@budibase/server 2.6.16 → 2.6.18
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.a40dcadd.js → index.69c5c1ea.js} +227 -227
- package/builder/index.html +1 -1
- package/dist/automations/triggers.js +2 -1
- package/dist/automations/utils.js +22 -17
- package/dist/threads/automation.js +2 -1
- package/dist/threads/index.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/automations/triggers.ts +5 -3
- package/src/automations/utils.ts +23 -16
- package/src/definitions/automations.ts +1 -5
- package/src/threads/automation.ts +11 -6
- package/src/threads/definitions.ts +0 -2
- package/src/threads/index.ts +4 -2
package/builder/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
|
|
10
10
|
rel="stylesheet" />
|
|
11
|
-
<script type="module" crossorigin src="/builder/assets/index.
|
|
11
|
+
<script type="module" crossorigin src="/builder/assets/index.69c5c1ea.js"></script>
|
|
12
12
|
<link rel="stylesheet" href="/builder/assets/index.86c992bf.css">
|
|
13
13
|
</head>
|
|
14
14
|
|
|
@@ -135,7 +135,8 @@ function externalTrigger(automation, params, { getResponses } = {}) {
|
|
|
135
135
|
const data = { automation, event: params };
|
|
136
136
|
if (getResponses) {
|
|
137
137
|
data.event = Object.assign(Object.assign({}, data.event), { appId: backend_core_1.context.getAppId(), automation });
|
|
138
|
-
|
|
138
|
+
const job = { data };
|
|
139
|
+
return utils.processEvent(job);
|
|
139
140
|
}
|
|
140
141
|
else {
|
|
141
142
|
return bullboard_1.automationQueue.add(data, JOB_OPTS);
|
|
@@ -29,28 +29,33 @@ const REBOOT_CRON = "@reboot";
|
|
|
29
29
|
const WH_STEP_ID = triggerInfo_1.definitions.WEBHOOK.stepId;
|
|
30
30
|
const CRON_STEP_ID = triggerInfo_1.definitions.CRON.stepId;
|
|
31
31
|
const Runner = new threads_1.Thread(threads_1.ThreadType.AUTOMATION);
|
|
32
|
-
|
|
33
|
-
return
|
|
34
|
-
|
|
32
|
+
function loggingArgs(job) {
|
|
33
|
+
return {
|
|
34
|
+
jobId: job.id,
|
|
35
|
+
trigger: job.data.automation.definition.trigger.event,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
35
38
|
function processEvent(job) {
|
|
36
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const appId = job.data.event.appId;
|
|
41
|
+
const automationId = job.data.automation._id;
|
|
42
|
+
const task = () => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
// need to actually await these so that an error can be captured properly
|
|
45
|
+
console.log("automation running", loggingArgs(job));
|
|
42
46
|
const runFn = () => Runner.run(job);
|
|
43
|
-
|
|
47
|
+
const result = yield pro_1.quotas.addAutomation(runFn, {
|
|
44
48
|
automationId,
|
|
45
49
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
50
|
+
console.log("automation completed", loggingArgs(job));
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
console.error(`automation was unable to run`, err, loggingArgs(job));
|
|
55
|
+
return { err };
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return yield backend_core_1.context.doInAutomationContext({ appId, automationId, task });
|
|
54
59
|
});
|
|
55
60
|
}
|
|
56
61
|
exports.processEvent = processEvent;
|
|
@@ -76,7 +76,8 @@ function getLoopIterations(loopStep, input) {
|
|
|
76
76
|
*/
|
|
77
77
|
class Orchestrator {
|
|
78
78
|
constructor(job) {
|
|
79
|
-
let automation = job.data.automation
|
|
79
|
+
let automation = job.data.automation;
|
|
80
|
+
let triggerOutput = job.data.event;
|
|
80
81
|
const metadata = triggerOutput.metadata;
|
|
81
82
|
this._chainCount = metadata ? metadata.automationChainCount : 0;
|
|
82
83
|
this._appId = triggerOutput.appId;
|
package/dist/threads/index.js
CHANGED
|
@@ -84,11 +84,11 @@ class Thread {
|
|
|
84
84
|
this.count === 0 ||
|
|
85
85
|
environment_1.default.isInThread());
|
|
86
86
|
}
|
|
87
|
-
run(
|
|
87
|
+
run(job) {
|
|
88
88
|
const timeout = this.timeoutMs;
|
|
89
89
|
return new Promise((resolve, reject) => {
|
|
90
90
|
function fire(worker) {
|
|
91
|
-
worker.execute(
|
|
91
|
+
worker.execute(job, (err, response) => {
|
|
92
92
|
if (err && err.type === "TimeoutError") {
|
|
93
93
|
reject(new Error(`Query response time exceeded ${timeout}ms timeout.`));
|
|
94
94
|
}
|