From 3da65773480c7f57150e820a310ae185e3bfa216 Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Thu, 26 Aug 2021 08:53:58 +0200 Subject: [PATCH 1/6] rename automation --- .../builderStore/store/automation/index.js | 17 +++-- .../EditAutomationPopover.svelte | 15 ++-- .../UpdateAutomationModal.svelte | 76 +++++++++++++++++++ 3 files changed, 92 insertions(+), 16 deletions(-) create mode 100644 packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index c372f27bb7..f522c7bba1 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -46,21 +46,24 @@ const automationActions = store => ({ return state }) }, - save: async ({ automation }) => { + save: async automation => { const UPDATE_AUTOMATION_URL = `/api/automations` const response = await api.put(UPDATE_AUTOMATION_URL, automation) const json = await response.json() store.update(state => { + const newAutomation = json.automation const existingIdx = state.automations.findIndex( existing => existing._id === automation._id ) - state.automations.splice(existingIdx, 1, json.automation) - state.automations = state.automations - store.actions.select(json.automation) - return state + if (existingIdx !== -1) { + state.automations.splice(existingIdx, 1, newAutomation) + state.automations = [...state.automations] + store.actions.select(newAutomation) + return state + } }) }, - delete: async ({ automation }) => { + delete: async automation => { const { _id, _rev } = automation const DELETE_AUTOMATION_URL = `/api/automations/${_id}/${_rev}` await api.delete(DELETE_AUTOMATION_URL) @@ -70,7 +73,7 @@ const automationActions = store => ({ existing => existing._id === _id ) state.automations.splice(existingIdx, 1) - state.automations = state.automations + state.automations = [...state.automations] state.selectedAutomation = null state.selectedBlock = null return state diff --git a/packages/builder/src/components/automation/AutomationPanel/EditAutomationPopover.svelte b/packages/builder/src/components/automation/AutomationPanel/EditAutomationPopover.svelte index a99c11e9e1..fc12b60676 100644 --- a/packages/builder/src/components/automation/AutomationPanel/EditAutomationPopover.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/EditAutomationPopover.svelte @@ -1,20 +1,17 @@ + + + + + + + Learn about automations + + + + + From 7f9e8fa32156f4f9a1507c409b84c23b8ba99d89 Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Thu, 26 Aug 2021 15:58:24 +0200 Subject: [PATCH 2/6] fix calls to automations.save, which doesn't need the instanceId --- .../components/automation/SetupPanel/SetupPanel.svelte | 9 ++------- .../automation/Shared/CreateWebhookModal.svelte | 5 +---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte b/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte index 3ba59f36a6..65e0009ba9 100644 --- a/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte +++ b/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte @@ -1,13 +1,11 @@ diff --git a/packages/builder/src/components/automation/Shared/CreateWebhookModal.svelte b/packages/builder/src/components/automation/Shared/CreateWebhookModal.svelte index 04656c1e2e..ac63ba6a47 100644 --- a/packages/builder/src/components/automation/Shared/CreateWebhookModal.svelte +++ b/packages/builder/src/components/automation/Shared/CreateWebhookModal.svelte @@ -18,10 +18,7 @@ onMount(async () => { if (!automation?.definition?.trigger?.inputs.schemaUrl) { // save the automation initially - await automationStore.actions.save({ - instanceId, - automation, - }) + await automationStore.actions.save(automation) } interval = setInterval(async () => { await automationStore.actions.fetch() From d3f79cf464b75cc5d1e004c3eb308cad7e507b14 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 16 Sep 2021 16:37:59 +0000 Subject: [PATCH 3/6] v0.9.125-alpha.13 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 6 +++--- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lerna.json b/lerna.json index ee79ebf8c4..6171a81f87 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.125-alpha.12", + "version": "0.9.125-alpha.13", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 46365eafbf..4fc09157b0 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.125-alpha.12", + "version": "0.9.125-alpha.13", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index c10076082a..6b4b21e61b 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.125-alpha.12", + "version": "0.9.125-alpha.13", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index b3684ec6fd..9c6c62aa8a 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.125-alpha.12", + "version": "0.9.125-alpha.13", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.125-alpha.12", - "@budibase/client": "^0.9.125-alpha.12", + "@budibase/bbui": "^0.9.125-alpha.13", + "@budibase/client": "^0.9.125-alpha.13", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.125-alpha.12", + "@budibase/string-templates": "^0.9.125-alpha.13", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 5a5803e877..635759becb 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.125-alpha.12", + "version": "0.9.125-alpha.13", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 4d139e69fa..0751ae6a9f 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.125-alpha.12", + "version": "0.9.125-alpha.13", "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": "^0.9.125-alpha.12", + "@budibase/bbui": "^0.9.125-alpha.13", "@budibase/standard-components": "^0.9.124", - "@budibase/string-templates": "^0.9.125-alpha.12", + "@budibase/string-templates": "^0.9.125-alpha.13", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/package.json b/packages/server/package.json index ba7f46e671..a3bb9d5d20 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.125-alpha.12", + "version": "0.9.125-alpha.13", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -64,9 +64,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.125-alpha.12", - "@budibase/client": "^0.9.125-alpha.12", - "@budibase/string-templates": "^0.9.125-alpha.12", + "@budibase/auth": "^0.9.125-alpha.13", + "@budibase/client": "^0.9.125-alpha.13", + "@budibase/string-templates": "^0.9.125-alpha.13", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 07b5bc0e49..c9ca671546 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.125-alpha.12", + "version": "0.9.125-alpha.13", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index ad5d548a6e..29300ba946 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.125-alpha.12", + "version": "0.9.125-alpha.13", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -25,8 +25,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.125-alpha.12", - "@budibase/string-templates": "^0.9.125-alpha.12", + "@budibase/auth": "^0.9.125-alpha.13", + "@budibase/string-templates": "^0.9.125-alpha.13", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 518f8fd55e98b8c4ca3bf239994c75da92ba5046 Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Thu, 16 Sep 2021 22:15:09 +0200 Subject: [PATCH 4/6] merge develop into branch --- .github/workflows/release.yml | 27 +- LICENSE | 3 +- SECURITY.md | 15 + hosting/docker-compose.yaml | 9 +- hosting/hosting.properties | 1 + .../templates/worker-service-deployment.yaml | 2 + hosting/kubernetes/budibase/values.yaml | 17 +- hosting/kubernetes/envoy/envoy.yaml | 20 +- lerna.json | 2 +- package.json | 3 +- packages/auth/package.json | 2 +- packages/auth/src/cache/user.js | 30 +- packages/auth/src/db/utils.js | 33 +- packages/auth/src/index.js | 2 + packages/auth/src/middleware/appTenancy.js | 25 + packages/auth/src/middleware/authenticated.js | 15 +- packages/auth/src/middleware/index.js | 2 + packages/auth/src/middleware/tenancy.js | 9 +- packages/auth/src/redis/index.js | 6 +- packages/auth/src/redis/utils.js | 14 +- packages/auth/src/tenancy/context.js | 4 +- packages/bbui/package.json | 2 +- .../bbui/src/ActionButton/ActionButton.svelte | 5 + packages/bbui/src/Badge/Badge.svelte | 2 + packages/bbui/src/Drawer/Drawer.svelte | 9 +- packages/bbui/src/Form/Core/DatePicker.svelte | 2 + packages/bbui/src/Form/DatePicker.svelte | 2 + packages/bbui/src/Icon/Icon.svelte | 2 +- packages/bbui/src/Layout/Page.svelte | 3 - packages/bbui/src/Modal/ModalContent.svelte | 7 + .../src/ProgressCircle/ProgressCircle.svelte | 4 +- packages/bbui/src/SideNavigation/Item.svelte | 1 + packages/bbui/src/Table/ArrayRenderer.svelte | 17 + packages/bbui/src/Table/CellRenderer.svelte | 3 +- packages/bbui/src/Table/Table.svelte | 3 +- packages/builder/assets/discord.svg | 10 + packages/builder/assets/integromat.png | Bin 0 -> 26614 bytes packages/builder/assets/n8n.png | Bin 0 -> 3078 bytes packages/builder/assets/slack.svg | 33 + packages/builder/assets/zapier.png | Bin 0 -> 12359 bytes .../integration/createAutomation.spec.js | 59 +- packages/builder/cypress/setup.js | 1 + packages/builder/cypress/support/commands.js | 20 +- packages/builder/package.json | 8 +- packages/builder/src/analytics.js | 2 + .../builder/src/builderStore/dataBinding.js | 70 +- .../store/automation/Automation.js | 4 + .../builderStore/store/automation/index.js | 20 +- .../src/builderStore/store/frontend.js | 28 + .../store/screenTemplates/newRowScreen.js | 1 + .../store/screenTemplates/rowDetailScreen.js | 1 - .../store/screenTemplates/rowListScreen.js | 1 + .../screenTemplates/utils/commonComponents.js | 8 + .../AutomationBuilder.svelte | 3 - .../AutomationBuilder/BlockList.svelte | 108 - .../FlowChart/ActionModal.svelte | 136 + .../AutomationBuilder/FlowChart/Arrow.svelte | 1 + .../FlowChart/ExternalActions.js | 11 + .../FlowChart/FlowChart.svelte | 135 +- .../FlowChart/FlowItem.svelte | 228 +- .../FlowChart/ResultsModal.svelte | 114 + .../FlowChart/TestDataModal.svelte | 88 + .../AutomationPanel/AutomationList.svelte | 1 - .../AutomationPanel/AutomationPanel.svelte | 6 +- .../CreateAutomationModal.svelte | 104 +- .../SetupPanel/AutomationBlockSetup.svelte | 211 +- .../automation/SetupPanel/CronBuilder.svelte | 11 +- .../SetupPanel/QueryParamSelector.svelte | 1 + .../automation/SetupPanel/RowSelector.svelte | 49 +- .../automation/SetupPanel/SchemaSetup.svelte | 13 +- .../automation/SetupPanel/SetupPanel.svelte | 91 - .../SetupPanel/TableSelector.svelte | 9 + .../backend/DataTable/RowFieldControl.svelte | 11 +- .../DataTable/modals/CreateEditColumn.svelte | 5 + .../DataTable/modals/ExportModal.svelte | 4 +- .../DatasourceNavigator.svelte | 20 +- .../modals/UpdateDatasourceModal.svelte | 4 +- .../popovers/EditDatasourcePopover.svelte | 2 +- .../TableNavigator/TableDataImport.svelte | 4 + .../components/common/ConfigChecklist.svelte | 38 +- .../src/components/common/NavItem.svelte | 10 +- .../bindings/DrawerBindableInput.svelte | 3 +- .../design/AppPreview/AppThemeSelect.svelte | 2 +- .../AppPreview/ComponentSelectionList.svelte | 5 +- .../AppPreview/CurrentItemPreview.svelte | 77 +- .../AppPreview/DevicePreviewSelect.svelte | 22 + .../design/AppPreview/ThemeEditor.svelte | 140 + .../design/AppPreview/componentStructure.json | 3 +- .../design/AppPreview/iframeTemplate.js | 14 +- .../NavigationPanel/NewScreenModal.svelte | 5 +- .../PropertyControls/DataSourceSelect.svelte | 2 +- .../EventsEditor/EventEditor.svelte | 3 +- .../EventsEditor/actions/UpdateState.svelte | 65 + .../EventsEditor/actions/index.js | 99 +- .../FilterEditor/FilterDrawer.svelte | 31 +- .../ValidationEditor/ValidationDrawer.svelte | 24 +- .../PropertyControls/componentSettings.js | 2 + .../components/integration/QueryViewer.svelte | 1 + .../src/components/start/AppCard.svelte | 4 +- .../src/components/start/AppRow.svelte | 14 +- .../components/start/CreateAppModal.svelte | 2 +- .../components/start/UpdateAppModal.svelte | 4 +- .../builder/src/constants/backend/index.js | 9 + packages/builder/src/helpers/lucene.js | 10 + .../builder/src/pages/builder/_layout.svelte | 27 +- .../src/pages/builder/admin/_layout.svelte | 2 +- .../builder/app/[application]/_layout.svelte | 2 +- .../app/[application]/automate/_layout.svelte | 68 +- .../app/[application]/automate/index.svelte | 10 - .../design/[assetType]/_layout.svelte | 23 +- .../src/pages/builder/apps/index.svelte | 35 +- .../src/pages/builder/auth/_layout.svelte | 7 +- .../builder/src/pages/builder/auth/org.svelte | 3 +- .../src/pages/builder/portal/_layout.svelte | 150 +- .../pages/builder/portal/apps/index.svelte | 8 +- .../builder/portal/manage/auth/index.svelte | 110 +- .../portal/manage/email/[template].svelte | 155 +- .../builder/portal/manage/email/index.svelte | 4 +- .../portal/manage/users/[userId].svelte | 2 +- .../builder/portal/manage/users/index.svelte | 2 +- .../portal/settings/organisation.svelte | 18 +- .../builder/portal/settings/theming.svelte | 4 +- .../builder/portal/settings/update.svelte | 34 +- packages/builder/src/stores/backend/tables.js | 1 - packages/builder/src/stores/portal/admin.js | 37 +- packages/cli/package.json | 2 +- packages/cli/src/constants.js | 5 +- packages/cli/src/hosting/makeEnv.js | 1 + .../{standard-components => client}/README.md | 0 .../manifest.json | 146 +- packages/client/package.json | 25 +- packages/client/rollup.config.js | 34 + packages/client/src/api/api.js | 4 +- packages/client/src/api/automations.js | 3 +- packages/client/src/api/queries.js | 2 +- packages/client/src/api/rows.js | 28 +- .../client/src/components/ClientApp.svelte | 159 +- .../client/src/components/Component.svelte | 19 +- .../src/components/CustomThemeWrapper.svelte | 79 + packages/client/src/components/Router.svelte | 2 +- packages/client/src/components/Screen.svelte | 4 +- .../components/app}/BackgroundImage.svelte | 0 .../src/components/app}/Button.svelte | 0 .../src/components/app}/CardStat.svelte | 2 +- .../src/components/app}/Container.svelte | 0 .../src/components/app}/DataProvider.svelte | 2 +- .../components/app}/DateRangePicker.svelte | 0 .../src/components/app}/Divider.svelte | 0 .../src/components/app}/Embed.svelte | 0 .../src/components/app}/ErrorsBox.svelte | 0 .../src/components/app}/Heading.svelte | 0 .../src/components/app}/Icon.svelte | 11 +- .../src/components/app}/Image.svelte | 0 .../src/components/app}/Layout.svelte | 225 +- .../src/components/app}/Link.svelte | 2 +- .../src/components/app}/Placeholder.svelte | 0 .../src/components/app}/Repeater.svelte | 0 .../src/components/app}/ScreenSlot.svelte | 0 .../src/components/app}/Section.svelte | 0 .../src/components/app}/SpectrumCard.svelte | 2 +- .../src/components/app}/Text.svelte | 0 .../components/app}/charts/ApexChart.svelte | 0 .../app}/charts/ApexOptionsBuilder.js | 34 +- .../components/app}/charts/AreaChart.svelte | 0 .../components/app}/charts/BarChart.svelte | 20 +- .../app}/charts/CandleStickChart.svelte | 0 .../components/app}/charts/DonutChart.svelte | 0 .../components/app}/charts/LineChart.svelte | 4 +- .../components/app}/charts/PieChart.svelte | 0 .../src/components/app}/charts/index.js | 0 .../components/app}/deprecated/Card.svelte | 0 .../app}/deprecated/CardHorizontal.svelte | 0 .../app}/deprecated/Navigation.svelte | 0 .../app}/deprecated/StackedList.svelte | 0 .../app}/forms/AttachmentField.svelte | 0 .../components/app}/forms/BooleanField.svelte | 0 .../app}/forms/DateTimeField.svelte | 1 + .../src/components/app}/forms/Field.svelte | 1 + .../components/app}/forms/FieldGroup.svelte | 0 .../app}/forms/FieldGroupFallback.svelte | 0 .../src/components/app}/forms/Form.svelte | 7 +- .../src/components/app}/forms/FormStep.svelte | 0 .../components/app}/forms/InnerForm.svelte | 29 +- .../app}/forms/LongFormField.svelte | 0 .../app/forms/MultiFieldSelect.svelte | 58 + .../components/app}/forms/NumberField.svelte | 0 .../components/app}/forms/OptionsField.svelte | 38 +- .../app}/forms/PasswordField.svelte | 0 .../app}/forms/RelationshipField.svelte | 0 .../components/app}/forms/StringField.svelte | 0 .../src/components/app}/forms/index.js | 1 + .../src/components/app/forms/optionsParser.js | 47 + .../src/components/app}/forms/validation.js | 20 +- .../src/components/app}/index.js | 3 - .../components/app}/table/SlotRenderer.svelte | 0 .../src/components/app}/table/Table.svelte | 3 +- .../src/components/app}/table/index.js | 0 .../DeviceBindingsProvider.svelte | 6 +- .../components/{ => context}/Provider.svelte | 4 +- .../context/StateBindingsProvider.svelte | 8 + .../{ => context}/UserBindingsProvider.svelte | 4 +- .../{ => overlay}/ConfirmationDisplay.svelte | 2 +- .../{ => overlay}/NotificationDisplay.svelte | 2 +- .../{ => overlay}/PeekScreenDisplay.svelte | 2 +- .../components/preview/HoverIndicator.svelte | 2 +- .../src/components/preview/Indicator.svelte | 22 +- .../components/preview/IndicatorSet.svelte | 13 +- .../preview/SelectionIndicator.svelte | 2 +- .../src/components/preview/SettingsBar.svelte | 19 +- .../components/preview/SettingsButton.svelte | 2 +- .../preview/SettingsColorPicker.svelte | 2 +- .../components/preview/SettingsPicker.svelte | 2 +- packages/client/src/index.js | 8 +- packages/client/src/sdk.js | 12 +- packages/client/src/{store => stores}/app.js | 0 packages/client/src/{store => stores}/auth.js | 0 .../client/src/{store => stores}/builder.js | 5 +- .../src/{store => stores}/confirmation.js | 0 .../client/src/{store => stores}/context.js | 0 .../src/{store => stores}/dataSource.js | 0 .../client/src/{store => stores}/index.js | 2 + .../src/{store => stores}/initialise.js | 0 .../src/{store => stores}/notification.js | 0 packages/client/src/{store => stores}/peek.js | 0 .../client/src/{store => stores}/routes.js | 0 .../client/src/{store => stores}/screens.js | 0 packages/client/src/stores/state.js | 54 + packages/client/src/stores/theme.js | 65 + packages/client/src/utils/buttonActions.js | 17 +- packages/client/src/utils/conditions.js | 5 +- packages/client/src/utils/hash.js | 12 - .../src => client/src/utils}/helpers.js | 16 + packages/client/src/utils/linkable.js | 2 +- .../src => client/src/utils}/lucene.js | 6 +- packages/client/src/utils/styleable.js | 2 +- packages/client/yarn.lock | 1396 +++++- packages/server/package.json | 25 +- packages/server/scripts/selfhost.js | 8 + .../server/src/api/controllers/application.js | 11 +- .../server/src/api/controllers/automation.js | 220 +- .../server/src/api/controllers/datasource.js | 4 +- .../src/api/controllers/deploy/index.js | 24 +- .../server/src/api/controllers/metadata.js | 46 + packages/server/src/api/controllers/query.js | 2 - .../api/controllers/row/ExternalRequest.ts | 142 +- .../server/src/api/controllers/row/index.js | 1 + .../src/api/controllers/row/internal.js | 64 +- .../src/api/controllers/row/internalSearch.js | 2 +- .../server/src/api/controllers/row/utils.js | 16 +- .../src/api/controllers/static/index.js | 40 +- .../static/templates/BudibaseApp.svelte | 5 +- .../server/src/api/controllers/table/utils.js | 11 + packages/server/src/api/controllers/user.js | 3 +- packages/server/src/api/index.js | 30 +- packages/server/src/api/routes/automation.js | 31 +- packages/server/src/api/routes/index.js | 2 + packages/server/src/api/routes/metadata.js | 38 + packages/server/src/api/routes/static.js | 1 - .../src/api/routes/tests/automation.spec.js | 30 +- .../src/api/routes/tests/datasource.spec.js | 2 +- .../src/api/routes/tests/metadata.spec.js | 65 + .../routes/tests/utilities/TestFunctions.js | 14 + packages/server/src/app.ts | 2 +- packages/server/src/automations/actions.js | 78 +- packages/server/src/automations/bullboard.js | 14 +- packages/server/src/automations/index.js | 56 +- packages/server/src/automations/logic.js | 20 - packages/server/src/automations/steps/bash.js | 19 +- .../server/src/automations/steps/createRow.js | 10 +- .../server/src/automations/steps/delay.js | 19 +- .../server/src/automations/steps/deleteRow.js | 10 +- .../server/src/automations/steps/discord.js | 83 + .../src/automations/steps/executeQuery.js | 28 +- .../src/automations/steps/executeScript.js | 28 +- .../server/src/automations/steps/filter.js | 37 +- .../src/automations/steps/integromat.js | 87 + .../src/automations/steps/outgoingWebhook.js | 28 +- .../server/src/automations/steps/queryRows.js | 119 + .../src/automations/steps/sendSmtpEmail.js | 8 +- .../src/automations/steps/sendgridEmail.js | 74 - .../server/src/automations/steps/serverLog.js | 10 +- .../server/src/automations/steps/slack.js | 64 + .../server/src/automations/steps/updateRow.js | 8 +- .../server/src/automations/steps/utils.js | 36 + .../server/src/automations/steps/zapier.js | 84 + .../src/automations/tests/automation.spec.js | 71 +- .../src/automations/tests/delay.spec.js | 4 +- .../src/automations/tests/filter.spec.js | 28 +- .../src/automations/tests/queryRows.spec.js | 51 + .../src/automations/tests/sendEmail.spec.js | 36 - .../src/automations/tests/utilities/index.js | 15 +- packages/server/src/automations/thread.js | 53 +- .../server/src/automations/triggerInfo/app.js | 31 + .../src/automations/triggerInfo/cron.js | 31 + .../src/automations/triggerInfo/index.js | 15 + .../src/automations/triggerInfo/rowDeleted.js | 32 + .../src/automations/triggerInfo/rowSaved.js | 40 + .../src/automations/triggerInfo/rowUpdated.js | 40 + .../src/automations/triggerInfo/webhook.js | 36 + packages/server/src/automations/triggers.js | 321 +- packages/server/src/automations/utils.js | 159 + packages/server/src/constants/index.js | 6 + packages/server/src/db/linkedRows/index.js | 76 +- .../server/src/db/tests/linkTests.spec.js | 14 +- packages/server/src/db/utils.js | 18 + packages/server/src/db/views/staticViews.js | 9 +- packages/server/src/definitions/datasource.ts | 5 + packages/server/src/environment.js | 1 + packages/server/src/integrations/arangodb.ts | 2 + packages/server/src/integrations/base/sql.ts | 16 +- .../src/integrations/microsoftSqlServer.ts | 2 + packages/server/src/integrations/mysql.ts | 17 +- packages/server/src/integrations/postgres.ts | 1 + packages/server/src/integrations/rest.ts | 35 + .../server/src/integrations/tests/sql.spec.js | 2 +- packages/server/src/integrations/utils.ts | 5 +- packages/server/src/middleware/appInfo.js | 19 + packages/server/src/middleware/usageQuota.js | 2 +- .../appDirectoryTemplate/package.json | 2 +- .../src/utilities/fileSystem/clientLibrary.js | 4 +- .../server/src/utilities/fileSystem/index.js | 38 +- packages/server/src/utilities/global.js | 18 +- packages/server/src/utilities/index.js | 51 + packages/server/src/utilities/redis.js | 19 +- .../index.js} | 55 +- .../src/utilities/rowProcessor/utils.js | 23 + packages/server/src/utilities/users.js | 2 +- .../server/src/utilities/workerRequests.js | 2 +- packages/server/yarn.lock | 4072 ++++++++++------- packages/standard-components/.gitignore | 4 - packages/standard-components/LICENSE | 375 -- packages/standard-components/package.json | 49 - .../standard-components/scripts/deploy.js | 34 - packages/standard-components/vite.config.js | 28 - packages/standard-components/yarn.lock | 292 -- packages/string-templates/manifest.json | 111 +- packages/string-templates/package.json | 2 +- .../scripts/gen-collection-info.js | 10 +- packages/worker/package.json | 10 +- packages/worker/scripts/dev/manage.js | 1 + packages/worker/scripts/selfhost.js | 8 + packages/worker/src/api/controllers/app.js | 1 - .../src/api/controllers/global/configs.js | 24 +- .../src/api/controllers/global/users.js | 20 +- .../system/{flags.js => environment.js} | 3 +- packages/worker/src/api/index.js | 12 +- packages/worker/src/api/routes/global/auth.js | 6 + .../worker/src/api/routes/global/users.js | 2 +- packages/worker/src/api/routes/index.js | 4 +- .../src/api/routes/system/environment.js | 8 + .../worker/src/api/routes/system/flags.js | 8 - .../src/api/routes/tests/configs.spec.js | 12 +- packages/worker/src/environment.js | 2 +- 353 files changed, 9401 insertions(+), 4810 deletions(-) create mode 100644 SECURITY.md create mode 100644 packages/auth/src/middleware/appTenancy.js create mode 100644 packages/bbui/src/Table/ArrayRenderer.svelte create mode 100644 packages/builder/assets/discord.svg create mode 100644 packages/builder/assets/integromat.png create mode 100644 packages/builder/assets/n8n.png create mode 100644 packages/builder/assets/slack.svg create mode 100644 packages/builder/assets/zapier.png delete mode 100644 packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte create mode 100644 packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte create mode 100644 packages/builder/src/components/automation/AutomationBuilder/FlowChart/ExternalActions.js create mode 100644 packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte create mode 100644 packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte delete mode 100644 packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte create mode 100644 packages/builder/src/components/design/AppPreview/DevicePreviewSelect.svelte create mode 100644 packages/builder/src/components/design/AppPreview/ThemeEditor.svelte create mode 100644 packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/UpdateState.svelte rename packages/{standard-components => client}/README.md (100%) rename packages/{standard-components => client}/manifest.json (94%) create mode 100644 packages/client/src/components/CustomThemeWrapper.svelte rename packages/{standard-components/src => client/src/components/app}/BackgroundImage.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/Button.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/CardStat.svelte (95%) rename packages/{standard-components/src => client/src/components/app}/Container.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/DataProvider.svelte (99%) rename packages/{standard-components/src => client/src/components/app}/DateRangePicker.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/Divider.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/Embed.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/ErrorsBox.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/Heading.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/Icon.svelte (71%) rename packages/{standard-components/src => client/src/components/app}/Image.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/Layout.svelte (64%) rename packages/{standard-components/src => client/src/components/app}/Link.svelte (97%) rename packages/{standard-components/src => client/src/components/app}/Placeholder.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/Repeater.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/ScreenSlot.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/Section.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/SpectrumCard.svelte (97%) rename packages/{standard-components/src => client/src/components/app}/Text.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/charts/ApexChart.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/charts/ApexOptionsBuilder.js (82%) rename packages/{standard-components/src => client/src/components/app}/charts/AreaChart.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/charts/BarChart.svelte (77%) rename packages/{standard-components/src => client/src/components/app}/charts/CandleStickChart.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/charts/DonutChart.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/charts/LineChart.svelte (94%) rename packages/{standard-components/src => client/src/components/app}/charts/PieChart.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/charts/index.js (100%) rename packages/{standard-components/src => client/src/components/app}/deprecated/Card.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/deprecated/CardHorizontal.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/deprecated/Navigation.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/deprecated/StackedList.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/forms/AttachmentField.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/forms/BooleanField.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/forms/DateTimeField.svelte (96%) rename packages/{standard-components/src => client/src/components/app}/forms/Field.svelte (99%) rename packages/{standard-components/src => client/src/components/app}/forms/FieldGroup.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/forms/FieldGroupFallback.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/forms/Form.svelte (92%) rename packages/{standard-components/src => client/src/components/app}/forms/FormStep.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/forms/InnerForm.svelte (89%) rename packages/{standard-components/src => client/src/components/app}/forms/LongFormField.svelte (100%) create mode 100644 packages/client/src/components/app/forms/MultiFieldSelect.svelte rename packages/{standard-components/src => client/src/components/app}/forms/NumberField.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/forms/OptionsField.svelte (68%) rename packages/{standard-components/src => client/src/components/app}/forms/PasswordField.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/forms/RelationshipField.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/forms/StringField.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/forms/index.js (91%) create mode 100644 packages/client/src/components/app/forms/optionsParser.js rename packages/{standard-components/src => client/src/components/app}/forms/validation.js (94%) rename packages/{standard-components/src => client/src/components/app}/index.js (95%) rename packages/{standard-components/src => client/src/components/app}/table/SlotRenderer.svelte (100%) rename packages/{standard-components/src => client/src/components/app}/table/Table.svelte (96%) rename packages/{standard-components/src => client/src/components/app}/table/index.js (100%) rename packages/client/src/components/{ => context}/DeviceBindingsProvider.svelte (80%) rename packages/client/src/components/{ => context}/Provider.svelte (94%) create mode 100644 packages/client/src/components/context/StateBindingsProvider.svelte rename packages/client/src/components/{ => context}/UserBindingsProvider.svelte (82%) rename packages/client/src/components/{ => overlay}/ConfirmationDisplay.svelte (88%) rename packages/client/src/components/{ => overlay}/NotificationDisplay.svelte (94%) rename packages/client/src/components/{ => overlay}/PeekScreenDisplay.svelte (99%) rename packages/client/src/{store => stores}/app.js (100%) rename packages/client/src/{store => stores}/auth.js (100%) rename packages/client/src/{store => stores}/builder.js (95%) rename packages/client/src/{store => stores}/confirmation.js (100%) rename packages/client/src/{store => stores}/context.js (100%) rename packages/client/src/{store => stores}/dataSource.js (100%) rename packages/client/src/{store => stores}/index.js (88%) rename packages/client/src/{store => stores}/initialise.js (100%) rename packages/client/src/{store => stores}/notification.js (100%) rename packages/client/src/{store => stores}/peek.js (100%) rename packages/client/src/{store => stores}/routes.js (100%) rename packages/client/src/{store => stores}/screens.js (100%) create mode 100644 packages/client/src/stores/state.js create mode 100644 packages/client/src/stores/theme.js delete mode 100644 packages/client/src/utils/hash.js rename packages/{standard-components/src => client/src/utils}/helpers.js (79%) rename packages/{standard-components/src => client/src/utils}/lucene.js (96%) create mode 100644 packages/server/scripts/selfhost.js create mode 100644 packages/server/src/api/controllers/metadata.js create mode 100644 packages/server/src/api/routes/metadata.js create mode 100644 packages/server/src/api/routes/tests/metadata.spec.js delete mode 100644 packages/server/src/automations/logic.js create mode 100644 packages/server/src/automations/steps/discord.js create mode 100644 packages/server/src/automations/steps/integromat.js create mode 100644 packages/server/src/automations/steps/queryRows.js delete mode 100644 packages/server/src/automations/steps/sendgridEmail.js create mode 100644 packages/server/src/automations/steps/slack.js create mode 100644 packages/server/src/automations/steps/utils.js create mode 100644 packages/server/src/automations/steps/zapier.js create mode 100644 packages/server/src/automations/tests/queryRows.spec.js delete mode 100644 packages/server/src/automations/tests/sendEmail.spec.js create mode 100644 packages/server/src/automations/triggerInfo/app.js create mode 100644 packages/server/src/automations/triggerInfo/cron.js create mode 100644 packages/server/src/automations/triggerInfo/index.js create mode 100644 packages/server/src/automations/triggerInfo/rowDeleted.js create mode 100644 packages/server/src/automations/triggerInfo/rowSaved.js create mode 100644 packages/server/src/automations/triggerInfo/rowUpdated.js create mode 100644 packages/server/src/automations/triggerInfo/webhook.js create mode 100644 packages/server/src/automations/utils.js create mode 100644 packages/server/src/middleware/appInfo.js rename packages/server/src/utilities/{rowProcessor.js => rowProcessor/index.js} (85%) create mode 100644 packages/server/src/utilities/rowProcessor/utils.js delete mode 100644 packages/standard-components/.gitignore delete mode 100644 packages/standard-components/LICENSE delete mode 100644 packages/standard-components/package.json delete mode 100644 packages/standard-components/scripts/deploy.js delete mode 100644 packages/standard-components/vite.config.js delete mode 100644 packages/standard-components/yarn.lock create mode 100644 packages/worker/scripts/selfhost.js rename packages/worker/src/api/controllers/system/{flags.js => environment.js} (61%) create mode 100644 packages/worker/src/api/routes/system/environment.js delete mode 100644 packages/worker/src/api/routes/system/flags.js diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 588f0c54ae..aaee3923ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ name: Budibase Release -on: +on: push: branches: - master @@ -9,20 +9,20 @@ env: POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }} POSTHOG_URL: ${{ secrets.POSTHOG_URL }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }} - + jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 12.x - - run: yarn - - run: yarn bootstrap - - run: yarn lint - - run: yarn build + - run: yarn + - run: yarn bootstrap + - run: yarn lint + - run: yarn build - run: yarn test - name: Configure AWS Credentials @@ -35,19 +35,19 @@ jobs: - name: Publish budibase packages to NPM env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: | + run: | # setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default git config user.name "Budibase Release Bot" git config user.email "<>" - echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc + echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc yarn release - - name: Get Previous tag - id: previoustag - uses: "WyriHaximus/github-action-get-previous-tag@v1" + - name: 'Get Previous tag' + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" - name: Build/release Docker images - run: | + run: | docker login -u $DOCKER_USER -p $DOCKER_PASSWORD yarn build yarn build:docker @@ -68,4 +68,3 @@ jobs: charts_dir: docs env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - \ No newline at end of file diff --git a/LICENSE b/LICENSE index a6bd926020..9c0a8c22a0 100644 --- a/LICENSE +++ b/LICENSE @@ -5,8 +5,7 @@ Each Budibase package has its own license: builder: GPLv3 server: GPLv3 client: MPLv2.0 -standard-components: MPLv2.0 -You can consider Budibase to be GPLv3 licensed. +You can consider Budibase to be GPLv3 licensed. The apps that you build with Budibase do not fall under GPLv3 - hence why our components and client library are licensed differently. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000000..e414f48cb8 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,15 @@ +# Security Policy + +## Versions + +As an open source product, we will only patch the latest major version for security vulnerabilities. Previous versions of budibase will not be retroactively patched. + +## Disclosing + +You can get in touch with us regarding a vulnerability via email at community@budibase.com. + +You can also disclose via huntr.dev. If you believe you have found a vulnerability, please disclose it on huntr and let us know. + +https://huntr.dev/bounties/disclose + +This will enable us to review the vulnerability and potentially reward you for your work. diff --git a/hosting/docker-compose.yaml b/hosting/docker-compose.yaml index 9cdf2b2114..18b93fdf61 100644 --- a/hosting/docker-compose.yaml +++ b/hosting/docker-compose.yaml @@ -51,6 +51,7 @@ services: INTERNAL_API_KEY: ${INTERNAL_API_KEY} REDIS_URL: redis-service:6379 REDIS_PASSWORD: ${REDIS_PASSWORD} + ACCOUNT_PORTAL_URL: https://portal.budi.live volumes: - ./logs:/logs depends_on: @@ -107,7 +108,7 @@ services: depends_on: - couchdb-service command: ["sh","-c","sleep 10 && $${PUT_CALL}/_users && $${PUT_CALL}/_replicator; fg;"] - + redis-service: restart: always image: redis @@ -116,9 +117,11 @@ services: - "${REDIS_PORT}:6379" volumes: - redis_data:/data - + watchtower-service: image: containrrr/watchtower + ports: + - "${WATCHTOWER_PORT}:8080" volumes: - /var/run/docker.sock:/var/run/docker.sock command: --debug --http-api-update bbapps bbworker @@ -128,8 +131,6 @@ services: - WATCHTOWER_CLEANUP=true labels: - "com.centurylinklabs.watchtower.enable=false" - ports: - - 6161:8080 volumes: diff --git a/hosting/hosting.properties b/hosting/hosting.properties index d11972bc4b..c8e2f5c606 100644 --- a/hosting/hosting.properties +++ b/hosting/hosting.properties @@ -17,4 +17,5 @@ WORKER_PORT=4003 MINIO_PORT=4004 COUCH_DB_PORT=4005 REDIS_PORT=6379 +WATCHTOWER_PORT=6161 BUDIBASE_ENVIRONMENT=PRODUCTION diff --git a/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml b/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml index 703d59c075..6c165872c8 100644 --- a/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml +++ b/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml @@ -87,6 +87,8 @@ spec: {{ end }} - name: SELF_HOSTED value: {{ .Values.globals.selfHosted | quote }} + - name: ACCOUNT_PORTAL_URL + value: {{ .Values.globals.accountPortalUrl | quote }} image: budibase/worker imagePullPolicy: Always name: bbworker diff --git a/hosting/kubernetes/budibase/values.yaml b/hosting/kubernetes/budibase/values.yaml index 30594f95e3..1113842c8b 100644 --- a/hosting/kubernetes/budibase/values.yaml +++ b/hosting/kubernetes/budibase/values.yaml @@ -44,7 +44,7 @@ ingress: nginx: true certificateArn: "" className: "" - annotations: + annotations: kubernetes.io/ingress.class: nginx hosts: - host: # change if using custom domain @@ -55,7 +55,7 @@ ingress: service: name: proxy-service port: - number: 10000 + number: 10000 resources: {} # We usually recommend not to specify default resources and to leave this as a conscious @@ -86,9 +86,10 @@ globals: budibaseEnv: PRODUCTION enableAnalytics: false posthogToken: "" - sentryDSN: "" + sentryDSN: "" logLevel: info selfHosted: 1 + accountPortalUrL: "" createSecrets: true # creates an internal API key, JWT secrets and redis password for you # if createSecrets is set to false, you can hard-code your secrets here @@ -120,7 +121,7 @@ services: password: "" # only change if pointing to existing couch server port: 5984 storage: 100Mi - + redis: enabled: true # disable if using external redis port: 6379 @@ -128,15 +129,15 @@ services: url: "" # only change if pointing to existing redis cluster and enabled: false password: "budibase" # recommended to override if using built-in redis storage: 100Mi - + objectStore: minio: true browser: true port: 9000 replicaCount: 1 accessKey: "" # AWS_ACCESS_KEY if using S3 or existing minio access key - secretKey: "" # AWS_SECRET_ACCESS_KEY if using S3 or existing minio secret - region: "" # AWS_REGION if using S3 or existing minio secret - url: "" # only change if pointing to existing minio cluster and minio: false + secretKey: "" # AWS_SECRET_ACCESS_KEY if using S3 or existing minio secret + region: "" # AWS_REGION if using S3 or existing minio secret + url: "" # only change if pointing to existing minio cluster and minio: false storage: 100Mi diff --git a/hosting/kubernetes/envoy/envoy.yaml b/hosting/kubernetes/envoy/envoy.yaml index 0e7859d887..c36f04936f 100644 --- a/hosting/kubernetes/envoy/envoy.yaml +++ b/hosting/kubernetes/envoy/envoy.yaml @@ -28,27 +28,35 @@ static_resources: - match: { prefix: "/builder" } route: cluster: app-service - + - match: { prefix: "/app_" } route: cluster: app-service - # special case for worker admin API + # special cases for worker admin (deprecated), global and system API + - match: { prefix: "/api/global/" } + route: + cluster: worker-service + - match: { prefix: "/api/admin/" } route: cluster: worker-service + - match: { prefix: "/api/system/" } + route: + cluster: worker-service + - match: { path: "/" } route: cluster: app-service - # special case for when API requests are made, can just forward, not to minio + # special case for when API requests are made, can just forward, not to minio - match: { prefix: "/api/" } route: cluster: app-service - match: { prefix: "/worker/" } - route: + route: cluster: worker-service prefix_rewrite: "/" @@ -77,7 +85,7 @@ static_resources: - lb_endpoints: - endpoint: address: - socket_address: + socket_address: address: app-service.budibase.svc.cluster.local port_value: 4002 @@ -105,7 +113,7 @@ static_resources: - lb_endpoints: - endpoint: address: - socket_address: + socket_address: address: worker-service.budibase.svc.cluster.local port_value: 4001 diff --git a/lerna.json b/lerna.json index 8188c1c229..6171a81f87 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.105-alpha.31", + "version": "0.9.125-alpha.13", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/package.json b/package.json index 05c69e54dc..f87c3715aa 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "setup": "node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev", "bootstrap": "lerna link && lerna bootstrap", "build": "lerna run build", - "initialise": "lerna run initialise", "publishdev": "lerna run publishdev", "publishnpm": "yarn build && lerna publish --force-publish", "release": "yarn build && lerna publish patch --yes --force-publish", @@ -48,6 +47,8 @@ "release:helm": "./scripts/release_helm_chart.sh", "multi:enable": "lerna run multi:enable", "multi:disable": "lerna run multi:disable", + "selfhost:enable": "lerna run selfhost:enable", + "selfhost:disable": "lerna run selfhost:disable", "postinstall": "husky install" } } diff --git a/packages/auth/package.json b/packages/auth/package.json index ad5afd5691..4fc09157b0 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.105-alpha.31", + "version": "0.9.125-alpha.13", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/auth/src/cache/user.js b/packages/auth/src/cache/user.js index 4a19da489f..2b2693ca01 100644 --- a/packages/auth/src/cache/user.js +++ b/packages/auth/src/cache/user.js @@ -3,7 +3,29 @@ const { getTenantId, lookupTenantId, getGlobalDB } = require("../tenancy") const EXPIRY_SECONDS = 3600 -exports.getUser = async (userId, tenantId = null) => { +/** + * The default populate user function + */ +const populateFromDB = async (userId, tenantId) => { + const user = await getGlobalDB(tenantId).get(userId) + user.budibaseAccess = true + return user +} + +/** + * Get the requested user by id. + * Use redis cache to first read the user. + * If not present fallback to loading the user directly and re-caching. + * @param {*} userId the id of the user to get + * @param {*} tenantId the tenant of the user to get + * @param {*} populateUser function to provide the user for re-caching. default to couch db + * @returns + */ +exports.getUser = async ( + userId, + tenantId = null, + populateUser = populateFromDB +) => { if (!tenantId) { try { tenantId = getTenantId() @@ -15,9 +37,13 @@ exports.getUser = async (userId, tenantId = null) => { // try cache let user = await client.get(userId) if (!user) { - user = await getGlobalDB(tenantId).get(userId) + user = await populateUser(userId, tenantId) client.store(userId, user, EXPIRY_SECONDS) } + if (user && !user.tenantId && tenantId) { + // make sure the tenant ID is always correct/set + user.tenantId = tenantId + } return user } diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index 4cd29c9bc8..a5d7c1f100 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -35,10 +35,6 @@ exports.APP_PREFIX = DocumentTypes.APP + SEPARATOR exports.APP_DEV = exports.APP_DEV_PREFIX = DocumentTypes.APP_DEV + SEPARATOR exports.SEPARATOR = SEPARATOR -function isDevApp(app) { - return app.appId.startsWith(exports.APP_DEV_PREFIX) -} - /** * If creating DB allDocs/query params with only a single top level ID this can be used, this * is usually the case as most of our docs are top level e.g. tables, automations, users and so on. @@ -62,6 +58,35 @@ function getDocParams(docType, docId = null, otherProps = {}) { } } +exports.isDevAppID = appId => { + return appId.startsWith(exports.APP_DEV_PREFIX) +} + +exports.isProdAppID = appId => { + return appId.startsWith(exports.APP_PREFIX) && !exports.isDevAppID(appId) +} + +function isDevApp(app) { + return exports.isDevAppID(app.appId) +} + +/** + * Given an app ID this will attempt to retrieve the tenant ID from it. + * @return {null|string} The tenant ID found within the app ID. + */ +exports.getTenantIDFromAppID = appId => { + const split = appId.split(SEPARATOR) + const hasDev = split[1] === DocumentTypes.DEV + if ((hasDev && split.length === 3) || (!hasDev && split.length === 2)) { + return null + } + if (hasDev) { + return split[2] + } else { + return split[1] + } +} + /** * Generates a new workspace ID. * @returns {string} The new workspace ID which the workspace doc can be stored under. diff --git a/packages/auth/src/index.js b/packages/auth/src/index.js index 5421dea214..569456ea10 100644 --- a/packages/auth/src/index.js +++ b/packages/auth/src/index.js @@ -11,6 +11,7 @@ const { oidc, auditLog, tenancy, + appTenancy, } = require("./middleware") const { setDB } = require("./db") const userCache = require("./cache/user") @@ -57,6 +58,7 @@ module.exports = { oidc, jwt: require("jsonwebtoken"), buildTenancyMiddleware: tenancy, + buildAppTenancyMiddleware: appTenancy, auditLog, }, cache: { diff --git a/packages/auth/src/middleware/appTenancy.js b/packages/auth/src/middleware/appTenancy.js new file mode 100644 index 0000000000..30fc4f7453 --- /dev/null +++ b/packages/auth/src/middleware/appTenancy.js @@ -0,0 +1,25 @@ +const { + isMultiTenant, + updateTenantId, + isTenantIdSet, + DEFAULT_TENANT_ID, +} = require("../tenancy") +const ContextFactory = require("../tenancy/FunctionContext") +const { getTenantIDFromAppID } = require("../db/utils") + +module.exports = () => { + return ContextFactory.getMiddleware(ctx => { + // if not in multi-tenancy mode make sure its default and exit + if (!isMultiTenant()) { + updateTenantId(DEFAULT_TENANT_ID) + return + } + // if tenant ID already set no need to continue + if (isTenantIdSet()) { + return + } + const appId = ctx.appId ? ctx.appId : ctx.user ? ctx.user.appId : null + const tenantId = getTenantIDFromAppID(appId) || DEFAULT_TENANT_ID + updateTenantId(tenantId) + }) +} diff --git a/packages/auth/src/middleware/authenticated.js b/packages/auth/src/middleware/authenticated.js index e3705a9a24..944f3ee9d9 100644 --- a/packages/auth/src/middleware/authenticated.js +++ b/packages/auth/src/middleware/authenticated.js @@ -21,7 +21,10 @@ function finalise( * The tenancy modules should not be used here and it should be assumed that the tenancy context * has not yet been populated. */ -module.exports = (noAuthPatterns = [], opts = { publicAllowed: false }) => { +module.exports = ( + noAuthPatterns = [], + opts = { publicAllowed: false, populateUser: null } +) => { const noAuthOptions = noAuthPatterns ? buildMatcherRegex(noAuthPatterns) : [] return async (ctx, next) => { let publicEndpoint = false @@ -46,7 +49,15 @@ module.exports = (noAuthPatterns = [], opts = { publicAllowed: false }) => { error = "No session found" } else { try { - user = await getUser(userId, session.tenantId) + if (opts && opts.populateUser) { + user = await getUser( + userId, + session.tenantId, + opts.populateUser(ctx) + ) + } else { + user = await getUser(userId, session.tenantId) + } delete user.password authenticated = true } catch (err) { diff --git a/packages/auth/src/middleware/index.js b/packages/auth/src/middleware/index.js index 689859a139..059f20af8b 100644 --- a/packages/auth/src/middleware/index.js +++ b/packages/auth/src/middleware/index.js @@ -5,6 +5,7 @@ const oidc = require("./passport/oidc") const authenticated = require("./authenticated") const auditLog = require("./auditLog") const tenancy = require("./tenancy") +const appTenancy = require("./appTenancy") module.exports = { google, @@ -14,4 +15,5 @@ module.exports = { authenticated, auditLog, tenancy, + appTenancy, } diff --git a/packages/auth/src/middleware/tenancy.js b/packages/auth/src/middleware/tenancy.js index b80b9a6763..adfd36a503 100644 --- a/packages/auth/src/middleware/tenancy.js +++ b/packages/auth/src/middleware/tenancy.js @@ -2,12 +2,17 @@ const { setTenantId } = require("../tenancy") const ContextFactory = require("../tenancy/FunctionContext") const { buildMatcherRegex, matches } = require("./matchers") -module.exports = (allowQueryStringPatterns, noTenancyPatterns) => { +module.exports = ( + allowQueryStringPatterns, + noTenancyPatterns, + opts = { noTenancyRequired: false } +) => { const allowQsOptions = buildMatcherRegex(allowQueryStringPatterns) const noTenancyOptions = buildMatcherRegex(noTenancyPatterns) return ContextFactory.getMiddleware(ctx => { - const allowNoTenant = !!matches(ctx, noTenancyOptions) + const allowNoTenant = + opts.noTenancyRequired || !!matches(ctx, noTenancyOptions) const allowQs = !!matches(ctx, allowQsOptions) setTenantId(ctx, { allowQs, allowNoTenant }) }) diff --git a/packages/auth/src/redis/index.js b/packages/auth/src/redis/index.js index 4f2b5288ea..94b453c8f6 100644 --- a/packages/auth/src/redis/index.js +++ b/packages/auth/src/redis/index.js @@ -56,9 +56,13 @@ function init() { if (CLIENT) { CLIENT.disconnect() } - const { opts, host, port } = getRedisOptions(CLUSTERED) + + const { redisProtocolUrl, opts, host, port } = getRedisOptions(CLUSTERED) + if (CLUSTERED) { CLIENT = new Redis.Cluster([{ host, port }], opts) + } else if (redisProtocolUrl) { + CLIENT = new Redis(redisProtocolUrl) } else { CLIENT = new Redis(opts) } diff --git a/packages/auth/src/redis/utils.js b/packages/auth/src/redis/utils.js index 415dcbf463..6befecd9ba 100644 --- a/packages/auth/src/redis/utils.js +++ b/packages/auth/src/redis/utils.js @@ -8,17 +8,27 @@ const REDIS_PASSWORD = !env.REDIS_PASSWORD ? "budibase" : env.REDIS_PASSWORD exports.Databases = { PW_RESETS: "pwReset", + VERIFICATIONS: "verification", INVITATIONS: "invitation", DEV_LOCKS: "devLocks", DEBOUNCE: "debounce", SESSIONS: "session", USER_CACHE: "users", + FLAGS: "flags", } exports.SEPARATOR = SEPARATOR exports.getRedisOptions = (clustered = false) => { - const [host, port] = REDIS_URL.split(":") + const [host, port, ...rest] = REDIS_URL.split(":") + + let redisProtocolUrl + + // fully qualified redis URL + if (rest.length && /rediss?/.test(host)) { + redisProtocolUrl = REDIS_URL + } + const opts = { connectTimeout: CONNECT_TIMEOUT_MS, } @@ -33,7 +43,7 @@ exports.getRedisOptions = (clustered = false) => { opts.port = port opts.password = REDIS_PASSWORD } - return { opts, host, port } + return { opts, host, port, redisProtocolUrl } } exports.addDbPrefix = (db, key) => { diff --git a/packages/auth/src/tenancy/context.js b/packages/auth/src/tenancy/context.js index f3f1f541e9..b1ef5a5807 100644 --- a/packages/auth/src/tenancy/context.js +++ b/packages/auth/src/tenancy/context.js @@ -21,9 +21,7 @@ exports.doInTenant = (tenantId, task) => { cls.setOnContext(TENANT_ID, tenantId) // invoke the task - const result = task() - - return result + return task() }) } diff --git a/packages/bbui/package.json b/packages/bbui/package.json index f6275b7fe3..6b4b21e61b 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.105-alpha.31", + "version": "0.9.125-alpha.13", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/bbui/src/ActionButton/ActionButton.svelte b/packages/bbui/src/ActionButton/ActionButton.svelte index 83f71d385b..b518ac3d92 100644 --- a/packages/bbui/src/ActionButton/ActionButton.svelte +++ b/packages/bbui/src/ActionButton/ActionButton.svelte @@ -12,6 +12,7 @@ export let dataCy = null export let size = "M" export let active = false + export let fullWidth = false function longPress(element) { if (!longPressable) return @@ -40,6 +41,7 @@ class:spectrum-ActionButton--quiet={quiet} class:spectrum-ActionButton--emphasized={emphasized} class:is-selected={selected} + class:fullWidth class="spectrum-ActionButton spectrum-ActionButton--size{size}" class:active {disabled} @@ -71,6 +73,9 @@ diff --git a/packages/bbui/src/Modal/ModalContent.svelte b/packages/bbui/src/Modal/ModalContent.svelte index bba72e6093..678a813a61 100644 --- a/packages/bbui/src/Modal/ModalContent.svelte +++ b/packages/bbui/src/Modal/ModalContent.svelte @@ -46,8 +46,10 @@

{title} +

{#if showDivider} @@ -120,4 +122,9 @@ .close-icon :global(svg) { margin-right: 0; } + + .header-spacing { + display: flex; + justify-content: space-between; + } diff --git a/packages/bbui/src/ProgressCircle/ProgressCircle.svelte b/packages/bbui/src/ProgressCircle/ProgressCircle.svelte index 9c8181ec7c..0428263346 100644 --- a/packages/bbui/src/ProgressCircle/ProgressCircle.svelte +++ b/packages/bbui/src/ProgressCircle/ProgressCircle.svelte @@ -13,7 +13,7 @@ } } - export let value = false + export let value = null export let minValue = 0 export let maxValue = 100 @@ -42,7 +42,7 @@
diff --git a/packages/bbui/src/SideNavigation/Item.svelte b/packages/bbui/src/SideNavigation/Item.svelte index f50270dfbd..dfebdb46a6 100644 --- a/packages/bbui/src/SideNavigation/Item.svelte +++ b/packages/bbui/src/SideNavigation/Item.svelte @@ -13,6 +13,7 @@ class="spectrum-SideNav-item" class:is-selected={selected} class:is-disabled={disabled} + on:click > {#if heading}
diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte new file mode 100644 index 0000000000..7dfdff20a7 --- /dev/null +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte @@ -0,0 +1,114 @@ + + + +
+
+ {#if isTrigger || testResult[0].outputs.success} +
+ +
+ {:else} +
+ +
+ {/if} +
+
+ +
{ + inputToggled = !inputToggled + }} + class="toggle splitHeader" + > +
+
+ + Input + +
+
+
+ {#if inputToggled} + + {:else} + + {/if} +
+
+ {#if inputToggled} +
+