@voltro/workflow 0.71.1 → 0.73.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.
- package/CHANGELOG.md +468 -0
- package/THIRD-PARTY-NOTICES.md +29 -1
- package/dist/{cluster-BRSoL1tb.js → cluster-Doetj9Bb.js} +18 -18
- package/dist/cluster.d.ts +13 -13
- package/dist/cluster.js +1 -1
- package/dist/{clusterDiagnostics-jpkNVay6.js → clusterDiagnostics-Cwt-WFec.js} +39 -23
- package/dist/clusterTestSuite.js +3 -3
- package/dist/index.d.ts +64 -32
- package/dist/index.js +4 -4
- package/dist/{primitives-DsMsMr5S.js → primitives-bv2JHUfk.js} +64 -64
- package/dist/primitives.js +1 -1
- package/dist/{src-OEBqLBJl.js → src-BnF1JtbZ.js} +1105 -976
- package/package.json +4 -4
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -5,7 +5,7 @@ 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 (
|
|
8
|
+
Generated from the resolved runtime dependency closure (10 packages).
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -37,6 +37,34 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
37
37
|
SOFTWARE.
|
|
38
38
|
```
|
|
39
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
|
+
|
|
40
68
|
## @effect/sql@0.52.1
|
|
41
69
|
|
|
42
70
|
License: MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e,
|
|
1
|
+
import { a as e, l as t, n, o as r, t as i, u as a } from "./clusterDiagnostics-Cwt-WFec.js";
|
|
2
2
|
import { Context as o, Duration as s, Effect as c, Layer as l, Option as u, Runtime as d, Schema as f } from "effect";
|
|
3
3
|
import { SqlClient as p } from "@effect/sql";
|
|
4
4
|
import { ClusterCron as m, ClusterSchema as h, ClusterWorkflowEngine as g, EntityAddress as _, EntityId as v, EntityType as ee, MessageStorage as y, RunnerAddress as b, ShardId as te, Sharding as x, ShardingConfig as ne, SingleRunner as re, SqlMessageStorage as ie, SqlRunnerStorage as ae } from "@effect/cluster";
|
|
@@ -119,11 +119,11 @@ var T = f.parseJson(f.Struct({
|
|
|
119
119
|
};
|
|
120
120
|
}).pipe(s.withTransaction, c.provideService(p.SafeIntegers, !0));
|
|
121
121
|
}), le = (e) => ce([e], { suspension: e }), ue = (e) => c.gen(function* () {
|
|
122
|
-
let
|
|
123
|
-
if (
|
|
124
|
-
let
|
|
125
|
-
if (
|
|
126
|
-
let { request: o } =
|
|
122
|
+
let n = yield* c.runtime(), r = yield* c.promise(() => e.transaction((t) => a(t, e.requestId, (e) => d.runPromise(n)(se(e)))));
|
|
123
|
+
if (r.kind !== "bound") return r;
|
|
124
|
+
let i = yield* c.promise(() => e.transaction((n) => t(n, e.requestId)));
|
|
125
|
+
if (i.kind !== "dispatch") return i;
|
|
126
|
+
let { request: o } = i;
|
|
127
127
|
if (o.operation !== "resume" || o.resumeJournal === null) return yield* c.die(/* @__PURE__ */ Error("Resume dispatch requires its committed suspension binding"));
|
|
128
128
|
let s = yield* le({
|
|
129
129
|
workflowName: o.workflowName,
|
|
@@ -195,7 +195,7 @@ var T = f.parseJson(f.Struct({
|
|
|
195
195
|
let r = e.slice(0, n), i = Number(e.slice(n + 1)), a = t.indexOf(r);
|
|
196
196
|
if (!(a < 0 || !Number.isInteger(i))) return (a + 1) * 1e6 + i;
|
|
197
197
|
}, U = (e) => c.gen(function* () {
|
|
198
|
-
let t = yield* p.SqlClient, n = e.shardGroups ?? ["default"], r = e.dialectId ?? "",
|
|
198
|
+
let t = yield* p.SqlClient, n = e.shardGroups ?? ["default"], r = e.dialectId ?? "", a = r.startsWith("postgres") || r === "pg", o = (e) => e.pipe(c.catchAll(() => c.succeed([]))), s = t.onDialectOrElse({
|
|
199
199
|
pg: () => t.literal("NOW()"),
|
|
200
200
|
mysql: () => t.literal("NOW()"),
|
|
201
201
|
mssql: () => t.literal("GETDATE()"),
|
|
@@ -226,7 +226,7 @@ var T = f.parseJson(f.Struct({
|
|
|
226
226
|
WHERE entity_id = ${e}
|
|
227
227
|
ORDER BY rowid ASC
|
|
228
228
|
`).pipe(c.map((e) => e.map((e) => l(e, n))));
|
|
229
|
-
}, m = (e =
|
|
229
|
+
}, m = (e = i) => {
|
|
230
230
|
let n = Math.max(1, Math.ceil(e / 1e3)), r = Date.now();
|
|
231
231
|
return o(t`
|
|
232
232
|
SELECT tag, entity_type, entity_id, shard_id, processed, last_read, ${s} AS server_now
|
|
@@ -293,7 +293,7 @@ var T = f.parseJson(f.Struct({
|
|
|
293
293
|
shardLockMode: e.shardLockMode,
|
|
294
294
|
messagesFor: f,
|
|
295
295
|
unreadMessages: m,
|
|
296
|
-
shardLockHolders: (t) => t.length === 0 || e.runnerStorage !== "sql" ? c.succeed([]) : e.shardLockMode === "row" ? h(t) : e.shardLockMode === "advisory" &&
|
|
296
|
+
shardLockHolders: (t) => t.length === 0 || e.runnerStorage !== "sql" ? c.succeed([]) : e.shardLockMode === "row" ? h(t) : e.shardLockMode === "advisory" && a ? g(t) : c.succeed([]),
|
|
297
297
|
runners: () => e.runnerStorage === "sql" ? o(t`SELECT address, last_heartbeat, healthy FROM cluster_runners ORDER BY last_heartbeat DESC`).pipe(c.map((e) => e.map((e) => {
|
|
298
298
|
let t = e;
|
|
299
299
|
return {
|
|
@@ -362,8 +362,8 @@ var T = f.parseJson(f.Struct({
|
|
|
362
362
|
runnerStorage: e.runnerStorage,
|
|
363
363
|
runnerListenHost: e.runnerListenHost,
|
|
364
364
|
runnerListenPort: e.runnerListenPort
|
|
365
|
-
}),
|
|
366
|
-
t.localhostRisk && !Y.has(
|
|
365
|
+
}), i = t.host, a = t.port;
|
|
366
|
+
t.localhostRisk && !Y.has(i) && (Y.add(i), W.warn("runner host is not routable from other pods with SQL cluster storage — a workflow cannot resume on another pod after a reschedule. Inject POD_IP via the K8s downward API (fieldRef: status.podIP) or set runnerListenHost / VOLTRO_WORKFLOW_RUNNER_HOST.", { runnerHost: i }));
|
|
367
367
|
let d = B({ runnerStorage: e.runnerStorage }).pipe(l.provide(e.sqlClientLayer)), f = e.shardLockMode ?? K(), p = l.unwrapEffect(J({
|
|
368
368
|
dialectId: e.dialectId,
|
|
369
369
|
runnerStorage: e.runnerStorage,
|
|
@@ -374,25 +374,25 @@ var T = f.parseJson(f.Struct({
|
|
|
374
374
|
dialectId: e.dialectId,
|
|
375
375
|
mode: f
|
|
376
376
|
}));
|
|
377
|
-
let
|
|
378
|
-
ownAddress: b.make(
|
|
377
|
+
let r = l.effect(n, c.flatMap(x.Sharding, (n) => U({
|
|
378
|
+
ownAddress: b.make(i, a).toString(),
|
|
379
379
|
shardLockMode: e.runnerStorage === "sql" ? t ? "row" : "advisory" : "none",
|
|
380
380
|
runnerStorage: e.runnerStorage,
|
|
381
381
|
dialectId: e.dialectId,
|
|
382
|
-
hasShard: (e) =>
|
|
382
|
+
hasShard: (e) => n.hasShardId(te.ShardId.fromString(e))
|
|
383
383
|
}))), o = re.layer({
|
|
384
384
|
runnerStorage: e.runnerStorage,
|
|
385
385
|
shardingConfig: {
|
|
386
|
-
runnerAddress: u.some(b.make(
|
|
387
|
-
runnerListenAddress: u.some(b.make(
|
|
386
|
+
runnerAddress: u.some(b.make(i, a)),
|
|
387
|
+
runnerListenAddress: u.some(b.make(i, a)),
|
|
388
388
|
...t ? { shardLockDisableAdvisory: !0 } : {},
|
|
389
389
|
...e.failoverLeaseSeconds === void 0 ? {} : { shardLockExpiration: s.seconds(e.failoverLeaseSeconds) },
|
|
390
390
|
...e.failoverHeartbeatSeconds === void 0 ? {} : { shardLockRefreshInterval: s.seconds(e.failoverHeartbeatSeconds) },
|
|
391
391
|
...e.messagePollSeconds === void 0 ? {} : { entityMessagePollInterval: s.seconds(e.messagePollSeconds) }
|
|
392
392
|
}
|
|
393
393
|
});
|
|
394
|
-
return l.merge(
|
|
395
|
-
}))).pipe(l.provide(d)), m = e.extraShardingLayers ?? [], h = m.length === 0 ? g.layer : l.mergeAll(g.layer, ...m), _ = p.pipe(l.map((e) => o.add(e, x.Sharding,
|
|
394
|
+
return l.merge(r, l.effect(E, de)).pipe(l.provideMerge(o));
|
|
395
|
+
}))).pipe(l.provide(d)), m = e.extraShardingLayers ?? [], h = m.length === 0 ? g.layer : l.mergeAll(g.layer, ...m), _ = p.pipe(l.map((e) => o.add(e, x.Sharding, r(o.get(e, x.Sharding)))));
|
|
396
396
|
return h.pipe(l.provideMerge(_));
|
|
397
397
|
}, X = (e) => m.make({
|
|
398
398
|
name: e.name,
|
package/dist/cluster.d.ts
CHANGED
|
@@ -54,12 +54,12 @@ declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: string, ob
|
|
|
54
54
|
readonly generation: string;
|
|
55
55
|
readonly enteredAt: number;
|
|
56
56
|
} | null;
|
|
57
|
+
readonly generation: string;
|
|
57
58
|
readonly requestedAt: number;
|
|
58
59
|
readonly executionId: string;
|
|
59
60
|
readonly runId: string;
|
|
60
61
|
readonly workflowName: string;
|
|
61
62
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
62
|
-
readonly generation: string;
|
|
63
63
|
readonly owner: {
|
|
64
64
|
readonly tenantId: string | null;
|
|
65
65
|
} | null;
|
|
@@ -93,12 +93,12 @@ declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: string, ob
|
|
|
93
93
|
readonly generation: string;
|
|
94
94
|
readonly enteredAt: number;
|
|
95
95
|
} | null;
|
|
96
|
+
readonly generation: string;
|
|
96
97
|
readonly requestedAt: number;
|
|
97
98
|
readonly executionId: string;
|
|
98
99
|
readonly runId: string;
|
|
99
100
|
readonly workflowName: string;
|
|
100
101
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
101
|
-
readonly generation: string;
|
|
102
102
|
readonly owner: {
|
|
103
103
|
readonly tenantId: string | null;
|
|
104
104
|
} | null;
|
|
@@ -132,12 +132,12 @@ declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: string, ob
|
|
|
132
132
|
readonly generation: string;
|
|
133
133
|
readonly enteredAt: number;
|
|
134
134
|
} | null;
|
|
135
|
+
readonly generation: string;
|
|
135
136
|
readonly requestedAt: number;
|
|
136
137
|
readonly executionId: string;
|
|
137
138
|
readonly runId: string;
|
|
138
139
|
readonly workflowName: string;
|
|
139
140
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
140
|
-
readonly generation: string;
|
|
141
141
|
readonly owner: {
|
|
142
142
|
readonly tenantId: string | null;
|
|
143
143
|
} | null;
|
|
@@ -171,12 +171,12 @@ declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: string, ob
|
|
|
171
171
|
readonly generation: string;
|
|
172
172
|
readonly enteredAt: number;
|
|
173
173
|
} | null;
|
|
174
|
+
readonly generation: string;
|
|
174
175
|
readonly requestedAt: number;
|
|
175
176
|
readonly executionId: string;
|
|
176
177
|
readonly runId: string;
|
|
177
178
|
readonly workflowName: string;
|
|
178
179
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
179
|
-
readonly generation: string;
|
|
180
180
|
readonly owner: {
|
|
181
181
|
readonly tenantId: string | null;
|
|
182
182
|
} | null;
|
|
@@ -210,12 +210,12 @@ declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: string, ob
|
|
|
210
210
|
readonly generation: string;
|
|
211
211
|
readonly enteredAt: number;
|
|
212
212
|
} | null;
|
|
213
|
+
readonly generation: string;
|
|
213
214
|
readonly requestedAt: number;
|
|
214
215
|
readonly executionId: string;
|
|
215
216
|
readonly runId: string;
|
|
216
217
|
readonly workflowName: string;
|
|
217
218
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
218
|
-
readonly generation: string;
|
|
219
219
|
readonly owner: {
|
|
220
220
|
readonly tenantId: string | null;
|
|
221
221
|
} | null;
|
|
@@ -249,12 +249,12 @@ declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: string, ob
|
|
|
249
249
|
readonly generation: string;
|
|
250
250
|
readonly enteredAt: number;
|
|
251
251
|
} | null;
|
|
252
|
+
readonly generation: string;
|
|
252
253
|
readonly requestedAt: number;
|
|
253
254
|
readonly executionId: string;
|
|
254
255
|
readonly runId: string;
|
|
255
256
|
readonly workflowName: string;
|
|
256
257
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
257
|
-
readonly generation: string;
|
|
258
258
|
readonly owner: {
|
|
259
259
|
readonly tenantId: string | null;
|
|
260
260
|
} | null;
|
|
@@ -397,12 +397,12 @@ declare const dispatchWorkflowResume: (options: {
|
|
|
397
397
|
readonly generation: string;
|
|
398
398
|
readonly enteredAt: number;
|
|
399
399
|
} | null;
|
|
400
|
+
readonly generation: string;
|
|
400
401
|
readonly requestedAt: number;
|
|
401
402
|
readonly executionId: string;
|
|
402
403
|
readonly runId: string;
|
|
403
404
|
readonly workflowName: string;
|
|
404
405
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
405
|
-
readonly generation: string;
|
|
406
406
|
readonly owner: {
|
|
407
407
|
readonly tenantId: string | null;
|
|
408
408
|
} | null;
|
|
@@ -436,12 +436,12 @@ declare const dispatchWorkflowResume: (options: {
|
|
|
436
436
|
readonly generation: string;
|
|
437
437
|
readonly enteredAt: number;
|
|
438
438
|
} | null;
|
|
439
|
+
readonly generation: string;
|
|
439
440
|
readonly requestedAt: number;
|
|
440
441
|
readonly executionId: string;
|
|
441
442
|
readonly runId: string;
|
|
442
443
|
readonly workflowName: string;
|
|
443
444
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
444
|
-
readonly generation: string;
|
|
445
445
|
readonly owner: {
|
|
446
446
|
readonly tenantId: string | null;
|
|
447
447
|
} | null;
|
|
@@ -475,12 +475,12 @@ declare const dispatchWorkflowResume: (options: {
|
|
|
475
475
|
readonly generation: string;
|
|
476
476
|
readonly enteredAt: number;
|
|
477
477
|
} | null;
|
|
478
|
+
readonly generation: string;
|
|
478
479
|
readonly requestedAt: number;
|
|
479
480
|
readonly executionId: string;
|
|
480
481
|
readonly runId: string;
|
|
481
482
|
readonly workflowName: string;
|
|
482
483
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
483
|
-
readonly generation: string;
|
|
484
484
|
readonly owner: {
|
|
485
485
|
readonly tenantId: string | null;
|
|
486
486
|
} | null;
|
|
@@ -514,12 +514,12 @@ declare const dispatchWorkflowResume: (options: {
|
|
|
514
514
|
readonly generation: string;
|
|
515
515
|
readonly enteredAt: number;
|
|
516
516
|
} | null;
|
|
517
|
+
readonly generation: string;
|
|
517
518
|
readonly requestedAt: number;
|
|
518
519
|
readonly executionId: string;
|
|
519
520
|
readonly runId: string;
|
|
520
521
|
readonly workflowName: string;
|
|
521
522
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
522
|
-
readonly generation: string;
|
|
523
523
|
readonly owner: {
|
|
524
524
|
readonly tenantId: string | null;
|
|
525
525
|
} | null;
|
|
@@ -553,12 +553,12 @@ declare const dispatchWorkflowResume: (options: {
|
|
|
553
553
|
readonly generation: string;
|
|
554
554
|
readonly enteredAt: number;
|
|
555
555
|
} | null;
|
|
556
|
+
readonly generation: string;
|
|
556
557
|
readonly requestedAt: number;
|
|
557
558
|
readonly executionId: string;
|
|
558
559
|
readonly runId: string;
|
|
559
560
|
readonly workflowName: string;
|
|
560
561
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
561
|
-
readonly generation: string;
|
|
562
562
|
readonly owner: {
|
|
563
563
|
readonly tenantId: string | null;
|
|
564
564
|
} | null;
|
|
@@ -592,12 +592,12 @@ declare const dispatchWorkflowResume: (options: {
|
|
|
592
592
|
readonly generation: string;
|
|
593
593
|
readonly enteredAt: number;
|
|
594
594
|
} | null;
|
|
595
|
+
readonly generation: string;
|
|
595
596
|
readonly requestedAt: number;
|
|
596
597
|
readonly executionId: string;
|
|
597
598
|
readonly runId: string;
|
|
598
599
|
readonly workflowName: string;
|
|
599
600
|
readonly operation: "resume" | "cancel" | "terminate";
|
|
600
|
-
readonly generation: string;
|
|
601
601
|
readonly owner: {
|
|
602
602
|
readonly tenantId: string | null;
|
|
603
603
|
} | null;
|
|
@@ -633,12 +633,12 @@ declare const dispatchWorkflowResume: (options: {
|
|
|
633
633
|
readonly generation: string;
|
|
634
634
|
readonly enteredAt: number;
|
|
635
635
|
} | null;
|
|
636
|
+
generation: string;
|
|
636
637
|
requestedAt: number;
|
|
637
638
|
executionId: string;
|
|
638
639
|
runId: string;
|
|
639
640
|
workflowName: string;
|
|
640
641
|
operation: "resume" | "cancel" | "terminate";
|
|
641
|
-
generation: string;
|
|
642
642
|
owner: {
|
|
643
643
|
readonly tenantId: string | null;
|
|
644
644
|
} | null;
|
package/dist/cluster.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "./cluster-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "./cluster-Doetj9Bb.js";
|
|
2
2
|
export { e as DEFAULT_RUNNER_LISTEN_PORT, i as WorkflowResumeDispatcher, p as activityPrimaryKey, l as detectWsrepCluster, a as makeClusterCronLayer, s as makeClusterDiagnostics, f as parseShardLockMode, t as pollWorkflowStorage, c as redriveFailedRun, o as resolveFailoverTuning, m as resolveRunnerIdentity, n as resolveRunnerStorage, r as resolveShardLockDisableAdvisory, d as resumeRunFromStep, u as workflowEngineLayer };
|
|
@@ -67,11 +67,11 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
}, b = async (e, t) => {
|
|
70
|
-
let n;
|
|
70
|
+
let n = [], i;
|
|
71
71
|
for (;;) {
|
|
72
|
-
let
|
|
72
|
+
let l = await e({
|
|
73
73
|
table: c,
|
|
74
|
-
predicate: r(a("runId", t.runId), a("workflowName", t.workflowName), a("executionId", t.executionId), a("generation", t.generation), s(a("operation", "cancel"), a("operation", "terminate")), ...
|
|
74
|
+
predicate: r(a("runId", t.runId), a("workflowName", t.workflowName), a("executionId", t.executionId), a("generation", t.generation), s(a("operation", "cancel"), a("operation", "terminate")), ...i === void 0 ? [] : [o("id", i)]),
|
|
75
75
|
order: [{
|
|
76
76
|
column: "id",
|
|
77
77
|
direction: "asc"
|
|
@@ -80,14 +80,30 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
80
80
|
skip: void 0,
|
|
81
81
|
projection: void 0
|
|
82
82
|
});
|
|
83
|
-
for (let e of
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
for (let e of l) {
|
|
84
|
+
let t = v(e);
|
|
85
|
+
t.result === null && n.push(t);
|
|
86
|
+
}
|
|
87
|
+
if (l.length < 100) return n;
|
|
88
|
+
i = v(l[l.length - 1]).id;
|
|
86
89
|
}
|
|
87
|
-
}, x = (e, t) => b((t) => e.query({
|
|
90
|
+
}, x = async (e, t) => (await b(e, t)).length > 0, S = (e, t) => x((t) => e.query({
|
|
88
91
|
...t,
|
|
89
92
|
lock: "update"
|
|
90
|
-
}), t),
|
|
93
|
+
}), t), C = {
|
|
94
|
+
source: "flow-control",
|
|
95
|
+
timeout: "finish"
|
|
96
|
+
}, w = n.Struct({
|
|
97
|
+
reason: n.NonEmptyString,
|
|
98
|
+
detail: n.Struct({
|
|
99
|
+
source: n.Literal("flow-control"),
|
|
100
|
+
timeout: n.Literal("finish"),
|
|
101
|
+
onFailure: n.NullOr(n.NonEmptyString)
|
|
102
|
+
})
|
|
103
|
+
}), T = (e) => {
|
|
104
|
+
let t = n.decodeUnknownOption(w)(e.cause);
|
|
105
|
+
return t._tag === "Some" ? t.value : void 0;
|
|
106
|
+
}, E = async (e, t) => {
|
|
91
107
|
let [n] = await e.query({
|
|
92
108
|
table: c,
|
|
93
109
|
predicate: a("id", t),
|
|
@@ -98,7 +114,7 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
98
114
|
projection: void 0
|
|
99
115
|
});
|
|
100
116
|
if (n !== void 0) return v(n);
|
|
101
|
-
},
|
|
117
|
+
}, D = async (e, t) => {
|
|
102
118
|
let n;
|
|
103
119
|
for (;;) {
|
|
104
120
|
let i = await e.query({
|
|
@@ -121,7 +137,7 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
121
137
|
}
|
|
122
138
|
if (i.length < 100) return !1;
|
|
123
139
|
}
|
|
124
|
-
},
|
|
140
|
+
}, O = async (e, t) => {
|
|
125
141
|
let r = n.decodeUnknownSync(g)({
|
|
126
142
|
...t,
|
|
127
143
|
owner: null,
|
|
@@ -129,7 +145,7 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
129
145
|
dispatchAttempts: 0,
|
|
130
146
|
resumeJournal: null,
|
|
131
147
|
result: null
|
|
132
|
-
}), i = await
|
|
148
|
+
}), i = await E(e, r.id);
|
|
133
149
|
if (i !== void 0) {
|
|
134
150
|
if (i.runId !== r.runId || i.workflowName !== r.workflowName || i.executionId !== r.executionId || i.generation !== r.generation || i.operation !== r.operation) throw Error("Workflow control identity belongs to a different target or operation");
|
|
135
151
|
return i;
|
|
@@ -165,8 +181,8 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
165
181
|
requestedAt: o,
|
|
166
182
|
parentClosureId: p
|
|
167
183
|
}), d.result !== null && await y(e, d, d.result, r.requestedAt), d;
|
|
168
|
-
},
|
|
169
|
-
let i = await
|
|
184
|
+
}, k = async (e, t, r) => {
|
|
185
|
+
let i = await E(e, t);
|
|
170
186
|
if (i === void 0) throw Error("Workflow control request is missing");
|
|
171
187
|
if (i.operation !== "resume") throw Error("Only resume controls can bind a suspension journal");
|
|
172
188
|
if (i.result !== null) return {
|
|
@@ -233,8 +249,8 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
233
249
|
resumeJournal: l
|
|
234
250
|
}
|
|
235
251
|
};
|
|
236
|
-
},
|
|
237
|
-
let n = await
|
|
252
|
+
}, A = async (e, t) => {
|
|
253
|
+
let n = await E(e, t);
|
|
238
254
|
if (n === void 0) throw Error("Workflow control request is missing");
|
|
239
255
|
if (n.result !== null) return {
|
|
240
256
|
kind: "settled",
|
|
@@ -274,7 +290,7 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
274
290
|
dispatchAttempts: i
|
|
275
291
|
}
|
|
276
292
|
};
|
|
277
|
-
},
|
|
293
|
+
}, j = async (e, t) => {
|
|
278
294
|
let i = t.owner, s;
|
|
279
295
|
for (;;) {
|
|
280
296
|
let l = await e.query({
|
|
@@ -291,7 +307,7 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
291
307
|
});
|
|
292
308
|
for (let r of l) {
|
|
293
309
|
if (typeof r.id != "string") throw Error("Workflow control request has an invalid identity");
|
|
294
|
-
let i = await
|
|
310
|
+
let i = await E(e, r.id);
|
|
295
311
|
if (i === void 0) throw Error("Workflow control request disappeared during completion");
|
|
296
312
|
if (i.result !== null) continue;
|
|
297
313
|
let a = t.outcome;
|
|
@@ -309,7 +325,7 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
309
325
|
if (typeof u.id != "string") throw Error("Workflow control cursor has an invalid identity");
|
|
310
326
|
s = u.id;
|
|
311
327
|
}
|
|
312
|
-
},
|
|
328
|
+
}, M = async (e, t, i, s) => {
|
|
313
329
|
let l = n.decodeUnknownSync(d)({
|
|
314
330
|
kind: "confirmed",
|
|
315
331
|
status: "running",
|
|
@@ -331,7 +347,7 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
331
347
|
});
|
|
332
348
|
for (let t of n) {
|
|
333
349
|
if (typeof t.id != "string") throw Error("Workflow control request has an invalid identity");
|
|
334
|
-
let n = await
|
|
350
|
+
let n = await E(e, t.id);
|
|
335
351
|
if (n === void 0) throw Error("Workflow control request disappeared during resume");
|
|
336
352
|
n.result === null && await y(e, n, l, s);
|
|
337
353
|
}
|
|
@@ -340,7 +356,7 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
340
356
|
if (typeof i.id != "string") throw Error("Workflow control cursor has an invalid identity");
|
|
341
357
|
u = i.id;
|
|
342
358
|
}
|
|
343
|
-
},
|
|
359
|
+
}, N = "voltro-workflow-restart", P = class extends e.Tag("voltro/CurrentWorkflowDelivery")() {}, F = (e) => ({
|
|
344
360
|
...e,
|
|
345
361
|
registerEntity: (n, r, i) => e.registerEntity(n, n.type.startsWith("Workflow/") ? r.pipe(t.map((e) => {
|
|
346
362
|
let n = e.run;
|
|
@@ -355,11 +371,11 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
355
371
|
return t.suspend(() => {
|
|
356
372
|
let r = n(e);
|
|
357
373
|
return t.isEffect(r) ? r : t.die(/* @__PURE__ */ Error("Workflow run handler must return an Effect"));
|
|
358
|
-
}).pipe(t.provideService(
|
|
374
|
+
}).pipe(t.provideService(P, r));
|
|
359
375
|
}
|
|
360
376
|
};
|
|
361
377
|
})) : r, i)
|
|
362
|
-
}),
|
|
378
|
+
}), I = 6e5, L = class extends e.Tag("@voltro/workflow/ClusterDiagnostics")() {}, R = (e, n, r = Date.now()) => t.flatMap(e.messagesFor(n), (n) => {
|
|
363
379
|
if (n.length === 0) return t.succeed(void 0);
|
|
364
380
|
let i = [...new Set(n.filter((e) => !e.processed).map((e) => e.shardId))], a = i.length === 0 ? t.succeed([]) : e.shardLockHolders(i);
|
|
365
381
|
return t.map(a, (t) => ({
|
|
@@ -376,4 +392,4 @@ var c = "_voltro_workflow_control_requests", l = n.String.pipe(n.minLength(1)),
|
|
|
376
392
|
}));
|
|
377
393
|
});
|
|
378
394
|
//#endregion
|
|
379
|
-
export {
|
|
395
|
+
export { j as _, N as a, O as c, T as d, S as f, E as g, b as h, P as i, A as l, x as m, L as n, F as o, D as p, R as r, C as s, I as t, k as u, M as v };
|
package/dist/clusterTestSuite.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as e, L as t, S as n, g as r, v as i } from "./primitives-
|
|
2
|
-
import { r as a } from "./src-
|
|
3
|
-
import { i as o, p as s } from "./cluster-
|
|
1
|
+
import { F as e, L as t, S as n, g as r, v as i } from "./primitives-bv2JHUfk.js";
|
|
2
|
+
import { r as a } from "./src-BnF1JtbZ.js";
|
|
3
|
+
import { i as o, p as s } from "./cluster-Doetj9Bb.js";
|
|
4
4
|
import { Cron as c, Deferred as l, Effect as u, Fiber as d, Layer as f, Schema as p } from "effect";
|
|
5
5
|
import { SqlClient as m } from "@effect/sql";
|
|
6
6
|
import { beforeAll as h, describe as g, expect as _, test as v } from "vitest";
|