@rotorsoft/act-tck 1.41.2 → 1.41.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"store-tck.d.ts","sourceRoot":"","sources":["../../src/store-tck.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAUV,KAAK,EAIN,MAAM,sBAAsB,CAAC;AAe9B;;;;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;;;;;;;OAOG;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,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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K,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,IAk0LtD,CAAC"}
package/dist/index.cjs CHANGED
@@ -1155,7 +1155,6 @@ var runStoreTck = (options) => {
1155
1155
  (0, import_vitest9.describe)(`TCK / Store / ${options.name}`, () => {
1156
1156
  let store;
1157
1157
  const caps = { ...options.capabilities };
1158
- const is_literal = (source) => !/[\]^$.*+?()[{}|\\]/.test(source);
1159
1158
  const correlate = async (target = store) => {
1160
1159
  const rows = [];
1161
1160
  await target.query_streams(
@@ -1175,7 +1174,10 @@ var runStoreTck = (options) => {
1175
1174
  (e) => {
1176
1175
  mark = Math.max(mark, e.id);
1177
1176
  },
1178
- row.source !== void 0 ? { stream: row.source, stream_exact: is_literal(row.source) } : {}
1177
+ row.source !== void 0 ? {
1178
+ stream: row.source,
1179
+ stream_exact: (0, import_act2.is_literal_source)(row.source, row.stream)
1180
+ } : {}
1179
1181
  );
1180
1182
  if (mark > row.at)
1181
1183
  marks.push({
@@ -1307,6 +1309,41 @@ var runStoreTck = (options) => {
1307
1309
  await store.commit(s, [], make_meta({ stream: s }), 0)
1308
1310
  ).toEqual([]);
1309
1311
  });
1312
+ (0, import_vitest9.it)("takes concurrent commits, reads and writes on one instance", async () => {
1313
+ const x = `commit-concurrent-x-${uid()}`;
1314
+ const y = `commit-concurrent-y-${uid()}`;
1315
+ const [first, second, other, read, subscribed] = await Promise.allSettled([
1316
+ store.commit(
1317
+ x,
1318
+ [inc(1)],
1319
+ make_meta({ stream: x }),
1320
+ -1
1321
+ ),
1322
+ store.commit(
1323
+ x,
1324
+ [inc(2)],
1325
+ make_meta({ stream: x }),
1326
+ -1
1327
+ ),
1328
+ store.commit(y, [inc(1)], make_meta({ stream: y })),
1329
+ store.query(() => {
1330
+ }, { stream: x, stream_exact: true }),
1331
+ // A source nothing writes, so later claims never see it.
1332
+ store.subscribe([
1333
+ { stream: `${y}-idle`, source: `${y}-no-source` }
1334
+ ])
1335
+ ]);
1336
+ (0, import_vitest9.expect)(
1337
+ [first, second].filter((r) => r.status === "fulfilled")
1338
+ ).toHaveLength(1);
1339
+ const lost = [first, second].find((r) => r.status === "rejected");
1340
+ (0, import_vitest9.expect)(lost.reason).toBeInstanceOf(
1341
+ import_act2.ConcurrencyError
1342
+ );
1343
+ (0, import_vitest9.expect)(other.status).toBe("fulfilled");
1344
+ (0, import_vitest9.expect)(read.status).toBe("fulfilled");
1345
+ (0, import_vitest9.expect)(subscribed.status).toBe("fulfilled");
1346
+ });
1310
1347
  (0, import_vitest9.it)("preserves prior events when a concurrent commit is rejected", async () => {
1311
1348
  const s = `commit-cc-preserve-${uid()}`;
1312
1349
  await store.commit(
@@ -1894,6 +1931,16 @@ var runStoreTck = (options) => {
1894
1931
  const leases = await store.claim(5, 5, `w-${uid()}`, 5e3);
1895
1932
  (0, import_vitest9.expect)(leases.filter((l) => l.stream === s)).toHaveLength(0);
1896
1933
  });
1934
+ (0, import_vitest9.it)("takes a target reading itself, whatever its name holds", async () => {
1935
+ const name = `self-a+b(${uid()}`;
1936
+ await store.subscribe([{ stream: name, source: name }]);
1937
+ const found = [];
1938
+ await store.query_streams((p) => found.push(p.stream), {
1939
+ stream: name,
1940
+ stream_exact: true
1941
+ });
1942
+ (0, import_vitest9.expect)(found).toEqual([name]);
1943
+ });
1897
1944
  (0, import_vitest9.it)("claims a fresh subscription as soon as its first event is marked", async () => {
1898
1945
  const s = `fresh-first-${uid()}`;
1899
1946
  const src = `fresh-first-src-${uid()}`;