@budibase/server 1.0.219 → 1.0.220-alpha.2
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/.yarnrc +1 -0
- package/__mocks__/node-fetch.ts +9 -0
- package/builder/assets/index.7786f497.css +6 -0
- package/builder/assets/index.e1885c5f.js +974 -0
- package/builder/assets/{vendor.9bf2fcb4.js → vendor.001dcf8c.js} +163 -163
- package/builder/index.html +3 -3
- package/coverage/clover.xml +1018 -950
- package/coverage/coverage-final.json +31 -31
- 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 +111 -12
- package/coverage/lcov-report/api/controllers/backup.js.html +9 -6
- 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 +13 -166
- package/coverage/lcov-report/api/controllers/index.html +32 -32
- 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 +47 -17
- package/coverage/lcov-report/api/controllers/row/index.html +33 -33
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +159 -21
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +17 -8
- 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 +22 -13
- 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 +32 -2
- 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 +2 -5
- 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 +5 -2
- 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 +57 -12
- 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 +2 -2
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +58 -34
- 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 +10 -7
- 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 +27 -51
- 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 +83 -83
- 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 +18 -9
- package/coverage/lcov-report/threads/index.html +25 -25
- package/coverage/lcov-report/threads/query.js.html +301 -79
- 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 +26 -26
- package/coverage/lcov-report/utilities/index.js.html +17 -32
- 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 +57 -9
- package/coverage/lcov.info +1789 -1665
- package/dist/api/controllers/application.js +19 -16
- package/dist/api/controllers/automation.js +28 -2
- package/dist/api/controllers/backup.js +3 -2
- package/dist/api/controllers/dev.js +2 -40
- package/dist/api/controllers/public/applications.js +1 -1
- package/dist/api/controllers/public/utils.js +8 -1
- package/dist/api/controllers/query/index.js +31 -3
- package/dist/api/controllers/row/external.js +19 -7
- package/dist/api/controllers/row/internalSearch.js +47 -10
- package/dist/api/controllers/row/utils.js +3 -0
- package/dist/api/controllers/static/index.js +1 -5
- package/dist/api/index.js +4 -1
- package/dist/api/routes/automation.js +2 -0
- package/dist/api/routes/dev.js +1 -2
- package/dist/api/routes/public/rows.js +7 -2
- package/dist/api/routes/utils/validators.js +1 -0
- package/dist/app.js +20 -0
- package/dist/automations/automationUtils.js +16 -4
- package/dist/automations/logging/index.js +70 -0
- package/dist/automations/steps/executeQuery.js +1 -1
- package/dist/automations/steps/filter.js +38 -29
- package/dist/automations/triggers.js +1 -1
- package/dist/db/linkedRows/index.js +1 -0
- package/dist/db/utils.js +4 -31
- package/dist/definitions/datasource.js +1 -0
- package/dist/environment.js +3 -0
- package/dist/integrations/airtable.js +1 -0
- package/dist/integrations/arangodb.js +1 -0
- package/dist/integrations/base/sql.js +22 -3
- package/dist/integrations/couchdb.js +1 -0
- package/dist/integrations/dynamodb.js +1 -0
- package/dist/integrations/elasticsearch.js +1 -0
- package/dist/integrations/firebase.js +1 -0
- package/dist/integrations/googlesheets.js +1 -0
- package/dist/integrations/index.js +4 -0
- package/dist/integrations/microsoftSqlServer.js +2 -1
- package/dist/integrations/mongodb.js +1 -0
- package/dist/integrations/mysql.js +2 -1
- package/dist/integrations/oracle.js +1 -0
- package/dist/integrations/postgres.js +2 -1
- package/dist/integrations/queries/sql.js +3 -0
- package/dist/integrations/redis.js +1 -0
- package/dist/integrations/rest.js +2 -1
- package/dist/integrations/s3.js +1 -0
- package/dist/integrations/snowflake.js +102 -0
- package/dist/package.json +7 -6
- package/dist/tests/utilities/TestConfiguration.js +19 -6
- package/dist/threads/automation.js +6 -3
- package/dist/threads/index.js +15 -1
- package/dist/threads/query.js +65 -12
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/index.js +16 -6
- package/dist/utilities/index.js +1 -5
- package/dist/utilities/workerRequests.js +8 -0
- package/package.json +8 -7
- package/scripts/dev/manage.js +2 -0
- package/scripts/integrations/oracle/instantclient/linux/arm64/basiclite-19.10.zip +0 -0
- package/scripts/integrations/oracle/instantclient/linux/arm64/install.sh +23 -0
- package/scripts/integrations/oracle/instantclient/linux/install.sh +10 -0
- package/specs/openapi.json +9 -5
- package/specs/openapi.yaml +10 -4
- package/src/api/controllers/application.ts +19 -19
- package/src/api/controllers/automation.js +35 -2
- package/src/api/controllers/backup.js +3 -2
- package/src/api/controllers/dev.js +2 -53
- package/src/api/controllers/public/applications.ts +2 -2
- package/src/api/controllers/public/utils.ts +8 -1
- package/src/api/controllers/query/index.ts +40 -4
- package/src/api/controllers/row/external.js +19 -9
- package/src/api/controllers/row/internalSearch.js +55 -9
- package/src/api/controllers/row/utils.js +3 -0
- package/src/api/controllers/static/index.js +1 -6
- package/src/api/index.js +4 -1
- package/src/api/routes/automation.js +10 -0
- package/src/api/routes/dev.js +0 -1
- package/src/api/routes/public/rows.ts +7 -2
- package/src/api/routes/tests/query.spec.js +166 -1
- package/src/api/routes/utils/validators.js +1 -0
- package/src/app.ts +30 -1
- package/src/automations/automationUtils.js +19 -4
- package/src/automations/logging/index.ts +35 -0
- package/src/automations/steps/executeQuery.js +1 -1
- package/src/automations/steps/filter.js +36 -28
- package/src/automations/tests/filter.spec.js +2 -1
- package/src/automations/triggers.js +1 -1
- package/src/db/linkedRows/index.js +1 -0
- package/src/db/utils.js +5 -13
- package/src/definitions/common.ts +1 -0
- package/src/definitions/datasource.ts +2 -0
- package/src/definitions/openapi.ts +471 -469
- package/src/environment.js +3 -0
- package/src/integrations/airtable.ts +1 -0
- package/src/integrations/arangodb.ts +1 -0
- package/src/integrations/base/sql.ts +29 -11
- package/src/integrations/couchdb.ts +1 -0
- package/src/integrations/dynamodb.ts +1 -0
- package/src/integrations/elasticsearch.ts +1 -0
- package/src/integrations/firebase.ts +1 -0
- package/src/integrations/googlesheets.ts +1 -0
- package/src/integrations/index.ts +4 -0
- package/src/integrations/microsoftSqlServer.ts +2 -0
- package/src/integrations/mongodb.ts +1 -0
- package/src/integrations/mysql.ts +2 -0
- package/src/integrations/oracle.ts +1 -0
- package/src/integrations/postgres.ts +2 -0
- package/src/integrations/queries/sql.ts +3 -1
- package/src/integrations/redis.ts +1 -0
- package/src/integrations/rest.ts +2 -1
- package/src/integrations/s3.ts +1 -0
- package/src/integrations/snowflake.ts +99 -0
- package/src/integrations/tests/rest.spec.js +16 -1
- package/src/migrations/tests/index.spec.ts +18 -2
- package/src/module.d.ts +2 -0
- package/src/tests/utilities/TestConfiguration.js +22 -3
- package/src/threads/automation.js +6 -3
- package/src/threads/index.ts +5 -1
- package/src/threads/query.js +88 -14
- package/src/utilities/fileSystem/index.js +22 -8
- package/src/utilities/index.js +1 -6
- package/src/utilities/workerRequests.js +16 -0
- package/builder/assets/index.1c640a53.js +0 -1316
- package/builder/assets/index.24307ca0.css +0 -6
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.checkAppMetadata = exports.storeLog = void 0;
|
|
36
|
+
const env = __importStar(require("../../environment"));
|
|
37
|
+
const pro_1 = require("@budibase/pro");
|
|
38
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
39
|
+
function storeLog(automation, results) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
// can disable this if un-needed in self-host, also only do this for prod apps
|
|
42
|
+
if (env.DISABLE_AUTOMATION_LOGS) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
yield pro_1.automations.logs.storeLog(automation, results);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
exports.storeLog = storeLog;
|
|
49
|
+
function checkAppMetadata(apps) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const maxStartDate = yield pro_1.automations.logs.oldestLogDate();
|
|
52
|
+
for (let metadata of apps) {
|
|
53
|
+
if (!metadata.automationErrors) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
for (let [key, errors] of Object.entries(metadata.automationErrors)) {
|
|
57
|
+
const updated = [];
|
|
58
|
+
for (let error of errors) {
|
|
59
|
+
const startDate = error.split(backend_core_1.db.SEPARATOR)[2];
|
|
60
|
+
if (startDate > maxStartDate) {
|
|
61
|
+
updated.push(error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
metadata.automationErrors[key] = updated;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return apps;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
exports.checkAppMetadata = checkAppMetadata;
|
|
@@ -88,7 +88,7 @@ exports.run = function ({ inputs, appId, emitter }) {
|
|
|
88
88
|
},
|
|
89
89
|
});
|
|
90
90
|
try {
|
|
91
|
-
yield queryController.executeV2(ctx);
|
|
91
|
+
yield queryController.executeV2(ctx, { isAutomation: true });
|
|
92
92
|
const _b = ctx.body, { data } = _b, rest = __rest(_b, ["data"]);
|
|
93
93
|
return {
|
|
94
94
|
response: data,
|
|
@@ -56,46 +56,55 @@ exports.definition = {
|
|
|
56
56
|
outputs: {
|
|
57
57
|
properties: {
|
|
58
58
|
success: {
|
|
59
|
+
type: "boolean",
|
|
60
|
+
description: "Whether the action was successful",
|
|
61
|
+
},
|
|
62
|
+
result: {
|
|
59
63
|
type: "boolean",
|
|
60
64
|
description: "Whether the logic block passed",
|
|
61
65
|
},
|
|
62
66
|
},
|
|
63
|
-
required: ["success"],
|
|
67
|
+
required: ["success", "result"],
|
|
64
68
|
},
|
|
65
69
|
},
|
|
66
70
|
};
|
|
67
71
|
exports.run = function filter({ inputs }) {
|
|
68
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
value
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
73
|
+
try {
|
|
74
|
+
let { field, condition, value } = inputs;
|
|
75
|
+
// coerce types so that we can use them
|
|
76
|
+
if (!isNaN(value) && !isNaN(field)) {
|
|
77
|
+
value = parseFloat(value);
|
|
78
|
+
field = parseFloat(field);
|
|
79
|
+
}
|
|
80
|
+
else if (!isNaN(Date.parse(value)) && !isNaN(Date.parse(field))) {
|
|
81
|
+
value = Date.parse(value);
|
|
82
|
+
field = Date.parse(field);
|
|
83
|
+
}
|
|
84
|
+
let result = false;
|
|
85
|
+
if (typeof field !== "object" && typeof value !== "object") {
|
|
86
|
+
switch (condition) {
|
|
87
|
+
case FilterConditions.EQUAL:
|
|
88
|
+
result = field === value;
|
|
89
|
+
break;
|
|
90
|
+
case FilterConditions.NOT_EQUAL:
|
|
91
|
+
result = field !== value;
|
|
92
|
+
break;
|
|
93
|
+
case FilterConditions.GREATER_THAN:
|
|
94
|
+
result = field > value;
|
|
95
|
+
break;
|
|
96
|
+
case FilterConditions.LESS_THAN:
|
|
97
|
+
result = field < value;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
result = false;
|
|
94
103
|
}
|
|
104
|
+
return { success: true, result };
|
|
95
105
|
}
|
|
96
|
-
|
|
97
|
-
success
|
|
106
|
+
catch (err) {
|
|
107
|
+
return { success: false, result: false };
|
|
98
108
|
}
|
|
99
|
-
return { success };
|
|
100
109
|
});
|
|
101
110
|
};
|
|
@@ -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,6 +56,7 @@ 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)
|
|
59
60
|
// create a unique ID which we can use for getting only unique ones
|
|
60
61
|
.map(el => (Object.assign(Object.assign({}, el), { unique: el.id + el.thisId + el.fieldName }))), "unique");
|
|
61
62
|
});
|
package/dist/db/utils.js
CHANGED
|
@@ -1,39 +1,13 @@
|
|
|
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, } = require("@budibase/backend-core/db");
|
|
3
|
+
const { DocumentTypes: CoreDocTypes, getRoleParams, generateRoleID, APP_DEV_PREFIX, APP_PREFIX, SEPARATOR, StaticDatabases, isDevAppID, isProdAppID, getDevelopmentAppID, generateAppID, getQueryIndex, ViewNames, } = 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 = {
|
|
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
|
-
};
|
|
10
|
+
const DocumentTypes = Object.assign(Object.assign({}, CoreDocTypes), { TABLE: "ta", ROW: "ro", USER: "us", AUTOMATION: "au", LINK: "li", WEBHOOK: "wh", INSTANCE: "inst", LAYOUT: "layout", SCREEN: "screen", DATASOURCE: "datasource", DATASOURCE_PLUS: "datasource_plus", QUERY: "query", DEPLOYMENTS: "deployments", METADATA: "metadata", MEM_VIEW: "view", USER_FLAG: "flag" });
|
|
37
11
|
const InternalTables = {
|
|
38
12
|
USER_METADATA: "ta_users",
|
|
39
13
|
};
|
|
@@ -54,6 +28,7 @@ exports.isDevAppID = isDevAppID;
|
|
|
54
28
|
exports.isProdAppID = isProdAppID;
|
|
55
29
|
exports.USER_METDATA_PREFIX = `${DocumentTypes.ROW}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`;
|
|
56
30
|
exports.LINK_USER_METADATA_PREFIX = `${DocumentTypes.LINK}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`;
|
|
31
|
+
exports.TABLE_ROW_PREFIX = `${DocumentTypes.ROW}${SEPARATOR}${DocumentTypes.TABLE}`;
|
|
57
32
|
exports.ViewNames = ViewNames;
|
|
58
33
|
exports.InternalTables = InternalTables;
|
|
59
34
|
exports.DocumentTypes = DocumentTypes;
|
|
@@ -66,9 +41,7 @@ exports.generateAppID = generateAppID;
|
|
|
66
41
|
exports.generateDevAppID = getDevelopmentAppID;
|
|
67
42
|
exports.generateRoleID = generateRoleID;
|
|
68
43
|
exports.getRoleParams = getRoleParams;
|
|
69
|
-
exports.getQueryIndex =
|
|
70
|
-
return `database/${viewName}`;
|
|
71
|
-
};
|
|
44
|
+
exports.getQueryIndex = getQueryIndex;
|
|
72
45
|
/**
|
|
73
46
|
* If creating DB allDocs/query params with only a single top level ID this can be used, this
|
|
74
47
|
* is usually the case as most of our docs are top level e.g. tables, automations, users and so on.
|
|
@@ -52,6 +52,7 @@ var SourceNames;
|
|
|
52
52
|
SourceNames["GOOGLE_SHEETS"] = "GOOGLE_SHEETS";
|
|
53
53
|
SourceNames["FIRESTORE"] = "FIRESTORE";
|
|
54
54
|
SourceNames["REDIS"] = "REDIS";
|
|
55
|
+
SourceNames["SNOWFLAKE"] = "SNOWFLAKE";
|
|
55
56
|
})(SourceNames = exports.SourceNames || (exports.SourceNames = {}));
|
|
56
57
|
var IncludeRelationships;
|
|
57
58
|
(function (IncludeRelationships) {
|
package/dist/environment.js
CHANGED
|
@@ -62,10 +62,13 @@ module.exports = {
|
|
|
62
62
|
DYNAMO_ENDPOINT: process.env.DYNAMO_ENDPOINT,
|
|
63
63
|
QUERY_THREAD_TIMEOUT: parseIntSafe(process.env.QUERY_THREAD_TIMEOUT),
|
|
64
64
|
SQL_MAX_ROWS: process.env.SQL_MAX_ROWS,
|
|
65
|
+
BB_ADMIN_USER_EMAIL: process.env.BB_ADMIN_USER_EMAIL,
|
|
66
|
+
BB_ADMIN_USER_PASSWORD: process.env.BB_ADMIN_USER_PASSWORD,
|
|
65
67
|
// flags
|
|
66
68
|
ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
|
|
67
69
|
DISABLE_THREADING: process.env.DISABLE_THREADING,
|
|
68
70
|
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
|
|
71
|
+
DISABLE_AUTOMATION_LOGS: process.env.DISABLE_AUTOMATION_LOGS,
|
|
69
72
|
MULTI_TENANCY: process.env.MULTI_TENANCY,
|
|
70
73
|
ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS,
|
|
71
74
|
SELF_HOSTED: process.env.SELF_HOSTED,
|
|
@@ -17,6 +17,7 @@ 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",
|
|
20
21
|
datasource: {
|
|
21
22
|
apiKey: {
|
|
22
23
|
type: datasource_1.DatasourceFieldTypes.PASSWORD,
|
|
@@ -16,6 +16,7 @@ var ArangoModule;
|
|
|
16
16
|
const SCHEMA = {
|
|
17
17
|
docs: "https://github.com/arangodb/arangojs",
|
|
18
18
|
friendlyName: "ArangoDB",
|
|
19
|
+
type: "Non-relational",
|
|
19
20
|
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. ",
|
|
20
21
|
datasource: {
|
|
21
22
|
url: {
|
|
@@ -89,6 +89,25 @@ 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 &&
|
|
101
|
+
(schema === null || schema === void 0 ? void 0 : schema[columnName]) &&
|
|
102
|
+
knex.client.config.client === utils_1.SqlClients.POSTGRES) {
|
|
103
|
+
const externalType = schema[columnName].externalType;
|
|
104
|
+
if (externalType === null || externalType === void 0 ? void 0 : externalType.includes("money")) {
|
|
105
|
+
return knex.raw(`"${tableName}"."${columnName}"::money::numeric as "${field}"`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return `${field} as ${field}`;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
92
111
|
class InternalBuilder {
|
|
93
112
|
constructor(client) {
|
|
94
113
|
this.client = client;
|
|
@@ -209,7 +228,7 @@ class InternalBuilder {
|
|
|
209
228
|
}
|
|
210
229
|
return query;
|
|
211
230
|
}
|
|
212
|
-
addRelationships(
|
|
231
|
+
addRelationships(query, fromTable, relationships) {
|
|
213
232
|
if (!relationships) {
|
|
214
233
|
return query;
|
|
215
234
|
}
|
|
@@ -311,7 +330,7 @@ class InternalBuilder {
|
|
|
311
330
|
if (resource.fields && resource.fields.length > 0) {
|
|
312
331
|
// select the resources as the format "table.columnName" - this is what is provided
|
|
313
332
|
// by the resource builder further up
|
|
314
|
-
selectStatement =
|
|
333
|
+
selectStatement = generateSelectStatement(json, knex);
|
|
315
334
|
}
|
|
316
335
|
let foundLimit = limit || BASE_LIMIT;
|
|
317
336
|
// handle pagination
|
|
@@ -347,7 +366,7 @@ class InternalBuilder {
|
|
|
347
366
|
preQuery = this.addSorting(preQuery, json);
|
|
348
367
|
}
|
|
349
368
|
// handle joins
|
|
350
|
-
query = this.addRelationships(
|
|
369
|
+
query = this.addRelationships(preQuery, tableName, relationships);
|
|
351
370
|
return this.addFilters(query, filters, { relationship: true });
|
|
352
371
|
}
|
|
353
372
|
update(knex, json, opts) {
|
|
@@ -16,6 +16,7 @@ var CouchDBModule;
|
|
|
16
16
|
const SCHEMA = {
|
|
17
17
|
docs: "https://docs.couchdb.org/en/stable/",
|
|
18
18
|
friendlyName: "CouchDB",
|
|
19
|
+
type: "Non-relational",
|
|
19
20
|
description: "Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.",
|
|
20
21
|
datasource: {
|
|
21
22
|
url: {
|
|
@@ -18,6 +18,7 @@ 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",
|
|
21
22
|
datasource: {
|
|
22
23
|
region: {
|
|
23
24
|
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
@@ -17,6 +17,7 @@ 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",
|
|
20
21
|
datasource: {
|
|
21
22
|
url: {
|
|
22
23
|
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
@@ -16,6 +16,7 @@ var Firebase;
|
|
|
16
16
|
const SCHEMA = {
|
|
17
17
|
docs: "https://firebase.google.com/docs/firestore/quickstart",
|
|
18
18
|
friendlyName: "Firestore",
|
|
19
|
+
type: "Non-relational",
|
|
19
20
|
description: "Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.",
|
|
20
21
|
datasource: {
|
|
21
22
|
email: {
|
|
@@ -33,6 +33,7 @@ var GoogleSheetsModule;
|
|
|
33
33
|
docs: "https://developers.google.com/sheets/api/quickstart/nodejs",
|
|
34
34
|
description: "Create and collaborate on online spreadsheets in real-time and from any device. ",
|
|
35
35
|
friendlyName: "Google Sheets",
|
|
36
|
+
type: "Spreadsheet",
|
|
36
37
|
datasource: {
|
|
37
38
|
spreadsheetId: {
|
|
38
39
|
display: "Google Sheet URL",
|
|
@@ -13,6 +13,7 @@ const rest = require("./rest");
|
|
|
13
13
|
const googlesheets = require("./googlesheets");
|
|
14
14
|
const firebase = require("./firebase");
|
|
15
15
|
const redis = require("./redis");
|
|
16
|
+
const snowflake = require("./snowflake");
|
|
16
17
|
const { SourceNames } = require("../definitions/datasource");
|
|
17
18
|
const environment = require("../environment");
|
|
18
19
|
const DEFINITIONS = {
|
|
@@ -29,6 +30,7 @@ const DEFINITIONS = {
|
|
|
29
30
|
[SourceNames.REST]: rest.schema,
|
|
30
31
|
[SourceNames.FIRESTORE]: firebase.schema,
|
|
31
32
|
[SourceNames.REDIS]: redis.schema,
|
|
33
|
+
[SourceNames.SNOWFLAKE]: snowflake.schema,
|
|
32
34
|
};
|
|
33
35
|
const INTEGRATIONS = {
|
|
34
36
|
[SourceNames.POSTGRES]: postgres.integration,
|
|
@@ -45,6 +47,8 @@ const INTEGRATIONS = {
|
|
|
45
47
|
[SourceNames.FIRESTORE]: firebase.integration,
|
|
46
48
|
[SourceNames.GOOGLE_SHEETS]: googlesheets.integration,
|
|
47
49
|
[SourceNames.REDIS]: redis.integration,
|
|
50
|
+
[SourceNames.FIREBASE]: firebase.integration,
|
|
51
|
+
[SourceNames.SNOWFLAKE]: snowflake.integration,
|
|
48
52
|
};
|
|
49
53
|
// optionally add oracle integration if the oracle binary can be installed
|
|
50
54
|
if (!(process.arch === "arm64" && process.platform === "darwin")) {
|
|
@@ -21,6 +21,7 @@ var MSSQLModule;
|
|
|
21
21
|
plus: true,
|
|
22
22
|
description: "Microsoft SQL Server is a relational database management system developed by Microsoft. ",
|
|
23
23
|
friendlyName: "MS SQL Server",
|
|
24
|
+
type: "Relational",
|
|
24
25
|
datasource: {
|
|
25
26
|
user: {
|
|
26
27
|
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
@@ -201,7 +202,7 @@ var MSSQLModule;
|
|
|
201
202
|
if (typeof name !== "string") {
|
|
202
203
|
continue;
|
|
203
204
|
}
|
|
204
|
-
schema[name] = Object.assign({ autocolumn: !!autoColumns.find((col) => col === name), name: name }, (0, utils_1.convertSqlType)(def.DATA_TYPE));
|
|
205
|
+
schema[name] = Object.assign(Object.assign({ autocolumn: !!autoColumns.find((col) => col === name), name: name }, (0, utils_1.convertSqlType)(def.DATA_TYPE)), { externalType: def.DATA_TYPE });
|
|
205
206
|
}
|
|
206
207
|
tables[tableName] = {
|
|
207
208
|
_id: (0, utils_1.buildExternalTableId)(datasourceId, tableName),
|
|
@@ -16,6 +16,7 @@ var MongoDBModule;
|
|
|
16
16
|
const SCHEMA = {
|
|
17
17
|
docs: "https://github.com/mongodb/node-mongodb-native",
|
|
18
18
|
friendlyName: "MongoDB",
|
|
19
|
+
type: "Non-relational",
|
|
19
20
|
description: "MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.",
|
|
20
21
|
datasource: {
|
|
21
22
|
connectionString: {
|
|
@@ -24,6 +24,7 @@ var MySQLModule;
|
|
|
24
24
|
docs: "https://github.com/sidorares/node-mysql2",
|
|
25
25
|
plus: true,
|
|
26
26
|
friendlyName: "MySQL",
|
|
27
|
+
type: "Relational",
|
|
27
28
|
description: "MySQL Database Service is a fully managed database service to deploy cloud-native applications. ",
|
|
28
29
|
datasource: {
|
|
29
30
|
host: {
|
|
@@ -187,7 +188,7 @@ var MySQLModule;
|
|
|
187
188
|
const isAuto = typeof column.Extra === "string" &&
|
|
188
189
|
(column.Extra === "auto_increment" ||
|
|
189
190
|
column.Extra.toLowerCase().includes("generated"));
|
|
190
|
-
schema[columnName] = Object.assign({ name: columnName, autocolumn: isAuto, constraints }, (0, utils_1.convertSqlType)(column.Type));
|
|
191
|
+
schema[columnName] = Object.assign(Object.assign({ name: columnName, autocolumn: isAuto, constraints }, (0, utils_1.convertSqlType)(column.Type)), { externalType: column.Type });
|
|
191
192
|
}
|
|
192
193
|
if (!tables[tableName]) {
|
|
193
194
|
tables[tableName] = {
|
|
@@ -24,6 +24,7 @@ var OracleModule;
|
|
|
24
24
|
docs: "https://github.com/oracle/node-oracledb",
|
|
25
25
|
plus: true,
|
|
26
26
|
friendlyName: "Oracle",
|
|
27
|
+
type: "Relational",
|
|
27
28
|
description: "Oracle Database is an object-relational database management system developed by Oracle Corporation",
|
|
28
29
|
datasource: {
|
|
29
30
|
host: {
|
|
@@ -29,6 +29,7 @@ var PostgresModule;
|
|
|
29
29
|
docs: "https://node-postgres.com",
|
|
30
30
|
plus: true,
|
|
31
31
|
friendlyName: "PostgreSQL",
|
|
32
|
+
type: "Relational",
|
|
32
33
|
description: "PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.",
|
|
33
34
|
datasource: {
|
|
34
35
|
host: {
|
|
@@ -229,7 +230,7 @@ var PostgresModule;
|
|
|
229
230
|
column.column_default.startsWith("nextval");
|
|
230
231
|
const isGenerated = column.is_generated && column.is_generated !== "NEVER";
|
|
231
232
|
const isAuto = hasDefault || identity || isGenerated;
|
|
232
|
-
tables[tableName].schema[columnName] = Object.assign({ autocolumn: isAuto, name: columnName }, (0, utils_1.convertSqlType)(column.data_type));
|
|
233
|
+
tables[tableName].schema[columnName] = Object.assign(Object.assign({ autocolumn: isAuto, name: columnName }, (0, utils_1.convertSqlType)(column.data_type)), { externalType: column.data_type });
|
|
233
234
|
}
|
|
234
235
|
const final = (0, utils_1.finaliseExternalTables)(tables, entities);
|
|
235
236
|
this.tables = final.tables;
|
|
@@ -5,6 +5,9 @@ const string_templates_1 = require("@budibase/string-templates");
|
|
|
5
5
|
const CONST_CHAR_REGEX = new RegExp("'[^']*'", "g");
|
|
6
6
|
function enrichQueryFields(fields, parameters = {}) {
|
|
7
7
|
const enrichedQuery = Array.isArray(fields) ? [] : {};
|
|
8
|
+
if (!fields || !parameters) {
|
|
9
|
+
return enrichedQuery;
|
|
10
|
+
}
|
|
8
11
|
// enrich the fields with dynamic parameters
|
|
9
12
|
for (let key of Object.keys(fields)) {
|
|
10
13
|
if (fields[key] == null) {
|
|
@@ -56,6 +56,7 @@ var RestModule;
|
|
|
56
56
|
docs: "https://github.com/node-fetch/node-fetch",
|
|
57
57
|
description: "With the REST API datasource, you can connect, query and pull data from multiple REST APIs. You can then use the retrieved data to build apps.",
|
|
58
58
|
friendlyName: "REST API",
|
|
59
|
+
type: "API",
|
|
59
60
|
datasource: {
|
|
60
61
|
url: {
|
|
61
62
|
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
@@ -251,7 +252,7 @@ var RestModule;
|
|
|
251
252
|
input.body = form;
|
|
252
253
|
break;
|
|
253
254
|
case BodyTypes.XML:
|
|
254
|
-
if (object != null) {
|
|
255
|
+
if (object != null && Object.keys(object).length) {
|
|
255
256
|
string = new XmlBuilder().buildObject(object);
|
|
256
257
|
}
|
|
257
258
|
input.body = string;
|
package/dist/integrations/s3.js
CHANGED
|
@@ -17,6 +17,7 @@ var S3Module;
|
|
|
17
17
|
docs: "https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html",
|
|
18
18
|
description: "Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
|
|
19
19
|
friendlyName: "Amazon S3",
|
|
20
|
+
type: "Object store",
|
|
20
21
|
datasource: {
|
|
21
22
|
region: {
|
|
22
23
|
type: "string",
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const datasource_1 = require("../definitions/datasource");
|
|
13
|
+
const snowflake_promise_1 = require("snowflake-promise");
|
|
14
|
+
var SnowflakeModule;
|
|
15
|
+
(function (SnowflakeModule) {
|
|
16
|
+
const SCHEMA = {
|
|
17
|
+
docs: "https://developers.snowflake.com/",
|
|
18
|
+
description: "Snowflake is a solution for data warehousing, data lakes, data engineering, data science, data application development, and securely sharing and consuming shared data.",
|
|
19
|
+
friendlyName: "Snowflake",
|
|
20
|
+
type: "Relational",
|
|
21
|
+
datasource: {
|
|
22
|
+
account: {
|
|
23
|
+
type: "string",
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
username: {
|
|
27
|
+
type: "string",
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
password: {
|
|
31
|
+
type: "password",
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
warehouse: {
|
|
35
|
+
type: "string",
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
database: {
|
|
39
|
+
type: "string",
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
schema: {
|
|
43
|
+
type: "string",
|
|
44
|
+
required: true,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
query: {
|
|
48
|
+
create: {
|
|
49
|
+
type: datasource_1.QueryTypes.SQL,
|
|
50
|
+
},
|
|
51
|
+
read: {
|
|
52
|
+
type: datasource_1.QueryTypes.SQL,
|
|
53
|
+
},
|
|
54
|
+
update: {
|
|
55
|
+
type: datasource_1.QueryTypes.SQL,
|
|
56
|
+
},
|
|
57
|
+
delete: {
|
|
58
|
+
type: datasource_1.QueryTypes.SQL,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
class SnowflakeIntegration {
|
|
63
|
+
constructor(config) {
|
|
64
|
+
this.client = new snowflake_promise_1.Snowflake(config);
|
|
65
|
+
}
|
|
66
|
+
internalQuery(query) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
yield this.client.connect();
|
|
69
|
+
try {
|
|
70
|
+
return yield this.client.execute(query.sql);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
throw (err === null || err === void 0 ? void 0 : err.message.split(":")[1]) || (err === null || err === void 0 ? void 0 : err.message);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
create(query) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
return this.internalQuery(query);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
read(query) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
return this.internalQuery(query);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
update(query) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
return this.internalQuery(query);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
delete(query) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
return this.internalQuery(query);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
module.exports = {
|
|
99
|
+
schema: SCHEMA,
|
|
100
|
+
integration: SnowflakeIntegration,
|
|
101
|
+
};
|
|
102
|
+
})(SnowflakeModule || (SnowflakeModule = {}));
|