@rotorsoft/act-tck 1.3.0 → 1.5.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/.tsbuildinfo +1 -1
- package/dist/@types/store-tck.d.ts +9 -0
- package/dist/@types/store-tck.d.ts.map +1 -1
- package/dist/index.cjs +148 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +148 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1588,8 +1588,7 @@ var runStoreTck = (options) => {
|
|
|
1588
1588
|
(0, import_vitest3.expect)(result.duration_ms).toBeGreaterThanOrEqual(0);
|
|
1589
1589
|
(0, import_vitest3.expect)(result.dropped).toEqual({
|
|
1590
1590
|
closed_streams: 0,
|
|
1591
|
-
snapshots: 0
|
|
1592
|
-
empty_streams: 0
|
|
1591
|
+
snapshots: 0
|
|
1593
1592
|
});
|
|
1594
1593
|
const events = await collect(store, { limit: 10 });
|
|
1595
1594
|
(0, import_vitest3.expect)(events).toHaveLength(0);
|
|
@@ -1931,6 +1930,153 @@ var runStoreTck = (options) => {
|
|
|
1931
1930
|
(0, import_vitest3.expect)(calls).toEqual([1, 2]);
|
|
1932
1931
|
});
|
|
1933
1932
|
});
|
|
1933
|
+
import_vitest3.describe.skipIf(!caps.pii_isolation)("pii_isolation (capability)", () => {
|
|
1934
|
+
(0, import_vitest3.it)("commits and loads pii alongside data", async () => {
|
|
1935
|
+
const s = `pii-roundtrip-${uid()}`;
|
|
1936
|
+
const committed = await store.commit(
|
|
1937
|
+
s,
|
|
1938
|
+
[
|
|
1939
|
+
{
|
|
1940
|
+
name: "Incremented",
|
|
1941
|
+
data: { amount: 1 },
|
|
1942
|
+
pii: { email: "u@example.com", name: "Ursula" }
|
|
1943
|
+
}
|
|
1944
|
+
],
|
|
1945
|
+
makeMeta({ stream: s })
|
|
1946
|
+
);
|
|
1947
|
+
(0, import_vitest3.expect)(committed).toHaveLength(1);
|
|
1948
|
+
(0, import_vitest3.expect)(committed[0].pii).toEqual({
|
|
1949
|
+
email: "u@example.com",
|
|
1950
|
+
name: "Ursula"
|
|
1951
|
+
});
|
|
1952
|
+
const seen = [];
|
|
1953
|
+
await store.query(
|
|
1954
|
+
(e) => {
|
|
1955
|
+
seen.push(e);
|
|
1956
|
+
},
|
|
1957
|
+
{ stream: s, stream_exact: true }
|
|
1958
|
+
);
|
|
1959
|
+
(0, import_vitest3.expect)(seen).toHaveLength(1);
|
|
1960
|
+
(0, import_vitest3.expect)(seen[0].pii).toEqual({ email: "u@example.com", name: "Ursula" });
|
|
1961
|
+
(0, import_vitest3.expect)(seen[0].data).toEqual({ amount: 1 });
|
|
1962
|
+
});
|
|
1963
|
+
(0, import_vitest3.it)("passes through events without pii (pii is null or undefined on load)", async () => {
|
|
1964
|
+
const s = `pii-none-${uid()}`;
|
|
1965
|
+
await store.commit(s, [inc(1)], makeMeta({ stream: s }));
|
|
1966
|
+
const seen = [];
|
|
1967
|
+
await store.query(
|
|
1968
|
+
(e) => {
|
|
1969
|
+
seen.push(e);
|
|
1970
|
+
},
|
|
1971
|
+
{ stream: s, stream_exact: true }
|
|
1972
|
+
);
|
|
1973
|
+
(0, import_vitest3.expect)(seen).toHaveLength(1);
|
|
1974
|
+
(0, import_vitest3.expect)(seen[0].pii == null).toBe(true);
|
|
1975
|
+
});
|
|
1976
|
+
(0, import_vitest3.it)("wipes pii for every event on the stream via forget_pii", async () => {
|
|
1977
|
+
const s = `pii-forget-${uid()}`;
|
|
1978
|
+
await store.commit(
|
|
1979
|
+
s,
|
|
1980
|
+
[
|
|
1981
|
+
{
|
|
1982
|
+
name: "Incremented",
|
|
1983
|
+
data: { amount: 1 },
|
|
1984
|
+
pii: { email: "a@example.com" }
|
|
1985
|
+
},
|
|
1986
|
+
{
|
|
1987
|
+
name: "Incremented",
|
|
1988
|
+
data: { amount: 2 },
|
|
1989
|
+
pii: { email: "b@example.com" }
|
|
1990
|
+
}
|
|
1991
|
+
],
|
|
1992
|
+
makeMeta({ stream: s })
|
|
1993
|
+
);
|
|
1994
|
+
const forget = store.forget_pii;
|
|
1995
|
+
(0, import_vitest3.expect)(forget).toBeDefined();
|
|
1996
|
+
const wiped = await forget.call(store, s);
|
|
1997
|
+
(0, import_vitest3.expect)(wiped).toBe(2);
|
|
1998
|
+
const seen = [];
|
|
1999
|
+
await store.query(
|
|
2000
|
+
(e) => {
|
|
2001
|
+
seen.push(e);
|
|
2002
|
+
},
|
|
2003
|
+
{ stream: s, stream_exact: true }
|
|
2004
|
+
);
|
|
2005
|
+
(0, import_vitest3.expect)(seen).toHaveLength(2);
|
|
2006
|
+
for (const e of seen) {
|
|
2007
|
+
(0, import_vitest3.expect)(e.pii == null).toBe(true);
|
|
2008
|
+
(0, import_vitest3.expect)(e.data).toBeDefined();
|
|
2009
|
+
}
|
|
2010
|
+
});
|
|
2011
|
+
(0, import_vitest3.it)("is idempotent \u2014 second forget_pii returns 0, no error", async () => {
|
|
2012
|
+
const s = `pii-forget-idem-${uid()}`;
|
|
2013
|
+
await store.commit(
|
|
2014
|
+
s,
|
|
2015
|
+
[
|
|
2016
|
+
{
|
|
2017
|
+
name: "Incremented",
|
|
2018
|
+
data: { amount: 1 },
|
|
2019
|
+
pii: { email: "u@example.com" }
|
|
2020
|
+
}
|
|
2021
|
+
],
|
|
2022
|
+
makeMeta({ stream: s })
|
|
2023
|
+
);
|
|
2024
|
+
const forget = store.forget_pii;
|
|
2025
|
+
const first = await forget.call(store, s);
|
|
2026
|
+
(0, import_vitest3.expect)(first).toBe(1);
|
|
2027
|
+
const second = await forget.call(store, s);
|
|
2028
|
+
(0, import_vitest3.expect)(second).toBe(0);
|
|
2029
|
+
});
|
|
2030
|
+
(0, import_vitest3.it)("only wipes the targeted stream \u2014 siblings untouched", async () => {
|
|
2031
|
+
const sA = `pii-iso-a-${uid()}`;
|
|
2032
|
+
const sB = `pii-iso-b-${uid()}`;
|
|
2033
|
+
await store.commit(
|
|
2034
|
+
sA,
|
|
2035
|
+
[
|
|
2036
|
+
{
|
|
2037
|
+
name: "Incremented",
|
|
2038
|
+
data: { amount: 1 },
|
|
2039
|
+
pii: { email: "alice@example.com" }
|
|
2040
|
+
}
|
|
2041
|
+
],
|
|
2042
|
+
makeMeta({ stream: sA })
|
|
2043
|
+
);
|
|
2044
|
+
await store.commit(
|
|
2045
|
+
sB,
|
|
2046
|
+
[
|
|
2047
|
+
{
|
|
2048
|
+
name: "Incremented",
|
|
2049
|
+
data: { amount: 1 },
|
|
2050
|
+
pii: { email: "bob@example.com" }
|
|
2051
|
+
}
|
|
2052
|
+
],
|
|
2053
|
+
makeMeta({ stream: sB })
|
|
2054
|
+
);
|
|
2055
|
+
await store.forget_pii.call(store, sA);
|
|
2056
|
+
const a = [];
|
|
2057
|
+
await store.query(
|
|
2058
|
+
(e) => {
|
|
2059
|
+
a.push(e);
|
|
2060
|
+
},
|
|
2061
|
+
{ stream: sA, stream_exact: true }
|
|
2062
|
+
);
|
|
2063
|
+
(0, import_vitest3.expect)(a[0].pii == null).toBe(true);
|
|
2064
|
+
const b = [];
|
|
2065
|
+
await store.query(
|
|
2066
|
+
(e) => {
|
|
2067
|
+
b.push(e);
|
|
2068
|
+
},
|
|
2069
|
+
{ stream: sB, stream_exact: true }
|
|
2070
|
+
);
|
|
2071
|
+
(0, import_vitest3.expect)(b[0].pii).toEqual({ email: "bob@example.com" });
|
|
2072
|
+
});
|
|
2073
|
+
(0, import_vitest3.it)("forget_pii on a stream with no pii events returns 0", async () => {
|
|
2074
|
+
const s = `pii-forget-empty-${uid()}`;
|
|
2075
|
+
await store.commit(s, [inc(1)], makeMeta({ stream: s }));
|
|
2076
|
+
const wiped = await store.forget_pii.call(store, s);
|
|
2077
|
+
(0, import_vitest3.expect)(wiped).toBe(0);
|
|
2078
|
+
});
|
|
2079
|
+
});
|
|
1934
2080
|
if (caps.notify) {
|
|
1935
2081
|
(0, import_vitest3.describe)("notify (capability)", () => {
|
|
1936
2082
|
(0, import_vitest3.it)("delivers a notification when a different instance commits", async () => {
|