@voltro/workflow 0.33.0 → 0.34.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 +1801 -0
- package/dist/clusterTestSuite.js +28 -28
- package/dist/index.d.ts +509 -6
- package/dist/index.js +3 -3
- package/dist/{primitives-Bp98_F5L.js → primitives-oLKOTbvJ.js} +131 -76
- package/dist/primitives.d.ts +145 -5
- package/dist/primitives.js +2 -2
- package/dist/{src-CP61KZ9V.js → src-BXObaqb-.js} +912 -493
- package/package.json +3 -3
package/dist/clusterTestSuite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { A as e, M as t, S as n, g as r, v as i } from "./primitives-oLKOTbvJ.js";
|
|
2
|
+
import { o as a } from "./src-BXObaqb-.js";
|
|
3
3
|
import { i as o, p as s } from "./cluster-CyIyBO39.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";
|
|
@@ -59,39 +59,39 @@ var y = async (e, t, n = 750) => {
|
|
|
59
59
|
await x(m);
|
|
60
60
|
}, 3e4), v("a two-step workflow runs end-to-end", async () => {
|
|
61
61
|
if (!s) return;
|
|
62
|
-
let e = `clusterTwoStep_${y}`,
|
|
62
|
+
let e = `clusterTwoStep_${y}`, t = n({
|
|
63
63
|
name: e,
|
|
64
64
|
payload: { id: p.String },
|
|
65
65
|
success: p.Number,
|
|
66
66
|
idempotencyKey: ({ id: t }) => `${e}:${t}`
|
|
67
|
-
}), r =
|
|
68
|
-
let e = yield*
|
|
67
|
+
}), r = t.toLayer(() => u.gen(function* () {
|
|
68
|
+
let e = yield* i({
|
|
69
69
|
name: "first",
|
|
70
70
|
success: p.Number,
|
|
71
71
|
execute: u.succeed(40)
|
|
72
72
|
});
|
|
73
|
-
return yield*
|
|
73
|
+
return yield* i({
|
|
74
74
|
name: "second",
|
|
75
75
|
success: p.Number,
|
|
76
76
|
execute: u.succeed(e + 2)
|
|
77
77
|
});
|
|
78
78
|
}));
|
|
79
|
-
_(await u.runPromise(u.scoped(
|
|
79
|
+
_(await u.runPromise(u.scoped(t.execute({ id: `e2e-${y}` }).pipe(u.provide(r.pipe(f.provideMerge(b(m.runnerPort)))))))).toBe(42);
|
|
80
80
|
}, 3e4), v("idempotency-key journal — same payload returns same result", async () => {
|
|
81
81
|
if (!s) return;
|
|
82
|
-
let e = `clusterIdempotency_${y}`,
|
|
82
|
+
let e = `clusterIdempotency_${y}`, t = 0, r = n({
|
|
83
83
|
name: e,
|
|
84
84
|
payload: { id: p.String },
|
|
85
85
|
success: p.Number,
|
|
86
86
|
idempotencyKey: ({ id: t }) => `${e}:${t}`
|
|
87
|
-
}), a = r.toLayer(() =>
|
|
87
|
+
}), a = r.toLayer(() => i({
|
|
88
88
|
name: "compute",
|
|
89
89
|
success: p.Number,
|
|
90
|
-
execute: u.sync(() => (
|
|
90
|
+
execute: u.sync(() => (t++, t * 100))
|
|
91
91
|
})).pipe(f.provideMerge(b(m.runnerPort))), [o, c] = await u.runPromise(u.scoped(u.gen(function* () {
|
|
92
92
|
return [yield* r.execute({ id: `same-${y}` }), yield* r.execute({ id: `same-${y}` })];
|
|
93
93
|
}).pipe(u.provide(a))));
|
|
94
|
-
_(o).toBe(c), _(
|
|
94
|
+
_(o).toBe(c), _(t).toBe(1);
|
|
95
95
|
}, 3e4), v("ClusterCron fires its execute on the shard owner", async () => {
|
|
96
96
|
if (!s) return;
|
|
97
97
|
let e = await u.runPromise(l.make()), t = 0, n = o({
|
|
@@ -108,32 +108,32 @@ var y = async (e, t, n = 750) => {
|
|
|
108
108
|
let g = m.clusterResume ? v : (() => {});
|
|
109
109
|
g("a sleeping workflow resumes on a fresh runner after the first is torn down", async () => {
|
|
110
110
|
if (!s) return;
|
|
111
|
-
let e = `dormancyResume_${y}`,
|
|
111
|
+
let e = `dormancyResume_${y}`, t = [], a = [], o = [], c = () => n({
|
|
112
112
|
name: e,
|
|
113
113
|
payload: { id: p.String },
|
|
114
114
|
success: p.String,
|
|
115
115
|
idempotencyKey: ({ id: t }) => `${e}:${t}`
|
|
116
|
-
}), l = (e,
|
|
117
|
-
return yield*
|
|
116
|
+
}), l = (e, n) => e.toLayer(() => u.gen(function* () {
|
|
117
|
+
return yield* i({
|
|
118
118
|
name: "step1",
|
|
119
119
|
success: p.Void,
|
|
120
120
|
execute: u.sync(() => {
|
|
121
|
-
|
|
121
|
+
t.push(n);
|
|
122
122
|
})
|
|
123
|
-
}), yield*
|
|
123
|
+
}), yield* i({
|
|
124
124
|
name: "armed",
|
|
125
125
|
success: p.Void,
|
|
126
126
|
execute: u.sync(() => {
|
|
127
|
-
o.push(
|
|
127
|
+
o.push(n);
|
|
128
128
|
})
|
|
129
|
-
}), yield*
|
|
129
|
+
}), yield* r({
|
|
130
130
|
name: "nap",
|
|
131
131
|
duration: S
|
|
132
|
-
}), yield*
|
|
132
|
+
}), yield* i({
|
|
133
133
|
name: "step2",
|
|
134
134
|
success: p.Void,
|
|
135
135
|
execute: u.sync(() => {
|
|
136
|
-
a.push(
|
|
136
|
+
a.push(n);
|
|
137
137
|
})
|
|
138
138
|
}), "done";
|
|
139
139
|
})), h = m.runnerPort + 2, g = (e) => {
|
|
@@ -146,10 +146,10 @@ var y = async (e, t, n = 750) => {
|
|
|
146
146
|
let { wf: e, layer: t } = g("A"), n = yield* f.build(t), r = yield* u.forkDaemon(e.execute(v).pipe(u.provide(n), u.ignore));
|
|
147
147
|
return (yield* w(() => o.length > 0, 6e4)) ? r : yield* u.die(/* @__PURE__ */ Error("runner A never journaled step1"));
|
|
148
148
|
})));
|
|
149
|
-
await u.runPromise(d.interrupt(x).pipe(u.ignore)), _(
|
|
149
|
+
await u.runPromise(d.interrupt(x).pipe(u.ignore)), _(t).toEqual(["A"]), _(a).toEqual([]), _(await u.runPromise(u.scoped(u.gen(function* () {
|
|
150
150
|
let { wf: e, layer: t } = g("B"), n = yield* f.build(t);
|
|
151
151
|
return yield* e.execute(v).pipe(u.provide(n), u.timeout("240 seconds"), u.orElseSucceed(() => "TIMEOUT"));
|
|
152
|
-
})))).toBe("done"), _(
|
|
152
|
+
})))).toBe("done"), _(t).toEqual(["A"]), _(a).toEqual(["B"]);
|
|
153
153
|
}, 48e4), g("dormancy loop: a wake signal survives teardown and is cleared on resume", async () => {
|
|
154
154
|
if (!s) return;
|
|
155
155
|
let o = `dormancyLoop_${y}`, c = `wr_${o}`, l = [], h = /* @__PURE__ */ new Map(), g = a({
|
|
@@ -166,27 +166,27 @@ var y = async (e, t, n = 750) => {
|
|
|
166
166
|
h.delete(e);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
}), v = () =>
|
|
169
|
+
}), v = () => n({
|
|
170
170
|
name: o,
|
|
171
171
|
payload: { id: p.String },
|
|
172
172
|
success: p.String,
|
|
173
173
|
idempotencyKey: ({ id: e }) => `${o}:${e}`
|
|
174
|
-
}), x = (
|
|
175
|
-
return yield*
|
|
174
|
+
}), x = (n, a) => n.toLayer(() => u.gen(function* () {
|
|
175
|
+
return yield* i({
|
|
176
176
|
name: "step1",
|
|
177
177
|
success: p.Void,
|
|
178
178
|
execute: u.void
|
|
179
|
-
}), yield*
|
|
179
|
+
}), yield* r({
|
|
180
180
|
name: "nap",
|
|
181
181
|
duration: C
|
|
182
|
-
}), yield*
|
|
182
|
+
}), yield* i({
|
|
183
183
|
name: "step2",
|
|
184
184
|
success: p.Void,
|
|
185
185
|
execute: u.sync(() => {
|
|
186
186
|
l.push(a);
|
|
187
187
|
})
|
|
188
188
|
}), "done";
|
|
189
|
-
}).pipe(u.locally(
|
|
189
|
+
}).pipe(u.locally(e, c), u.provideService(t, g))), S = m.runnerPort + 2, T = (e) => {
|
|
190
190
|
let t = v();
|
|
191
191
|
return {
|
|
192
192
|
wf: t,
|