@rotorsoft/act 2.1.12 → 2.1.14

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.
Files changed (62) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/@types/act.d.ts.map +1 -1
  3. package/dist/@types/builders/act-builder.d.ts.map +1 -1
  4. package/dist/@types/builders/event-builder.d.ts +7 -3
  5. package/dist/@types/builders/event-builder.d.ts.map +1 -1
  6. package/dist/@types/builders/merge.d.ts.map +1 -1
  7. package/dist/@types/deprecated.d.ts +10 -0
  8. package/dist/@types/deprecated.d.ts.map +1 -1
  9. package/dist/@types/index.d.ts +2 -3
  10. package/dist/@types/index.d.ts.map +1 -1
  11. package/dist/@types/internal/audit.d.ts +2 -0
  12. package/dist/@types/internal/audit.d.ts.map +1 -1
  13. package/dist/@types/internal/config.d.ts +9 -0
  14. package/dist/@types/internal/config.d.ts.map +1 -1
  15. package/dist/@types/internal/pii.d.ts +1 -1
  16. package/dist/@types/{sensitive.d.ts → internal/sensitive.d.ts} +0 -24
  17. package/dist/@types/internal/sensitive.d.ts.map +1 -0
  18. package/dist/@types/ports.d.ts +0 -5
  19. package/dist/@types/ports.d.ts.map +1 -1
  20. package/dist/@types/types/action-rules.d.ts +177 -0
  21. package/dist/@types/types/action-rules.d.ts.map +1 -0
  22. package/dist/@types/types/builders.d.ts +15 -311
  23. package/dist/@types/types/builders.d.ts.map +1 -1
  24. package/dist/@types/types/ports.d.ts +1 -1
  25. package/dist/@types/types/projection.d.ts +135 -0
  26. package/dist/@types/types/projection.d.ts.map +1 -0
  27. package/dist/@types/types/registry.d.ts +7 -4
  28. package/dist/@types/types/registry.d.ts.map +1 -1
  29. package/dist/@types/types/schemas.d.ts +0 -1
  30. package/dist/@types/types/schemas.d.ts.map +1 -1
  31. package/dist/adapter.cjs +3 -3
  32. package/dist/adapter.js +2 -2
  33. package/dist/{chunk-SC6TY4P2.cjs → chunk-DCWPJFXR.cjs} +12 -4
  34. package/dist/chunk-DCWPJFXR.cjs.map +1 -0
  35. package/dist/{chunk-RV34EYSN.js → chunk-EIGZVFT7.js} +11 -3
  36. package/dist/{chunk-RV34EYSN.js.map → chunk-EIGZVFT7.js.map} +1 -1
  37. package/dist/{chunk-BQUOIHOR.js → chunk-GDPBPAML.js} +31 -87
  38. package/dist/chunk-GDPBPAML.js.map +1 -0
  39. package/dist/{chunk-Y2ISPWQL.js → chunk-SCH4GLWM.js} +78 -42
  40. package/dist/{chunk-Y2ISPWQL.js.map → chunk-SCH4GLWM.js.map} +1 -1
  41. package/dist/chunk-UEGKXCSQ.cjs +247 -0
  42. package/dist/chunk-UEGKXCSQ.cjs.map +1 -0
  43. package/dist/{chunk-N74AN6L5.cjs → chunk-WDIBO6AW.cjs} +91 -55
  44. package/dist/chunk-WDIBO6AW.cjs.map +1 -0
  45. package/dist/index.cjs +685 -454
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.js +428 -197
  48. package/dist/index.js.map +1 -1
  49. package/dist/test/index.cjs +13 -9
  50. package/dist/test/index.cjs.map +1 -1
  51. package/dist/test/index.js +11 -7
  52. package/dist/test/index.js.map +1 -1
  53. package/dist/types/index.cjs +2 -6
  54. package/dist/types/index.cjs.map +1 -1
  55. package/dist/types/index.js +3 -7
  56. package/package.json +1 -1
  57. package/dist/@types/sensitive.d.ts.map +0 -1
  58. package/dist/chunk-BQUOIHOR.js.map +0 -1
  59. package/dist/chunk-N74AN6L5.cjs.map +0 -1
  60. package/dist/chunk-SC6TY4P2.cjs.map +0 -1
  61. package/dist/chunk-ZTHGF62O.cjs +0 -303
  62. package/dist/chunk-ZTHGF62O.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/types/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG1D;;;;;GAKG;AAEH;;GAE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+ require('./chunk-UEGKXCSQ.cjs');
11
11
 
12
12
 
13
13
 
@@ -16,5 +16,5 @@ require('./chunk-ZTHGF62O.cjs');
16
16
 
17
17
 
18
18
 
19
- exports.checkAppends = _chunkSC6TY4P2cjs.checkAppends; exports.checkVersion = _chunkSC6TY4P2cjs.checkVersion; exports.concurrencyError = _chunkSC6TY4P2cjs.concurrencyError; exports.fairSlots = _chunkSC6TY4P2cjs.fairSlots; exports.isStreamName = _chunkSC6TY4P2cjs.isStreamName; exports.parseNotification = _chunkSC6TY4P2cjs.parseNotification; exports.seedEvent = _chunkSC6TY4P2cjs.seedEvent;
19
+ exports.checkAppends = _chunkDCWPJFXRcjs.checkAppends; exports.checkVersion = _chunkDCWPJFXRcjs.checkVersion; exports.concurrencyError = _chunkDCWPJFXRcjs.concurrencyError; exports.fairSlots = _chunkDCWPJFXRcjs.fairSlots; exports.isStreamName = _chunkDCWPJFXRcjs.isStreamName; exports.parseNotification = _chunkDCWPJFXRcjs.parseNotification; exports.seedEvent = _chunkDCWPJFXRcjs.seedEvent;
20
20
  //# sourceMappingURL=adapter.cjs.map
package/dist/adapter.js CHANGED
@@ -6,8 +6,8 @@ import {
6
6
  isStreamName,
7
7
  parseNotification,
8
8
  seedEvent
9
- } from "./chunk-RV34EYSN.js";
10
- import "./chunk-BQUOIHOR.js";
9
+ } from "./chunk-EIGZVFT7.js";
10
+ import "./chunk-GDPBPAML.js";
11
11
  export {
12
12
  checkAppends,
13
13
  checkVersion,
@@ -2,12 +2,14 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkZTHGF62Ocjs = require('./chunk-ZTHGF62O.cjs');
5
+
6
+ var _chunkUEGKXCSQcjs = require('./chunk-UEGKXCSQ.cjs');
6
7
 
7
8
  // src/adapter.ts
8
9
  function isStreamName(source, target) {
9
10
  return source === target || !source.startsWith("^") && !source.endsWith("$");
10
11
  }
12
+ _chunkUEGKXCSQcjs.__name.call(void 0, isStreamName, "isStreamName");
11
13
  function checkAppends(appends) {
12
14
  const seen = /* @__PURE__ */ new Set();
13
15
  for (const { stream, msgs } of appends) {
@@ -18,28 +20,33 @@ function checkAppends(appends) {
18
20
  seen.add(stream);
19
21
  }
20
22
  }
23
+ _chunkUEGKXCSQcjs.__name.call(void 0, checkAppends, "checkAppends");
21
24
  function concurrencyError(append, head) {
22
- return new (0, _chunkZTHGF62Ocjs.ConcurrencyError)(
25
+ return new (0, _chunkUEGKXCSQcjs.ConcurrencyError)(
23
26
  append.stream,
24
27
  head,
25
28
  append.msgs,
26
29
  _nullishCoalesce(append.expectedVersion, () => ( -1))
27
30
  );
28
31
  }
32
+ _chunkUEGKXCSQcjs.__name.call(void 0, concurrencyError, "concurrencyError");
29
33
  function checkVersion(append, head) {
30
34
  if (typeof append.expectedVersion === "number" && head !== append.expectedVersion)
31
35
  throw concurrencyError(append, head);
32
36
  }
37
+ _chunkUEGKXCSQcjs.__name.call(void 0, checkVersion, "checkVersion");
33
38
  function seedEvent(snapshot, meta) {
34
39
  return {
35
- name: snapshot !== void 0 ? _chunkZTHGF62Ocjs.SNAP_EVENT : _chunkZTHGF62Ocjs.TOMBSTONE_EVENT,
40
+ name: snapshot !== void 0 ? _chunkUEGKXCSQcjs.SNAP_EVENT : _chunkUEGKXCSQcjs.TOMBSTONE_EVENT,
36
41
  data: _nullishCoalesce(snapshot, () => ( {})),
37
42
  meta: _nullishCoalesce(meta, () => ( { correlation: "", causation: {} }))
38
43
  };
39
44
  }
45
+ _chunkUEGKXCSQcjs.__name.call(void 0, seedEvent, "seedEvent");
40
46
  function fairSlots(lagging) {
41
47
  return lagging >= 2 ? Math.max(1, Math.floor(lagging / 4)) : 0;
42
48
  }
49
+ _chunkUEGKXCSQcjs.__name.call(void 0, fairSlots, "fairSlots");
43
50
  function parseNotification(raw) {
44
51
  if (!raw || typeof raw !== "object") return void 0;
45
52
  const { stream, events } = raw;
@@ -49,6 +56,7 @@ function parseNotification(raw) {
49
56
  );
50
57
  return kept.length ? { stream, events: kept.map(({ id, name }) => ({ id, name })) } : void 0;
51
58
  }
59
+ _chunkUEGKXCSQcjs.__name.call(void 0, parseNotification, "parseNotification");
52
60
 
53
61
 
54
62
 
@@ -59,4 +67,4 @@ function parseNotification(raw) {
59
67
 
60
68
 
61
69
  exports.isStreamName = isStreamName; exports.checkAppends = checkAppends; exports.concurrencyError = concurrencyError; exports.checkVersion = checkVersion; exports.seedEvent = seedEvent; exports.fairSlots = fairSlots; exports.parseNotification = parseNotification;
62
- //# sourceMappingURL=chunk-SC6TY4P2.cjs.map
70
+ //# sourceMappingURL=chunk-DCWPJFXR.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/act-root/act-root/libs/act/dist/chunk-DCWPJFXR.cjs","../src/adapter.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACmCO,SAAS,YAAA,CAAa,MAAA,EAAgB,MAAA,EAA0B;AACrE,EAAA,OACE,OAAA,IAAW,OAAA,GAAW,CAAC,MAAA,CAAO,UAAA,CAAW,GAAG,EAAA,GAAK,CAAC,MAAA,CAAO,QAAA,CAAS,GAAG,CAAA;AAEzE;AAJgB,sCAAA,YAAA,EAAA,cAAA,CAAA;AAUT,SAAS,YAAA,CACd,OAAA,EAIM;AACN,EAAA,MAAM,KAAA,kBAAO,IAAI,GAAA,CAAY,CAAA;AAC7B,EAAA,IAAA,CAAA,MAAW,EAAE,MAAA,EAAQ,KAAK,EAAA,GAAK,OAAA,EAAS;AACtC,IAAA,GAAA,CAAI,CAAC,IAAA,CAAK,MAAA;AACR,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,uBAAA,EAA0B,MAAM,CAAA,eAAA,CAAiB,CAAA;AACnE,IAAA,GAAA,CAAI,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA;AACjB,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,gBAAA,EAAmB,MAAM,CAAA,gBAAA,CAAkB,CAAA;AAC7D,IAAA,IAAA,CAAK,G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AA,GAAO,OAAO,IAAA,IAAQ,QAAA,EAAU,OAAO,KAAA,CAAA;AAC5C,EAAA,MAAM,EAAE,MAAA,EAAQ,OAAO,EAAA,EAAI,GAAA;AAC3B,EAAA,GAAA,CAAI,OAAO,OAAA,IAAW,SAAA,GAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,EAAG,OAAO,KAAA,CAAA;AACjE,EAAA,MAAM,KAAA,EAAO,MAAA,CAAO,MAAA;AAAA,IAClB,CAAC,CAAA,EAAA,GACC,CAAC,CAAC,EAAA,GACF,OAAO,EAAA,IAAM,SAAA,GACb,OAAQ,CAAA,CAAuB,GAAA,IAAO,SAAA,GACtC,OAAQ,CAAA,CAAyB,KAAA,IAAS;AAAA,EAC9C,CAAA;AACA,EAAA,OAAO,IAAA,CAAK,OAAA,EACR,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,CAAK,GAAA,CAAI,CAAC,EAAE,EAAA,EAAI,KAAK,CAAA,EAAA,GAAA,CAAO,EAAE,EAAA,EAAI,KAAK,CAAA,CAAE,EAAE,EAAA,EAC7D,KAAA,CAAA;AACN;AAdgB,sCAAA,iBAAA,EAAA,mBAAA,CAAA;ADjFhB;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wQAAC","file":"/home/runner/work/act-root/act-root/libs/act/dist/chunk-DCWPJFXR.cjs","sourcesContent":[null,"/**\n * @packageDocumentation\n * @module act/adapter\n *\n * The rules a `Store` implementation calls, so each one lives once in core and\n * a third-party store can't drift from it. Each is a pure function of its\n * arguments. Import them by name, or as\n * `import * as adapter from \"@rotorsoft/act/adapter\"`. Writing a store:\n * https://rotorsoft.github.io/act-root/docs/guides/writing-a-store\n */\nimport {\n ConcurrencyError,\n type EventMeta,\n type Message,\n type Schema,\n type Schemas,\n SNAP_EVENT,\n type StoreNotification,\n TOMBSTONE_EVENT,\n} from \"./types/index.js\";\n\n/**\n * True when `source` is a stream's **name**, matched exactly. Only an anchored\n * source, one that starts with `^` or ends with `$`, is a **pattern** and gets\n * compiled as a RegExp. A name can hold any other character, so\n * `user+tag@example.com` and `order(1)` are names, and a pattern always says\n * that it is one.\n *\n * Pass the subscription's `target` too when it's known: a target reading itself\n * holds a stream's name, whatever characters that name has.\n *\n * The single source of truth for this across correlate (which decides what a\n * source marks), the drain fetch path, the close check, and the adapters, so\n * they all agree.\n *\n * @example\n * ```typescript\n * isStreamName(\"Board\"); // → true (exact lookup)\n * isStreamName(\"a+b\"); // → true (exact lookup)\n * isStreamName(\"^(A|B)$\"); // → false (compile as RegExp)\n * ```\n */\nexport function isStreamName(source: string, target?: string): boolean {\n return (\n source === target || (!source.startsWith(\"^\") && !source.endsWith(\"$\"))\n );\n}\n\n/**\n * What every store refuses in a `commit`: an append with no events, and a\n * stream named twice. In core so each adapter calls the one rule.\n */\nexport function checkAppends(\n appends: readonly {\n readonly stream: string;\n readonly msgs: readonly unknown[];\n }[]\n): void {\n const seen = new Set<string>();\n for (const { stream, msgs } of appends) {\n if (!msgs.length)\n throw new Error(`commit: the append to \"${stream}\" has no events`);\n if (seen.has(stream))\n throw new Error(`commit: stream \"${stream}\" is named twice`);\n seen.add(stream);\n }\n}\n\n/**\n * The error a stale append raises, given the head the store found. A writer\n * that named no `expectedVersion` reads as `-1`: only a race between the\n * version check and the insert gets one here.\n */\nexport function concurrencyError(\n append: {\n readonly stream: string;\n readonly msgs: readonly unknown[];\n readonly expectedVersion?: number;\n },\n head: number\n): ConcurrencyError {\n return new ConcurrencyError(\n append.stream,\n head,\n append.msgs as Message<Schemas, keyof Schemas>[],\n append.expectedVersion ?? -1\n );\n}\n\n/**\n * What every store refuses as a stale writer: an append whose\n * `expectedVersion` is not the stream's head. In core so each adapter calls\n * the one rule before it appends anything.\n */\nexport function checkVersion(\n append: {\n readonly stream: string;\n readonly msgs: readonly unknown[];\n readonly expectedVersion?: number;\n },\n head: number\n): void {\n if (\n typeof append.expectedVersion === \"number\" &&\n head !== append.expectedVersion\n )\n throw concurrencyError(append, head);\n}\n\n/**\n * The event a full `truncate` seeds a stream with at version 0: a snapshot\n * of the given state, or a tombstone when there is none.\n */\nexport function seedEvent(\n snapshot?: Schema,\n meta?: EventMeta\n): { name: string; data: Schema; meta: EventMeta } {\n return {\n name: snapshot !== undefined ? SNAP_EVENT : TOMBSTONE_EVENT,\n data: snapshot ?? {},\n meta: meta ?? { correlation: \"\", causation: {} },\n };\n}\n\n/**\n * How many of `lagging` claim slots ignore priority, so sustained high-priority\n * load can't starve a low-priority stream forever. Each store's `claim` calls\n * it, and the rule stays out of the `claim` signature.\n */\nexport function fairSlots(lagging: number): number {\n return lagging >= 2 ? Math.max(1, Math.floor(lagging / 4)) : 0;\n}\n\n/**\n * The commit notification in a payload a store or broker received, or\n * `undefined` when there is none: `stream` must be a string, and only\n * `{ id: number, name: string }` events are kept, stripped of anything else.\n * A payload with no such event is not a notification. In core so every\n * listener reads a foreign or version-skewed payload the same way.\n */\nexport function parseNotification(raw: unknown): StoreNotification | undefined {\n if (!raw || typeof raw !== \"object\") return undefined;\n const { stream, events } = raw as { stream?: unknown; events?: unknown };\n if (typeof stream !== \"string\" || !Array.isArray(events)) return undefined;\n const kept = events.filter(\n (e): e is { id: number; name: string } =>\n !!e &&\n typeof e === \"object\" &&\n typeof (e as { id?: unknown }).id === \"number\" &&\n typeof (e as { name?: unknown }).name === \"string\"\n );\n return kept.length\n ? { stream, events: kept.map(({ id, name }) => ({ id, name })) }\n : undefined;\n}\n"]}
@@ -1,13 +1,15 @@
1
1
  import {
2
2
  ConcurrencyError,
3
3
  SNAP_EVENT,
4
- TOMBSTONE_EVENT
5
- } from "./chunk-BQUOIHOR.js";
4
+ TOMBSTONE_EVENT,
5
+ __name
6
+ } from "./chunk-GDPBPAML.js";
6
7
 
7
8
  // src/adapter.ts
8
9
  function isStreamName(source, target) {
9
10
  return source === target || !source.startsWith("^") && !source.endsWith("$");
10
11
  }
12
+ __name(isStreamName, "isStreamName");
11
13
  function checkAppends(appends) {
12
14
  const seen = /* @__PURE__ */ new Set();
13
15
  for (const { stream, msgs } of appends) {
@@ -18,6 +20,7 @@ function checkAppends(appends) {
18
20
  seen.add(stream);
19
21
  }
20
22
  }
23
+ __name(checkAppends, "checkAppends");
21
24
  function concurrencyError(append, head) {
22
25
  return new ConcurrencyError(
23
26
  append.stream,
@@ -26,10 +29,12 @@ function concurrencyError(append, head) {
26
29
  append.expectedVersion ?? -1
27
30
  );
28
31
  }
32
+ __name(concurrencyError, "concurrencyError");
29
33
  function checkVersion(append, head) {
30
34
  if (typeof append.expectedVersion === "number" && head !== append.expectedVersion)
31
35
  throw concurrencyError(append, head);
32
36
  }
37
+ __name(checkVersion, "checkVersion");
33
38
  function seedEvent(snapshot, meta) {
34
39
  return {
35
40
  name: snapshot !== void 0 ? SNAP_EVENT : TOMBSTONE_EVENT,
@@ -37,9 +42,11 @@ function seedEvent(snapshot, meta) {
37
42
  meta: meta ?? { correlation: "", causation: {} }
38
43
  };
39
44
  }
45
+ __name(seedEvent, "seedEvent");
40
46
  function fairSlots(lagging) {
41
47
  return lagging >= 2 ? Math.max(1, Math.floor(lagging / 4)) : 0;
42
48
  }
49
+ __name(fairSlots, "fairSlots");
43
50
  function parseNotification(raw) {
44
51
  if (!raw || typeof raw !== "object") return void 0;
45
52
  const { stream, events } = raw;
@@ -49,6 +56,7 @@ function parseNotification(raw) {
49
56
  );
50
57
  return kept.length ? { stream, events: kept.map(({ id, name }) => ({ id, name })) } : void 0;
51
58
  }
59
+ __name(parseNotification, "parseNotification");
52
60
 
53
61
  export {
54
62
  isStreamName,
@@ -59,4 +67,4 @@ export {
59
67
  fairSlots,
60
68
  parseNotification
61
69
  };
62
- //# sourceMappingURL=chunk-RV34EYSN.js.map
70
+ //# sourceMappingURL=chunk-EIGZVFT7.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/adapter.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * @module act/adapter\n *\n * The rules a `Store` implementation calls, so each one lives once in core and\n * a third-party store can't drift from it. Each is a pure function of its\n * arguments. Import them by name, or as\n * `import * as adapter from \"@rotorsoft/act/adapter\"`. Writing a store:\n * https://rotorsoft.github.io/act-root/docs/guides/writing-a-store\n */\nimport {\n ConcurrencyError,\n type EventMeta,\n type Message,\n type Schema,\n type Schemas,\n SNAP_EVENT,\n type StoreNotification,\n TOMBSTONE_EVENT,\n} from \"./types/index.js\";\n\n/**\n * True when `source` is a stream's **name**, matched exactly. Only an anchored\n * source, one that starts with `^` or ends with `$`, is a **pattern** and gets\n * compiled as a RegExp. A name can hold any other character, so\n * `user+tag@example.com` and `order(1)` are names, and a pattern always says\n * that it is one.\n *\n * Pass the subscription's `target` too when it's known: a target reading itself\n * holds a stream's name, whatever characters that name has.\n *\n * The single source of truth for this across correlate (which decides what a\n * source marks), the drain fetch path, the close check, and the adapters, so\n * they all agree.\n *\n * @example\n * ```typescript\n * isStreamName(\"Board\"); // → true (exact lookup)\n * isStreamName(\"a+b\"); // → true (exact lookup)\n * isStreamName(\"^(A|B)$\"); // → false (compile as RegExp)\n * ```\n */\nexport function isStreamName(source: string, target?: string): boolean {\n return (\n source === target || (!source.startsWith(\"^\") && !source.endsWith(\"$\"))\n );\n}\n\n/**\n * What every store refuses in a `commit`: an append with no events, and a\n * stream named twice. In core so each adapter calls the one rule.\n */\nexport function checkAppends(\n appends: readonly {\n readonly stream: string;\n readonly msgs: readonly unknown[];\n }[]\n): void {\n const seen = new Set<string>();\n for (const { stream, msgs } of appends) {\n if (!msgs.length)\n throw new Error(`commit: the append to \"${stream}\" has no events`);\n if (seen.has(stream))\n throw new Error(`commit: stream \"${stream}\" is named twice`);\n seen.add(stream);\n }\n}\n\n/**\n * The error a stale append raises, given the head the store found. A writer\n * that named no `expectedVersion` reads as `-1`: only a race between the\n * version check and the insert gets one here.\n */\nexport function concurrencyError(\n append: {\n readonly stream: string;\n readonly msgs: readonly unknown[];\n readonly expectedVersion?: number;\n },\n head: number\n): ConcurrencyError {\n return new ConcurrencyError(\n append.stream,\n head,\n append.msgs as Message<Schemas, keyof Schemas>[],\n append.expectedVersion ?? -1\n );\n}\n\n/**\n * What every store refuses as a stale writer: an append whose\n * `expectedVersion` is not the stream's head. In core so each adapter calls\n * the one rule before it appends anything.\n */\nexport function checkVersion(\n append: {\n readonly stream: string;\n readonly msgs: readonly unknown[];\n readonly expectedVersion?: number;\n },\n head: number\n): void {\n if (\n typeof append.expectedVersion === \"number\" &&\n head !== append.expectedVersion\n )\n throw concurrencyError(append, head);\n}\n\n/**\n * The event a full `truncate` seeds a stream with at version 0: a snapshot\n * of the given state, or a tombstone when there is none.\n */\nexport function seedEvent(\n snapshot?: Schema,\n meta?: EventMeta\n): { name: string; data: Schema; meta: EventMeta } {\n return {\n name: snapshot !== undefined ? SNAP_EVENT : TOMBSTONE_EVENT,\n data: snapshot ?? {},\n meta: meta ?? { correlation: \"\", causation: {} },\n };\n}\n\n/**\n * How many of `lagging` claim slots ignore priority, so sustained high-priority\n * load can't starve a low-priority stream forever. Each store's `claim` calls\n * it, and the rule stays out of the `claim` signature.\n */\nexport function fairSlots(lagging: number): number {\n return lagging >= 2 ? Math.max(1, Math.floor(lagging / 4)) : 0;\n}\n\n/**\n * The commit notification in a payload a store or broker received, or\n * `undefined` when there is none: `stream` must be a string, and only\n * `{ id: number, name: string }` events are kept, stripped of anything else.\n * A payload with no such event is not a notification. In core so every\n * listener reads a foreign or version-skewed payload the same way.\n */\nexport function parseNotification(raw: unknown): StoreNotification | undefined {\n if (!raw || typeof raw !== \"object\") return undefined;\n const { stream, events } = raw as { stream?: unknown; events?: unknown };\n if (typeof stream !== \"string\" || !Array.isArray(events)) return undefined;\n const kept = events.filter(\n (e): e is { id: number; name: string } =>\n !!e &&\n typeof e === \"object\" &&\n typeof (e as { id?: unknown }).id === \"number\" &&\n typeof (e as { name?: unknown }).name === \"string\"\n );\n return kept.length\n ? { stream, events: kept.map(({ id, name }) => ({ id, name })) }\n : undefined;\n}\n"],"mappings":";;;;;;;AA0CO,SAAS,aAAa,QAAgB,QA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S;AAAA,EAC9C;AACA,SAAO,KAAK,SACR,EAAE,QAAQ,QAAQ,KAAK,IAAI,CAAC,EAAE,IAAI,KAAK,OAAO,EAAE,IAAI,KAAK,EAAE,EAAE,IAC7D;AACN;","names":[]}
1
+ {"version":3,"sources":["../src/adapter.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * @module act/adapter\n *\n * The rules a `Store` implementation calls, so each one lives once in core and\n * a third-party store can't drift from it. Each is a pure function of its\n * arguments. Import them by name, or as\n * `import * as adapter from \"@rotorsoft/act/adapter\"`. Writing a store:\n * https://rotorsoft.github.io/act-root/docs/guides/writing-a-store\n */\nimport {\n ConcurrencyError,\n type EventMeta,\n type Message,\n type Schema,\n type Schemas,\n SNAP_EVENT,\n type StoreNotification,\n TOMBSTONE_EVENT,\n} from \"./types/index.js\";\n\n/**\n * True when `source` is a stream's **name**, matched exactly. Only an anchored\n * source, one that starts with `^` or ends with `$`, is a **pattern** and gets\n * compiled as a RegExp. A name can hold any other character, so\n * `user+tag@example.com` and `order(1)` are names, and a pattern always says\n * that it is one.\n *\n * Pass the subscription's `target` too when it's known: a target reading itself\n * holds a stream's name, whatever characters that name has.\n *\n * The single source of truth for this across correlate (which decides what a\n * source marks), the drain fetch path, the close check, and the adapters, so\n * they all agree.\n *\n * @example\n * ```typescript\n * isStreamName(\"Board\"); // → true (exact lookup)\n * isStreamName(\"a+b\"); // → true (exact lookup)\n * isStreamName(\"^(A|B)$\"); // → false (compile as RegExp)\n * ```\n */\nexport function isStreamName(source: string, target?: string): boolean {\n return (\n source === target || (!source.startsWith(\"^\") && !source.endsWith(\"$\"))\n );\n}\n\n/**\n * What every store refuses in a `commit`: an append with no events, and a\n * stream named twice. In core so each adapter calls the one rule.\n */\nexport function checkAppends(\n appends: readonly {\n readonly stream: string;\n readonly msgs: readonly unknown[];\n }[]\n): void {\n const seen = new Set<string>();\n for (const { stream, msgs } of appends) {\n if (!msgs.length)\n throw new Error(`commit: the append to \"${stream}\" has no events`);\n if (seen.has(stream))\n throw new Error(`commit: stream \"${stream}\" is named twice`);\n seen.add(stream);\n }\n}\n\n/**\n * The error a stale append raises, given the head the store found. A writer\n * that named no `expectedVersion` reads as `-1`: only a race between the\n * version check and the insert gets one here.\n */\nexport function concurrencyError(\n append: {\n readonly stream: string;\n readonly msgs: readonly unknown[];\n readonly expectedVersion?: number;\n },\n head: number\n): ConcurrencyError {\n return new ConcurrencyError(\n append.stream,\n head,\n append.msgs as Message<Schemas, keyof Schemas>[],\n append.expectedVersion ?? -1\n );\n}\n\n/**\n * What every store refuses as a stale writer: an append whose\n * `expectedVersion` is not the stream's head. In core so each adapter calls\n * the one rule before it appends anything.\n */\nexport function checkVersion(\n append: {\n readonly stream: string;\n readonly msgs: readonly unknown[];\n readonly expectedVersion?: number;\n },\n head: number\n): void {\n if (\n typeof append.expectedVersion === \"number\" &&\n head !== append.expectedVersion\n )\n throw concurrencyError(append, head);\n}\n\n/**\n * The event a full `truncate` seeds a stream with at version 0: a snapshot\n * of the given state, or a tombstone when there is none.\n */\nexport function seedEvent(\n snapshot?: Schema,\n meta?: EventMeta\n): { name: string; data: Schema; meta: EventMeta } {\n return {\n name: snapshot !== undefined ? SNAP_EVENT : TOMBSTONE_EVENT,\n data: snapshot ?? {},\n meta: meta ?? { correlation: \"\", causation: {} },\n };\n}\n\n/**\n * How many of `lagging` claim slots ignore priority, so sustained high-priority\n * load can't starve a low-priority stream forever. Each store's `claim` calls\n * it, and the rule stays out of the `claim` signature.\n */\nexport function fairSlots(lagging: number): number {\n return lagging >= 2 ? Math.max(1, Math.floor(lagging / 4)) : 0;\n}\n\n/**\n * The commit notification in a payload a store or broker received, or\n * `undefined` when there is none: `stream` must be a string, and only\n * `{ id: number, name: string }` events are kept, stripped of anything else.\n * A payload with no such event is not a notification. In core so every\n * listener reads a foreign or version-skewed payload the same way.\n */\nexport function parseNotification(raw: unknown): StoreNotification | undefined {\n if (!raw || typeof raw !== \"object\") return undefined;\n const { stream, events } = raw as { stream?: unknown; events?: unknown };\n if (typeof stream !== \"string\" || !Array.isArray(events)) return undefined;\n const kept = events.filter(\n (e): e is { id: number; name: string } =>\n !!e &&\n typeof e === \"object\" &&\n typeof (e as { id?: unknown }).id === \"number\" &&\n typeof (e as { name?: unknown }).name === \"string\"\n );\n return kept.length\n ? { stream, events: kept.map(({ id, name }) => ({ id, name })) }\n : undefined;\n}\n"],"mappings":";;;;;;;;AA0CO,SAAS,aAAa,QAAgB,QAA0B;AACrE,SACE,WAAW,UAAW,CAAC,OAAO,WAAW,GAAG,KAAK,CAAC,OAAO,SAAS,GAAG;AAEzE;AAJgB;AAUT,SAAS,aACd,SAIM;AACN,QAAM,OAAO,oBAAI,IAAY;AAC7B,aAAW,EAAE,QAAQ,KAAK,KAAK,SAAS;AACtC,QAAI,CAAC,KAAK;AACR,YAAM,IAAI,MAAM,0BAA0B,MAAM,iBAAiB;AACnE,QAAI,KAAK,IAAI,MAAM;AACjB,YAAM,IAAI,MAAM,mBAAmB,MAAM,kBAAkB;AAC7D,SAAK,IAAI,MAAM;AAAA,EACjB;AACF;AAdgB;AAqBT,SAAS,iBACd,QAKA,MACkB;AAClB,SAAO,IAAI;AAAA,IACT,OAAO;AAAA,IACP;AAAA,IACA,OAAO;AAAA,IACP,OAAO,mBAAmB;AAAA,EAC5B;AACF;AAdgB;AAqBT,SAAS,aACd,QAKA,MACM;AACN,MACE,OAAO,OAAO,oBAAoB,YAClC,SAAS,OAAO;AAEhB,UAAM,iBAAiB,QAAQ,IAAI;AACvC;AAbgB;AAmBT,SAAS,UACd,UACA,MACiD;AACjD,SAAO;AAAA,IACL,MAAM,aAAa,SAAY,aAAa;AAAA,IAC5C,MAAM,YAAY,CAAC;AAAA,IACnB,MAAM,QAAQ,EAAE,aAAa,IAAI,WAAW,CAAC,EAAE;AAAA,EACjD;AACF;AATgB;AAgBT,SAAS,UAAU,SAAyB;AACjD,SAAO,WAAW,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,UAAU,CAAC,CAAC,IAAI;AAC/D;AAFgB;AAWT,SAAS,kBAAkB,KAA6C;AAC7E,MAAI,CAAC,OAAO,OAAO,QAAQ,SAAU,QAAO;AAC5C,QAAM,EAAE,QAAQ,OAAO,IAAI;AAC3B,MAAI,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,EAAG,QAAO;AACjE,QAAM,OAAO,OAAO;AAAA,IAClB,CAAC,MACC,CAAC,CAAC,KACF,OAAO,MAAM,YACb,OAAQ,EAAuB,OAAO,YACtC,OAAQ,EAAyB,SAAS;AAAA,EAC9C;AACA,SAAO,KAAK,SACR,EAAE,QAAQ,QAAQ,KAAK,IAAI,CAAC,EAAE,IAAI,KAAK,OAAO,EAAE,IAAI,KAAK,EAAE,EAAE,IAC7D;AACN;AAdgB;","names":[]}
@@ -1,3 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
1
4
  // src/types/act.ts
2
5
  var DEFAULT_SETTLE_DEBOUNCE_MS = 10;
3
6
  var DEFAULT_MAX_SUBSCRIBED_STREAMS = 1e3;
@@ -12,6 +15,9 @@ var Errors = {
12
15
  StoreError: "ERR_STORE"
13
16
  };
14
17
  var ValidationError = class extends Error {
18
+ static {
19
+ __name(this, "ValidationError");
20
+ }
15
21
  /** The type of target being validated (e.g., "action", "event") */
16
22
  target;
17
23
  /** The invalid payload that failed validation */
@@ -27,6 +33,9 @@ var ValidationError = class extends Error {
27
33
  }
28
34
  };
29
35
  var PreconditionError = class extends Error {
36
+ static {
37
+ __name(this, "PreconditionError");
38
+ }
30
39
  /** The action that was attempted */
31
40
  action;
32
41
  /** The action payload that was provided */
@@ -48,6 +57,9 @@ var PreconditionError = class extends Error {
48
57
  }
49
58
  };
50
59
  var ConcurrencyError = class extends Error {
60
+ static {
61
+ __name(this, "ConcurrencyError");
62
+ }
51
63
  /** The stream that had the concurrent modification */
52
64
  stream;
53
65
  /** The actual current version in the store */
@@ -70,6 +82,9 @@ var ConcurrencyError = class extends Error {
70
82
  }
71
83
  };
72
84
  var StreamClosedError = class extends Error {
85
+ static {
86
+ __name(this, "StreamClosedError");
87
+ }
73
88
  /** The stream that is closed */
74
89
  stream;
75
90
  constructor(stream) {
@@ -79,6 +94,9 @@ var StreamClosedError = class extends Error {
79
94
  }
80
95
  };
81
96
  var StoreError = class extends Error {
97
+ static {
98
+ __name(this, "StoreError");
99
+ }
82
100
  /** The store operation that failed (e.g. `"claim"`, `"ack"`, `"commit"`). */
83
101
  operation;
84
102
  constructor(operation, options) {
@@ -88,6 +106,9 @@ var StoreError = class extends Error {
88
106
  }
89
107
  };
90
108
  var NonRetryableError = class extends Error {
109
+ static {
110
+ __name(this, "NonRetryableError");
111
+ }
91
112
  /** The original failure, if any. Mirrors the standard `Error.cause` shape. */
92
113
  cause;
93
114
  constructor(message, options) {
@@ -97,6 +118,9 @@ var NonRetryableError = class extends Error {
97
118
  }
98
119
  };
99
120
  var DeferSignal = class extends Error {
121
+ static {
122
+ __name(this, "DeferSignal");
123
+ }
100
124
  /**
101
125
  * The unresolved schedule. The dispatcher turns this into an absolute
102
126
  * due-time by resolving it against the triggering event.
@@ -119,92 +143,17 @@ var DEFAULT_LANE = "default";
119
143
 
120
144
  // src/types/schemas.ts
121
145
  import { z } from "zod";
122
-
123
- // src/internal/zod.ts
124
- var def_of = (schema) => schema?._zod?.def;
125
- var SINGLE_INNER = [
126
- "optional",
127
- "nullable",
128
- "default",
129
- "prefault",
130
- "nonoptional",
131
- "readonly",
132
- "catch"
133
- ];
134
- var inner_of = (def) => SINGLE_INNER.includes(def.type) ? def.innerType : void 0;
135
- function wrapped(schema) {
136
- const def = def_of(schema);
137
- if (!def) return [];
138
- if (def.type === "pipe") return [def.in, def.out];
139
- if (def.type === "lazy") return [def.getter()];
140
- const inner = inner_of(def);
141
- return inner ? [inner] : [];
142
- }
143
- function some_layer(schema, test) {
144
- const seen = /* @__PURE__ */ new Set();
145
- const visit = (s) => {
146
- if (seen.has(s)) return false;
147
- seen.add(s);
148
- const def = def_of(s);
149
- return !!def && (test(def) || wrapped(s).some(visit));
150
- };
151
- return visit(schema);
152
- }
153
- function output_of(schema) {
154
- const seen = /* @__PURE__ */ new Set();
155
- let cur = schema;
156
- while (!seen.has(cur)) {
157
- seen.add(cur);
158
- const def = def_of(cur);
159
- if (!def) return cur;
160
- const next = def.type === "pipe" ? def.out : wrapped(cur)[0];
161
- if (!next) return cur;
162
- cur = next;
163
- }
164
- return cur;
165
- }
166
-
167
- // src/sensitive.ts
168
- var _SENSITIVE = /* @__PURE__ */ Symbol.for("act.sensitive");
169
- function _mark_sensitive(schema) {
170
- const def = def_of(schema);
171
- if (!def) throw new Error("sensitive() takes a Zod 4 schema");
172
- def[_SENSITIVE] = true;
173
- }
174
- var is_pii = (schema) => some_layer(schema, (def) => def[_SENSITIVE] === true);
175
- function pii_schemas(schema) {
176
- const shape = schema.shape;
177
- if (shape && typeof shape === "object") {
178
- const fields = {};
179
- for (const key of Object.keys(shape))
180
- if (is_pii(shape[key])) fields[key] = shape[key];
181
- return fields;
182
- }
183
- const options = schema.options;
184
- if (Array.isArray(options)) {
185
- const fields = {};
186
- for (const option of options)
187
- for (const [key, field] of Object.entries(
188
- pii_schemas(option)
189
- ))
190
- fields[key] ??= field;
191
- return fields;
192
- }
193
- return {};
194
- }
195
- function sensitiveFields(schema) {
196
- return Object.keys(pii_schemas(schema));
197
- }
198
- var pii_fields = sensitiveFields;
199
-
200
- // src/types/schemas.ts
201
146
  var ZodEmpty = z.record(z.string(), z.never());
202
147
  var REDACTED = "[REDACTED]";
203
148
  var SHREDDED = "[SHREDDED]";
149
+ var SENSITIVE = /* @__PURE__ */ Symbol.for("act.sensitive");
204
150
  function sensitive(schema) {
205
- _mark_sensitive(schema);
151
+ const def = schema.def;
152
+ if (!def) throw new Error("sensitive() takes a Zod 4 schema");
153
+ def[SENSITIVE] = true;
206
154
  return schema;
207
155
  }
156
+ __name(sensitive, "sensitive");
208
157
  var ActorSchema = z.object({
209
158
  id: z.string(),
210
159
  name: z.string()
@@ -266,6 +215,7 @@ var LogLevels = [
266
215
  var ExitCodes = ["ERROR", "EXIT"];
267
216
 
268
217
  export {
218
+ __name,
269
219
  DEFAULT_SETTLE_DEBOUNCE_MS,
270
220
  DEFAULT_MAX_SUBSCRIBED_STREAMS,
271
221
  Errors,
@@ -280,12 +230,6 @@ export {
280
230
  TOMBSTONE_EVENT,
281
231
  DEFAULT_QUERY_STREAMS_LIMIT,
282
232
  DEFAULT_LANE,
283
- def_of,
284
- inner_of,
285
- output_of,
286
- pii_schemas,
287
- sensitiveFields,
288
- pii_fields,
289
233
  ZodEmpty,
290
234
  REDACTED,
291
235
  SHREDDED,
@@ -300,4 +244,4 @@ export {
300
244
  LogLevels,
301
245
  ExitCodes
302
246
  };
303
- //# sourceMappingURL=chunk-BQUOIHOR.js.map
247
+ //# sourceMappingURL=chunk-GDPBPAML.js.map