@rotorsoft/act-tck 1.27.7 → 1.27.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/.tsbuildinfo +1 -1
- package/dist/@types/store-tck.d.ts.map +1 -1
- package/dist/index.cjs +60 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +60 -44
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1218,6 +1218,46 @@ var runStoreTck = (options) => {
|
|
|
1218
1218
|
});
|
|
1219
1219
|
expect8(full).toHaveLength(2);
|
|
1220
1220
|
});
|
|
1221
|
+
it7("with_snaps applies the resume floor on a backward scan too", async () => {
|
|
1222
|
+
const s = `q-snap-back-${uid()}`;
|
|
1223
|
+
await store.commit(
|
|
1224
|
+
s,
|
|
1225
|
+
[inc(1), inc(1)],
|
|
1226
|
+
make_meta({ stream: s })
|
|
1227
|
+
);
|
|
1228
|
+
const [snap] = await store.commit(
|
|
1229
|
+
s,
|
|
1230
|
+
[{ name: SNAP_EVENT2, data: { count: 2 } }],
|
|
1231
|
+
make_meta({ stream: s })
|
|
1232
|
+
);
|
|
1233
|
+
await store.commit(
|
|
1234
|
+
s,
|
|
1235
|
+
[inc(1), inc(1), inc(1)],
|
|
1236
|
+
make_meta({ stream: s })
|
|
1237
|
+
);
|
|
1238
|
+
const backward = await collect(store, {
|
|
1239
|
+
stream: s,
|
|
1240
|
+
stream_exact: true,
|
|
1241
|
+
with_snaps: true,
|
|
1242
|
+
backward: true
|
|
1243
|
+
});
|
|
1244
|
+
expect8(backward).toHaveLength(4);
|
|
1245
|
+
expect8(backward[backward.length - 1].name).toBe(SNAP_EVENT2);
|
|
1246
|
+
expect8(backward.every((e) => e.id >= snap.id)).toBe(true);
|
|
1247
|
+
const s2 = `q-nosnap-back-${uid()}`;
|
|
1248
|
+
await store.commit(
|
|
1249
|
+
s2,
|
|
1250
|
+
[inc(1), inc(1)],
|
|
1251
|
+
make_meta({ stream: s2 })
|
|
1252
|
+
);
|
|
1253
|
+
const full = await collect(store, {
|
|
1254
|
+
stream: s2,
|
|
1255
|
+
stream_exact: true,
|
|
1256
|
+
with_snaps: true,
|
|
1257
|
+
backward: true
|
|
1258
|
+
});
|
|
1259
|
+
expect8(full).toHaveLength(2);
|
|
1260
|
+
});
|
|
1221
1261
|
it7("supports backward traversal", async () => {
|
|
1222
1262
|
const s = `q-back-${uid()}`;
|
|
1223
1263
|
const committed = await store.commit(
|
|
@@ -2322,7 +2362,7 @@ var runStoreTck = (options) => {
|
|
|
2322
2362
|
expect8(again.find((l) => l.stream === ctl)).toBeDefined();
|
|
2323
2363
|
expect8(again.find((l) => l.stream === s)).toBeUndefined();
|
|
2324
2364
|
});
|
|
2325
|
-
it7("holds the watermark and resets retry on
|
|
2365
|
+
it7("holds the watermark and resets retry on an explicit-defer due lease (retry: -1)", async () => {
|
|
2326
2366
|
const s = `ackdefer-past-${uid()}`;
|
|
2327
2367
|
await store.subscribe([{ stream: s }]);
|
|
2328
2368
|
await store.commit(
|
|
@@ -2332,7 +2372,7 @@ var runStoreTck = (options) => {
|
|
|
2332
2372
|
);
|
|
2333
2373
|
const leased = await store.claim(100, 100, `w-${uid()}`, 1e5);
|
|
2334
2374
|
const mine = leased.find((l) => l.stream === s);
|
|
2335
|
-
await store.ack([{ ...mine, due: Date.now() - 1e3 }]);
|
|
2375
|
+
await store.ack([{ ...mine, due: Date.now() - 1e3, retry: -1 }]);
|
|
2336
2376
|
const again = await store.claim(100, 100, `w-${uid()}`, 1e5);
|
|
2337
2377
|
const re = again.find((l) => l.stream === s);
|
|
2338
2378
|
expect8(re).toBeDefined();
|
|
@@ -2340,6 +2380,24 @@ var runStoreTck = (options) => {
|
|
|
2340
2380
|
expect8(re.retry).toBe(0);
|
|
2341
2381
|
await store.ack([{ ...re, at: 1e6 }]);
|
|
2342
2382
|
});
|
|
2383
|
+
it7("persists the lease's retry on a backoff-style due lease (#1262)", async () => {
|
|
2384
|
+
const s = `ackdefer-retry-${uid()}`;
|
|
2385
|
+
await store.subscribe([{ stream: s }]);
|
|
2386
|
+
await store.commit(
|
|
2387
|
+
s,
|
|
2388
|
+
[inc(1)],
|
|
2389
|
+
make_meta({ stream: s })
|
|
2390
|
+
);
|
|
2391
|
+
const leased = await store.claim(100, 100, `w-${uid()}`, 1e5);
|
|
2392
|
+
const mine = leased.find((l) => l.stream === s);
|
|
2393
|
+
await store.ack([{ ...mine, due: Date.now() - 1e3, retry: 3 }]);
|
|
2394
|
+
const again = await store.claim(100, 100, `w-${uid()}`, 1e5);
|
|
2395
|
+
const re = again.find((l) => l.stream === s);
|
|
2396
|
+
expect8(re).toBeDefined();
|
|
2397
|
+
expect8(re.at).toBe(mine.at);
|
|
2398
|
+
expect8(re.retry).toBe(4);
|
|
2399
|
+
await store.ack([{ ...re, at: 1e6 }]);
|
|
2400
|
+
});
|
|
2343
2401
|
it7("ignores due-marked entries from a non-holder", async () => {
|
|
2344
2402
|
const s = `ackdefer-owner-${uid()}`;
|
|
2345
2403
|
await store.subscribe([{ stream: s }]);
|
|
@@ -3985,48 +4043,6 @@ var runStoreTck = (options) => {
|
|
|
3985
4043
|
);
|
|
3986
4044
|
expect8(bwd).toEqual([10]);
|
|
3987
4045
|
});
|
|
3988
|
-
it7("time-travel query ignores a snapshot newer than the created cutoff", async () => {
|
|
3989
|
-
const s = `restore-tt-snap-${uid()}`;
|
|
3990
|
-
const t0 = /* @__PURE__ */ new Date("2020-01-01T00:00:00.000Z");
|
|
3991
|
-
const t1 = /* @__PURE__ */ new Date("2020-02-01T00:00:00.000Z");
|
|
3992
|
-
const tSnap = /* @__PURE__ */ new Date("2020-03-01T00:00:00.000Z");
|
|
3993
|
-
await restore(
|
|
3994
|
-
as_source([
|
|
3995
|
-
event(1, s, 0, "Incremented", t0, { amount: 1 }),
|
|
3996
|
-
event(2, s, 1, "Incremented", t1, { amount: 2 }),
|
|
3997
|
-
// Snapshot committed last → highest id and latest `created`.
|
|
3998
|
-
event(3, s, 2, SNAP_EVENT2, tSnap, { count: 3 })
|
|
3999
|
-
])
|
|
4000
|
-
);
|
|
4001
|
-
const cutoff = /* @__PURE__ */ new Date("2020-01-15T00:00:00.000Z");
|
|
4002
|
-
const before = [];
|
|
4003
|
-
await store.query(
|
|
4004
|
-
(e) => {
|
|
4005
|
-
before.push(e.data.amount);
|
|
4006
|
-
},
|
|
4007
|
-
{
|
|
4008
|
-
stream: s,
|
|
4009
|
-
stream_exact: true,
|
|
4010
|
-
with_snaps: true,
|
|
4011
|
-
created_before: cutoff
|
|
4012
|
-
}
|
|
4013
|
-
);
|
|
4014
|
-
expect8(before).toEqual([1]);
|
|
4015
|
-
const after = [];
|
|
4016
|
-
await store.query(
|
|
4017
|
-
(e) => {
|
|
4018
|
-
if (e.name !== SNAP_EVENT2)
|
|
4019
|
-
after.push(e.data.amount);
|
|
4020
|
-
},
|
|
4021
|
-
{
|
|
4022
|
-
stream: s,
|
|
4023
|
-
stream_exact: true,
|
|
4024
|
-
with_snaps: true,
|
|
4025
|
-
created_after: cutoff
|
|
4026
|
-
}
|
|
4027
|
-
);
|
|
4028
|
-
expect8(after).toEqual([2]);
|
|
4029
|
-
});
|
|
4030
4046
|
it7.skipIf(!caps.pii_isolation)(
|
|
4031
4047
|
"isolates restored pii so forget_pii erases it",
|
|
4032
4048
|
async () => {
|