@yieldstar/runtime-conformance 0.6.0 → 0.7.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/dist/execution.d.ts.map +1 -1
- package/dist/index.js +29 -14
- package/package.json +2 -2
package/dist/execution.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,OAAO,EAGb,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,kCAAkC,GAAG;IAC/C;;;OAGG;IACH,KAAK,EAAE,MAAM,MAAM,CAAC;CACrB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,2EAA2E;IAC3E,OAAO,CAAC,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC;;;;OAIG;IACH,gBAAgB,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACxF,OAAO,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CACJ,OAAO,EAAE,kCAAkC,GAC1C,2BAA2B,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;CACvE,CAAC;AAwDF;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,EACjD,IAAI,EACJ,MAAM,GACP,EAAE,2BAA2B,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,OAAO,EAGb,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,kCAAkC,GAAG;IAC/C;;;OAGG;IACH,KAAK,EAAE,MAAM,MAAM,CAAC;CACrB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,2EAA2E;IAC3E,OAAO,CAAC,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC;;;;OAIG;IACH,gBAAgB,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACxF,OAAO,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CACJ,OAAO,EAAE,kCAAkC,GAC1C,2BAA2B,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;CACvE,CAAC;AAwDF;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,EACjD,IAAI,EACJ,MAAM,GACP,EAAE,2BAA2B,GAAG,IAAI,CA8+DpC"}
|
package/dist/index.js
CHANGED
|
@@ -202,7 +202,7 @@ function registerEffectClientConformance({
|
|
|
202
202
|
["an empty effect ID", { effectId: "" }],
|
|
203
203
|
["an empty operation", { operation: "" }],
|
|
204
204
|
["array input", { input: [] }],
|
|
205
|
-
["
|
|
205
|
+
["an invalid Date in the input", { input: { at: new Date(Number.NaN) } }],
|
|
206
206
|
["a non-finite number in the input", { input: { amount: Number.NaN } }],
|
|
207
207
|
["an empty execution ID", { executionId: "" }],
|
|
208
208
|
["an empty step key", { stepKey: "" }]
|
|
@@ -379,7 +379,7 @@ function registerEffectClientConformance({
|
|
|
379
379
|
expect(await runtime.effects.getEffect("pay:unknown")).toBeUndefined();
|
|
380
380
|
await begin(runtime, "pay:invariant");
|
|
381
381
|
await expectInvariant(settle(runtime, "pay:invariant", "result", "charge-v2"));
|
|
382
|
-
await expectInvariant(settle(runtime, "pay:invariant", { at: new Date(
|
|
382
|
+
await expectInvariant(settle(runtime, "pay:invariant", { at: new Date(Number.NaN) }));
|
|
383
383
|
expect(await runtime.effects.getEffect("pay:invariant")).toMatchObject({
|
|
384
384
|
status: "pending"
|
|
385
385
|
});
|
|
@@ -956,16 +956,15 @@ function registerExecutionClientConformance({
|
|
|
956
956
|
const cyclic = {};
|
|
957
957
|
cyclic.self = cyclic;
|
|
958
958
|
const invalidEvents = [
|
|
959
|
-
["
|
|
959
|
+
["an invalid Date", { params: { at: new Date(NaN) }, context: new Map }],
|
|
960
960
|
["a class instance", { params: { point: new Point(1) }, context: new Map }],
|
|
961
961
|
["NaN", { params: { n: NaN }, context: new Map }],
|
|
962
962
|
["Infinity", { params: { n: Infinity }, context: new Map }],
|
|
963
|
-
["a bigint", { params: { n: 10n }, context: new Map }],
|
|
964
963
|
["a function", { params: { fn: () => 1 }, context: new Map }],
|
|
965
|
-
["a Map", { params: { map: new Map([["a", 1]]) }, context: new Map }],
|
|
964
|
+
["a function in a Map", { params: { map: new Map([["a", () => 1]]) }, context: new Map }],
|
|
966
965
|
["a sparse array", { params: { list: [1, , 3] }, context: new Map }],
|
|
967
966
|
["a cycle", { params: cyclic, context: new Map }],
|
|
968
|
-
["a
|
|
967
|
+
["a class instance in context", { params: {}, context: new Map([["at", new Point(1)]]) }],
|
|
969
968
|
["an object context key", { params: {}, context: new Map([[{}, 1]]) }],
|
|
970
969
|
["a number context key", { params: {}, context: new Map([[7, 1]]) }]
|
|
971
970
|
];
|
|
@@ -1405,7 +1404,7 @@ function registerExecutionClientConformance({
|
|
|
1405
1404
|
const lease = await claimOne(runtime, "invalid-result");
|
|
1406
1405
|
const acknowledged = await runtime.executions.acknowledge({
|
|
1407
1406
|
lease,
|
|
1408
|
-
outcome: { status: "completed", result: {
|
|
1407
|
+
outcome: { status: "completed", result: { point: new Point(1) } }
|
|
1409
1408
|
});
|
|
1410
1409
|
const record = await runtime.executions.get("invalid-result");
|
|
1411
1410
|
expect2(record.status).toBe("failed");
|
|
@@ -1520,6 +1519,23 @@ function registerExecutionClientConformance({
|
|
|
1520
1519
|
]);
|
|
1521
1520
|
expect2((await claim(runtime, 2)).map((lease) => lease.executionId)).toEqual(["late"]);
|
|
1522
1521
|
});
|
|
1522
|
+
it("claims only the requested executions and leaves the others due and unclaimed", async ({
|
|
1523
|
+
runtime
|
|
1524
|
+
}) => {
|
|
1525
|
+
for (const id of ["a", "b", "c", "d"])
|
|
1526
|
+
await admit(runtime, id);
|
|
1527
|
+
const claimIds = (executionIds) => runtime.executions.claimDue({ limit: 100, duration: LEASE2, filter: { executionIds } });
|
|
1528
|
+
expect2(await claimIds([])).toEqual([]);
|
|
1529
|
+
const leases = await claimIds(["d", "b", "unknown"]);
|
|
1530
|
+
expect2(leases.map((lease) => lease.executionId).sort()).toEqual(["b", "d"]);
|
|
1531
|
+
for (const id of ["a", "c"]) {
|
|
1532
|
+
expect2(await runtime.executions.get(id)).toMatchObject({
|
|
1533
|
+
status: "admitted",
|
|
1534
|
+
unacknowledgedDeliveryCount: 0
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
expect2(await claimedIds(runtime)).toEqual(["a", "c"]);
|
|
1538
|
+
});
|
|
1523
1539
|
it("marks a claimed execution running", async ({ runtime }) => {
|
|
1524
1540
|
await admit(runtime, "running");
|
|
1525
1541
|
expect2(await runtime.executions.get("running")).toMatchObject({ status: "admitted" });
|
|
@@ -2194,17 +2210,16 @@ function registerExecutionClientConformance({
|
|
|
2194
2210
|
});
|
|
2195
2211
|
const hidden = Object.defineProperty({}, "value", { value: 1, enumerable: false });
|
|
2196
2212
|
const invalidParams = [
|
|
2197
|
-
["
|
|
2213
|
+
["an invalid Date", { at: new Date(NaN) }],
|
|
2198
2214
|
["a class instance", { point: new Point(1) }],
|
|
2199
2215
|
["NaN", { n: NaN }],
|
|
2200
2216
|
["Infinity", { n: Infinity }],
|
|
2201
|
-
["a bigint", { n: 10n }],
|
|
2202
2217
|
["a function", { fn: () => 1 }],
|
|
2203
2218
|
["a symbol", { s: Symbol("s") }],
|
|
2204
2219
|
["a symbol key", { [Symbol("s")]: 1 }],
|
|
2205
2220
|
["an accessor", { nested: accessor }],
|
|
2206
2221
|
["a non-enumerable property", { nested: hidden }],
|
|
2207
|
-
["a Map", { map: new Map([["a", 1]]) }],
|
|
2222
|
+
["a function in a Map", { map: new Map([["a", () => 1]]) }],
|
|
2208
2223
|
["a sparse array", { list: [1, , 3] }],
|
|
2209
2224
|
["a cycle", cyclic],
|
|
2210
2225
|
["an array as params", [1, 2]],
|
|
@@ -2541,7 +2556,7 @@ function registerStoreClientConformance({
|
|
|
2541
2556
|
const { stores } = harness.runtime;
|
|
2542
2557
|
const invalid = { code: "INVALID_STEP_VALUE", name: "WorkflowValueError" };
|
|
2543
2558
|
try {
|
|
2544
|
-
seed(Store, "never-created", { messages: [], unrelated: new Date(
|
|
2559
|
+
seed(Store, "never-created", { messages: [], unrelated: new Date(Number.NaN) });
|
|
2545
2560
|
await expect3(stores.getStore({ definition: Store, id: "never-created" })).rejects.toMatchObject(invalid);
|
|
2546
2561
|
await expect3(stores.updateStore({
|
|
2547
2562
|
definition: Store,
|
|
@@ -2562,14 +2577,14 @@ function registerStoreClientConformance({
|
|
|
2562
2577
|
stepId,
|
|
2563
2578
|
updater(draft) {
|
|
2564
2579
|
draft.messages.push({ id: "two" });
|
|
2565
|
-
draft.at = new
|
|
2580
|
+
draft.at = new Date(Number.NaN);
|
|
2566
2581
|
}
|
|
2567
2582
|
})).rejects.toMatchObject({ ...invalid, stepKey: "update" });
|
|
2568
2583
|
await expect3(stores.updateStoreFrom({
|
|
2569
2584
|
definition: Store,
|
|
2570
2585
|
id: "durable",
|
|
2571
2586
|
snapshot: created,
|
|
2572
|
-
updater: () => ({ messages: [], unrelated:
|
|
2587
|
+
updater: () => ({ messages: [], unrelated: Number.NaN })
|
|
2573
2588
|
})).rejects.toMatchObject(invalid);
|
|
2574
2589
|
expect3(await stores.getStore({ definition: Store, id: "durable" })).toMatchObject({
|
|
2575
2590
|
state: { messages: [{ id: "one" }] },
|
|
@@ -2583,7 +2598,7 @@ function registerStoreClientConformance({
|
|
|
2583
2598
|
await expect3(stores.takeFromStore({
|
|
2584
2599
|
definition: TakeStore,
|
|
2585
2600
|
id: "durable-take",
|
|
2586
|
-
selector: (state) => state.messages.length > 0 && new
|
|
2601
|
+
selector: (state) => state.messages.length > 0 && new Date(Number.NaN),
|
|
2587
2602
|
claim(draft) {
|
|
2588
2603
|
draft.messages = [];
|
|
2589
2604
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yieldstar/runtime-conformance",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Daniel Grant",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"vitest": "^3.2.4",
|
|
33
|
-
"@yieldstar/core": "0.
|
|
33
|
+
"@yieldstar/core": "0.7.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "bun build src/index.ts --outfile dist/index.js --target node --packages=external"
|