@budibase/server 0.9.169-alpha.9 → 0.9.172
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder/assets/{index.aafb155b.js → index.9ab01cd4.js} +34 -34
- package/builder/assets/{index.0ea76a5c.css → index.dbc6728e.css} +2 -2
- package/builder/assets/{vendor.2053eff2.js → vendor.54435e8f.js} +2 -2
- package/builder/index.html +3 -3
- package/coverage/clover.xml +517 -609
- package/coverage/coverage-final.json +31 -32
- 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 +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 +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +17 -41
- package/coverage/lcov-report/api/controllers/hosting.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +45 -45
- 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 +4 -7
- package/coverage/lcov-report/api/controllers/query.js.html +24 -129
- 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 +5 -5
- package/coverage/lcov-report/api/controllers/row/index.js.html +15 -15
- 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 +57 -12
- package/coverage/lcov-report/api/controllers/table/index.html +28 -28
- package/coverage/lcov-report/api/controllers/table/index.js.html +37 -16
- package/coverage/lcov-report/api/controllers/table/utils.js.html +33 -279
- package/coverage/lcov-report/api/controllers/templates.js.html +13 -49
- 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 +8 -8
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +6 -6
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/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 +11 -26
- 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 +3 -9
- 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 +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 +10 -31
- package/coverage/lcov-report/automations/automationUtils.js.html +86 -14
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +25 -25
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +7 -10
- package/coverage/lcov-report/automations/steps/createRow.js.html +2 -2
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +5 -8
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +7 -10
- package/coverage/lcov-report/automations/steps/executeScript.js.html +7 -10
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +57 -57
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +7 -10
- package/coverage/lcov-report/automations/steps/queryRows.js.html +7 -10
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +7 -10
- 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 +14 -14
- package/coverage/lcov-report/automations/steps/utils.js.html +10 -10
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/thread.js.html +12 -54
- 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 +2 -5
- 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 +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +12 -12
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +9 -9
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +1 -1
- 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 +69 -69
- 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 +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +2 -2
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/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/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 +2 -2
- package/coverage/lcov-report/utilities/index.html +7 -22
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +14 -14
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +8 -38
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- 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 +848 -1026
- package/dist/api/controllers/backup.js +4 -4
- package/dist/api/controllers/dev.js +11 -17
- package/dist/api/controllers/permission.js +0 -1
- package/dist/api/controllers/query.js +8 -26
- package/dist/api/controllers/row/ExternalRequest.js +5 -46
- package/dist/api/controllers/script.js +16 -4
- package/dist/api/controllers/table/index.js +10 -5
- package/dist/api/controllers/table/utils.js +10 -83
- package/dist/api/controllers/templates.js +3 -18
- package/dist/api/routes/dev.js +4 -8
- package/dist/api/routes/query.js +1 -3
- package/dist/automations/actions.js +3 -9
- package/dist/automations/automationUtils.js +29 -8
- package/dist/automations/steps/bash.js +1 -2
- package/dist/automations/steps/createRow.js +1 -1
- package/dist/automations/steps/deleteRow.js +1 -2
- package/dist/automations/steps/executeQuery.js +1 -2
- package/dist/automations/steps/executeScript.js +1 -2
- package/dist/automations/steps/outgoingWebhook.js +1 -2
- package/dist/automations/steps/queryRows.js +1 -2
- package/dist/automations/steps/sendSmtpEmail.js +1 -2
- package/dist/automations/steps/updateRow.js +2 -6
- package/dist/automations/thread.js +3 -14
- package/dist/constants/index.js +0 -1
- package/dist/integrations/base/sql.js +4 -4
- package/dist/integrations/utils.js +1 -16
- package/dist/middleware/currentapp.js +1 -1
- package/dist/package.json +5 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/index.js +33 -49
- package/dist/utilities/global.js +1 -1
- package/dist/utilities/rowProcessor/index.js +0 -8
- package/package.json +6 -7
- package/src/api/controllers/backup.js +5 -4
- package/src/api/controllers/dev.js +8 -16
- package/src/api/controllers/permission.js +0 -1
- package/src/api/controllers/query.js +11 -46
- package/src/api/controllers/row/ExternalRequest.ts +4 -49
- package/src/api/controllers/script.js +19 -4
- package/src/api/controllers/table/index.js +12 -5
- package/src/api/controllers/table/utils.js +12 -94
- package/src/api/controllers/templates.js +5 -17
- package/src/api/routes/dev.js +4 -9
- package/src/api/routes/query.js +1 -3
- package/src/automations/actions.js +3 -10
- package/src/automations/automationUtils.js +31 -7
- package/src/automations/steps/bash.js +1 -2
- package/src/automations/steps/createRow.js +1 -1
- package/src/automations/steps/deleteRow.js +1 -2
- package/src/automations/steps/executeQuery.js +1 -2
- package/src/automations/steps/executeScript.js +1 -2
- package/src/automations/steps/outgoingWebhook.js +1 -2
- package/src/automations/steps/queryRows.js +1 -2
- package/src/automations/steps/sendSmtpEmail.js +1 -2
- package/src/automations/steps/updateRow.js +6 -6
- package/src/automations/thread.js +3 -17
- package/src/constants/index.js +0 -1
- package/src/integrations/base/sql.ts +3 -5
- package/src/integrations/tests/mongo.spec.js +6 -10
- package/src/integrations/utils.ts +0 -15
- package/src/middleware/currentapp.js +1 -1
- package/src/middleware/tests/currentapp.spec.js +3 -3
- package/src/utilities/fileSystem/index.js +43 -65
- package/src/utilities/global.js +1 -1
- package/src/utilities/rowProcessor/index.js +0 -10
- package/coverage/lcov-report/utilities/scriptRunner.js.html +0 -143
- package/dist/utilities/scriptRunner.js +0 -19
- package/src/utilities/scriptRunner.js +0 -21
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
const scriptController = require("../../api/controllers/script");
|
|
12
12
|
const { buildCtx } = require("./utils");
|
|
13
|
-
const automationUtils = require("../automationUtils");
|
|
14
13
|
exports.definition = {
|
|
15
14
|
name: "JS Scripting",
|
|
16
15
|
tagline: "Execute JavaScript Code",
|
|
@@ -72,7 +71,7 @@ exports.run = function ({ inputs, appId, context, emitter }) {
|
|
|
72
71
|
catch (err) {
|
|
73
72
|
return {
|
|
74
73
|
success: false,
|
|
75
|
-
response:
|
|
74
|
+
response: err,
|
|
76
75
|
};
|
|
77
76
|
}
|
|
78
77
|
});
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
const fetch = require("node-fetch");
|
|
12
12
|
const { getFetchResponse } = require("./utils");
|
|
13
|
-
const automationUtils = require("../automationUtils");
|
|
14
13
|
const RequestType = {
|
|
15
14
|
POST: "POST",
|
|
16
15
|
GET: "GET",
|
|
@@ -131,7 +130,7 @@ exports.run = function ({ inputs }) {
|
|
|
131
130
|
/* istanbul ignore next */
|
|
132
131
|
return {
|
|
133
132
|
success: false,
|
|
134
|
-
response:
|
|
133
|
+
response: err,
|
|
135
134
|
};
|
|
136
135
|
}
|
|
137
136
|
});
|
|
@@ -12,7 +12,6 @@ const rowController = require("../../api/controllers/row");
|
|
|
12
12
|
const tableController = require("../../api/controllers/table");
|
|
13
13
|
const { FieldTypes } = require("../../constants");
|
|
14
14
|
const { buildCtx } = require("./utils");
|
|
15
|
-
const automationUtils = require("../automationUtils");
|
|
16
15
|
const SortOrders = {
|
|
17
16
|
ASCENDING: "ascending",
|
|
18
17
|
DESCENDING: "descending",
|
|
@@ -120,7 +119,7 @@ exports.run = function ({ inputs, appId }) {
|
|
|
120
119
|
catch (err) {
|
|
121
120
|
return {
|
|
122
121
|
success: false,
|
|
123
|
-
response:
|
|
122
|
+
response: err,
|
|
124
123
|
};
|
|
125
124
|
}
|
|
126
125
|
});
|
|
@@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
const { sendSmtpEmail } = require("../../utilities/workerRequests");
|
|
12
|
-
const automationUtils = require("../automationUtils");
|
|
13
12
|
exports.definition = {
|
|
14
13
|
description: "Send an email using SMTP",
|
|
15
14
|
tagline: "Send SMTP email to {{inputs.to}}",
|
|
@@ -72,7 +71,7 @@ exports.run = function ({ inputs }) {
|
|
|
72
71
|
catch (err) {
|
|
73
72
|
return {
|
|
74
73
|
success: false,
|
|
75
|
-
response:
|
|
74
|
+
response: err,
|
|
76
75
|
};
|
|
77
76
|
}
|
|
78
77
|
});
|
|
@@ -73,7 +73,6 @@ exports.run = function ({ inputs, appId, emitter }) {
|
|
|
73
73
|
},
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
const tableId = inputs.row.tableId;
|
|
77
76
|
// clear any falsy properties so that they aren't updated
|
|
78
77
|
for (let propKey of Object.keys(inputs.row)) {
|
|
79
78
|
if (!inputs.row[propKey] || inputs.row[propKey] === "") {
|
|
@@ -85,13 +84,10 @@ exports.run = function ({ inputs, appId, emitter }) {
|
|
|
85
84
|
body: Object.assign(Object.assign({}, inputs.row), { _id: inputs.rowId }),
|
|
86
85
|
params: {
|
|
87
86
|
rowId: inputs.rowId,
|
|
88
|
-
tableId: tableId,
|
|
89
87
|
},
|
|
90
88
|
});
|
|
91
89
|
try {
|
|
92
|
-
|
|
93
|
-
inputs.row = yield automationUtils.cleanUpRow(appId, tableId, inputs.row);
|
|
94
|
-
}
|
|
90
|
+
inputs.row = yield automationUtils.cleanUpRowById(appId, inputs.rowId, inputs.row);
|
|
95
91
|
yield rowController.patch(ctx);
|
|
96
92
|
return {
|
|
97
93
|
row: ctx.body,
|
|
@@ -104,7 +100,7 @@ exports.run = function ({ inputs, appId, emitter }) {
|
|
|
104
100
|
catch (err) {
|
|
105
101
|
return {
|
|
106
102
|
success: false,
|
|
107
|
-
response:
|
|
103
|
+
response: err,
|
|
108
104
|
};
|
|
109
105
|
}
|
|
110
106
|
});
|
|
@@ -19,7 +19,6 @@ const { doInTenant } = require("@budibase/auth/tenancy");
|
|
|
19
19
|
const env = require("../environment");
|
|
20
20
|
const usage = require("../utilities/usageQuota");
|
|
21
21
|
const FILTER_STEP_ID = actions.ACTION_DEFINITIONS.FILTER.stepId;
|
|
22
|
-
const STOPPED_STATUS = { success: false, status: "STOPPED" };
|
|
23
22
|
/**
|
|
24
23
|
* The automation orchestrator is a class responsible for executing automations.
|
|
25
24
|
* It handles the context of the automation and makes sure each step gets the correct
|
|
@@ -78,13 +77,7 @@ class Orchestrator {
|
|
|
78
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
78
|
let automation = this._automation;
|
|
80
79
|
const app = yield this.getApp();
|
|
81
|
-
let stopped = false;
|
|
82
80
|
for (let step of automation.definition.steps) {
|
|
83
|
-
// execution stopped, record state for that
|
|
84
|
-
if (stopped) {
|
|
85
|
-
this.updateExecutionOutput(step.id, step.stepId, {}, STOPPED_STATUS);
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
81
|
let stepFn = yield this.getStepFunctionality(step.stepId);
|
|
89
82
|
step.inputs = yield processObject(step.inputs, this._context);
|
|
90
83
|
step.inputs = automationUtils.cleanInputValues(step.inputs, step.schema.inputs);
|
|
@@ -99,14 +92,10 @@ class Orchestrator {
|
|
|
99
92
|
context: this._context,
|
|
100
93
|
});
|
|
101
94
|
});
|
|
102
|
-
this._context.steps.push(outputs);
|
|
103
|
-
// if filter causes us to stop execution don't break the loop, set a var
|
|
104
|
-
// so that we can finish iterating through the steps and record that it stopped
|
|
105
95
|
if (step.stepId === FILTER_STEP_ID && !outputs.success) {
|
|
106
|
-
|
|
107
|
-
this.updateExecutionOutput(step.id, step.stepId, step.inputs, Object.assign(Object.assign({}, outputs), STOPPED_STATUS));
|
|
108
|
-
continue;
|
|
96
|
+
break;
|
|
109
97
|
}
|
|
98
|
+
this._context.steps.push(outputs);
|
|
110
99
|
this.updateExecutionOutput(step.id, step.stepId, step.inputs, outputs);
|
|
111
100
|
}
|
|
112
101
|
catch (err) {
|
|
@@ -116,7 +105,7 @@ class Orchestrator {
|
|
|
116
105
|
}
|
|
117
106
|
// Increment quota for automation runs
|
|
118
107
|
if (!env.SELF_HOSTED && !isDevAppID(this._appId)) {
|
|
119
|
-
|
|
108
|
+
usage.update(usage.Properties.AUTOMATION, 1);
|
|
120
109
|
}
|
|
121
110
|
return this.executionOutput;
|
|
122
111
|
});
|
package/dist/constants/index.js
CHANGED
|
@@ -80,7 +80,7 @@ function addFilters(tableName, query, filters) {
|
|
|
80
80
|
}
|
|
81
81
|
return query;
|
|
82
82
|
}
|
|
83
|
-
function addRelationships(
|
|
83
|
+
function addRelationships(query, fromTable, relationships) {
|
|
84
84
|
if (!relationships) {
|
|
85
85
|
return query;
|
|
86
86
|
}
|
|
@@ -88,7 +88,7 @@ function addRelationships(knex, query, fields, fromTable, relationships) {
|
|
|
88
88
|
const from = relationship.from, to = relationship.to, toTable = relationship.tableName;
|
|
89
89
|
if (!relationship.through) {
|
|
90
90
|
// @ts-ignore
|
|
91
|
-
query = query.leftJoin(toTable, `${fromTable}.${from}`, `${
|
|
91
|
+
query = query.leftJoin(toTable, `${fromTable}.${from}`, `${relationship.tableName}.${to}`);
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
94
|
const throughTable = relationship.through;
|
|
@@ -100,7 +100,7 @@ function addRelationships(knex, query, fields, fromTable, relationships) {
|
|
|
100
100
|
.leftJoin(toTable, `${toTable}.${toPrimary}`, `${throughTable}.${to}`);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
return query
|
|
103
|
+
return query;
|
|
104
104
|
}
|
|
105
105
|
function buildCreate(knex, json, opts) {
|
|
106
106
|
const { endpoint, body } = json;
|
|
@@ -165,7 +165,7 @@ function buildRead(knex, json, limit) {
|
|
|
165
165
|
[tableName]: query,
|
|
166
166
|
}).select(selectStatement);
|
|
167
167
|
// handle joins
|
|
168
|
-
return addRelationships(
|
|
168
|
+
return addRelationships(preQuery, tableName, relationships);
|
|
169
169
|
}
|
|
170
170
|
function buildUpdate(knex, json, opts) {
|
|
171
171
|
const { endpoint, body, filters } = json;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.copyExistingPropsOver = exports.isIsoDateString = exports.isSQL = exports.getSqlQuery = exports.convertType = exports.breakRowIdField = exports.
|
|
3
|
+
exports.copyExistingPropsOver = exports.isIsoDateString = exports.isSQL = exports.getSqlQuery = exports.convertType = exports.breakRowIdField = exports.generateRowIdField = exports.breakExternalTableId = exports.buildExternalTableId = exports.isExternalTable = void 0;
|
|
4
4
|
const datasource_1 = require("../definitions/datasource");
|
|
5
5
|
const { DocumentTypes, SEPARATOR } = require("../db/utils");
|
|
6
6
|
const { FieldTypes } = require("../constants");
|
|
7
7
|
const DOUBLE_SEPARATOR = `${SEPARATOR}${SEPARATOR}`;
|
|
8
|
-
const ROW_ID_REGEX = /^\[.*]$/g;
|
|
9
8
|
function isExternalTable(tableId) {
|
|
10
9
|
return tableId.includes(DocumentTypes.DATASOURCE);
|
|
11
10
|
}
|
|
@@ -32,20 +31,6 @@ function generateRowIdField(keyProps = []) {
|
|
|
32
31
|
return encodeURIComponent(JSON.stringify(keyProps).replace(/"/g, "'"));
|
|
33
32
|
}
|
|
34
33
|
exports.generateRowIdField = generateRowIdField;
|
|
35
|
-
function isRowId(field) {
|
|
36
|
-
return Array.isArray(field) || (typeof field === "string" && field.match(ROW_ID_REGEX) != null);
|
|
37
|
-
}
|
|
38
|
-
exports.isRowId = isRowId;
|
|
39
|
-
function convertRowId(field) {
|
|
40
|
-
if (Array.isArray(field)) {
|
|
41
|
-
return field[0];
|
|
42
|
-
}
|
|
43
|
-
if (typeof field === "string" && field.match(ROW_ID_REGEX) != null) {
|
|
44
|
-
return field.substring(1, field.length - 1);
|
|
45
|
-
}
|
|
46
|
-
return field;
|
|
47
|
-
}
|
|
48
|
-
exports.convertRowId = convertRowId;
|
|
49
34
|
// should always return an array
|
|
50
35
|
function breakRowIdField(_id) {
|
|
51
36
|
if (!_id) {
|
|
@@ -53,7 +53,7 @@ module.exports = (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
53
53
|
const globalUser = yield getCachedSelf(ctx, requestAppId);
|
|
54
54
|
appId = requestAppId;
|
|
55
55
|
// retrieving global user gets the right role
|
|
56
|
-
roleId = globalUser.roleId ||
|
|
56
|
+
roleId = globalUser.roleId || BUILTIN_ROLE_IDS.BASIC;
|
|
57
57
|
}
|
|
58
58
|
// nothing more to do
|
|
59
59
|
if (!appId) {
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.171",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
"author": "Budibase",
|
|
69
69
|
"license": "AGPL-3.0-or-later",
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@budibase/auth": "^0.9.
|
|
72
|
-
"@budibase/client": "^0.9.
|
|
73
|
-
"@budibase/string-templates": "^0.9.
|
|
71
|
+
"@budibase/auth": "^0.9.171",
|
|
72
|
+
"@budibase/client": "^0.9.171",
|
|
73
|
+
"@budibase/string-templates": "^0.9.171",
|
|
74
74
|
"@elastic/elasticsearch": "7.10.0",
|
|
75
75
|
"@koa/router": "8.0.0",
|
|
76
76
|
"@sendgrid/mail": "7.1.1",
|
|
77
|
-
"@sentry/node": "
|
|
77
|
+
"@sentry/node": "5.19.2",
|
|
78
78
|
"airtable": "0.10.1",
|
|
79
79
|
"arangojs": "7.2.0",
|
|
80
80
|
"aws-sdk": "^2.767.0",
|
|
@@ -119,7 +119,6 @@
|
|
|
119
119
|
"to-json-schema": "0.2.5",
|
|
120
120
|
"uuid": "3.3.2",
|
|
121
121
|
"validate.js": "0.13.1",
|
|
122
|
-
"vm2": "^3.9.3",
|
|
123
122
|
"yargs": "13.2.4",
|
|
124
123
|
"zlib": "1.0.5"
|
|
125
124
|
},
|