@budibase/server 1.0.19-alpha.1 → 1.0.22
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 -3
- package/builder/assets/{index.2fc6da87.css → index.4fb3f887.css} +1 -1
- package/builder/assets/index.91de2761.js +1316 -0
- package/builder/assets/{vendor.a9288856.js → vendor.470042a4.js} +1 -1
- package/builder/index.html +3 -3
- package/coverage/clover.xml +372 -440
- package/coverage/coverage-final.json +16 -17
- package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/application.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- 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 +14 -14
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/hosting.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +38 -23
- 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/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/{query/index.js.html → query.js.html} +27 -159
- 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/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.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/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/table/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +9 -108
- 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 +6 -18
- 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/application.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/hosting.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +9 -9
- package/coverage/lcov-report/api/routes/index.js.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/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +98 -11
- 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/row.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/static.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 +2 -32
- 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/createRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/deleteRow.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/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/automations/utils.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +22 -22
- 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/client.js.html +18 -18
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +15 -15
- package/coverage/lcov-report/db/index.js.html +3 -3
- 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 +1 -1
- package/coverage/lcov-report/db/newid.js.html +4 -4
- package/coverage/lcov-report/db/utils.js.html +64 -91
- 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 +52 -67
- 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/authorized.js.html +2 -2
- package/coverage/lcov-report/middleware/builder.js.html +1 -1
- 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 +3 -3
- 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/usageQuota.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +20 -20
- package/coverage/lcov-report/threads/index.js.html +1 -1
- package/coverage/lcov-report/threads/query.js.html +12 -63
- package/coverage/lcov-report/utilities/bcrypt.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 +19 -19
- package/coverage/lcov-report/utilities/index.js.html +33 -66
- 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 +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/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +583 -688
- package/dist/api/controllers/{query/index.js → query.js} +6 -42
- package/dist/api/controllers/user.js +1 -37
- package/dist/api/controllers/webhook.js +0 -4
- package/dist/api/routes/query.js +32 -2
- package/dist/api/routes/user.js +1 -3
- package/dist/db/utils.js +0 -8
- package/dist/integrations/rest.js +113 -110
- package/dist/package.json +4 -8
- package/dist/threads/query.js +2 -14
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/index.js +0 -10
- package/package.json +5 -9
- package/src/api/controllers/{query/index.js → query.js} +6 -50
- package/src/api/controllers/user.js +0 -33
- package/src/api/controllers/webhook.js +0 -4
- package/src/api/routes/query.js +34 -5
- package/src/api/routes/user.js +0 -10
- package/src/db/utils.js +0 -9
- package/src/definitions/common.ts +16 -2
- package/src/definitions/datasource.ts +1 -50
- package/src/integrations/base/IntegrationBase.ts +4 -4
- package/src/integrations/oracle.ts +1 -1
- package/src/integrations/rest.ts +137 -111
- package/src/integrations/tests/rest.spec.js +7 -16
- package/src/threads/query.js +2 -19
- package/src/utilities/index.js +0 -11
- package/builder/assets/bb-spaceship.8f6e81e1.svg +0 -227
- package/builder/assets/index.b0718f41.js +0 -1320
- package/coverage/lcov-report/api/controllers/query/index.html +0 -126
- package/coverage/lcov-report/api/controllers/query/validation.js.html +0 -203
- package/dist/api/controllers/query/import/index.js +0 -79
- package/dist/api/controllers/query/import/sources/base/index.js +0 -63
- package/dist/api/controllers/query/import/sources/base/openapi.js +0 -42
- package/dist/api/controllers/query/import/sources/curl.js +0 -90
- package/dist/api/controllers/query/import/sources/openapi2.js +0 -139
- package/dist/api/controllers/query/import/sources/tests/openapi2/data/crud/crud.json +0 -253
- package/dist/api/controllers/query/import/sources/tests/openapi2/data/petstore/petstore.json +0 -1054
- package/dist/api/controllers/query/validation.js +0 -37
- package/src/api/controllers/query/import/index.ts +0 -85
- package/src/api/controllers/query/import/sources/base/index.ts +0 -85
- package/src/api/controllers/query/import/sources/base/openapi.ts +0 -24
- package/src/api/controllers/query/import/sources/curl.ts +0 -94
- package/src/api/controllers/query/import/sources/openapi2.ts +0 -159
- package/src/api/controllers/query/import/sources/tests/curl/curl.spec.js +0 -104
- package/src/api/controllers/query/import/sources/tests/curl/data/delete.txt +0 -1
- package/src/api/controllers/query/import/sources/tests/curl/data/empty-body.txt +0 -2
- package/src/api/controllers/query/import/sources/tests/curl/data/get.txt +0 -1
- package/src/api/controllers/query/import/sources/tests/curl/data/headers.txt +0 -3
- package/src/api/controllers/query/import/sources/tests/curl/data/patch.txt +0 -2
- package/src/api/controllers/query/import/sources/tests/curl/data/path.txt +0 -1
- package/src/api/controllers/query/import/sources/tests/curl/data/post.txt +0 -2
- package/src/api/controllers/query/import/sources/tests/curl/data/put.txt +0 -2
- package/src/api/controllers/query/import/sources/tests/curl/data/query.txt +0 -1
- package/src/api/controllers/query/import/sources/tests/openapi2/data/crud/crud.json +0 -253
- package/src/api/controllers/query/import/sources/tests/openapi2/data/crud/crud.yaml +0 -160
- package/src/api/controllers/query/import/sources/tests/openapi2/data/petstore/petstore.json +0 -1054
- package/src/api/controllers/query/import/sources/tests/openapi2/data/petstore/petstore.yaml +0 -711
- package/src/api/controllers/query/import/sources/tests/openapi2/openapi2.spec.js +0 -239
- package/src/api/controllers/query/import/tests/index.spec.js +0 -115
- package/src/api/controllers/query/validation.js +0 -41
|
@@ -9,12 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
const { processString } = require("@budibase/string-templates");
|
|
12
|
-
const CouchDB = require("
|
|
13
|
-
const { generateQueryID, getQueryParams, isProdAppID, } = require("
|
|
14
|
-
const { BaseQueryVerbs } = require("
|
|
15
|
-
const { Thread, ThreadType } = require("
|
|
16
|
-
const { save: saveDatasource } = require("../datasource");
|
|
17
|
-
const { RestImporter } = require("./import");
|
|
12
|
+
const CouchDB = require("../../db");
|
|
13
|
+
const { generateQueryID, getQueryParams, isProdAppID, } = require("../../db/utils");
|
|
14
|
+
const { BaseQueryVerbs } = require("../../constants");
|
|
15
|
+
const { Thread, ThreadType } = require("../../threads");
|
|
18
16
|
const Runner = new Thread(ThreadType.QUERY, { timeoutMs: 10000 });
|
|
19
17
|
// simple function to append "readable" to all read queries
|
|
20
18
|
function enrichQueries(input) {
|
|
@@ -36,38 +34,6 @@ exports.fetch = function (ctx) {
|
|
|
36
34
|
ctx.body = enrichQueries(body.rows.map(row => row.doc));
|
|
37
35
|
});
|
|
38
36
|
};
|
|
39
|
-
exports.import = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
-
const body = ctx.request.body;
|
|
41
|
-
const data = body.data;
|
|
42
|
-
const importer = new RestImporter(data);
|
|
43
|
-
yield importer.init();
|
|
44
|
-
let datasourceId;
|
|
45
|
-
if (!body.datasourceId) {
|
|
46
|
-
// construct new datasource
|
|
47
|
-
const info = yield importer.getInfo();
|
|
48
|
-
let datasource = {
|
|
49
|
-
type: "datasource",
|
|
50
|
-
source: "REST",
|
|
51
|
-
config: {
|
|
52
|
-
url: info.url,
|
|
53
|
-
defaultHeaders: [],
|
|
54
|
-
},
|
|
55
|
-
name: info.name,
|
|
56
|
-
};
|
|
57
|
-
// save the datasource
|
|
58
|
-
const datasourceCtx = Object.assign({}, ctx);
|
|
59
|
-
datasourceCtx.request.body.datasource = datasource;
|
|
60
|
-
yield saveDatasource(datasourceCtx);
|
|
61
|
-
datasourceId = datasourceCtx.body.datasource._id;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
// use existing datasource
|
|
65
|
-
datasourceId = body.datasourceId;
|
|
66
|
-
}
|
|
67
|
-
const importResult = yield importer.importQueries(ctx.appId, datasourceId);
|
|
68
|
-
ctx.body = Object.assign(Object.assign({}, importResult), { datasourceId });
|
|
69
|
-
ctx.status = 200;
|
|
70
|
-
});
|
|
71
37
|
exports.save = function (ctx) {
|
|
72
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
39
|
const db = new CouchDB(ctx.appId);
|
|
@@ -112,7 +78,7 @@ function enrichQueryFields(fields, parameters = {}) {
|
|
|
112
78
|
enrichedQuery.requestBody);
|
|
113
79
|
}
|
|
114
80
|
catch (err) {
|
|
115
|
-
|
|
81
|
+
throw { message: `JSON Invalid - error: ${err}` };
|
|
116
82
|
}
|
|
117
83
|
delete enrichedQuery.customData;
|
|
118
84
|
}
|
|
@@ -138,7 +104,7 @@ exports.preview = function (ctx) {
|
|
|
138
104
|
const { fields, parameters, queryVerb, transformer } = ctx.request.body;
|
|
139
105
|
const enrichedQuery = yield enrichQueryFields(fields, parameters);
|
|
140
106
|
try {
|
|
141
|
-
const { rows, keys
|
|
107
|
+
const { rows, keys } = yield Runner.run({
|
|
142
108
|
datasource,
|
|
143
109
|
queryVerb,
|
|
144
110
|
query: enrichedQuery,
|
|
@@ -147,8 +113,6 @@ exports.preview = function (ctx) {
|
|
|
147
113
|
ctx.body = {
|
|
148
114
|
rows,
|
|
149
115
|
schemaFields: [...new Set(keys)],
|
|
150
|
-
info,
|
|
151
|
-
extra,
|
|
152
116
|
};
|
|
153
117
|
}
|
|
154
118
|
catch (err) {
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
const CouchDB = require("../../db");
|
|
12
|
-
const { generateUserMetadataID, getUserMetadataParams,
|
|
12
|
+
const { generateUserMetadataID, getUserMetadataParams, } = require("../../db/utils");
|
|
13
13
|
const { InternalTables } = require("../../db/utils");
|
|
14
14
|
const { getGlobalUsers, getRawGlobalUser } = require("../../utilities/global");
|
|
15
15
|
const { getFullUser } = require("../../utilities/users");
|
|
@@ -189,39 +189,3 @@ exports.findMetadata = function (ctx) {
|
|
|
189
189
|
ctx.body = yield getFullUser(ctx, ctx.params.id);
|
|
190
190
|
});
|
|
191
191
|
};
|
|
192
|
-
exports.setFlag = function (ctx) {
|
|
193
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
194
|
-
const userId = ctx.user._id;
|
|
195
|
-
const { flag, value } = ctx.request.body;
|
|
196
|
-
if (!flag) {
|
|
197
|
-
ctx.throw(400, "Must supply a 'flag' field in request body.");
|
|
198
|
-
}
|
|
199
|
-
const flagDocId = generateUserFlagID(userId);
|
|
200
|
-
const db = new CouchDB(ctx.appId);
|
|
201
|
-
let doc;
|
|
202
|
-
try {
|
|
203
|
-
doc = yield db.get(flagDocId);
|
|
204
|
-
}
|
|
205
|
-
catch (err) {
|
|
206
|
-
doc = { _id: flagDocId };
|
|
207
|
-
}
|
|
208
|
-
doc[flag] = value || true;
|
|
209
|
-
yield db.put(doc);
|
|
210
|
-
ctx.body = { message: "Flag set successfully" };
|
|
211
|
-
});
|
|
212
|
-
};
|
|
213
|
-
exports.getFlags = function (ctx) {
|
|
214
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
-
const userId = ctx.user._id;
|
|
216
|
-
const docId = generateUserFlagID(userId);
|
|
217
|
-
const db = new CouchDB(ctx.appId);
|
|
218
|
-
let doc;
|
|
219
|
-
try {
|
|
220
|
-
doc = yield db.get(docId);
|
|
221
|
-
}
|
|
222
|
-
catch (err) {
|
|
223
|
-
doc = { _id: docId };
|
|
224
|
-
}
|
|
225
|
-
ctx.body = doc;
|
|
226
|
-
});
|
|
227
|
-
};
|
|
@@ -65,10 +65,6 @@ exports.buildSchema = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
65
65
|
let automation = yield db.get(webhook.action.target);
|
|
66
66
|
const autoOutputs = automation.definition.trigger.schema.outputs;
|
|
67
67
|
let properties = webhook.bodySchema.properties;
|
|
68
|
-
// reset webhook outputs
|
|
69
|
-
autoOutputs.properties = {
|
|
70
|
-
body: autoOutputs.properties.body,
|
|
71
|
-
};
|
|
72
68
|
for (let prop of Object.keys(properties)) {
|
|
73
69
|
autoOutputs.properties[prop] = {
|
|
74
70
|
type: properties[prop].type,
|
package/dist/api/routes/query.js
CHANGED
|
@@ -2,14 +2,44 @@
|
|
|
2
2
|
const Router = require("@koa/router");
|
|
3
3
|
const queryController = require("../controllers/query");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
|
+
const Joi = require("joi");
|
|
5
6
|
const { PermissionLevels, PermissionTypes, BUILDER, } = require("@budibase/auth/permissions");
|
|
7
|
+
const joiValidator = require("../../middleware/joi-validator");
|
|
6
8
|
const { bodyResource, bodySubResource, paramResource, } = require("../../middleware/resourceId");
|
|
7
|
-
const { generateQueryPreviewValidation, generateQueryValidation, } = require("../controllers/query/validation");
|
|
8
9
|
const router = Router();
|
|
10
|
+
function generateQueryValidation() {
|
|
11
|
+
// prettier-ignore
|
|
12
|
+
return joiValidator.body(Joi.object({
|
|
13
|
+
_id: Joi.string(),
|
|
14
|
+
_rev: Joi.string(),
|
|
15
|
+
name: Joi.string().required(),
|
|
16
|
+
fields: Joi.object().required(),
|
|
17
|
+
datasourceId: Joi.string().required(),
|
|
18
|
+
readable: Joi.boolean(),
|
|
19
|
+
parameters: Joi.array().items(Joi.object({
|
|
20
|
+
name: Joi.string(),
|
|
21
|
+
default: Joi.string().allow(""),
|
|
22
|
+
})),
|
|
23
|
+
queryVerb: Joi.string().allow().required(),
|
|
24
|
+
extra: Joi.object().optional(),
|
|
25
|
+
schema: Joi.object({}).required().unknown(true),
|
|
26
|
+
transformer: Joi.string().optional(),
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
function generateQueryPreviewValidation() {
|
|
30
|
+
// prettier-ignore
|
|
31
|
+
return joiValidator.body(Joi.object({
|
|
32
|
+
fields: Joi.object().required(),
|
|
33
|
+
queryVerb: Joi.string().allow().required(),
|
|
34
|
+
extra: Joi.object().optional(),
|
|
35
|
+
datasourceId: Joi.string().required(),
|
|
36
|
+
transformer: Joi.string().optional(),
|
|
37
|
+
parameters: Joi.object({}).required().unknown(true)
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
9
40
|
router
|
|
10
41
|
.get("/api/queries", authorized(BUILDER), queryController.fetch)
|
|
11
42
|
.post("/api/queries", bodySubResource("datasourceId", "_id"), authorized(BUILDER), generateQueryValidation(), queryController.save)
|
|
12
|
-
.post("/api/queries/import", authorized(BUILDER), queryController.import)
|
|
13
43
|
.post("/api/queries/preview", bodyResource("datasourceId"), authorized(BUILDER), generateQueryPreviewValidation(), queryController.preview)
|
|
14
44
|
.get("/api/queries/:queryId", paramResource("queryId"), authorized(PermissionTypes.QUERY, PermissionLevels.READ), queryController.find)
|
|
15
45
|
.post("/api/queries/:queryId", paramResource("queryId"), authorized(PermissionTypes.QUERY, PermissionLevels.WRITE), queryController.execute)
|
package/dist/api/routes/user.js
CHANGED
|
@@ -10,7 +10,5 @@ router
|
|
|
10
10
|
.put("/api/users/metadata", authorized(PermissionTypes.USER, PermissionLevels.WRITE), controller.updateMetadata)
|
|
11
11
|
.post("/api/users/metadata/self", authorized(PermissionTypes.USER, PermissionLevels.WRITE), controller.updateSelfMetadata)
|
|
12
12
|
.delete("/api/users/metadata/:id", authorized(PermissionTypes.USER, PermissionLevels.WRITE), controller.destroyMetadata)
|
|
13
|
-
.post("/api/users/metadata/sync/:id", authorized(PermissionTypes.USER, PermissionLevels.WRITE), controller.syncUser)
|
|
14
|
-
.post("/api/users/flags", authorized(PermissionTypes.USER, PermissionLevels.WRITE), controller.setFlag)
|
|
15
|
-
.get("/api/users/flags", authorized(PermissionTypes.USER, PermissionLevels.READ), controller.getFlags);
|
|
13
|
+
.post("/api/users/metadata/sync/:id", authorized(PermissionTypes.USER, PermissionLevels.WRITE), controller.syncUser);
|
|
16
14
|
module.exports = router;
|
package/dist/db/utils.js
CHANGED
|
@@ -28,7 +28,6 @@ const DocumentTypes = {
|
|
|
28
28
|
DEPLOYMENTS: "deployments",
|
|
29
29
|
METADATA: "metadata",
|
|
30
30
|
MEM_VIEW: "view",
|
|
31
|
-
USER_FLAG: "flag",
|
|
32
31
|
};
|
|
33
32
|
const ViewNames = {
|
|
34
33
|
LINK: "by_link",
|
|
@@ -272,13 +271,6 @@ exports.getQueryParams = (datasourceId = null, otherProps = {}) => {
|
|
|
272
271
|
}
|
|
273
272
|
return getDocParams(DocumentTypes.QUERY, `${datasourceId}${SEPARATOR}`, otherProps);
|
|
274
273
|
};
|
|
275
|
-
/**
|
|
276
|
-
* Generates a new flag document ID.
|
|
277
|
-
* @returns {string} The ID of the flag document that was generated.
|
|
278
|
-
*/
|
|
279
|
-
exports.generateUserFlagID = userId => {
|
|
280
|
-
return `${DocumentTypes.USER_FLAG}${SEPARATOR}${userId}`;
|
|
281
|
-
};
|
|
282
274
|
exports.generateMetadataID = (type, entityId) => {
|
|
283
275
|
return `${DocumentTypes.METADATA}${SEPARATOR}${type}${SEPARATOR}${entityId}`;
|
|
284
276
|
};
|
|
@@ -10,50 +10,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const datasource_1 = require("../definitions/datasource");
|
|
13
|
-
const BodyTypes = {
|
|
14
|
-
NONE: "none",
|
|
15
|
-
FORM_DATA: "form",
|
|
16
|
-
ENCODED: "encoded",
|
|
17
|
-
JSON: "json",
|
|
18
|
-
TEXT: "text",
|
|
19
|
-
};
|
|
20
|
-
const coreFields = {
|
|
21
|
-
path: {
|
|
22
|
-
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
23
|
-
display: "URL",
|
|
24
|
-
},
|
|
25
|
-
queryString: {
|
|
26
|
-
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
27
|
-
},
|
|
28
|
-
headers: {
|
|
29
|
-
type: datasource_1.DatasourceFieldTypes.OBJECT,
|
|
30
|
-
},
|
|
31
|
-
enabledHeaders: {
|
|
32
|
-
type: datasource_1.DatasourceFieldTypes.OBJECT,
|
|
33
|
-
},
|
|
34
|
-
requestBody: {
|
|
35
|
-
type: datasource_1.DatasourceFieldTypes.JSON,
|
|
36
|
-
},
|
|
37
|
-
bodyType: {
|
|
38
|
-
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
39
|
-
enum: Object.values(BodyTypes),
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
13
|
var RestModule;
|
|
43
14
|
(function (RestModule) {
|
|
44
15
|
const fetch = require("node-fetch");
|
|
45
|
-
const { formatBytes } = require("../utilities");
|
|
46
|
-
const { performance } = require("perf_hooks");
|
|
47
16
|
const SCHEMA = {
|
|
48
17
|
docs: "https://github.com/node-fetch/node-fetch",
|
|
49
|
-
description: "
|
|
18
|
+
description: "Representational state transfer (REST) is a de-facto standard for a software architecture for interactive applications that typically use multiple Web services. ",
|
|
50
19
|
friendlyName: "REST API",
|
|
51
20
|
datasource: {
|
|
52
21
|
url: {
|
|
53
22
|
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
54
|
-
default: "",
|
|
55
|
-
required:
|
|
56
|
-
deprecated: true,
|
|
23
|
+
default: "localhost",
|
|
24
|
+
required: true,
|
|
57
25
|
},
|
|
58
26
|
defaultHeaders: {
|
|
59
27
|
type: datasource_1.DatasourceFieldTypes.OBJECT,
|
|
@@ -66,134 +34,169 @@ var RestModule;
|
|
|
66
34
|
readable: true,
|
|
67
35
|
displayName: "POST",
|
|
68
36
|
type: datasource_1.QueryTypes.FIELDS,
|
|
69
|
-
|
|
37
|
+
urlDisplay: true,
|
|
38
|
+
fields: {
|
|
39
|
+
path: {
|
|
40
|
+
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
41
|
+
},
|
|
42
|
+
queryString: {
|
|
43
|
+
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
44
|
+
},
|
|
45
|
+
headers: {
|
|
46
|
+
type: datasource_1.DatasourceFieldTypes.OBJECT,
|
|
47
|
+
},
|
|
48
|
+
requestBody: {
|
|
49
|
+
type: datasource_1.DatasourceFieldTypes.JSON,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
70
52
|
},
|
|
71
53
|
read: {
|
|
72
54
|
displayName: "GET",
|
|
73
55
|
readable: true,
|
|
74
56
|
type: datasource_1.QueryTypes.FIELDS,
|
|
75
|
-
|
|
57
|
+
urlDisplay: true,
|
|
58
|
+
fields: {
|
|
59
|
+
path: {
|
|
60
|
+
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
61
|
+
},
|
|
62
|
+
queryString: {
|
|
63
|
+
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
64
|
+
},
|
|
65
|
+
headers: {
|
|
66
|
+
type: datasource_1.DatasourceFieldTypes.OBJECT,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
76
69
|
},
|
|
77
70
|
update: {
|
|
78
71
|
displayName: "PUT",
|
|
79
72
|
readable: true,
|
|
80
73
|
type: datasource_1.QueryTypes.FIELDS,
|
|
81
|
-
|
|
74
|
+
urlDisplay: true,
|
|
75
|
+
fields: {
|
|
76
|
+
path: {
|
|
77
|
+
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
78
|
+
},
|
|
79
|
+
queryString: {
|
|
80
|
+
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
81
|
+
},
|
|
82
|
+
headers: {
|
|
83
|
+
type: datasource_1.DatasourceFieldTypes.OBJECT,
|
|
84
|
+
},
|
|
85
|
+
requestBody: {
|
|
86
|
+
type: datasource_1.DatasourceFieldTypes.JSON,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
82
89
|
},
|
|
83
90
|
patch: {
|
|
84
91
|
displayName: "PATCH",
|
|
85
92
|
readable: true,
|
|
86
93
|
type: datasource_1.QueryTypes.FIELDS,
|
|
87
|
-
|
|
94
|
+
urlDisplay: true,
|
|
95
|
+
fields: {
|
|
96
|
+
path: {
|
|
97
|
+
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
98
|
+
},
|
|
99
|
+
queryString: {
|
|
100
|
+
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
101
|
+
},
|
|
102
|
+
headers: {
|
|
103
|
+
type: datasource_1.DatasourceFieldTypes.OBJECT,
|
|
104
|
+
},
|
|
105
|
+
requestBody: {
|
|
106
|
+
type: datasource_1.DatasourceFieldTypes.JSON,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
88
109
|
},
|
|
89
110
|
delete: {
|
|
90
111
|
displayName: "DELETE",
|
|
91
112
|
type: datasource_1.QueryTypes.FIELDS,
|
|
92
|
-
|
|
113
|
+
urlDisplay: true,
|
|
114
|
+
fields: {
|
|
115
|
+
path: {
|
|
116
|
+
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
117
|
+
},
|
|
118
|
+
queryString: {
|
|
119
|
+
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
120
|
+
},
|
|
121
|
+
headers: {
|
|
122
|
+
type: datasource_1.DatasourceFieldTypes.OBJECT,
|
|
123
|
+
},
|
|
124
|
+
requestBody: {
|
|
125
|
+
type: datasource_1.DatasourceFieldTypes.JSON,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
93
128
|
},
|
|
94
129
|
},
|
|
95
130
|
};
|
|
96
131
|
class RestIntegration {
|
|
97
132
|
constructor(config) {
|
|
98
133
|
this.headers = {};
|
|
99
|
-
this.startTimeMs = performance.now();
|
|
100
134
|
this.config = config;
|
|
101
135
|
}
|
|
102
136
|
parseResponse(response) {
|
|
103
137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
let data, raw, headers;
|
|
105
138
|
const contentType = response.headers.get("content-type");
|
|
106
139
|
if (contentType && contentType.indexOf("application/json") !== -1) {
|
|
107
|
-
|
|
108
|
-
raw = JSON.stringify(data);
|
|
140
|
+
return yield response.json();
|
|
109
141
|
}
|
|
110
142
|
else {
|
|
111
|
-
|
|
112
|
-
raw = data;
|
|
143
|
+
return yield response.text();
|
|
113
144
|
}
|
|
114
|
-
const size = formatBytes(response.headers.get("content-length") || Buffer.byteLength(raw, "utf8"));
|
|
115
|
-
const time = `${Math.round(performance.now() - this.startTimeMs)}ms`;
|
|
116
|
-
headers = response.headers.raw();
|
|
117
|
-
for (let [key, value] of Object.entries(headers)) {
|
|
118
|
-
headers[key] = Array.isArray(value) ? value[0] : value;
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
data,
|
|
122
|
-
info: {
|
|
123
|
-
code: response.status,
|
|
124
|
-
size,
|
|
125
|
-
time,
|
|
126
|
-
},
|
|
127
|
-
extra: {
|
|
128
|
-
raw,
|
|
129
|
-
headers,
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
145
|
});
|
|
133
146
|
}
|
|
134
147
|
getUrl(path, queryString) {
|
|
135
|
-
|
|
136
|
-
let complete = main;
|
|
137
|
-
if (this.config.url && !main.startsWith(this.config.url)) {
|
|
138
|
-
complete = !this.config.url ? main : `${this.config.url}/${main}`;
|
|
139
|
-
}
|
|
140
|
-
if (!complete.startsWith("http")) {
|
|
141
|
-
complete = `http://${complete}`;
|
|
142
|
-
}
|
|
143
|
-
return complete;
|
|
148
|
+
return `${this.config.url}/${path}?${queryString}`;
|
|
144
149
|
}
|
|
145
|
-
|
|
150
|
+
create({ path = "", queryString = "", headers = {}, json = {} }) {
|
|
146
151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const { path = "", queryString = "", headers = {}, method = "GET", disabledHeaders, bodyType, requestBody } = query;
|
|
148
152
|
this.headers = Object.assign(Object.assign({}, this.config.defaultHeaders), headers);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
let json;
|
|
157
|
-
if (bodyType === BodyTypes.JSON && requestBody) {
|
|
158
|
-
try {
|
|
159
|
-
json = JSON.parse(requestBody);
|
|
160
|
-
}
|
|
161
|
-
catch (err) {
|
|
162
|
-
throw "Invalid JSON for request body";
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const input = { method, headers: this.headers };
|
|
166
|
-
if (json && typeof json === "object" && Object.keys(json).length > 0) {
|
|
167
|
-
input.body = JSON.stringify(json);
|
|
168
|
-
}
|
|
169
|
-
this.startTimeMs = performance.now();
|
|
170
|
-
const response = yield fetch(this.getUrl(path, queryString), input);
|
|
153
|
+
const response = yield fetch(this.getUrl(path, queryString), {
|
|
154
|
+
method: "POST",
|
|
155
|
+
headers: this.headers,
|
|
156
|
+
body: JSON.stringify(json),
|
|
157
|
+
});
|
|
171
158
|
return yield this.parseResponse(response);
|
|
172
159
|
});
|
|
173
160
|
}
|
|
174
|
-
|
|
175
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
176
|
-
return this._req(Object.assign(Object.assign({}, opts), { method: "POST" }));
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
read(opts) {
|
|
161
|
+
read({ path = "", queryString = "", headers = {} }) {
|
|
180
162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
-
|
|
163
|
+
this.headers = Object.assign(Object.assign({}, this.config.defaultHeaders), headers);
|
|
164
|
+
const response = yield fetch(this.getUrl(path, queryString), {
|
|
165
|
+
headers: this.headers,
|
|
166
|
+
});
|
|
167
|
+
return yield this.parseResponse(response);
|
|
182
168
|
});
|
|
183
169
|
}
|
|
184
|
-
update(
|
|
170
|
+
update({ path = "", queryString = "", headers = {}, json = {} }) {
|
|
185
171
|
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
-
|
|
172
|
+
this.headers = Object.assign(Object.assign({}, this.config.defaultHeaders), headers);
|
|
173
|
+
const response = yield fetch(this.getUrl(path, queryString), {
|
|
174
|
+
method: "PUT",
|
|
175
|
+
headers: this.headers,
|
|
176
|
+
body: JSON.stringify(json),
|
|
177
|
+
});
|
|
178
|
+
return yield this.parseResponse(response);
|
|
187
179
|
});
|
|
188
180
|
}
|
|
189
|
-
patch(
|
|
181
|
+
patch({ path = "", queryString = "", headers = {}, json = {} }) {
|
|
190
182
|
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
-
|
|
183
|
+
this.headers = Object.assign(Object.assign({}, this.config.defaultHeaders), headers);
|
|
184
|
+
const response = yield fetch(this.getUrl(path, queryString), {
|
|
185
|
+
method: "PATCH",
|
|
186
|
+
headers: this.headers,
|
|
187
|
+
body: JSON.stringify(json),
|
|
188
|
+
});
|
|
189
|
+
return yield this.parseResponse(response);
|
|
192
190
|
});
|
|
193
191
|
}
|
|
194
|
-
delete(
|
|
192
|
+
delete({ path = "", queryString = "", headers = {} }) {
|
|
195
193
|
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
-
|
|
194
|
+
this.headers = Object.assign(Object.assign({}, this.config.defaultHeaders), headers);
|
|
195
|
+
const response = yield fetch(this.getUrl(path, queryString), {
|
|
196
|
+
method: "DELETE",
|
|
197
|
+
headers: this.headers,
|
|
198
|
+
});
|
|
199
|
+
return yield this.parseResponse(response);
|
|
197
200
|
});
|
|
198
201
|
}
|
|
199
202
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.21",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -69,10 +69,9 @@
|
|
|
69
69
|
"author": "Budibase",
|
|
70
70
|
"license": "GPL-3.0",
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@
|
|
73
|
-
"@budibase/
|
|
74
|
-
"@budibase/
|
|
75
|
-
"@budibase/string-templates": "^1.0.19-alpha.0",
|
|
72
|
+
"@budibase/auth": "^1.0.21",
|
|
73
|
+
"@budibase/client": "^1.0.21",
|
|
74
|
+
"@budibase/string-templates": "^1.0.21",
|
|
76
75
|
"@bull-board/api": "^3.7.0",
|
|
77
76
|
"@bull-board/koa": "^3.7.0",
|
|
78
77
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -86,14 +85,12 @@
|
|
|
86
85
|
"bull": "^3.22.4",
|
|
87
86
|
"chmodr": "1.2.0",
|
|
88
87
|
"csvtojson": "2.0.10",
|
|
89
|
-
"curlconverter": "^3.21.0",
|
|
90
88
|
"dotenv": "8.2.0",
|
|
91
89
|
"download": "8.0.0",
|
|
92
90
|
"fix-path": "3.0.0",
|
|
93
91
|
"fs-extra": "8.1.0",
|
|
94
92
|
"jimp": "0.16.1",
|
|
95
93
|
"joi": "17.2.1",
|
|
96
|
-
"js-yaml": "^4.1.0",
|
|
97
94
|
"jsonschema": "1.4.0",
|
|
98
95
|
"knex": "^0.95.6",
|
|
99
96
|
"koa": "2.7.0",
|
|
@@ -149,7 +146,6 @@
|
|
|
149
146
|
"eslint": "^6.8.0",
|
|
150
147
|
"jest": "^27.0.5",
|
|
151
148
|
"nodemon": "^2.0.4",
|
|
152
|
-
"openapi-types": "^9.3.1",
|
|
153
149
|
"path-to-regexp": "^6.2.0",
|
|
154
150
|
"prettier": "^2.3.1",
|
|
155
151
|
"rimraf": "^3.0.2",
|
package/dist/threads/query.js
CHANGED
|
@@ -24,12 +24,6 @@ function formatResponse(resp) {
|
|
|
24
24
|
}
|
|
25
25
|
return resp;
|
|
26
26
|
}
|
|
27
|
-
function hasExtraData(response) {
|
|
28
|
-
return (typeof response === "object" &&
|
|
29
|
-
!Array.isArray(response) &&
|
|
30
|
-
response.data != null &&
|
|
31
|
-
response.info != null);
|
|
32
|
-
}
|
|
33
27
|
function runAndTransform(datasource, queryVerb, query, transformer) {
|
|
34
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
29
|
const Integration = integrations[datasource.source];
|
|
@@ -37,13 +31,7 @@ function runAndTransform(datasource, queryVerb, query, transformer) {
|
|
|
37
31
|
throw "Integration type does not exist.";
|
|
38
32
|
}
|
|
39
33
|
const integration = new Integration(datasource.config);
|
|
40
|
-
let
|
|
41
|
-
let rows = output, info = undefined, extra = undefined;
|
|
42
|
-
if (hasExtraData(output)) {
|
|
43
|
-
rows = output.data;
|
|
44
|
-
info = output.info;
|
|
45
|
-
extra = output.extra;
|
|
46
|
-
}
|
|
34
|
+
let rows = formatResponse(yield integration[queryVerb](query));
|
|
47
35
|
// transform as required
|
|
48
36
|
if (transformer) {
|
|
49
37
|
const runner = new ScriptRunner(transformer, { data: rows });
|
|
@@ -62,7 +50,7 @@ function runAndTransform(datasource, queryVerb, query, transformer) {
|
|
|
62
50
|
if (integration.end) {
|
|
63
51
|
integration.end();
|
|
64
52
|
}
|
|
65
|
-
return { rows, keys
|
|
53
|
+
return { rows, keys };
|
|
66
54
|
});
|
|
67
55
|
}
|
|
68
56
|
module.exports = (input, callback) => {
|