@rotorsoft/act-tck 1.27.4 → 1.27.6
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 +154 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +154 -0
- 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":"AAQA,OAAO,KAAK,EAQV,KAAK,EAEN,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;;;;;;;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;CACrD,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;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,iB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/dist/index.cjs
CHANGED
|
@@ -2194,6 +2194,27 @@ var runStoreTck = (options) => {
|
|
|
2194
2194
|
]);
|
|
2195
2195
|
(0, import_vitest9.expect)(blocked).toHaveLength(0);
|
|
2196
2196
|
});
|
|
2197
|
+
(0, import_vitest9.it)("re-blocking an already-blocked stream is a no-op (#1263)", async () => {
|
|
2198
|
+
const s = `block-twice-${uid()}`;
|
|
2199
|
+
await store.subscribe([{ stream: s }]);
|
|
2200
|
+
await store.commit(
|
|
2201
|
+
s,
|
|
2202
|
+
[inc(1)],
|
|
2203
|
+
make_meta({ stream: s })
|
|
2204
|
+
);
|
|
2205
|
+
const leased = await store.claim(100, 0, `w-${uid()}`, 1e5);
|
|
2206
|
+
const mine = leased.find((l) => l.stream === s);
|
|
2207
|
+
(0, import_vitest9.expect)(mine).toBeDefined();
|
|
2208
|
+
await store.ack(leased.filter((l) => l.stream !== s));
|
|
2209
|
+
const first = await store.block([
|
|
2210
|
+
{ ...mine, error: "boom" }
|
|
2211
|
+
]);
|
|
2212
|
+
(0, import_vitest9.expect)(first).toHaveLength(1);
|
|
2213
|
+
const second = await store.block([
|
|
2214
|
+
{ ...mine, error: "boom" }
|
|
2215
|
+
]);
|
|
2216
|
+
(0, import_vitest9.expect)(second).toHaveLength(0);
|
|
2217
|
+
});
|
|
2197
2218
|
});
|
|
2198
2219
|
(0, import_vitest9.describe)("defer", () => {
|
|
2199
2220
|
(0, import_vitest9.it)("hides a stream from claim until its deferred_at passes", async () => {
|
|
@@ -3978,6 +3999,139 @@ var runStoreTck = (options) => {
|
|
|
3978
3999
|
);
|
|
3979
4000
|
(0, import_vitest9.expect)(calls).toEqual([1, 2]);
|
|
3980
4001
|
});
|
|
4002
|
+
(0, import_vitest9.it)("query created bounds are filters, not id-ordered breaks", async () => {
|
|
4003
|
+
const s = `restore-created-order-${uid()}`;
|
|
4004
|
+
const newest = /* @__PURE__ */ new Date("2020-06-01T00:00:00.000Z");
|
|
4005
|
+
const oldest = /* @__PURE__ */ new Date("2020-01-01T00:00:00.000Z");
|
|
4006
|
+
await restore(
|
|
4007
|
+
as_source([
|
|
4008
|
+
event(1, s, 0, "Incremented", newest, { amount: 10 }),
|
|
4009
|
+
event(2, s, 1, "Incremented", oldest, { amount: 20 })
|
|
4010
|
+
])
|
|
4011
|
+
);
|
|
4012
|
+
const cutoff = /* @__PURE__ */ new Date("2020-03-01T00:00:00.000Z");
|
|
4013
|
+
const fwd = [];
|
|
4014
|
+
await store.query(
|
|
4015
|
+
(e) => {
|
|
4016
|
+
fwd.push(e.data.amount);
|
|
4017
|
+
},
|
|
4018
|
+
{ stream: s, stream_exact: true, created_before: cutoff }
|
|
4019
|
+
);
|
|
4020
|
+
(0, import_vitest9.expect)(fwd).toEqual([20]);
|
|
4021
|
+
const bwd = [];
|
|
4022
|
+
await store.query(
|
|
4023
|
+
(e) => {
|
|
4024
|
+
bwd.push(e.data.amount);
|
|
4025
|
+
},
|
|
4026
|
+
{
|
|
4027
|
+
stream: s,
|
|
4028
|
+
stream_exact: true,
|
|
4029
|
+
created_after: cutoff,
|
|
4030
|
+
backward: true
|
|
4031
|
+
}
|
|
4032
|
+
);
|
|
4033
|
+
(0, import_vitest9.expect)(bwd).toEqual([10]);
|
|
4034
|
+
});
|
|
4035
|
+
(0, import_vitest9.it)("time-travel query ignores a snapshot newer than the created cutoff", async () => {
|
|
4036
|
+
const s = `restore-tt-snap-${uid()}`;
|
|
4037
|
+
const t0 = /* @__PURE__ */ new Date("2020-01-01T00:00:00.000Z");
|
|
4038
|
+
const t1 = /* @__PURE__ */ new Date("2020-02-01T00:00:00.000Z");
|
|
4039
|
+
const tSnap = /* @__PURE__ */ new Date("2020-03-01T00:00:00.000Z");
|
|
4040
|
+
await restore(
|
|
4041
|
+
as_source([
|
|
4042
|
+
event(1, s, 0, "Incremented", t0, { amount: 1 }),
|
|
4043
|
+
event(2, s, 1, "Incremented", t1, { amount: 2 }),
|
|
4044
|
+
// Snapshot committed last → highest id and latest `created`.
|
|
4045
|
+
event(3, s, 2, import_act2.SNAP_EVENT, tSnap, { count: 3 })
|
|
4046
|
+
])
|
|
4047
|
+
);
|
|
4048
|
+
const cutoff = /* @__PURE__ */ new Date("2020-01-15T00:00:00.000Z");
|
|
4049
|
+
const before = [];
|
|
4050
|
+
await store.query(
|
|
4051
|
+
(e) => {
|
|
4052
|
+
before.push(e.data.amount);
|
|
4053
|
+
},
|
|
4054
|
+
{
|
|
4055
|
+
stream: s,
|
|
4056
|
+
stream_exact: true,
|
|
4057
|
+
with_snaps: true,
|
|
4058
|
+
created_before: cutoff
|
|
4059
|
+
}
|
|
4060
|
+
);
|
|
4061
|
+
(0, import_vitest9.expect)(before).toEqual([1]);
|
|
4062
|
+
const after = [];
|
|
4063
|
+
await store.query(
|
|
4064
|
+
(e) => {
|
|
4065
|
+
if (e.name !== import_act2.SNAP_EVENT)
|
|
4066
|
+
after.push(e.data.amount);
|
|
4067
|
+
},
|
|
4068
|
+
{
|
|
4069
|
+
stream: s,
|
|
4070
|
+
stream_exact: true,
|
|
4071
|
+
with_snaps: true,
|
|
4072
|
+
created_after: cutoff
|
|
4073
|
+
}
|
|
4074
|
+
);
|
|
4075
|
+
(0, import_vitest9.expect)(after).toEqual([2]);
|
|
4076
|
+
});
|
|
4077
|
+
import_vitest9.it.skipIf(!caps.pii_isolation)(
|
|
4078
|
+
"isolates restored pii so forget_pii erases it",
|
|
4079
|
+
async () => {
|
|
4080
|
+
const s = `restore-pii-${uid()}`;
|
|
4081
|
+
const t = /* @__PURE__ */ new Date("2020-05-01T00:00:00.000Z");
|
|
4082
|
+
const result = await restore(
|
|
4083
|
+
as_source([
|
|
4084
|
+
{
|
|
4085
|
+
id: 1,
|
|
4086
|
+
stream: s,
|
|
4087
|
+
version: 0,
|
|
4088
|
+
name: "Incremented",
|
|
4089
|
+
data: { amount: 1 },
|
|
4090
|
+
pii: { email: "first@example.com" },
|
|
4091
|
+
created: t,
|
|
4092
|
+
meta: { correlation: "restore-tck", causation: {} }
|
|
4093
|
+
},
|
|
4094
|
+
{
|
|
4095
|
+
id: 2,
|
|
4096
|
+
stream: s,
|
|
4097
|
+
version: 1,
|
|
4098
|
+
name: "Incremented",
|
|
4099
|
+
data: { amount: 2 },
|
|
4100
|
+
pii: { email: "second@example.com" },
|
|
4101
|
+
created: t,
|
|
4102
|
+
meta: { correlation: "restore-tck", causation: {} }
|
|
4103
|
+
}
|
|
4104
|
+
])
|
|
4105
|
+
);
|
|
4106
|
+
(0, import_vitest9.expect)(result.kept).toBe(2);
|
|
4107
|
+
const before = [];
|
|
4108
|
+
await store.query(
|
|
4109
|
+
(e) => {
|
|
4110
|
+
before.push(e);
|
|
4111
|
+
},
|
|
4112
|
+
{ stream: s, stream_exact: true }
|
|
4113
|
+
);
|
|
4114
|
+
(0, import_vitest9.expect)(before.map((e) => e.pii)).toEqual([
|
|
4115
|
+
{ email: "first@example.com" },
|
|
4116
|
+
{ email: "second@example.com" }
|
|
4117
|
+
]);
|
|
4118
|
+
const wiped = await store.forget_pii.call(store, s);
|
|
4119
|
+
(0, import_vitest9.expect)(wiped).toBe(2);
|
|
4120
|
+
const after = [];
|
|
4121
|
+
await store.query(
|
|
4122
|
+
(e) => {
|
|
4123
|
+
after.push(e);
|
|
4124
|
+
},
|
|
4125
|
+
{ stream: s, stream_exact: true }
|
|
4126
|
+
);
|
|
4127
|
+
(0, import_vitest9.expect)(after).toHaveLength(2);
|
|
4128
|
+
for (const e of after) (0, import_vitest9.expect)(e.pii == null).toBe(true);
|
|
4129
|
+
(0, import_vitest9.expect)(after.map((e) => e.data)).toEqual([
|
|
4130
|
+
{ amount: 1 },
|
|
4131
|
+
{ amount: 2 }
|
|
4132
|
+
]);
|
|
4133
|
+
}
|
|
4134
|
+
);
|
|
3981
4135
|
});
|
|
3982
4136
|
import_vitest9.describe.skipIf(!caps.pii_isolation)("pii_isolation (capability)", () => {
|
|
3983
4137
|
(0, import_vitest9.it)("commits and loads pii alongside data", async () => {
|