From 9e41068a5dbe93616cb3af4e07e95863600a9ff3 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 16 Jun 2021 17:50:22 +0100 Subject: [PATCH] end to end data providers and opinionated sql --- packages/builder/src/builderStore/api.js | 30 ++-- .../builderStore/store/automation/index.js | 7 +- .../DatasourceNavigator/icons/Budibase.svelte | 130 ++++++++++++------ .../common/bindings/BindingPanel.svelte | 8 +- .../common/bindings/ServerBindingPanel.svelte | 4 +- .../PropertyControls/DataSourceSelect.svelte | 5 +- .../EventsEditor/actions/ExecuteQuery.svelte | 5 +- .../[selectedDatasource]/index.svelte | 32 +++-- .../builder/src/stores/backend/datasources.js | 4 +- .../stores/backend/tests/fixtures/queries.js | 6 +- packages/server/src/api/controllers/query.js | 2 + .../src/api/controllers/row/external.js | 5 +- .../server/src/api/controllers/table/index.js | 7 +- .../server/src/integrations/elasticsearch.js | 3 +- .../server/src/integrations/plus/postgres.js | 8 +- packages/server/src/integrations/postgres.js | 6 +- packages/server/src/integrations/utils.js | 8 +- packages/server/src/middleware/authorized.js | 92 ++++++------- packages/server/src/middleware/currentapp.js | 8 +- .../src/forms/validation.js | 16 +-- .../worker/src/api/controllers/admin/email.js | 11 +- .../src/api/controllers/admin/groups.js | 7 +- .../worker/src/api/controllers/admin/users.js | 7 +- 23 files changed, 239 insertions(+), 172 deletions(-) diff --git a/packages/builder/src/builderStore/api.js b/packages/builder/src/builderStore/api.js index ae81df10f6..2e683238bc 100644 --- a/packages/builder/src/builderStore/api.js +++ b/packages/builder/src/builderStore/api.js @@ -2,21 +2,23 @@ import { store } from "./index" import { get as svelteGet } from "svelte/store" import { removeCookie, Cookies } from "./cookies" -const apiCall = - method => - async (url, body, headers = { "Content-Type": "application/json" }) => { - headers["x-budibase-app-id"] = svelteGet(store).appId - const json = headers["Content-Type"] === "application/json" - const resp = await fetch(url, { - method: method, - body: json ? JSON.stringify(body) : body, - headers, - }) - if (resp.status === 403) { - removeCookie(Cookies.Auth) - } - return resp +const apiCall = method => async ( + url, + body, + headers = { "Content-Type": "application/json" } +) => { + headers["x-budibase-app-id"] = svelteGet(store).appId + const json = headers["Content-Type"] === "application/json" + const resp = await fetch(url, { + method: method, + body: json ? JSON.stringify(body) : body, + headers, + }) + if (resp.status === 403) { + removeCookie(Cookies.Auth) } + return resp +} export const post = apiCall("POST") export const get = apiCall("GET") diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index c372f27bb7..7a01bccfab 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -100,10 +100,9 @@ const automationActions = store => ({ }, deleteAutomationBlock: block => { store.update(state => { - const idx = - state.selectedAutomation.automation.definition.steps.findIndex( - x => x.id === block.id - ) + const idx = state.selectedAutomation.automation.definition.steps.findIndex( + x => x.id === block.id + ) state.selectedAutomation.deleteBlock(block.id) // Select next closest step diff --git a/packages/builder/src/components/backend/DatasourceNavigator/icons/Budibase.svelte b/packages/builder/src/components/backend/DatasourceNavigator/icons/Budibase.svelte index e335dfe9f2..02ecf89027 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/icons/Budibase.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/icons/Budibase.svelte @@ -2,81 +2,125 @@ export let width = "100" export let height = "100" - - - - - - - + + + + + + - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - + + + + + + - - - - - + c0.44,0,0.86-0.09,1.24-0.26c0.39-0.17,0.72-0.41,1.01-0.71c0.29-0.3,0.52-0.65,0.69-1.05C19.21,29.16,19.3,28.75,19.3,28.31z" + /> + + diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index 01e0c5918b..37e7f520f3 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -59,7 +59,9 @@
Columns