@fluidgrids/workflows 2026.1027.0 → 2026.1028.1
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 +170 -18
- 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-2DP2Y6EU.cjs +832 -0
- package/dist/chunk-2J6TF7YI.cjs +86 -0
- package/dist/chunk-3FOTFQ3J.js +1622 -0
- package/dist/chunk-4LYSEANA.js +199 -0
- package/dist/{chunk-KUTMY2IO.cjs → chunk-57MSZ24T.cjs} +162 -98
- package/dist/{chunk-BWSLWF2E.js → chunk-5HDSBTBX.js} +99 -32
- package/dist/chunk-623FVQSN.cjs +251 -0
- package/dist/{chunk-4DPEGDPW.js → chunk-6FSHT5IL.js} +4 -4
- package/dist/{chunk-REV7ZOA4.js → chunk-7AAZGVKD.js} +1 -35
- package/dist/chunk-7NQ37GZU.js +73 -0
- package/dist/chunk-ABFZWYHT.js +612 -0
- package/dist/{chunk-SS4LT2IP.js → chunk-BD7ZPG53.js} +5 -10
- package/dist/chunk-BO6OVILK.js +79 -0
- package/dist/chunk-C5OLWZ42.js +245 -0
- package/dist/chunk-CBL5JSCC.cjs +75 -0
- package/dist/{chunk-LSKSBVL4.cjs → chunk-CPDK3K5N.cjs} +6 -6
- package/dist/chunk-CSNWNFKU.cjs +1635 -0
- package/dist/chunk-DJYMDLV5.js +227 -0
- package/dist/{chunk-X4HKU3MX.js → chunk-E2VK7J2C.js} +3 -1
- package/dist/chunk-FMSW2HDF.cjs +267 -0
- package/dist/chunk-FQIHX7YI.cjs +80 -0
- package/dist/chunk-FR7KYWRO.cjs +41 -0
- package/dist/{chunk-AU3YW7FZ.cjs → chunk-GBQ33SIZ.cjs} +46 -51
- package/dist/{chunk-RRQ5HOBF.cjs → chunk-GVTZMA5C.cjs} +4 -4
- package/dist/chunk-H7KEVW2M.js +816 -0
- package/dist/chunk-HR3BN4C4.cjs +27 -0
- package/dist/chunk-IISBRUWJ.js +13 -0
- package/dist/chunk-JD2VQIDZ.cjs +15 -0
- package/dist/{chunk-PL73GJR4.js → chunk-JZ4TOOLN.js} +1 -1
- package/dist/chunk-L24YIZY7.cjs +207 -0
- package/dist/chunk-LNUQE6D6.js +39 -0
- package/dist/{chunk-BYJ7QTLY.cjs → chunk-NEIUQASE.cjs} +13 -13
- package/dist/chunk-P6TA5EZT.cjs +634 -0
- package/dist/chunk-PDHLTDZB.js +72 -0
- package/dist/chunk-PMCM2OH4.js +46 -0
- package/dist/chunk-PZCVF76Q.cjs +868 -0
- package/dist/{chunk-GO34UHSY.js → chunk-QAN5MZEM.js} +3 -3
- package/dist/{chunk-27HASETB.cjs → chunk-QKZL3ONM.cjs} +3 -1
- package/dist/chunk-SAENRNBJ.cjs +52 -0
- package/dist/{chunk-LMX35GNQ.js → chunk-SMCANK3F.js} +5 -4
- package/dist/{chunk-IZQNUNSU.cjs → chunk-SX2PNKKT.cjs} +18 -17
- package/dist/{chunk-LRM6JXJA.cjs → chunk-TBDXTV22.cjs} +0 -37
- package/dist/chunk-VOKMAAJP.js +848 -0
- package/dist/chunk-XB53G2DK.js +25 -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 +161 -165
- package/dist/ir/index.d.cts +32 -12
- package/dist/ir/index.d.ts +32 -12
- package/dist/ir/index.js +54 -61
- package/dist/lower-BuSvAFqi.d.cts +129 -0
- package/dist/lower-C_Qv_34S.d.ts +129 -0
- package/dist/lower-types-nofRXw9c.d.cts +15 -0
- package/dist/lower-types-nofRXw9c.d.ts +15 -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-CJNP4GHX.js +12 -0
- package/dist/node-evaluator-DMKPKUWA.cjs +22 -0
- package/dist/quickjs/index.cjs +256 -78
- package/dist/quickjs/index.d.cts +48 -7
- package/dist/quickjs/index.d.ts +48 -7
- package/dist/quickjs/index.js +254 -79
- package/dist/roundtrip/index.cjs +404 -129
- package/dist/roundtrip/index.d.cts +43 -8
- package/dist/roundtrip/index.d.ts +43 -8
- package/dist/roundtrip/index.js +260 -19
- 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-DMOuaxRI.d.ts → workflow-Bpr3vnA_.d.ts} +60 -162
- package/dist/workflow-C2a05WUJ.d.ts +444 -0
- package/dist/{assemble-BJo9TECS.d.cts → workflow-FXUkpIBc.d.cts} +60 -162
- 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 +85 -20
- 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-265J2FCH.cjs +0 -33
- package/dist/chunk-LUXCXFOE.cjs +0 -269
- package/dist/chunk-S34NJE3A.js +0 -262
- package/dist/chunk-SRQRLWOS.js +0 -31
- package/dist/lower-DcOY8ux0.d.cts +0 -49
- package/dist/lower-Dw5grNrI.d.ts +0 -49
- package/dist/node-evaluator-2GTUZVPK.cjs +0 -17
- package/dist/node-evaluator-RMYEWCXZ.js +0 -8
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// src/history/allowlist.ts
|
|
2
|
+
var ACTIVITY_INTERNAL_ALLOWLIST = /* @__PURE__ */ new Set([
|
|
3
|
+
"internal:http",
|
|
4
|
+
"internal:datatable",
|
|
5
|
+
"internal:set",
|
|
6
|
+
"internal:code"
|
|
7
|
+
]);
|
|
8
|
+
var ACTIVITY_NODE_DENYLIST = /* @__PURE__ */ new Set([
|
|
9
|
+
"internal:end",
|
|
10
|
+
"internal:if",
|
|
11
|
+
"internal:switch",
|
|
12
|
+
"internal:loop",
|
|
13
|
+
"internal:merge",
|
|
14
|
+
"internal:wait",
|
|
15
|
+
"internal:subworkflow",
|
|
16
|
+
"internal:code-workflow",
|
|
17
|
+
"internal:wait-for-signal",
|
|
18
|
+
"internal:send-and-wait",
|
|
19
|
+
"internal:respond-to-webhook",
|
|
20
|
+
"internal:failure-triage"
|
|
21
|
+
]);
|
|
22
|
+
var ACTIVITY_NODE_ALLOWLIST = {
|
|
23
|
+
internal: ACTIVITY_INTERNAL_ALLOWLIST,
|
|
24
|
+
refused: ACTIVITY_NODE_DENYLIST,
|
|
25
|
+
/** Non-built-in node types (store and registry nodes) are allowed. */
|
|
26
|
+
external: "allowed"
|
|
27
|
+
};
|
|
28
|
+
var LEGACY_SHORT_NAMES = /* @__PURE__ */ new Set([
|
|
29
|
+
"if",
|
|
30
|
+
"switch",
|
|
31
|
+
"loop",
|
|
32
|
+
"merge",
|
|
33
|
+
"set",
|
|
34
|
+
"filter",
|
|
35
|
+
"aggregate",
|
|
36
|
+
"wait",
|
|
37
|
+
"noop",
|
|
38
|
+
"code",
|
|
39
|
+
"http",
|
|
40
|
+
"transform",
|
|
41
|
+
"validate",
|
|
42
|
+
"log",
|
|
43
|
+
"error",
|
|
44
|
+
"subworkflow",
|
|
45
|
+
"end",
|
|
46
|
+
"trigger",
|
|
47
|
+
"webhook",
|
|
48
|
+
"schedule",
|
|
49
|
+
"manual",
|
|
50
|
+
"api"
|
|
51
|
+
]);
|
|
52
|
+
function canonicalType(nodeType) {
|
|
53
|
+
const lower = nodeType.trim().toLowerCase();
|
|
54
|
+
return LEGACY_SHORT_NAMES.has(lower) ? `internal:${lower}` : lower;
|
|
55
|
+
}
|
|
56
|
+
function isActivityNodeTypeAllowed(nodeType) {
|
|
57
|
+
if (typeof nodeType !== "string" || nodeType.trim() === "") return false;
|
|
58
|
+
const type = canonicalType(nodeType);
|
|
59
|
+
if (!type.startsWith("internal:")) return true;
|
|
60
|
+
return ACTIVITY_INTERNAL_ALLOWLIST.has(type);
|
|
61
|
+
}
|
|
62
|
+
var ActivityNodeTypeNotAllowedError = class extends Error {
|
|
63
|
+
constructor(nodeType) {
|
|
64
|
+
super(
|
|
65
|
+
`${nodeType} cannot run as a durable activity: only store and registry nodes and internal:http, internal:datatable, internal:set and internal:code can`
|
|
66
|
+
);
|
|
67
|
+
this.nodeType = nodeType;
|
|
68
|
+
this.name = "ActivityNodeTypeNotAllowedError";
|
|
69
|
+
}
|
|
70
|
+
nodeType;
|
|
71
|
+
code = "durable.activityTypeNotAllowed";
|
|
72
|
+
errorType = "VALIDATION";
|
|
73
|
+
nonRetryable = true;
|
|
74
|
+
};
|
|
75
|
+
function assertActivityNodeType(nodeType) {
|
|
76
|
+
if (!isActivityNodeTypeAllowed(nodeType)) throw new ActivityNodeTypeNotAllowedError(nodeType);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { ACTIVITY_INTERNAL_ALLOWLIST, ACTIVITY_NODE_ALLOWLIST, ACTIVITY_NODE_DENYLIST, ActivityNodeTypeNotAllowedError, assertActivityNodeType, isActivityNodeTypeAllowed };
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { durationMs } from './chunk-LNUQE6D6.js';
|
|
2
|
+
|
|
3
|
+
// src/durable/definitions.ts
|
|
4
|
+
function checkName(name, what) {
|
|
5
|
+
if (typeof name !== "string" || name === "" || name.startsWith("__"))
|
|
6
|
+
throw new TypeError(`${what} needs a name that does not start with "__"`);
|
|
7
|
+
}
|
|
8
|
+
function defineSignal(name, options = {}) {
|
|
9
|
+
checkName(name, "defineSignal");
|
|
10
|
+
return {
|
|
11
|
+
kind: "signal",
|
|
12
|
+
name,
|
|
13
|
+
...options.description !== void 0 ? { description: options.description } : {},
|
|
14
|
+
...options.schema !== void 0 ? { schema: options.schema } : {}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function defineQuery(name, options = {}) {
|
|
18
|
+
checkName(name, "defineQuery");
|
|
19
|
+
return {
|
|
20
|
+
kind: "query",
|
|
21
|
+
name,
|
|
22
|
+
...options.description !== void 0 ? { description: options.description } : {}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function defineUpdate(name, options = {}) {
|
|
26
|
+
checkName(name, "defineUpdate");
|
|
27
|
+
return {
|
|
28
|
+
kind: "update",
|
|
29
|
+
name,
|
|
30
|
+
...options.description !== void 0 ? { description: options.description } : {}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function signalName(signal) {
|
|
34
|
+
return typeof signal === "string" ? signal : signal.name;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/durable/errors.ts
|
|
38
|
+
var ERROR_TYPE_VALUES = /* @__PURE__ */ new Set([
|
|
39
|
+
"TIMEOUT",
|
|
40
|
+
"TRANSIENT",
|
|
41
|
+
"DEPENDENCY",
|
|
42
|
+
"AUTHORIZATION",
|
|
43
|
+
"VALIDATION",
|
|
44
|
+
"PERMANENT",
|
|
45
|
+
"UNKNOWN"
|
|
46
|
+
]);
|
|
47
|
+
function isErrorType(value) {
|
|
48
|
+
return typeof value === "string" && ERROR_TYPE_VALUES.has(value);
|
|
49
|
+
}
|
|
50
|
+
var WorkflowFailure = class extends Error {
|
|
51
|
+
/** The shared error type the engine classifies this failure as. */
|
|
52
|
+
errorType;
|
|
53
|
+
constructor(message, errorType, options = {}) {
|
|
54
|
+
super(message);
|
|
55
|
+
this.name = "WorkflowFailure";
|
|
56
|
+
this.errorType = errorType;
|
|
57
|
+
if (options.cause !== void 0)
|
|
58
|
+
Object.defineProperty(this, "cause", {
|
|
59
|
+
value: options.cause,
|
|
60
|
+
enumerable: false,
|
|
61
|
+
writable: true,
|
|
62
|
+
configurable: true
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var ApplicationError = class extends WorkflowFailure {
|
|
67
|
+
type;
|
|
68
|
+
nonRetryable;
|
|
69
|
+
details;
|
|
70
|
+
nextRetryDelayMs;
|
|
71
|
+
category;
|
|
72
|
+
constructor(message, options = {}) {
|
|
73
|
+
super(
|
|
74
|
+
message,
|
|
75
|
+
options.errorType ?? (isErrorType(options.type) ? options.type : "UNKNOWN"),
|
|
76
|
+
options.cause !== void 0 ? { cause: options.cause } : {}
|
|
77
|
+
);
|
|
78
|
+
this.name = "ApplicationError";
|
|
79
|
+
this.type = options.type;
|
|
80
|
+
this.nonRetryable = options.nonRetryable === true;
|
|
81
|
+
this.details = options.details;
|
|
82
|
+
this.nextRetryDelayMs = options.nextRetryDelay;
|
|
83
|
+
this.category = options.category;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var ActivityFailure = class extends WorkflowFailure {
|
|
87
|
+
constructor(message, activityId, nodeType, operation, cause) {
|
|
88
|
+
super(message, cause instanceof WorkflowFailure ? cause.errorType : "UNKNOWN", { cause });
|
|
89
|
+
this.activityId = activityId;
|
|
90
|
+
this.nodeType = nodeType;
|
|
91
|
+
this.operation = operation;
|
|
92
|
+
this.name = "ActivityFailure";
|
|
93
|
+
}
|
|
94
|
+
activityId;
|
|
95
|
+
nodeType;
|
|
96
|
+
operation;
|
|
97
|
+
};
|
|
98
|
+
var ChildRunFailure = class extends WorkflowFailure {
|
|
99
|
+
constructor(message, childId, childRunId, cause) {
|
|
100
|
+
super(message, cause instanceof WorkflowFailure ? cause.errorType : "UNKNOWN", { cause });
|
|
101
|
+
this.childId = childId;
|
|
102
|
+
this.childRunId = childRunId;
|
|
103
|
+
this.name = "ChildRunFailure";
|
|
104
|
+
}
|
|
105
|
+
childId;
|
|
106
|
+
childRunId;
|
|
107
|
+
};
|
|
108
|
+
var TerminatedFailure = class extends WorkflowFailure {
|
|
109
|
+
constructor(message = "Terminated") {
|
|
110
|
+
super(message, "PERMANENT");
|
|
111
|
+
this.name = "TerminatedFailure";
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
var ServerFailure = class extends WorkflowFailure {
|
|
115
|
+
constructor(message, nonRetryable = false, errorType = "DEPENDENCY") {
|
|
116
|
+
super(message, errorType);
|
|
117
|
+
this.nonRetryable = nonRetryable;
|
|
118
|
+
this.name = "ServerFailure";
|
|
119
|
+
}
|
|
120
|
+
nonRetryable;
|
|
121
|
+
};
|
|
122
|
+
var CancelledFailure = class extends WorkflowFailure {
|
|
123
|
+
constructor(message = "Cancelled") {
|
|
124
|
+
super(message, "PERMANENT");
|
|
125
|
+
this.name = "CancelledFailure";
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
var TimeoutFailure = class extends WorkflowFailure {
|
|
129
|
+
constructor(message, timeoutType) {
|
|
130
|
+
super(message, "TIMEOUT");
|
|
131
|
+
this.timeoutType = timeoutType;
|
|
132
|
+
this.name = "TimeoutFailure";
|
|
133
|
+
}
|
|
134
|
+
timeoutType;
|
|
135
|
+
};
|
|
136
|
+
var DeterminismViolation = class extends Error {
|
|
137
|
+
constructor(message) {
|
|
138
|
+
super(message);
|
|
139
|
+
this.name = "DeterminismViolation";
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
var HistoryLimitExceeded = class extends Error {
|
|
143
|
+
constructor(message) {
|
|
144
|
+
super(message);
|
|
145
|
+
this.name = "HistoryLimitExceeded";
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var PhaseCFeatureError = class extends Error {
|
|
149
|
+
code = "durable.phaseC";
|
|
150
|
+
constructor(feature) {
|
|
151
|
+
super(
|
|
152
|
+
`${feature} is not available yet (Phase C); durable functions in this release cannot use it`
|
|
153
|
+
);
|
|
154
|
+
this.name = "PhaseCFeatureError";
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
function isCancellation(error) {
|
|
158
|
+
let current = error;
|
|
159
|
+
for (let depth = 0; depth < 16 && current instanceof Error; depth++) {
|
|
160
|
+
if (current instanceof CancelledFailure || current.name === "CancelledFailure") return true;
|
|
161
|
+
if (!(current instanceof ActivityFailure || current instanceof ChildRunFailure)) return false;
|
|
162
|
+
current = current.cause;
|
|
163
|
+
}
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
function isRunFailure(error) {
|
|
167
|
+
return error instanceof WorkflowFailure;
|
|
168
|
+
}
|
|
169
|
+
function stackOf(error) {
|
|
170
|
+
return typeof error.stack === "string" && error.stack !== "" ? error.stack : void 0;
|
|
171
|
+
}
|
|
172
|
+
function errorToFailure(error, source = "sdk-ts", depth = 0) {
|
|
173
|
+
if (!(error instanceof Error)) return { errorType: "UNKNOWN", message: String(error), source };
|
|
174
|
+
const failure = {
|
|
175
|
+
errorType: error instanceof WorkflowFailure ? error.errorType : "UNKNOWN",
|
|
176
|
+
message: error.message,
|
|
177
|
+
type: error instanceof ApplicationError && error.type !== void 0 ? error.type : error.name,
|
|
178
|
+
source
|
|
179
|
+
};
|
|
180
|
+
const stack = stackOf(error);
|
|
181
|
+
if (stack !== void 0) failure.stackTrace = stack;
|
|
182
|
+
if (error instanceof ApplicationError) {
|
|
183
|
+
if (error.nonRetryable) failure.nonRetryable = true;
|
|
184
|
+
if (error.details !== void 0) failure.details = error.details;
|
|
185
|
+
if (error.nextRetryDelayMs !== void 0) failure.nextRetryDelayMs = error.nextRetryDelayMs;
|
|
186
|
+
if (error.category !== void 0) failure.category = error.category;
|
|
187
|
+
}
|
|
188
|
+
if (error instanceof TimeoutFailure) failure.timeoutType = error.timeoutType;
|
|
189
|
+
if (error instanceof ServerFailure && error.nonRetryable) failure.nonRetryable = true;
|
|
190
|
+
const cause = error.cause;
|
|
191
|
+
if (cause !== void 0 && depth < 16) failure.cause = errorToFailure(cause, source, depth + 1);
|
|
192
|
+
return failure;
|
|
193
|
+
}
|
|
194
|
+
function failureToError(failure, depth = 0) {
|
|
195
|
+
const cause = failure.cause && depth < 16 ? failureToError(failure.cause, depth + 1) : void 0;
|
|
196
|
+
let error;
|
|
197
|
+
switch (failure.type) {
|
|
198
|
+
case "CancelledFailure":
|
|
199
|
+
error = new CancelledFailure(failure.message);
|
|
200
|
+
break;
|
|
201
|
+
case "TerminatedFailure":
|
|
202
|
+
error = new TerminatedFailure(failure.message);
|
|
203
|
+
break;
|
|
204
|
+
case "TimeoutFailure":
|
|
205
|
+
error = new TimeoutFailure(failure.message, failure.timeoutType ?? "UNKNOWN");
|
|
206
|
+
break;
|
|
207
|
+
case "ServerFailure":
|
|
208
|
+
error = new ServerFailure(failure.message, failure.nonRetryable === true, failure.errorType);
|
|
209
|
+
break;
|
|
210
|
+
default:
|
|
211
|
+
if (failure.timeoutType !== void 0 && failure.errorType === "TIMEOUT" && !failure.type)
|
|
212
|
+
error = new TimeoutFailure(failure.message, failure.timeoutType);
|
|
213
|
+
else
|
|
214
|
+
error = new ApplicationError(failure.message, {
|
|
215
|
+
errorType: failure.errorType,
|
|
216
|
+
...failure.type !== void 0 ? { type: failure.type } : {},
|
|
217
|
+
...failure.nonRetryable !== void 0 ? { nonRetryable: failure.nonRetryable } : {},
|
|
218
|
+
...failure.details !== void 0 ? { details: failure.details } : {},
|
|
219
|
+
...failure.nextRetryDelayMs !== void 0 ? { nextRetryDelay: failure.nextRetryDelayMs } : {},
|
|
220
|
+
...failure.category !== void 0 ? { category: failure.category } : {},
|
|
221
|
+
...cause !== void 0 ? { cause } : {}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
if (cause !== void 0 && !(error instanceof ApplicationError))
|
|
225
|
+
Object.defineProperty(error, "cause", {
|
|
226
|
+
value: cause,
|
|
227
|
+
enumerable: false,
|
|
228
|
+
writable: true,
|
|
229
|
+
configurable: true
|
|
230
|
+
});
|
|
231
|
+
if (failure.stackTrace !== void 0) error.stack = failure.stackTrace;
|
|
232
|
+
return error;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// src/durable/durations.ts
|
|
236
|
+
function toMs(value, what = "duration") {
|
|
237
|
+
const ms = durationMs(value, "ms");
|
|
238
|
+
if (ms === void 0) throw new TypeError(`${what} "${String(value)}" is not a duration`);
|
|
239
|
+
return Math.round(ms);
|
|
240
|
+
}
|
|
241
|
+
function optionalMs(value, what) {
|
|
242
|
+
return value === void 0 ? void 0 : toMs(value, what);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export { ActivityFailure, ApplicationError, CancelledFailure, ChildRunFailure, DeterminismViolation, HistoryLimitExceeded, PhaseCFeatureError, ServerFailure, TerminatedFailure, TimeoutFailure, WorkflowFailure, defineQuery, defineSignal, defineUpdate, errorToFailure, failureToError, isCancellation, isRunFailure, optionalMs, signalName, toMs };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk57MSZ24T_cjs = require('./chunk-57MSZ24T.cjs');
|
|
4
|
+
var chunkGVTZMA5C_cjs = require('./chunk-GVTZMA5C.cjs');
|
|
5
|
+
var chunkSAENRNBJ_cjs = require('./chunk-SAENRNBJ.cjs');
|
|
6
|
+
var chunkFQIHX7YI_cjs = require('./chunk-FQIHX7YI.cjs');
|
|
7
|
+
|
|
8
|
+
// src/builder/collect.ts
|
|
9
|
+
var COLLECTION_FORMAT = "fluidgrids.tier1-collection";
|
|
10
|
+
function triggerOf(spec, where) {
|
|
11
|
+
if (spec === void 0) return void 0;
|
|
12
|
+
const operation = chunk57MSZ24T_cjs.isOperation(spec) ? spec : chunkSAENRNBJ_cjs.isRecord(spec) ? spec.operation : void 0;
|
|
13
|
+
if (!chunk57MSZ24T_cjs.isOperation(operation))
|
|
14
|
+
throw new chunkGVTZMA5C_cjs.BuilderError(`${where}: trigger must be a trigger operation`);
|
|
15
|
+
const out = { nodeType: operation.nodeType };
|
|
16
|
+
if (operation.version !== void 0) out.version = operation.version;
|
|
17
|
+
if (operation.operation !== void 0) out.operation = operation.operation;
|
|
18
|
+
if (!chunk57MSZ24T_cjs.isOperation(spec)) {
|
|
19
|
+
if (spec.args !== void 0) out.args = spec.args;
|
|
20
|
+
if (spec.id !== void 0) out.id = spec.id;
|
|
21
|
+
}
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
function collectWorkflowExports(modules) {
|
|
25
|
+
const exportNames = /* @__PURE__ */ new Map();
|
|
26
|
+
const durable = [];
|
|
27
|
+
for (const [module, namespace] of modules) {
|
|
28
|
+
for (const exportName of Object.keys(namespace).sort()) {
|
|
29
|
+
const value = namespace[exportName];
|
|
30
|
+
if (!chunkFQIHX7YI_cjs.isDurableWorkflow(value) || exportNames.has(value)) continue;
|
|
31
|
+
exportNames.set(value, exportName);
|
|
32
|
+
const options = value.options;
|
|
33
|
+
const entry = {
|
|
34
|
+
module,
|
|
35
|
+
exportName,
|
|
36
|
+
name: value.name,
|
|
37
|
+
taskQueue: options.taskQueue ?? "managed",
|
|
38
|
+
interface: chunkFQIHX7YI_cjs.interfaceOf(value)
|
|
39
|
+
};
|
|
40
|
+
if (options.title !== void 0) entry.title = options.title;
|
|
41
|
+
if (options.description !== void 0) entry.description = options.description;
|
|
42
|
+
if (options.standalone !== void 0) entry.standalone = options.standalone;
|
|
43
|
+
const trigger = triggerOf(options.trigger, `workflow("${value.name}")`);
|
|
44
|
+
if (trigger) entry.trigger = trigger;
|
|
45
|
+
durable.push(entry);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const workflows = [];
|
|
49
|
+
for (const [module, namespace] of modules) {
|
|
50
|
+
for (const exportName of Object.keys(namespace).sort()) {
|
|
51
|
+
const value = namespace[exportName];
|
|
52
|
+
if (!chunk57MSZ24T_cjs.isTier1Workflow(value)) continue;
|
|
53
|
+
for (const ref of value.durableRefs ?? []) {
|
|
54
|
+
const resolved = exportNames.get(ref.definition);
|
|
55
|
+
if (resolved === void 0)
|
|
56
|
+
throw new chunkGVTZMA5C_cjs.BuilderError(
|
|
57
|
+
`${value.key}: wf.codeWorkflow node "${ref.nodeId}" uses workflow("${ref.definition.name}"), which no module exports`
|
|
58
|
+
);
|
|
59
|
+
const recorded = value.recording.nodes.find((entry) => entry.node.id === ref.nodeId);
|
|
60
|
+
const state = recorded?.node.args?.state;
|
|
61
|
+
if (chunkSAENRNBJ_cjs.isRecord(state)) chunkSAENRNBJ_cjs.setOwn(state, "workflowFn", resolved);
|
|
62
|
+
}
|
|
63
|
+
workflows.push({ module, exportName, recording: value.recording });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const collection = {
|
|
67
|
+
format: COLLECTION_FORMAT,
|
|
68
|
+
workflows,
|
|
69
|
+
...durable.length > 0 ? { durable } : {}
|
|
70
|
+
};
|
|
71
|
+
return JSON.stringify(collection);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
exports.COLLECTION_FORMAT = COLLECTION_FORMAT;
|
|
75
|
+
exports.collectWorkflowExports = collectWorkflowExports;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkSAENRNBJ_cjs = require('./chunk-SAENRNBJ.cjs');
|
|
4
4
|
|
|
5
5
|
// src/ir/manifest.ts
|
|
6
6
|
function operationsOf(manifest) {
|
|
7
7
|
const operations = Array.isArray(manifest.operations) ? manifest.operations : manifest.operations.operations;
|
|
8
|
-
return Array.isArray(operations) ? operations.filter((operation) =>
|
|
8
|
+
return Array.isArray(operations) ? operations.filter((operation) => chunkSAENRNBJ_cjs.isRecord(operation) && typeof operation.name === "string") : [];
|
|
9
9
|
}
|
|
10
10
|
function isTriggerOperation(operation) {
|
|
11
11
|
if (typeof operation.role === "string") return operation.role.toLowerCase() === "trigger";
|
|
@@ -13,7 +13,7 @@ function isTriggerOperation(operation) {
|
|
|
13
13
|
}
|
|
14
14
|
function fieldOf(value) {
|
|
15
15
|
if (typeof value === "string") return { type: value };
|
|
16
|
-
return
|
|
16
|
+
return chunkSAENRNBJ_cjs.isRecord(value) ? value : {};
|
|
17
17
|
}
|
|
18
18
|
function fieldSchema(value) {
|
|
19
19
|
const field = fieldOf(value);
|
|
@@ -49,10 +49,10 @@ function fieldSchema(value) {
|
|
|
49
49
|
return { type: "array", ...items, ...description };
|
|
50
50
|
}
|
|
51
51
|
case "object": {
|
|
52
|
-
if (
|
|
52
|
+
if (chunkSAENRNBJ_cjs.isRecord(field.properties)) {
|
|
53
53
|
const properties = {};
|
|
54
54
|
for (const [name, child] of Object.entries(field.properties))
|
|
55
|
-
properties
|
|
55
|
+
chunkSAENRNBJ_cjs.setOwn(properties, name, fieldSchema(child));
|
|
56
56
|
return { type: "object", properties, ...description };
|
|
57
57
|
}
|
|
58
58
|
return { type: "object", ...description };
|
|
@@ -65,7 +65,7 @@ function fieldsSchema(fields) {
|
|
|
65
65
|
const properties = {};
|
|
66
66
|
const required = [];
|
|
67
67
|
for (const [name, field] of Object.entries(fields ?? {})) {
|
|
68
|
-
properties
|
|
68
|
+
chunkSAENRNBJ_cjs.setOwn(properties, name, fieldSchema(field));
|
|
69
69
|
if (fieldOf(field).required === true) required.push(name);
|
|
70
70
|
}
|
|
71
71
|
return {
|