@budibase/server 1.2.35 → 1.2.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder/assets/{index.05962580.js → index.47bfb9a6.js} +48 -48
- package/builder/index.html +1 -1
- package/coverage/clover.xml +2 -2
- package/coverage/coverage-final.json +13 -13
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +3 -3
- package/coverage/lcov-report/api/controllers/backup.js.html +3 -3
- package/coverage/lcov-report/api/controllers/cloud.js.html +4 -4
- package/coverage/lcov-report/api/controllers/component.js.html +3 -3
- package/coverage/lcov-report/api/controllers/datasource.js.html +3 -3
- package/coverage/lcov-report/api/controllers/dev.js.html +4 -4
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- package/coverage/lcov-report/api/controllers/integration.js.html +3 -3
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +3 -3
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +3 -3
- package/coverage/lcov-report/api/controllers/view/utils.js.html +5 -5
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +3 -3
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +39 -39
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +3 -3
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +1 -1
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +3 -3
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +9 -9
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/dist/api/controllers/analytics.js +1 -1
- package/dist/api/controllers/application.js +8 -8
- package/dist/api/controllers/automation.js +2 -2
- package/dist/api/controllers/backup.js +2 -2
- package/dist/api/controllers/cloud.js +3 -3
- package/dist/api/controllers/component.js +2 -2
- package/dist/api/controllers/datasource.js +2 -2
- package/dist/api/controllers/deploy/index.js +6 -6
- package/dist/api/controllers/dev.js +3 -3
- package/dist/api/controllers/integration.js +2 -2
- package/dist/api/controllers/public/utils.js +1 -1
- package/dist/api/controllers/row/ExternalRequest.js +3 -3
- package/dist/api/controllers/row/internal.js +2 -2
- package/dist/api/controllers/static/index.js +2 -2
- package/dist/api/controllers/view/index.js +2 -2
- package/dist/api/controllers/view/utils.js +3 -3
- package/dist/db/linkedRows/linkUtils.js +2 -2
- package/dist/db/utils.js +37 -37
- package/dist/db/views/staticViews.js +4 -4
- package/dist/definitions/automations.js +6 -6
- package/dist/definitions/datasource.js +6 -70
- package/dist/integrations/airtable.js +13 -13
- package/dist/integrations/arangodb.js +8 -8
- package/dist/integrations/base/sql.js +28 -28
- package/dist/integrations/base/sqlTable.js +4 -4
- package/dist/integrations/couchdb.js +8 -8
- package/dist/integrations/dynamodb.js +21 -21
- package/dist/integrations/elasticsearch.js +12 -12
- package/dist/integrations/firebase.js +12 -12
- package/dist/integrations/googlesheets.js +14 -14
- package/dist/integrations/index.js +34 -34
- package/dist/integrations/microsoftSqlServer.js +14 -14
- package/dist/integrations/mongodb.js +9 -9
- package/dist/integrations/mysql.js +13 -13
- package/dist/integrations/oracle.js +13 -13
- package/dist/integrations/postgres.js +15 -15
- package/dist/integrations/redis.js +10 -10
- package/dist/integrations/rest.js +15 -14
- package/dist/integrations/s3.js +2 -2
- package/dist/integrations/snowflake.js +5 -5
- package/dist/integrations/utils.js +14 -14
- package/dist/middleware/builder.js +2 -2
- package/dist/migrations/functions/appUrls.js +2 -2
- package/dist/migrations/functions/backfill/app/queries.js +3 -1
- package/dist/migrations/functions/backfill/app.js +1 -1
- package/dist/migrations/functions/backfill/global/users.js +1 -1
- package/dist/package.json +6 -6
- package/dist/tests/utilities/TestConfiguration.js +2 -2
- package/dist/threads/automation.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/routing/index.js +2 -2
- package/dist/utilities/security.js +8 -8
- package/package.json +7 -7
- package/src/api/controllers/analytics.ts +2 -2
- package/src/api/controllers/application.ts +9 -9
- package/src/api/controllers/automation.js +2 -2
- package/src/api/controllers/backup.js +2 -2
- package/src/api/controllers/cloud.js +3 -3
- package/src/api/controllers/component.js +2 -2
- package/src/api/controllers/datasource.js +2 -2
- package/src/api/controllers/deploy/index.ts +7 -7
- package/src/api/controllers/dev.js +3 -3
- package/src/api/controllers/integration.js +2 -2
- package/src/api/controllers/public/utils.ts +2 -2
- package/src/api/controllers/query/import/sources/openapi2.ts +1 -1
- package/src/api/controllers/query/import/sources/openapi3.ts +1 -1
- package/src/api/controllers/row/ExternalRequest.ts +5 -7
- package/src/api/controllers/row/internal.js +2 -2
- package/src/api/controllers/static/index.ts +2 -2
- package/src/api/controllers/view/index.js +2 -2
- package/src/api/controllers/view/utils.js +4 -4
- package/src/db/linkedRows/linkUtils.js +2 -2
- package/src/db/utils.js +38 -38
- package/src/db/views/staticViews.js +4 -9
- package/src/definitions/automations.ts +2 -2
- package/src/definitions/common.ts +14 -65
- package/src/definitions/datasource.ts +5 -250
- package/src/integrations/airtable.ts +16 -16
- package/src/integrations/arangodb.ts +11 -11
- package/src/integrations/base/sql.ts +16 -16
- package/src/integrations/base/sqlTable.ts +1 -6
- package/src/integrations/base/utils.ts +1 -2
- package/src/integrations/couchdb.ts +11 -11
- package/src/integrations/dynamodb.ts +24 -24
- package/src/integrations/elasticsearch.ts +15 -15
- package/src/integrations/firebase.ts +15 -15
- package/src/integrations/googlesheets.ts +19 -18
- package/src/integrations/index.ts +34 -34
- package/src/integrations/microsoftSqlServer.ts +19 -18
- package/src/integrations/mongodb.ts +12 -12
- package/src/integrations/mysql.ts +19 -18
- package/src/integrations/oracle.ts +16 -16
- package/src/integrations/postgres.ts +20 -20
- package/src/integrations/queries/sql.ts +1 -2
- package/src/integrations/redis.ts +10 -14
- package/src/integrations/rest.ts +22 -20
- package/src/integrations/s3.ts +2 -3
- package/src/integrations/snowflake.ts +5 -5
- package/src/integrations/tests/sql.spec.js +7 -7
- package/src/integrations/utils.ts +8 -9
- package/src/middleware/builder.js +2 -2
- package/src/migrations/functions/appUrls.ts +2 -2
- package/src/migrations/functions/backfill/app/queries.ts +3 -2
- package/src/migrations/functions/backfill/app.ts +1 -1
- package/src/migrations/functions/backfill/global/users.ts +1 -1
- package/src/migrations/functions/tests/appUrls.spec.js +3 -3
- package/src/migrations/tests/index.spec.ts +2 -2
- package/src/tests/utilities/TestConfiguration.js +2 -2
- package/src/threads/automation.ts +3 -3
- package/src/utilities/routing/index.js +2 -2
- package/src/utilities/security.js +8 -8
- package/dist/integrations/base/IntegrationBase.js +0 -2
- package/dist/integrations/base/datasourcePlus.js +0 -2
- package/src/integrations/base/IntegrationBase.ts +0 -6
- package/src/integrations/base/datasourcePlus.ts +0 -13
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const knex_1 = require("knex");
|
|
16
|
-
const
|
|
16
|
+
const types_1 = require("@budibase/types");
|
|
17
17
|
const utils_1 = require("../utils");
|
|
18
18
|
const sqlTable_1 = __importDefault(require("./sqlTable"));
|
|
19
19
|
const environment_1 = __importDefault(require("../../environment"));
|
|
@@ -30,14 +30,14 @@ function likeKey(client, key) {
|
|
|
30
30
|
}
|
|
31
31
|
let start, end;
|
|
32
32
|
switch (client) {
|
|
33
|
-
case utils_1.
|
|
33
|
+
case utils_1.SqlClient.MY_SQL:
|
|
34
34
|
start = end = "`";
|
|
35
35
|
break;
|
|
36
|
-
case utils_1.
|
|
37
|
-
case utils_1.
|
|
36
|
+
case utils_1.SqlClient.ORACLE:
|
|
37
|
+
case utils_1.SqlClient.POSTGRES:
|
|
38
38
|
start = end = '"';
|
|
39
39
|
break;
|
|
40
|
-
case utils_1.
|
|
40
|
+
case utils_1.SqlClient.MS_SQL:
|
|
41
41
|
start = "[";
|
|
42
42
|
end = "]";
|
|
43
43
|
break;
|
|
@@ -99,7 +99,7 @@ function generateSelectStatement(json, knex) {
|
|
|
99
99
|
const columnName = fieldNames[1];
|
|
100
100
|
if (columnName &&
|
|
101
101
|
(schema === null || schema === void 0 ? void 0 : schema[columnName]) &&
|
|
102
|
-
knex.client.config.client === utils_1.
|
|
102
|
+
knex.client.config.client === utils_1.SqlClient.POSTGRES) {
|
|
103
103
|
const externalType = schema[columnName].externalType;
|
|
104
104
|
if (externalType === null || externalType === void 0 ? void 0 : externalType.includes("money")) {
|
|
105
105
|
return knex.raw(`"${tableName}"."${columnName}"::money::numeric as "${field}"`);
|
|
@@ -128,7 +128,7 @@ class InternalBuilder {
|
|
|
128
128
|
const like = (key, value) => {
|
|
129
129
|
const fnc = allOr ? "orWhere" : "where";
|
|
130
130
|
// postgres supports ilike, nothing else does
|
|
131
|
-
if (this.client === utils_1.
|
|
131
|
+
if (this.client === utils_1.SqlClient.POSTGRES) {
|
|
132
132
|
query = query[fnc](key, "ilike", `%${value}%`);
|
|
133
133
|
}
|
|
134
134
|
else {
|
|
@@ -155,7 +155,7 @@ class InternalBuilder {
|
|
|
155
155
|
iterate(filters.string, (key, value) => {
|
|
156
156
|
const fnc = allOr ? "orWhere" : "where";
|
|
157
157
|
// postgres supports ilike, nothing else does
|
|
158
|
-
if (this.client === utils_1.
|
|
158
|
+
if (this.client === utils_1.SqlClient.POSTGRES) {
|
|
159
159
|
query = query[fnc](key, "ilike", `${value}%`);
|
|
160
160
|
}
|
|
161
161
|
else {
|
|
@@ -214,7 +214,7 @@ class InternalBuilder {
|
|
|
214
214
|
if (filters.contains) {
|
|
215
215
|
const fnc = allOr ? "orWhere" : "where";
|
|
216
216
|
const rawFnc = `${fnc}Raw`;
|
|
217
|
-
if (this.client === utils_1.
|
|
217
|
+
if (this.client === utils_1.SqlClient.POSTGRES) {
|
|
218
218
|
iterate(filters.contains, (key, value) => {
|
|
219
219
|
const fieldNames = key.split(/\./g);
|
|
220
220
|
const tableName = fieldNames[0];
|
|
@@ -226,7 +226,7 @@ class InternalBuilder {
|
|
|
226
226
|
query = query[rawFnc](`"${tableName}"."${columnName}"::jsonb @> '[${value}]'`);
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
|
-
else if (this.client === utils_1.
|
|
229
|
+
else if (this.client === utils_1.SqlClient.MY_SQL) {
|
|
230
230
|
iterate(filters.contains, (key, value) => {
|
|
231
231
|
if (typeof value === "string") {
|
|
232
232
|
value = `"${value}"`;
|
|
@@ -247,11 +247,11 @@ class InternalBuilder {
|
|
|
247
247
|
const table = (_a = json.meta) === null || _a === void 0 ? void 0 : _a.table;
|
|
248
248
|
if (sort) {
|
|
249
249
|
for (let [key, value] of Object.entries(sort)) {
|
|
250
|
-
const direction = value ===
|
|
250
|
+
const direction = value === types_1.SortDirection.ASCENDING ? "asc" : "desc";
|
|
251
251
|
query = query.orderBy(`${table === null || table === void 0 ? void 0 : table.name}.${key}`, direction);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
else if (this.client === utils_1.
|
|
254
|
+
else if (this.client === utils_1.SqlClient.MS_SQL && (paginate === null || paginate === void 0 ? void 0 : paginate.limit)) {
|
|
255
255
|
// @ts-ignore
|
|
256
256
|
query = query.orderBy(`${table === null || table === void 0 ? void 0 : table.name}.${table === null || table === void 0 ? void 0 : table.primary[0]}`);
|
|
257
257
|
}
|
|
@@ -391,7 +391,7 @@ class InternalBuilder {
|
|
|
391
391
|
[tableName]: query,
|
|
392
392
|
}).select(selectStatement);
|
|
393
393
|
// have to add after as well (this breaks MS-SQL)
|
|
394
|
-
if (this.client !== utils_1.
|
|
394
|
+
if (this.client !== utils_1.SqlClient.MS_SQL) {
|
|
395
395
|
preQuery = this.addSorting(preQuery, json);
|
|
396
396
|
}
|
|
397
397
|
// handle joins
|
|
@@ -448,24 +448,24 @@ class SqlQueryBuilder extends sqlTable_1.default {
|
|
|
448
448
|
let query;
|
|
449
449
|
const builder = new InternalBuilder(sqlClient);
|
|
450
450
|
switch (this._operation(json)) {
|
|
451
|
-
case
|
|
451
|
+
case types_1.Operation.CREATE:
|
|
452
452
|
query = builder.create(client, json, opts);
|
|
453
453
|
break;
|
|
454
|
-
case
|
|
454
|
+
case types_1.Operation.READ:
|
|
455
455
|
query = builder.read(client, json, this.limit);
|
|
456
456
|
break;
|
|
457
|
-
case
|
|
457
|
+
case types_1.Operation.UPDATE:
|
|
458
458
|
query = builder.update(client, json, opts);
|
|
459
459
|
break;
|
|
460
|
-
case
|
|
460
|
+
case types_1.Operation.DELETE:
|
|
461
461
|
query = builder.delete(client, json, opts);
|
|
462
462
|
break;
|
|
463
|
-
case
|
|
463
|
+
case types_1.Operation.BULK_CREATE:
|
|
464
464
|
query = builder.bulkCreate(client, json);
|
|
465
465
|
break;
|
|
466
|
-
case
|
|
467
|
-
case
|
|
468
|
-
case
|
|
466
|
+
case types_1.Operation.CREATE_TABLE:
|
|
467
|
+
case types_1.Operation.UPDATE_TABLE:
|
|
468
|
+
case types_1.Operation.DELETE_TABLE:
|
|
469
469
|
return this._tableQuery(json);
|
|
470
470
|
default:
|
|
471
471
|
throw `Operation type is not supported by SQL query builder`;
|
|
@@ -479,7 +479,7 @@ class SqlQueryBuilder extends sqlTable_1.default {
|
|
|
479
479
|
return {};
|
|
480
480
|
}
|
|
481
481
|
const input = this._query({
|
|
482
|
-
endpoint: Object.assign(Object.assign({}, json.endpoint), { operation:
|
|
482
|
+
endpoint: Object.assign(Object.assign({}, json.endpoint), { operation: types_1.Operation.READ }),
|
|
483
483
|
resource: {
|
|
484
484
|
fields: [],
|
|
485
485
|
},
|
|
@@ -489,7 +489,7 @@ class SqlQueryBuilder extends sqlTable_1.default {
|
|
|
489
489
|
},
|
|
490
490
|
meta: json.meta,
|
|
491
491
|
});
|
|
492
|
-
return queryFn(input,
|
|
492
|
+
return queryFn(input, types_1.Operation.READ);
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
495
|
// when creating if an ID has been inserted need to make sure
|
|
@@ -524,23 +524,23 @@ class SqlQueryBuilder extends sqlTable_1.default {
|
|
|
524
524
|
}
|
|
525
525
|
let row;
|
|
526
526
|
// need to manage returning, a feature mySQL can't do
|
|
527
|
-
if (operation ===
|
|
527
|
+
if (operation === types_1.Operation.DELETE) {
|
|
528
528
|
row = processFn(yield this.getReturningRow(queryFn, json));
|
|
529
529
|
}
|
|
530
530
|
const response = yield queryFn(input, operation);
|
|
531
531
|
const results = processFn(response);
|
|
532
532
|
// same as delete, manage returning
|
|
533
|
-
if (operation ===
|
|
533
|
+
if (operation === types_1.Operation.CREATE || operation === types_1.Operation.UPDATE) {
|
|
534
534
|
let id;
|
|
535
|
-
if (sqlClient === utils_1.
|
|
535
|
+
if (sqlClient === utils_1.SqlClient.MS_SQL) {
|
|
536
536
|
id = results === null || results === void 0 ? void 0 : results[0].id;
|
|
537
537
|
}
|
|
538
|
-
else if (sqlClient === utils_1.
|
|
538
|
+
else if (sqlClient === utils_1.SqlClient.MY_SQL) {
|
|
539
539
|
id = results === null || results === void 0 ? void 0 : results.insertId;
|
|
540
540
|
}
|
|
541
541
|
row = processFn(yield this.getReturningRow(queryFn, this.checkLookupKeys(id, json)));
|
|
542
542
|
}
|
|
543
|
-
if (operation !==
|
|
543
|
+
if (operation !== types_1.Operation.READ) {
|
|
544
544
|
return row;
|
|
545
545
|
}
|
|
546
546
|
return results.length ? results : [{ [operation.toLowerCase()]: true }];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const knex_1 = require("knex");
|
|
4
|
-
const
|
|
4
|
+
const types_1 = require("@budibase/types");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const { FieldTypes, RelationshipTypes } = require("../../constants");
|
|
7
7
|
function generateSchema(schema, table, tables, oldTable = null, renamed) {
|
|
@@ -135,16 +135,16 @@ class SqlTableQueryBuilder {
|
|
|
135
135
|
throw "Cannot execute without table being specified";
|
|
136
136
|
}
|
|
137
137
|
switch (this._operation(json)) {
|
|
138
|
-
case
|
|
138
|
+
case types_1.Operation.CREATE_TABLE:
|
|
139
139
|
query = buildCreateTable(client, json.table, json.meta.tables);
|
|
140
140
|
break;
|
|
141
|
-
case
|
|
141
|
+
case types_1.Operation.UPDATE_TABLE:
|
|
142
142
|
if (!json.meta || !json.meta.table) {
|
|
143
143
|
throw "Must specify old table for update";
|
|
144
144
|
}
|
|
145
145
|
query = buildUpdateTable(client, json.table, json.meta.tables, json.meta.table, json.meta.renamed);
|
|
146
146
|
break;
|
|
147
|
-
case
|
|
147
|
+
case types_1.Operation.DELETE_TABLE:
|
|
148
148
|
query = buildDeleteTable(client, json.table);
|
|
149
149
|
break;
|
|
150
150
|
default:
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const
|
|
12
|
+
const types_1 = require("@budibase/types");
|
|
13
13
|
var CouchDBModule;
|
|
14
14
|
(function (CouchDBModule) {
|
|
15
15
|
const PouchDB = require("pouchdb");
|
|
@@ -20,30 +20,30 @@ var CouchDBModule;
|
|
|
20
20
|
description: "Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.",
|
|
21
21
|
datasource: {
|
|
22
22
|
url: {
|
|
23
|
-
type:
|
|
23
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
24
24
|
required: true,
|
|
25
25
|
default: "http://localhost:5984",
|
|
26
26
|
},
|
|
27
27
|
database: {
|
|
28
|
-
type:
|
|
28
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
29
29
|
required: true,
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
query: {
|
|
33
33
|
create: {
|
|
34
|
-
type:
|
|
34
|
+
type: types_1.QueryType.JSON,
|
|
35
35
|
},
|
|
36
36
|
read: {
|
|
37
|
-
type:
|
|
37
|
+
type: types_1.QueryType.JSON,
|
|
38
38
|
},
|
|
39
39
|
update: {
|
|
40
|
-
type:
|
|
40
|
+
type: types_1.QueryType.JSON,
|
|
41
41
|
},
|
|
42
42
|
delete: {
|
|
43
|
-
type:
|
|
43
|
+
type: types_1.QueryType.FIELDS,
|
|
44
44
|
fields: {
|
|
45
45
|
id: {
|
|
46
|
-
type:
|
|
46
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
47
47
|
required: true,
|
|
48
48
|
},
|
|
49
49
|
},
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const
|
|
12
|
+
const types_1 = require("@budibase/types");
|
|
13
13
|
var DynamoModule;
|
|
14
14
|
(function (DynamoModule) {
|
|
15
15
|
const AWS = require("aws-sdk");
|
|
@@ -21,101 +21,101 @@ var DynamoModule;
|
|
|
21
21
|
type: "Non-relational",
|
|
22
22
|
datasource: {
|
|
23
23
|
region: {
|
|
24
|
-
type:
|
|
24
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
25
25
|
required: true,
|
|
26
26
|
default: "us-east-1",
|
|
27
27
|
},
|
|
28
28
|
accessKeyId: {
|
|
29
|
-
type:
|
|
29
|
+
type: types_1.DatasourceFieldType.PASSWORD,
|
|
30
30
|
required: true,
|
|
31
31
|
},
|
|
32
32
|
secretAccessKey: {
|
|
33
|
-
type:
|
|
33
|
+
type: types_1.DatasourceFieldType.PASSWORD,
|
|
34
34
|
required: true,
|
|
35
35
|
},
|
|
36
36
|
endpoint: {
|
|
37
|
-
type:
|
|
37
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
38
38
|
required: false,
|
|
39
39
|
default: "https://dynamodb.us-east-1.amazonaws.com",
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
query: {
|
|
43
43
|
create: {
|
|
44
|
-
type:
|
|
44
|
+
type: types_1.QueryType.FIELDS,
|
|
45
45
|
customisable: true,
|
|
46
46
|
fields: {
|
|
47
47
|
table: {
|
|
48
|
-
type:
|
|
48
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
49
49
|
required: true,
|
|
50
50
|
},
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
read: {
|
|
54
|
-
type:
|
|
54
|
+
type: types_1.QueryType.FIELDS,
|
|
55
55
|
customisable: true,
|
|
56
56
|
readable: true,
|
|
57
57
|
fields: {
|
|
58
58
|
table: {
|
|
59
|
-
type:
|
|
59
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
60
60
|
required: true,
|
|
61
61
|
},
|
|
62
62
|
index: {
|
|
63
|
-
type:
|
|
63
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
scan: {
|
|
68
|
-
type:
|
|
68
|
+
type: types_1.QueryType.FIELDS,
|
|
69
69
|
customisable: true,
|
|
70
70
|
readable: true,
|
|
71
71
|
fields: {
|
|
72
72
|
table: {
|
|
73
|
-
type:
|
|
73
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
74
74
|
required: true,
|
|
75
75
|
},
|
|
76
76
|
index: {
|
|
77
|
-
type:
|
|
77
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
78
78
|
},
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
describe: {
|
|
82
|
-
type:
|
|
82
|
+
type: types_1.QueryType.FIELDS,
|
|
83
83
|
customisable: true,
|
|
84
84
|
readable: true,
|
|
85
85
|
fields: {
|
|
86
86
|
table: {
|
|
87
|
-
type:
|
|
87
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
88
88
|
required: true,
|
|
89
89
|
},
|
|
90
90
|
},
|
|
91
91
|
},
|
|
92
92
|
get: {
|
|
93
|
-
type:
|
|
93
|
+
type: types_1.QueryType.FIELDS,
|
|
94
94
|
customisable: true,
|
|
95
95
|
readable: true,
|
|
96
96
|
fields: {
|
|
97
97
|
table: {
|
|
98
|
-
type:
|
|
98
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
99
99
|
required: true,
|
|
100
100
|
},
|
|
101
101
|
},
|
|
102
102
|
},
|
|
103
103
|
update: {
|
|
104
|
-
type:
|
|
104
|
+
type: types_1.QueryType.FIELDS,
|
|
105
105
|
customisable: true,
|
|
106
106
|
fields: {
|
|
107
107
|
table: {
|
|
108
|
-
type:
|
|
108
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
109
109
|
required: true,
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
112
|
},
|
|
113
113
|
delete: {
|
|
114
|
-
type:
|
|
114
|
+
type: types_1.QueryType.FIELDS,
|
|
115
115
|
customisable: true,
|
|
116
116
|
fields: {
|
|
117
117
|
table: {
|
|
118
|
-
type:
|
|
118
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
119
119
|
required: true,
|
|
120
120
|
},
|
|
121
121
|
},
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const
|
|
12
|
+
const types_1 = require("@budibase/types");
|
|
13
13
|
var ElasticsearchModule;
|
|
14
14
|
(function (ElasticsearchModule) {
|
|
15
15
|
const { Client } = require("@elastic/elasticsearch");
|
|
@@ -20,55 +20,55 @@ var ElasticsearchModule;
|
|
|
20
20
|
type: "Non-relational",
|
|
21
21
|
datasource: {
|
|
22
22
|
url: {
|
|
23
|
-
type:
|
|
23
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
24
24
|
required: true,
|
|
25
25
|
default: "http://localhost:9200",
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
query: {
|
|
29
29
|
create: {
|
|
30
|
-
type:
|
|
30
|
+
type: types_1.QueryType.FIELDS,
|
|
31
31
|
customisable: true,
|
|
32
32
|
fields: {
|
|
33
33
|
index: {
|
|
34
|
-
type:
|
|
34
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
35
35
|
required: true,
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
read: {
|
|
40
|
-
type:
|
|
40
|
+
type: types_1.QueryType.FIELDS,
|
|
41
41
|
customisable: true,
|
|
42
42
|
fields: {
|
|
43
43
|
index: {
|
|
44
|
-
type:
|
|
44
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
45
45
|
required: true,
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
update: {
|
|
50
|
-
type:
|
|
50
|
+
type: types_1.QueryType.FIELDS,
|
|
51
51
|
customisable: true,
|
|
52
52
|
fields: {
|
|
53
53
|
id: {
|
|
54
|
-
type:
|
|
54
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
55
55
|
required: true,
|
|
56
56
|
},
|
|
57
57
|
index: {
|
|
58
|
-
type:
|
|
58
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
59
59
|
required: true,
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
63
|
delete: {
|
|
64
|
-
type:
|
|
64
|
+
type: types_1.QueryType.FIELDS,
|
|
65
65
|
fields: {
|
|
66
66
|
index: {
|
|
67
|
-
type:
|
|
67
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
68
68
|
required: true,
|
|
69
69
|
},
|
|
70
70
|
id: {
|
|
71
|
-
type:
|
|
71
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
72
72
|
required: true,
|
|
73
73
|
},
|
|
74
74
|
},
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const
|
|
12
|
+
const types_1 = require("@budibase/types");
|
|
13
13
|
const firestore_1 = require("@google-cloud/firestore");
|
|
14
14
|
var Firebase;
|
|
15
15
|
(function (Firebase) {
|
|
@@ -20,46 +20,46 @@ var Firebase;
|
|
|
20
20
|
description: "Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.",
|
|
21
21
|
datasource: {
|
|
22
22
|
email: {
|
|
23
|
-
type:
|
|
23
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
24
24
|
required: true,
|
|
25
25
|
},
|
|
26
26
|
privateKey: {
|
|
27
|
-
type:
|
|
27
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
28
28
|
required: true,
|
|
29
29
|
},
|
|
30
30
|
projectId: {
|
|
31
|
-
type:
|
|
31
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
32
32
|
required: true,
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
query: {
|
|
36
36
|
create: {
|
|
37
|
-
type:
|
|
37
|
+
type: types_1.QueryType.JSON,
|
|
38
38
|
},
|
|
39
39
|
read: {
|
|
40
|
-
type:
|
|
40
|
+
type: types_1.QueryType.JSON,
|
|
41
41
|
},
|
|
42
42
|
update: {
|
|
43
|
-
type:
|
|
43
|
+
type: types_1.QueryType.JSON,
|
|
44
44
|
},
|
|
45
45
|
delete: {
|
|
46
|
-
type:
|
|
46
|
+
type: types_1.QueryType.JSON,
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
extra: {
|
|
50
50
|
collection: {
|
|
51
51
|
displayName: "Collection",
|
|
52
|
-
type:
|
|
52
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
53
53
|
required: true,
|
|
54
54
|
},
|
|
55
55
|
filterField: {
|
|
56
56
|
displayName: "Filter field",
|
|
57
|
-
type:
|
|
57
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
58
58
|
required: false,
|
|
59
59
|
},
|
|
60
60
|
filter: {
|
|
61
61
|
displayName: "Filter comparison",
|
|
62
|
-
type:
|
|
62
|
+
type: types_1.DatasourceFieldType.LIST,
|
|
63
63
|
required: false,
|
|
64
64
|
data: {
|
|
65
65
|
read: [
|
|
@@ -78,7 +78,7 @@ var Firebase;
|
|
|
78
78
|
},
|
|
79
79
|
filterValue: {
|
|
80
80
|
displayName: "Filter value",
|
|
81
|
-
type:
|
|
81
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
82
82
|
required: false,
|
|
83
83
|
},
|
|
84
84
|
},
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const
|
|
15
|
+
const types_1 = require("@budibase/types");
|
|
16
16
|
const google_auth_library_1 = require("google-auth-library");
|
|
17
17
|
const utils_1 = require("./utils");
|
|
18
18
|
const constants_1 = require("../constants");
|
|
@@ -37,59 +37,59 @@ var GoogleSheetsModule;
|
|
|
37
37
|
datasource: {
|
|
38
38
|
spreadsheetId: {
|
|
39
39
|
display: "Google Sheet URL",
|
|
40
|
-
type:
|
|
40
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
41
41
|
required: true,
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
query: {
|
|
45
45
|
create: {
|
|
46
|
-
type:
|
|
46
|
+
type: types_1.QueryType.FIELDS,
|
|
47
47
|
fields: {
|
|
48
48
|
sheet: {
|
|
49
|
-
type:
|
|
49
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
50
50
|
required: true,
|
|
51
51
|
},
|
|
52
52
|
row: {
|
|
53
|
-
type:
|
|
53
|
+
type: types_1.QueryType.JSON,
|
|
54
54
|
required: true,
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
read: {
|
|
59
|
-
type:
|
|
59
|
+
type: types_1.QueryType.FIELDS,
|
|
60
60
|
fields: {
|
|
61
61
|
sheet: {
|
|
62
|
-
type:
|
|
62
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
63
63
|
required: true,
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
update: {
|
|
68
|
-
type:
|
|
68
|
+
type: types_1.QueryType.FIELDS,
|
|
69
69
|
fields: {
|
|
70
70
|
sheet: {
|
|
71
|
-
type:
|
|
71
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
72
72
|
required: true,
|
|
73
73
|
},
|
|
74
74
|
rowIndex: {
|
|
75
|
-
type:
|
|
75
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
76
76
|
required: true,
|
|
77
77
|
},
|
|
78
78
|
row: {
|
|
79
|
-
type:
|
|
79
|
+
type: types_1.QueryType.JSON,
|
|
80
80
|
required: true,
|
|
81
81
|
},
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
delete: {
|
|
85
|
-
type:
|
|
85
|
+
type: types_1.QueryType.FIELDS,
|
|
86
86
|
fields: {
|
|
87
87
|
sheet: {
|
|
88
|
-
type:
|
|
88
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
89
89
|
required: true,
|
|
90
90
|
},
|
|
91
91
|
rowIndex: {
|
|
92
|
-
type:
|
|
92
|
+
type: types_1.DatasourceFieldType.NUMBER,
|
|
93
93
|
required: true,
|
|
94
94
|
},
|
|
95
95
|
},
|