@voltro/workflow 0.84.0 → 0.86.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +1215 -0
  2. package/THIRD-PARTY-NOTICES.md +5 -151
  3. package/dist/admission.js +140 -0
  4. package/dist/admissionDrainer.js +705 -0
  5. package/dist/admissionGate.js +115 -0
  6. package/dist/admissionStore.js +347 -0
  7. package/dist/admissionSubmission.js +297 -0
  8. package/dist/admissionTables.js +137 -0
  9. package/dist/admissionTransaction.js +21 -0
  10. package/dist/awaitEvent.js +82 -0
  11. package/dist/budgetHold.js +136 -0
  12. package/dist/cancelOnPlan.js +75 -0
  13. package/dist/cancelOnSweep.js +188 -0
  14. package/dist/cancelPendingStart.js +50 -0
  15. package/dist/cluster.d.ts +304 -280
  16. package/dist/cluster.js +8 -2
  17. package/dist/clusterCron.js +11 -0
  18. package/dist/clusterDiagnostics.js +20 -0
  19. package/dist/clusterDiagnosticsSql.js +145 -0
  20. package/dist/clusterLayer.js +110 -0
  21. package/dist/clusterMigrationGate.js +61 -0
  22. package/dist/clusterRunnerLayer.js +21 -0
  23. package/dist/clusterTestSuite.d.ts +11 -11
  24. package/dist/clusterTestSuite.js +257 -257
  25. package/dist/controlMonitor.js +13 -0
  26. package/dist/controlRequest.js +367 -0
  27. package/dist/executionRefusal.js +162 -0
  28. package/dist/failureHandoff.js +183 -0
  29. package/dist/failureMessage.js +12 -0
  30. package/dist/failureRecovery.js +50 -0
  31. package/dist/failureReportStore.js +60 -0
  32. package/dist/flowControl.js +142 -0
  33. package/dist/forwardStartReceipts.js +41 -0
  34. package/dist/inMemoryLayer.js +7 -0
  35. package/dist/inMemoryRecorder.js +56 -0
  36. package/dist/index.d.ts +456 -360
  37. package/dist/index.js +49 -5
  38. package/dist/inspectWorkflow.js +101 -0
  39. package/dist/journalEncryption.js +147 -0
  40. package/dist/messages.js +92 -0
  41. package/dist/nondeterminism.js +51 -0
  42. package/dist/parentClosure.js +141 -0
  43. package/dist/parentClosureRecovery.js +54 -0
  44. package/dist/pendingSubmission.js +85 -0
  45. package/dist/prepareSubmissionDispatch.js +17 -0
  46. package/dist/preparedExecution.js +14 -0
  47. package/dist/primitives.d.ts +56 -31
  48. package/dist/primitives.js +225 -2
  49. package/dist/queuedCancellationRequest.js +364 -0
  50. package/dist/queuedControl.js +21 -0
  51. package/dist/recorder.js +11 -0
  52. package/dist/residentExecutionEvidence.js +64 -0
  53. package/dist/retryPolicy.js +57 -0
  54. package/dist/runEventsTable.js +17 -0
  55. package/dist/runGeneration.js +345 -0
  56. package/dist/runRecording.js +615 -0
  57. package/dist/runStepsTable.js +28 -0
  58. package/dist/runnerStorageGuard.js +29 -0
  59. package/dist/runsTable.js +42 -0
  60. package/dist/scheduleDeclaration.js +44 -0
  61. package/dist/signalHint.js +23 -0
  62. package/dist/signals.js +70 -0
  63. package/dist/signalsSuspending.js +57 -0
  64. package/dist/sqliteWorkflowOwnership.js +26 -0
  65. package/dist/stalenessSweep.js +191 -0
  66. package/dist/startContextsTable.js +20 -0
  67. package/dist/startReceipt.js +143 -0
  68. package/dist/submissionRecovery.js +122 -0
  69. package/dist/submissionRejection.js +10 -0
  70. package/dist/submissionRetry.js +71 -0
  71. package/dist/suspensionUnavailable.js +9 -0
  72. package/dist/updates.js +87 -0
  73. package/dist/watermarkTable.js +9 -0
  74. package/dist/webCrypto.js +17 -0
  75. package/dist/workflowDelivery.js +24 -0
  76. package/dist/workflowJournal.js +124 -0
  77. package/dist/workflowJournalReset.js +111 -0
  78. package/dist/workflowReadSelections.js +12 -0
  79. package/dist/workflowRestartDispatch.js +29 -0
  80. package/dist/workflowRestartObservation.js +60 -0
  81. package/dist/workflowRestartPreparation.js +109 -0
  82. package/dist/workflowRestartReservation.js +426 -0
  83. package/dist/workflowResumeDispatch.js +29 -0
  84. package/package.json +6 -9
  85. package/dist/cluster-i3frC3Da.js +0 -646
  86. package/dist/clusterDiagnostics-CGUtnJkX.js +0 -2084
  87. package/dist/journalEncryption--n5VDdYO.js +0 -148
  88. package/dist/primitives-Btjhjm8P.js +0 -483
  89. package/dist/src-DP-lKqaG.js +0 -3867
@@ -1,126 +1,14 @@
1
1
  # Third-Party Notices — @voltro/workflow
2
2
 
3
- This package depends on the open-source software listed below. Each is the
3
+ This package uses the open-source software listed below. Each is the
4
4
  property of its respective copyright holders and is used under the terms of
5
5
  its license. This file is provided for attribution; it grants no rights in
6
6
  @voltro/workflow itself, which is proprietary (see LICENSE).
7
7
 
8
- Generated from the resolved runtime dependency closure (10 packages).
8
+ Generated from the resolved runtime dependency closure (4 packages).
9
9
 
10
10
  ---
11
11
 
12
- ## @effect/cluster@0.60.2
13
-
14
- License: MIT
15
-
16
- ```
17
- MIT License
18
-
19
- Copyright (c) 2023-present The Contributors
20
-
21
- Permission is hereby granted, free of charge, to any person obtaining a copy
22
- of this software and associated documentation files (the "Software"), to deal
23
- in the Software without restriction, including without limitation the rights
24
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
- copies of the Software, and to permit persons to whom the Software is
26
- furnished to do so, subject to the following conditions:
27
-
28
- The above copyright notice and this permission notice shall be included in all
29
- copies or substantial portions of the Software.
30
-
31
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
- SOFTWARE.
38
- ```
39
-
40
- ## @effect/experimental@0.61.1
41
-
42
- License: MIT
43
-
44
- ```
45
- MIT License
46
-
47
- Copyright (c) 2023-present The Contributors
48
-
49
- Permission is hereby granted, free of charge, to any person obtaining a copy
50
- of this software and associated documentation files (the "Software"), to deal
51
- in the Software without restriction, including without limitation the rights
52
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
- copies of the Software, and to permit persons to whom the Software is
54
- furnished to do so, subject to the following conditions:
55
-
56
- The above copyright notice and this permission notice shall be included in all
57
- copies or substantial portions of the Software.
58
-
59
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
65
- SOFTWARE.
66
- ```
67
-
68
- ## @effect/sql@0.52.1
69
-
70
- License: MIT
71
-
72
- ```
73
- MIT License
74
-
75
- Copyright (c) 2023-present The Contributors
76
-
77
- Permission is hereby granted, free of charge, to any person obtaining a copy
78
- of this software and associated documentation files (the "Software"), to deal
79
- in the Software without restriction, including without limitation the rights
80
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
81
- copies of the Software, and to permit persons to whom the Software is
82
- furnished to do so, subject to the following conditions:
83
-
84
- The above copyright notice and this permission notice shall be included in all
85
- copies or substantial portions of the Software.
86
-
87
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
88
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
89
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
90
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
91
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
92
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
93
- SOFTWARE.
94
- ```
95
-
96
- ## @effect/workflow@0.19.1
97
-
98
- License: MIT
99
-
100
- ```
101
- MIT License
102
-
103
- Copyright (c) 2023-present The Contributors
104
-
105
- Permission is hereby granted, free of charge, to any person obtaining a copy
106
- of this software and associated documentation files (the "Software"), to deal
107
- in the Software without restriction, including without limitation the rights
108
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
109
- copies of the Software, and to permit persons to whom the Software is
110
- furnished to do so, subject to the following conditions:
111
-
112
- The above copyright notice and this permission notice shall be included in all
113
- copies or substantial portions of the Software.
114
-
115
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
116
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
117
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
118
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
120
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
121
- SOFTWARE.
122
- ```
123
-
124
12
  ## jose@6.2.12
125
13
 
126
14
  License: MIT
@@ -149,40 +37,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
149
37
  SOFTWARE.
150
38
  ```
151
39
 
152
- ## kubernetes-types@1.30.0
153
-
154
- License: Apache-2.0
155
-
156
- _(no bundled license text found in the package; see its npm page.)_
157
-
158
- ## layerr@3.0.0
159
-
160
- License: MIT
161
-
162
- ```
163
- MIT License
164
-
165
- Copyright (c) 2020 Perry Mitchell
166
-
167
- Permission is hereby granted, free of charge, to any person obtaining a copy
168
- of this software and associated documentation files (the "Software"), to deal
169
- in the Software without restriction, including without limitation the rights
170
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
171
- copies of the Software, and to permit persons to whom the Software is
172
- furnished to do so, subject to the following conditions:
173
-
174
- The above copyright notice and this permission notice shall be included in all
175
- copies or substantial portions of the Software.
176
-
177
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
178
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
179
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
180
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
181
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
182
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
183
- SOFTWARE.
184
- ```
185
-
186
40
  ## typeid-js@1.2.0
187
41
 
188
42
  License: Apache-2.0
@@ -391,14 +245,14 @@ Apache License
391
245
  limitations under the License.
392
246
  ```
393
247
 
394
- ## ulidx@2.4.1
248
+ ## ulid@3.0.2
395
249
 
396
250
  License: MIT
397
251
 
398
252
  ```
399
- MIT License
253
+ The MIT License (MIT)
400
254
 
401
- Copyright (c) 2021 Perry Mitchell
255
+ Copyright (c) 2017 Alizain Feerasta
402
256
 
403
257
  Permission is hereby granted, free of charge, to any person obtaining a copy
404
258
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,140 @@
1
+ //#region src/admission.ts
2
+ var e = class extends Error {
3
+ workflowName;
4
+ field;
5
+ constructor(e, t, n) {
6
+ super(`workflow '${e}': ${t}(payload) threw — a flow-control key function must be total over every payload the workflow accepts, because it runs before the run exists and there is nowhere to report a partial failure to. Cause: ${n instanceof Error ? n.message : String(n)}`), this.name = "FlowControlKeyError", this.workflowName = e, this.field = t, this.cause = n;
7
+ }
8
+ }, t = (t, n, r, i) => {
9
+ try {
10
+ let e = r(i);
11
+ if (typeof e != "string" || e.length === 0) throw Error(`returned ${e === "" ? "an empty string" : String(e)}; expected a non-empty string`);
12
+ return e;
13
+ } catch (r) {
14
+ throw new e(t, n, r);
15
+ }
16
+ }, n = (e, t) => JSON.stringify([e ?? null, t]), r = (r, i) => {
17
+ let a = r.workflowName, o = 0;
18
+ if (r.priority !== void 0) try {
19
+ let e = r.priority(i);
20
+ if (!Number.isFinite(e)) throw Error(`returned ${String(e)}; expected a finite number`);
21
+ o = Math.trunc(e);
22
+ } catch (t) {
23
+ throw new e(a, "priority", t);
24
+ }
25
+ return {
26
+ ...r.debounce === void 0 ? {} : { debounceKey: t(a, "debounce.key", r.debounce.key, i) },
27
+ ...r.singleton === void 0 ? {} : { singletonKey: t(a, "singleton.key", r.singleton.key, i) },
28
+ ...r.concurrency === void 0 ? {} : { concurrencyKey: n(r.concurrency.pool, r.concurrency.key === void 0 ? "" : t(a, "concurrency.key", r.concurrency.key, i)) },
29
+ ...r.throttle?.key === void 0 ? r.throttle === void 0 ? {} : { throttleKey: "" } : { throttleKey: t(a, "throttle.key", r.throttle.key, i) },
30
+ ...r.rateLimit?.key === void 0 ? r.rateLimit === void 0 ? {} : { rateLimitKey: "" } : { rateLimitKey: t(a, "rateLimit.key", r.rateLimit.key, i) },
31
+ ...r.batch?.key === void 0 ? r.batch === void 0 ? {} : { batchKey: "" } : { batchKey: t(a, "batch.key", r.batch.key, i) },
32
+ priority: o
33
+ };
34
+ }, i = (e, t, n, r) => {
35
+ let i = e.filter((e) => e > r - n);
36
+ if (i.length < t) return;
37
+ let a = [...i].sort((e, t) => t - e)[t - 1];
38
+ if (a !== void 0) return a + n;
39
+ }, a = (e) => {
40
+ let { control: t, keys: n, state: r, now: a, reconsidering: c } = e;
41
+ if (r.paused === !0) return {
42
+ kind: "defer",
43
+ mode: "paused",
44
+ dueAt: a,
45
+ collapse: c ? "hold" : "append",
46
+ keys: n
47
+ };
48
+ if (t.rateLimit !== void 0) {
49
+ let e = i(r.recentAdmissions ?? [], t.rateLimit.limit, t.rateLimit.periodMs, a);
50
+ if (e !== void 0) return {
51
+ kind: "drop",
52
+ reason: "rate-limit",
53
+ retryAfterMs: Math.max(0, e - a),
54
+ keys: n
55
+ };
56
+ }
57
+ if (t.singleton !== void 0 && r.singletonUnacknowledged === !0) return {
58
+ kind: "defer",
59
+ mode: "singleton",
60
+ dueAt: a,
61
+ collapse: c ? "hold" : "append",
62
+ keys: n
63
+ };
64
+ if (t.singleton !== void 0 && t.singleton.mode === "skip" && r.singletonHolder !== void 0) return {
65
+ kind: "skip",
66
+ incumbent: r.singletonHolder,
67
+ keys: n
68
+ };
69
+ if (t.debounce !== void 0) {
70
+ let e = r.debouncePending, i = e?.firstSeenAt ?? a, o = e?.deadlineAt ?? (t.debounce.timeoutMs === void 0 ? void 0 : i + t.debounce.timeoutMs);
71
+ return c ? o !== void 0 && a >= o ? {
72
+ kind: "admit",
73
+ reason: "debounce-deadline",
74
+ keys: n,
75
+ ...s(t, r)
76
+ } : {
77
+ kind: "admit",
78
+ reason: "debounce-elapsed",
79
+ keys: n,
80
+ ...s(t, r)
81
+ } : {
82
+ kind: "defer",
83
+ mode: "debounce",
84
+ dueAt: o === void 0 ? a + t.debounce.periodMs : Math.min(a + t.debounce.periodMs, o),
85
+ ...o === void 0 ? {} : { deadlineAt: o },
86
+ collapse: "replace",
87
+ keys: n
88
+ };
89
+ }
90
+ if (t.batch !== void 0) {
91
+ let e = r.batchPending, i = (e?.count ?? 0) + +!c, o = (e?.firstSeenAt ?? a) + t.batch.timeoutMs;
92
+ return i >= t.batch.maxSize ? {
93
+ kind: "admit",
94
+ reason: "batch-full",
95
+ keys: n,
96
+ ...s(t, r)
97
+ } : c && a >= o ? {
98
+ kind: "admit",
99
+ reason: "batch-timeout",
100
+ keys: n,
101
+ ...s(t, r)
102
+ } : {
103
+ kind: "defer",
104
+ mode: "batch",
105
+ dueAt: o,
106
+ collapse: c ? "hold" : "append",
107
+ keys: n
108
+ };
109
+ }
110
+ if (t.throttle !== void 0) {
111
+ let e = i(r.recentAdmissions ?? [], t.throttle.limit, t.throttle.periodMs, a);
112
+ if (e !== void 0) return {
113
+ kind: "defer",
114
+ mode: "throttle",
115
+ dueAt: e,
116
+ collapse: c ? "hold" : "append",
117
+ keys: n
118
+ };
119
+ }
120
+ return t.concurrency !== void 0 && (r.inFlight ?? 0) >= t.concurrency.limit ? {
121
+ kind: "defer",
122
+ mode: "concurrency",
123
+ dueAt: a,
124
+ collapse: c ? "hold" : "append",
125
+ keys: n
126
+ } : {
127
+ kind: "admit",
128
+ reason: o(t) ? "under-limits" : "no-controls",
129
+ keys: n,
130
+ ...s(t, r)
131
+ };
132
+ }, o = (e) => e.debounce !== void 0 || e.singleton !== void 0 || e.concurrency !== void 0 || e.throttle !== void 0 || e.rateLimit !== void 0 || e.batch !== void 0, s = (e, t) => e.singleton?.mode === "cancel" && t.singletonHolder !== void 0 ? { evict: t.singletonHolder } : {}, c = (e, t, n) => {
133
+ let r = e.timeouts?.startMs;
134
+ return r !== void 0 && n - t.firstSeenAt >= r;
135
+ }, l = (e, t, n) => {
136
+ let r = e.timeouts?.finishMs;
137
+ return r === void 0 || t.terminal ? !1 : n - t.startedAt >= r;
138
+ }, u = (e, t) => e.priority === t.priority ? e.firstSeenAt === t.firstSeenAt ? e.id < t.id ? -1 : +(e.id > t.id) : e.firstSeenAt - t.firstSeenAt : t.priority - e.priority;
139
+ //#endregion
140
+ export { e as FlowControlKeyError, u as comparePendingOrder, a as decideAdmission, l as isFinishExpired, c as isStartExpired, i as nextSlotAt, n as pooledConcurrencyKey, r as resolveAdmissionKeys };