@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.mjs
CHANGED
|
@@ -893,6 +893,12 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
893
893
|
async workAsync() {
|
|
894
894
|
try {
|
|
895
895
|
this.result = await this.result;
|
|
896
|
+
if (typeof this.result === "object" && (this.result.hasOwnProperty("errored") || this.result.hasOwnProperty("failed"))) {
|
|
897
|
+
const result = await this.retryAsync(this.result);
|
|
898
|
+
if (typeof result === "object" && (result.hasOwnProperty("errored") || result.hasOwnProperty("failed"))) {
|
|
899
|
+
this.onError(result.error);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
896
902
|
} catch (e) {
|
|
897
903
|
const result = await this.retryAsync(e);
|
|
898
904
|
if (result === e) {
|
|
@@ -2299,7 +2305,7 @@ var GraphRunner = class extends SignalEmitter {
|
|
|
2299
2305
|
* @edge Empty tasks warns no-op.
|
|
2300
2306
|
*/
|
|
2301
2307
|
addTasks(tasks, context = {}) {
|
|
2302
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
2308
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2303
2309
|
let _tasks = Array.isArray(tasks) ? tasks : [tasks];
|
|
2304
2310
|
if (_tasks.length === 0) {
|
|
2305
2311
|
console.warn("No tasks/routines to add.");
|
|
@@ -2321,12 +2327,13 @@ var GraphRunner = class extends SignalEmitter {
|
|
|
2321
2327
|
});
|
|
2322
2328
|
const isSubMeta = allTasks.some((t) => t.isSubMeta) || !!context.__isSubMeta;
|
|
2323
2329
|
context.__isSubMeta = isSubMeta;
|
|
2324
|
-
const
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2330
|
+
const isNewTrace = !context.__routineExecId && !((_a = context.__metadata) == null ? void 0 : _a.__executionTraceId) && !context.__executionTraceId;
|
|
2331
|
+
const executionTraceId = (_d = (_c = (_b = context.__metadata) == null ? void 0 : _b.__executionTraceId) != null ? _c : context.__executionTraceId) != null ? _d : uuid4();
|
|
2332
|
+
context.__executionTraceId = executionTraceId;
|
|
2333
|
+
const routineExecId = (_e = context.__routineExecId) != null ? _e : uuid4();
|
|
2327
2334
|
context.__routineExecId = routineExecId;
|
|
2335
|
+
const ctx = new GraphContext(context || {});
|
|
2328
2336
|
if (!isSubMeta) {
|
|
2329
|
-
const executionTraceId = (_d = (_c = (_b = context.__metadata) == null ? void 0 : _b.__executionTraceId) != null ? _c : context.__executionTraceId) != null ? _d : uuid4();
|
|
2330
2337
|
const contextData = ctx.export();
|
|
2331
2338
|
if (isNewTrace) {
|
|
2332
2339
|
this.emitMetrics("meta.runner.new_trace", {
|
|
@@ -2334,9 +2341,9 @@ var GraphRunner = class extends SignalEmitter {
|
|
|
2334
2341
|
uuid: executionTraceId,
|
|
2335
2342
|
issuer_type: "service",
|
|
2336
2343
|
// TODO: Add issuer type
|
|
2337
|
-
issuer_id: (
|
|
2344
|
+
issuer_id: (_h = (_g = (_f = context.__metadata) == null ? void 0 : _f.__issuerId) != null ? _g : context.__issuerId) != null ? _h : null,
|
|
2338
2345
|
issued_at: formatTimestamp(Date.now()),
|
|
2339
|
-
intent: (
|
|
2346
|
+
intent: (_k = (_j = (_i = context.__metadata) == null ? void 0 : _i.__intent) != null ? _j : context.__intent) != null ? _k : null,
|
|
2340
2347
|
context: contextData,
|
|
2341
2348
|
is_meta: isMeta
|
|
2342
2349
|
},
|
|
@@ -2353,7 +2360,7 @@ var GraphRunner = class extends SignalEmitter {
|
|
|
2353
2360
|
isMeta,
|
|
2354
2361
|
executionTraceId,
|
|
2355
2362
|
context: isNewTrace ? contextData.id : contextData,
|
|
2356
|
-
previousRoutineExecution: (
|
|
2363
|
+
previousRoutineExecution: (_m = (_l = context.__metadata) == null ? void 0 : _l.__routineExecId) != null ? _m : null,
|
|
2357
2364
|
// TODO: There is a chance this is not added to the database yet...
|
|
2358
2365
|
created: formatTimestamp(Date.now())
|
|
2359
2366
|
},
|