@cadenza.io/core 3.0.6 → 3.0.8
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/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -930,6 +930,12 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
930
930
|
async workAsync() {
|
|
931
931
|
try {
|
|
932
932
|
this.result = await this.result;
|
|
933
|
+
if (typeof this.result === "object" && (this.result.hasOwnProperty("errored") || this.result.hasOwnProperty("failed"))) {
|
|
934
|
+
const result = await this.retryAsync(this.result);
|
|
935
|
+
if (typeof result === "object" && (result.hasOwnProperty("errored") || result.hasOwnProperty("failed"))) {
|
|
936
|
+
this.onError(result.error);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
933
939
|
} catch (e) {
|
|
934
940
|
const result = await this.retryAsync(e);
|
|
935
941
|
if (result === e) {
|
|
@@ -2336,7 +2342,7 @@ var GraphRunner = class extends SignalEmitter {
|
|
|
2336
2342
|
* @edge Empty tasks warns no-op.
|
|
2337
2343
|
*/
|
|
2338
2344
|
addTasks(tasks, context = {}) {
|
|
2339
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
2345
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2340
2346
|
let _tasks = Array.isArray(tasks) ? tasks : [tasks];
|
|
2341
2347
|
if (_tasks.length === 0) {
|
|
2342
2348
|
console.warn("No tasks/routines to add.");
|
|
@@ -2358,12 +2364,13 @@ var GraphRunner = class extends SignalEmitter {
|
|
|
2358
2364
|
});
|
|
2359
2365
|
const isSubMeta = allTasks.some((t) => t.isSubMeta) || !!context.__isSubMeta;
|
|
2360
2366
|
context.__isSubMeta = isSubMeta;
|
|
2361
|
-
const
|
|
2362
|
-
const
|
|
2363
|
-
|
|
2367
|
+
const isNewTrace = !context.__routineExecId && !((_a = context.__metadata) == null ? void 0 : _a.__executionTraceId) && !context.__executionTraceId;
|
|
2368
|
+
const executionTraceId = (_d = (_c = (_b = context.__metadata) == null ? void 0 : _b.__executionTraceId) != null ? _c : context.__executionTraceId) != null ? _d : (0, import_uuid4.v4)();
|
|
2369
|
+
context.__executionTraceId = executionTraceId;
|
|
2370
|
+
const routineExecId = (_e = context.__routineExecId) != null ? _e : (0, import_uuid4.v4)();
|
|
2364
2371
|
context.__routineExecId = routineExecId;
|
|
2372
|
+
const ctx = new GraphContext(context || {});
|
|
2365
2373
|
if (!isSubMeta) {
|
|
2366
|
-
const executionTraceId = (_d = (_c = (_b = context.__metadata) == null ? void 0 : _b.__executionTraceId) != null ? _c : context.__executionTraceId) != null ? _d : (0, import_uuid4.v4)();
|
|
2367
2374
|
const contextData = ctx.export();
|
|
2368
2375
|
if (isNewTrace) {
|
|
2369
2376
|
this.emitMetrics("meta.runner.new_trace", {
|
|
@@ -2371,9 +2378,9 @@ var GraphRunner = class extends SignalEmitter {
|
|
|
2371
2378
|
uuid: executionTraceId,
|
|
2372
2379
|
issuer_type: "service",
|
|
2373
2380
|
// TODO: Add issuer type
|
|
2374
|
-
issuer_id: (
|
|
2381
|
+
issuer_id: (_h = (_g = (_f = context.__metadata) == null ? void 0 : _f.__issuerId) != null ? _g : context.__issuerId) != null ? _h : null,
|
|
2375
2382
|
issued_at: formatTimestamp(Date.now()),
|
|
2376
|
-
intent: (
|
|
2383
|
+
intent: (_k = (_j = (_i = context.__metadata) == null ? void 0 : _i.__intent) != null ? _j : context.__intent) != null ? _k : null,
|
|
2377
2384
|
context: contextData,
|
|
2378
2385
|
is_meta: isMeta
|
|
2379
2386
|
},
|
|
@@ -2390,7 +2397,7 @@ var GraphRunner = class extends SignalEmitter {
|
|
|
2390
2397
|
isMeta,
|
|
2391
2398
|
executionTraceId,
|
|
2392
2399
|
context: isNewTrace ? contextData.id : contextData,
|
|
2393
|
-
previousRoutineExecution: (
|
|
2400
|
+
previousRoutineExecution: (_m = (_l = context.__metadata) == null ? void 0 : _l.__routineExecId) != null ? _m : null,
|
|
2394
2401
|
// TODO: There is a chance this is not added to the database yet...
|
|
2395
2402
|
created: formatTimestamp(Date.now())
|
|
2396
2403
|
},
|