@balena/pinejs 16.1.0-build-joshbwlng-tasks-82a48d2f7c281892020e59c514b2775690dcabed-1 → 16.1.0-build-partial-unique-index-constraints-c664148d85c67b645954adc929c778a7ce81115f-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pinejs-cache.json +1 -1
- package/.versionbot/CHANGELOG.yml +175 -6
- package/CHANGELOG.md +67 -2
- package/out/config-loader/env.d.ts +0 -4
- package/out/config-loader/env.js +1 -5
- package/out/config-loader/env.js.map +1 -1
- package/out/migrator/async.js +5 -4
- package/out/migrator/async.js.map +1 -1
- package/out/migrator/utils.d.ts +4 -4
- package/out/migrator/utils.js +9 -1
- package/out/migrator/utils.js.map +1 -1
- package/out/sbvr-api/sbvr-utils.d.ts +0 -1
- package/out/sbvr-api/sbvr-utils.js +37 -24
- package/out/sbvr-api/sbvr-utils.js.map +1 -1
- package/out/server-glue/module.d.ts +0 -1
- package/out/server-glue/module.js +1 -2
- package/out/server-glue/module.js.map +1 -1
- package/package.json +4 -7
- package/src/config-loader/env.ts +1 -6
- package/src/migrator/async.ts +5 -4
- package/src/migrator/utils.ts +26 -5
- package/src/sbvr-api/sbvr-utils.ts +53 -27
- package/src/server-glue/module.ts +0 -1
- package/out/sbvr-api/tasks.d.ts +0 -44
- package/out/sbvr-api/tasks.js +0 -245
- package/out/sbvr-api/tasks.js.map +0 -1
- package/out/sbvr-api/tasks.sbvr +0 -56
- package/src/sbvr-api/tasks.sbvr +0 -56
- package/src/sbvr-api/tasks.ts +0 -378
package/out/sbvr-api/tasks.js
DELETED
@@ -1,245 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.addTaskHandler = exports.setup = exports.config = exports.taskStatuses = exports.apiRoot = void 0;
|
30
|
-
const ajv_1 = __importDefault(require("ajv"));
|
31
|
-
const cronParser = __importStar(require("cron-parser"));
|
32
|
-
const env_1 = require("../config-loader/env");
|
33
|
-
const errors_1 = require("./errors");
|
34
|
-
const hooks_1 = require("./hooks");
|
35
|
-
const permissions = __importStar(require("./permissions"));
|
36
|
-
const sbvr_utils_1 = require("./sbvr-utils");
|
37
|
-
const module_1 = require("../server-glue/module");
|
38
|
-
exports.apiRoot = 'tasks';
|
39
|
-
const modelText = require(`./${exports.apiRoot}.sbvr`);
|
40
|
-
const handlers = {};
|
41
|
-
exports.taskStatuses = ['pending', 'cancelled', 'success', 'failed'];
|
42
|
-
function parseCron(cron) {
|
43
|
-
return cronParser.parseExpression(cron).next().toDate();
|
44
|
-
}
|
45
|
-
exports.config = {
|
46
|
-
models: [
|
47
|
-
{
|
48
|
-
apiRoot: exports.apiRoot,
|
49
|
-
modelText,
|
50
|
-
customServerCode: exports,
|
51
|
-
migrations: {},
|
52
|
-
},
|
53
|
-
],
|
54
|
-
};
|
55
|
-
const ajv = new ajv_1.default({
|
56
|
-
inlineRefs: false,
|
57
|
-
});
|
58
|
-
const setup = async () => {
|
59
|
-
(0, hooks_1.addPureHook)('POST', exports.apiRoot, 'task', {
|
60
|
-
POSTPARSE: async ({ req, request }) => {
|
61
|
-
request.values.is_created_by__actor =
|
62
|
-
req.user?.actor ?? req.apiKey?.actor;
|
63
|
-
if (request.values.is_created_by__actor == null) {
|
64
|
-
throw new errors_1.BadRequestError('Creating tasks with missing actor on req is not allowed');
|
65
|
-
}
|
66
|
-
request.values.status = 'pending';
|
67
|
-
request.values.attempt_count = 0;
|
68
|
-
request.values.priority ??= 1;
|
69
|
-
request.values.attempt_limit ??= 1;
|
70
|
-
if (request.values.is_scheduled_with__cron_expression != null &&
|
71
|
-
request.values.is_scheduled_to_execute_on__time == null) {
|
72
|
-
try {
|
73
|
-
request.values.is_scheduled_to_execute_on__time = parseCron(request.values.is_scheduled_with__cron_expression).toISOString();
|
74
|
-
}
|
75
|
-
catch (_) {
|
76
|
-
throw new errors_1.BadRequestError(`Invalid cron expression: ${request.values.is_scheduled_with__cron_expression}`);
|
77
|
-
}
|
78
|
-
}
|
79
|
-
if (request.values.is_scheduled_to_execute_on__time != null) {
|
80
|
-
const now = new Date(new Date().getTime() + env_1.tasks.queueIntervalMS);
|
81
|
-
const startTime = new Date(request.values.is_scheduled_to_execute_on__time);
|
82
|
-
if (startTime < now) {
|
83
|
-
throw new errors_1.BadRequestError(`Task scheduled start time must be greater than ${env_1.tasks.queueIntervalMS} milliseconds in the future`);
|
84
|
-
}
|
85
|
-
}
|
86
|
-
const handlerName = request.values.is_executed_by__handler;
|
87
|
-
if (handlerName == null) {
|
88
|
-
throw new errors_1.BadRequestError(`Must specify a task handler to execute`);
|
89
|
-
}
|
90
|
-
const handler = handlers[handlerName];
|
91
|
-
if (handler == null) {
|
92
|
-
throw new errors_1.BadRequestError(`No task handler with name '${handlerName}' registered`);
|
93
|
-
}
|
94
|
-
if (handler.validate != null) {
|
95
|
-
if (!handler.validate(request.values.is_executed_with__parameter_set)) {
|
96
|
-
throw new errors_1.BadRequestError(`Invalid parameter set: ${ajv.errorsText(handler.validate.errors)}`);
|
97
|
-
}
|
98
|
-
}
|
99
|
-
},
|
100
|
-
});
|
101
|
-
if (env_1.tasks.queueConcurrency > 0 && env_1.tasks.queueIntervalMS >= 1000) {
|
102
|
-
watch();
|
103
|
-
}
|
104
|
-
};
|
105
|
-
exports.setup = setup;
|
106
|
-
function addTaskHandler(name, fn, schema) {
|
107
|
-
if (handlers[name] != null) {
|
108
|
-
throw new Error(`Task handler with name '${name}' already registered`);
|
109
|
-
}
|
110
|
-
handlers[name] = {
|
111
|
-
name,
|
112
|
-
fn,
|
113
|
-
validate: schema != null ? ajv.compile(schema) : undefined,
|
114
|
-
};
|
115
|
-
}
|
116
|
-
exports.addTaskHandler = addTaskHandler;
|
117
|
-
function getNextAttemptTime(attempt) {
|
118
|
-
const millisecondsInFuture = Math.ceil(Math.exp(Math.min(10, attempt))) * 1000;
|
119
|
-
return new Date(Date.now() + millisecondsInFuture);
|
120
|
-
}
|
121
|
-
let executing = 0;
|
122
|
-
function watch() {
|
123
|
-
const client = new sbvr_utils_1.PinejsClient({
|
124
|
-
apiPrefix: `/${exports.apiRoot}/`,
|
125
|
-
});
|
126
|
-
setInterval(async () => {
|
127
|
-
if (Object.keys(handlers).length === 0 ||
|
128
|
-
executing >= env_1.tasks.queueConcurrency) {
|
129
|
-
return;
|
130
|
-
}
|
131
|
-
try {
|
132
|
-
await module_1.sbvrUtils.db.transaction(async (tx) => {
|
133
|
-
const names = Object.keys(handlers);
|
134
|
-
const binds = names.map((_, index) => `$${index + 1}`).join(', ');
|
135
|
-
const result = await tx.executeSql(`
|
136
|
-
SELECT
|
137
|
-
t."id",
|
138
|
-
t."is executed by-handler" AS is_executed_by__handler,
|
139
|
-
t."is executed with-parameter set" AS is_executed_with__parameter_set,
|
140
|
-
t."is scheduled with-cron expression" AS is_scheduled_with__cron_expression,
|
141
|
-
t."attempt count" AS attempt_count,
|
142
|
-
t."attempt limit" AS attempt_limit,
|
143
|
-
t."priority" AS priority,
|
144
|
-
t."is created by-actor" AS is_created_by__actor
|
145
|
-
FROM
|
146
|
-
task AS t
|
147
|
-
WHERE
|
148
|
-
t."is executed by-handler" IN (${binds}) AND
|
149
|
-
t."status" = 'pending' AND
|
150
|
-
t."attempt count" <= t."attempt limit" AND
|
151
|
-
(
|
152
|
-
t."is scheduled to execute on-time" IS NULL OR
|
153
|
-
t."is scheduled to execute on-time" <= CURRENT_TIMESTAMP + INTERVAL '${Math.ceil(env_1.tasks.queueIntervalMS / 1000)} second'
|
154
|
-
)
|
155
|
-
ORDER BY
|
156
|
-
t."is scheduled to execute on-time" ASC,
|
157
|
-
t."priority" DESC,
|
158
|
-
t."id" ASC
|
159
|
-
LIMIT 1
|
160
|
-
FOR UPDATE
|
161
|
-
SKIP LOCKED
|
162
|
-
`, names);
|
163
|
-
if (result.rows.length > 0) {
|
164
|
-
executing++;
|
165
|
-
await execute(client, result.rows[0], tx);
|
166
|
-
executing--;
|
167
|
-
}
|
168
|
-
});
|
169
|
-
}
|
170
|
-
catch (err) {
|
171
|
-
console.error('Failed polling for tasks:', err);
|
172
|
-
}
|
173
|
-
}, env_1.tasks.queueIntervalMS);
|
174
|
-
}
|
175
|
-
async function execute(client, task, tx) {
|
176
|
-
try {
|
177
|
-
const handler = handlers[task.is_executed_by__handler];
|
178
|
-
const startedOnTime = new Date();
|
179
|
-
if (handler == null) {
|
180
|
-
await update(client, tx, task, startedOnTime, 'failed', 'Matching task handler not found');
|
181
|
-
return;
|
182
|
-
}
|
183
|
-
if (handler.validate != null &&
|
184
|
-
!handler.validate(task.is_executed_with__parameter_set)) {
|
185
|
-
await update(client, tx, task, startedOnTime, 'failed', `Invalid parameter set: ${ajv.errorsText(handler.validate.errors)}`);
|
186
|
-
return;
|
187
|
-
}
|
188
|
-
const result = await handler.fn({
|
189
|
-
api: new sbvr_utils_1.PinejsClient({
|
190
|
-
passthrough: {
|
191
|
-
tx,
|
192
|
-
},
|
193
|
-
}),
|
194
|
-
params: task.is_executed_with__parameter_set ?? {},
|
195
|
-
tx,
|
196
|
-
});
|
197
|
-
await update(client, tx, task, startedOnTime, result.status, result.error);
|
198
|
-
}
|
199
|
-
catch (err) {
|
200
|
-
console.error('Task execution failed:', err);
|
201
|
-
process.exit(1);
|
202
|
-
}
|
203
|
-
}
|
204
|
-
async function update(client, tx, task, startedOnTime, status, errorMessage) {
|
205
|
-
const attemptCount = task.attempt_count + 1;
|
206
|
-
const body = {
|
207
|
-
started_on__time: startedOnTime,
|
208
|
-
ended_on__time: new Date(),
|
209
|
-
status,
|
210
|
-
attempt_count: attemptCount,
|
211
|
-
...(errorMessage != null && { error_message: errorMessage }),
|
212
|
-
};
|
213
|
-
if (status === 'failed' && attemptCount < task.attempt_limit) {
|
214
|
-
body.status = 'pending';
|
215
|
-
body.is_scheduled_to_execute_on__time = getNextAttemptTime(attemptCount);
|
216
|
-
}
|
217
|
-
await client.patch({
|
218
|
-
resource: 'task',
|
219
|
-
passthrough: {
|
220
|
-
tx,
|
221
|
-
req: permissions.root,
|
222
|
-
},
|
223
|
-
id: task.id,
|
224
|
-
body,
|
225
|
-
});
|
226
|
-
if (['failed', 'success'].includes(body.status) &&
|
227
|
-
task.is_scheduled_with__cron_expression != null) {
|
228
|
-
await client.post({
|
229
|
-
resource: 'task',
|
230
|
-
passthrough: {
|
231
|
-
tx,
|
232
|
-
req: permissions.root,
|
233
|
-
},
|
234
|
-
body: {
|
235
|
-
attempt_limit: task.attempt_limit,
|
236
|
-
is_created_by__actor: task.is_created_by__actor,
|
237
|
-
is_executed_by__handler: task.is_executed_by__handler,
|
238
|
-
is_executed_with__parameter_set: task.is_executed_with__parameter_set,
|
239
|
-
is_scheduled_with__cron_expression: task.is_scheduled_with__cron_expression,
|
240
|
-
priority: task.priority,
|
241
|
-
},
|
242
|
-
});
|
243
|
-
}
|
244
|
-
}
|
245
|
-
//# sourceMappingURL=tasks.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../src/sbvr-api/tasks.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAsB;AAEtB,wDAA0C;AAG1C,8CAAyD;AAEzD,qCAA2C;AAC3C,mCAAsC;AACtC,2DAA6C;AAE7C,6CAA4C;AAC5C,kDAAkD;AAErC,QAAA,OAAO,GAAG,OAAO,CAAC;AAG/B,MAAM,SAAS,GAAW,OAAO,CAAC,KAAK,eAAO,OAAO,CAAC,CAAC;AAEvD,MAAM,QAAQ,GAEV,EAAE,CAAC;AAEM,QAAA,YAAY,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAiD1E,SAAS,SAAS,CAAC,IAAY;IAC9B,OAAO,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC;AACzD,CAAC;AAEY,QAAA,MAAM,GAAG;IACrB,MAAM,EAAE;QACP;YACC,OAAO,EAAP,eAAO;YACP,SAAS;YACT,gBAAgB,EAAE,OAAO;YACzB,UAAU,EAAE,EAAE;SACd;KACoB;CACtB,CAAC;AAKF,MAAM,GAAG,GAAG,IAAI,aAAG,CAAC;IACnB,UAAU,EAAE,KAAK;CACjB,CAAC,CAAC;AAEI,MAAM,KAAK,GAAG,KAAK,IAAI,EAAE;IAC/B,IAAA,mBAAW,EAAC,MAAM,EAAE,eAAO,EAAE,MAAM,EAAE;QACpC,SAAS,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;YAErC,OAAO,CAAC,MAAM,CAAC,oBA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,CAAC,kCAAkC,IAAI,IAAI,EAC9C,CAAC;QACF,MAAM,MAAM,CAAC,IAAI,CAAC;YACjB,QAAQ,EAAE,MAAM;YAChB,WAAW,EAAE;gBACZ,EAAE;gBACF,GAAG,EAAE,WAAW,CAAC,IAAI;aACrB;YACD,IAAI,EAAE;gBACL,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;gBAC/C,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;gBACrD,+BAA+B,EAAE,IAAI,CAAC,+BAA+B;gBACrE,kCAAkC,EACjC,IAAI,CAAC,kCAAkC;gBACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACvB;SACD,CAAC,CAAC;IACJ,CAAC;AACF,CAAC"}
|
package/out/sbvr-api/tasks.sbvr
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
Vocabulary: tasks
|
2
|
-
|
3
|
-
Term: actor
|
4
|
-
Concept Type: Integer (Type)
|
5
|
-
Term: attempt count
|
6
|
-
Concept Type: Integer (Type)
|
7
|
-
Term: attempt limit
|
8
|
-
Concept Type: Integer (Type)
|
9
|
-
Term: cron expression
|
10
|
-
Concept Type: Short Text (Type)
|
11
|
-
Term: error message
|
12
|
-
Concept Type: Short Text (Type)
|
13
|
-
Term: handler
|
14
|
-
Concept Type: Short Text (Type)
|
15
|
-
Term: key
|
16
|
-
Concept Type: Short Text (Type)
|
17
|
-
Term: parameter set
|
18
|
-
Concept Type: JSON (Type)
|
19
|
-
Term: priority
|
20
|
-
Concept Type: Integer (Type)
|
21
|
-
Term: status
|
22
|
-
Concept Type: Short Text (Type)
|
23
|
-
Term: time
|
24
|
-
Concept Type: Date Time (Type)
|
25
|
-
|
26
|
-
Term: task
|
27
|
-
Fact type: task has key
|
28
|
-
Necessity: each task has at most one key
|
29
|
-
Fact type: task is created by actor
|
30
|
-
Necessity: each task is created by exactly one actor
|
31
|
-
Fact type: task is executed by handler
|
32
|
-
Necessity: each task is executed by exactly one handler
|
33
|
-
Fact type: task is executed with parameter set
|
34
|
-
Necessity: each task is executed with at most one parameter set
|
35
|
-
Fact type: task has priority
|
36
|
-
Necessity: each task has exactly one priority
|
37
|
-
Necessity: each task has a priority that is greater than or equal to 0
|
38
|
-
Fact type: task is scheduled with cron expression
|
39
|
-
Necessity: each task is scheduled with at most one cron expression
|
40
|
-
Fact type: task is scheduled to execute on time
|
41
|
-
Necessity: each task is scheduled to execute on at most one time
|
42
|
-
Fact type: task has status
|
43
|
-
Necessity: each task has exactly one status
|
44
|
-
Definition: "pending" or "cancelled" or "success" or "failed"
|
45
|
-
Fact type: task started on time
|
46
|
-
Necessity: each task started on at most one time
|
47
|
-
Fact type: task ended on time
|
48
|
-
Necessity: each task ended on at most one time
|
49
|
-
Fact type: task has error message
|
50
|
-
Necessity: each task has at most one error message
|
51
|
-
Fact type: task has attempt count
|
52
|
-
Necessity: each task has exactly one attempt count
|
53
|
-
Fact type: task has attempt limit
|
54
|
-
Necessity: each task has exactly one attempt limit
|
55
|
-
Necessity: each task has an attempt limit that is greater than or equal to 1
|
56
|
-
|
package/src/sbvr-api/tasks.sbvr
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
Vocabulary: tasks
|
2
|
-
|
3
|
-
Term: actor
|
4
|
-
Concept Type: Integer (Type)
|
5
|
-
Term: attempt count
|
6
|
-
Concept Type: Integer (Type)
|
7
|
-
Term: attempt limit
|
8
|
-
Concept Type: Integer (Type)
|
9
|
-
Term: cron expression
|
10
|
-
Concept Type: Short Text (Type)
|
11
|
-
Term: error message
|
12
|
-
Concept Type: Short Text (Type)
|
13
|
-
Term: handler
|
14
|
-
Concept Type: Short Text (Type)
|
15
|
-
Term: key
|
16
|
-
Concept Type: Short Text (Type)
|
17
|
-
Term: parameter set
|
18
|
-
Concept Type: JSON (Type)
|
19
|
-
Term: priority
|
20
|
-
Concept Type: Integer (Type)
|
21
|
-
Term: status
|
22
|
-
Concept Type: Short Text (Type)
|
23
|
-
Term: time
|
24
|
-
Concept Type: Date Time (Type)
|
25
|
-
|
26
|
-
Term: task
|
27
|
-
Fact type: task has key
|
28
|
-
Necessity: each task has at most one key
|
29
|
-
Fact type: task is created by actor
|
30
|
-
Necessity: each task is created by exactly one actor
|
31
|
-
Fact type: task is executed by handler
|
32
|
-
Necessity: each task is executed by exactly one handler
|
33
|
-
Fact type: task is executed with parameter set
|
34
|
-
Necessity: each task is executed with at most one parameter set
|
35
|
-
Fact type: task has priority
|
36
|
-
Necessity: each task has exactly one priority
|
37
|
-
Necessity: each task has a priority that is greater than or equal to 0
|
38
|
-
Fact type: task is scheduled with cron expression
|
39
|
-
Necessity: each task is scheduled with at most one cron expression
|
40
|
-
Fact type: task is scheduled to execute on time
|
41
|
-
Necessity: each task is scheduled to execute on at most one time
|
42
|
-
Fact type: task has status
|
43
|
-
Necessity: each task has exactly one status
|
44
|
-
Definition: "pending" or "cancelled" or "success" or "failed"
|
45
|
-
Fact type: task started on time
|
46
|
-
Necessity: each task started on at most one time
|
47
|
-
Fact type: task ended on time
|
48
|
-
Necessity: each task ended on at most one time
|
49
|
-
Fact type: task has error message
|
50
|
-
Necessity: each task has at most one error message
|
51
|
-
Fact type: task has attempt count
|
52
|
-
Necessity: each task has exactly one attempt count
|
53
|
-
Fact type: task has attempt limit
|
54
|
-
Necessity: each task has exactly one attempt limit
|
55
|
-
Necessity: each task has an attempt limit that is greater than or equal to 1
|
56
|
-
|