Merge branch 'master' of github.com:Budibase/budibase into develop

This commit is contained in:
mike12345567 2023-02-10 17:42:56 +00:00
commit 0c80ea2083
26 changed files with 151 additions and 68 deletions

View File

@ -55,7 +55,7 @@ http {
set $csp_style "style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://fonts.googleapis.com https://rsms.me https://maxcdn.bootstrapcdn.com";
set $csp_object "object-src 'none'";
set $csp_base_uri "base-uri 'self'";
set $csp_connect "connect-src 'self' https://*.budibase.net https://api-iam.intercom.io https://api-iam.intercom.io https://api-ping.intercom.io https://app.posthog.com wss://nexus-websocket-a.intercom.io wss://nexus-websocket-b.intercom.io https://nexus-websocket-a.intercom.io https://nexus-websocket-b.intercom.io https://uploads.intercomcdn.com https://uploads.intercomusercontent.com https://*.s3.amazonaws.com https://*.s3.us-east-2.amazonaws.com https://*.s3.us-east-1.amazonaws.com https://*.s3.us-west-1.amazonaws.com https://*.s3.us-west-2.amazonaws.com https://*.s3.af-south-1.amazonaws.com https://*.s3.ap-east-1.amazonaws.com https://*.s3.ap-southeast-3.amazonaws.com https://*.s3.ap-south-1.amazonaws.com https://*.s3.ap-northeast-3.amazonaws.com https://*.s3.ap-northeast-2.amazonaws.com https://*.s3.ap-southeast-1.amazonaws.com https://*.s3.ap-southeast-2.amazonaws.com https://*.s3.ap-northeast-1.amazonaws.com https://*.s3.ca-central-1.amazonaws.com https://*.s3.cn-north-1.amazonaws.com https://*.s3.cn-northwest-1.amazonaws.com https://*.s3.eu-central-1.amazonaws.com https://*.s3.eu-west-1.amazonaws.com https://*.s3.eu-west-2.amazonaws.com https://*.s3.eu-south-1.amazonaws.com https://*.s3.eu-west-3.amazonaws.com https://*.s3.eu-north-1.amazonaws.com https://*.s3.sa-east-1.amazonaws.com https://*.s3.me-south-1.amazonaws.com https://*.s3.us-gov-east-1.amazonaws.com https://*.s3.us-gov-west-1.amazonaws.com";
set $csp_connect "connect-src 'self' https://*.budibase.net https://api-iam.intercom.io https://api-iam.intercom.io https://api-ping.intercom.io https://app.posthog.com wss://nexus-websocket-a.intercom.io wss://nexus-websocket-b.intercom.io https://nexus-websocket-a.intercom.io https://nexus-websocket-b.intercom.io https://uploads.intercomcdn.com https://uploads.intercomusercontent.com https://*.s3.amazonaws.com https://*.s3.us-east-2.amazonaws.com https://*.s3.us-east-1.amazonaws.com https://*.s3.us-west-1.amazonaws.com https://*.s3.us-west-2.amazonaws.com https://*.s3.af-south-1.amazonaws.com https://*.s3.ap-east-1.amazonaws.com https://*.s3.ap-southeast-3.amazonaws.com https://*.s3.ap-south-1.amazonaws.com https://*.s3.ap-northeast-3.amazonaws.com https://*.s3.ap-northeast-2.amazonaws.com https://*.s3.ap-southeast-1.amazonaws.com https://*.s3.ap-southeast-2.amazonaws.com https://*.s3.ap-northeast-1.amazonaws.com https://*.s3.ca-central-1.amazonaws.com https://*.s3.cn-north-1.amazonaws.com https://*.s3.cn-northwest-1.amazonaws.com https://*.s3.eu-central-1.amazonaws.com https://*.s3.eu-west-1.amazonaws.com https://*.s3.eu-west-2.amazonaws.com https://*.s3.eu-south-1.amazonaws.com https://*.s3.eu-west-3.amazonaws.com https://*.s3.eu-north-1.amazonaws.com https://*.s3.sa-east-1.amazonaws.com https://*.s3.me-south-1.amazonaws.com https://*.s3.us-gov-east-1.amazonaws.com https://*.s3.us-gov-west-1.amazonaws.com https://api.github.com";
set $csp_font "font-src 'self' data: https://cdn.jsdelivr.net https://fonts.gstatic.com https://rsms.me https://maxcdn.bootstrapcdn.com https://js.intercomcdn.com https://fonts.intercomcdn.com";
set $csp_frame "frame-src 'self' https:";
set $csp_img "img-src http: https: data: blob:";

View File

@ -1,5 +1,5 @@
{
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
@ -24,7 +24,7 @@
"dependencies": {
"@budibase/nano": "10.1.1",
"@budibase/pouchdb-replication-stream": "1.2.10",
"@budibase/types": "2.3.2-alpha.3",
"@budibase/types": "^2.3.10",
"@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-cloudfront-sign": "2.2.0",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"license": "MPL-2.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",
@ -38,7 +38,7 @@
],
"dependencies": {
"@adobe/spectrum-css-workflow-icons": "1.2.1",
"@budibase/string-templates": "2.3.2-alpha.3",
"@budibase/string-templates": "^2.3.10",
"@spectrum-css/accordion": "3.0.24",
"@spectrum-css/actionbutton": "1.0.1",
"@spectrum-css/actiongroup": "1.0.1",

View File

@ -1,5 +1,5 @@
<script>
import { createEventDispatcher } from "svelte"
import { createEventDispatcher, onMount } from "svelte"
import FancyField from "./FancyField.svelte"
import FancyFieldLabel from "./FancyFieldLabel.svelte"
import { fade } from "svelte/transition"
@ -14,8 +14,11 @@
const dispatch = createEventDispatcher()
let ref
let focused = false
$: placeholder = !focused && !value
let autofilled = false
$: placeholder = !autofilled && !focused && !value
const onChange = e => {
const newValue = e.target.value
@ -25,6 +28,27 @@
error = validate(newValue)
}
}
onMount(() => {
// Start watching for autofill every 100ms
const interval = setInterval(() => {
autofilled = ref?.matches(":-webkit-autofill")
if (autofilled) {
clearInterval(interval)
}
}, 100)
// Give up after 2 seconds and assume autofill has not been used
const timeout = setTimeout(() => {
clearInterval(interval)
}, 2000)
// Cleanup
return () => {
clearInterval(interval)
clearTimeout(timeout)
}
})
</script>
<FancyField {error} {value} {validate} {disabled} {focused}>
@ -39,6 +63,7 @@
on:focus={() => (focused = true)}
on:blur={() => (focused = false)}
class:placeholder
bind:this={ref}
/>
{#if suffix && !placeholder}
<div in:fade|local={{ duration: 130 }} class="suffix">{suffix}</div>
@ -74,4 +99,11 @@
line-height: 17px;
font-family: var(--font-sans);
}
input:-webkit-autofill {
border-radius: 2px;
-webkit-box-shadow: 0 0 0 100px var(--spectrum-global-color-gray-300) inset;
-webkit-text-fill-color: var(--spectrum-global-color-gray-900);
transition: -webkit-box-shadow 130ms 200ms, background-color 0s 86400s;
padding: 3px 8px 4px 8px;
}
</style>

View File

@ -13,6 +13,7 @@
export let quiet = false
export let align
export let autofocus = false
export let autocomplete = null
const dispatch = createEventDispatcher()
@ -103,6 +104,7 @@
class="spectrum-Textfield-input"
style={align ? `text-align: ${align};` : ""}
inputmode={type === "number" ? "decimal" : "text"}
{autocomplete}
/>
</div>

View File

@ -14,6 +14,7 @@
export let updateOnChange = true
export let quiet = false
export let autofocus
export let autocomplete
const dispatch = createEventDispatcher()
const onChange = e => {
@ -33,6 +34,7 @@
{type}
{quiet}
{autofocus}
{autocomplete}
on:change={onChange}
on:click
on:input

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -58,10 +58,10 @@
}
},
"dependencies": {
"@budibase/bbui": "2.3.2-alpha.3",
"@budibase/client": "2.3.2-alpha.3",
"@budibase/frontend-core": "2.3.2-alpha.3",
"@budibase/string-templates": "2.3.2-alpha.3",
"@budibase/bbui": "^2.3.10",
"@budibase/client": "^2.3.10",
"@budibase/frontend-core": "^2.3.10",
"@budibase/string-templates": "^2.3.10",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1",

View File

@ -75,16 +75,20 @@
editableColumn.constraints.presence = { allowEmpty: false }
}
$: if (field && !savingColumn) {
editableColumn = cloneDeep(field)
originalName = editableColumn.name ? editableColumn.name + "" : null
linkEditDisabled = originalName != null
isCreating = originalName == null
primaryDisplay =
$tables.selected.primaryDisplay == null ||
$tables.selected.primaryDisplay === editableColumn.name
const initialiseField = (field, savingColumn) => {
if (field && !savingColumn) {
editableColumn = cloneDeep(field)
originalName = editableColumn.name ? editableColumn.name + "" : null
linkEditDisabled = originalName != null
isCreating = originalName == null
primaryDisplay =
$tables.selected.primaryDisplay == null ||
$tables.selected.primaryDisplay === editableColumn.name
}
}
$: initialiseField(field, savingColumn)
$: checkConstraints(editableColumn)
$: required = !!editableColumn?.constraints?.presence || primaryDisplay
$: uneditable =
@ -583,7 +587,12 @@
title="Formula"
label="Formula"
value={editableColumn.formula}
on:change={e => (editableColumn.formula = e.detail)}
on:change={e => {
editableColumn = {
...editableColumn,
formula: e.detail,
}
}}
bindings={getBindings({ table })}
allowJS
/>

View File

@ -71,6 +71,7 @@
}
}}
value={productionValue}
autocomplete="new-password"
/>
</div>
<div>
@ -83,6 +84,7 @@
disabled={useProductionValue}
label="Value"
value={useProductionValue ? productionValue : developmentValue}
autocomplete="new-password"
/>
<Checkbox bind:value={useProductionValue} text="Use production value" />
</div>

View File

@ -62,6 +62,7 @@ const getTours = () => {
id: TOUR_STEP_KEYS.BUILDER_APP_PUBLISH,
title: "Publish",
layout: OnboardingPublish,
route: "/builder/app/:application/design",
query: ".toprightnav #builder-app-publish-button",
onLoad: () => {
tourEvent(TOUR_STEP_KEYS.BUILDER_APP_PUBLISH)

View File

@ -147,8 +147,8 @@
options: setting.options || [],
// Number fields
min: setting.min || null,
max: setting.max || null,
min: setting.min ?? null,
max: setting.max ?? null,
}}
{bindings}
{componentBindings}

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {
@ -26,9 +26,9 @@
"outputPath": "build"
},
"dependencies": {
"@budibase/backend-core": "2.3.2-alpha.3",
"@budibase/string-templates": "2.3.2-alpha.3",
"@budibase/types": "2.3.2-alpha.3",
"@budibase/backend-core": "^2.3.10",
"@budibase/string-templates": "^2.3.10",
"@budibase/types": "^2.3.10",
"axios": "0.21.2",
"chalk": "4.1.0",
"cli-progress": "3.11.2",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -19,9 +19,9 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/bbui": "2.3.2-alpha.3",
"@budibase/frontend-core": "2.3.2-alpha.3",
"@budibase/string-templates": "2.3.2-alpha.3",
"@budibase/bbui": "^2.3.10",
"@budibase/frontend-core": "^2.3.10",
"@budibase/string-templates": "^2.3.10",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",

View File

@ -1,12 +1,12 @@
{
"name": "@budibase/frontend-core",
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
"@budibase/bbui": "2.3.2-alpha.3",
"@budibase/bbui": "^2.3.10",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"description": "Budibase Public API SDK",
"author": "Budibase",
"license": "MPL-2.0",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -43,11 +43,11 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "2.3.2-alpha.3",
"@budibase/client": "2.3.2-alpha.3",
"@budibase/pro": "2.3.2-alpha.3",
"@budibase/string-templates": "2.3.2-alpha.3",
"@budibase/types": "2.3.2-alpha.3",
"@budibase/backend-core": "^2.3.10",
"@budibase/client": "^2.3.10",
"@budibase/pro": "2.3.10",
"@budibase/string-templates": "^2.3.10",
"@budibase/types": "^2.3.10",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",

View File

@ -191,7 +191,7 @@ export async function validate(ctx: BBContext) {
}
export async function exportRows(ctx: BBContext) {
const { datasourceId } = breakExternalTableId(ctx.params.tableId)
const { datasourceId, tableName } = breakExternalTableId(ctx.params.tableId)
const format = ctx.query.format
const { columns } = ctx.request.body
const datasource = await sdk.datasources.get(datasourceId!)
@ -227,7 +227,9 @@ export async function exportRows(ctx: BBContext) {
rows = result.rows
}
// @ts-ignore
if (!tableName) {
ctx.throw(400, "Could not find table name.")
}
let schema = datasource.entities[tableName].schema
let exportRows = cleanExportRows(rows, schema, format, columns)

View File

@ -104,7 +104,6 @@ export function importToRows(data: any, table: any, user: any = {}) {
const processed: any = inputProcessing(user, table, row, {
noAutoRelationships: true,
})
table = processed.table
row = processed.row
let fieldName: any
@ -113,6 +112,7 @@ export function importToRows(data: any, table: any, user: any = {}) {
// check whether the options need to be updated for inclusion as part of the data import
if (
schema.type === FieldTypes.OPTIONS &&
row[fieldName] &&
(!schema.constraints.inclusion ||
schema.constraints.inclusion.indexOf(row[fieldName]) === -1)
) {
@ -120,6 +120,7 @@ export function importToRows(data: any, table: any, user: any = {}) {
...schema.constraints.inclusion,
row[fieldName],
]
schema.constraints.inclusion.sort()
}
}

View File

@ -67,6 +67,15 @@ if (
INTEGRATIONS[SourceName.ORACLE] = oracle.integration
}
export async function getDefinition(source: SourceName): Promise<Integration> {
// check if its integrated, faster
if (DEFINITIONS[source]) {
return DEFINITIONS[source]
}
const allDefinitions = await getDefinitions()
return allDefinitions[source]
}
export async function getDefinitions() {
const pluginSchemas: { [key: string]: Integration } = {}
if (env.SELF_HOSTED) {

View File

@ -26,7 +26,7 @@ interface MSSQLConfig {
user: string
password: string
server: string
port: number
port: number | string
database: string
schema: string
encrypt?: boolean

View File

@ -3,6 +3,7 @@ import { findHBSBlocks, processObjectSync } from "@budibase/string-templates"
import {
Datasource,
DatasourceFieldType,
Integration,
PASSWORD_REPLACEMENT,
RestAuthConfig,
RestAuthType,
@ -11,16 +12,38 @@ import {
} from "@budibase/types"
import { cloneDeep } from "lodash/fp"
import { getEnvironmentVariables } from "../../utils"
import { getDefinitions } from "../../../integrations"
import { getDefinitions, getDefinition } from "../../../integrations"
const ENV_VAR_PREFIX = "env."
export function checkDatasourceTypes(schema: Integration, config: any) {
for (let key of Object.keys(config)) {
if (!schema.datasource[key]) {
continue
}
const type = schema.datasource[key].type
if (
type === DatasourceFieldType.NUMBER &&
typeof config[key] === "string"
) {
config[key] = parseFloat(config[key])
}
}
return config
}
async function enrichDatasourceWithValues(datasource: Datasource) {
const cloned = cloneDeep(datasource)
const env = await getEnvironmentVariables()
const processed = processObjectSync(cloned, { env }, { onlyFound: true })
const processed = processObjectSync(
cloned,
{ env },
{ onlyFound: true }
) as Datasource
const definition = await getDefinition(processed.source)
processed.config = checkDatasourceTypes(definition, processed.config)
return {
datasource: processed as Datasource,
datasource: processed,
envVars: env as Record<string, string>,
}
}

View File

@ -464,13 +464,17 @@ export function execute(job: Job, callback: WorkerCallback) {
throw new Error("Unable to execute, event doesn't contain app ID.")
}
return context.doInAppContext(appId, async () => {
const automationOrchestrator = new Orchestrator(job)
try {
const response = await automationOrchestrator.execute()
callback(null, response)
} catch (err) {
callback(err)
}
const envVars = await sdkUtils.getEnvironmentVariables()
// put into automation thread for whole context
await context.doInEnvironmentContext(envVars, async () => {
const automationOrchestrator = new Orchestrator(job)
try {
const response = await automationOrchestrator.execute()
callback(null, response)
} catch (err) {
callback(err)
}
})
})
}
@ -480,11 +484,7 @@ export const removeStalled = async (job: Job) => {
throw new Error("Unable to execute, event doesn't contain app ID.")
}
await context.doInAppContext(appId, async () => {
const envVars = await sdkUtils.getEnvironmentVariables()
// put into automation thread for whole context
await context.doInEnvironmentContext(envVars, async () => {
const automationOrchestrator = new Orchestrator(job)
await automationOrchestrator.stopCron("stalled")
})
const automationOrchestrator = new Orchestrator(job)
await automationOrchestrator.stopCron("stalled")
})
}

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/types",
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"description": "Budibase types",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "2.3.2-alpha.3",
"version": "2.3.10",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -36,10 +36,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "2.3.2-alpha.3",
"@budibase/pro": "2.3.2-alpha.3",
"@budibase/string-templates": "2.3.2-alpha.3",
"@budibase/types": "2.3.2-alpha.3",
"@budibase/backend-core": "^2.3.10",
"@budibase/pro": "2.3.10",
"@budibase/string-templates": "^2.3.10",
"@budibase/types": "^2.3.10",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",