@fluidgrids/workflows 2026.1027.1 → 2026.1028.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/README.md +144 -13
- package/dist/activation-BBh1p82z.d.cts +57 -0
- package/dist/activation-DnhG7SmF.d.ts +57 -0
- package/dist/assemble-BLqQ8lSu.d.cts +39 -0
- package/dist/assemble-DWgaXHd-.d.ts +39 -0
- package/dist/chunk-2J6TF7YI.cjs +86 -0
- package/dist/chunk-4LYSEANA.js +199 -0
- package/dist/chunk-623FVQSN.cjs +251 -0
- package/dist/{chunk-W32BSO3M.js → chunk-6FSHT5IL.js} +2 -2
- package/dist/{chunk-E3APHA6O.cjs → chunk-7AAZGVKD.js} +1 -64
- package/dist/chunk-ABFZWYHT.js +612 -0
- package/dist/{chunk-6U446SKY.js → chunk-BD7ZPG53.js} +2 -2
- package/dist/chunk-BO6OVILK.js +79 -0
- package/dist/chunk-C5OLWZ42.js +245 -0
- package/dist/{chunk-OSPTJCDI.cjs → chunk-CPDK3K5N.cjs} +6 -6
- package/dist/chunk-DHTLALBL.cjs +80 -0
- package/dist/chunk-DJYMDLV5.js +227 -0
- package/dist/{chunk-IHKXLG6I.js → chunk-E2VK7J2C.js} +1 -1
- package/dist/{chunk-3M34AUIY.cjs → chunk-FEW3JBYA.cjs} +3 -3
- package/dist/chunk-FMSW2HDF.cjs +267 -0
- package/dist/chunk-FR7KYWRO.cjs +41 -0
- package/dist/{chunk-7YR7DI7B.cjs → chunk-GBQ33SIZ.cjs} +44 -44
- package/dist/{chunk-6AIAC2FP.cjs → chunk-GVTZMA5C.cjs} +4 -4
- package/dist/{chunk-EEAIM35V.js → chunk-HWJZVOG7.js} +64 -23
- package/dist/chunk-I5LR3D2K.js +869 -0
- package/dist/chunk-IISBRUWJ.js +13 -0
- package/dist/chunk-JD2VQIDZ.cjs +15 -0
- package/dist/{chunk-UB2BHU2M.js → chunk-JZ4TOOLN.js} +1 -1
- package/dist/chunk-L24YIZY7.cjs +207 -0
- package/dist/chunk-LNUQE6D6.js +39 -0
- package/dist/chunk-M4BBAERY.cjs +1635 -0
- package/dist/chunk-N23SKIG4.js +73 -0
- package/dist/{chunk-TWOYB4Y7.cjs → chunk-NEIUQASE.cjs} +13 -13
- package/dist/chunk-P6TA5EZT.cjs +634 -0
- package/dist/chunk-PMCM2OH4.js +46 -0
- package/dist/chunk-PZCVF76Q.cjs +868 -0
- package/dist/{chunk-6BEW4QD6.js → chunk-QAN5MZEM.js} +1 -1
- package/dist/{chunk-CSYBNN3V.cjs → chunk-QKZL3ONM.cjs} +2 -2
- package/dist/chunk-QQ6ULXHI.cjs +885 -0
- package/dist/chunk-SAENRNBJ.cjs +52 -0
- package/dist/{chunk-TQF7MYEN.cjs → chunk-SAOBPYYJ.cjs} +134 -96
- package/dist/{chunk-XBIID5DY.js → chunk-SMCANK3F.js} +5 -4
- package/dist/{chunk-UWQWD7BP.cjs → chunk-SX2PNKKT.cjs} +18 -17
- package/dist/{chunk-UJNHTS6D.js → chunk-TBDXTV22.cjs} +8 -45
- package/dist/chunk-UK3WM7YZ.cjs +75 -0
- package/dist/chunk-VOKMAAJP.js +848 -0
- package/dist/chunk-VRHHBPT6.js +1622 -0
- package/dist/{chunk-5AW745OG.js → chunk-XHXIDVEC.js} +1 -1
- package/dist/chunk-XKJA7KX3.js +72 -0
- package/dist/chunk-Z2Y65YOY.cjs +7 -0
- package/dist/codegen/index.cjs +9 -7
- package/dist/codegen/index.d.cts +2 -2
- package/dist/codegen/index.d.ts +2 -2
- package/dist/codegen/index.js +6 -5
- package/dist/file-BOoHZgoQ.d.cts +1557 -0
- package/dist/file-yuPCFU5b.d.ts +1557 -0
- package/dist/history/index.cjs +287 -0
- package/dist/history/index.d.cts +157 -0
- package/dist/history/index.d.ts +157 -0
- package/dist/history/index.js +5 -0
- package/dist/index.cjs +134 -36
- package/dist/index.d.cts +137 -9
- package/dist/index.d.ts +137 -9
- package/dist/index.js +8 -3
- package/dist/ir/index.cjs +152 -158
- package/dist/ir/index.d.cts +14 -4
- package/dist/ir/index.d.ts +14 -4
- package/dist/ir/index.js +41 -50
- package/dist/lower-BzmUz0sq.d.cts +129 -0
- package/dist/lower-_-iT4HYs.d.ts +129 -0
- package/dist/lower-types-DQNBfWQn.d.cts +37 -0
- package/dist/lower-types-DQNBfWQn.d.ts +37 -0
- package/dist/{manifest-Duf-gHdO.d.cts → manifest-0OLw0i7k.d.cts} +1 -1
- package/dist/{manifest-Bp9ZJlav.d.ts → manifest-C8N6HDYl.d.ts} +1 -1
- package/dist/node-evaluator-4MSDKWOG.cjs +22 -0
- package/dist/node-evaluator-SX4LEYQC.js +12 -0
- package/dist/quickjs/index.cjs +236 -12
- package/dist/quickjs/index.d.cts +46 -5
- package/dist/quickjs/index.d.ts +46 -5
- package/dist/quickjs/index.js +230 -9
- package/dist/roundtrip/index.cjs +333 -131
- package/dist/roundtrip/index.d.cts +39 -7
- package/dist/roundtrip/index.d.ts +39 -7
- package/dist/roundtrip/index.js +185 -13
- package/dist/runtime/index.cjs +90 -0
- package/dist/runtime/index.d.cts +297 -0
- package/dist/runtime/index.d.ts +297 -0
- package/dist/runtime/index.js +8 -0
- package/dist/testing/index.cjs +1057 -0
- package/dist/testing/index.d.cts +305 -0
- package/dist/testing/index.d.ts +305 -0
- package/dist/testing/index.js +1037 -0
- package/dist/{types-Dr2Fn1Ax.d.ts → types-BGoPzgcl.d.cts} +1 -1
- package/dist/{types-Dr2Fn1Ax.d.cts → types-BGoPzgcl.d.ts} +1 -1
- package/dist/types-CpBBjaGX.d.cts +380 -0
- package/dist/types-DV-HX_Gt.d.ts +380 -0
- package/dist/{assemble-CrpUyd_3.d.ts → workflow-Bpr3vnA_.d.ts} +40 -160
- package/dist/workflow-C2a05WUJ.d.ts +444 -0
- package/dist/{assemble-DEf3znGD.d.cts → workflow-FXUkpIBc.d.cts} +40 -160
- package/dist/workflow-J-yYixny.d.cts +444 -0
- package/fixtures/README.md +128 -0
- package/fixtures/histories/activity-failure-fails-run.history.json +163 -0
- package/fixtures/histories/activity-retry-then-success.history.json +147 -0
- package/fixtures/histories/cancel-activity-abandon.history.json +126 -0
- package/fixtures/histories/cancel-activity-compensate.history.json +307 -0
- package/fixtures/histories/cancel-concurrent-non-cancellable.history.json +234 -0
- package/fixtures/histories/cancel-concurrent-scope-timeout.history.json +184 -0
- package/fixtures/histories/cancel-condition-after-cancel.history.json +200 -0
- package/fixtures/histories/cancel-during-timer.history.json +123 -0
- package/fixtures/histories/cancel-saga-compensations.history.json +325 -0
- package/fixtures/histories/cancel-scope-timeout.history.json +148 -0
- package/fixtures/histories/child-abandon-outlives-parent.history.json +191 -0
- package/fixtures/histories/child-cancel-default.history.json +234 -0
- package/fixtures/histories/child-cancel-request.history.json +206 -0
- package/fixtures/histories/child-durable-child-side.history.json +124 -0
- package/fixtures/histories/child-durable-result.history.json +163 -0
- package/fixtures/histories/child-failure-caught.history.json +166 -0
- package/fixtures/histories/child-graph-by-key.history.json +138 -0
- package/fixtures/histories/child-terminated-by-parent-close.history.json +85 -0
- package/fixtures/histories/continue-as-new-first-run.history.json +146 -0
- package/fixtures/histories/continue-as-new-history-limit.history.json +489 -0
- package/fixtures/histories/continue-as-new-last-run.history.json +147 -0
- package/fixtures/histories/continue-as-new-suggested.history.json +352 -0
- package/fixtures/histories/details-and-context.history.json +176 -0
- package/fixtures/histories/deterministic-values.history.json +128 -0
- package/fixtures/histories/engine-builtins.history.json +172 -0
- package/fixtures/histories/gather-activities.history.json +291 -0
- package/fixtures/histories/gather-all-settled.history.json +219 -0
- package/fixtures/histories/gather-mixed.history.json +281 -0
- package/fixtures/histories/input-during-running-task.history.json +111 -0
- package/fixtures/histories/nondeterminism-reordered.history.json +218 -0
- package/fixtures/histories/patched-deprecated.history.json +271 -0
- package/fixtures/histories/patched-new-run.history.json +270 -0
- package/fixtures/histories/patched-old-history.history.json +190 -0
- package/fixtures/histories/race-activity-wins.history.json +152 -0
- package/fixtures/histories/race-signal-beats-child.history.json +161 -0
- package/fixtures/histories/race-timeout-wins.history.json +118 -0
- package/fixtures/histories/side-effect-recorded.history.json +153 -0
- package/fixtures/histories/signal-buffered-at-start.history.json +157 -0
- package/fixtures/histories/signal-default-handler.history.json +187 -0
- package/fixtures/histories/signal-handler.history.json +191 -0
- package/fixtures/histories/signal-parent-child-side.history.json +132 -0
- package/fixtures/histories/signal-parent.history.json +202 -0
- package/fixtures/histories/signal-run-delivered.history.json +128 -0
- package/fixtures/histories/signal-run-undelivered.history.json +134 -0
- package/fixtures/histories/signal-wait.history.json +111 -0
- package/fixtures/histories/task-failure-code-error.history.json +137 -0
- package/fixtures/histories/task-failure-then-transient-attempt.history.json +140 -0
- package/fixtures/histories/timer-condition-met.history.json +201 -0
- package/fixtures/histories/timer-condition-timeout.history.json +118 -0
- package/fixtures/histories/timer-sleep-once.history.json +118 -0
- package/fixtures/histories/timer-sleep-sequence.history.json +210 -0
- package/fixtures/histories/update-accepted-completed.history.json +149 -0
- package/fixtures/histories/update-with-start-rejected-validation.history.json +91 -0
- package/package.json +44 -5
- package/schema/history-file.schema.json +2544 -0
- package/schema/ir-v2.schema.json +16 -0
- package/schema/run-event.schema.json +2374 -0
- package/schema/workflow-command.schema.json +1095 -0
- package/schema/workflow-task.schema.json +3560 -0
- package/dist/chunk-MBBKGD7K.js +0 -440
- package/dist/chunk-Y7NWR3WH.cjs +0 -450
- package/dist/lower-CXggJTIo.d.ts +0 -67
- package/dist/lower-DAzvsJCo.d.cts +0 -67
- package/dist/node-evaluator-CH3XCJND.cjs +0 -17
- package/dist/node-evaluator-TULXA3WE.js +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQQ6ULXHI_cjs = require('./chunk-QQ6ULXHI.cjs');
|
|
4
4
|
|
|
5
5
|
// src/generated/vm-worker-source.ts
|
|
6
6
|
var VM_WORKER_SOURCE = '"use strict";\n\nvar import_node_worker_threads = require("node:worker_threads");\n\nfunction isRecord(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\n\nvar DETERMINISM_VIOLATION = "DeterminismViolation";\nvar DETERMINISM_PRELUDE = `(() => {\n const NAME = ${JSON.stringify(DETERMINISM_VIOLATION)};\n const fail = (what) => {\n const error = new Error(\n what + " is not allowed in workflow code: lowering must give the same IR on every build. Read times and random values at run time instead (for example wf.now)."\n );\n error.name = NAME;\n throw error;\n };\n const lock = (target, key, value) =>\n Object.defineProperty(target, key, { value, writable: false, enumerable: false, configurable: false });\n const RealDate = Date;\n const LockedDate = function Date(...args) {\n if (new.target === undefined) return fail("Date()");\n if (args.length === 0) return fail("new Date()");\n return Reflect.construct(RealDate, args, new.target);\n };\n lock(LockedDate, "prototype", RealDate.prototype);\n lock(RealDate.prototype, "constructor", LockedDate);\n lock(LockedDate, "now", function now() { return fail("Date.now()"); });\n lock(LockedDate, "parse", RealDate.parse);\n lock(LockedDate, "UTC", RealDate.UTC);\n lock(globalThis, "Date", LockedDate);\n lock(Math, "random", function random() { return fail("Math.random()"); });\n const crypto = globalThis.crypto;\n if (crypto !== null && typeof crypto === "object") {\n for (const name of ["getRandomValues", "randomUUID"]) {\n if (typeof crypto[name] === "function") lock(crypto, name, function () { return fail("crypto." + name + "()"); });\n }\n }\n const DateTimeFormat = typeof Intl === "object" && Intl !== null ? Intl.DateTimeFormat : undefined;\n if (typeof DateTimeFormat === "function") {\n const proto = DateTimeFormat.prototype;\n const format = Object.getOwnPropertyDescriptor(proto, "format");\n if (format && typeof format.get === "function") {\n const get = format.get;\n Object.defineProperty(proto, "format", {\n get() {\n const bound = get.call(this);\n return (date) => (date === undefined ? fail("Intl.DateTimeFormat format()") : bound(date));\n },\n enumerable: false,\n configurable: false,\n });\n }\n const formatToParts = proto.formatToParts;\n if (typeof formatToParts === "function") {\n lock(proto, "formatToParts", function (date) {\n return date === undefined ? fail("Intl.DateTimeFormat formatToParts()") : formatToParts.call(this, date);\n });\n }\n }\n})();\n`;\nfunction failure(kind, message) {\n return { ok: false, failure: kind, message };\n}\n\nvar import_node_vm = require("node:vm");\nvar import_node_util = require("node:util");\nvar BUNDLE_GLOBAL = "__fluidgridsBundle";\nfunction wrap(code) {\n return `(function () {\n const describe = (error) => {\n let name = "Error";\n let message = "";\n try {\n if (error !== null && (typeof error === "object" || typeof error === "function")) {\n const n = error.name;\n if (typeof n === "string") name = n;\n const m = error.message;\n message = typeof m === "string" ? m : m === undefined ? "" + error : "" + m;\n } else {\n message = "" + error;\n }\n } catch (_) {\n message = "a value whose message cannot be read was thrown";\n }\n return (name === ${JSON.stringify(DETERMINISM_VIOLATION)} ? "D" : "E") + message;\n };\n try {\n${code}\n;const __fluidgridsValue = ${BUNDLE_GLOBAL}.__fluidgrids;\n return typeof __fluidgridsValue === "string" ? "R" + __fluidgridsValue : "N";\n } catch (error) {\n try {\n return describe(error);\n } catch (_) {\n return "Ean error that cannot be described was thrown";\n }\n }\n})()`;\n}\nfunction hostErrorFields(error) {\n if (!import_node_util.types.isNativeError(error)) return {};\n const code = Object.getOwnPropertyDescriptor(error, "code")?.value;\n const message = Object.getOwnPropertyDescriptor(error, "message")?.value;\n return {\n ...typeof code === "string" ? { code } : {},\n ...typeof message === "string" ? { message } : {}\n };\n}\nfunction decode(result) {\n const tag = result.charAt(0);\n const rest = result.slice(1);\n if (tag === "R") return { ok: true, value: rest };\n if (tag === "N")\n return failure("no-collection", "The bundle did not export a workflow collection");\n if (tag === "D") return failure("determinism", rest);\n return failure("error", rest);\n}\nfunction runInVmContext(code, timeoutMs) {\n const context = (0, import_node_vm.createContext)(/* @__PURE__ */ Object.create(null), {\n codeGeneration: { strings: false, wasm: false },\n microtaskMode: "afterEvaluate",\n name: "fluidgrids-workflow-lowering"\n });\n const refuseImport = () => {\n throw new Error("Workflow code may not import modules at run time");\n };\n const deadline = Date.now() + timeoutMs;\n const run = (source, filename) => new import_node_vm.Script(source, { filename, importModuleDynamically: refuseImport }).runInContext(context, {\n timeout: Math.max(1, deadline - Date.now()),\n breakOnSigint: true\n });\n try {\n run(DETERMINISM_PRELUDE, "determinism-prelude.js");\n const result = run(wrap(code), "workflow-bundle.js");\n return typeof result === "string" ? decode(result) : failure("no-collection", "The bundle did not export a workflow collection");\n } catch (error) {\n const fields = hostErrorFields(error);\n if (fields.code === "ERR_SCRIPT_EXECUTION_TIMEOUT" || fields.message !== void 0 && /^Script execution timed out/.test(fields.message)) {\n return failure("timeout", `Evaluating the workflow code timed out after ${timeoutMs} ms`);\n }\n return failure("error", fields.message ?? "The workflow code could not be evaluated");\n }\n}\n\nprocess.on("unhandledRejection", () => void 0);\nvar input = import_node_worker_threads.workerData;\nimport_node_worker_threads.parentPort?.postMessage(\n isRecord(input) && typeof input["code"] === "string" && typeof input["timeoutMs"] === "number" ? runInVmContext(input["code"], input["timeoutMs"]) : failure("crashed", "The evaluation worker received no bundle")\n);\n';
|
|
@@ -13,13 +13,13 @@ function createNodeVmEvaluator(options = {}) {
|
|
|
13
13
|
return {
|
|
14
14
|
format: "iife",
|
|
15
15
|
async evaluate(code) {
|
|
16
|
-
const outcome = await
|
|
16
|
+
const outcome = await chunkQQ6ULXHI_cjs.runIsolateWorker({
|
|
17
17
|
source: VM_WORKER_SOURCE,
|
|
18
18
|
workerData: { code, timeoutMs },
|
|
19
19
|
timeoutMs,
|
|
20
20
|
resourceLimits: { maxOldGenerationSizeMb: Math.max(16, Math.ceil(memoryLimitBytes / MIB)) }
|
|
21
21
|
});
|
|
22
|
-
return
|
|
22
|
+
return chunkQQ6ULXHI_cjs.outcomeToCollection(outcome);
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkFR7KYWRO_cjs = require('./chunk-FR7KYWRO.cjs');
|
|
4
|
+
|
|
5
|
+
// src/durable/definitions.ts
|
|
6
|
+
function checkName(name, what) {
|
|
7
|
+
if (typeof name !== "string" || name === "" || name.startsWith("__"))
|
|
8
|
+
throw new TypeError(`${what} needs a name that does not start with "__"`);
|
|
9
|
+
}
|
|
10
|
+
function defineSignal(name, options = {}) {
|
|
11
|
+
checkName(name, "defineSignal");
|
|
12
|
+
return {
|
|
13
|
+
kind: "signal",
|
|
14
|
+
name,
|
|
15
|
+
...options.description !== void 0 ? { description: options.description } : {},
|
|
16
|
+
...options.schema !== void 0 ? { schema: options.schema } : {}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function defineQuery(name, options = {}) {
|
|
20
|
+
checkName(name, "defineQuery");
|
|
21
|
+
return {
|
|
22
|
+
kind: "query",
|
|
23
|
+
name,
|
|
24
|
+
...options.description !== void 0 ? { description: options.description } : {}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function defineUpdate(name, options = {}) {
|
|
28
|
+
checkName(name, "defineUpdate");
|
|
29
|
+
return {
|
|
30
|
+
kind: "update",
|
|
31
|
+
name,
|
|
32
|
+
...options.description !== void 0 ? { description: options.description } : {}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function signalName(signal) {
|
|
36
|
+
return typeof signal === "string" ? signal : signal.name;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/durable/errors.ts
|
|
40
|
+
var ERROR_TYPE_VALUES = /* @__PURE__ */ new Set([
|
|
41
|
+
"TIMEOUT",
|
|
42
|
+
"TRANSIENT",
|
|
43
|
+
"DEPENDENCY",
|
|
44
|
+
"AUTHORIZATION",
|
|
45
|
+
"VALIDATION",
|
|
46
|
+
"PERMANENT",
|
|
47
|
+
"UNKNOWN"
|
|
48
|
+
]);
|
|
49
|
+
function isErrorType(value) {
|
|
50
|
+
return typeof value === "string" && ERROR_TYPE_VALUES.has(value);
|
|
51
|
+
}
|
|
52
|
+
var WorkflowFailure = class extends Error {
|
|
53
|
+
/** The shared error type the engine classifies this failure as. */
|
|
54
|
+
errorType;
|
|
55
|
+
constructor(message, errorType, options = {}) {
|
|
56
|
+
super(message);
|
|
57
|
+
this.name = "WorkflowFailure";
|
|
58
|
+
this.errorType = errorType;
|
|
59
|
+
if (options.cause !== void 0)
|
|
60
|
+
Object.defineProperty(this, "cause", {
|
|
61
|
+
value: options.cause,
|
|
62
|
+
enumerable: false,
|
|
63
|
+
writable: true,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var ApplicationError = class extends WorkflowFailure {
|
|
69
|
+
type;
|
|
70
|
+
nonRetryable;
|
|
71
|
+
details;
|
|
72
|
+
nextRetryDelayMs;
|
|
73
|
+
category;
|
|
74
|
+
constructor(message, options = {}) {
|
|
75
|
+
super(
|
|
76
|
+
message,
|
|
77
|
+
options.errorType ?? (isErrorType(options.type) ? options.type : "UNKNOWN"),
|
|
78
|
+
options.cause !== void 0 ? { cause: options.cause } : {}
|
|
79
|
+
);
|
|
80
|
+
this.name = "ApplicationError";
|
|
81
|
+
this.type = options.type;
|
|
82
|
+
this.nonRetryable = options.nonRetryable === true;
|
|
83
|
+
this.details = options.details;
|
|
84
|
+
this.nextRetryDelayMs = options.nextRetryDelay;
|
|
85
|
+
this.category = options.category;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var ActivityFailure = class extends WorkflowFailure {
|
|
89
|
+
constructor(message, activityId, nodeType, operation, cause) {
|
|
90
|
+
super(message, cause instanceof WorkflowFailure ? cause.errorType : "UNKNOWN", { cause });
|
|
91
|
+
this.activityId = activityId;
|
|
92
|
+
this.nodeType = nodeType;
|
|
93
|
+
this.operation = operation;
|
|
94
|
+
this.name = "ActivityFailure";
|
|
95
|
+
}
|
|
96
|
+
activityId;
|
|
97
|
+
nodeType;
|
|
98
|
+
operation;
|
|
99
|
+
};
|
|
100
|
+
var ChildRunFailure = class extends WorkflowFailure {
|
|
101
|
+
constructor(message, childId, childRunId, cause) {
|
|
102
|
+
super(message, cause instanceof WorkflowFailure ? cause.errorType : "UNKNOWN", { cause });
|
|
103
|
+
this.childId = childId;
|
|
104
|
+
this.childRunId = childRunId;
|
|
105
|
+
this.name = "ChildRunFailure";
|
|
106
|
+
}
|
|
107
|
+
childId;
|
|
108
|
+
childRunId;
|
|
109
|
+
};
|
|
110
|
+
var TerminatedFailure = class extends WorkflowFailure {
|
|
111
|
+
constructor(message = "Terminated") {
|
|
112
|
+
super(message, "PERMANENT");
|
|
113
|
+
this.name = "TerminatedFailure";
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var ServerFailure = class extends WorkflowFailure {
|
|
117
|
+
constructor(message, nonRetryable = false, errorType = "DEPENDENCY") {
|
|
118
|
+
super(message, errorType);
|
|
119
|
+
this.nonRetryable = nonRetryable;
|
|
120
|
+
this.name = "ServerFailure";
|
|
121
|
+
}
|
|
122
|
+
nonRetryable;
|
|
123
|
+
};
|
|
124
|
+
var CancelledFailure = class extends WorkflowFailure {
|
|
125
|
+
constructor(message = "Cancelled") {
|
|
126
|
+
super(message, "PERMANENT");
|
|
127
|
+
this.name = "CancelledFailure";
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
var TimeoutFailure = class extends WorkflowFailure {
|
|
131
|
+
constructor(message, timeoutType) {
|
|
132
|
+
super(message, "TIMEOUT");
|
|
133
|
+
this.timeoutType = timeoutType;
|
|
134
|
+
this.name = "TimeoutFailure";
|
|
135
|
+
}
|
|
136
|
+
timeoutType;
|
|
137
|
+
};
|
|
138
|
+
var DeterminismViolation = class extends Error {
|
|
139
|
+
constructor(message) {
|
|
140
|
+
super(message);
|
|
141
|
+
this.name = "DeterminismViolation";
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
var HistoryLimitExceeded = class extends Error {
|
|
145
|
+
constructor(message) {
|
|
146
|
+
super(message);
|
|
147
|
+
this.name = "HistoryLimitExceeded";
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var PhaseCFeatureError = class extends Error {
|
|
151
|
+
code = "durable.phaseC";
|
|
152
|
+
constructor(feature) {
|
|
153
|
+
super(
|
|
154
|
+
`${feature} is not available yet (Phase C); durable functions in this release cannot use it`
|
|
155
|
+
);
|
|
156
|
+
this.name = "PhaseCFeatureError";
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
function isCancellation(error) {
|
|
160
|
+
let current = error;
|
|
161
|
+
for (let depth = 0; depth < 16 && current instanceof Error; depth++) {
|
|
162
|
+
if (current instanceof CancelledFailure || current.name === "CancelledFailure") return true;
|
|
163
|
+
if (!(current instanceof ActivityFailure || current instanceof ChildRunFailure)) return false;
|
|
164
|
+
current = current.cause;
|
|
165
|
+
}
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
function isRunFailure(error) {
|
|
169
|
+
return error instanceof WorkflowFailure;
|
|
170
|
+
}
|
|
171
|
+
function stackOf(error) {
|
|
172
|
+
return typeof error.stack === "string" && error.stack !== "" ? error.stack : void 0;
|
|
173
|
+
}
|
|
174
|
+
function errorToFailure(error, source = "sdk-ts", depth = 0) {
|
|
175
|
+
if (!(error instanceof Error)) return { errorType: "UNKNOWN", message: String(error), source };
|
|
176
|
+
const failure = {
|
|
177
|
+
errorType: error instanceof WorkflowFailure ? error.errorType : "UNKNOWN",
|
|
178
|
+
message: error.message,
|
|
179
|
+
type: error instanceof ApplicationError && error.type !== void 0 ? error.type : error.name,
|
|
180
|
+
source
|
|
181
|
+
};
|
|
182
|
+
const stack = stackOf(error);
|
|
183
|
+
if (stack !== void 0) failure.stackTrace = stack;
|
|
184
|
+
if (error instanceof ApplicationError) {
|
|
185
|
+
if (error.nonRetryable) failure.nonRetryable = true;
|
|
186
|
+
if (error.details !== void 0) failure.details = error.details;
|
|
187
|
+
if (error.nextRetryDelayMs !== void 0) failure.nextRetryDelayMs = error.nextRetryDelayMs;
|
|
188
|
+
if (error.category !== void 0) failure.category = error.category;
|
|
189
|
+
}
|
|
190
|
+
if (error instanceof TimeoutFailure) failure.timeoutType = error.timeoutType;
|
|
191
|
+
if (error instanceof ServerFailure && error.nonRetryable) failure.nonRetryable = true;
|
|
192
|
+
const cause = error.cause;
|
|
193
|
+
if (cause !== void 0 && depth < 16) failure.cause = errorToFailure(cause, source, depth + 1);
|
|
194
|
+
return failure;
|
|
195
|
+
}
|
|
196
|
+
function failureToError(failure, depth = 0) {
|
|
197
|
+
const cause = failure.cause && depth < 16 ? failureToError(failure.cause, depth + 1) : void 0;
|
|
198
|
+
let error;
|
|
199
|
+
switch (failure.type) {
|
|
200
|
+
case "CancelledFailure":
|
|
201
|
+
error = new CancelledFailure(failure.message);
|
|
202
|
+
break;
|
|
203
|
+
case "TerminatedFailure":
|
|
204
|
+
error = new TerminatedFailure(failure.message);
|
|
205
|
+
break;
|
|
206
|
+
case "TimeoutFailure":
|
|
207
|
+
error = new TimeoutFailure(failure.message, failure.timeoutType ?? "UNKNOWN");
|
|
208
|
+
break;
|
|
209
|
+
case "ServerFailure":
|
|
210
|
+
error = new ServerFailure(failure.message, failure.nonRetryable === true, failure.errorType);
|
|
211
|
+
break;
|
|
212
|
+
default:
|
|
213
|
+
if (failure.timeoutType !== void 0 && failure.errorType === "TIMEOUT" && !failure.type)
|
|
214
|
+
error = new TimeoutFailure(failure.message, failure.timeoutType);
|
|
215
|
+
else
|
|
216
|
+
error = new ApplicationError(failure.message, {
|
|
217
|
+
errorType: failure.errorType,
|
|
218
|
+
...failure.type !== void 0 ? { type: failure.type } : {},
|
|
219
|
+
...failure.nonRetryable !== void 0 ? { nonRetryable: failure.nonRetryable } : {},
|
|
220
|
+
...failure.details !== void 0 ? { details: failure.details } : {},
|
|
221
|
+
...failure.nextRetryDelayMs !== void 0 ? { nextRetryDelay: failure.nextRetryDelayMs } : {},
|
|
222
|
+
...failure.category !== void 0 ? { category: failure.category } : {},
|
|
223
|
+
...cause !== void 0 ? { cause } : {}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
if (cause !== void 0 && !(error instanceof ApplicationError))
|
|
227
|
+
Object.defineProperty(error, "cause", {
|
|
228
|
+
value: cause,
|
|
229
|
+
enumerable: false,
|
|
230
|
+
writable: true,
|
|
231
|
+
configurable: true
|
|
232
|
+
});
|
|
233
|
+
if (failure.stackTrace !== void 0) error.stack = failure.stackTrace;
|
|
234
|
+
return error;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// src/durable/durations.ts
|
|
238
|
+
function toMs(value, what = "duration") {
|
|
239
|
+
const ms = chunkFR7KYWRO_cjs.durationMs(value, "ms");
|
|
240
|
+
if (ms === void 0) throw new TypeError(`${what} "${String(value)}" is not a duration`);
|
|
241
|
+
return Math.round(ms);
|
|
242
|
+
}
|
|
243
|
+
function optionalMs(value, what) {
|
|
244
|
+
return value === void 0 ? void 0 : toMs(value, what);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
exports.ActivityFailure = ActivityFailure;
|
|
248
|
+
exports.ApplicationError = ApplicationError;
|
|
249
|
+
exports.CancelledFailure = CancelledFailure;
|
|
250
|
+
exports.ChildRunFailure = ChildRunFailure;
|
|
251
|
+
exports.DeterminismViolation = DeterminismViolation;
|
|
252
|
+
exports.HistoryLimitExceeded = HistoryLimitExceeded;
|
|
253
|
+
exports.PhaseCFeatureError = PhaseCFeatureError;
|
|
254
|
+
exports.ServerFailure = ServerFailure;
|
|
255
|
+
exports.TerminatedFailure = TerminatedFailure;
|
|
256
|
+
exports.TimeoutFailure = TimeoutFailure;
|
|
257
|
+
exports.WorkflowFailure = WorkflowFailure;
|
|
258
|
+
exports.defineQuery = defineQuery;
|
|
259
|
+
exports.defineSignal = defineSignal;
|
|
260
|
+
exports.defineUpdate = defineUpdate;
|
|
261
|
+
exports.errorToFailure = errorToFailure;
|
|
262
|
+
exports.failureToError = failureToError;
|
|
263
|
+
exports.isCancellation = isCancellation;
|
|
264
|
+
exports.isRunFailure = isRunFailure;
|
|
265
|
+
exports.optionalMs = optionalMs;
|
|
266
|
+
exports.signalName = signalName;
|
|
267
|
+
exports.toMs = toMs;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/ir/duration.ts
|
|
4
|
+
var SHORT = /^(\d+(?:\.\d+)?)(ms|s|m|h|d|w)$/;
|
|
5
|
+
var ISO = /^P(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/;
|
|
6
|
+
var SECOND_MS = 1e3;
|
|
7
|
+
var MINUTE_MS = 60 * SECOND_MS;
|
|
8
|
+
var HOUR_MS = 60 * MINUTE_MS;
|
|
9
|
+
var DAY_MS = 24 * HOUR_MS;
|
|
10
|
+
var WEEK_MS = 7 * DAY_MS;
|
|
11
|
+
var UNIT_MS = {
|
|
12
|
+
ms: 1,
|
|
13
|
+
s: SECOND_MS,
|
|
14
|
+
m: MINUTE_MS,
|
|
15
|
+
h: HOUR_MS,
|
|
16
|
+
d: DAY_MS,
|
|
17
|
+
w: WEEK_MS
|
|
18
|
+
};
|
|
19
|
+
function durationMs(value, numberUnit) {
|
|
20
|
+
if (typeof value === "number") {
|
|
21
|
+
if (!Number.isFinite(value) || value < 0) return void 0;
|
|
22
|
+
return numberUnit === "s" ? value * 1e3 : value;
|
|
23
|
+
}
|
|
24
|
+
if (typeof value !== "string") return void 0;
|
|
25
|
+
const text = value.trim();
|
|
26
|
+
const short = SHORT.exec(text);
|
|
27
|
+
if (short?.[1] !== void 0 && short[2] !== void 0) {
|
|
28
|
+
const unit = UNIT_MS[short[2]];
|
|
29
|
+
return unit === void 0 ? void 0 : Number(short[1]) * unit;
|
|
30
|
+
}
|
|
31
|
+
const iso = ISO.exec(text);
|
|
32
|
+
if (iso && text !== "P" && text !== "PT") {
|
|
33
|
+
const [, weeks, days, hours, minutes, seconds] = iso;
|
|
34
|
+
const parts = [weeks, days, hours, minutes, seconds];
|
|
35
|
+
if (parts.every((part) => part === void 0)) return void 0;
|
|
36
|
+
return Number(weeks ?? 0) * WEEK_MS + Number(days ?? 0) * DAY_MS + Number(hours ?? 0) * HOUR_MS + Number(minutes ?? 0) * MINUTE_MS + Number(seconds ?? 0) * SECOND_MS;
|
|
37
|
+
}
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.durationMs = durationMs;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkG4UEPUGO_cjs = require('./chunk-G4UEPUGO.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkQKZL3ONM_cjs = require('./chunk-QKZL3ONM.cjs');
|
|
5
|
+
var chunkSAENRNBJ_cjs = require('./chunk-SAENRNBJ.cjs');
|
|
6
6
|
|
|
7
7
|
// src/ir/node-types.ts
|
|
8
8
|
var EXECUTOR_INTERNAL_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -82,18 +82,18 @@ function firstTruthy(...values) {
|
|
|
82
82
|
return void 0;
|
|
83
83
|
}
|
|
84
84
|
function readPosition(value) {
|
|
85
|
-
if (!
|
|
85
|
+
if (!chunkSAENRNBJ_cjs.isRecord(value)) return void 0;
|
|
86
86
|
const { x, y } = value;
|
|
87
87
|
return typeof x === "number" && typeof y === "number" && Number.isFinite(x) && Number.isFinite(y) ? { x, y } : void 0;
|
|
88
88
|
}
|
|
89
89
|
function removeIfEmpty(parent, key) {
|
|
90
90
|
const value = parent[key];
|
|
91
|
-
if (
|
|
91
|
+
if (chunkSAENRNBJ_cjs.isRecord(value) && Object.keys(value).length === 0) delete parent[key];
|
|
92
92
|
}
|
|
93
93
|
function normalizeLabel(node, data) {
|
|
94
94
|
if (node["label"] === void 0 && typeof data["label"] === "string")
|
|
95
95
|
node["label"] = data["label"];
|
|
96
|
-
if (data["label"] !== void 0 &&
|
|
96
|
+
if (data["label"] !== void 0 && chunkSAENRNBJ_cjs.deepEqual(data["label"], node["label"])) delete data["label"];
|
|
97
97
|
}
|
|
98
98
|
function normalizeOperation(node, data) {
|
|
99
99
|
if (!isNonEmptyString(node["operation_name"]) && isNonEmptyString(data["operation_name"])) {
|
|
@@ -104,30 +104,30 @@ function normalizeVersion(node, data, merged) {
|
|
|
104
104
|
if (merged) return;
|
|
105
105
|
const effective = firstTruthy(data["version"], node["version"]);
|
|
106
106
|
if (typeof effective === "string") node["version"] = effective;
|
|
107
|
-
if (data["nodeVersion"] !== void 0 &&
|
|
107
|
+
if (data["nodeVersion"] !== void 0 && chunkSAENRNBJ_cjs.deepEqual(data["nodeVersion"], node["version"])) {
|
|
108
108
|
delete data["nodeVersion"];
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
function normalizeExternalState(node, data) {
|
|
112
|
-
const args =
|
|
113
|
-
const dataArgs =
|
|
112
|
+
const args = chunkSAENRNBJ_cjs.isRecord(node["args"]) ? node["args"] : void 0;
|
|
113
|
+
const dataArgs = chunkSAENRNBJ_cjs.isRecord(data["args"]) ? data["args"] : void 0;
|
|
114
114
|
const effective = firstTruthy(args?.["state"], dataArgs?.["state"]);
|
|
115
115
|
if (effective !== void 0 && args?.["state"] === void 0) {
|
|
116
116
|
const nextArgs = args ?? {};
|
|
117
117
|
nextArgs["state"] = effective;
|
|
118
118
|
node["args"] = nextArgs;
|
|
119
119
|
}
|
|
120
|
-
const rootState =
|
|
121
|
-
if (dataArgs && dataArgs["state"] !== void 0 &&
|
|
120
|
+
const rootState = chunkSAENRNBJ_cjs.isRecord(node["args"]) ? node["args"]["state"] : void 0;
|
|
121
|
+
if (dataArgs && dataArgs["state"] !== void 0 && chunkSAENRNBJ_cjs.deepEqual(dataArgs["state"], rootState)) {
|
|
122
122
|
delete dataArgs["state"];
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
function normalizeMergedState(node, data) {
|
|
126
|
-
const args =
|
|
127
|
-
const dataArgs =
|
|
128
|
-
const config =
|
|
129
|
-
const dataState =
|
|
130
|
-
const rootState =
|
|
126
|
+
const args = chunkSAENRNBJ_cjs.isRecord(node["args"]) ? node["args"] : {};
|
|
127
|
+
const dataArgs = chunkSAENRNBJ_cjs.isRecord(data["args"]) ? data["args"] : void 0;
|
|
128
|
+
const config = chunkSAENRNBJ_cjs.isRecord(node["config"]) ? node["config"] : void 0;
|
|
129
|
+
const dataState = chunkSAENRNBJ_cjs.isRecord(dataArgs?.["state"]) ? dataArgs["state"] : void 0;
|
|
130
|
+
const rootState = chunkSAENRNBJ_cjs.isRecord(args["state"]) ? args["state"] : void 0;
|
|
131
131
|
if (config === void 0 && dataState === void 0) return;
|
|
132
132
|
args["state"] = { ...config, ...dataState, ...rootState };
|
|
133
133
|
node["args"] = args;
|
|
@@ -135,42 +135,42 @@ function normalizeMergedState(node, data) {
|
|
|
135
135
|
if (dataArgs && dataState !== void 0) delete dataArgs["state"];
|
|
136
136
|
}
|
|
137
137
|
function normalizeConnections(node, data) {
|
|
138
|
-
const dataArgs =
|
|
138
|
+
const dataArgs = chunkSAENRNBJ_cjs.isRecord(data["args"]) ? data["args"] : void 0;
|
|
139
139
|
if (!dataArgs) return;
|
|
140
140
|
for (const key of ["connections", "credentials"]) {
|
|
141
|
-
const args =
|
|
141
|
+
const args = chunkSAENRNBJ_cjs.isRecord(node["args"]) ? node["args"] : void 0;
|
|
142
142
|
if (!args?.[key] && dataArgs[key]) {
|
|
143
143
|
const nextArgs = args ?? {};
|
|
144
144
|
nextArgs[key] = dataArgs[key];
|
|
145
145
|
node["args"] = nextArgs;
|
|
146
146
|
}
|
|
147
|
-
const rootValue =
|
|
148
|
-
if (dataArgs[key] !== void 0 &&
|
|
147
|
+
const rootValue = chunkSAENRNBJ_cjs.isRecord(node["args"]) ? node["args"][key] : void 0;
|
|
148
|
+
if (dataArgs[key] !== void 0 && chunkSAENRNBJ_cjs.deepEqual(dataArgs[key], rootValue)) delete dataArgs[key];
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
function normalizeContext(node, data) {
|
|
152
|
-
const dataArgs =
|
|
153
|
-
const args =
|
|
152
|
+
const dataArgs = chunkSAENRNBJ_cjs.isRecord(data["args"]) ? data["args"] : void 0;
|
|
153
|
+
const args = chunkSAENRNBJ_cjs.isRecord(node["args"]) ? node["args"] : void 0;
|
|
154
154
|
if (!dataArgs || dataArgs["context"] === void 0) return;
|
|
155
|
-
if (args &&
|
|
155
|
+
if (args && chunkSAENRNBJ_cjs.deepEqual(dataArgs["context"], args["context"])) delete dataArgs["context"];
|
|
156
156
|
}
|
|
157
157
|
function normalizeErrorConfig(node, data) {
|
|
158
|
-
const dataArgs =
|
|
159
|
-
const dataState =
|
|
158
|
+
const dataArgs = chunkSAENRNBJ_cjs.isRecord(data["args"]) ? data["args"] : void 0;
|
|
159
|
+
const dataState = chunkSAENRNBJ_cjs.isRecord(dataArgs?.["state"]) ? dataArgs["state"] : void 0;
|
|
160
160
|
const effective = node["errorConfig"] ?? data["errorConfig"] ?? dataState?.["errorConfig"];
|
|
161
161
|
if (effective !== void 0 && effective !== null) node["errorConfig"] = effective;
|
|
162
162
|
else if (node["errorConfig"] === null) delete node["errorConfig"];
|
|
163
|
-
if (data["errorConfig"] !== void 0 &&
|
|
163
|
+
if (data["errorConfig"] !== void 0 && chunkSAENRNBJ_cjs.deepEqual(data["errorConfig"], node["errorConfig"])) {
|
|
164
164
|
delete data["errorConfig"];
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
function normalizeExecutionSettings(node, data) {
|
|
168
|
-
const root =
|
|
169
|
-
const mirror =
|
|
168
|
+
const root = chunkSAENRNBJ_cjs.isRecord(node["executionSettings"]) ? node["executionSettings"] : void 0;
|
|
169
|
+
const mirror = chunkSAENRNBJ_cjs.isRecord(data["executionSettings"]) ? data["executionSettings"] : void 0;
|
|
170
170
|
if (!root && !mirror) return;
|
|
171
171
|
const merged = { ...root };
|
|
172
172
|
for (const [key, value] of Object.entries(mirror ?? {}))
|
|
173
|
-
if (!Object.hasOwn(merged, key))
|
|
173
|
+
if (!Object.hasOwn(merged, key)) chunkSAENRNBJ_cjs.setOwn(merged, key, value);
|
|
174
174
|
if (root?.["executeOnce"] === true || mirror?.["executeOnce"] === true)
|
|
175
175
|
merged["executeOnce"] = true;
|
|
176
176
|
if (mirror && Object.hasOwn(mirror, "runOn")) {
|
|
@@ -186,11 +186,11 @@ function normalizeDisabled(node, data) {
|
|
|
186
186
|
delete data["disabled"];
|
|
187
187
|
}
|
|
188
188
|
function normalizeNode(raw) {
|
|
189
|
-
if (!
|
|
190
|
-
const node =
|
|
189
|
+
if (!chunkSAENRNBJ_cjs.isRecord(raw)) return raw;
|
|
190
|
+
const node = chunkSAENRNBJ_cjs.cloneJson(raw);
|
|
191
191
|
const type = typeof node["type"] === "string" ? node["type"] : "";
|
|
192
192
|
const merged = usesMergedParameters(type);
|
|
193
|
-
const data =
|
|
193
|
+
const data = chunkSAENRNBJ_cjs.isRecord(node["data"]) ? node["data"] : {};
|
|
194
194
|
normalizeLabel(node, data);
|
|
195
195
|
normalizeOperation(node, data);
|
|
196
196
|
normalizeVersion(node, data, merged);
|
|
@@ -201,28 +201,28 @@ function normalizeNode(raw) {
|
|
|
201
201
|
normalizeContext(node, data);
|
|
202
202
|
normalizeExecutionSettings(node, data);
|
|
203
203
|
normalizeDisabled(node, data);
|
|
204
|
-
if (
|
|
204
|
+
if (chunkSAENRNBJ_cjs.isRecord(data["args"])) removeIfEmpty(data, "args");
|
|
205
205
|
if (Object.keys(data).length === 0) delete node["data"];
|
|
206
206
|
else node["data"] = data;
|
|
207
207
|
return node;
|
|
208
208
|
}
|
|
209
209
|
function normalizeDefinition(definition) {
|
|
210
|
-
if (!
|
|
211
|
-
const doc =
|
|
210
|
+
if (!chunkSAENRNBJ_cjs.isRecord(definition) || !chunkSAENRNBJ_cjs.isRecord(definition["data"])) return definition;
|
|
211
|
+
const doc = chunkSAENRNBJ_cjs.cloneJson(definition);
|
|
212
212
|
const data = doc["data"];
|
|
213
213
|
const rawNodes = Array.isArray(data["nodes"]) ? data["nodes"] : [];
|
|
214
214
|
const nodes = rawNodes.map(normalizeNode);
|
|
215
215
|
data["nodes"] = nodes;
|
|
216
|
-
const edges = Array.isArray(data["edges"]) ? data["edges"].filter(
|
|
216
|
+
const edges = Array.isArray(data["edges"]) ? data["edges"].filter(chunkSAENRNBJ_cjs.isRecord) : [];
|
|
217
217
|
const ids = nodes.flatMap(
|
|
218
|
-
(node) =>
|
|
218
|
+
(node) => chunkSAENRNBJ_cjs.isRecord(node) && typeof node["id"] === "string" ? [node["id"]] : []
|
|
219
219
|
);
|
|
220
220
|
const missing = nodes.some(
|
|
221
|
-
(node) =>
|
|
221
|
+
(node) => chunkSAENRNBJ_cjs.isRecord(node) && readPosition(node["position"]) === void 0
|
|
222
222
|
);
|
|
223
223
|
if (missing) {
|
|
224
|
-
const meta =
|
|
225
|
-
const metaLayout =
|
|
224
|
+
const meta = chunkSAENRNBJ_cjs.isRecord(doc["meta"]) ? doc["meta"] : void 0;
|
|
225
|
+
const metaLayout = chunkSAENRNBJ_cjs.isRecord(meta?.["layout"]) ? meta["layout"] : void 0;
|
|
226
226
|
const computed = chunkG4UEPUGO_cjs.autoLayout(
|
|
227
227
|
ids,
|
|
228
228
|
edges.flatMap(
|
|
@@ -230,7 +230,7 @@ function normalizeDefinition(definition) {
|
|
|
230
230
|
)
|
|
231
231
|
);
|
|
232
232
|
for (const node of nodes) {
|
|
233
|
-
if (!
|
|
233
|
+
if (!chunkSAENRNBJ_cjs.isRecord(node) || typeof node["id"] !== "string") continue;
|
|
234
234
|
if (readPosition(node["position"]) !== void 0) continue;
|
|
235
235
|
const fromMeta = readPosition(metaLayout?.[node["id"]]);
|
|
236
236
|
const position = fromMeta ?? computed.get(node["id"]);
|
|
@@ -244,22 +244,22 @@ function normalizeDefinition(definition) {
|
|
|
244
244
|
// src/ir/hash.ts
|
|
245
245
|
function hashedProjection(definition) {
|
|
246
246
|
const normalized = normalizeDefinition(definition);
|
|
247
|
-
if (!
|
|
247
|
+
if (!chunkSAENRNBJ_cjs.isRecord(normalized)) return normalized;
|
|
248
248
|
const copy = { ...normalized };
|
|
249
249
|
delete copy["authoring"];
|
|
250
250
|
return copy;
|
|
251
251
|
}
|
|
252
252
|
function irHash(definition) {
|
|
253
|
-
return
|
|
253
|
+
return chunkQKZL3ONM_cjs.sha256Tagged(chunkQKZL3ONM_cjs.canonicalJson(hashedProjection(definition)));
|
|
254
254
|
}
|
|
255
255
|
function sourceHash(files) {
|
|
256
256
|
const entries = [...files].sort(
|
|
257
257
|
(a, b) => a.path === b.path ? a.content < b.content ? -1 : a.content > b.content ? 1 : 0 : a.path < b.path ? -1 : 1
|
|
258
258
|
).map((file) => [file.path, file.content]);
|
|
259
|
-
return
|
|
259
|
+
return chunkQKZL3ONM_cjs.sha256Tagged(chunkQKZL3ONM_cjs.canonicalJson(entries));
|
|
260
260
|
}
|
|
261
261
|
function buildIdOf(bundle) {
|
|
262
|
-
return
|
|
262
|
+
return chunkQKZL3ONM_cjs.sha256Tagged(bundle);
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
exports.CODE_WORKFLOW_NODE_TYPE = CODE_WORKFLOW_NODE_TYPE;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkTBDXTV22_cjs = require('./chunk-TBDXTV22.cjs');
|
|
4
4
|
|
|
5
5
|
// src/builder/refs.ts
|
|
6
6
|
var REF_MODEL = /* @__PURE__ */ Symbol.for("fluidgrids.workflows.ref");
|
|
@@ -101,7 +101,7 @@ function callOnRef(model, args) {
|
|
|
101
101
|
}
|
|
102
102
|
function makeRef(root, path = []) {
|
|
103
103
|
const model = { root, path };
|
|
104
|
-
const render = () =>
|
|
104
|
+
const render = () => chunkTBDXTV22_cjs.formatRefTemplate(model);
|
|
105
105
|
const target = function fluidgridsRef() {
|
|
106
106
|
return void 0;
|
|
107
107
|
};
|
|
@@ -112,7 +112,7 @@ function makeRef(root, path = []) {
|
|
|
112
112
|
if (typeof property === "symbol") return void 0;
|
|
113
113
|
if (property === "then") return void 0;
|
|
114
114
|
if (property === "toJSON" || property === "toString" || property === "valueOf") return render;
|
|
115
|
-
return makeRef(root, [...path,
|
|
115
|
+
return makeRef(root, [...path, chunkTBDXTV22_cjs.segmentFromKey(property)]);
|
|
116
116
|
},
|
|
117
117
|
apply(_target, _thisArg, args) {
|
|
118
118
|
return callOnRef(model, args);
|
|
@@ -162,7 +162,7 @@ function expr(strings, ...values) {
|
|
|
162
162
|
let out = strings[0] ?? "";
|
|
163
163
|
values.forEach((value, index) => {
|
|
164
164
|
const model = refModelOf(value);
|
|
165
|
-
if (model) out +=
|
|
165
|
+
if (model) out += chunkTBDXTV22_cjs.formatRefTemplate(model);
|
|
166
166
|
else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
167
167
|
out += String(value);
|
|
168
168
|
} else {
|