From 72ea05cc059951b8311ff4383844878995ec837e Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 11 Jan 2021 21:01:21 +0000 Subject: [PATCH] type safe schema validation --- .../src/components/integration/Query.js | 9 ++- .../components/integration/QueryViewer.svelte | 2 +- .../src/components/integration/index.svelte | 6 +- packages/server/src/api/controllers/query.js | 20 ------- packages/server/src/api/routes/query.js | 60 ++++++++++++++++++- packages/server/src/integrations/postgres.js | 38 ++++++++++-- .../src/utilities/security/permissions.js | 3 + 7 files changed, 106 insertions(+), 32 deletions(-) diff --git a/packages/builder/src/components/integration/Query.js b/packages/builder/src/components/integration/Query.js index 4057da508b..25e9bb2745 100644 --- a/packages/builder/src/components/integration/Query.js +++ b/packages/builder/src/components/integration/Query.js @@ -1,9 +1,14 @@ +const handlebars = require("handlebars") + class Query { - constructor(source, schema, type) { + constructor(source, schema, type, queryString) { this.source = source this.schema = schema this.type = type + this.queryString = queryString } - build(parameters) {} + build(parameters) { + this.queryStr + } } diff --git a/packages/builder/src/components/integration/QueryViewer.svelte b/packages/builder/src/components/integration/QueryViewer.svelte index 246bfaf4cc..a77e0cc211 100644 --- a/packages/builder/src/components/integration/QueryViewer.svelte +++ b/packages/builder/src/components/integration/QueryViewer.svelte @@ -136,7 +136,7 @@ diff --git a/packages/builder/src/components/integration/index.svelte b/packages/builder/src/components/integration/index.svelte index 9b9b7e5d11..3876df5a09 100644 --- a/packages/builder/src/components/integration/index.svelte +++ b/packages/builder/src/components/integration/index.svelte @@ -5,6 +5,8 @@ const QueryTypes = { SQL: "sql", + JSON: "json", + FIELDS: "fields", } export let query @@ -19,4 +21,6 @@