@iterativeflow/conformance 2.0.0-alpha.8 → 2.0.0-alpha.9
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/index.d.mts +8 -1
- package/dist/index.mjs +58 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -75,4 +75,11 @@ declare const cronConformance: (label: string, makeStore: () => Store | Promise<
|
|
|
75
75
|
*/
|
|
76
76
|
declare const engineConformance: (label: string, makeBackend: () => Backend | Promise<Backend>) => void;
|
|
77
77
|
//#endregion
|
|
78
|
-
|
|
78
|
+
//#region src/claim-filter.d.ts
|
|
79
|
+
/**
|
|
80
|
+
* `ClaimOpts.names` as executable invariants: a sharded worker leases only runs whose flow `name`
|
|
81
|
+
* it registered. Needs the store (to create named runs), so it takes the whole backend.
|
|
82
|
+
*/
|
|
83
|
+
declare const claimFilterConformance: (label: string, makeBackend: () => Backend$1 | Promise<Backend$1>) => void;
|
|
84
|
+
//#endregion
|
|
85
|
+
export { claimFilterConformance, cronConformance, engineConformance, outboxConformance, queueConformance, reconcileConformance, signalConformance, storeConformance, timerConformance, wakeupConformance };
|
package/dist/index.mjs
CHANGED
|
@@ -1927,4 +1927,61 @@ const engineConformance = (label, makeBackend) => {
|
|
|
1927
1927
|
});
|
|
1928
1928
|
};
|
|
1929
1929
|
//#endregion
|
|
1930
|
-
|
|
1930
|
+
//#region src/claim-filter.ts
|
|
1931
|
+
/**
|
|
1932
|
+
* `ClaimOpts.names` as executable invariants: a sharded worker leases only runs whose flow `name`
|
|
1933
|
+
* it registered. Needs the store (to create named runs), so it takes the whole backend.
|
|
1934
|
+
*/
|
|
1935
|
+
const claimFilterConformance = (label, makeBackend) => {
|
|
1936
|
+
describe(`Claim flow-name filter — ${label}`, () => {
|
|
1937
|
+
it("leases only runs whose flow name is in the set", async () => {
|
|
1938
|
+
const { store, queue } = await makeBackend();
|
|
1939
|
+
const a = await store.startRun({
|
|
1940
|
+
name: "flow-a",
|
|
1941
|
+
version: 1,
|
|
1942
|
+
input: {}
|
|
1943
|
+
});
|
|
1944
|
+
const b = await store.startRun({
|
|
1945
|
+
name: "flow-b",
|
|
1946
|
+
version: 1,
|
|
1947
|
+
input: {}
|
|
1948
|
+
});
|
|
1949
|
+
await queue.enqueue(a.runId);
|
|
1950
|
+
await queue.enqueue(b.runId);
|
|
1951
|
+
expect((await queue.claim({
|
|
1952
|
+
limit: 10,
|
|
1953
|
+
leaseMs: 1e3,
|
|
1954
|
+
names: ["flow-a"],
|
|
1955
|
+
now: at(0)
|
|
1956
|
+
})).map((l) => l.runId)).toEqual([a.runId]);
|
|
1957
|
+
expect((await queue.claim({
|
|
1958
|
+
limit: 10,
|
|
1959
|
+
leaseMs: 1e3,
|
|
1960
|
+
names: ["flow-b"],
|
|
1961
|
+
now: at(0)
|
|
1962
|
+
})).map((l) => l.runId)).toEqual([b.runId]);
|
|
1963
|
+
});
|
|
1964
|
+
it("an empty set leases nothing; an omitted set leases everything", async () => {
|
|
1965
|
+
const { store, queue } = await makeBackend();
|
|
1966
|
+
const a = await store.startRun({
|
|
1967
|
+
name: "flow-a",
|
|
1968
|
+
version: 1,
|
|
1969
|
+
input: {}
|
|
1970
|
+
});
|
|
1971
|
+
await queue.enqueue(a.runId);
|
|
1972
|
+
expect(await queue.claim({
|
|
1973
|
+
limit: 10,
|
|
1974
|
+
leaseMs: 1e3,
|
|
1975
|
+
names: [],
|
|
1976
|
+
now: at(0)
|
|
1977
|
+
})).toEqual([]);
|
|
1978
|
+
expect((await queue.claim({
|
|
1979
|
+
limit: 10,
|
|
1980
|
+
leaseMs: 1e3,
|
|
1981
|
+
now: at(0)
|
|
1982
|
+
})).map((l) => l.runId)).toEqual([a.runId]);
|
|
1983
|
+
});
|
|
1984
|
+
});
|
|
1985
|
+
};
|
|
1986
|
+
//#endregion
|
|
1987
|
+
export { claimFilterConformance, cronConformance, engineConformance, outboxConformance, queueConformance, reconcileConformance, signalConformance, storeConformance, timerConformance, wakeupConformance };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iterativeflow/conformance",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"build": "tsdown"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@iterativeflow/core": "2.0.0-alpha.
|
|
31
|
+
"@iterativeflow/core": "2.0.0-alpha.9"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"vitest": ">=3"
|