@fabricorg/platform 1.9.0 → 1.10.1

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 (209) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +48 -2
  3. package/dist/actions/index.cjs +45 -26
  4. package/dist/actions/index.cjs.map +1 -1
  5. package/dist/actions/index.d.cts +225 -226
  6. package/dist/actions/index.d.ts +225 -226
  7. package/dist/actions/index.js +41 -2
  8. package/dist/actions/index.js.map +1 -1
  9. package/dist/adapters/index.cjs +696 -66
  10. package/dist/adapters/index.cjs.map +1 -1
  11. package/dist/adapters/index.d.cts +367 -365
  12. package/dist/adapters/index.d.ts +367 -365
  13. package/dist/adapters/index.js +682 -2
  14. package/dist/adapters/index.js.map +1 -1
  15. package/dist/agent-hitl/index.cjs +21 -10
  16. package/dist/agent-hitl/index.cjs.map +1 -1
  17. package/dist/agent-hitl/index.d.cts +30 -30
  18. package/dist/agent-hitl/index.d.ts +30 -30
  19. package/dist/agent-hitl/index.js +21 -2
  20. package/dist/agent-hitl/index.js.map +1 -1
  21. package/dist/certification/index.cjs +109 -24
  22. package/dist/certification/index.cjs.map +1 -1
  23. package/dist/certification/index.d.cts +33 -39
  24. package/dist/certification/index.d.ts +33 -39
  25. package/dist/certification/index.js +107 -8
  26. package/dist/certification/index.js.map +1 -1
  27. package/dist/discovery/index.cjs +12 -10
  28. package/dist/discovery/index.cjs.map +1 -1
  29. package/dist/discovery/index.d.cts +2 -10
  30. package/dist/discovery/index.d.ts +2 -10
  31. package/dist/discovery/index.js +12 -2
  32. package/dist/discovery/index.js.map +1 -1
  33. package/dist/engine-B4csEOEc.js +223 -0
  34. package/dist/engine-B4csEOEc.js.map +1 -0
  35. package/dist/engine-BqScuhrT.cjs +246 -0
  36. package/dist/engine-BqScuhrT.cjs.map +1 -0
  37. package/dist/events/index.cjs +39 -10
  38. package/dist/events/index.cjs.map +1 -1
  39. package/dist/events/index.d.cts +43 -43
  40. package/dist/events/index.d.ts +43 -43
  41. package/dist/events/index.js +39 -2
  42. package/dist/events/index.js.map +1 -1
  43. package/dist/evidence/index.cjs +12 -50
  44. package/dist/evidence/index.d.cts +2 -229
  45. package/dist/evidence/index.d.ts +2 -229
  46. package/dist/evidence/index.js +1 -5
  47. package/dist/evidence-BuCICb0c.js +516 -0
  48. package/dist/evidence-BuCICb0c.js.map +1 -0
  49. package/dist/evidence-Cq48eDvA.cjs +575 -0
  50. package/dist/evidence-Cq48eDvA.cjs.map +1 -0
  51. package/dist/governance/index.cjs +24 -18
  52. package/dist/governance/index.cjs.map +1 -1
  53. package/dist/governance/index.d.cts +80 -83
  54. package/dist/governance/index.d.ts +80 -83
  55. package/dist/governance/index.js +22 -2
  56. package/dist/governance/index.js.map +1 -1
  57. package/dist/ids/index.cjs +52 -22
  58. package/dist/ids/index.cjs.map +1 -1
  59. package/dist/ids/index.d.cts +17 -17
  60. package/dist/ids/index.d.ts +17 -17
  61. package/dist/ids/index.js +49 -2
  62. package/dist/ids/index.js.map +1 -1
  63. package/dist/index-9jasmw76.d.cts +124 -0
  64. package/dist/index-BXpeFdk2.d.cts +190 -0
  65. package/dist/index-BXpeFdk2.d.ts +190 -0
  66. package/dist/index-BnbsKZsT.d.cts +231 -0
  67. package/dist/index-CIl1rYRv.d.cts +11 -0
  68. package/dist/index-CIl1rYRv.d.ts +11 -0
  69. package/dist/index-CVHA1ypT.d.cts +262 -0
  70. package/dist/index-DZ4mnNb7.d.cts +78 -0
  71. package/dist/index-DZ4mnNb7.d.ts +78 -0
  72. package/dist/index-IqcDvl69.d.ts +124 -0
  73. package/dist/index-fmUiRBXu.d.cts +57 -0
  74. package/dist/index-fmUiRBXu.d.ts +57 -0
  75. package/dist/index-sPUPs8pr.d.ts +262 -0
  76. package/dist/index-z9-CYOIo.d.ts +231 -0
  77. package/dist/index.cjs +111 -385
  78. package/dist/index.d.cts +18 -17
  79. package/dist/index.d.ts +18 -17
  80. package/dist/index.js +19 -20
  81. package/dist/manifest/index.cjs +224 -35
  82. package/dist/manifest/index.cjs.map +1 -1
  83. package/dist/manifest/index.d.cts +130 -131
  84. package/dist/manifest/index.d.ts +130 -131
  85. package/dist/manifest/index.js +219 -7
  86. package/dist/manifest/index.js.map +1 -1
  87. package/dist/modules/index.cjs +281 -42
  88. package/dist/modules/index.cjs.map +1 -1
  89. package/dist/modules/index.d.cts +157 -159
  90. package/dist/modules/index.d.ts +157 -159
  91. package/dist/modules/index.js +274 -6
  92. package/dist/modules/index.js.map +1 -1
  93. package/dist/objects/index.cjs +355 -22
  94. package/dist/objects/index.cjs.map +1 -1
  95. package/dist/objects/index.d.cts +2 -77
  96. package/dist/objects/index.d.ts +2 -77
  97. package/dist/objects/index.js +352 -2
  98. package/dist/objects/index.js.map +1 -1
  99. package/dist/policies/index.cjs +14 -48
  100. package/dist/policies/index.d.cts +2 -247
  101. package/dist/policies/index.d.ts +2 -247
  102. package/dist/policies/index.js +1 -3
  103. package/dist/policies-DH_GCXQ-.js +627 -0
  104. package/dist/policies-DH_GCXQ-.js.map +1 -0
  105. package/dist/policies-Nxbp1CH8.cjs +698 -0
  106. package/dist/policies-Nxbp1CH8.cjs.map +1 -0
  107. package/dist/privacy/index.cjs +26 -43
  108. package/dist/privacy/index.cjs.map +1 -1
  109. package/dist/privacy/index.d.cts +2 -189
  110. package/dist/privacy/index.d.ts +2 -189
  111. package/dist/privacy/index.js +18 -3
  112. package/dist/privacy/index.js.map +1 -1
  113. package/dist/projections/index.cjs +241 -23
  114. package/dist/projections/index.cjs.map +1 -1
  115. package/dist/projections/index.d.cts +2 -125
  116. package/dist/projections/index.d.ts +2 -125
  117. package/dist/projections/index.js +238 -3
  118. package/dist/projections/index.js.map +1 -1
  119. package/dist/state-machines/index.cjs +76 -18
  120. package/dist/state-machines/index.cjs.map +1 -1
  121. package/dist/state-machines/index.d.cts +2 -55
  122. package/dist/state-machines/index.d.ts +2 -55
  123. package/dist/state-machines/index.js +74 -2
  124. package/dist/state-machines/index.js.map +1 -1
  125. package/dist/testing/index.cjs +27 -19
  126. package/dist/testing/index.cjs.map +1 -1
  127. package/dist/testing/index.d.cts +17 -19
  128. package/dist/testing/index.d.ts +17 -19
  129. package/dist/testing/index.js +25 -3
  130. package/dist/testing/index.js.map +1 -1
  131. package/package.json +6 -5
  132. package/dist/chunk-2AE6TMAX.cjs +0 -44
  133. package/dist/chunk-2AE6TMAX.cjs.map +0 -1
  134. package/dist/chunk-6HY35TKB.cjs +0 -491
  135. package/dist/chunk-6HY35TKB.cjs.map +0 -1
  136. package/dist/chunk-6UGEIDLC.cjs +0 -26
  137. package/dist/chunk-6UGEIDLC.cjs.map +0 -1
  138. package/dist/chunk-7GAWSUOG.js +0 -64
  139. package/dist/chunk-7GAWSUOG.js.map +0 -1
  140. package/dist/chunk-AFXFAEWA.js +0 -673
  141. package/dist/chunk-AFXFAEWA.js.map +0 -1
  142. package/dist/chunk-AFXKSIVI.cjs +0 -540
  143. package/dist/chunk-AFXKSIVI.cjs.map +0 -1
  144. package/dist/chunk-B5DOGDPG.js +0 -42
  145. package/dist/chunk-B5DOGDPG.js.map +0 -1
  146. package/dist/chunk-BJGZE3GE.js +0 -20
  147. package/dist/chunk-BJGZE3GE.js.map +0 -1
  148. package/dist/chunk-CRZXTZ36.cjs +0 -258
  149. package/dist/chunk-CRZXTZ36.cjs.map +0 -1
  150. package/dist/chunk-D4SWRBUH.cjs +0 -22
  151. package/dist/chunk-D4SWRBUH.cjs.map +0 -1
  152. package/dist/chunk-DBTAUI6C.cjs +0 -395
  153. package/dist/chunk-DBTAUI6C.cjs.map +0 -1
  154. package/dist/chunk-EMSAFNPX.js +0 -98
  155. package/dist/chunk-EMSAFNPX.js.map +0 -1
  156. package/dist/chunk-F3E5SXPN.cjs +0 -28
  157. package/dist/chunk-F3E5SXPN.cjs.map +0 -1
  158. package/dist/chunk-HEYMMVDP.js +0 -480
  159. package/dist/chunk-HEYMMVDP.js.map +0 -1
  160. package/dist/chunk-IFW43ELT.cjs +0 -331
  161. package/dist/chunk-IFW43ELT.cjs.map +0 -1
  162. package/dist/chunk-LFE74IJX.js +0 -20
  163. package/dist/chunk-LFE74IJX.js.map +0 -1
  164. package/dist/chunk-LZSE6QGQ.cjs +0 -60
  165. package/dist/chunk-LZSE6QGQ.cjs.map +0 -1
  166. package/dist/chunk-MCWSUGB3.cjs +0 -102
  167. package/dist/chunk-MCWSUGB3.cjs.map +0 -1
  168. package/dist/chunk-MLBALEUR.js +0 -290
  169. package/dist/chunk-MLBALEUR.js.map +0 -1
  170. package/dist/chunk-NNXQZPB3.cjs +0 -31
  171. package/dist/chunk-NNXQZPB3.cjs.map +0 -1
  172. package/dist/chunk-OFCCZ27Z.js +0 -26
  173. package/dist/chunk-OFCCZ27Z.js.map +0 -1
  174. package/dist/chunk-PDN5DOLQ.js +0 -242
  175. package/dist/chunk-PDN5DOLQ.js.map +0 -1
  176. package/dist/chunk-PIDZQAEL.js +0 -50
  177. package/dist/chunk-PIDZQAEL.js.map +0 -1
  178. package/dist/chunk-Q4Q4JPR3.js +0 -524
  179. package/dist/chunk-Q4Q4JPR3.js.map +0 -1
  180. package/dist/chunk-RALMUSOX.js +0 -55
  181. package/dist/chunk-RALMUSOX.js.map +0 -1
  182. package/dist/chunk-SNTV45LH.cjs +0 -295
  183. package/dist/chunk-SNTV45LH.cjs.map +0 -1
  184. package/dist/chunk-TBS2S5AX.cjs +0 -40
  185. package/dist/chunk-TBS2S5AX.cjs.map +0 -1
  186. package/dist/chunk-TYNIFC7J.js +0 -253
  187. package/dist/chunk-TYNIFC7J.js.map +0 -1
  188. package/dist/chunk-UGWGHTNC.cjs +0 -56
  189. package/dist/chunk-UGWGHTNC.cjs.map +0 -1
  190. package/dist/chunk-WI7CWNYI.cjs +0 -68
  191. package/dist/chunk-WI7CWNYI.cjs.map +0 -1
  192. package/dist/chunk-WNZP53GI.js +0 -386
  193. package/dist/chunk-WNZP53GI.js.map +0 -1
  194. package/dist/chunk-WQ3BYI7T.cjs +0 -249
  195. package/dist/chunk-WQ3BYI7T.cjs.map +0 -1
  196. package/dist/chunk-Y2PJLRIY.js +0 -36
  197. package/dist/chunk-Y2PJLRIY.js.map +0 -1
  198. package/dist/chunk-YGIPN3TU.cjs +0 -684
  199. package/dist/chunk-YGIPN3TU.cjs.map +0 -1
  200. package/dist/chunk-ZAEVQSB5.js +0 -326
  201. package/dist/chunk-ZAEVQSB5.js.map +0 -1
  202. package/dist/chunk-ZMQTV5OJ.js +0 -27
  203. package/dist/chunk-ZMQTV5OJ.js.map +0 -1
  204. package/dist/evidence/index.cjs.map +0 -1
  205. package/dist/evidence/index.js.map +0 -1
  206. package/dist/index.cjs.map +0 -1
  207. package/dist/index.js.map +0 -1
  208. package/dist/policies/index.cjs.map +0 -1
  209. package/dist/policies/index.js.map +0 -1
@@ -1,91 +1,91 @@
1
- import { SurfaceDeclaration } from '../discovery/index.js';
2
-
3
- type ActionId = `${string}.${string}`;
4
- interface SchemaParseIssue {
5
- path: PropertyKey[];
6
- message: string;
1
+ import { t as SurfaceDeclaration } from "../index-CIl1rYRv.js";
2
+ //#region actions/index.d.ts
3
+ export type ActionId = `${string}.${string}`;
4
+ export interface SchemaParseIssue {
5
+ path: PropertyKey[];
6
+ message: string;
7
7
  }
8
- type SchemaParseResult<T = unknown> = {
9
- success: true;
10
- data: T;
8
+ export type SchemaParseResult<T = unknown> = {
9
+ success: true;
10
+ data: T;
11
11
  } | {
12
- success: false;
13
- error: {
14
- issues: SchemaParseIssue[];
15
- };
12
+ success: false;
13
+ error: {
14
+ issues: SchemaParseIssue[];
15
+ };
16
16
  };
17
- interface SchemaValidator<T = unknown> {
18
- parse(input: unknown): T;
19
- safeParse(input: unknown): SchemaParseResult<T>;
17
+ export interface SchemaValidator<T = unknown> {
18
+ parse(input: unknown): T;
19
+ safeParse(input: unknown): SchemaParseResult<T>;
20
20
  }
21
- type ActorType = "natural_person" | "agent" | "system" | "service_account" | "external_system" | "integration";
22
- declare const ACTOR_TYPES: readonly ActorType[];
23
- declare function isActorType(value: string): value is ActorType;
24
- declare function assertActorType(value: string): asserts value is ActorType;
25
- type ActionStatus = "pending" | "running" | "completed" | "failed" | "blocked_by_policy" | "waiting_for_approval" | "reconciliation_required" | "validation_failed";
26
- interface FabricRuntimeServices {
27
- readonly [serviceName: string]: unknown;
21
+ export type ActorType = "natural_person" | "agent" | "system" | "service_account" | "external_system" | "integration";
22
+ export declare const ACTOR_TYPES: readonly ActorType[];
23
+ export declare function isActorType(value: string): value is ActorType;
24
+ export declare function assertActorType(value: string): asserts value is ActorType;
25
+ export type ActionStatus = "pending" | "running" | "completed" | "failed" | "blocked_by_policy" | "waiting_for_approval" | "reconciliation_required" | "validation_failed";
26
+ export interface FabricRuntimeServices {
27
+ readonly [serviceName: string]: unknown;
28
28
  }
29
- interface ActionContext<TDb = unknown> {
30
- actionInvocationId: string;
31
- tenantId: string;
32
- spaceId: string;
33
- actorId: string;
34
- actorType: ActorType;
35
- correlationId: string;
36
- causationId?: string;
37
- provenance?: {
38
- source: string;
39
- auditAttributes?: Record<string, string>;
40
- };
41
- db: TDb;
42
- services?: FabricRuntimeServices;
43
- /**
44
- * When the host admitted this invocation's submission through the
45
- * action's `admitSubmission` check, read from the durable invocation
46
- * record. Absent when the action declares no check, or when the runtime
47
- * that built this context does not run declared admission checks (a host
48
- * older than the one that introduced them). A handler whose action
49
- * declares `admitSubmission` can refuse to run without it.
50
- */
51
- admittedAt?: Date;
29
+ export interface ActionContext<TDb = unknown> {
30
+ actionInvocationId: string;
31
+ tenantId: string;
32
+ spaceId: string;
33
+ actorId: string;
34
+ actorType: ActorType;
35
+ correlationId: string;
36
+ causationId?: string;
37
+ provenance?: {
38
+ source: string;
39
+ auditAttributes?: Record<string, string>;
40
+ };
41
+ db: TDb;
42
+ services?: FabricRuntimeServices;
43
+ /**
44
+ * When the host admitted this invocation's submission through the
45
+ * action's `admitSubmission` check, read from the durable invocation
46
+ * record. Absent when the action declares no check, or when the runtime
47
+ * that built this context does not run declared admission checks (a host
48
+ * older than the one that introduced them). A handler whose action
49
+ * declares `admitSubmission` can refuse to run without it.
50
+ */
51
+ admittedAt?: Date;
52
52
  }
53
53
  /**
54
54
  * Trusted facts a host gives an action's `admitSubmission` check. Scope and
55
55
  * actor come from the host's authenticated submission, never from the
56
56
  * parameters.
57
57
  */
58
- interface ActionAdmissionInput {
59
- readonly actionId: ActionId;
60
- readonly tenantId: string;
61
- readonly spaceId: string;
62
- readonly actorId: string;
63
- readonly actorType: ActorType;
64
- /**
65
- * The submitted parameters, unvalidated, as a copy made for this check.
66
- * `@fabricorg/platform-host` records its own copy of the same value, taken
67
- * before the check ran, and only if the check admits it; changing this
68
- * copy changes nothing the host records.
69
- */
70
- readonly parameters: Readonly<Record<string, unknown>>;
71
- /**
72
- * Aborted when the host's admission deadline passes. Hosts pass an
73
- * `AbortSignal`. `@fabricorg/platform-host` refuses an answer that settles
74
- * at or after the deadline, even one that settles before the abort.
75
- */
76
- readonly signal: ActionAdmissionSignal;
58
+ export interface ActionAdmissionInput {
59
+ readonly actionId: ActionId;
60
+ readonly tenantId: string;
61
+ readonly spaceId: string;
62
+ readonly actorId: string;
63
+ readonly actorType: ActorType;
64
+ /**
65
+ * The submitted parameters, unvalidated, as a copy made for this check.
66
+ * `@fabricorg/platform-host` records its own copy of the same value, taken
67
+ * before the check ran, and only if the check admits it; changing this
68
+ * copy changes nothing the host records.
69
+ */
70
+ readonly parameters: Readonly<Record<string, unknown>>;
71
+ /**
72
+ * Aborted when the host's admission deadline passes. Hosts pass an
73
+ * `AbortSignal`. `@fabricorg/platform-host` refuses an answer that settles
74
+ * at or after the deadline, even one that settles before the abort.
75
+ */
76
+ readonly signal: ActionAdmissionSignal;
77
77
  }
78
78
  /**
79
79
  * The part of an `AbortSignal` an admission check can rely on. Declared
80
80
  * structurally so this module compiles without DOM or Node type libraries; a
81
81
  * host passes a real `AbortSignal`, which satisfies it.
82
82
  */
83
- interface ActionAdmissionSignal {
84
- readonly aborted: boolean;
85
- addEventListener(type: "abort", listener: () => void, options?: {
86
- once?: boolean;
87
- }): void;
88
- removeEventListener(type: "abort", listener: () => void): void;
83
+ export interface ActionAdmissionSignal {
84
+ readonly aborted: boolean;
85
+ addEventListener(type: "abort", listener: () => void, options?: {
86
+ once?: boolean;
87
+ }): void;
88
+ removeEventListener(type: "abort", listener: () => void): void;
89
89
  }
90
90
  /**
91
91
  * An admission check's answer. Only `{ admitted: true }` admits. A refusal's
@@ -93,11 +93,11 @@ interface ActionAdmissionSignal {
93
93
  * then letters, digits, `_`, `.`, `:` or `-`, at most 128 characters), never
94
94
  * a submitted value: the host puts it in the error it throws.
95
95
  */
96
- type ActionAdmissionDecision = {
97
- readonly admitted: true;
96
+ export type ActionAdmissionDecision = {
97
+ readonly admitted: true;
98
98
  } | {
99
- readonly admitted: false;
100
- readonly code: string;
99
+ readonly admitted: false;
100
+ readonly code: string;
101
101
  };
102
102
  /**
103
103
  * Decides whether a submission may be recorded at all. A host that supports
@@ -105,165 +105,164 @@ type ActionAdmissionDecision = {
105
105
  * anything durable for the submission; a refusal, a throw, a timeout or any
106
106
  * answer other than `{ admitted: true }` refuses the submission.
107
107
  */
108
- type ActionAdmission = (input: ActionAdmissionInput) => Promise<ActionAdmissionDecision>;
109
- interface ActionResult {
110
- success: boolean;
111
- data?: Record<string, unknown>;
112
- error?: string;
108
+ export type ActionAdmission = (input: ActionAdmissionInput) => Promise<ActionAdmissionDecision>;
109
+ export interface ActionResult {
110
+ success: boolean;
111
+ data?: Record<string, unknown>;
112
+ error?: string;
113
113
  }
114
- type ActionHandler<TDb = unknown> = (ctx: ActionContext<TDb>, params: unknown) => Promise<ActionResult>;
115
- interface AdapterStepRetryPolicy {
116
- idempotent: boolean;
117
- maxAttempts?: number;
118
- initialDelayMs?: number;
119
- backoffMultiplier?: number;
120
- maxDelayMs?: number;
114
+ export type ActionHandler<TDb = unknown> = (ctx: ActionContext<TDb>, params: unknown) => Promise<ActionResult>;
115
+ export interface AdapterStepRetryPolicy {
116
+ idempotent: boolean;
117
+ maxAttempts?: number;
118
+ initialDelayMs?: number;
119
+ backoffMultiplier?: number;
120
+ maxDelayMs?: number;
121
121
  }
122
- interface AdapterStep {
123
- adapterType: string;
124
- operation: string;
125
- retryPolicy?: AdapterStepRetryPolicy;
126
- getInput: (params: unknown, handlerResult: Record<string, unknown>) => Record<string, unknown> | undefined;
122
+ export interface AdapterStep {
123
+ adapterType: string;
124
+ operation: string;
125
+ retryPolicy?: AdapterStepRetryPolicy;
126
+ getInput: (params: unknown, handlerResult: Record<string, unknown>) => Record<string, unknown> | undefined;
127
127
  }
128
- interface ActionStateMachineBinding {
129
- entityType: string;
130
- targetState: string | ((params: unknown) => string);
131
- getEntityId: (params: unknown) => string | undefined;
128
+ export interface ActionStateMachineBinding {
129
+ entityType: string;
130
+ targetState: string | ((params: unknown) => string);
131
+ getEntityId: (params: unknown) => string | undefined;
132
132
  }
133
- interface ActionDefinition<TDb = unknown> extends SurfaceDeclaration {
134
- actionId: ActionId;
135
- namespace: string;
136
- version: number;
137
- schema: SchemaValidator;
138
- /**
139
- * Optional check a host runs on every submission before it records
140
- * anything durable for it (invocation, idempotency key, events, errors).
141
- * Use it when parameters must be validated against trusted context, for
142
- * example a secret reference the tenant's secret store must hold, before
143
- * they may be persisted. `@fabricorg/platform-host` runs it from the
144
- * release that introduced it; an older host ignores it, so a handler that
145
- * relies on it should require `ActionContext.admittedAt`.
146
- */
147
- admitSubmission?: ActionAdmission;
148
- /** Optional validation contract for the public handler result data. */
149
- resultSchema?: SchemaValidator;
150
- handler?: ActionHandler<TDb>;
151
- requiredRoles?: string[];
152
- requiredPermissions?: string[];
153
- policies?: `${string}.v${number}`[];
154
- emitsEvents: string[];
155
- idempotent: boolean;
156
- mutatesDomain: boolean;
157
- /** Portable execution semantics used by hosts, gateways, and generated capability contracts. */
158
- execution?: ActionExecutionContract;
159
- stateMachine?: ActionStateMachineBinding;
160
- adapterSteps?: AdapterStep[];
161
- /** Completion actions can attest only after all external adapter work succeeds. */
162
- eventPhase?: "before_adapters" | "after_adapters";
163
- /**
164
- * If "saga", the action is a multi-step orchestration. The worker dispatches
165
- * to a registered saga implementation instead of running `handler` directly.
166
- */
167
- kind?: "atomic" | "saga";
133
+ export interface ActionDefinition<TDb = unknown> extends SurfaceDeclaration {
134
+ actionId: ActionId;
135
+ namespace: string;
136
+ version: number;
137
+ schema: SchemaValidator;
138
+ /**
139
+ * Optional check a host runs on every submission before it records
140
+ * anything durable for it (invocation, idempotency key, events, errors).
141
+ * Use it when parameters must be validated against trusted context, for
142
+ * example a secret reference the tenant's secret store must hold, before
143
+ * they may be persisted. `@fabricorg/platform-host` runs it from the
144
+ * release that introduced it; an older host ignores it, so a handler that
145
+ * relies on it should require `ActionContext.admittedAt`.
146
+ */
147
+ admitSubmission?: ActionAdmission;
148
+ /** Optional validation contract for the public handler result data. */
149
+ resultSchema?: SchemaValidator;
150
+ handler?: ActionHandler<TDb>;
151
+ requiredRoles?: string[];
152
+ requiredPermissions?: string[];
153
+ policies?: `${string}.v${number}`[];
154
+ emitsEvents: string[];
155
+ idempotent: boolean;
156
+ mutatesDomain: boolean;
157
+ /** Portable execution semantics used by hosts, gateways, and generated capability contracts. */
158
+ execution?: ActionExecutionContract;
159
+ stateMachine?: ActionStateMachineBinding;
160
+ adapterSteps?: AdapterStep[];
161
+ /** Completion actions can attest only after all external adapter work succeeds. */
162
+ eventPhase?: "before_adapters" | "after_adapters";
163
+ /**
164
+ * If "saga", the action is a multi-step orchestration. The worker dispatches
165
+ * to a registered saga implementation instead of running `handler` directly.
166
+ */
167
+ kind?: "atomic" | "saga";
168
168
  }
169
- type ActionConnectivity = "online-required" | "offline-capturable";
170
- type AuthorityMoment = "capture" | "execution" | "both";
171
- type ActionIdempotencyStance = "required" | "supported" | "prohibited";
172
- type ActionCompletionMode = "immediate" | "accepted" | "long-running";
173
- type ActionConsistency = "authoritative-now" | "provisional-until-reconciled";
174
- type ActionDataSensitivity = "public" | "internal" | "confidential" | "restricted";
175
- interface ActionExecutionContract {
176
- connectivity: ActionConnectivity;
177
- authorityMoment: AuthorityMoment;
178
- idempotency: ActionIdempotencyStance;
179
- /**
180
- * `immediate`: the invocation settles within the host's execution.
181
- * `accepted` and `long-running`: an adapter may hand the work to an
182
- * external system and the invocation stays running until that system
183
- * completes it by reference through the host's completion ingress.
184
- * Declare `completionDeadlineMs` on a `long-running` action so a callback
185
- * that never comes is noticed rather than waited on forever.
186
- */
187
- completion: ActionCompletionMode;
188
- /**
189
- * How long an accepted handoff may wait for its completion before the host
190
- * moves the invocation to reconciliation. Without it, nothing sweeps the
191
- * handoff. Refused on `immediate`, since nothing external completes it.
192
- */
193
- completionDeadlineMs?: number;
194
- consistency: ActionConsistency;
195
- sensitivity?: ActionDataSensitivity;
169
+ export type ActionConnectivity = "online-required" | "offline-capturable";
170
+ export type AuthorityMoment = "capture" | "execution" | "both";
171
+ export type ActionIdempotencyStance = "required" | "supported" | "prohibited";
172
+ export type ActionCompletionMode = "immediate" | "accepted" | "long-running";
173
+ export type ActionConsistency = "authoritative-now" | "provisional-until-reconciled";
174
+ export type ActionDataSensitivity = "public" | "internal" | "confidential" | "restricted";
175
+ export interface ActionExecutionContract {
176
+ connectivity: ActionConnectivity;
177
+ authorityMoment: AuthorityMoment;
178
+ idempotency: ActionIdempotencyStance;
179
+ /**
180
+ * `immediate`: the invocation settles within the host's execution.
181
+ * `accepted` and `long-running`: an adapter may hand the work to an
182
+ * external system and the invocation stays running until that system
183
+ * completes it by reference through the host's completion ingress.
184
+ * Declare `completionDeadlineMs` on a `long-running` action so a callback
185
+ * that never comes is noticed rather than waited on forever.
186
+ */
187
+ completion: ActionCompletionMode;
188
+ /**
189
+ * How long an accepted handoff may wait for its completion before the host
190
+ * moves the invocation to reconciliation. Without it, nothing sweeps the
191
+ * handoff. Refused on `immediate`, since nothing external completes it.
192
+ */
193
+ completionDeadlineMs?: number;
194
+ consistency: ActionConsistency;
195
+ sensitivity?: ActionDataSensitivity;
196
196
  }
197
- interface SagaContext {
198
- actionInvocationId: string;
199
- tenantId: string;
200
- spaceId: string;
201
- parameters: unknown;
202
- sleep?: (delayMs: number) => Promise<void>;
203
- query?: <T = unknown>(model: string, operation: string, args: unknown) => Promise<T>;
204
- /**
205
- * Wait for a named external signal carrying a payload of `T`, with a timeout.
206
- *
207
- * Resolves with the payload of the first signal received, or `null` if the timeout
208
- * fires first. Subsequent distinct signals with the same name received before
209
- * another `awaitSignal` call are buffered in FIFO order so none is lost.
210
- *
211
- * A signal may carry a stable signal ID that the sender keeps the same on each redelivery
212
- * (for example a webhook delivery ID or an approval decision ID). A runtime drops
213
- * a signal whose ID it has already received for this saga, so a sender retrying
214
- * after a timeout does not wake the saga twice. Signals without an ID are not
215
- * deduplicated. `@fabricorg/platform-temporal` provides `createSagaSignalInbox()`
216
- * for Temporal runtimes.
217
- *
218
- * Intended for agent-driven and webhook-driven coordination: replace polling loops
219
- * with push-based wakeups while preserving the saga's deterministic replay
220
- * semantics (the runtime is responsible for capturing signals into workflow history).
221
- *
222
- * Optional. Runtimes that cannot implement push-based signaling (e.g. an in-memory
223
- * test harness) may omit this; sagas should treat absence as a fallback condition
224
- * and use `sleep` + `query` polling instead.
225
- *
226
- * Signal *senders* are runtime-specific (e.g. a Temporal `WorkflowClient.signal()`
227
- * call from an action handler). Apps that need to send signals from action
228
- * handlers should expose a coordination service via `ActionContext.services`
229
- * — the platform does not prescribe the sender API.
230
- *
231
- * @example
232
- * const payload = await ctx.awaitSignal?.<{ result: Record<string, unknown> }>(
233
- * "userInputProcessed",
234
- * 5 * 60 * 1000,
235
- * );
236
- * if (payload) { /* handle pushed result *\/ }
237
- * else { /* timeout — fall back to deterministic path *\/ }
238
- */
239
- awaitSignal?: <T = unknown>(signalName: string, timeoutMs: number) => Promise<T | null>;
197
+ export interface SagaContext {
198
+ actionInvocationId: string;
199
+ tenantId: string;
200
+ spaceId: string;
201
+ parameters: unknown;
202
+ sleep?: (delayMs: number) => Promise<void>;
203
+ query?: <T = unknown>(model: string, operation: string, args: unknown) => Promise<T>;
204
+ /**
205
+ * Wait for a named external signal carrying a payload of `T`, with a timeout.
206
+ *
207
+ * Resolves with the payload of the first signal received, or `null` if the timeout
208
+ * fires first. Subsequent distinct signals with the same name received before
209
+ * another `awaitSignal` call are buffered in FIFO order so none is lost.
210
+ *
211
+ * A signal may carry a stable signal ID that the sender keeps the same on each redelivery
212
+ * (for example a webhook delivery ID or an approval decision ID). A runtime drops
213
+ * a signal whose ID it has already received for this saga, so a sender retrying
214
+ * after a timeout does not wake the saga twice. Signals without an ID are not
215
+ * deduplicated. `@fabricorg/platform-temporal` provides `createSagaSignalInbox()`
216
+ * for Temporal runtimes.
217
+ *
218
+ * Intended for agent-driven and webhook-driven coordination: replace polling loops
219
+ * with push-based wakeups while preserving the saga's deterministic replay
220
+ * semantics (the runtime is responsible for capturing signals into workflow history).
221
+ *
222
+ * Optional. Runtimes that cannot implement push-based signaling (e.g. an in-memory
223
+ * test harness) may omit this; sagas should treat absence as a fallback condition
224
+ * and use `sleep` + `query` polling instead.
225
+ *
226
+ * Signal *senders* are runtime-specific (e.g. a Temporal `WorkflowClient.signal()`
227
+ * call from an action handler). Apps that need to send signals from action
228
+ * handlers should expose a coordination service via `ActionContext.services`
229
+ * — the platform does not prescribe the sender API.
230
+ *
231
+ * @example
232
+ * const payload = await ctx.awaitSignal?.<{ result: Record<string, unknown> }>(
233
+ * "userInputProcessed",
234
+ * 5 * 60 * 1000,
235
+ * );
236
+ * if (payload) { /* handle pushed result *\/ }
237
+ * else { /* timeout — fall back to deterministic path *\/ }
238
+ */
239
+ awaitSignal?: <T = unknown>(signalName: string, timeoutMs: number) => Promise<T | null>;
240
240
  }
241
- interface SagaChildActionInput {
242
- suffix: string;
243
- actionId: string;
244
- parameters: Record<string, unknown>;
241
+ export interface SagaChildActionInput {
242
+ suffix: string;
243
+ actionId: string;
244
+ parameters: Record<string, unknown>;
245
245
  }
246
- type SagaRunChild = (input: SagaChildActionInput) => Promise<Record<string, unknown>>;
247
- interface SagaCompletionEvent {
248
- eventType: string;
249
- subjectType: string;
250
- subjectId: string;
251
- payload: unknown;
252
- eventSchemaVersion?: number;
246
+ export type SagaRunChild = (input: SagaChildActionInput) => Promise<Record<string, unknown>>;
247
+ export interface SagaCompletionEvent {
248
+ eventType: string;
249
+ subjectType: string;
250
+ subjectId: string;
251
+ payload: unknown;
252
+ eventSchemaVersion?: number;
253
253
  }
254
- interface SagaCompletion {
255
- resultData: Record<string, unknown>;
256
- event?: SagaCompletionEvent;
254
+ export interface SagaCompletion {
255
+ resultData: Record<string, unknown>;
256
+ event?: SagaCompletionEvent;
257
257
  }
258
- type SagaImplementation = (ctx: SagaContext, runChild: SagaRunChild) => Promise<SagaCompletion>;
259
- declare function assertActionId(actionId: string): asserts actionId is ActionId;
260
- interface ActionRegistry<TDb = unknown> {
261
- register(definition: ActionDefinition<TDb>): void;
262
- registerIfMissing(definition: ActionDefinition<TDb>): void;
263
- resolve(actionId: ActionId): ActionDefinition<TDb> | undefined;
264
- has(actionId: string): actionId is ActionId;
265
- ids(): ActionId[];
258
+ export type SagaImplementation = (ctx: SagaContext, runChild: SagaRunChild) => Promise<SagaCompletion>;
259
+ export declare function assertActionId(actionId: string): asserts actionId is ActionId;
260
+ export interface ActionRegistry<TDb = unknown> {
261
+ register(definition: ActionDefinition<TDb>): void;
262
+ registerIfMissing(definition: ActionDefinition<TDb>): void;
263
+ resolve(actionId: ActionId): ActionDefinition<TDb> | undefined;
264
+ has(actionId: string): actionId is ActionId;
265
+ ids(): ActionId[];
266
266
  }
267
- declare function createActionRegistry<TDb = unknown>(definitions?: readonly ActionDefinition<TDb>[]): ActionRegistry<TDb>;
268
-
269
- export { ACTOR_TYPES, type ActionAdmission, type ActionAdmissionDecision, type ActionAdmissionInput, type ActionAdmissionSignal, type ActionCompletionMode, type ActionConnectivity, type ActionConsistency, type ActionContext, type ActionDataSensitivity, type ActionDefinition, type ActionExecutionContract, type ActionHandler, type ActionId, type ActionIdempotencyStance, type ActionRegistry, type ActionResult, type ActionStateMachineBinding, type ActionStatus, type ActorType, type AdapterStep, type AdapterStepRetryPolicy, type AuthorityMoment, type FabricRuntimeServices, type SagaChildActionInput, type SagaCompletion, type SagaCompletionEvent, type SagaContext, type SagaImplementation, type SagaRunChild, type SchemaParseIssue, type SchemaParseResult, type SchemaValidator, assertActionId, assertActorType, createActionRegistry, isActorType };
267
+ export declare function createActionRegistry<TDb = unknown>(definitions?: readonly ActionDefinition<TDb>[]): ActionRegistry<TDb>;
268
+ //#endregion
@@ -1,3 +1,42 @@
1
- export { ACTOR_TYPES, assertActionId, assertActorType, createActionRegistry, isActorType } from '../chunk-PIDZQAEL.js';
2
- //# sourceMappingURL=index.js.map
1
+ //#region actions/index.ts
2
+ const ACTOR_TYPES = [
3
+ "natural_person",
4
+ "agent",
5
+ "system",
6
+ "service_account",
7
+ "external_system",
8
+ "integration"
9
+ ];
10
+ function isActorType(value) {
11
+ return ACTOR_TYPES.includes(value);
12
+ }
13
+ function assertActorType(value) {
14
+ if (!isActorType(value)) throw new Error(`Invalid actorType: ${value}`);
15
+ }
16
+ function assertActionId(actionId) {
17
+ if (!/^[a-z][a-z0-9-]*\.[a-z][a-z0-9_]*$/.test(actionId)) throw new Error(`Invalid action ID: ${actionId}`);
18
+ }
19
+ function createActionRegistry(definitions = []) {
20
+ const actions = /* @__PURE__ */ new Map();
21
+ const register = (definition) => {
22
+ assertActionId(definition.actionId);
23
+ if (actions.has(definition.actionId)) throw new Error(`Action "${definition.actionId}" is already registered`);
24
+ if (definition.mutatesDomain && definition.emitsEvents.length === 0) throw new Error(`Action "${definition.actionId}" mutates domain but emits no events. Every mutating action must emit at least one AssetEvent.`);
25
+ if (definition.admitSubmission !== void 0 && typeof definition.admitSubmission !== "function") throw new Error(`Action "${definition.actionId}" declares admitSubmission that is not a function.`);
26
+ actions.set(definition.actionId, definition);
27
+ };
28
+ for (const definition of definitions) register(definition);
29
+ return {
30
+ register,
31
+ registerIfMissing(definition) {
32
+ if (!actions.has(definition.actionId)) register(definition);
33
+ },
34
+ resolve: (actionId) => actions.get(actionId),
35
+ has: (actionId) => actions.has(actionId),
36
+ ids: () => Array.from(actions.keys())
37
+ };
38
+ }
39
+ //#endregion
40
+ export { ACTOR_TYPES, assertActionId, assertActorType, createActionRegistry, isActorType };
41
+
3
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../actions/index.ts"],"sourcesContent":["import type { SurfaceDeclaration } from \"../discovery\";\nexport type ActionId = `${string}.${string}`;\n\nexport interface SchemaParseIssue {\n\tpath: PropertyKey[];\n\tmessage: string;\n}\n\nexport type SchemaParseResult<T = unknown> =\n\t| { success: true; data: T }\n\t| { success: false; error: { issues: SchemaParseIssue[] } };\n\nexport interface SchemaValidator<T = unknown> {\n\tparse(input: unknown): T;\n\tsafeParse(input: unknown): SchemaParseResult<T>;\n}\n\nexport type ActorType =\n\t| \"natural_person\"\n\t| \"agent\"\n\t| \"system\"\n\t| \"service_account\"\n\t| \"external_system\"\n\t| \"integration\";\n\nexport const ACTOR_TYPES: readonly ActorType[] = [\n\t\"natural_person\",\n\t\"agent\",\n\t\"system\",\n\t\"service_account\",\n\t\"external_system\",\n\t\"integration\",\n] as const;\n\nexport function isActorType(value: string): value is ActorType {\n\treturn (ACTOR_TYPES as readonly string[]).includes(value);\n}\n\nexport function assertActorType(value: string): asserts value is ActorType {\n\tif (!isActorType(value)) {\n\t\tthrow new Error(`Invalid actorType: ${value}`);\n\t}\n}\n\nexport type ActionStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"blocked_by_policy\"\n\t| \"waiting_for_approval\"\n\t| \"reconciliation_required\"\n\t| \"validation_failed\";\n\nexport interface FabricRuntimeServices {\n\treadonly [serviceName: string]: unknown;\n}\n\nexport interface ActionContext<TDb = unknown> {\n\tactionInvocationId: string;\n\ttenantId: string;\n\tspaceId: string;\n\tactorId: string;\n\tactorType: ActorType;\n\tcorrelationId: string;\n\tcausationId?: string;\n\tprovenance?: { source: string; auditAttributes?: Record<string, string> };\n\tdb: TDb;\n\tservices?: FabricRuntimeServices;\n\t/**\n\t * When the host admitted this invocation's submission through the\n\t * action's `admitSubmission` check, read from the durable invocation\n\t * record. Absent when the action declares no check, or when the runtime\n\t * that built this context does not run declared admission checks (a host\n\t * older than the one that introduced them). A handler whose action\n\t * declares `admitSubmission` can refuse to run without it.\n\t */\n\tadmittedAt?: Date;\n}\n\n/**\n * Trusted facts a host gives an action's `admitSubmission` check. Scope and\n * actor come from the host's authenticated submission, never from the\n * parameters.\n */\nexport interface ActionAdmissionInput {\n\treadonly actionId: ActionId;\n\treadonly tenantId: string;\n\treadonly spaceId: string;\n\treadonly actorId: string;\n\treadonly actorType: ActorType;\n\t/**\n\t * The submitted parameters, unvalidated, as a copy made for this check.\n\t * `@fabricorg/platform-host` records its own copy of the same value, taken\n\t * before the check ran, and only if the check admits it; changing this\n\t * copy changes nothing the host records.\n\t */\n\treadonly parameters: Readonly<Record<string, unknown>>;\n\t/**\n\t * Aborted when the host's admission deadline passes. Hosts pass an\n\t * `AbortSignal`. `@fabricorg/platform-host` refuses an answer that settles\n\t * at or after the deadline, even one that settles before the abort.\n\t */\n\treadonly signal: ActionAdmissionSignal;\n}\n\n/**\n * The part of an `AbortSignal` an admission check can rely on. Declared\n * structurally so this module compiles without DOM or Node type libraries; a\n * host passes a real `AbortSignal`, which satisfies it.\n */\nexport interface ActionAdmissionSignal {\n\treadonly aborted: boolean;\n\taddEventListener(type: \"abort\", listener: () => void, options?: { once?: boolean }): void;\n\tremoveEventListener(type: \"abort\", listener: () => void): void;\n}\n\n/**\n * An admission check's answer. Only `{ admitted: true }` admits. A refusal's\n * `code` must be a fixed code chosen by the action (lower-case first letter,\n * then letters, digits, `_`, `.`, `:` or `-`, at most 128 characters), never\n * a submitted value: the host puts it in the error it throws.\n */\nexport type ActionAdmissionDecision =\n\t| { readonly admitted: true }\n\t| { readonly admitted: false; readonly code: string };\n\n/**\n * Decides whether a submission may be recorded at all. A host that supports\n * it runs the check after authorizing the submitter and before it writes\n * anything durable for the submission; a refusal, a throw, a timeout or any\n * answer other than `{ admitted: true }` refuses the submission.\n */\nexport type ActionAdmission = (input: ActionAdmissionInput) => Promise<ActionAdmissionDecision>;\n\nexport interface ActionResult {\n\tsuccess: boolean;\n\tdata?: Record<string, unknown>;\n\terror?: string;\n}\n\nexport type ActionHandler<TDb = unknown> = (\n\tctx: ActionContext<TDb>,\n\tparams: unknown,\n) => Promise<ActionResult>;\n\nexport interface AdapterStepRetryPolicy {\n\tidempotent: boolean;\n\tmaxAttempts?: number;\n\tinitialDelayMs?: number;\n\tbackoffMultiplier?: number;\n\tmaxDelayMs?: number;\n}\n\nexport interface AdapterStep {\n\tadapterType: string;\n\toperation: string;\n\tretryPolicy?: AdapterStepRetryPolicy;\n\tgetInput: (\n\t\tparams: unknown,\n\t\thandlerResult: Record<string, unknown>,\n\t) => Record<string, unknown> | undefined;\n}\n\nexport interface ActionStateMachineBinding {\n\tentityType: string;\n\ttargetState: string | ((params: unknown) => string);\n\tgetEntityId: (params: unknown) => string | undefined;\n}\n\nexport interface ActionDefinition<TDb = unknown> extends SurfaceDeclaration {\n\tactionId: ActionId;\n\tnamespace: string;\n\tversion: number;\n\tschema: SchemaValidator;\n\t/**\n\t * Optional check a host runs on every submission before it records\n\t * anything durable for it (invocation, idempotency key, events, errors).\n\t * Use it when parameters must be validated against trusted context, for\n\t * example a secret reference the tenant's secret store must hold, before\n\t * they may be persisted. `@fabricorg/platform-host` runs it from the\n\t * release that introduced it; an older host ignores it, so a handler that\n\t * relies on it should require `ActionContext.admittedAt`.\n\t */\n\tadmitSubmission?: ActionAdmission;\n\t/** Optional validation contract for the public handler result data. */\n\tresultSchema?: SchemaValidator;\n\thandler?: ActionHandler<TDb>;\n\trequiredRoles?: string[];\n\trequiredPermissions?: string[];\n\tpolicies?: `${string}.v${number}`[];\n\temitsEvents: string[];\n\tidempotent: boolean;\n\tmutatesDomain: boolean;\n\t/** Portable execution semantics used by hosts, gateways, and generated capability contracts. */\n\texecution?: ActionExecutionContract;\n\tstateMachine?: ActionStateMachineBinding;\n\tadapterSteps?: AdapterStep[];\n\t/** Completion actions can attest only after all external adapter work succeeds. */\n\teventPhase?: \"before_adapters\" | \"after_adapters\";\n\t/**\n\t * If \"saga\", the action is a multi-step orchestration. The worker dispatches\n\t * to a registered saga implementation instead of running `handler` directly.\n\t */\n\tkind?: \"atomic\" | \"saga\";\n}\n\nexport type ActionConnectivity = \"online-required\" | \"offline-capturable\";\nexport type AuthorityMoment = \"capture\" | \"execution\" | \"both\";\nexport type ActionIdempotencyStance = \"required\" | \"supported\" | \"prohibited\";\nexport type ActionCompletionMode = \"immediate\" | \"accepted\" | \"long-running\";\nexport type ActionConsistency = \"authoritative-now\" | \"provisional-until-reconciled\";\nexport type ActionDataSensitivity = \"public\" | \"internal\" | \"confidential\" | \"restricted\";\n\nexport interface ActionExecutionContract {\n\tconnectivity: ActionConnectivity;\n\tauthorityMoment: AuthorityMoment;\n\tidempotency: ActionIdempotencyStance;\n\t/**\n\t * `immediate`: the invocation settles within the host's execution.\n\t * `accepted` and `long-running`: an adapter may hand the work to an\n\t * external system and the invocation stays running until that system\n\t * completes it by reference through the host's completion ingress.\n\t * Declare `completionDeadlineMs` on a `long-running` action so a callback\n\t * that never comes is noticed rather than waited on forever.\n\t */\n\tcompletion: ActionCompletionMode;\n\t/**\n\t * How long an accepted handoff may wait for its completion before the host\n\t * moves the invocation to reconciliation. Without it, nothing sweeps the\n\t * handoff. Refused on `immediate`, since nothing external completes it.\n\t */\n\tcompletionDeadlineMs?: number;\n\tconsistency: ActionConsistency;\n\tsensitivity?: ActionDataSensitivity;\n}\n\nexport interface SagaContext {\n\tactionInvocationId: string;\n\ttenantId: string;\n\tspaceId: string;\n\tparameters: unknown;\n\tsleep?: (delayMs: number) => Promise<void>;\n\tquery?: <T = unknown>(model: string, operation: string, args: unknown) => Promise<T>;\n\t/**\n\t * Wait for a named external signal carrying a payload of `T`, with a timeout.\n\t *\n\t * Resolves with the payload of the first signal received, or `null` if the timeout\n\t * fires first. Subsequent distinct signals with the same name received before\n\t * another `awaitSignal` call are buffered in FIFO order so none is lost.\n\t *\n\t * A signal may carry a stable signal ID that the sender keeps the same on each redelivery\n\t * (for example a webhook delivery ID or an approval decision ID). A runtime drops\n\t * a signal whose ID it has already received for this saga, so a sender retrying\n\t * after a timeout does not wake the saga twice. Signals without an ID are not\n\t * deduplicated. `@fabricorg/platform-temporal` provides `createSagaSignalInbox()`\n\t * for Temporal runtimes.\n\t *\n\t * Intended for agent-driven and webhook-driven coordination: replace polling loops\n\t * with push-based wakeups while preserving the saga's deterministic replay\n\t * semantics (the runtime is responsible for capturing signals into workflow history).\n\t *\n\t * Optional. Runtimes that cannot implement push-based signaling (e.g. an in-memory\n\t * test harness) may omit this; sagas should treat absence as a fallback condition\n\t * and use `sleep` + `query` polling instead.\n\t *\n\t * Signal *senders* are runtime-specific (e.g. a Temporal `WorkflowClient.signal()`\n\t * call from an action handler). Apps that need to send signals from action\n\t * handlers should expose a coordination service via `ActionContext.services`\n\t * — the platform does not prescribe the sender API.\n\t *\n\t * @example\n\t * const payload = await ctx.awaitSignal?.<{ result: Record<string, unknown> }>(\n\t * \"userInputProcessed\",\n\t * 5 * 60 * 1000,\n\t * );\n\t * if (payload) { /* handle pushed result *\\/ }\n\t * else { /* timeout — fall back to deterministic path *\\/ }\n\t */\n\tawaitSignal?: <T = unknown>(signalName: string, timeoutMs: number) => Promise<T | null>;\n}\n\nexport interface SagaChildActionInput {\n\tsuffix: string;\n\tactionId: string;\n\tparameters: Record<string, unknown>;\n}\n\nexport type SagaRunChild = (input: SagaChildActionInput) => Promise<Record<string, unknown>>;\n\nexport interface SagaCompletionEvent {\n\teventType: string;\n\tsubjectType: string;\n\tsubjectId: string;\n\tpayload: unknown;\n\teventSchemaVersion?: number;\n}\n\nexport interface SagaCompletion {\n\tresultData: Record<string, unknown>;\n\tevent?: SagaCompletionEvent;\n}\n\nexport type SagaImplementation = (\n\tctx: SagaContext,\n\trunChild: SagaRunChild,\n) => Promise<SagaCompletion>;\n\nexport function assertActionId(actionId: string): asserts actionId is ActionId {\n\tif (!/^[a-z][a-z0-9-]*\\.[a-z][a-z0-9_]*$/.test(actionId)) {\n\t\tthrow new Error(`Invalid action ID: ${actionId}`);\n\t}\n}\n\nexport interface ActionRegistry<TDb = unknown> {\n\tregister(definition: ActionDefinition<TDb>): void;\n\tregisterIfMissing(definition: ActionDefinition<TDb>): void;\n\tresolve(actionId: ActionId): ActionDefinition<TDb> | undefined;\n\thas(actionId: string): actionId is ActionId;\n\tids(): ActionId[];\n}\n\nexport function createActionRegistry<TDb = unknown>(definitions: readonly ActionDefinition<TDb>[] = []): ActionRegistry<TDb> {\n\tconst actions = new Map<ActionId, ActionDefinition<TDb>>();\n\tconst register = (definition: ActionDefinition<TDb>): void => {\n\t\tassertActionId(definition.actionId);\n\t\tif (actions.has(definition.actionId)) throw new Error(`Action \"${definition.actionId}\" is already registered`);\n\t\tif (definition.mutatesDomain && definition.emitsEvents.length === 0) {\n\t\t\tthrow new Error(`Action \"${definition.actionId}\" mutates domain but emits no events. Every mutating action must emit at least one AssetEvent.`);\n\t\t}\n\t\tif (definition.admitSubmission !== undefined && typeof definition.admitSubmission !== \"function\") {\n\t\t\tthrow new Error(`Action \"${definition.actionId}\" declares admitSubmission that is not a function.`);\n\t\t}\n\t\tactions.set(definition.actionId, definition);\n\t};\n\tfor (const definition of definitions) register(definition);\n\treturn {\n\t\tregister,\n\t\tregisterIfMissing(definition) {\n\t\t\tif (!actions.has(definition.actionId)) register(definition);\n\t\t},\n\t\tresolve: (actionId) => actions.get(actionId),\n\t\thas: (actionId): actionId is ActionId => actions.has(actionId as ActionId),\n\t\tids: () => Array.from(actions.keys()),\n\t};\n}\n"],"mappings":";AAyBA,MAAa,cAAoC;CAChD;CACA;CACA;CACA;CACA;CACA;AACD;AAEA,SAAgB,YAAY,OAAmC;CAC9D,OAAQ,YAAkC,SAAS,KAAK;AACzD;AAEA,SAAgB,gBAAgB,OAA2C;CAC1E,IAAI,CAAC,YAAY,KAAK,GACrB,MAAM,IAAI,MAAM,sBAAsB,OAAO;AAE/C;AA0QA,SAAgB,eAAe,UAAgD;CAC9E,IAAI,CAAC,qCAAqC,KAAK,QAAQ,GACtD,MAAM,IAAI,MAAM,sBAAsB,UAAU;AAElD;AAUA,SAAgB,qBAAoC,cAAgD,CAAC,GAAwB;CAC5H,MAAM,0BAAU,IAAI,IAAqC;CACzD,MAAM,YAAY,eAA4C;EAC7D,eAAe,WAAW,QAAQ;EAClC,IAAI,QAAQ,IAAI,WAAW,QAAQ,GAAG,MAAM,IAAI,MAAM,WAAW,WAAW,SAAS,wBAAwB;EAC7G,IAAI,WAAW,iBAAiB,WAAW,YAAY,WAAW,GACjE,MAAM,IAAI,MAAM,WAAW,WAAW,SAAS,+FAA+F;EAE/I,IAAI,WAAW,oBAAoB,KAAA,KAAa,OAAO,WAAW,oBAAoB,YACrF,MAAM,IAAI,MAAM,WAAW,WAAW,SAAS,mDAAmD;EAEnG,QAAQ,IAAI,WAAW,UAAU,UAAU;CAC5C;CACA,KAAK,MAAM,cAAc,aAAa,SAAS,UAAU;CACzD,OAAO;EACN;EACA,kBAAkB,YAAY;GAC7B,IAAI,CAAC,QAAQ,IAAI,WAAW,QAAQ,GAAG,SAAS,UAAU;EAC3D;EACA,UAAU,aAAa,QAAQ,IAAI,QAAQ;EAC3C,MAAM,aAAmC,QAAQ,IAAI,QAAoB;EACzE,WAAW,MAAM,KAAK,QAAQ,KAAK,CAAC;CACrC;AACD"}