@fabricorg/platform 1.10.0 → 1.10.2

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 +54 -0
  2. package/README.md +32 -3
  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 -393
  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 -56
  100. package/dist/policies/index.d.cts +2 -261
  101. package/dist/policies/index.d.ts +2 -261
  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-A42JJIPL.cjs +0 -699
  141. package/dist/chunk-A42JJIPL.cjs.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-PXD7NG6X.js +0 -686
  179. package/dist/chunk-PXD7NG6X.js.map +0 -1
  180. package/dist/chunk-Q4Q4JPR3.js +0 -524
  181. package/dist/chunk-Q4Q4JPR3.js.map +0 -1
  182. package/dist/chunk-RALMUSOX.js +0 -55
  183. package/dist/chunk-RALMUSOX.js.map +0 -1
  184. package/dist/chunk-SNTV45LH.cjs +0 -295
  185. package/dist/chunk-SNTV45LH.cjs.map +0 -1
  186. package/dist/chunk-TBS2S5AX.cjs +0 -40
  187. package/dist/chunk-TBS2S5AX.cjs.map +0 -1
  188. package/dist/chunk-TYNIFC7J.js +0 -253
  189. package/dist/chunk-TYNIFC7J.js.map +0 -1
  190. package/dist/chunk-UGWGHTNC.cjs +0 -56
  191. package/dist/chunk-UGWGHTNC.cjs.map +0 -1
  192. package/dist/chunk-WI7CWNYI.cjs +0 -68
  193. package/dist/chunk-WI7CWNYI.cjs.map +0 -1
  194. package/dist/chunk-WNZP53GI.js +0 -386
  195. package/dist/chunk-WNZP53GI.js.map +0 -1
  196. package/dist/chunk-WQ3BYI7T.cjs +0 -249
  197. package/dist/chunk-WQ3BYI7T.cjs.map +0 -1
  198. package/dist/chunk-Y2PJLRIY.js +0 -36
  199. package/dist/chunk-Y2PJLRIY.js.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
@@ -0,0 +1,262 @@
1
+ import { ActionId, ActorType, FabricRuntimeServices } from "./actions/index.cjs";
2
+ //#region policies/reconciliation-required.d.ts
3
+ /** A possibly committed domain effect requiring an operator decision at the handler transaction boundary. */
4
+ declare class ReconciliationRequiredError extends Error {
5
+ readonly name = "ReconciliationRequiredError";
6
+ readonly code: "EXECUTION_RECONCILIATION_REQUIRED";
7
+ constructor(message: string, options?: {
8
+ cause?: unknown;
9
+ });
10
+ }
11
+ /**
12
+ * Recognise a ReconciliationRequiredError, including one constructed by a second
13
+ * package copy (for example ESM and CommonJS builds loaded side by side).
14
+ */
15
+ declare function isReconciliationRequiredError(error: unknown): error is ReconciliationRequiredError;
16
+ //#endregion
17
+ //#region policies/retryable-execution.d.ts
18
+ /** A transient execution dependency failure; the host decides whether retry is safe. */
19
+ declare class RetryableExecutionError extends Error {
20
+ readonly name = "RetryableExecutionError";
21
+ readonly code: "EXECUTION_RETRYABLE";
22
+ constructor(message: string, options?: {
23
+ cause?: unknown;
24
+ });
25
+ }
26
+ /**
27
+ * Recognise a RetryableExecutionError, including one constructed by a second
28
+ * package copy (for example ESM and CommonJS builds loaded side by side).
29
+ */
30
+ declare function isRetryableExecutionError(error: unknown): error is RetryableExecutionError;
31
+ //#endregion
32
+ //#region policies/index.d.ts
33
+ type PolicyEvaluationResult = "pass" | "warn" | "block";
34
+ type PolicyKind = "code" | "data" | "hybrid";
35
+ type PolicyId = `${string}.v${number}`;
36
+ type PolicyEvaluationMode = "preview" | "execute";
37
+ declare function assertPolicyId(policyId: string): asserts policyId is PolicyId;
38
+ interface PolicyContext<TDb = unknown> {
39
+ tenantId: string;
40
+ spaceId: string;
41
+ actionInvocationId: string;
42
+ actionId: string;
43
+ /** Authenticated actor identity supplied by the host. Omitted only by legacy hosts and previews. */
44
+ actorId?: string;
45
+ actorType?: ActorType;
46
+ parameters: unknown;
47
+ db: TDb;
48
+ now?: Date;
49
+ mode?: PolicyEvaluationMode;
50
+ /**
51
+ * Optional runtime services bag, mirroring {@link FabricRuntimeServices} on
52
+ * `ActionContext`. Lets the host inject dependencies (HTTP clients, secret
53
+ * managers, external policy engines such as OPA, feature flags, etc.) that
54
+ * a code policy evaluator may need without resorting to module-level
55
+ * globals. The shape is opaque to the platform — adapters narrow it.
56
+ */
57
+ services?: FabricRuntimeServices;
58
+ /** Explicit code-policy catalog for this runtime; absence fails closed. */
59
+ resolveCodePolicy?: (policyId: PolicyId) => PolicyEvaluator | undefined;
60
+ }
61
+ interface PolicyFact {
62
+ name: string;
63
+ value: unknown;
64
+ label?: string;
65
+ }
66
+ type PolicyCorrectiveActionKind = "invoke_action" | "navigate" | "manual";
67
+ interface PolicyCorrectiveActionBase {
68
+ kind: PolicyCorrectiveActionKind;
69
+ label: string;
70
+ description?: string;
71
+ requiresRole?: string[];
72
+ requiresConfirmation?: boolean;
73
+ }
74
+ interface PolicyInvokeActionCorrectiveAction extends PolicyCorrectiveActionBase {
75
+ kind: "invoke_action";
76
+ actionId: ActionId;
77
+ parameters?: Record<string, unknown>;
78
+ }
79
+ interface PolicyNavigateCorrectiveAction extends PolicyCorrectiveActionBase {
80
+ kind: "navigate";
81
+ route?: string;
82
+ target?: {
83
+ surface?: string;
84
+ tab?: string;
85
+ field?: string;
86
+ };
87
+ }
88
+ interface PolicyManualCorrectiveAction extends PolicyCorrectiveActionBase {
89
+ kind: "manual";
90
+ }
91
+ type PolicyCorrectiveAction = PolicyInvokeActionCorrectiveAction | PolicyNavigateCorrectiveAction | PolicyManualCorrectiveAction;
92
+ interface PolicyGuidance {
93
+ summary?: string;
94
+ factsUsed: PolicyFact[];
95
+ correctiveActions: PolicyCorrectiveAction[];
96
+ }
97
+ interface PolicyGuidanceValidationResult {
98
+ valid: boolean;
99
+ errors: string[];
100
+ }
101
+ declare function validatePolicyGuidance(guidance: unknown): PolicyGuidanceValidationResult;
102
+ interface PolicyOutcome {
103
+ policyId: PolicyId;
104
+ policyVersion: number;
105
+ policyKind?: PolicyKind;
106
+ result: PolicyEvaluationResult;
107
+ reason?: string;
108
+ guidance?: PolicyGuidance;
109
+ metadata?: Record<string, unknown>;
110
+ dispatchEvidence?: PolicyDispatchEvidence;
111
+ }
112
+ interface PolicyEvaluator<TDb = unknown> {
113
+ policyId: PolicyId;
114
+ version: number;
115
+ kind?: Extract<PolicyKind, "code">;
116
+ previewSafe?: boolean;
117
+ evaluate: (ctx: PolicyContext<TDb>) => Promise<PolicyOutcome>;
118
+ }
119
+ type DataPolicySource = "parameters" | "context";
120
+ type DataPolicyLiteral = string | number | boolean | null;
121
+ type DataPolicyComparisonOperator = "exists" | "equals" | "notEquals" | "gt" | "gte" | "lt" | "lte";
122
+ interface DataPolicySourceReference {
123
+ source: DataPolicySource;
124
+ path: string;
125
+ }
126
+ type DataPolicyCondition = {
127
+ conditionId: string;
128
+ type: "always";
129
+ result: PolicyEvaluationResult;
130
+ reason?: string;
131
+ } | {
132
+ conditionId: string;
133
+ type: "parameter";
134
+ path: string;
135
+ operator: DataPolicyComparisonOperator;
136
+ value?: DataPolicyLiteral;
137
+ onPass?: PolicyEvaluationResult;
138
+ onFail?: PolicyEvaluationResult;
139
+ reason?: string;
140
+ } | {
141
+ conditionId: string;
142
+ type: "comparison";
143
+ left: DataPolicySourceReference;
144
+ operator: DataPolicyComparisonOperator;
145
+ value?: DataPolicyLiteral;
146
+ onPass?: PolicyEvaluationResult;
147
+ onFail?: PolicyEvaluationResult;
148
+ reason?: string;
149
+ } | {
150
+ conditionId: string;
151
+ type: "all" | "any";
152
+ conditions: DataPolicyCondition[];
153
+ onPass?: PolicyEvaluationResult;
154
+ onFail?: PolicyEvaluationResult;
155
+ reason?: string;
156
+ } | {
157
+ conditionId: string;
158
+ type: "not";
159
+ condition: DataPolicyCondition;
160
+ onPass?: PolicyEvaluationResult;
161
+ onFail?: PolicyEvaluationResult;
162
+ reason?: string;
163
+ };
164
+ interface DataPolicyDefinition {
165
+ conditions: DataPolicyCondition[];
166
+ defaultResult?: PolicyEvaluationResult;
167
+ reason?: string;
168
+ }
169
+ interface DataPolicyValidationResult {
170
+ valid: boolean;
171
+ errors: string[];
172
+ }
173
+ interface PolicyFallbackDefinition {
174
+ codeEvaluatorPolicyId: PolicyId;
175
+ onResults?: PolicyEvaluationResult[];
176
+ triggers?: PolicyFallbackTrigger[];
177
+ reason?: string;
178
+ }
179
+ type PolicyFallbackTrigger = "data_result" | "missing_data_definition" | "invalid_data_definition";
180
+ interface DataPolicyConditionResult {
181
+ conditionId: string;
182
+ passed: boolean;
183
+ result: PolicyEvaluationResult;
184
+ reason?: string;
185
+ }
186
+ /**
187
+ * Opaque, consumer-defined reference to the immutable policy authority or
188
+ * snapshot a runtime policy definition was resolved from. Platform records it
189
+ * in dispatch evidence and does not interpret it.
190
+ */
191
+ interface PolicyAuthorityReference {
192
+ snapshotId: string;
193
+ contentHash?: string;
194
+ }
195
+ interface RuntimePolicyDefinition {
196
+ policyId: PolicyId;
197
+ policyVersion: number;
198
+ kind: PolicyKind;
199
+ /** Snapshot/authority this definition came from; copied into dispatch evidence. */
200
+ authority?: PolicyAuthorityReference;
201
+ dataDefinition?: DataPolicyDefinition;
202
+ codeEvaluatorPolicyId?: PolicyId;
203
+ fallback?: PolicyFallbackDefinition;
204
+ }
205
+ interface PolicyDispatchEvidence {
206
+ policyKind: PolicyKind;
207
+ policyId?: PolicyId;
208
+ policyVersion?: number;
209
+ /** Snapshot/authority the evaluated definition was resolved from, when supplied. */
210
+ authority?: PolicyAuthorityReference;
211
+ dispatchPath: Array<"data" | "code" | "fallback">;
212
+ data?: {
213
+ definitionVersion: number;
214
+ definitionStatus: "evaluated" | "missing" | "invalid";
215
+ conditionResults: DataPolicyConditionResult[];
216
+ validationErrors?: string[];
217
+ };
218
+ code?: {
219
+ requestedPolicyId?: PolicyId;
220
+ policyId: PolicyId;
221
+ version?: number;
222
+ registered: boolean;
223
+ skipped?: boolean;
224
+ skipReason?: string;
225
+ };
226
+ fallback?: {
227
+ used: boolean;
228
+ trigger: PolicyFallbackTrigger | "not_triggered";
229
+ reason: string;
230
+ fromResult?: PolicyEvaluationResult;
231
+ definitionVersion: number;
232
+ codeEvaluatorPolicyId: PolicyId;
233
+ };
234
+ /**
235
+ * Provenance for the engine that produced this decision when a code
236
+ * evaluator delegates to an external policy engine (OPA, Cedar, Cerbos,
237
+ * Topaz, etc.). Fabric's `policyId` / `policyVersion` remain canonical for
238
+ * audit; this block carries deployment provenance (decision path, bundle
239
+ * revision, decision ID, input hash). Adapters populate it; the platform
240
+ * keeps `metadata` open-ended so engine-specific typing can live in the
241
+ * adapter package.
242
+ */
243
+ engine?: {
244
+ name: string;
245
+ version?: string;
246
+ metadata?: Record<string, unknown>;
247
+ };
248
+ }
249
+ interface PolicyRegistry {
250
+ register(evaluator: PolicyEvaluator): void;
251
+ registerIfMissing(evaluator: PolicyEvaluator): void;
252
+ resolve(policyId: PolicyId): PolicyEvaluator | undefined;
253
+ ids(): PolicyId[];
254
+ }
255
+ declare function createPolicyRegistry(evaluators?: readonly PolicyEvaluator[]): PolicyRegistry;
256
+ declare function evaluateRegisteredPolicies(policyIds: PolicyId[], ctx: PolicyContext): Promise<PolicyOutcome[]>;
257
+ declare function evaluatePolicyDefinitions(policies: RuntimePolicyDefinition[], ctx: PolicyContext): Promise<PolicyOutcome[]>;
258
+ declare function evaluatePolicyDefinition(policy: RuntimePolicyDefinition, ctx: PolicyContext): Promise<PolicyOutcome>;
259
+ declare function validateDataPolicyDefinition(definition: DataPolicyDefinition): DataPolicyValidationResult;
260
+ declare function aggregatePolicyOutcomes(outcomes: PolicyOutcome[]): PolicyOutcome | undefined;
261
+ //#endregion
262
+ export { RuntimePolicyDefinition as A, isRetryableExecutionError as B, PolicyId as C, PolicyNavigateCorrectiveAction as D, PolicyManualCorrectiveAction as E, evaluatePolicyDefinitions as F, isReconciliationRequiredError as H, evaluateRegisteredPolicies as I, validateDataPolicyDefinition as L, assertPolicyId as M, createPolicyRegistry as N, PolicyOutcome as O, evaluatePolicyDefinition as P, validatePolicyGuidance as R, PolicyGuidanceValidationResult as S, PolicyKind as T, ReconciliationRequiredError as V, PolicyEvaluator as _, DataPolicyLiteral as a, PolicyFallbackTrigger as b, DataPolicyValidationResult as c, PolicyCorrectiveAction as d, PolicyCorrectiveActionBase as f, PolicyEvaluationResult as g, PolicyEvaluationMode as h, DataPolicyDefinition as i, aggregatePolicyOutcomes as j, PolicyRegistry as k, PolicyAuthorityReference as l, PolicyDispatchEvidence as m, DataPolicyCondition as n, DataPolicySource as o, PolicyCorrectiveActionKind as p, DataPolicyConditionResult as r, DataPolicySourceReference as s, DataPolicyComparisonOperator as t, PolicyContext as u, PolicyFact as v, PolicyInvokeActionCorrectiveAction as w, PolicyGuidance as x, PolicyFallbackDefinition as y, RetryableExecutionError as z };
@@ -0,0 +1,78 @@
1
+ //#region objects/index.d.ts
2
+ type FabricObjectType = string;
3
+ type JsonPrimitive = string | number | boolean | null;
4
+ type JsonValue = JsonPrimitive | JsonValue[] | {
5
+ [key: string]: JsonValue;
6
+ };
7
+ /**
8
+ * Dependency-free JSON Schema profile accepted in portable module manifests.
9
+ * Unknown extension keywords must use an `x-` prefix. Runtime validators may
10
+ * support more vocabulary, but exported entity contracts stay in this profile.
11
+ */
12
+ interface PortableJsonSchema {
13
+ $schema?: string;
14
+ $id?: string;
15
+ $ref?: string;
16
+ $defs?: Record<string, PortableJsonSchema>;
17
+ title?: string;
18
+ description?: string;
19
+ type?: "null" | "boolean" | "object" | "array" | "number" | "integer" | "string" | Array<"null" | "boolean" | "object" | "array" | "number" | "integer" | "string">;
20
+ enum?: JsonValue[];
21
+ const?: JsonValue;
22
+ properties?: Record<string, PortableJsonSchema>;
23
+ required?: string[];
24
+ additionalProperties?: boolean | PortableJsonSchema;
25
+ items?: PortableJsonSchema | PortableJsonSchema[];
26
+ prefixItems?: PortableJsonSchema[];
27
+ propertyNames?: PortableJsonSchema;
28
+ patternProperties?: Record<string, PortableJsonSchema>;
29
+ dependentRequired?: Record<string, string[]>;
30
+ allOf?: PortableJsonSchema[];
31
+ anyOf?: PortableJsonSchema[];
32
+ oneOf?: PortableJsonSchema[];
33
+ not?: PortableJsonSchema;
34
+ if?: PortableJsonSchema;
35
+ then?: PortableJsonSchema;
36
+ else?: PortableJsonSchema;
37
+ minimum?: number;
38
+ maximum?: number;
39
+ exclusiveMinimum?: number;
40
+ exclusiveMaximum?: number;
41
+ multipleOf?: number;
42
+ minLength?: number;
43
+ maxLength?: number;
44
+ pattern?: string;
45
+ format?: string;
46
+ minItems?: number;
47
+ maxItems?: number;
48
+ uniqueItems?: boolean;
49
+ default?: JsonValue;
50
+ readOnly?: boolean;
51
+ writeOnly?: boolean;
52
+ deprecated?: boolean;
53
+ contentEncoding?: string;
54
+ contentMediaType?: string;
55
+ examples?: JsonValue[];
56
+ $comment?: string;
57
+ [key: `x-${string}`]: JsonValue | undefined;
58
+ }
59
+ declare function assertPortableJsonSchema(schema: unknown, path?: string): asserts schema is PortableJsonSchema;
60
+ interface JsonSchemaValidationIssue {
61
+ path: Array<string | number>;
62
+ message: string;
63
+ }
64
+ /**
65
+ * Validate JSON data against the dependency-free JSON Schema profile used by
66
+ * portable contracts. This intentionally returns issues instead of throwing so
67
+ * hosts can expose a stable, typed validation failure without leaking values.
68
+ */
69
+ declare function validatePortableJson(schema: PortableJsonSchema, value: unknown): JsonSchemaValidationIssue[];
70
+ declare function assertObjectType(type: string): asserts type is FabricObjectType;
71
+ interface ObjectTypeRegistry {
72
+ register(type: string): void;
73
+ has(type: string): boolean;
74
+ list(): string[];
75
+ }
76
+ declare function createObjectTypeRegistry(initialTypes?: readonly string[]): ObjectTypeRegistry;
77
+ //#endregion
78
+ export { ObjectTypeRegistry as a, assertPortableJsonSchema as c, JsonValue as i, createObjectTypeRegistry as l, JsonPrimitive as n, PortableJsonSchema as o, JsonSchemaValidationIssue as r, assertObjectType as s, FabricObjectType as t, validatePortableJson as u };
@@ -0,0 +1,78 @@
1
+ //#region objects/index.d.ts
2
+ type FabricObjectType = string;
3
+ type JsonPrimitive = string | number | boolean | null;
4
+ type JsonValue = JsonPrimitive | JsonValue[] | {
5
+ [key: string]: JsonValue;
6
+ };
7
+ /**
8
+ * Dependency-free JSON Schema profile accepted in portable module manifests.
9
+ * Unknown extension keywords must use an `x-` prefix. Runtime validators may
10
+ * support more vocabulary, but exported entity contracts stay in this profile.
11
+ */
12
+ interface PortableJsonSchema {
13
+ $schema?: string;
14
+ $id?: string;
15
+ $ref?: string;
16
+ $defs?: Record<string, PortableJsonSchema>;
17
+ title?: string;
18
+ description?: string;
19
+ type?: "null" | "boolean" | "object" | "array" | "number" | "integer" | "string" | Array<"null" | "boolean" | "object" | "array" | "number" | "integer" | "string">;
20
+ enum?: JsonValue[];
21
+ const?: JsonValue;
22
+ properties?: Record<string, PortableJsonSchema>;
23
+ required?: string[];
24
+ additionalProperties?: boolean | PortableJsonSchema;
25
+ items?: PortableJsonSchema | PortableJsonSchema[];
26
+ prefixItems?: PortableJsonSchema[];
27
+ propertyNames?: PortableJsonSchema;
28
+ patternProperties?: Record<string, PortableJsonSchema>;
29
+ dependentRequired?: Record<string, string[]>;
30
+ allOf?: PortableJsonSchema[];
31
+ anyOf?: PortableJsonSchema[];
32
+ oneOf?: PortableJsonSchema[];
33
+ not?: PortableJsonSchema;
34
+ if?: PortableJsonSchema;
35
+ then?: PortableJsonSchema;
36
+ else?: PortableJsonSchema;
37
+ minimum?: number;
38
+ maximum?: number;
39
+ exclusiveMinimum?: number;
40
+ exclusiveMaximum?: number;
41
+ multipleOf?: number;
42
+ minLength?: number;
43
+ maxLength?: number;
44
+ pattern?: string;
45
+ format?: string;
46
+ minItems?: number;
47
+ maxItems?: number;
48
+ uniqueItems?: boolean;
49
+ default?: JsonValue;
50
+ readOnly?: boolean;
51
+ writeOnly?: boolean;
52
+ deprecated?: boolean;
53
+ contentEncoding?: string;
54
+ contentMediaType?: string;
55
+ examples?: JsonValue[];
56
+ $comment?: string;
57
+ [key: `x-${string}`]: JsonValue | undefined;
58
+ }
59
+ declare function assertPortableJsonSchema(schema: unknown, path?: string): asserts schema is PortableJsonSchema;
60
+ interface JsonSchemaValidationIssue {
61
+ path: Array<string | number>;
62
+ message: string;
63
+ }
64
+ /**
65
+ * Validate JSON data against the dependency-free JSON Schema profile used by
66
+ * portable contracts. This intentionally returns issues instead of throwing so
67
+ * hosts can expose a stable, typed validation failure without leaking values.
68
+ */
69
+ declare function validatePortableJson(schema: PortableJsonSchema, value: unknown): JsonSchemaValidationIssue[];
70
+ declare function assertObjectType(type: string): asserts type is FabricObjectType;
71
+ interface ObjectTypeRegistry {
72
+ register(type: string): void;
73
+ has(type: string): boolean;
74
+ list(): string[];
75
+ }
76
+ declare function createObjectTypeRegistry(initialTypes?: readonly string[]): ObjectTypeRegistry;
77
+ //#endregion
78
+ export { ObjectTypeRegistry as a, assertPortableJsonSchema as c, JsonValue as i, createObjectTypeRegistry as l, JsonPrimitive as n, PortableJsonSchema as o, JsonSchemaValidationIssue as r, assertObjectType as s, FabricObjectType as t, validatePortableJson as u };
@@ -0,0 +1,124 @@
1
+ import { t as SurfaceDeclaration } from "./index-CIl1rYRv.js";
2
+ import { o as PortableJsonSchema } from "./index-DZ4mnNb7.js";
3
+ //#region projections/index.d.ts
4
+ interface ReplayableAssetEvent<Payload = unknown> {
5
+ id: string;
6
+ tenantId: string;
7
+ spaceId: string;
8
+ eventType: string;
9
+ eventSchemaVersion?: number;
10
+ subjectType: string;
11
+ subjectId: string;
12
+ payload: Payload;
13
+ /**
14
+ * Monotonic ordering cursor for the tenant/space event ledger. It is not
15
+ * contiguous after a view filters event types or narrows to one subject.
16
+ */
17
+ sequence: number;
18
+ /** Optional contiguous sequence local to this subject. */
19
+ subjectSequence?: number;
20
+ occurredAt: Date | string;
21
+ recordedAt: Date | string;
22
+ actionInvocationId: string;
23
+ correlationId: string;
24
+ }
25
+ interface ViewEventConsumption {
26
+ eventType: string;
27
+ schemaVersions: number[];
28
+ }
29
+ interface ViewContract<State = unknown, Event extends ReplayableAssetEvent = ReplayableAssetEvent> extends SurfaceDeclaration {
30
+ /** Stable module-qualified logical identity, for example `orders/summary`. */
31
+ name: `${string}/${string}`;
32
+ version: string;
33
+ shape: PortableJsonSchema;
34
+ /** Optional JSON Schema for query parameters. Parameterized variants get isolated snapshots. */
35
+ parameterSchema?: PortableJsonSchema;
36
+ consumes: ViewEventConsumption[];
37
+ scope: "tenant-space";
38
+ snapshotVersion: number;
39
+ compatibleSnapshotVersions?: number[];
40
+ usage?: ViewUsageMetadata;
41
+ /** Required to transform any older compatible snapshot into the current state shape. */
42
+ upgradeSnapshot?: (data: unknown, fromVersion: number) => State | Promise<State>;
43
+ initialState: State;
44
+ applyEvent: (state: State, event: Event) => State | Promise<State>;
45
+ }
46
+ interface ViewUsageMetadata {
47
+ semanticRole?: string;
48
+ collection?: {
49
+ pagination: "cursor" | "offset" | "none";
50
+ filterSchema?: PortableJsonSchema;
51
+ sortFields?: string[];
52
+ };
53
+ freshness?: {
54
+ maximumAgeSeconds?: number;
55
+ offlineUsable?: boolean;
56
+ };
57
+ classification?: "public" | "internal" | "confidential" | "restricted";
58
+ }
59
+ declare function viewContractKey(view: Pick<ViewContract, "name" | "version">): string;
60
+ interface ViewRegistry {
61
+ register(view: ViewContract): void;
62
+ registerIfMissing(view: ViewContract): void;
63
+ resolve(name: string, version: string): ViewContract | undefined;
64
+ keys(): string[];
65
+ }
66
+ declare function createViewRegistry(views?: readonly ViewContract[]): ViewRegistry;
67
+ interface ReplayViewOptions<State, Event extends ReplayableAssetEvent = ReplayableAssetEvent> {
68
+ view: ViewContract<State, Event>;
69
+ events: Iterable<Event> | AsyncIterable<Event>;
70
+ scope: ReplayScope;
71
+ snapshot?: (ReplaySnapshot<State> & {
72
+ snapshotVersion: number;
73
+ }) | null;
74
+ /**
75
+ * Set when the event source already applied the snapshot cursor and returns
76
+ * only later events. The snapshot still seeds state, but replay must not try
77
+ * to find its cursor in the supplied incremental stream.
78
+ */
79
+ eventsStartAfterSnapshot?: boolean;
80
+ }
81
+ declare function replayView<State, Event extends ReplayableAssetEvent = ReplayableAssetEvent>({ view, events, scope, snapshot, eventsStartAfterSnapshot }: ReplayViewOptions<State, Event>): Promise<ReplayEventsResult<State, Event>>;
82
+ interface ReplayScope {
83
+ tenantId: string;
84
+ spaceId: string;
85
+ subjectType?: string;
86
+ subjectId?: string;
87
+ }
88
+ interface ReplaySnapshot<State = unknown> {
89
+ snapshotData: State;
90
+ eventCursor?: string | null;
91
+ eventSequence?: number | null;
92
+ /** Per-subject high-water marks. Values prefer subjectSequence when supplied. */
93
+ subjectSequences?: Record<string, number>;
94
+ }
95
+ type ReplayWarningCode = "cursor_not_found" | "duplicate_event" | "missing_sequence" | "subject_scope_incomplete" | "unsupported_event_version";
96
+ interface ReplayWarning {
97
+ code: ReplayWarningCode;
98
+ message: string;
99
+ eventId?: string;
100
+ subjectType?: string;
101
+ subjectId?: string;
102
+ expectedSequence?: number;
103
+ actualSequence?: number;
104
+ }
105
+ interface ReplayEventsOptions<State, Event extends ReplayableAssetEvent = ReplayableAssetEvent> {
106
+ events: Iterable<Event> | AsyncIterable<Event>;
107
+ scope: ReplayScope;
108
+ initialState: State;
109
+ snapshot?: ReplaySnapshot<State> | null;
110
+ applyEvent: (state: State, event: Event) => State | Promise<State>;
111
+ /** The supplied stream begins after the snapshot checkpoint. */
112
+ eventsStartAfterSnapshot?: boolean;
113
+ }
114
+ interface ReplayEventsResult<State, Event extends ReplayableAssetEvent = ReplayableAssetEvent> {
115
+ state: State;
116
+ appliedEvents: Event[];
117
+ warnings: ReplayWarning[];
118
+ eventCursor: string | null;
119
+ eventSequence: number;
120
+ subjectSequences: Record<string, number>;
121
+ }
122
+ declare function replayEvents<State, Event extends ReplayableAssetEvent = ReplayableAssetEvent>({ events, scope, initialState, snapshot, applyEvent, eventsStartAfterSnapshot }: ReplayEventsOptions<State, Event>): Promise<ReplayEventsResult<State, Event>>;
123
+ //#endregion
124
+ export { ReplayViewOptions as a, ReplayableAssetEvent as c, ViewRegistry as d, ViewUsageMetadata as f, viewContractKey as g, replayView as h, ReplaySnapshot as i, ViewContract as l, replayEvents as m, ReplayEventsResult as n, ReplayWarning as o, createViewRegistry as p, ReplayScope as r, ReplayWarningCode as s, ReplayEventsOptions as t, ViewEventConsumption as u };
@@ -0,0 +1,57 @@
1
+ //#region state-machines/engine.d.ts
2
+ interface StateMachineDefinition {
3
+ entityType: string;
4
+ states: Record<string, StateDefinition>;
5
+ transitions: Array<{
6
+ from: string;
7
+ to: string;
8
+ causedByAction: string;
9
+ guard?: (ctx: TransitionContext) => boolean | Promise<boolean>;
10
+ }>;
11
+ }
12
+ type StateMachineDatabaseClient = unknown;
13
+ interface TransitionContext<TDb = StateMachineDatabaseClient> {
14
+ entity: Record<string, unknown>;
15
+ actionInvocationId: string;
16
+ actorId: string;
17
+ parameters: unknown;
18
+ db: TDb;
19
+ }
20
+ interface StateMachineRegistry {
21
+ register(definition: StateMachineDefinition): void;
22
+ registerIfMissing(definition: StateMachineDefinition): void;
23
+ resolve(entityType: string): StateMachineDefinition | undefined;
24
+ validateTransition(entityType: string, from: string, to: string, actionId: string): {
25
+ valid: boolean;
26
+ error?: string;
27
+ };
28
+ allowedTransitions(entityType: string, from: string): Array<{
29
+ to: string;
30
+ causedByAction: string;
31
+ }>;
32
+ stateClass(entityType: string, state: string): StateClass | undefined;
33
+ }
34
+ declare function validateStateMachineTransition(sm: StateMachineDefinition | undefined, entityType: string, from: string, to: string, actionId: string): {
35
+ valid: boolean;
36
+ error?: string;
37
+ };
38
+ /**
39
+ * Validates a transition and evaluates its declared guard against trusted Host
40
+ * context. Callers must construct `context.entity` from authoritative state,
41
+ * never from action parameters.
42
+ */
43
+ declare function evaluateStateMachineTransition<TDb = StateMachineDatabaseClient>(sm: StateMachineDefinition | undefined, entityType: string, from: string, to: string, actionId: string, context: TransitionContext<TDb>): Promise<{
44
+ valid: boolean;
45
+ error?: string;
46
+ }>;
47
+ declare function createStateMachineRegistry(definitions?: readonly StateMachineDefinition[]): StateMachineRegistry;
48
+ //#endregion
49
+ //#region state-machines/index.d.ts
50
+ type StateClass = "initial" | "active" | "action_required" | "waiting" | "terminal" | "exception";
51
+ interface StateDefinition {
52
+ id: string;
53
+ label: string;
54
+ stateClass: StateClass;
55
+ }
56
+ //#endregion
57
+ export { StateMachineRegistry as a, evaluateStateMachineTransition as c, StateMachineDefinition as i, validateStateMachineTransition as l, StateDefinition as n, TransitionContext as o, StateMachineDatabaseClient as r, createStateMachineRegistry as s, StateClass as t };
@@ -0,0 +1,57 @@
1
+ //#region state-machines/engine.d.ts
2
+ interface StateMachineDefinition {
3
+ entityType: string;
4
+ states: Record<string, StateDefinition>;
5
+ transitions: Array<{
6
+ from: string;
7
+ to: string;
8
+ causedByAction: string;
9
+ guard?: (ctx: TransitionContext) => boolean | Promise<boolean>;
10
+ }>;
11
+ }
12
+ type StateMachineDatabaseClient = unknown;
13
+ interface TransitionContext<TDb = StateMachineDatabaseClient> {
14
+ entity: Record<string, unknown>;
15
+ actionInvocationId: string;
16
+ actorId: string;
17
+ parameters: unknown;
18
+ db: TDb;
19
+ }
20
+ interface StateMachineRegistry {
21
+ register(definition: StateMachineDefinition): void;
22
+ registerIfMissing(definition: StateMachineDefinition): void;
23
+ resolve(entityType: string): StateMachineDefinition | undefined;
24
+ validateTransition(entityType: string, from: string, to: string, actionId: string): {
25
+ valid: boolean;
26
+ error?: string;
27
+ };
28
+ allowedTransitions(entityType: string, from: string): Array<{
29
+ to: string;
30
+ causedByAction: string;
31
+ }>;
32
+ stateClass(entityType: string, state: string): StateClass | undefined;
33
+ }
34
+ declare function validateStateMachineTransition(sm: StateMachineDefinition | undefined, entityType: string, from: string, to: string, actionId: string): {
35
+ valid: boolean;
36
+ error?: string;
37
+ };
38
+ /**
39
+ * Validates a transition and evaluates its declared guard against trusted Host
40
+ * context. Callers must construct `context.entity` from authoritative state,
41
+ * never from action parameters.
42
+ */
43
+ declare function evaluateStateMachineTransition<TDb = StateMachineDatabaseClient>(sm: StateMachineDefinition | undefined, entityType: string, from: string, to: string, actionId: string, context: TransitionContext<TDb>): Promise<{
44
+ valid: boolean;
45
+ error?: string;
46
+ }>;
47
+ declare function createStateMachineRegistry(definitions?: readonly StateMachineDefinition[]): StateMachineRegistry;
48
+ //#endregion
49
+ //#region state-machines/index.d.ts
50
+ type StateClass = "initial" | "active" | "action_required" | "waiting" | "terminal" | "exception";
51
+ interface StateDefinition {
52
+ id: string;
53
+ label: string;
54
+ stateClass: StateClass;
55
+ }
56
+ //#endregion
57
+ export { StateMachineRegistry as a, evaluateStateMachineTransition as c, StateMachineDefinition as i, validateStateMachineTransition as l, StateDefinition as n, TransitionContext as o, StateMachineDatabaseClient as r, createStateMachineRegistry as s, StateClass as t };