@digipair/skill-temporal 0.132.8 → 0.133.0
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/dist/schema.fr.json +81 -1
- package/dist/schema.json +81 -1
- package/dist/src/lib/activities.d.ts.map +1 -1
- package/dist/src/lib/activities.js +21 -1
- package/dist/src/lib/activities.js.map +1 -1
- package/dist/src/lib/shared.d.ts +2 -0
- package/dist/src/lib/shared.d.ts.map +1 -1
- package/dist/src/lib/shared.js.map +1 -1
- package/dist/src/lib/skill-temporal.d.ts +2 -0
- package/dist/src/lib/skill-temporal.d.ts.map +1 -1
- package/dist/src/lib/skill-temporal.js +39 -7
- package/dist/src/lib/skill-temporal.js.map +1 -1
- package/dist/src/lib/workflows.d.ts +1 -1
- package/dist/src/lib/workflows.d.ts.map +1 -1
- package/dist/src/lib/workflows.js +25 -3
- package/dist/src/lib/workflows.js.map +1 -1
- package/package.json +5 -5
- package/src/lib/activities.ts +23 -1
- package/src/lib/shared.ts +2 -0
- package/src/lib/skill-temporal.ts +47 -7
- package/src/lib/workflows.ts +27 -5
- package/src/schema.fr.json +81 -1
- package/src/schema.json +81 -1
package/dist/schema.fr.json
CHANGED
|
@@ -292,6 +292,40 @@
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
},
|
|
295
|
+
"/cancel": {
|
|
296
|
+
"post": {
|
|
297
|
+
"tags": [
|
|
298
|
+
"service"
|
|
299
|
+
],
|
|
300
|
+
"summary": "Annule un workflow",
|
|
301
|
+
"description": "Annule un workflow",
|
|
302
|
+
"parameters": [
|
|
303
|
+
{
|
|
304
|
+
"name": "id",
|
|
305
|
+
"summary": "Identifiant du workflow",
|
|
306
|
+
"required": true,
|
|
307
|
+
"description": "Identifiant du workflow",
|
|
308
|
+
"schema": {
|
|
309
|
+
"type": "string"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
"x-events": [],
|
|
314
|
+
"responses": {
|
|
315
|
+
"200": {
|
|
316
|
+
"description": "Confirmation de l'annulation du workflow",
|
|
317
|
+
"content": {
|
|
318
|
+
"application/json": {
|
|
319
|
+
"schema": {
|
|
320
|
+
"type": "null",
|
|
321
|
+
"description": "Le workflow a été annulé avec succès"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
},
|
|
295
329
|
"/list": {
|
|
296
330
|
"post": {
|
|
297
331
|
"tags": [
|
|
@@ -327,6 +361,40 @@
|
|
|
327
361
|
}
|
|
328
362
|
}
|
|
329
363
|
}
|
|
364
|
+
},
|
|
365
|
+
"/describe": {
|
|
366
|
+
"post": {
|
|
367
|
+
"tags": [
|
|
368
|
+
"service"
|
|
369
|
+
],
|
|
370
|
+
"summary": "Description du workflow",
|
|
371
|
+
"description": "Retourner la description du workflow",
|
|
372
|
+
"parameters": [
|
|
373
|
+
{
|
|
374
|
+
"name": "id",
|
|
375
|
+
"summary": "Workflow ID",
|
|
376
|
+
"required": true,
|
|
377
|
+
"description": "Workflow ID",
|
|
378
|
+
"schema": {
|
|
379
|
+
"type": "string"
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
"x-events": [],
|
|
384
|
+
"responses": {
|
|
385
|
+
"200": {
|
|
386
|
+
"description": "Description du workflow",
|
|
387
|
+
"content": {
|
|
388
|
+
"application/json": {
|
|
389
|
+
"schema": {
|
|
390
|
+
"type": "object",
|
|
391
|
+
"description": "Descripion du workflow"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
330
398
|
}
|
|
331
399
|
},
|
|
332
400
|
"components": {
|
|
@@ -424,6 +492,18 @@
|
|
|
424
492
|
"schema": {
|
|
425
493
|
"type": "object"
|
|
426
494
|
}
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"name": "cancelSteps",
|
|
498
|
+
"summary": "Étapes de nettoyage après annulation",
|
|
499
|
+
"required": false,
|
|
500
|
+
"description": "Exécute les étapes de nettoyage déclenchées lors de l'annulation",
|
|
501
|
+
"schema": {
|
|
502
|
+
"type": "array",
|
|
503
|
+
"items": {
|
|
504
|
+
"$ref": "https://schemas.digipair.ai/pinsSettings"
|
|
505
|
+
}
|
|
506
|
+
}
|
|
427
507
|
}
|
|
428
508
|
],
|
|
429
509
|
"responses": {
|
|
@@ -440,4 +520,4 @@
|
|
|
440
520
|
}
|
|
441
521
|
}
|
|
442
522
|
}
|
|
443
|
-
}
|
|
523
|
+
}
|
package/dist/schema.json
CHANGED
|
@@ -292,6 +292,40 @@
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
},
|
|
295
|
+
"/cancel": {
|
|
296
|
+
"post": {
|
|
297
|
+
"tags": [
|
|
298
|
+
"service"
|
|
299
|
+
],
|
|
300
|
+
"summary": "Cancel a workflow",
|
|
301
|
+
"description": "Cancel a workflow",
|
|
302
|
+
"parameters": [
|
|
303
|
+
{
|
|
304
|
+
"name": "id",
|
|
305
|
+
"summary": "Workflow ID",
|
|
306
|
+
"required": true,
|
|
307
|
+
"description": "Workflow ID",
|
|
308
|
+
"schema": {
|
|
309
|
+
"type": "string"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
"x-events": [],
|
|
314
|
+
"responses": {
|
|
315
|
+
"200": {
|
|
316
|
+
"description": "Workflow cancellation confirmation",
|
|
317
|
+
"content": {
|
|
318
|
+
"application/json": {
|
|
319
|
+
"schema": {
|
|
320
|
+
"type": "null",
|
|
321
|
+
"description": "Workflow has been successfully canceled"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
},
|
|
295
329
|
"/list": {
|
|
296
330
|
"post": {
|
|
297
331
|
"tags": [
|
|
@@ -327,6 +361,40 @@
|
|
|
327
361
|
}
|
|
328
362
|
}
|
|
329
363
|
}
|
|
364
|
+
},
|
|
365
|
+
"/describe": {
|
|
366
|
+
"post": {
|
|
367
|
+
"tags": [
|
|
368
|
+
"service"
|
|
369
|
+
],
|
|
370
|
+
"summary": "Workflow description",
|
|
371
|
+
"description": "Workflow description",
|
|
372
|
+
"parameters": [
|
|
373
|
+
{
|
|
374
|
+
"name": "id",
|
|
375
|
+
"summary": "Workflow ID",
|
|
376
|
+
"required": true,
|
|
377
|
+
"description": "Workflow ID",
|
|
378
|
+
"schema": {
|
|
379
|
+
"type": "string"
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
"x-events": [],
|
|
384
|
+
"responses": {
|
|
385
|
+
"200": {
|
|
386
|
+
"description": "Workflow description",
|
|
387
|
+
"content": {
|
|
388
|
+
"application/json": {
|
|
389
|
+
"schema": {
|
|
390
|
+
"type": "object",
|
|
391
|
+
"description": "Workflow description"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
330
398
|
}
|
|
331
399
|
},
|
|
332
400
|
"components": {
|
|
@@ -424,6 +492,18 @@
|
|
|
424
492
|
"schema": {
|
|
425
493
|
"type": "object"
|
|
426
494
|
}
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"name": "cancelSteps",
|
|
498
|
+
"summary": "Cleanup steps after cancellation",
|
|
499
|
+
"required": false,
|
|
500
|
+
"description": "Executes the cleanup steps triggered when the workflow is canceled",
|
|
501
|
+
"schema": {
|
|
502
|
+
"type": "array",
|
|
503
|
+
"items": {
|
|
504
|
+
"$ref": "https://schemas.digipair.ai/pinsSettings"
|
|
505
|
+
}
|
|
506
|
+
}
|
|
427
507
|
}
|
|
428
508
|
],
|
|
429
509
|
"responses": {
|
|
@@ -440,4 +520,4 @@
|
|
|
440
520
|
}
|
|
441
521
|
}
|
|
442
522
|
}
|
|
443
|
-
}
|
|
523
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activities.d.ts","sourceRoot":"","sources":["../../../src/lib/activities.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"activities.d.ts","sourceRoot":"","sources":["../../../src/lib/activities.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAG1F,wBAAsB,eAAe,CAAC,EACpC,gBAAgB,EAChB,OAAO,GACR,EAAE;IACD,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,OAAO,EAAE,GAAG,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBlB"}
|
|
@@ -2,7 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executePinsList = executePinsList;
|
|
4
4
|
const engine_1 = require("@digipair/engine");
|
|
5
|
+
const activity_1 = require("@temporalio/activity");
|
|
5
6
|
async function executePinsList({ pinsSettingsList, context, }) {
|
|
6
|
-
|
|
7
|
+
const info = (0, activity_1.activityInfo)();
|
|
8
|
+
const abortSignal = (0, activity_1.cancellationSignal)();
|
|
9
|
+
const abortController = new AbortController();
|
|
10
|
+
const newContext = { ...context, protected: { ...context.protected, signal: abortController.signal } };
|
|
11
|
+
abortSignal.addEventListener('abort', () => {
|
|
12
|
+
abortController.abort();
|
|
13
|
+
});
|
|
14
|
+
const intervalMs = info.heartbeatTimeoutMs
|
|
15
|
+
? Math.floor(info.heartbeatTimeoutMs / 3 / 1000) * 1000
|
|
16
|
+
: 3000;
|
|
17
|
+
const interval = setInterval(() => {
|
|
18
|
+
(0, activity_1.heartbeat)();
|
|
19
|
+
}, intervalMs);
|
|
20
|
+
try {
|
|
21
|
+
return await (0, engine_1.executePinsList)(pinsSettingsList, newContext);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
clearInterval(interval);
|
|
25
|
+
abortController.abort();
|
|
26
|
+
}
|
|
7
27
|
}
|
|
8
28
|
//# sourceMappingURL=activities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activities.js","sourceRoot":"","sources":["../../../src/lib/activities.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"activities.js","sourceRoot":"","sources":["../../../src/lib/activities.ts"],"names":[],"mappings":";;AAGA,0CA6BC;AAhCD,6CAA0F;AAC1F,mDAAmF;AAE5E,KAAK,UAAU,eAAe,CAAC,EACpC,gBAAgB,EAChB,OAAO,GAIR;IACC,MAAM,IAAI,GAAG,IAAA,uBAAY,GAAE,CAAC;IAC5B,MAAM,WAAW,GAAG,IAAA,6BAAkB,GAAE,CAAC;IACzC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC9C,MAAM,UAAU,GAAG,EAAC,GAAG,OAAO,EAAE,SAAS,EAAG,EAAC,GAAG,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,CAAC,MAAM,EAAE,EAAC,CAAA;IAEpG,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;QACzC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,IAAI,CAAC,kBAAkB;QACxC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI;QACvD,CAAC,CAAC,IAAI,CAAC;IACT,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAChC,IAAA,oBAAS,GAAE,CAAC;IACd,CAAC,EAAE,UAAU,CAAC,CAAC;IAEf,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,wBAAqB,EAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IACnE,CAAC;YAAS,CAAC;QACT,aAAa,CAAC,QAAQ,CAAC,CAAC;QACxB,eAAe,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
package/dist/src/lib/shared.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/lib/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/lib/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,GAAG,CAAC;IACb,WAAW,EAAE,YAAY,EAAE,CAAC;IAC5B,YAAY,EAAE,YAAY,EAAE,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,SAAS,iCAAiC,CAAC;AACxD,eAAO,MAAM,SAAS,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/lib/shared.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/lib/shared.ts"],"names":[],"mappings":";;;AAWa,QAAA,SAAS,GAAG,8BAA8B,CAAC;AAC3C,QAAA,SAAS,GAAG,SAAS,CAAC"}
|
|
@@ -3,5 +3,7 @@ export declare const initialize: (adresse: string) => Promise<void>;
|
|
|
3
3
|
export declare const workflow: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
4
4
|
export declare const push: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
5
5
|
export declare const terminate: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
6
|
+
export declare const cancel: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
6
7
|
export declare const list: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
8
|
+
export declare const describe: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
7
9
|
//# sourceMappingURL=skill-temporal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-temporal.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-temporal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"skill-temporal.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-temporal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgLhD,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,kBACc,CAAC;AAEzD,eAAO,MAAM,QAAQ,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBAC9B,CAAC;AAEvD,eAAO,MAAM,IAAI,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBAC9B,CAAC;AAEnD,eAAO,MAAM,SAAS,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBAC9B,CAAC;AAExD,eAAO,MAAM,MAAM,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBAC9B,CAAC;AAErD,eAAO,MAAM,IAAI,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBAC9B,CAAC;AAEnD,eAAO,MAAM,QAAQ,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBAC9B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.list = exports.terminate = exports.push = exports.workflow = exports.initialize = void 0;
|
|
3
|
+
exports.describe = exports.list = exports.cancel = exports.terminate = exports.push = exports.workflow = exports.initialize = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const client_1 = require("@temporalio/client");
|
|
6
6
|
const worker_1 = require("@temporalio/worker");
|
|
@@ -8,9 +8,17 @@ const workflows_js_1 = require("./workflows.js");
|
|
|
8
8
|
const shared_js_1 = require("./shared.js");
|
|
9
9
|
const activities = tslib_1.__importStar(require("./activities.js"));
|
|
10
10
|
class TemporalService {
|
|
11
|
-
async initialize(address = 'localhost:7233') {
|
|
11
|
+
async initialize(address = 'localhost:7233', workerOptions) {
|
|
12
|
+
const DEFAULT_WORKER_OPTIONS = {
|
|
13
|
+
maxConcurrentWorkflowTaskExecutions: 5,
|
|
14
|
+
maxConcurrentActivityTaskExecutions: 3
|
|
15
|
+
};
|
|
16
|
+
const finalWorkerOptions = {
|
|
17
|
+
...DEFAULT_WORKER_OPTIONS,
|
|
18
|
+
...workerOptions,
|
|
19
|
+
};
|
|
12
20
|
await this.startClient(address);
|
|
13
|
-
await this.startWorker(address);
|
|
21
|
+
await this.startWorker(address, finalWorkerOptions);
|
|
14
22
|
}
|
|
15
23
|
async startClient(address) {
|
|
16
24
|
const connection = await client_1.Connection.connect({
|
|
@@ -21,7 +29,7 @@ class TemporalService {
|
|
|
21
29
|
namespace: shared_js_1.namespace,
|
|
22
30
|
});
|
|
23
31
|
}
|
|
24
|
-
async startWorker(address) {
|
|
32
|
+
async startWorker(address, workerOptions) {
|
|
25
33
|
const connection = await worker_1.NativeConnection.connect({
|
|
26
34
|
address,
|
|
27
35
|
});
|
|
@@ -31,6 +39,7 @@ class TemporalService {
|
|
|
31
39
|
workflowsPath: require.resolve('./workflows'),
|
|
32
40
|
activities,
|
|
33
41
|
taskQueue: shared_js_1.taskQueue,
|
|
42
|
+
...workerOptions
|
|
34
43
|
});
|
|
35
44
|
// Start accepting tasks from the Task Queue.
|
|
36
45
|
worker.run();
|
|
@@ -54,7 +63,7 @@ class TemporalService {
|
|
|
54
63
|
return result;
|
|
55
64
|
}
|
|
56
65
|
async workflow(params, _pinsSettingsList, context) {
|
|
57
|
-
const { id, steps, data = {}, options = context.privates.TEMPORAL_OPTIONS ?? {} } = params;
|
|
66
|
+
const { id, steps, data = {}, options = context.privates.TEMPORAL_OPTIONS ?? {}, cancelSteps = [], failureSteps = [] } = params;
|
|
58
67
|
const prefix = context.privates.TEMPORAL_PREFIX ??
|
|
59
68
|
process.env['TEMPORAL_PREFIX'] ??
|
|
60
69
|
`digipair-workflow-${context.request.digipair}-${context.request.reasoning}-`;
|
|
@@ -64,11 +73,12 @@ class TemporalService {
|
|
|
64
73
|
initialInterval: '1 second',
|
|
65
74
|
maximumInterval: '1 minute',
|
|
66
75
|
backoffCoefficient: 2,
|
|
67
|
-
maximumAttempts:
|
|
76
|
+
maximumAttempts: 10,
|
|
68
77
|
nonRetryableErrorTypes: [],
|
|
69
78
|
...(options.retry || {}),
|
|
70
79
|
},
|
|
71
80
|
startToCloseTimeout: '1 minute',
|
|
81
|
+
heartbeatTimeout: '10s',
|
|
72
82
|
...options,
|
|
73
83
|
};
|
|
74
84
|
this.client.start(workflows_js_1.workflow, {
|
|
@@ -78,6 +88,8 @@ class TemporalService {
|
|
|
78
88
|
context: this.removeProtectedRecursively(context),
|
|
79
89
|
data,
|
|
80
90
|
options: workflowOptions,
|
|
91
|
+
cancelSteps,
|
|
92
|
+
failureSteps
|
|
81
93
|
},
|
|
82
94
|
],
|
|
83
95
|
taskQueue: shared_js_1.taskQueue,
|
|
@@ -100,13 +112,21 @@ class TemporalService {
|
|
|
100
112
|
const handle = this.client.getHandle(`${prefix}${id}`);
|
|
101
113
|
await handle.terminate();
|
|
102
114
|
}
|
|
115
|
+
async cancel(params, _pinsSettingsList, context) {
|
|
116
|
+
const { id } = params;
|
|
117
|
+
const prefix = context.privates.TEMPORAL_PREFIX ??
|
|
118
|
+
process.env['TEMPORAL_PREFIX'] ??
|
|
119
|
+
`digipair-workflow-${context.request.digipair}-${context.request.reasoning}-`;
|
|
120
|
+
const handle = this.client.getHandle(`${prefix}${id}`);
|
|
121
|
+
await handle.cancel();
|
|
122
|
+
}
|
|
103
123
|
async list(params, _pinsSettingsList, context) {
|
|
104
124
|
const { query = `ExecutionStatus = "Running"` } = params;
|
|
105
125
|
const prefix = context.privates.TEMPORAL_PREFIX ??
|
|
106
126
|
process.env['TEMPORAL_PREFIX'] ??
|
|
107
127
|
`digipair-workflow-${context.request.digipair}-${context.request.reasoning}-`;
|
|
108
128
|
const workflowIterator = this.client.list({
|
|
109
|
-
query: `
|
|
129
|
+
query: `WorkflowId STARTS_WITH '${prefix}' AND (${query})`
|
|
110
130
|
});
|
|
111
131
|
const workflows = [];
|
|
112
132
|
for await (const workflow of workflowIterator) {
|
|
@@ -114,6 +134,14 @@ class TemporalService {
|
|
|
114
134
|
}
|
|
115
135
|
return workflows;
|
|
116
136
|
}
|
|
137
|
+
async describe(params, _pinsSettingsList, context) {
|
|
138
|
+
const { id } = params;
|
|
139
|
+
const prefix = context.privates.TEMPORAL_PREFIX ??
|
|
140
|
+
process.env['TEMPORAL_PREFIX'] ??
|
|
141
|
+
`digipair-workflow-${context.request.digipair}-${context.request.reasoning}-`;
|
|
142
|
+
const handle = this.client.getHandle(`${prefix}${id}`);
|
|
143
|
+
return await handle.describe();
|
|
144
|
+
}
|
|
117
145
|
}
|
|
118
146
|
let instance;
|
|
119
147
|
const initialize = (adresse) => (instance = new TemporalService()).initialize(adresse);
|
|
@@ -124,6 +152,10 @@ const push = (params, pinsSettingsList, context) => instance.push(params, pinsSe
|
|
|
124
152
|
exports.push = push;
|
|
125
153
|
const terminate = (params, pinsSettingsList, context) => instance.terminate(params, pinsSettingsList, context);
|
|
126
154
|
exports.terminate = terminate;
|
|
155
|
+
const cancel = (params, pinsSettingsList, context) => instance.cancel(params, pinsSettingsList, context);
|
|
156
|
+
exports.cancel = cancel;
|
|
127
157
|
const list = (params, pinsSettingsList, context) => instance.list(params, pinsSettingsList, context);
|
|
128
158
|
exports.list = list;
|
|
159
|
+
const describe = (params, pinsSettingsList, context) => instance.describe(params, pinsSettingsList, context);
|
|
160
|
+
exports.describe = describe;
|
|
129
161
|
//# sourceMappingURL=skill-temporal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-temporal.js","sourceRoot":"","sources":["../../../src/lib/skill-temporal.ts"],"names":[],"mappings":";;;;AAGA,+CAAuF;AACvF,+
|
|
1
|
+
{"version":3,"file":"skill-temporal.js","sourceRoot":"","sources":["../../../src/lib/skill-temporal.ts"],"names":[],"mappings":";;;;AAGA,+CAAuF;AACvF,+CAA6E;AAE7E,iDAAqE;AACrE,2CAAmD;AACnD,oEAA8C;AAE9C,MAAM,eAAe;IAInB,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,gBAAgB,EAAE,aAAsC;QACjF,MAAM,sBAAsB,GAA2B;YACrD,mCAAmC,EAAE,CAAC;YACtC,mCAAmC,EAAE,CAAC;SACvC,CAAC;QACF,MAAM,kBAAkB,GAA2B;YACjD,GAAG,sBAAsB;YACzB,GAAG,aAAa;SACjB,CAAC;QACF,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAChC,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;IACtD,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,OAAe;QACvC,MAAM,UAAU,GAAG,MAAM,mBAAU,CAAC,OAAO,CAAC;YAC1C,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,IAAI,uBA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AE,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAD1C,QAAA,QAAQ,YACkC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { WorkflowArgs } from './shared.js';
|
|
2
2
|
export declare const dataSignal: import("@temporalio/workflow").SignalDefinition<[any], string>;
|
|
3
|
-
export declare function workflow({ steps, context, data, options }: WorkflowArgs): Promise<any>;
|
|
3
|
+
export declare function workflow({ steps, context, data, options, cancelSteps, failureSteps }: WorkflowArgs): Promise<any>;
|
|
4
4
|
//# sourceMappingURL=workflows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../src/lib/workflows.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,eAAO,MAAM,UAAU,gEAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../src/lib/workflows.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,eAAO,MAAM,UAAU,gEAA8B,CAAC;AAuGtD,wBAAsB,QAAQ,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,CA8DvH"}
|
|
@@ -75,6 +75,9 @@ async function executePins(executePinsList, steps, state, settingsOrigin, contex
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
catch (error) {
|
|
78
|
+
if ((0, workflow_1.isCancellation)(error)) {
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
78
81
|
throw new common_1.ApplicationFailure('[SKILL-TEMPORAL] EXECUTEPINS FAILED', null, null, [
|
|
79
82
|
error,
|
|
80
83
|
settings,
|
|
@@ -84,11 +87,14 @@ async function executePins(executePinsList, steps, state, settingsOrigin, contex
|
|
|
84
87
|
}
|
|
85
88
|
return result;
|
|
86
89
|
}
|
|
87
|
-
async function workflow({ steps, context, data, options }) {
|
|
90
|
+
async function workflow({ steps, context, data, options, cancelSteps, failureSteps }) {
|
|
88
91
|
let result;
|
|
89
92
|
context.workflow = { steps: {}, data };
|
|
90
93
|
context.protected = {};
|
|
91
|
-
const { executePinsList } = (0, workflow_1.proxyActivities)(
|
|
94
|
+
const { executePinsList } = (0, workflow_1.proxyActivities)({
|
|
95
|
+
...options,
|
|
96
|
+
cancellationType: workflow_1.ActivityCancellationType.WAIT_CANCELLATION_COMPLETED,
|
|
97
|
+
});
|
|
92
98
|
(0, workflow_1.setHandler)(exports.dataSignal, (data) => {
|
|
93
99
|
context.workflow.data = { ...context.workflow.data, ...data };
|
|
94
100
|
});
|
|
@@ -109,9 +115,25 @@ async function workflow({ steps, context, data, options }) {
|
|
|
109
115
|
if (error === 'DIGIPAIR_CONDITIONS_IF_FALSE') {
|
|
110
116
|
continue;
|
|
111
117
|
}
|
|
112
|
-
|
|
118
|
+
if (error === 'DIGIPAIR_WORKFLOW_STOP') {
|
|
113
119
|
return result;
|
|
114
120
|
}
|
|
121
|
+
if ((0, workflow_1.isCancellation)(error)) {
|
|
122
|
+
await workflow_1.CancellationScope.nonCancellable(async () => {
|
|
123
|
+
await executePinsList({
|
|
124
|
+
pinsSettingsList: cancelSteps,
|
|
125
|
+
context: { ...context },
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
if (!(0, workflow_1.isCancellation)(error)) {
|
|
130
|
+
await workflow_1.CancellationScope.nonCancellable(async () => {
|
|
131
|
+
await executePinsList({
|
|
132
|
+
pinsSettingsList: failureSteps,
|
|
133
|
+
context: { ...context },
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
115
137
|
throw error;
|
|
116
138
|
}
|
|
117
139
|
if (pinsSettings.properties?.['name']) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../../../src/lib/workflows.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../../../src/lib/workflows.ts"],"names":[],"mappings":";;;AAgHA,4BA8DC;;AA9KD,mDAAgK;AAChK,+CAAwD;AACxD,6CAAqE;AACrE,uDAAiC;AAKjC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAa,CAAC;AACtB,QAAA,UAAU,GAAG,IAAA,uBAAY,EAAQ,MAAM,CAAC,CAAC;AAEtD,KAAK,UAAU,WAAW,CACxB,eAAoB,EACpB,KAAqB,EACrB,KAAuB,EACvB,cAA4B,EAC5B,OAAY;IAEZ,MAAM,QAAQ,GAAG,MAAM,IAAA,4BAAmB,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACpE,IAAI,MAAM,GAAG,IAAI,CAAC;IAElB,IAAI,QAAQ,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,EAAW,CAAC;QAE5B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACrE,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7C,MAAM,kBAAkB,GAAG;gBACzB,GAAG,cAAc;gBACjB,UAAU,EAAE,EAAE,GAAG,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;aAC9D,CAAC;YACF,MAAM,WAAW,GAAG;gBAClB,GAAG,OAAO;gBACV,IAAI;gBACJ,KAAK;gBACL,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;aAC1E,CAAC;YACF,MAAM,YAAY,GAAG,MAAM,IAAA,4BAAmB,EAAC,kBAA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,KAAK,KAAK,wBAAwB,EAAE,CAAC;gBACvC,OAAO,MAAM,CAAC;YAChB,CAAC;YACD,IAAI,IAAA,yBAAc,EAAC,KAAK,CAAC,EAAE,CAAC;gBAC1B,MAAM,4BAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,EAAE;oBAChD,MAAM,eAAe,CAAC;wBACpB,gBAAgB,EAAE,WAAW;wBAC7B,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE;qBACxB,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC;YACD,IAAI,CAAC,IAAA,yBAAc,EAAC,KAAK,CAAC,EAAE,CAAC;gBAC3B,MAAM,4BAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,EAAE;oBAChD,MAAM,eAAe,CAAC;wBACpB,gBAAgB,EAAE,YAAY;wBAC9B,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE;qBACxB,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;YACtC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC;QACnE,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digipair/skill-temporal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.133.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"digipair",
|
|
6
6
|
"service",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@temporalio/client": "^1.
|
|
62
|
-
"@temporalio/common": "^1.
|
|
63
|
-
"@temporalio/worker": "^1.
|
|
64
|
-
"@temporalio/workflow": "^1.
|
|
61
|
+
"@temporalio/client": "^1.15.0",
|
|
62
|
+
"@temporalio/common": "^1.15.0",
|
|
63
|
+
"@temporalio/worker": "^1.15.0",
|
|
64
|
+
"@temporalio/workflow": "^1.15.0",
|
|
65
65
|
"feelin": "^4.3.0"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/lib/activities.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { executePinsList as executePinsListEngine, PinsSettings } from '@digipair/engine';
|
|
2
|
+
import { heartbeat, cancellationSignal, activityInfo } from '@temporalio/activity';
|
|
2
3
|
|
|
3
4
|
export async function executePinsList({
|
|
4
5
|
pinsSettingsList,
|
|
@@ -7,5 +8,26 @@ export async function executePinsList({
|
|
|
7
8
|
pinsSettingsList: PinsSettings[];
|
|
8
9
|
context: any;
|
|
9
10
|
}): Promise<string> {
|
|
10
|
-
|
|
11
|
+
const info = activityInfo();
|
|
12
|
+
const abortSignal = cancellationSignal();
|
|
13
|
+
const abortController = new AbortController();
|
|
14
|
+
const newContext = {...context, protected : {...context.protected, signal: abortController.signal }}
|
|
15
|
+
|
|
16
|
+
abortSignal.addEventListener('abort', () => {
|
|
17
|
+
abortController.abort();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const intervalMs = info.heartbeatTimeoutMs
|
|
21
|
+
? Math.floor(info.heartbeatTimeoutMs / 3 / 1000) * 1000
|
|
22
|
+
: 3000;
|
|
23
|
+
const interval = setInterval(() => {
|
|
24
|
+
heartbeat();
|
|
25
|
+
}, intervalMs);
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
return await executePinsListEngine(pinsSettingsList, newContext);
|
|
29
|
+
} finally {
|
|
30
|
+
clearInterval(interval);
|
|
31
|
+
abortController.abort();
|
|
32
|
+
}
|
|
11
33
|
}
|
package/src/lib/shared.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
import { PinsSettings } from '@digipair/engine';
|
|
4
4
|
import { Connection, WorkflowClient, WorkflowExecutionInfo } from '@temporalio/client';
|
|
5
|
-
import { NativeConnection, Worker } from '@temporalio/worker';
|
|
5
|
+
import { NativeConnection, Worker, WorkerOptions } from '@temporalio/worker';
|
|
6
6
|
|
|
7
7
|
import { dataSignal, workflow as workflowJob } from './workflows.js';
|
|
8
8
|
import { namespace, taskQueue } from './shared.js';
|
|
@@ -11,9 +11,18 @@ import * as activities from './activities.js';
|
|
|
11
11
|
class TemporalService {
|
|
12
12
|
private client!: WorkflowClient;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
async initialize(address = 'localhost:7233', workerOptions?: Partial<WorkerOptions>) {
|
|
16
|
+
const DEFAULT_WORKER_OPTIONS: Partial<WorkerOptions> = {
|
|
17
|
+
maxConcurrentWorkflowTaskExecutions: 5,
|
|
18
|
+
maxConcurrentActivityTaskExecutions: 3
|
|
19
|
+
};
|
|
20
|
+
const finalWorkerOptions: Partial<WorkerOptions> = {
|
|
21
|
+
...DEFAULT_WORKER_OPTIONS,
|
|
22
|
+
...workerOptions,
|
|
23
|
+
};
|
|
15
24
|
await this.startClient(address);
|
|
16
|
-
await this.startWorker(address);
|
|
25
|
+
await this.startWorker(address, finalWorkerOptions);
|
|
17
26
|
}
|
|
18
27
|
|
|
19
28
|
private async startClient(address: string) {
|
|
@@ -27,7 +36,7 @@ class TemporalService {
|
|
|
27
36
|
});
|
|
28
37
|
}
|
|
29
38
|
|
|
30
|
-
private async startWorker(address: string) {
|
|
39
|
+
private async startWorker(address: string, workerOptions: Partial<WorkerOptions>) {
|
|
31
40
|
const connection = await NativeConnection.connect({
|
|
32
41
|
address,
|
|
33
42
|
});
|
|
@@ -38,6 +47,7 @@ class TemporalService {
|
|
|
38
47
|
workflowsPath: require.resolve('./workflows'),
|
|
39
48
|
activities,
|
|
40
49
|
taskQueue,
|
|
50
|
+
...workerOptions
|
|
41
51
|
});
|
|
42
52
|
|
|
43
53
|
// Start accepting tasks from the Task Queue.
|
|
@@ -68,7 +78,7 @@ class TemporalService {
|
|
|
68
78
|
}
|
|
69
79
|
|
|
70
80
|
async workflow(params: any, _pinsSettingsList: PinsSettings[], context: any): Promise<any> {
|
|
71
|
-
const { id, steps, data = {}, options = context.privates.TEMPORAL_OPTIONS ?? {} } = params;
|
|
81
|
+
const { id, steps, data = {}, options = context.privates.TEMPORAL_OPTIONS ?? {}, cancelSteps = [], failureSteps = [] } = params;
|
|
72
82
|
const prefix =
|
|
73
83
|
context.privates.TEMPORAL_PREFIX ??
|
|
74
84
|
process.env['TEMPORAL_PREFIX'] ??
|
|
@@ -79,11 +89,12 @@ class TemporalService {
|
|
|
79
89
|
initialInterval: '1 second',
|
|
80
90
|
maximumInterval: '1 minute',
|
|
81
91
|
backoffCoefficient: 2,
|
|
82
|
-
maximumAttempts:
|
|
92
|
+
maximumAttempts: 10,
|
|
83
93
|
nonRetryableErrorTypes: [],
|
|
84
94
|
...(options.retry || {}),
|
|
85
95
|
},
|
|
86
96
|
startToCloseTimeout: '1 minute',
|
|
97
|
+
heartbeatTimeout: '10s',
|
|
87
98
|
...options,
|
|
88
99
|
};
|
|
89
100
|
|
|
@@ -94,6 +105,8 @@ class TemporalService {
|
|
|
94
105
|
context: this.removeProtectedRecursively(context),
|
|
95
106
|
data,
|
|
96
107
|
options: workflowOptions,
|
|
108
|
+
cancelSteps,
|
|
109
|
+
failureSteps
|
|
97
110
|
},
|
|
98
111
|
],
|
|
99
112
|
taskQueue,
|
|
@@ -121,6 +134,16 @@ class TemporalService {
|
|
|
121
134
|
await handle.terminate();
|
|
122
135
|
}
|
|
123
136
|
|
|
137
|
+
async cancel(params: any, _pinsSettingsList: PinsSettings[], context: any): Promise<any> {
|
|
138
|
+
const { id } = params;
|
|
139
|
+
const prefix =
|
|
140
|
+
context.privates.TEMPORAL_PREFIX ??
|
|
141
|
+
process.env['TEMPORAL_PREFIX'] ??
|
|
142
|
+
`digipair-workflow-${context.request.digipair}-${context.request.reasoning}-`;
|
|
143
|
+
const handle = this.client.getHandle(`${prefix}${id}`);
|
|
144
|
+
await handle.cancel();
|
|
145
|
+
}
|
|
146
|
+
|
|
124
147
|
async list(params: any, _pinsSettingsList: PinsSettings[], context: any): Promise<any> {
|
|
125
148
|
const { query = `ExecutionStatus = "Running"` } = params;
|
|
126
149
|
const prefix =
|
|
@@ -129,7 +152,7 @@ class TemporalService {
|
|
|
129
152
|
`digipair-workflow-${context.request.digipair}-${context.request.reasoning}-`;
|
|
130
153
|
|
|
131
154
|
const workflowIterator = this.client.list({
|
|
132
|
-
query: `
|
|
155
|
+
query: `WorkflowId STARTS_WITH '${prefix}' AND (${query})`
|
|
133
156
|
});
|
|
134
157
|
const workflows = [] as WorkflowExecutionInfo[];
|
|
135
158
|
for await (const workflow of workflowIterator) {
|
|
@@ -138,6 +161,17 @@ class TemporalService {
|
|
|
138
161
|
|
|
139
162
|
return workflows;
|
|
140
163
|
}
|
|
164
|
+
|
|
165
|
+
async describe(params: any, _pinsSettingsList: PinsSettings[], context: any): Promise<any> {
|
|
166
|
+
const { id } = params;
|
|
167
|
+
const prefix =
|
|
168
|
+
context.privates.TEMPORAL_PREFIX ??
|
|
169
|
+
process.env['TEMPORAL_PREFIX'] ??
|
|
170
|
+
`digipair-workflow-${context.request.digipair}-${context.request.reasoning}-`;
|
|
171
|
+
const handle = this.client.getHandle(`${prefix}${id}`);
|
|
172
|
+
|
|
173
|
+
return await handle.describe();
|
|
174
|
+
}
|
|
141
175
|
}
|
|
142
176
|
|
|
143
177
|
let instance: TemporalService;
|
|
@@ -154,5 +188,11 @@ export const push = (params: any, pinsSettingsList: PinsSettings[], context: any
|
|
|
154
188
|
export const terminate = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
|
|
155
189
|
instance.terminate(params, pinsSettingsList, context);
|
|
156
190
|
|
|
191
|
+
export const cancel = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
|
|
192
|
+
instance.cancel(params, pinsSettingsList, context);
|
|
193
|
+
|
|
157
194
|
export const list = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
|
|
158
195
|
instance.list(params, pinsSettingsList, context);
|
|
196
|
+
|
|
197
|
+
export const describe = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
|
|
198
|
+
instance.describe(params, pinsSettingsList, context);
|
package/src/lib/workflows.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sleep, proxyActivities, condition, setHandler, defineSignal } from '@temporalio/workflow';
|
|
1
|
+
import { sleep, proxyActivities, condition, setHandler, defineSignal, isCancellation, CancellationScope, ActivityCancellationType } from '@temporalio/workflow';
|
|
2
2
|
import { ApplicationFailure } from '@temporalio/common';
|
|
3
3
|
import { PinsSettings, preparePinsSettings } from '@digipair/engine';
|
|
4
4
|
import * as feelin from 'feelin';
|
|
@@ -96,6 +96,9 @@ async function executePins(
|
|
|
96
96
|
context,
|
|
97
97
|
});
|
|
98
98
|
} catch (error) {
|
|
99
|
+
if (isCancellation(error)) {
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
99
102
|
throw new ApplicationFailure('[SKILL-TEMPORAL] EXECUTEPINS FAILED', null, null, [
|
|
100
103
|
error,
|
|
101
104
|
settings,
|
|
@@ -107,13 +110,16 @@ async function executePins(
|
|
|
107
110
|
return result;
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
export async function workflow({ steps, context, data, options }: WorkflowArgs): Promise<any> {
|
|
113
|
+
export async function workflow({ steps, context, data, options, cancelSteps, failureSteps }: WorkflowArgs): Promise<any> {
|
|
111
114
|
let result: any;
|
|
112
115
|
|
|
113
116
|
context.workflow = { steps: {}, data };
|
|
114
117
|
context.protected = {};
|
|
115
118
|
|
|
116
|
-
const { executePinsList } = proxyActivities<typeof activities>(
|
|
119
|
+
const { executePinsList } = proxyActivities<typeof activities>({
|
|
120
|
+
...options,
|
|
121
|
+
cancellationType: ActivityCancellationType.WAIT_CANCELLATION_COMPLETED,
|
|
122
|
+
});
|
|
117
123
|
setHandler(dataSignal, (data: any) => {
|
|
118
124
|
context.workflow.data = { ...context.workflow.data, ...data };
|
|
119
125
|
});
|
|
@@ -137,10 +143,26 @@ export async function workflow({ steps, context, data, options }: WorkflowArgs):
|
|
|
137
143
|
} catch (error) {
|
|
138
144
|
if (error === 'DIGIPAIR_CONDITIONS_IF_FALSE') {
|
|
139
145
|
continue;
|
|
140
|
-
}
|
|
146
|
+
}
|
|
147
|
+
if (error === 'DIGIPAIR_WORKFLOW_STOP') {
|
|
141
148
|
return result;
|
|
142
149
|
}
|
|
143
|
-
|
|
150
|
+
if (isCancellation(error)) {
|
|
151
|
+
await CancellationScope.nonCancellable(async () => {
|
|
152
|
+
await executePinsList({
|
|
153
|
+
pinsSettingsList: cancelSteps,
|
|
154
|
+
context: { ...context },
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
if (!isCancellation(error)) {
|
|
159
|
+
await CancellationScope.nonCancellable(async () => {
|
|
160
|
+
await executePinsList({
|
|
161
|
+
pinsSettingsList: failureSteps,
|
|
162
|
+
context: { ...context },
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
}
|
|
144
166
|
throw error;
|
|
145
167
|
}
|
|
146
168
|
|
package/src/schema.fr.json
CHANGED
|
@@ -292,6 +292,40 @@
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
},
|
|
295
|
+
"/cancel": {
|
|
296
|
+
"post": {
|
|
297
|
+
"tags": [
|
|
298
|
+
"service"
|
|
299
|
+
],
|
|
300
|
+
"summary": "Annule un workflow",
|
|
301
|
+
"description": "Annule un workflow",
|
|
302
|
+
"parameters": [
|
|
303
|
+
{
|
|
304
|
+
"name": "id",
|
|
305
|
+
"summary": "Identifiant du workflow",
|
|
306
|
+
"required": true,
|
|
307
|
+
"description": "Identifiant du workflow",
|
|
308
|
+
"schema": {
|
|
309
|
+
"type": "string"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
"x-events": [],
|
|
314
|
+
"responses": {
|
|
315
|
+
"200": {
|
|
316
|
+
"description": "Confirmation de l'annulation du workflow",
|
|
317
|
+
"content": {
|
|
318
|
+
"application/json": {
|
|
319
|
+
"schema": {
|
|
320
|
+
"type": "null",
|
|
321
|
+
"description": "Le workflow a été annulé avec succès"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
},
|
|
295
329
|
"/list": {
|
|
296
330
|
"post": {
|
|
297
331
|
"tags": [
|
|
@@ -327,6 +361,40 @@
|
|
|
327
361
|
}
|
|
328
362
|
}
|
|
329
363
|
}
|
|
364
|
+
},
|
|
365
|
+
"/describe": {
|
|
366
|
+
"post": {
|
|
367
|
+
"tags": [
|
|
368
|
+
"service"
|
|
369
|
+
],
|
|
370
|
+
"summary": "Description du workflow",
|
|
371
|
+
"description": "Retourner la description du workflow",
|
|
372
|
+
"parameters": [
|
|
373
|
+
{
|
|
374
|
+
"name": "id",
|
|
375
|
+
"summary": "Workflow ID",
|
|
376
|
+
"required": true,
|
|
377
|
+
"description": "Workflow ID",
|
|
378
|
+
"schema": {
|
|
379
|
+
"type": "string"
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
"x-events": [],
|
|
384
|
+
"responses": {
|
|
385
|
+
"200": {
|
|
386
|
+
"description": "Description du workflow",
|
|
387
|
+
"content": {
|
|
388
|
+
"application/json": {
|
|
389
|
+
"schema": {
|
|
390
|
+
"type": "object",
|
|
391
|
+
"description": "Descripion du workflow"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
330
398
|
}
|
|
331
399
|
},
|
|
332
400
|
"components": {
|
|
@@ -424,6 +492,18 @@
|
|
|
424
492
|
"schema": {
|
|
425
493
|
"type": "object"
|
|
426
494
|
}
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"name": "cancelSteps",
|
|
498
|
+
"summary": "Étapes de nettoyage après annulation",
|
|
499
|
+
"required": false,
|
|
500
|
+
"description": "Exécute les étapes de nettoyage déclenchées lors de l'annulation",
|
|
501
|
+
"schema": {
|
|
502
|
+
"type": "array",
|
|
503
|
+
"items": {
|
|
504
|
+
"$ref": "https://schemas.digipair.ai/pinsSettings"
|
|
505
|
+
}
|
|
506
|
+
}
|
|
427
507
|
}
|
|
428
508
|
],
|
|
429
509
|
"responses": {
|
|
@@ -440,4 +520,4 @@
|
|
|
440
520
|
}
|
|
441
521
|
}
|
|
442
522
|
}
|
|
443
|
-
}
|
|
523
|
+
}
|
package/src/schema.json
CHANGED
|
@@ -292,6 +292,40 @@
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
},
|
|
295
|
+
"/cancel": {
|
|
296
|
+
"post": {
|
|
297
|
+
"tags": [
|
|
298
|
+
"service"
|
|
299
|
+
],
|
|
300
|
+
"summary": "Cancel a workflow",
|
|
301
|
+
"description": "Cancel a workflow",
|
|
302
|
+
"parameters": [
|
|
303
|
+
{
|
|
304
|
+
"name": "id",
|
|
305
|
+
"summary": "Workflow ID",
|
|
306
|
+
"required": true,
|
|
307
|
+
"description": "Workflow ID",
|
|
308
|
+
"schema": {
|
|
309
|
+
"type": "string"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
"x-events": [],
|
|
314
|
+
"responses": {
|
|
315
|
+
"200": {
|
|
316
|
+
"description": "Workflow cancellation confirmation",
|
|
317
|
+
"content": {
|
|
318
|
+
"application/json": {
|
|
319
|
+
"schema": {
|
|
320
|
+
"type": "null",
|
|
321
|
+
"description": "Workflow has been successfully canceled"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
},
|
|
295
329
|
"/list": {
|
|
296
330
|
"post": {
|
|
297
331
|
"tags": [
|
|
@@ -327,6 +361,40 @@
|
|
|
327
361
|
}
|
|
328
362
|
}
|
|
329
363
|
}
|
|
364
|
+
},
|
|
365
|
+
"/describe": {
|
|
366
|
+
"post": {
|
|
367
|
+
"tags": [
|
|
368
|
+
"service"
|
|
369
|
+
],
|
|
370
|
+
"summary": "Workflow description",
|
|
371
|
+
"description": "Workflow description",
|
|
372
|
+
"parameters": [
|
|
373
|
+
{
|
|
374
|
+
"name": "id",
|
|
375
|
+
"summary": "Workflow ID",
|
|
376
|
+
"required": true,
|
|
377
|
+
"description": "Workflow ID",
|
|
378
|
+
"schema": {
|
|
379
|
+
"type": "string"
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
"x-events": [],
|
|
384
|
+
"responses": {
|
|
385
|
+
"200": {
|
|
386
|
+
"description": "Workflow description",
|
|
387
|
+
"content": {
|
|
388
|
+
"application/json": {
|
|
389
|
+
"schema": {
|
|
390
|
+
"type": "object",
|
|
391
|
+
"description": "Workflow description"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
330
398
|
}
|
|
331
399
|
},
|
|
332
400
|
"components": {
|
|
@@ -424,6 +492,18 @@
|
|
|
424
492
|
"schema": {
|
|
425
493
|
"type": "object"
|
|
426
494
|
}
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"name": "cancelSteps",
|
|
498
|
+
"summary": "Cleanup steps after cancellation",
|
|
499
|
+
"required": false,
|
|
500
|
+
"description": "Executes the cleanup steps triggered when the workflow is canceled",
|
|
501
|
+
"schema": {
|
|
502
|
+
"type": "array",
|
|
503
|
+
"items": {
|
|
504
|
+
"$ref": "https://schemas.digipair.ai/pinsSettings"
|
|
505
|
+
}
|
|
506
|
+
}
|
|
427
507
|
}
|
|
428
508
|
],
|
|
429
509
|
"responses": {
|
|
@@ -440,4 +520,4 @@
|
|
|
440
520
|
}
|
|
441
521
|
}
|
|
442
522
|
}
|
|
443
|
-
}
|
|
523
|
+
}
|