From df111f8b44c0bee75967cb5f7f059f15d17e8593 Mon Sep 17 00:00:00 2001 From: Samuel-Martineau Date: Sat, 23 Sep 2023 14:05:49 -0400 Subject: [PATCH 01/56] Allow plugins to contribute DatasourcePlus integrations --- packages/backend-core/src/plugin/utils.ts | 20 ++++++++++++++++++- .../EditDatasourceConfigButton.svelte | 9 ++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/packages/backend-core/src/plugin/utils.ts b/packages/backend-core/src/plugin/utils.ts index f73ded0659..dcb45852a1 100644 --- a/packages/backend-core/src/plugin/utils.ts +++ b/packages/backend-core/src/plugin/utils.ts @@ -6,6 +6,7 @@ import { AutomationStepIdArray, AutomationIOType, AutomationCustomIOType, + DatasourceFeature, } from "@budibase/types" import joi from "joi" @@ -67,9 +68,26 @@ function validateDatasource(schema: any) { version: joi.string().optional(), schema: joi.object({ docs: joi.string(), + plus: joi.boolean().optional(), + auth: joi + .object({ + type: joi.string().required(), + }) + .optional(), + features: joi + .object( + Object.fromEntries( + Object.values(DatasourceFeature).map(key => [ + key, + joi.boolean().optional(), + ]) + ) + ) + .optional(), + relationships: joi.boolean().optional(), + description: joi.string().required(), friendlyName: joi.string().required(), type: joi.string().allow(...DATASOURCE_TYPES), - description: joi.string().required(), datasource: joi.object().pattern(joi.string(), fieldValidator).required(), query: joi .object() diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte index 9654b27b50..06b739e858 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte @@ -62,7 +62,14 @@ {/if}
- {getSubtitle(datasource)} + + {@const subtitle = getSubtitle(datasource)} + {#if subtitle} + {subtitle} + {:else} + {Object.values(datasource.config).join(" / ")} + {/if} +
From 2aac1c992a4723e07b3130ef76c54c8d08086fb0 Mon Sep 17 00:00:00 2001 From: Samuel-Martineau Date: Tue, 26 Sep 2023 21:26:40 -0400 Subject: [PATCH 02/56] Correct bugs with Datasource+ plugins --- packages/backend-core/src/plugin/utils.ts | 1 + .../design/settings/controls/SortableFieldSelect.svelte | 4 +++- packages/builder/src/stores/backend/datasources.js | 1 + packages/shared-core/src/helpers/integrations.ts | 2 +- packages/types/src/documents/app/datasource.ts | 1 + packages/types/src/sdk/datasources.ts | 1 + 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/backend-core/src/plugin/utils.ts b/packages/backend-core/src/plugin/utils.ts index dcb45852a1..8974a9f5a2 100644 --- a/packages/backend-core/src/plugin/utils.ts +++ b/packages/backend-core/src/plugin/utils.ts @@ -69,6 +69,7 @@ function validateDatasource(schema: any) { schema: joi.object({ docs: joi.string(), plus: joi.boolean().optional(), + isSQL: joi.boolean().optional(), auth: joi .object({ type: joi.string().required(), diff --git a/packages/builder/src/components/design/settings/controls/SortableFieldSelect.svelte b/packages/builder/src/components/design/settings/controls/SortableFieldSelect.svelte index 21ed68ce68..74b044e75e 100644 --- a/packages/builder/src/components/design/settings/controls/SortableFieldSelect.svelte +++ b/packages/builder/src/components/design/settings/controls/SortableFieldSelect.svelte @@ -20,7 +20,9 @@ const getSortableFields = schema => { return Object.entries(schema || {}) - .filter(entry => !UNSORTABLE_TYPES.includes(entry[1].type)) + .filter( + entry => !UNSORTABLE_TYPES.includes(entry[1].type) && entry[1].sortable + ) .map(entry => entry[0]) } diff --git a/packages/builder/src/stores/backend/datasources.js b/packages/builder/src/stores/backend/datasources.js index 7d2db44d6a..00384a6b1c 100644 --- a/packages/builder/src/stores/backend/datasources.js +++ b/packages/builder/src/stores/backend/datasources.js @@ -136,6 +136,7 @@ export function createDatasourcesStore() { config, name: `${integration.friendlyName}${nameModifier}`, plus: integration.plus && integration.name !== IntegrationTypes.REST, + isSQL: integration.isSQL, } if (await checkDatasourceValidity(integration, datasource)) { diff --git a/packages/shared-core/src/helpers/integrations.ts b/packages/shared-core/src/helpers/integrations.ts index b8c220c6a5..5cc8de880f 100644 --- a/packages/shared-core/src/helpers/integrations.ts +++ b/packages/shared-core/src/helpers/integrations.ts @@ -14,5 +14,5 @@ export function isSQL(datasource: Datasource): boolean { SourceName.MYSQL, SourceName.ORACLE, ] - return SQL.indexOf(datasource.source) !== -1 + return SQL.indexOf(datasource.source) !== -1 || datasource.isSQL === true } diff --git a/packages/types/src/documents/app/datasource.ts b/packages/types/src/documents/app/datasource.ts index 855006ea4c..67035a2e72 100644 --- a/packages/types/src/documents/app/datasource.ts +++ b/packages/types/src/documents/app/datasource.ts @@ -9,6 +9,7 @@ export interface Datasource extends Document { // the config is defined by the schema config?: Record plus?: boolean + isSQL?: boolean entities?: { [key: string]: Table } diff --git a/packages/types/src/sdk/datasources.ts b/packages/types/src/sdk/datasources.ts index d6a0d4a7c8..0e06b8fae0 100644 --- a/packages/types/src/sdk/datasources.ts +++ b/packages/types/src/sdk/datasources.ts @@ -140,6 +140,7 @@ export interface DatasourceConfig { export interface Integration { docs: string plus?: boolean + isSQL?: boolean auth?: { type: string } features?: Partial> relationships?: boolean From b4e0d98973c6395e36040f7789fb2f7995781f10 Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Fri, 29 Sep 2023 10:15:36 +0100 Subject: [PATCH 03/56] Add bindings support to meeting start / end dates (#11759) * Deprecate zapier+make values1..5 * Allow dates in meeting invite to be bindable * Add DrawerBindableSlot component * Show calendar icon * refactor * Use cancel icon * Disable cancel for JS bindings * WIP * WIP * WIP * Fix linkedIds svelte binding * Label and icon update * Handle arrays * Support text area * Add reactivity to text area icon * Support boolean * JSON support * Remove rowControl * Allow boolean field to have three states * lint * Refactor --------- Co-authored-by: Michael Drury --- .../builderStore/store/automation/index.js | 12 - .../FlowChart/FlowItem.svelte | 23 -- .../SetupPanel/AutomationBlockSetup.svelte | 84 ++---- .../automation/SetupPanel/RowSelector.svelte | 82 ++---- .../SetupPanel/RowSelectorTypes.svelte | 149 ++++++----- .../common/LinkedRowSelector.svelte | 6 +- .../common/bindings/DrawerBindableSlot.svelte | 250 ++++++++++++++++++ packages/server/src/automations/steps/make.ts | 8 +- .../server/src/automations/steps/zapier.ts | 8 +- 9 files changed, 376 insertions(+), 246 deletions(-) create mode 100644 packages/builder/src/components/common/bindings/DrawerBindableSlot.svelte diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index 4ebf0515d6..c22240370b 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -221,18 +221,6 @@ const automationActions = store => ({ newAutomation.definition.steps.splice(blockIdx, 0, block) await store.actions.save(newAutomation) }, - /** - * "rowControl" appears to be the name of the flag used to determine whether - * a certain automation block uses values or bindings as inputs - */ - toggleRowControl: async (block, rowControl) => { - const newBlock = { ...block, rowControl } - const newAutomation = store.actions.getUpdatedDefinition( - get(selectedAutomation), - newBlock - ) - await store.actions.save(newAutomation) - }, deleteAutomationBlock: async block => { const automation = get(selectedAutomation) let newAutomation = cloneDeep(automation) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index 85c3776fdb..6c964c84a9 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -7,7 +7,6 @@ Detail, Modal, Button, - Select, ActionButton, notifications, Label, @@ -39,9 +38,6 @@ step => step.stepId === ActionStepID.COLLECT ) $: automationId = $selectedAutomation?._id - $: showBindingPicker = - block.stepId === ActionStepID.CREATE_ROW || - block.stepId === ActionStepID.UPDATE_ROW $: isTrigger = block.type === "TRIGGER" $: steps = $selectedAutomation?.definition?.steps ?? [] $: blockIdx = steps.findIndex(step => step.id === block.id) @@ -96,15 +92,6 @@ } } - /** - * "rowControl" appears to be the name of the flag used to determine whether - * a certain automation block uses values or bindings as inputs - */ - function toggleRowControl(evt) { - const rowControl = evt.detail !== "Use values" - automationStore.actions.toggleRowControl(block, rowControl) - } - async function addLooping() { const loopDefinition = $automationStore.blockDefinitions.ACTION.LOOP const loopBlock = automationStore.actions.constructBlock( @@ -189,16 +176,6 @@ Add Looping {/if} - {#if showBindingPicker} - onChange(e, key)} @@ -469,7 +420,6 @@ /> {:else if value.customType === "row"} { diff --git a/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte b/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte index 5039c37ece..8c50689f22 100644 --- a/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte +++ b/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte @@ -1,18 +1,14 @@ -{#if schemaHasOptions(schema) && schema.type !== "array"} -