@rotorsoft/act-tck 1.38.10 → 1.38.12
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/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/store-tck.d.ts.map +1 -1
- package/dist/index.cjs +49 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +50 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-tck.d.ts","sourceRoot":"","sources":["../../src/store-tck.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAQV,KAAK,EAIN,MAAM,sBAAsB,CAAC;AAc9B;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IACxC;;;;;;;;OAQG;IACH,QAAQ,CAAC,gCAAgC,CAAC,EAAE,OAAO,CAAC;IACpD;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,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E,OAAO,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/C;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IACxD;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,WAAW,YAAa,eAAe,KAAG,IA0wKtD,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -2653,6 +2653,30 @@ var runStoreTck = (options) => {
|
|
|
2653
2653
|
(0, import_vitest9.expect)(leased.find((l) => l.stream === ctl)).toBeDefined();
|
|
2654
2654
|
(0, import_vitest9.expect)(leased.find((l) => l.stream === s)).toBeUndefined();
|
|
2655
2655
|
});
|
|
2656
|
+
(0, import_vitest9.it)("judges deferred_at by the claiming worker's clock", async () => {
|
|
2657
|
+
const s = `defer-clock-${uid()}`;
|
|
2658
|
+
await store.subscribe([{ stream: s }]);
|
|
2659
|
+
await store.commit(
|
|
2660
|
+
s,
|
|
2661
|
+
[inc(1)],
|
|
2662
|
+
make_meta({ stream: s })
|
|
2663
|
+
);
|
|
2664
|
+
(0, import_vitest9.expect)(await store.defer([s], Date.now() + 6e4)).toBe(1);
|
|
2665
|
+
await correlate();
|
|
2666
|
+
import_vitest9.vi.useFakeTimers({
|
|
2667
|
+
toFake: ["Date"],
|
|
2668
|
+
shouldAdvanceTime: true,
|
|
2669
|
+
now: Date.now() + 12e4
|
|
2670
|
+
});
|
|
2671
|
+
try {
|
|
2672
|
+
const leased = await store.claim(100, 100, `w-${uid()}`, 1);
|
|
2673
|
+
const mine = leased.find((l) => l.stream === s);
|
|
2674
|
+
(0, import_vitest9.expect)(mine).toBeDefined();
|
|
2675
|
+
await store.ack(leased);
|
|
2676
|
+
} finally {
|
|
2677
|
+
import_vitest9.vi.useRealTimers();
|
|
2678
|
+
}
|
|
2679
|
+
});
|
|
2656
2680
|
(0, import_vitest9.it)("makes a stream claimable once the deferred_at is in the past", async () => {
|
|
2657
2681
|
const s = `defer-past-${uid()}`;
|
|
2658
2682
|
await store.subscribe([{ stream: s }]);
|
|
@@ -4524,6 +4548,31 @@ var runStoreTck = (options) => {
|
|
|
4524
4548
|
await cache.dispose();
|
|
4525
4549
|
}
|
|
4526
4550
|
};
|
|
4551
|
+
(0, import_vitest9.it)("resets every correlate checkpoint, since the restored log is renumbered", async () => {
|
|
4552
|
+
const correlator = {
|
|
4553
|
+
key: `k-${uid()}`,
|
|
4554
|
+
by: `w-${uid()}`,
|
|
4555
|
+
millis: 6e4
|
|
4556
|
+
};
|
|
4557
|
+
await store.subscribe([], 50);
|
|
4558
|
+
await store.subscribe([], 50, correlator);
|
|
4559
|
+
(0, import_vitest9.expect)((await store.subscribe([])).correlated_at).toBe(50);
|
|
4560
|
+
const s = `restore-cp-${uid()}`;
|
|
4561
|
+
const t = /* @__PURE__ */ new Date("2020-01-01T00:00:00.000Z");
|
|
4562
|
+
const result = await restore(
|
|
4563
|
+
as_source([
|
|
4564
|
+
event(1, s, 0, "Incremented", t, { amount: 1 }),
|
|
4565
|
+
event(2, s, 1, "Incremented", t, { amount: 1 })
|
|
4566
|
+
])
|
|
4567
|
+
);
|
|
4568
|
+
(0, import_vitest9.expect)(result.kept).toBe(2);
|
|
4569
|
+
const restored = await collect(store, { limit: 10 });
|
|
4570
|
+
const min_id = Math.min(...restored.map((e) => e.id));
|
|
4571
|
+
const shared = (await store.subscribe([])).correlated_at;
|
|
4572
|
+
const keyed = (await store.subscribe([], void 0, correlator)).correlated_at;
|
|
4573
|
+
(0, import_vitest9.expect)(shared).toBeLessThan(min_id);
|
|
4574
|
+
(0, import_vitest9.expect)(keyed).toBeLessThan(min_id);
|
|
4575
|
+
});
|
|
4527
4576
|
(0, import_vitest9.it)("returns kept=0 on an empty source", async () => {
|
|
4528
4577
|
const result = await restore(as_source([]));
|
|
4529
4578
|
(0, import_vitest9.expect)(result.kept).toBe(0);
|