@budibase/server 1.1.32-alpha.6 → 1.1.32
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.133db51f.js +978 -0
- package/builder/assets/{index.4d57d3d4.css → index.192adf4c.css} +2 -2
- package/builder/assets/{vendor.6bcafa60.js → vendor.162098da.js} +1 -1
- package/builder/index.html +3 -3
- package/coverage/clover.xml +696 -381
- package/coverage/coverage-final.json +16 -13
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +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 +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- 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 +4 -4
- 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 +18 -18
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +49 -94
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +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 +15 -15
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +2 -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 +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +17 -17
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +2 -5
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +18 -18
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +14 -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/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +19 -19
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +13 -61
- 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 +72 -57
- 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 +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +21 -21
- package/coverage/lcov-report/middleware/joi-validator.js.html +43 -43
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/threads/automation.js.html +1114 -0
- package/coverage/lcov-report/threads/index.html +146 -0
- package/coverage/lcov-report/threads/query.js.html +916 -0
- package/coverage/lcov-report/threads/utils.js.html +319 -0
- 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 -68
- package/coverage/lcov-report/utilities/index.html +19 -19
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +14 -26
- package/coverage/lcov-report/utilities/queue/index.html +17 -17
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +2 -2
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +1214 -695
- package/dist/api/controllers/deploy/index.js +0 -1
- package/dist/api/controllers/query/index.js +1 -1
- package/dist/api/controllers/query/validation.js +3 -3
- package/dist/api/controllers/row/internalSearch.js +16 -30
- package/dist/api/routes/utils/validators.js +1 -1
- package/dist/automations/utils.js +1 -47
- package/dist/constants/index.js +4 -1
- package/dist/db/utils.js +1 -14
- package/dist/integrations/base/sql.js +14 -43
- package/dist/package.json +8 -8
- package/dist/threads/automation.js +54 -147
- package/dist/threads/index.js +20 -27
- package/dist/threads/query.js +15 -23
- package/dist/threads/utils.js +24 -47
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/global.js +5 -24
- package/dist/utilities/queue/inMemoryQueue.js +0 -5
- package/package.json +9 -9
- package/src/api/controllers/deploy/index.ts +1 -6
- package/src/api/controllers/query/index.ts +1 -1
- package/src/api/controllers/query/validation.js +3 -3
- package/src/api/controllers/row/internalSearch.js +20 -35
- package/src/api/routes/tests/user.spec.js +0 -2
- package/src/api/routes/utils/validators.js +1 -1
- package/src/automations/steps/executeQuery.js +0 -1
- package/src/automations/tests/automation.spec.js +2 -2
- package/src/automations/utils.ts +1 -54
- package/src/constants/index.js +5 -2
- package/src/db/utils.js +0 -16
- package/src/definitions/datasource.ts +0 -3
- package/src/integrations/base/sql.ts +13 -44
- package/src/integrations/tests/sql.spec.js +4 -50
- package/src/middleware/tests/currentapp.spec.js +0 -11
- package/src/threads/{automation.ts → automation.js} +48 -172
- package/src/threads/index.ts +23 -31
- package/src/threads/{query.ts → query.js} +12 -32
- package/src/threads/{utils.ts → utils.js} +12 -31
- package/src/utilities/global.js +3 -21
- package/src/utilities/queue/inMemoryQueue.js +0 -4
- package/builder/assets/index.fdd9c6c9.js +0 -977
- package/dist/definitions/automations.js +0 -8
- package/dist/threads/definitions.js +0 -2
- package/src/definitions/automations.ts +0 -49
- package/src/threads/definitions.ts +0 -18
|
@@ -8,45 +8,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.execute = void 0;
|
|
16
|
-
const utils_1 = __importDefault(require("./utils"));
|
|
17
|
-
utils_1.default.threadSetup();
|
|
18
|
-
const utils_2 = require("../automations/utils");
|
|
19
|
-
const actions_1 = __importDefault(require("../automations/actions"));
|
|
20
|
-
const automationUtils_1 = __importDefault(require("../automations/automationUtils"));
|
|
21
|
-
const AutomationEmitter_1 = __importDefault(require("../events/AutomationEmitter"));
|
|
22
|
-
const utils_3 = require("../db/utils");
|
|
23
|
-
const triggerInfo_1 = require("../automations/triggerInfo");
|
|
24
|
-
const constants_1 = require("../constants");
|
|
25
|
-
const logging_1 = require("../automations/logging");
|
|
26
|
-
const types_1 = require("@budibase/types");
|
|
27
|
-
const automations_1 = require("../definitions/automations");
|
|
28
|
-
const { doInAppContext, getAppDB } = require("@budibase/backend-core/context");
|
|
29
|
-
const { logAlertWithInfo, logWarn } = require("@budibase/backend-core/logging");
|
|
11
|
+
require("./utils").threadSetup();
|
|
12
|
+
const actions = require("../automations/actions");
|
|
13
|
+
const automationUtils = require("../automations/automationUtils");
|
|
14
|
+
const AutomationEmitter = require("../events/AutomationEmitter");
|
|
30
15
|
const { processObject } = require("@budibase/string-templates");
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
16
|
+
const { DocumentTypes } = require("../db/utils");
|
|
17
|
+
const { definitions: triggerDefs } = require("../automations/triggerInfo");
|
|
18
|
+
const { doInAppContext, getAppDB } = require("@budibase/backend-core/context");
|
|
19
|
+
const { AutomationErrors, LoopStepTypes } = require("../constants");
|
|
20
|
+
const { storeLog } = require("../automations/logging");
|
|
21
|
+
const FILTER_STEP_ID = actions.ACTION_DEFINITIONS.FILTER.stepId;
|
|
22
|
+
const LOOP_STEP_ID = actions.ACTION_DEFINITIONS.LOOP.stepId;
|
|
23
|
+
const CRON_STEP_ID = triggerDefs.CRON.stepId;
|
|
24
|
+
const STOPPED_STATUS = { success: true, status: "STOPPED" };
|
|
35
25
|
const { cloneDeep } = require("lodash/fp");
|
|
36
26
|
const env = require("../environment");
|
|
37
27
|
function typecastForLooping(loopStep, input) {
|
|
38
28
|
if (!input || !input.binding) {
|
|
39
29
|
return null;
|
|
40
30
|
}
|
|
31
|
+
const isArray = Array.isArray(input.binding), isString = typeof input.binding === "string";
|
|
41
32
|
try {
|
|
42
33
|
switch (loopStep.inputs.option) {
|
|
43
|
-
case
|
|
44
|
-
if (
|
|
34
|
+
case LoopStepTypes.ARRAY:
|
|
35
|
+
if (isString) {
|
|
45
36
|
return JSON.parse(input.binding);
|
|
46
37
|
}
|
|
47
38
|
break;
|
|
48
|
-
case
|
|
49
|
-
if (
|
|
39
|
+
case LoopStepTypes.STRING:
|
|
40
|
+
if (isArray) {
|
|
50
41
|
return input.binding.join(",");
|
|
51
42
|
}
|
|
52
43
|
break;
|
|
@@ -64,7 +55,7 @@ function getLoopIterations(loopStep, input) {
|
|
|
64
55
|
}
|
|
65
56
|
return Array.isArray(binding)
|
|
66
57
|
? binding.length
|
|
67
|
-
:
|
|
58
|
+
: automationUtils.stringSplit(binding).length;
|
|
68
59
|
}
|
|
69
60
|
/**
|
|
70
61
|
* The automation orchestrator is a class responsible for executing automations.
|
|
@@ -72,16 +63,11 @@ function getLoopIterations(loopStep, input) {
|
|
|
72
63
|
* inputs and handles any outputs.
|
|
73
64
|
*/
|
|
74
65
|
class Orchestrator {
|
|
75
|
-
constructor(automation, triggerOutput
|
|
76
|
-
|
|
77
|
-
this._chainCount =
|
|
66
|
+
constructor(automation, triggerOutput = {}) {
|
|
67
|
+
this._metadata = triggerOutput.metadata;
|
|
68
|
+
this._chainCount = this._metadata ? this._metadata.automationChainCount : 0;
|
|
78
69
|
this._appId = triggerOutput.appId;
|
|
79
|
-
|
|
80
|
-
this._repeat = {
|
|
81
|
-
jobId: opts.repeat.jobId,
|
|
82
|
-
jobKey: opts.repeat.key,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
70
|
+
this._app = null;
|
|
85
71
|
const triggerStepId = automation.definition.trigger.stepId;
|
|
86
72
|
triggerOutput = this.cleanupTriggerOutputs(triggerStepId, triggerOutput);
|
|
87
73
|
// remove from context
|
|
@@ -92,7 +78,7 @@ class Orchestrator {
|
|
|
92
78
|
this._automation = automation;
|
|
93
79
|
// create an emitter which has the chain count for this automation run in it, so it can block
|
|
94
80
|
// excessive chaining if required
|
|
95
|
-
this._emitter = new
|
|
81
|
+
this._emitter = new AutomationEmitter(this._chainCount + 1);
|
|
96
82
|
this.executionOutput = { trigger: {}, steps: [] };
|
|
97
83
|
// setup the execution output
|
|
98
84
|
const triggerId = automation.definition.trigger.id;
|
|
@@ -106,98 +92,32 @@ class Orchestrator {
|
|
|
106
92
|
}
|
|
107
93
|
getStepFunctionality(stepId) {
|
|
108
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
let step = yield
|
|
95
|
+
let step = yield actions.getAction(stepId);
|
|
110
96
|
if (step == null) {
|
|
111
97
|
throw `Cannot find automation step by name ${stepId}`;
|
|
112
98
|
}
|
|
113
99
|
return step;
|
|
114
100
|
});
|
|
115
101
|
}
|
|
116
|
-
|
|
117
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
const metadataId = (0, utils_3.generateAutomationMetadataID)(this._automation._id);
|
|
119
|
-
const db = getAppDB();
|
|
120
|
-
let metadata;
|
|
121
|
-
try {
|
|
122
|
-
metadata = yield db.get(metadataId);
|
|
123
|
-
}
|
|
124
|
-
catch (err) {
|
|
125
|
-
metadata = {
|
|
126
|
-
_id: metadataId,
|
|
127
|
-
errorCount: 0,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
return metadata;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
checkIfShouldStop(metadata) {
|
|
134
|
-
var _a, _b;
|
|
135
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
if (!metadata.errorCount || !this._repeat) {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
const automation = this._automation;
|
|
140
|
-
const trigger = automation.definition.trigger;
|
|
141
|
-
if (metadata.errorCount >= constants_1.MAX_AUTOMATION_RECURRING_ERRORS) {
|
|
142
|
-
logWarn(`CRON disabled due to errors - ${this._appId}/${this._automation._id}`);
|
|
143
|
-
yield (0, utils_2.disableCron)((_a = this._repeat) === null || _a === void 0 ? void 0 : _a.jobId, (_b = this._repeat) === null || _b === void 0 ? void 0 : _b.jobKey);
|
|
144
|
-
this.updateExecutionOutput(trigger.id, trigger.stepId, {}, {
|
|
145
|
-
status: types_1.AutomationStatus.STOPPED_ERROR,
|
|
146
|
-
success: false,
|
|
147
|
-
});
|
|
148
|
-
yield (0, logging_1.storeLog)(automation, this.executionOutput);
|
|
149
|
-
return true;
|
|
150
|
-
}
|
|
151
|
-
return false;
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
updateMetadata(metadata) {
|
|
102
|
+
getApp() {
|
|
155
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
const count = metadata.errorCount;
|
|
161
|
-
const isError = (0, utils_2.isErrorInOutput)(output);
|
|
162
|
-
// nothing to do in this scenario, escape
|
|
163
|
-
if (!count && !isError) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
if (isError) {
|
|
167
|
-
metadata.errorCount = count ? count + 1 : 1;
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
metadata.errorCount = 0;
|
|
104
|
+
if (this._app) {
|
|
105
|
+
return this._app;
|
|
171
106
|
}
|
|
172
107
|
const db = getAppDB();
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
catch (err) {
|
|
177
|
-
logAlertWithInfo("Failed to write automation metadata", db.name, automation._id, err);
|
|
178
|
-
}
|
|
108
|
+
this._app = yield db.get(DocumentTypes.APP_METADATA);
|
|
109
|
+
return this._app;
|
|
179
110
|
});
|
|
180
111
|
}
|
|
181
112
|
updateExecutionOutput(id, stepId, inputs, outputs) {
|
|
182
113
|
const stepObj = { id, stepId, inputs, outputs };
|
|
183
|
-
// replacing trigger when disabling CRON
|
|
184
|
-
if (stepId === CRON_STEP_ID &&
|
|
185
|
-
outputs.status === types_1.AutomationStatus.STOPPED_ERROR) {
|
|
186
|
-
this.executionOutput.trigger = stepObj;
|
|
187
|
-
this.executionOutput.steps = [stepObj];
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
114
|
// first entry is always the trigger (constructor)
|
|
191
|
-
if (this.executionOutput.steps.length === 0
|
|
192
|
-
this.executionOutput.trigger.id === id) {
|
|
115
|
+
if (this.executionOutput.steps.length === 0) {
|
|
193
116
|
this.executionOutput.trigger = stepObj;
|
|
194
117
|
}
|
|
195
118
|
this.executionOutput.steps.push(stepObj);
|
|
196
119
|
}
|
|
197
120
|
updateContextAndOutput(loopStepNumber, step, output, result) {
|
|
198
|
-
if (!loopStepNumber) {
|
|
199
|
-
throw new Error("No loop step number provided.");
|
|
200
|
-
}
|
|
201
121
|
this.executionOutput.steps.splice(loopStepNumber, 0, {
|
|
202
122
|
id: step.id,
|
|
203
123
|
stepId: step.stepId,
|
|
@@ -211,19 +131,10 @@ class Orchestrator {
|
|
|
211
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
212
132
|
let automation = this._automation;
|
|
213
133
|
let stopped = false;
|
|
214
|
-
let loopStep =
|
|
134
|
+
let loopStep = null;
|
|
215
135
|
let stepCount = 0;
|
|
216
|
-
let loopStepNumber =
|
|
136
|
+
let loopStepNumber = null;
|
|
217
137
|
let loopSteps = [];
|
|
218
|
-
let metadata;
|
|
219
|
-
// check if this is a recurring automation,
|
|
220
|
-
if ((0, utils_3.isProdAppID)(this._appId) && (0, utils_2.isRecurring)(automation)) {
|
|
221
|
-
metadata = yield this.getMetadata();
|
|
222
|
-
const shouldStop = yield this.checkIfShouldStop(metadata);
|
|
223
|
-
if (shouldStop) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
138
|
for (let step of automation.definition.steps) {
|
|
228
139
|
stepCount++;
|
|
229
140
|
let input, iterations = 1, iterationCount = 0;
|
|
@@ -247,17 +158,17 @@ class Orchestrator {
|
|
|
247
158
|
}
|
|
248
159
|
catch (err) {
|
|
249
160
|
this.updateContextAndOutput(loopStepNumber, step, tempOutput, {
|
|
250
|
-
status:
|
|
161
|
+
status: AutomationErrors.INCORRECT_TYPE,
|
|
251
162
|
success: false,
|
|
252
163
|
});
|
|
253
|
-
loopSteps =
|
|
254
|
-
loopStep =
|
|
164
|
+
loopSteps = null;
|
|
165
|
+
loopStep = null;
|
|
255
166
|
break;
|
|
256
167
|
}
|
|
257
168
|
let item;
|
|
258
169
|
if (typeof loopStep.inputs.binding === "string" &&
|
|
259
170
|
loopStep.inputs.option === "String") {
|
|
260
|
-
item =
|
|
171
|
+
item = automationUtils.stringSplit(newInput.binding);
|
|
261
172
|
}
|
|
262
173
|
else {
|
|
263
174
|
item = loopStep.inputs.binding;
|
|
@@ -272,31 +183,31 @@ class Orchestrator {
|
|
|
272
183
|
for (let [innerKey, innerValue] of Object.entries(originalStepInput[key])) {
|
|
273
184
|
if (typeof innerValue === "string") {
|
|
274
185
|
originalStepInput[key][innerKey] =
|
|
275
|
-
|
|
186
|
+
automationUtils.substituteLoopStep(innerValue, `steps.${loopStepNumber}`);
|
|
276
187
|
}
|
|
277
188
|
}
|
|
278
189
|
}
|
|
279
190
|
else {
|
|
280
191
|
if (typeof value === "string") {
|
|
281
|
-
originalStepInput[key] =
|
|
192
|
+
originalStepInput[key] = automationUtils.substituteLoopStep(value, `steps.${loopStepNumber}`);
|
|
282
193
|
}
|
|
283
194
|
}
|
|
284
195
|
}
|
|
285
196
|
if (index === env.AUTOMATION_MAX_ITERATION ||
|
|
286
197
|
index === parseInt(loopStep.inputs.iterations)) {
|
|
287
198
|
this.updateContextAndOutput(loopStepNumber, step, tempOutput, {
|
|
288
|
-
status:
|
|
199
|
+
status: AutomationErrors.MAX_ITERATIONS,
|
|
289
200
|
success: true,
|
|
290
201
|
});
|
|
291
|
-
loopSteps =
|
|
292
|
-
loopStep =
|
|
202
|
+
loopSteps = null;
|
|
203
|
+
loopStep = null;
|
|
293
204
|
break;
|
|
294
205
|
}
|
|
295
206
|
let isFailure = false;
|
|
296
207
|
const currentItem = (_a = this._context.steps[loopStepNumber]) === null || _a === void 0 ? void 0 : _a.currentItem;
|
|
297
208
|
if (currentItem && typeof currentItem === "object") {
|
|
298
209
|
isFailure = Object.keys(currentItem).some(value => {
|
|
299
|
-
return currentItem[value] ===
|
|
210
|
+
return currentItem[value] === loopStep.inputs.failure;
|
|
300
211
|
});
|
|
301
212
|
}
|
|
302
213
|
else {
|
|
@@ -304,11 +215,11 @@ class Orchestrator {
|
|
|
304
215
|
}
|
|
305
216
|
if (isFailure) {
|
|
306
217
|
this.updateContextAndOutput(loopStepNumber, step, tempOutput, {
|
|
307
|
-
status:
|
|
218
|
+
status: AutomationErrors.FAILURE_CONDITION,
|
|
308
219
|
success: false,
|
|
309
220
|
});
|
|
310
|
-
loopSteps =
|
|
311
|
-
loopStep =
|
|
221
|
+
loopSteps = null;
|
|
222
|
+
loopStep = null;
|
|
312
223
|
break;
|
|
313
224
|
}
|
|
314
225
|
}
|
|
@@ -320,7 +231,7 @@ class Orchestrator {
|
|
|
320
231
|
// If it's a loop step, we need to manually add the bindings to the context
|
|
321
232
|
let stepFn = yield this.getStepFunctionality(step.stepId);
|
|
322
233
|
let inputs = yield processObject(originalStepInput, this._context);
|
|
323
|
-
inputs =
|
|
234
|
+
inputs = automationUtils.cleanInputValues(inputs, step.schema.inputs);
|
|
324
235
|
try {
|
|
325
236
|
// appId is always passed
|
|
326
237
|
const outputs = yield stepFn({
|
|
@@ -351,7 +262,7 @@ class Orchestrator {
|
|
|
351
262
|
if (loopStep) {
|
|
352
263
|
iterationCount++;
|
|
353
264
|
if (index === iterations - 1) {
|
|
354
|
-
loopStep =
|
|
265
|
+
loopStep = null;
|
|
355
266
|
this._context.steps.splice(loopStepNumber, 1);
|
|
356
267
|
break;
|
|
357
268
|
}
|
|
@@ -370,22 +281,19 @@ class Orchestrator {
|
|
|
370
281
|
inputs: step.inputs,
|
|
371
282
|
});
|
|
372
283
|
this._context.steps.splice(loopStepNumber, 0, tempOutput);
|
|
373
|
-
loopSteps =
|
|
284
|
+
loopSteps = null;
|
|
374
285
|
}
|
|
375
286
|
}
|
|
376
287
|
// store the logs for the automation run
|
|
377
|
-
yield
|
|
378
|
-
if ((0, utils_3.isProdAppID)(this._appId) && (0, utils_2.isRecurring)(automation) && metadata) {
|
|
379
|
-
yield this.updateMetadata(metadata);
|
|
380
|
-
}
|
|
288
|
+
yield storeLog(this._automation, this.executionOutput);
|
|
381
289
|
return this.executionOutput;
|
|
382
290
|
});
|
|
383
291
|
}
|
|
384
292
|
}
|
|
385
|
-
|
|
293
|
+
module.exports = (input, callback) => {
|
|
386
294
|
const appId = input.data.event.appId;
|
|
387
|
-
doInAppContext(appId, () => __awaiter(
|
|
388
|
-
const automationOrchestrator = new Orchestrator(input.data.automation, input.data.event
|
|
295
|
+
doInAppContext(appId, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
296
|
+
const automationOrchestrator = new Orchestrator(input.data.automation, input.data.event);
|
|
389
297
|
try {
|
|
390
298
|
const response = yield automationOrchestrator.execute();
|
|
391
299
|
callback(null, response);
|
|
@@ -394,5 +302,4 @@ function execute(input, callback) {
|
|
|
394
302
|
callback(err);
|
|
395
303
|
}
|
|
396
304
|
}));
|
|
397
|
-
}
|
|
398
|
-
exports.execute = execute;
|
|
305
|
+
};
|
package/dist/threads/index.js
CHANGED
|
@@ -54,14 +54,17 @@ function typeToFile(type) {
|
|
|
54
54
|
default:
|
|
55
55
|
throw "Unknown thread type";
|
|
56
56
|
}
|
|
57
|
-
// have to use require here, to make it work with worker-farm
|
|
58
57
|
return require.resolve(filename);
|
|
59
58
|
}
|
|
60
59
|
class Thread {
|
|
61
60
|
constructor(type, opts = { timeoutMs: null, count: 1 }) {
|
|
62
61
|
this.type = type;
|
|
63
62
|
this.count = opts.count ? opts.count : 1;
|
|
64
|
-
this.disableThreading =
|
|
63
|
+
this.disableThreading =
|
|
64
|
+
env.isTest() ||
|
|
65
|
+
env.DISABLE_THREADING ||
|
|
66
|
+
this.count === 0 ||
|
|
67
|
+
env.isInThread();
|
|
65
68
|
if (!this.disableThreading) {
|
|
66
69
|
const workerOpts = {
|
|
67
70
|
autoStart: true,
|
|
@@ -71,41 +74,31 @@ class Thread {
|
|
|
71
74
|
this.timeoutMs = opts.timeoutMs;
|
|
72
75
|
workerOpts.maxCallTime = opts.timeoutMs;
|
|
73
76
|
}
|
|
74
|
-
this.workers = (0, worker_farm_1.default)(workerOpts, typeToFile(type)
|
|
77
|
+
this.workers = (0, worker_farm_1.default)(workerOpts, typeToFile(type));
|
|
75
78
|
Thread.workerRefs.push(this.workers);
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
|
-
shouldDisableThreading() {
|
|
79
|
-
return !!(env.isTest() ||
|
|
80
|
-
env.DISABLE_THREADING ||
|
|
81
|
-
this.count === 0 ||
|
|
82
|
-
env.isInThread());
|
|
83
|
-
}
|
|
84
81
|
run(data) {
|
|
85
|
-
const timeout = this.timeoutMs;
|
|
86
82
|
return new Promise((resolve, reject) => {
|
|
87
|
-
|
|
88
|
-
worker.execute(data, (err, response) => {
|
|
89
|
-
if (err && err.type === "TimeoutError") {
|
|
90
|
-
reject(new Error(`Query response time exceeded ${timeout}ms timeout.`));
|
|
91
|
-
}
|
|
92
|
-
else if (err) {
|
|
93
|
-
reject(err);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
resolve(response);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
83
|
+
let fncToCall;
|
|
100
84
|
// if in test then don't use threading
|
|
101
85
|
if (this.disableThreading) {
|
|
102
|
-
|
|
103
|
-
fire(thread);
|
|
104
|
-
});
|
|
86
|
+
fncToCall = require(typeToFile(this.type));
|
|
105
87
|
}
|
|
106
88
|
else {
|
|
107
|
-
|
|
89
|
+
fncToCall = this.workers;
|
|
108
90
|
}
|
|
91
|
+
fncToCall(data, (err, response) => {
|
|
92
|
+
if (err && err.type === "TimeoutError") {
|
|
93
|
+
reject(new Error(`Query response time exceeded ${this.timeoutMs}ms timeout.`));
|
|
94
|
+
}
|
|
95
|
+
else if (err) {
|
|
96
|
+
reject(err);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
resolve(response);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
109
102
|
});
|
|
110
103
|
}
|
|
111
104
|
static stopThreads() {
|
package/dist/threads/query.js
CHANGED
|
@@ -8,13 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.execute = void 0;
|
|
16
|
-
const utils_1 = __importDefault(require("./utils"));
|
|
17
|
-
utils_1.default.threadSetup();
|
|
11
|
+
const threadUtils = require("./utils");
|
|
12
|
+
threadUtils.threadSetup();
|
|
18
13
|
const ScriptRunner = require("../utilities/scriptRunner");
|
|
19
14
|
const { integrations } = require("../integrations");
|
|
20
15
|
const { processStringSync } = require("@budibase/string-templates");
|
|
@@ -44,7 +39,6 @@ class QueryRunner {
|
|
|
44
39
|
this.queryResponse = {};
|
|
45
40
|
this.hasRerun = false;
|
|
46
41
|
this.hasRefreshedOAuth = false;
|
|
47
|
-
this.hasDynamicVariables = false;
|
|
48
42
|
}
|
|
49
43
|
execute() {
|
|
50
44
|
var _a;
|
|
@@ -58,7 +52,7 @@ class QueryRunner {
|
|
|
58
52
|
}
|
|
59
53
|
if (datasourceClone.config.authConfigs) {
|
|
60
54
|
datasourceClone.config.authConfigs =
|
|
61
|
-
datasourceClone.config.authConfigs.map(
|
|
55
|
+
datasourceClone.config.authConfigs.map(config => {
|
|
62
56
|
return enrichQueryFields(config, this.ctx);
|
|
63
57
|
});
|
|
64
58
|
}
|
|
@@ -85,9 +79,9 @@ class QueryRunner {
|
|
|
85
79
|
if (this.pagination) {
|
|
86
80
|
query.paginationValues = this.pagination;
|
|
87
81
|
}
|
|
88
|
-
let output =
|
|
82
|
+
let output = threadUtils.formatResponse(yield integration[queryVerb](query));
|
|
89
83
|
let rows = output, info = undefined, extra = undefined, pagination = undefined;
|
|
90
|
-
if (
|
|
84
|
+
if (threadUtils.hasExtraData(output)) {
|
|
91
85
|
rows = output.data;
|
|
92
86
|
info = output.info;
|
|
93
87
|
extra = output.extra;
|
|
@@ -113,7 +107,7 @@ class QueryRunner {
|
|
|
113
107
|
else {
|
|
114
108
|
this.hasRerun = true;
|
|
115
109
|
}
|
|
116
|
-
yield
|
|
110
|
+
yield threadUtils.invalidateDynamicVariables(this.cachedVariables);
|
|
117
111
|
return this.execute();
|
|
118
112
|
}
|
|
119
113
|
// check for undefined response
|
|
@@ -125,8 +119,8 @@ class QueryRunner {
|
|
|
125
119
|
rows = [rows];
|
|
126
120
|
}
|
|
127
121
|
// map into JSON if just raw primitive here
|
|
128
|
-
if (rows.find(
|
|
129
|
-
rows = rows.map(
|
|
122
|
+
if (rows.find(row => typeof row !== "object")) {
|
|
123
|
+
rows = rows.map(value => ({ value }));
|
|
130
124
|
}
|
|
131
125
|
// get all the potential fields in the schema
|
|
132
126
|
let keys = rows.flatMap(Object.keys);
|
|
@@ -147,7 +141,6 @@ class QueryRunner {
|
|
|
147
141
|
fields: query.fields,
|
|
148
142
|
parameters,
|
|
149
143
|
transformer: query.transformer,
|
|
150
|
-
queryId,
|
|
151
144
|
}, { noRecursiveQuery: true }).execute();
|
|
152
145
|
});
|
|
153
146
|
}
|
|
@@ -179,14 +172,14 @@ class QueryRunner {
|
|
|
179
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
180
173
|
let { parameters } = this;
|
|
181
174
|
const queryId = variable.queryId, name = variable.name;
|
|
182
|
-
let value = yield
|
|
175
|
+
let value = yield threadUtils.checkCacheForDynamicVariable(queryId, name);
|
|
183
176
|
if (!value) {
|
|
184
177
|
value = this.queryResponse[queryId]
|
|
185
178
|
? this.queryResponse[queryId]
|
|
186
179
|
: yield this.runAnotherQuery(queryId, parameters);
|
|
187
180
|
// store incase this query is to be called again
|
|
188
181
|
this.queryResponse[queryId] = value;
|
|
189
|
-
yield
|
|
182
|
+
yield threadUtils.storeDynamicVariable(queryId, name, value);
|
|
190
183
|
}
|
|
191
184
|
else {
|
|
192
185
|
this.cachedVariables.push({ queryId, name });
|
|
@@ -210,7 +203,7 @@ class QueryRunner {
|
|
|
210
203
|
if (!this.noRecursiveQuery) {
|
|
211
204
|
// need to see if this uses any variables
|
|
212
205
|
const stringFields = JSON.stringify(fields);
|
|
213
|
-
const foundVars = dynamicVars.filter(
|
|
206
|
+
const foundVars = dynamicVars.filter(variable => {
|
|
214
207
|
// don't allow a query to use its own dynamic variable (loop)
|
|
215
208
|
if (variable.queryId === this.queryId) {
|
|
216
209
|
return false;
|
|
@@ -219,7 +212,7 @@ class QueryRunner {
|
|
|
219
212
|
const regex = new RegExp(`{{[ ]*${variable.name}[ ]*}}`);
|
|
220
213
|
return regex.test(stringFields);
|
|
221
214
|
});
|
|
222
|
-
const dynamics = foundVars.map(
|
|
215
|
+
const dynamics = foundVars.map(dynVar => this.getDynamicVariable(dynVar));
|
|
223
216
|
const responses = yield Promise.all(dynamics);
|
|
224
217
|
for (let i = 0; i < foundVars.length; i++) {
|
|
225
218
|
const variable = foundVars[i];
|
|
@@ -237,8 +230,8 @@ class QueryRunner {
|
|
|
237
230
|
});
|
|
238
231
|
}
|
|
239
232
|
}
|
|
240
|
-
|
|
241
|
-
doInAppContext(input.appId, () => __awaiter(
|
|
233
|
+
module.exports = (input, callback) => {
|
|
234
|
+
doInAppContext(input.appId, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
242
235
|
const Runner = new QueryRunner(input);
|
|
243
236
|
try {
|
|
244
237
|
const response = yield Runner.execute();
|
|
@@ -248,5 +241,4 @@ function execute(input, callback) {
|
|
|
248
241
|
callback(err);
|
|
249
242
|
}
|
|
250
243
|
}));
|
|
251
|
-
}
|
|
252
|
-
exports.execute = execute;
|
|
244
|
+
};
|
package/dist/threads/utils.js
CHANGED
|
@@ -8,8 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.hasExtraData = exports.formatResponse = exports.storeDynamicVariable = exports.invalidateDynamicVariables = exports.checkCacheForDynamicVariable = exports.threadSetup = void 0;
|
|
13
11
|
const env = require("../environment");
|
|
14
12
|
const db = require("../db");
|
|
15
13
|
const redis = require("@budibase/backend-core/redis");
|
|
@@ -25,14 +23,10 @@ function getClient() {
|
|
|
25
23
|
});
|
|
26
24
|
}
|
|
27
25
|
process.on("exit", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
-
if (client)
|
|
26
|
+
if (client)
|
|
29
27
|
yield client.finish();
|
|
30
|
-
}
|
|
31
28
|
}));
|
|
32
|
-
|
|
33
|
-
return `${queryId}${SEPARATOR}${variable}`;
|
|
34
|
-
}
|
|
35
|
-
function threadSetup() {
|
|
29
|
+
exports.threadSetup = () => {
|
|
36
30
|
// don't run this if not threading
|
|
37
31
|
if (env.isTest() || env.DISABLE_THREADING) {
|
|
38
32
|
return;
|
|
@@ -40,34 +34,27 @@ function threadSetup() {
|
|
|
40
34
|
// when thread starts, make sure it is recorded
|
|
41
35
|
env.setInThread();
|
|
42
36
|
db.init();
|
|
37
|
+
};
|
|
38
|
+
function makeVariableKey(queryId, variable) {
|
|
39
|
+
return `${queryId}${SEPARATOR}${variable}`;
|
|
43
40
|
}
|
|
44
|
-
exports.
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
exports.invalidateDynamicVariables = invalidateDynamicVariables;
|
|
63
|
-
function storeDynamicVariable(queryId, variable, value) {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
const cache = yield getClient();
|
|
66
|
-
yield cache.store(makeVariableKey(queryId, variable), value, VARIABLE_TTL_SECONDS);
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
exports.storeDynamicVariable = storeDynamicVariable;
|
|
70
|
-
function formatResponse(resp) {
|
|
41
|
+
exports.checkCacheForDynamicVariable = (queryId, variable) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
const cache = yield getClient();
|
|
43
|
+
return cache.get(makeVariableKey(queryId, variable));
|
|
44
|
+
});
|
|
45
|
+
exports.invalidateDynamicVariables = (cachedVars) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
const cache = yield getClient();
|
|
47
|
+
let promises = [];
|
|
48
|
+
for (let variable of cachedVars) {
|
|
49
|
+
promises.push(cache.delete(makeVariableKey(variable.queryId, variable.name)));
|
|
50
|
+
}
|
|
51
|
+
yield Promise.all(promises);
|
|
52
|
+
});
|
|
53
|
+
exports.storeDynamicVariable = (queryId, variable, value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
const cache = yield getClient();
|
|
55
|
+
yield cache.store(makeVariableKey(queryId, variable), value, VARIABLE_TTL_SECONDS);
|
|
56
|
+
});
|
|
57
|
+
exports.formatResponse = resp => {
|
|
71
58
|
if (typeof resp === "string") {
|
|
72
59
|
try {
|
|
73
60
|
resp = JSON.parse(resp);
|
|
@@ -77,21 +64,11 @@ function formatResponse(resp) {
|
|
|
77
64
|
}
|
|
78
65
|
}
|
|
79
66
|
return resp;
|
|
80
|
-
}
|
|
81
|
-
exports.
|
|
82
|
-
function hasExtraData(response) {
|
|
67
|
+
};
|
|
68
|
+
exports.hasExtraData = response => {
|
|
83
69
|
return (typeof response === "object" &&
|
|
84
70
|
!Array.isArray(response) &&
|
|
85
71
|
response &&
|
|
86
72
|
response.data != null &&
|
|
87
73
|
response.info != null);
|
|
88
|
-
}
|
|
89
|
-
exports.hasExtraData = hasExtraData;
|
|
90
|
-
exports.default = {
|
|
91
|
-
hasExtraData,
|
|
92
|
-
formatResponse,
|
|
93
|
-
storeDynamicVariable,
|
|
94
|
-
invalidateDynamicVariables,
|
|
95
|
-
checkCacheForDynamicVariable,
|
|
96
|
-
threadSetup,
|
|
97
74
|
};
|