@budibase/server 1.0.219-alpha.7 → 1.0.219
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/__mocks__/node-fetch.ts +0 -9
- package/builder/assets/index.1c640a53.js +1316 -0
- package/builder/assets/index.24307ca0.css +6 -0
- package/builder/assets/{vendor.001dcf8c.js → vendor.9bf2fcb4.js} +163 -163
- package/builder/index.html +3 -3
- package/coverage/clover.xml +794 -868
- package/coverage/coverage-final.json +26 -26
- 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 +12 -111
- package/coverage/lcov-report/api/controllers/backup.js.html +6 -9
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +16 -16
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +21 -21
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- 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 +17 -47
- package/coverage/lcov-report/api/controllers/row/index.html +34 -34
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +11 -95
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +8 -17
- 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 +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- 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 +15 -15
- package/coverage/lcov-report/api/index.js.html +13 -22
- 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 +2 -32
- 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 +12 -57
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +17 -17
- 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 +34 -58
- package/coverage/lcov-report/automations/steps/index.html +11 -11
- 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 +4 -4
- 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 +14 -14
- 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 +13 -13
- package/coverage/lcov-report/db/linkedRows/index.js.html +7 -10
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +2 -2
- package/coverage/lcov-report/db/utils.js.html +51 -27
- 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 +74 -74
- 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 +12 -12
- package/coverage/lcov-report/middleware/currentapp.js.html +33 -33
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +10 -10
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +7 -7
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +2 -2
- package/coverage/lcov-report/threads/automation.js.html +9 -18
- package/coverage/lcov-report/threads/index.html +25 -25
- package/coverage/lcov-report/threads/query.js.html +76 -283
- package/coverage/lcov-report/threads/utils.js.html +4 -4
- 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 +14 -14
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +9 -9
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +2 -2
- 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 +1 -1
- 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 +2 -2
- 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/coverage/lcov.info +1425 -1553
- package/dist/api/controllers/application.js +15 -18
- package/dist/api/controllers/automation.js +2 -28
- package/dist/api/controllers/backup.js +2 -3
- package/dist/api/controllers/query/index.js +0 -25
- package/dist/api/controllers/row/external.js +7 -19
- package/dist/api/controllers/row/internalSearch.js +1 -22
- package/dist/api/controllers/row/utils.js +0 -3
- package/dist/api/index.js +1 -4
- package/dist/api/routes/automation.js +0 -2
- package/dist/automations/automationUtils.js +4 -16
- package/dist/automations/steps/filter.js +29 -38
- package/dist/automations/triggers.js +1 -1
- package/dist/db/linkedRows/index.js +0 -1
- package/dist/db/utils.js +31 -4
- package/dist/definitions/datasource.js +0 -1
- package/dist/environment.js +0 -1
- package/dist/integrations/airtable.js +0 -1
- package/dist/integrations/arangodb.js +0 -1
- package/dist/integrations/base/sql.js +3 -20
- package/dist/integrations/couchdb.js +0 -1
- package/dist/integrations/dynamodb.js +0 -1
- package/dist/integrations/elasticsearch.js +0 -1
- package/dist/integrations/firebase.js +0 -1
- package/dist/integrations/googlesheets.js +0 -1
- package/dist/integrations/index.js +0 -4
- package/dist/integrations/microsoftSqlServer.js +1 -2
- package/dist/integrations/mongodb.js +0 -1
- package/dist/integrations/mysql.js +1 -2
- package/dist/integrations/oracle.js +0 -1
- package/dist/integrations/postgres.js +1 -2
- package/dist/integrations/queries/sql.js +0 -3
- package/dist/integrations/redis.js +0 -1
- package/dist/integrations/rest.js +1 -2
- package/dist/integrations/s3.js +0 -1
- package/dist/package.json +6 -7
- package/dist/tests/utilities/TestConfiguration.js +6 -19
- package/dist/threads/automation.js +3 -6
- package/dist/threads/index.js +1 -15
- package/dist/threads/query.js +8 -54
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/index.js +6 -16
- package/package.json +7 -8
- package/src/api/controllers/application.ts +14 -18
- package/src/api/controllers/automation.js +2 -35
- package/src/api/controllers/backup.js +2 -3
- package/src/api/controllers/query/index.ts +1 -29
- package/src/api/controllers/row/external.js +9 -19
- package/src/api/controllers/row/internalSearch.js +0 -28
- package/src/api/controllers/row/utils.js +0 -3
- package/src/api/index.js +1 -4
- package/src/api/routes/automation.js +0 -10
- package/src/api/routes/tests/query.spec.js +0 -166
- package/src/automations/automationUtils.js +4 -19
- package/src/automations/steps/filter.js +28 -36
- package/src/automations/tests/filter.spec.js +1 -2
- package/src/automations/triggers.js +1 -1
- package/src/db/linkedRows/index.js +0 -1
- package/src/db/utils.js +13 -5
- package/src/definitions/common.ts +0 -1
- package/src/definitions/datasource.ts +0 -2
- package/src/environment.js +0 -1
- package/src/integrations/airtable.ts +0 -1
- package/src/integrations/arangodb.ts +0 -1
- package/src/integrations/base/sql.ts +11 -25
- package/src/integrations/couchdb.ts +0 -1
- package/src/integrations/dynamodb.ts +0 -1
- package/src/integrations/elasticsearch.ts +0 -1
- package/src/integrations/firebase.ts +0 -1
- package/src/integrations/googlesheets.ts +0 -1
- package/src/integrations/index.ts +0 -4
- package/src/integrations/microsoftSqlServer.ts +0 -2
- package/src/integrations/mongodb.ts +0 -1
- package/src/integrations/mysql.ts +0 -2
- package/src/integrations/oracle.ts +0 -1
- package/src/integrations/postgres.ts +0 -2
- package/src/integrations/queries/sql.ts +1 -3
- package/src/integrations/redis.ts +0 -1
- package/src/integrations/rest.ts +1 -2
- package/src/integrations/s3.ts +0 -1
- package/src/integrations/tests/rest.spec.js +1 -16
- package/src/migrations/tests/index.spec.ts +2 -18
- package/src/module.d.ts +0 -2
- package/src/tests/utilities/TestConfiguration.js +3 -22
- package/src/threads/automation.js +3 -6
- package/src/threads/index.ts +1 -5
- package/src/threads/query.js +10 -79
- package/src/utilities/fileSystem/index.js +8 -22
- package/builder/assets/index.5a233c3d.js +0 -977
- package/builder/assets/index.7786f497.css +0 -6
- package/dist/automations/logging/index.js +0 -70
- package/dist/integrations/snowflake.js +0 -102
- package/scripts/integrations/oracle/instantclient/linux/arm64/basiclite-19.10.zip +0 -0
- package/scripts/integrations/oracle/instantclient/linux/arm64/install.sh +0 -23
- package/scripts/integrations/oracle/instantclient/linux/install.sh +0 -10
- package/src/automations/logging/index.ts +0 -35
- package/src/integrations/snowflake.ts +0 -99
|
@@ -33,8 +33,7 @@ const { getTenantId, isMultiTenant } = require("@budibase/backend-core/tenancy")
|
|
|
33
33
|
const user_1 = require("./user");
|
|
34
34
|
const { app: appCache } = require("@budibase/backend-core/cache");
|
|
35
35
|
const utils_2 = require("../../automations/utils");
|
|
36
|
-
const
|
|
37
|
-
const { getAppDB, getProdAppDB, updateAppId, doInAppContext, } = require("@budibase/backend-core/context");
|
|
36
|
+
const { getAppDB, getProdAppDB, updateAppId, } = require("@budibase/backend-core/context");
|
|
38
37
|
const rows_1 = require("../../utilities/usageQuota/rows");
|
|
39
38
|
const pro_1 = require("@budibase/pro");
|
|
40
39
|
const backend_core_1 = require("@budibase/backend-core");
|
|
@@ -160,7 +159,7 @@ const fetch = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
|
-
ctx.body =
|
|
162
|
+
ctx.body = apps;
|
|
164
163
|
});
|
|
165
164
|
exports.fetch = fetch;
|
|
166
165
|
const fetchAppDefinition = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -487,21 +486,19 @@ const sync = (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
487
486
|
});
|
|
488
487
|
exports.sync = sync;
|
|
489
488
|
const updateAppPackage = (appPackage, appId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
return newAppPackage;
|
|
504
|
-
}));
|
|
489
|
+
const db = getAppDB();
|
|
490
|
+
const application = yield db.get(utils_1.DocumentTypes.APP_METADATA);
|
|
491
|
+
const newAppPackage = Object.assign(Object.assign({}, application), appPackage);
|
|
492
|
+
if (appPackage._rev !== application._rev) {
|
|
493
|
+
newAppPackage._rev = application._rev;
|
|
494
|
+
}
|
|
495
|
+
// the locked by property is attached by server but generated from
|
|
496
|
+
// Redis, shouldn't ever store it
|
|
497
|
+
delete newAppPackage.lockedBy;
|
|
498
|
+
yield db.put(newAppPackage);
|
|
499
|
+
// remove any cached metadata, so that it will be updated
|
|
500
|
+
yield appCache.invalidateAppMetadata(appId);
|
|
501
|
+
return newAppPackage;
|
|
505
502
|
});
|
|
506
503
|
const createEmptyAppPackage = (ctx, app) => __awaiter(void 0, void 0, void 0, function* () {
|
|
507
504
|
const db = getAppDB();
|
|
@@ -10,15 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
const actions = require("../../automations/actions");
|
|
12
12
|
const triggers = require("../../automations/triggers");
|
|
13
|
-
const { getAutomationParams, generateAutomationID
|
|
13
|
+
const { getAutomationParams, generateAutomationID } = require("../../db/utils");
|
|
14
14
|
const { checkForWebhooks, updateTestHistory, removeDeprecated, } = require("../../automations/utils");
|
|
15
15
|
const { deleteEntityMetadata } = require("../../utilities");
|
|
16
16
|
const { MetadataTypes } = require("../../constants");
|
|
17
17
|
const { setTestFlag, clearTestFlag } = require("../../utilities/redis");
|
|
18
|
-
const { getAppDB
|
|
18
|
+
const { getAppDB } = require("@budibase/backend-core/context");
|
|
19
19
|
const { events } = require("@budibase/backend-core");
|
|
20
|
-
const { app } = require("@budibase/backend-core/cache");
|
|
21
|
-
const { automations } = require("@budibase/pro");
|
|
22
20
|
const ACTION_DEFS = removeDeprecated(actions.ACTION_DEFINITIONS);
|
|
23
21
|
const TRIGGER_DEFS = removeDeprecated(triggers.TRIGGER_DEFINITIONS);
|
|
24
22
|
/*************************
|
|
@@ -164,30 +162,6 @@ exports.destroy = function (ctx) {
|
|
|
164
162
|
yield events.automation.deleted(oldAutomation);
|
|
165
163
|
});
|
|
166
164
|
};
|
|
167
|
-
exports.logSearch = function (ctx) {
|
|
168
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
-
ctx.body = yield automations.logs.logSearch(ctx.request.body);
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
exports.clearLogError = function (ctx) {
|
|
173
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
-
const { automationId, appId } = ctx.request.body;
|
|
175
|
-
yield doInAppContext(appId, () => __awaiter(this, void 0, void 0, function* () {
|
|
176
|
-
const db = getProdAppDB();
|
|
177
|
-
const metadata = yield db.get(DocumentTypes.APP_METADATA);
|
|
178
|
-
if (!automationId) {
|
|
179
|
-
delete metadata.automationErrors;
|
|
180
|
-
}
|
|
181
|
-
else if (metadata.automationErrors &&
|
|
182
|
-
metadata.automationErrors[automationId]) {
|
|
183
|
-
delete metadata.automationErrors[automationId];
|
|
184
|
-
}
|
|
185
|
-
yield db.put(metadata);
|
|
186
|
-
yield app.invalidateAppMetadata(metadata.appId, metadata);
|
|
187
|
-
ctx.body = { message: `Error logs cleared.` };
|
|
188
|
-
}));
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
165
|
exports.getActionList = function (ctx) {
|
|
192
166
|
return __awaiter(this, void 0, void 0, function* () {
|
|
193
167
|
ctx.body = ACTION_DEFS;
|
|
@@ -13,12 +13,11 @@ const { events, context } = require("@budibase/backend-core");
|
|
|
13
13
|
const { DocumentTypes } = require("../../db/utils");
|
|
14
14
|
exports.exportAppDump = function (ctx) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
|
|
16
|
+
const { appId } = ctx.query;
|
|
17
17
|
const appName = decodeURI(ctx.query.appname);
|
|
18
|
-
excludeRows = excludeRows === "true";
|
|
19
18
|
const backupIdentifier = `${appName}-export-${new Date().getTime()}.txt`;
|
|
20
19
|
ctx.attachment(backupIdentifier);
|
|
21
|
-
ctx.body = yield streamBackup(appId
|
|
20
|
+
ctx.body = yield streamBackup(appId);
|
|
22
21
|
yield context.doInAppContext(appId, () => __awaiter(this, void 0, void 0, function* () {
|
|
23
22
|
const appDb = context.getAppDB();
|
|
24
23
|
const app = yield appDb.get(DocumentTypes.APP_METADATA);
|
|
@@ -20,8 +20,6 @@ const environment_1 = require("../../../environment");
|
|
|
20
20
|
const context_1 = require("@budibase/backend-core/context");
|
|
21
21
|
const pro_1 = require("@budibase/pro");
|
|
22
22
|
const backend_core_1 = require("@budibase/backend-core");
|
|
23
|
-
const utils_3 = require("@budibase/backend-core/utils");
|
|
24
|
-
const constants_2 = require("@budibase/backend-core/constants");
|
|
25
23
|
const Runner = new threads_1.Thread(threads_1.ThreadType.QUERY, {
|
|
26
24
|
timeoutMs: environment_1.QUERY_THREAD_TIMEOUT || 10000,
|
|
27
25
|
});
|
|
@@ -113,19 +111,6 @@ function find(ctx) {
|
|
|
113
111
|
});
|
|
114
112
|
}
|
|
115
113
|
exports.find = find;
|
|
116
|
-
//Required to discern between OIDC OAuth config entries
|
|
117
|
-
function getOAuthConfigCookieId(ctx) {
|
|
118
|
-
if (ctx.user.providerType === constants_2.Configs.OIDC) {
|
|
119
|
-
return (0, utils_3.getCookie)(ctx, constants_2.Cookies.OIDC_CONFIG);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function getAuthConfig(ctx) {
|
|
123
|
-
const authCookie = (0, utils_3.getCookie)(ctx, constants_2.Cookies.Auth);
|
|
124
|
-
let authConfigCtx = {};
|
|
125
|
-
authConfigCtx["configId"] = getOAuthConfigCookieId(ctx);
|
|
126
|
-
authConfigCtx["sessionId"] = authCookie ? authCookie.sessionId : null;
|
|
127
|
-
return authConfigCtx;
|
|
128
|
-
}
|
|
129
114
|
function preview(ctx) {
|
|
130
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
116
|
const db = (0, context_1.getAppDB)();
|
|
@@ -134,7 +119,6 @@ function preview(ctx) {
|
|
|
134
119
|
// preview may not have a queryId as it hasn't been saved, but if it does
|
|
135
120
|
// this stops dynamic variables from calling the same query
|
|
136
121
|
const { fields, parameters, queryVerb, transformer, queryId } = query;
|
|
137
|
-
const authConfigCtx = getAuthConfig(ctx);
|
|
138
122
|
try {
|
|
139
123
|
const runFn = () => Runner.run({
|
|
140
124
|
appId: ctx.appId,
|
|
@@ -144,10 +128,6 @@ function preview(ctx) {
|
|
|
144
128
|
parameters,
|
|
145
129
|
transformer,
|
|
146
130
|
queryId,
|
|
147
|
-
ctx: {
|
|
148
|
-
user: ctx.user,
|
|
149
|
-
auth: Object.assign({}, authConfigCtx),
|
|
150
|
-
},
|
|
151
131
|
});
|
|
152
132
|
const { rows, keys, info, extra } = yield pro_1.quotas.addQuery(runFn);
|
|
153
133
|
yield backend_core_1.events.query.previewed(datasource, query);
|
|
@@ -169,7 +149,6 @@ function execute(ctx, opts = { rowsOnly: false }) {
|
|
|
169
149
|
const db = (0, context_1.getAppDB)();
|
|
170
150
|
const query = yield db.get(ctx.params.queryId);
|
|
171
151
|
const datasource = yield db.get(query.datasourceId);
|
|
172
|
-
const authConfigCtx = getAuthConfig(ctx);
|
|
173
152
|
const enrichedParameters = ctx.request.body.parameters || {};
|
|
174
153
|
// make sure parameters are fully enriched with defaults
|
|
175
154
|
if (query && query.parameters) {
|
|
@@ -190,10 +169,6 @@ function execute(ctx, opts = { rowsOnly: false }) {
|
|
|
190
169
|
parameters: enrichedParameters,
|
|
191
170
|
transformer: query.transformer,
|
|
192
171
|
queryId: ctx.params.queryId,
|
|
193
|
-
ctx: {
|
|
194
|
-
user: ctx.user,
|
|
195
|
-
auth: Object.assign({}, authConfigCtx),
|
|
196
|
-
},
|
|
197
172
|
});
|
|
198
173
|
const { rows, pagination, extra } = yield pro_1.quotas.addQuery(runFn);
|
|
199
174
|
if (opts && opts.rowsOnly) {
|
|
@@ -155,41 +155,29 @@ exports.validate = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
155
155
|
return { valid: true };
|
|
156
156
|
});
|
|
157
157
|
exports.exportRows = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
158
|
-
const { datasourceId } = breakExternalTableId(ctx.params.tableId);
|
|
158
|
+
const { datasourceId, tableName } = breakExternalTableId(ctx.params.tableId);
|
|
159
159
|
const db = getAppDB();
|
|
160
|
-
|
|
161
|
-
const { columns } = ctx.request.body;
|
|
160
|
+
let format = ctx.query.format;
|
|
162
161
|
const datasource = yield db.get(datasourceId);
|
|
163
162
|
if (!datasource || !datasource.entities) {
|
|
164
163
|
ctx.throw(400, "Datasource has not been configured for plus API.");
|
|
165
164
|
}
|
|
165
|
+
const tables = datasource.entities;
|
|
166
|
+
const table = tables[tableName];
|
|
166
167
|
ctx.request.body = {
|
|
167
168
|
query: {
|
|
168
169
|
oneOf: {
|
|
169
|
-
|
|
170
|
+
[table.primaryDisplay]: ctx.request.body.rows.map(id => breakRowIdField(id)[0]),
|
|
170
171
|
},
|
|
171
172
|
},
|
|
172
173
|
};
|
|
173
174
|
let result = yield exports.search(ctx);
|
|
174
|
-
let
|
|
175
|
-
// Filter data to only specified columns if required
|
|
176
|
-
if (columns && columns.length) {
|
|
177
|
-
for (let i = 0; i < result.rows.length; i++) {
|
|
178
|
-
rows[i] = {};
|
|
179
|
-
for (let column of columns) {
|
|
180
|
-
rows[i][column] = result.rows[i][column];
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
rows = result.rows;
|
|
186
|
-
}
|
|
187
|
-
let headers = Object.keys(rows[0]);
|
|
175
|
+
let headers = Object.keys(result.rows[0]);
|
|
188
176
|
const exporter = exporters[format];
|
|
189
177
|
const filename = `export.${format}`;
|
|
190
178
|
// send down the file
|
|
191
179
|
ctx.attachment(filename);
|
|
192
|
-
return apiFileReturn(exporter(headers, rows));
|
|
180
|
+
return apiFileReturn(exporter(headers, result.rows));
|
|
193
181
|
});
|
|
194
182
|
exports.fetchEnrichedRow = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
195
183
|
const id = ctx.params.rowId;
|
|
@@ -18,7 +18,7 @@ const { getAppId } = require("@budibase/backend-core/context");
|
|
|
18
18
|
*/
|
|
19
19
|
class QueryBuilder {
|
|
20
20
|
constructor(base) {
|
|
21
|
-
this.query = Object.assign({ string: {}, fuzzy: {}, range: {}, equal: {}, notEqual: {}, empty: {}, notEmpty: {}
|
|
21
|
+
this.query = Object.assign({ string: {}, fuzzy: {}, range: {}, equal: {}, notEqual: {}, empty: {}, notEmpty: {} }, base);
|
|
22
22
|
this.limit = 50;
|
|
23
23
|
this.sortOrder = "ascending";
|
|
24
24
|
this.sortType = "string";
|
|
@@ -96,10 +96,6 @@ class QueryBuilder {
|
|
|
96
96
|
this.query.notEmpty[key] = value;
|
|
97
97
|
return this;
|
|
98
98
|
}
|
|
99
|
-
addOneOf(key, value) {
|
|
100
|
-
this.query.oneOf[key] = value;
|
|
101
|
-
return this;
|
|
102
|
-
}
|
|
103
99
|
/**
|
|
104
100
|
* Preprocesses a value before going into a lucene search.
|
|
105
101
|
* Transforms strings to lowercase and wraps strings and bools in quotes.
|
|
@@ -205,23 +201,6 @@ class QueryBuilder {
|
|
|
205
201
|
if (this.query.notEmpty) {
|
|
206
202
|
build(this.query.notEmpty, key => `${key}:["" TO *]`);
|
|
207
203
|
}
|
|
208
|
-
if (this.query.oneOf) {
|
|
209
|
-
build(this.query.oneOf, (key, value) => {
|
|
210
|
-
if (!Array.isArray(value)) {
|
|
211
|
-
if (typeof value === "string") {
|
|
212
|
-
value = value.split(",");
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
return "";
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
let orStatement = `${builder.preprocess(value[0], allPreProcessingOpts)}`;
|
|
219
|
-
for (let i = 1; i < value.length; i++) {
|
|
220
|
-
orStatement += ` OR ${builder.preprocess(value[i], allPreProcessingOpts)}`;
|
|
221
|
-
}
|
|
222
|
-
return `${key}:(${orStatement})`;
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
204
|
return query;
|
|
226
205
|
}
|
|
227
206
|
buildSearchBody() {
|
|
@@ -70,9 +70,6 @@ exports.validate = ({ tableId, row, table }) => __awaiter(void 0, void 0, void 0
|
|
|
70
70
|
// Validate.js doesn't seem to handle array
|
|
71
71
|
if (type === FieldTypes.ARRAY && row[fieldName]) {
|
|
72
72
|
if (row[fieldName].length) {
|
|
73
|
-
if (!Array.isArray(row[fieldName])) {
|
|
74
|
-
row[fieldName] = row[fieldName].split(",");
|
|
75
|
-
}
|
|
76
73
|
row[fieldName].map(val => {
|
|
77
74
|
if (!constraints.inclusion.includes(val) &&
|
|
78
75
|
constraints.inclusion.length !== 0) {
|
package/dist/api/index.js
CHANGED
|
@@ -69,10 +69,7 @@ router.use((ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
69
69
|
error,
|
|
70
70
|
};
|
|
71
71
|
ctx.log.error(err);
|
|
72
|
-
|
|
73
|
-
if (!env.isTest()) {
|
|
74
|
-
console.trace(err);
|
|
75
|
-
}
|
|
72
|
+
console.trace(err);
|
|
76
73
|
}
|
|
77
74
|
}));
|
|
78
75
|
// authenticated routes
|
|
@@ -15,8 +15,6 @@ router
|
|
|
15
15
|
.get("/api/automations/:id", paramResource("id"), authorized(BUILDER), controller.find)
|
|
16
16
|
.put("/api/automations", bodyResource("_id"), authorized(BUILDER), automationValidator(true), controller.update)
|
|
17
17
|
.post("/api/automations", authorized(BUILDER), automationValidator(false), controller.create)
|
|
18
|
-
.post("/api/automations/logs/search", authorized(BUILDER), controller.logSearch)
|
|
19
|
-
.delete("/api/automations/logs", authorized(BUILDER), controller.clearLogError)
|
|
20
18
|
.delete("/api/automations/:id/:rev", paramResource("id"), authorized(BUILDER), controller.destroy)
|
|
21
19
|
.post("/api/automations/:id/trigger", appInfoMiddleware({ appType: AppType.PROD }), paramResource("id"), authorized(PermissionTypes.AUTOMATION, PermissionLevels.EXECUTE), controller.trigger)
|
|
22
20
|
.post("/api/automations/:id/test", appInfoMiddleware({ appType: AppType.DEV }), paramResource("id"), authorized(PermissionTypes.AUTOMATION, PermissionLevels.EXECUTE), controller.test);
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
const { getTable } = require("../api/controllers/table/utils");
|
|
12
|
-
const { findHBSBlocks
|
|
12
|
+
const { findHBSBlocks } = require("@budibase/string-templates");
|
|
13
13
|
/**
|
|
14
14
|
* When values are input to the system generally they will be of type string as this is required for template strings.
|
|
15
15
|
* This can generate some odd scenarios as the Schema of the automation requires a number but the builder might supply
|
|
@@ -81,23 +81,11 @@ exports.getError = err => {
|
|
|
81
81
|
return typeof err !== "string" ? err.toString() : err;
|
|
82
82
|
};
|
|
83
83
|
exports.substituteLoopStep = (hbsString, substitute) => {
|
|
84
|
-
let blocks =
|
|
85
|
-
let checkForJS = isJSBinding(hbsString);
|
|
86
|
-
if (checkForJS) {
|
|
87
|
-
hbsString = decodeJSBinding(hbsString);
|
|
88
|
-
blocks.push(hbsString);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
blocks = findHBSBlocks(hbsString);
|
|
92
|
-
}
|
|
84
|
+
let blocks = findHBSBlocks(hbsString);
|
|
93
85
|
for (let block of blocks) {
|
|
86
|
+
let oldBlock = block;
|
|
94
87
|
block = block.replace(/loop/, substitute);
|
|
95
|
-
|
|
96
|
-
hbsString = encodeJSBinding(block);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
hbsString = block;
|
|
100
|
-
}
|
|
88
|
+
hbsString = hbsString.replace(new RegExp(oldBlock, "g"), block);
|
|
101
89
|
}
|
|
102
90
|
return hbsString;
|
|
103
91
|
};
|
|
@@ -56,55 +56,46 @@ exports.definition = {
|
|
|
56
56
|
outputs: {
|
|
57
57
|
properties: {
|
|
58
58
|
success: {
|
|
59
|
-
type: "boolean",
|
|
60
|
-
description: "Whether the action was successful",
|
|
61
|
-
},
|
|
62
|
-
result: {
|
|
63
59
|
type: "boolean",
|
|
64
60
|
description: "Whether the logic block passed",
|
|
65
61
|
},
|
|
66
62
|
},
|
|
67
|
-
required: ["success"
|
|
63
|
+
required: ["success"],
|
|
68
64
|
},
|
|
69
65
|
},
|
|
70
66
|
};
|
|
71
67
|
exports.run = function filter({ inputs }) {
|
|
72
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
result = false;
|
|
69
|
+
let { field, condition, value } = inputs;
|
|
70
|
+
// coerce types so that we can use them
|
|
71
|
+
if (!isNaN(value) && !isNaN(field)) {
|
|
72
|
+
value = parseFloat(value);
|
|
73
|
+
field = parseFloat(field);
|
|
74
|
+
}
|
|
75
|
+
else if (!isNaN(Date.parse(value)) && !isNaN(Date.parse(field))) {
|
|
76
|
+
value = Date.parse(value);
|
|
77
|
+
field = Date.parse(field);
|
|
78
|
+
}
|
|
79
|
+
let success = false;
|
|
80
|
+
if (typeof field !== "object" && typeof value !== "object") {
|
|
81
|
+
switch (condition) {
|
|
82
|
+
case FilterConditions.EQUAL:
|
|
83
|
+
success = field === value;
|
|
84
|
+
break;
|
|
85
|
+
case FilterConditions.NOT_EQUAL:
|
|
86
|
+
success = field !== value;
|
|
87
|
+
break;
|
|
88
|
+
case FilterConditions.GREATER_THAN:
|
|
89
|
+
success = field > value;
|
|
90
|
+
break;
|
|
91
|
+
case FilterConditions.LESS_THAN:
|
|
92
|
+
success = field < value;
|
|
93
|
+
break;
|
|
103
94
|
}
|
|
104
|
-
return { success: true, result };
|
|
105
95
|
}
|
|
106
|
-
|
|
107
|
-
|
|
96
|
+
else {
|
|
97
|
+
success = false;
|
|
108
98
|
}
|
|
99
|
+
return { success };
|
|
109
100
|
});
|
|
110
101
|
};
|
|
@@ -95,7 +95,7 @@ exports.externalTrigger = function (automation, params, { getResponses } = {}) {
|
|
|
95
95
|
// values are likely to be submitted as strings, so we shall convert to correct type
|
|
96
96
|
const coercedFields = {};
|
|
97
97
|
const fields = automation.definition.trigger.inputs.fields;
|
|
98
|
-
for (let key of Object.keys(fields
|
|
98
|
+
for (let key of Object.keys(fields)) {
|
|
99
99
|
coercedFields[key] = coerce(params.fields[key], fields[key]);
|
|
100
100
|
}
|
|
101
101
|
params.fields = coercedFields;
|
|
@@ -56,7 +56,6 @@ function getLinksForRows(rows) {
|
|
|
56
56
|
// have to get unique as the previous table query can
|
|
57
57
|
// return duplicates, could be querying for both tables in a relation
|
|
58
58
|
return getUniqueByProp(responses
|
|
59
|
-
.filter(el => el != null)
|
|
60
59
|
// create a unique ID which we can use for getting only unique ones
|
|
61
60
|
.map(el => (Object.assign(Object.assign({}, el), { unique: el.id + el.thisId + el.fieldName }))), "unique");
|
|
62
61
|
});
|
package/dist/db/utils.js
CHANGED
|
@@ -1,13 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const newid = require("./newid");
|
|
3
|
-
const { DocumentTypes: CoreDocTypes, getRoleParams, generateRoleID, APP_DEV_PREFIX, APP_PREFIX, SEPARATOR, StaticDatabases, isDevAppID, isProdAppID, getDevelopmentAppID, generateAppID,
|
|
3
|
+
const { DocumentTypes: CoreDocTypes, getRoleParams, generateRoleID, APP_DEV_PREFIX, APP_PREFIX, SEPARATOR, StaticDatabases, isDevAppID, isProdAppID, getDevelopmentAppID, generateAppID, } = require("@budibase/backend-core/db");
|
|
4
4
|
const UNICODE_MAX = "\ufff0";
|
|
5
5
|
const AppStatus = {
|
|
6
6
|
DEV: "development",
|
|
7
7
|
ALL: "all",
|
|
8
8
|
DEPLOYED: "published",
|
|
9
9
|
};
|
|
10
|
-
const DocumentTypes =
|
|
10
|
+
const DocumentTypes = {
|
|
11
|
+
APP: CoreDocTypes.APP,
|
|
12
|
+
DEV: CoreDocTypes.DEV,
|
|
13
|
+
APP_DEV: CoreDocTypes.APP_DEV,
|
|
14
|
+
APP_METADATA: CoreDocTypes.APP_METADATA,
|
|
15
|
+
ROLE: CoreDocTypes.ROLE,
|
|
16
|
+
TABLE: "ta",
|
|
17
|
+
ROW: "ro",
|
|
18
|
+
USER: "us",
|
|
19
|
+
AUTOMATION: "au",
|
|
20
|
+
LINK: "li",
|
|
21
|
+
WEBHOOK: "wh",
|
|
22
|
+
INSTANCE: "inst",
|
|
23
|
+
LAYOUT: "layout",
|
|
24
|
+
SCREEN: "screen",
|
|
25
|
+
DATASOURCE: "datasource",
|
|
26
|
+
DATASOURCE_PLUS: "datasource_plus",
|
|
27
|
+
QUERY: "query",
|
|
28
|
+
DEPLOYMENTS: "deployments",
|
|
29
|
+
METADATA: "metadata",
|
|
30
|
+
MEM_VIEW: "view",
|
|
31
|
+
USER_FLAG: "flag",
|
|
32
|
+
};
|
|
33
|
+
const ViewNames = {
|
|
34
|
+
LINK: "by_link",
|
|
35
|
+
ROUTING: "screen_routes",
|
|
36
|
+
};
|
|
11
37
|
const InternalTables = {
|
|
12
38
|
USER_METADATA: "ta_users",
|
|
13
39
|
};
|
|
@@ -28,7 +54,6 @@ exports.isDevAppID = isDevAppID;
|
|
|
28
54
|
exports.isProdAppID = isProdAppID;
|
|
29
55
|
exports.USER_METDATA_PREFIX = `${DocumentTypes.ROW}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`;
|
|
30
56
|
exports.LINK_USER_METADATA_PREFIX = `${DocumentTypes.LINK}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`;
|
|
31
|
-
exports.TABLE_ROW_PREFIX = `${DocumentTypes.ROW}${SEPARATOR}${DocumentTypes.TABLE}`;
|
|
32
57
|
exports.ViewNames = ViewNames;
|
|
33
58
|
exports.InternalTables = InternalTables;
|
|
34
59
|
exports.DocumentTypes = DocumentTypes;
|
|
@@ -41,7 +66,9 @@ exports.generateAppID = generateAppID;
|
|
|
41
66
|
exports.generateDevAppID = getDevelopmentAppID;
|
|
42
67
|
exports.generateRoleID = generateRoleID;
|
|
43
68
|
exports.getRoleParams = getRoleParams;
|
|
44
|
-
exports.getQueryIndex =
|
|
69
|
+
exports.getQueryIndex = viewName => {
|
|
70
|
+
return `database/${viewName}`;
|
|
71
|
+
};
|
|
45
72
|
/**
|
|
46
73
|
* If creating DB allDocs/query params with only a single top level ID this can be used, this
|
|
47
74
|
* is usually the case as most of our docs are top level e.g. tables, automations, users and so on.
|
|
@@ -52,7 +52,6 @@ var SourceNames;
|
|
|
52
52
|
SourceNames["GOOGLE_SHEETS"] = "GOOGLE_SHEETS";
|
|
53
53
|
SourceNames["FIRESTORE"] = "FIRESTORE";
|
|
54
54
|
SourceNames["REDIS"] = "REDIS";
|
|
55
|
-
SourceNames["SNOWFLAKE"] = "SNOWFLAKE";
|
|
56
55
|
})(SourceNames = exports.SourceNames || (exports.SourceNames = {}));
|
|
57
56
|
var IncludeRelationships;
|
|
58
57
|
(function (IncludeRelationships) {
|
package/dist/environment.js
CHANGED
|
@@ -66,7 +66,6 @@ module.exports = {
|
|
|
66
66
|
ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
|
|
67
67
|
DISABLE_THREADING: process.env.DISABLE_THREADING,
|
|
68
68
|
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
|
|
69
|
-
DISABLE_AUTOMATION_LOGS: process.env.DISABLE_AUTOMATION_LOGS,
|
|
70
69
|
MULTI_TENANCY: process.env.MULTI_TENANCY,
|
|
71
70
|
ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS,
|
|
72
71
|
SELF_HOSTED: process.env.SELF_HOSTED,
|
|
@@ -17,7 +17,6 @@ var AirtableModule;
|
|
|
17
17
|
docs: "https://airtable.com/api",
|
|
18
18
|
description: "Airtable is a spreadsheet-database hybrid, with the features of a database but applied to a spreadsheet.",
|
|
19
19
|
friendlyName: "Airtable",
|
|
20
|
-
type: "Spreadsheet",
|
|
21
20
|
datasource: {
|
|
22
21
|
apiKey: {
|
|
23
22
|
type: datasource_1.DatasourceFieldTypes.PASSWORD,
|
|
@@ -16,7 +16,6 @@ var ArangoModule;
|
|
|
16
16
|
const SCHEMA = {
|
|
17
17
|
docs: "https://github.com/arangodb/arangojs",
|
|
18
18
|
friendlyName: "ArangoDB",
|
|
19
|
-
type: "Non-relational",
|
|
20
19
|
description: "ArangoDB is a scalable open-source multi-model database natively supporting graph, document and search. All supported data models & access patterns can be combined in queries allowing for maximal flexibility. ",
|
|
21
20
|
datasource: {
|
|
22
21
|
url: {
|
|
@@ -89,23 +89,6 @@ function parseFilters(filters) {
|
|
|
89
89
|
}
|
|
90
90
|
return filters;
|
|
91
91
|
}
|
|
92
|
-
function generateSelectStatement(json, knex) {
|
|
93
|
-
var _a;
|
|
94
|
-
const { resource, meta } = json;
|
|
95
|
-
const schema = (_a = meta === null || meta === void 0 ? void 0 : meta.table) === null || _a === void 0 ? void 0 : _a.schema;
|
|
96
|
-
return resource.fields.map(field => {
|
|
97
|
-
const fieldNames = field.split(/\./g);
|
|
98
|
-
const tableName = fieldNames[0];
|
|
99
|
-
const columnName = fieldNames[1];
|
|
100
|
-
if (columnName && knex.client.config.client === utils_1.SqlClients.POSTGRES) {
|
|
101
|
-
const externalType = schema === null || schema === void 0 ? void 0 : schema[columnName].externalType;
|
|
102
|
-
if (externalType === null || externalType === void 0 ? void 0 : externalType.includes("money")) {
|
|
103
|
-
return knex.raw(`"${tableName}"."${columnName}"::money::numeric as "${field}"`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return `${field} as ${field}`;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
92
|
class InternalBuilder {
|
|
110
93
|
constructor(client) {
|
|
111
94
|
this.client = client;
|
|
@@ -226,7 +209,7 @@ class InternalBuilder {
|
|
|
226
209
|
}
|
|
227
210
|
return query;
|
|
228
211
|
}
|
|
229
|
-
addRelationships(query, fromTable, relationships) {
|
|
212
|
+
addRelationships(knex, query, fields, fromTable, relationships) {
|
|
230
213
|
if (!relationships) {
|
|
231
214
|
return query;
|
|
232
215
|
}
|
|
@@ -328,7 +311,7 @@ class InternalBuilder {
|
|
|
328
311
|
if (resource.fields && resource.fields.length > 0) {
|
|
329
312
|
// select the resources as the format "table.columnName" - this is what is provided
|
|
330
313
|
// by the resource builder further up
|
|
331
|
-
selectStatement =
|
|
314
|
+
selectStatement = resource.fields.map(field => `${field} as ${field}`);
|
|
332
315
|
}
|
|
333
316
|
let foundLimit = limit || BASE_LIMIT;
|
|
334
317
|
// handle pagination
|
|
@@ -364,7 +347,7 @@ class InternalBuilder {
|
|
|
364
347
|
preQuery = this.addSorting(preQuery, json);
|
|
365
348
|
}
|
|
366
349
|
// handle joins
|
|
367
|
-
query = this.addRelationships(preQuery, tableName, relationships);
|
|
350
|
+
query = this.addRelationships(knex, preQuery, selectStatement, tableName, relationships);
|
|
368
351
|
return this.addFilters(query, filters, { relationship: true });
|
|
369
352
|
}
|
|
370
353
|
update(knex, json, opts) {
|
|
@@ -16,7 +16,6 @@ var CouchDBModule;
|
|
|
16
16
|
const SCHEMA = {
|
|
17
17
|
docs: "https://docs.couchdb.org/en/stable/",
|
|
18
18
|
friendlyName: "CouchDB",
|
|
19
|
-
type: "Non-relational",
|
|
20
19
|
description: "Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.",
|
|
21
20
|
datasource: {
|
|
22
21
|
url: {
|
|
@@ -18,7 +18,6 @@ var DynamoModule;
|
|
|
18
18
|
docs: "https://github.com/dabit3/dynamodb-documentclient-cheat-sheet",
|
|
19
19
|
description: "Amazon DynamoDB is a key-value and document database that delivers single-digit millisecond performance at any scale.",
|
|
20
20
|
friendlyName: "DynamoDB",
|
|
21
|
-
type: "Non-relational",
|
|
22
21
|
datasource: {
|
|
23
22
|
region: {
|
|
24
23
|
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
@@ -17,7 +17,6 @@ var ElasticsearchModule;
|
|
|
17
17
|
docs: "https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
|
|
18
18
|
description: "Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.",
|
|
19
19
|
friendlyName: "ElasticSearch",
|
|
20
|
-
type: "Non-relational",
|
|
21
20
|
datasource: {
|
|
22
21
|
url: {
|
|
23
22
|
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
@@ -16,7 +16,6 @@ var Firebase;
|
|
|
16
16
|
const SCHEMA = {
|
|
17
17
|
docs: "https://firebase.google.com/docs/firestore/quickstart",
|
|
18
18
|
friendlyName: "Firestore",
|
|
19
|
-
type: "Non-relational",
|
|
20
19
|
description: "Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.",
|
|
21
20
|
datasource: {
|
|
22
21
|
email: {
|