@cullet/erp-core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/KIT_CONTEXT.md +39 -0
  2. package/README.md +110 -0
  3. package/dist/errors/index.d.ts +2 -0
  4. package/dist/errors/index.js +3 -0
  5. package/dist/exceptions/validation-field.d.ts +2 -0
  6. package/dist/exceptions/validation-field.js +2 -0
  7. package/dist/gate-engine-registry.js +260 -0
  8. package/dist/gate-engine-registry.js.map +1 -0
  9. package/dist/gate-types.d.ts +307 -0
  10. package/dist/gate-v1-payload.schema.js +677 -0
  11. package/dist/gate-v1-payload.schema.js.map +1 -0
  12. package/dist/index.d.ts +88 -0
  13. package/dist/index.js +153 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/outcome.js +92 -0
  16. package/dist/outcome.js.map +1 -0
  17. package/dist/parse-gate-payload.d.ts +136 -0
  18. package/dist/policies/engines/index.d.ts +3 -0
  19. package/dist/policies/engines/index.js +2 -0
  20. package/dist/policies/engines/v1/gate/index.d.ts +115 -0
  21. package/dist/policies/engines/v1/gate/index.js +84 -0
  22. package/dist/policies/engines/v1/gate/index.js.map +1 -0
  23. package/dist/policies/index.d.ts +4 -0
  24. package/dist/policies/index.js +5 -0
  25. package/dist/policy-service.d.ts +541 -0
  26. package/dist/policy-service.js +992 -0
  27. package/dist/policy-service.js.map +1 -0
  28. package/dist/validation-code.js +210 -0
  29. package/dist/validation-code.js.map +1 -0
  30. package/dist/validation-error.d.ts +686 -0
  31. package/dist/validation-error.js +757 -0
  32. package/dist/validation-error.js.map +1 -0
  33. package/dist/validation-field.d.ts +12 -0
  34. package/dist/validation-field.js +23 -0
  35. package/dist/validation-field.js.map +1 -0
  36. package/meta.json +66 -0
  37. package/package.json +59 -0
  38. package/src/core/application/commands/command.ts +28 -0
  39. package/src/core/application/commands/index.ts +2 -0
  40. package/src/core/application/commands/requested-by.ts +97 -0
  41. package/src/core/application/index.ts +31 -0
  42. package/src/core/application/policy-error-mapper.ts +60 -0
  43. package/src/core/application/ports/index.ts +14 -0
  44. package/src/core/application/ports/logger.port.ts +10 -0
  45. package/src/core/application/ports/metrics.port.ts +9 -0
  46. package/src/core/application/ports/policy-port.ts +20 -0
  47. package/src/core/application/ports/repository.port.ts +7 -0
  48. package/src/core/application/ports/temporal-repository.port.ts +14 -0
  49. package/src/core/application/ports/tracer.port.ts +16 -0
  50. package/src/core/application/queries/index.ts +2 -0
  51. package/src/core/application/queries/query.ts +53 -0
  52. package/src/core/application/temporal/index.ts +11 -0
  53. package/src/core/application/temporal/temporal-context.ts +41 -0
  54. package/src/core/application/temporal/temporal-use-case.ts +41 -0
  55. package/src/core/application/use-case.ts +24 -0
  56. package/src/core/config/core-config.instance.ts +14 -0
  57. package/src/core/config/core-config.ts +87 -0
  58. package/src/core/config/index.ts +12 -0
  59. package/src/core/config/policy-reporter.ts +60 -0
  60. package/src/core/config/silent-policy-reporter.ts +5 -0
  61. package/src/core/domain/entity.ts +69 -0
  62. package/src/core/domain/rulesets/entity-ruleset.contracts.ts +16 -0
  63. package/src/core/domain/rulesets/ruleset-registry.ts +71 -0
  64. package/src/core/domain/rulesets/ruleset.contracts.ts +15 -0
  65. package/src/core/domain/rulesets/value-object-ruleset.contracts.ts +13 -0
  66. package/src/core/domain/temporal/index.ts +18 -0
  67. package/src/core/domain/temporal/temporal-range.ts +53 -0
  68. package/src/core/domain/temporal/temporal-snapshot.ts +47 -0
  69. package/src/core/domain/temporal/transaction-time.ts +60 -0
  70. package/src/core/domain/temporal/valid-time.ts +57 -0
  71. package/src/core/domain/value-object.ts +30 -0
  72. package/src/core/errors/app-error.ts +85 -0
  73. package/src/core/errors/authentication-error.ts +171 -0
  74. package/src/core/errors/authorization-error.ts +204 -0
  75. package/src/core/errors/business-rule-violation-error.ts +28 -0
  76. package/src/core/errors/conflict-error.ts +246 -0
  77. package/src/core/errors/error-codes.ts +60 -0
  78. package/src/core/errors/idempotency-error.ts +372 -0
  79. package/src/core/errors/index.ts +99 -0
  80. package/src/core/errors/integration-error.ts +157 -0
  81. package/src/core/errors/legacy-incompatible-error.ts +26 -0
  82. package/src/core/errors/not-found-error.ts +27 -0
  83. package/src/core/errors/serialization-error.ts +233 -0
  84. package/src/core/errors/temporal-error.ts +145 -0
  85. package/src/core/errors/types.ts +74 -0
  86. package/src/core/errors/unexpected-error.ts +22 -0
  87. package/src/core/errors/utils/index.ts +4 -0
  88. package/src/core/errors/utils/json-safe.ts +93 -0
  89. package/src/core/errors/validation-error.ts +34 -0
  90. package/src/core/exceptions/business-rule-violation-exception.ts +12 -0
  91. package/src/core/exceptions/domain-exception.ts +9 -0
  92. package/src/core/exceptions/entity-not-found-exception.ts +12 -0
  93. package/src/core/exceptions/invalid-state-transition-exception.ts +15 -0
  94. package/src/core/exceptions/invariant-violation-exception.ts +9 -0
  95. package/src/core/exceptions/validation-code.ts +39 -0
  96. package/src/core/exceptions/validation-exception.ts +39 -0
  97. package/src/core/exceptions/validation-field.ts +32 -0
  98. package/src/core/index.ts +15 -0
  99. package/src/core/policies/asof/asof.ts +68 -0
  100. package/src/core/policies/asof/index.ts +2 -0
  101. package/src/core/policies/catalog/catalog-types.ts +12 -0
  102. package/src/core/policies/catalog/catalog.instance.ts +21 -0
  103. package/src/core/policies/catalog/index.ts +11 -0
  104. package/src/core/policies/catalog/policy-catalog-entry.ts +220 -0
  105. package/src/core/policies/catalog/policy-catalog.ts +124 -0
  106. package/src/core/policies/catalog/policy-key.ts +78 -0
  107. package/src/core/policies/context/context-builder.ts +391 -0
  108. package/src/core/policies/context/context-registry.instance.ts +26 -0
  109. package/src/core/policies/context/context-registry.ts +95 -0
  110. package/src/core/policies/context/context-resolver.ts +31 -0
  111. package/src/core/policies/context/context-seed.ts +32 -0
  112. package/src/core/policies/context/index.ts +21 -0
  113. package/src/core/policies/context/path.ts +152 -0
  114. package/src/core/policies/defs/in-memory-policy-definition-repo.ts +73 -0
  115. package/src/core/policies/defs/index.ts +20 -0
  116. package/src/core/policies/defs/policy-definition-repository.ts +8 -0
  117. package/src/core/policies/defs/policy-definition.ts +192 -0
  118. package/src/core/policies/defs/policy-payload.contracts.ts +13 -0
  119. package/src/core/policies/defs/policy-scope.ts +53 -0
  120. package/src/core/policies/defs/policy-semver.ts +83 -0
  121. package/src/core/policies/engines/compute-engine-registry.ts +57 -0
  122. package/src/core/policies/engines/compute-evaluator-registry.ts +28 -0
  123. package/src/core/policies/engines/compute-payload.ts +5 -0
  124. package/src/core/policies/engines/compute-registry.ts +67 -0
  125. package/src/core/policies/engines/compute-types.ts +51 -0
  126. package/src/core/policies/engines/condition-evaluator-reporter.ts +34 -0
  127. package/src/core/policies/engines/gate-engine-registry.ts +38 -0
  128. package/src/core/policies/engines/gate-payload.ts +5 -0
  129. package/src/core/policies/engines/gate-types.ts +63 -0
  130. package/src/core/policies/engines/index.ts +48 -0
  131. package/src/core/policies/engines/parse-compute-payload.ts +71 -0
  132. package/src/core/policies/engines/parse-gate-payload.ts +68 -0
  133. package/src/core/policies/engines/v1/compute/compute-engine-v1.ts +55 -0
  134. package/src/core/policies/engines/v1/compute/compute-payload.schema.ts +75 -0
  135. package/src/core/policies/engines/v1/compute/index.ts +12 -0
  136. package/src/core/policies/engines/v1/compute/resolve-decision-table-v1.ts +54 -0
  137. package/src/core/policies/engines/v1/condition-evaluator.ts +592 -0
  138. package/src/core/policies/engines/v1/condition-schema.ts +50 -0
  139. package/src/core/policies/engines/v1/condition-types.ts +41 -0
  140. package/src/core/policies/engines/v1/gate/gate-engine-v1.ts +157 -0
  141. package/src/core/policies/engines/v1/gate/gate-types-v1.ts +12 -0
  142. package/src/core/policies/engines/v1/gate/gate-v1-payload.schema.ts +46 -0
  143. package/src/core/policies/engines/v1/gate/index.ts +9 -0
  144. package/src/core/policies/engines/v1/index.ts +13 -0
  145. package/src/core/policies/index.ts +132 -0
  146. package/src/core/policies/package/policy-package.ts +17 -0
  147. package/src/core/policies/policy-ids.ts +60 -0
  148. package/src/core/policies/resolver/index.ts +1 -0
  149. package/src/core/policies/resolver/policy-resolver.ts +57 -0
  150. package/src/core/policies/service/index.ts +10 -0
  151. package/src/core/policies/service/policy-evaluation-error.ts +148 -0
  152. package/src/core/policies/service/policy-service.ts +493 -0
  153. package/src/core/policies/utils/date.ts +7 -0
  154. package/src/core/policies/utils/hash.ts +90 -0
  155. package/src/core/policies/utils/index.ts +3 -0
  156. package/src/core/policies/utils/result.ts +4 -0
  157. package/src/core/result/outcome.ts +158 -0
  158. package/src/core/result/result.ts +153 -0
  159. package/src/core/shared/aggregate-version.ts +11 -0
  160. package/src/core/shared/hashing.ts +38 -0
  161. package/src/core/shared/immutable.ts +46 -0
  162. package/src/core/shared/temporal-guards.ts +22 -0
  163. package/src/core/versioning/domain-event-contracts.ts +73 -0
  164. package/src/core/versioning/version.ts +34 -0
  165. package/src/errors/index.ts +1 -0
  166. package/src/examples/rulesets/entity/order-creation-rules-v1.ts +31 -0
  167. package/src/examples/rulesets/entity/order-invariants-v1.ts +48 -0
  168. package/src/examples/rulesets/entity/order-invariants-v2.ts +28 -0
  169. package/src/examples/rulesets/entity/order.ts +162 -0
  170. package/src/examples/rulesets/value-object/cpf-rules-v1.ts +52 -0
  171. package/src/examples/rulesets/value-object/cpf-rules-v2.ts +27 -0
  172. package/src/examples/rulesets/value-object/cpf.ts +37 -0
  173. package/src/examples/rulesets/value-object/customer.ts +67 -0
  174. package/src/examples/rulesets/value-object/person-name-rules-v1.ts +37 -0
  175. package/src/examples/rulesets/value-object/person-name-rules-v2.ts +27 -0
  176. package/src/examples/rulesets/value-object/person-name.ts +39 -0
  177. package/src/exceptions/validation-field.ts +1 -0
  178. package/src/index.ts +11 -0
  179. package/src/policies/engines/index.ts +1 -0
  180. package/src/policies/engines/v1/gate/index.ts +1 -0
  181. package/src/policies/index.ts +1 -0
  182. package/src/version.ts +7 -0
@@ -0,0 +1,307 @@
1
+ //#region src/core/result/result.d.ts
2
+ /**
3
+ * Represents the outcome of an operation that may succeed or fail.
4
+ * Useful for avoiding excessive exceptions and making error flows explicit.
5
+ */
6
+ declare abstract class Result<T, E> {
7
+ protected constructor();
8
+ /**
9
+ * Creates a success result containing a value.
10
+ */
11
+ static ok<T>(value: T): Result<T, never>;
12
+ /**
13
+ * Creates an error result containing an error object.
14
+ */
15
+ static err<E>(error: E): Result<never, E>;
16
+ /**
17
+ * Returns true when this is a success result.
18
+ */
19
+ abstract isOk(): this is Ok<T>;
20
+ /**
21
+ * Returns true when this is an error result.
22
+ */
23
+ abstract isErr(): this is Err<E>;
24
+ /**
25
+ * Runs a handler based on the result state (similar to pattern matching).
26
+ */
27
+ abstract match<R>(handlers: {
28
+ ok: (value: T) => R;
29
+ err: (error: E) => R;
30
+ }): R;
31
+ /**
32
+ * Returns the value when this is success, or null when this is an error.
33
+ */
34
+ getOrNull(): T | null;
35
+ /**
36
+ * Returns the error when this is a failure, or null when this is a success.
37
+ */
38
+ errorOrNull(): E | null;
39
+ /**
40
+ * Returns the value when this is a success, or throws the error when this is a failure.
41
+ */
42
+ getOrThrow(): T;
43
+ /**
44
+ * Transforms the success value using the provided function. Keeps the error when this is a failure.
45
+ */
46
+ map<R>(transform: (value: T) => R): Result<R, E>;
47
+ /**
48
+ * Transforms the error using the provided function. Keeps the value when this is a success.
49
+ */
50
+ mapError<F>(transform: (error: E) => F): Result<T, F>;
51
+ /**
52
+ * Chains another operation that returns a Result when this result is a success.
53
+ */
54
+ flatMap<R>(transform: (value: T) => Result<R, E>): Result<R, E>;
55
+ }
56
+ /**
57
+ * Success variant of Result.
58
+ */
59
+ declare class Ok<T> extends Result<T, never> {
60
+ readonly value: T;
61
+ constructor(value: T);
62
+ isOk(): this is Ok<T>;
63
+ isErr(): this is Err<never>;
64
+ match<R>(handlers: {
65
+ ok: (value: T) => R;
66
+ err: (error: never) => R;
67
+ }): R;
68
+ }
69
+ /**
70
+ * Error variant of Result.
71
+ */
72
+ declare class Err<E> extends Result<never, E> {
73
+ readonly error: E;
74
+ constructor(error: E);
75
+ isOk(): this is Ok<never>;
76
+ isErr(): this is Err<E>;
77
+ match<R>(handlers: {
78
+ ok: (value: never) => R;
79
+ err: (error: E) => R;
80
+ }): R;
81
+ }
82
+ //#endregion
83
+ //#region src/core/policies/engines/condition-evaluator-reporter.d.ts
84
+ interface ConditionEvaluationCause {
85
+ readonly name: string;
86
+ readonly message: string;
87
+ }
88
+ type ConditionEvaluationReportLevel = "warn" | "error";
89
+ type ConditionEvaluationReportTag = "MISSING_CONTEXT_FIELD" | "NULLISH_NUMERIC_OPERAND_NOT_ALLOWED" | "NULLISH_DATE_OPERAND_NOT_ALLOWED" | "INVALID_DATE_OPERAND" | "CONDITION_EVAL_THREW";
90
+ interface ConditionEvaluationReport {
91
+ readonly occurredAt: Date;
92
+ readonly level: ConditionEvaluationReportLevel;
93
+ readonly tag: ConditionEvaluationReportTag;
94
+ readonly message: string;
95
+ readonly engineVersion: number;
96
+ readonly details: Readonly<Record<string, unknown>>;
97
+ }
98
+ interface ConditionEvaluatorReporter {
99
+ warn(report: ConditionEvaluationReport): void;
100
+ error(report: ConditionEvaluationReport): void;
101
+ }
102
+ type ConditionEvaluationOptions = {
103
+ readonly reporter: ConditionEvaluatorReporter;
104
+ readonly engineVersion: number;
105
+ };
106
+ //#endregion
107
+ //#region src/core/policies/policy-ids.d.ts
108
+ type Brand<TValue, TBrand extends string> = TValue & {
109
+ readonly __brand: TBrand;
110
+ };
111
+ type PolicyDefinitionId = Brand<string, "PolicyDefinitionId">;
112
+ type PolicyDecisionId = Brand<string, "PolicyDecisionId">;
113
+ type TenantId = Brand<string, "TenantId">;
114
+ type SchoolId = Brand<string, "SchoolId">;
115
+ declare function asPolicyDefinitionId(value: string): PolicyDefinitionId;
116
+ declare function asPolicyDecisionId(value: string): PolicyDecisionId;
117
+ declare function asTenantId(value: string): TenantId;
118
+ declare function asSchoolId(value: string): SchoolId;
119
+ //#endregion
120
+ //#region src/core/config/policy-reporter.d.ts
121
+ type ConditionEvalEvent = ConditionEvaluationReport & {
122
+ readonly kind: "condition-eval";
123
+ };
124
+ interface PolicyResolutionEvent {
125
+ readonly kind: "policy-resolution";
126
+ readonly level: "info";
127
+ readonly policyKey: string;
128
+ readonly definitionId: PolicyDefinitionId;
129
+ readonly policyVersion: string;
130
+ readonly engineKind: "GATE" | "COMPUTE";
131
+ readonly engineVersion: number;
132
+ readonly occurredAt: Date;
133
+ }
134
+ interface PolicyEvaluationFailedEvent {
135
+ readonly kind: "policy-evaluation-failed";
136
+ readonly level: "error";
137
+ readonly policyKey: string | undefined;
138
+ readonly errorKind: string;
139
+ readonly message: string;
140
+ readonly cause: string;
141
+ readonly occurredAt: Date;
142
+ }
143
+ interface PolicyEvaluationCompletedEvent {
144
+ readonly kind: "policy-evaluation-completed";
145
+ readonly level: "info";
146
+ readonly policyKey: string;
147
+ readonly decisionId: PolicyDecisionId;
148
+ readonly engineKind: "GATE" | "COMPUTE";
149
+ readonly occurredAt: Date;
150
+ }
151
+ type PolicyEvent = ConditionEvalEvent | PolicyResolutionEvent | PolicyEvaluationFailedEvent | PolicyEvaluationCompletedEvent;
152
+ interface PolicyReporter {
153
+ report(event: PolicyEvent): void;
154
+ }
155
+ //#endregion
156
+ //#region src/core/config/core-config.d.ts
157
+ interface CoreObservabilityConfig {
158
+ readonly reporter?: PolicyReporter;
159
+ }
160
+ interface CoreConfigOptions {
161
+ readonly observability?: CoreObservabilityConfig;
162
+ }
163
+ /**
164
+ * Centraliza a configuracao pura do core sem depender de implementacoes
165
+ * concretas de logging, tracing ou report.
166
+ */
167
+ declare class CoreConfig {
168
+ #private;
169
+ constructor(options?: CoreConfigOptions);
170
+ configure(options: CoreConfigOptions): this;
171
+ reset(): this;
172
+ getPolicyReporter(): PolicyReporter;
173
+ getConditionEvaluationOptions(engineVersion: number): ConditionEvaluationOptions;
174
+ }
175
+ //#endregion
176
+ //#region src/core/result/outcome.d.ts
177
+ /**
178
+ * Outcome — Business decision abstraction.
179
+ *
180
+ * Represents the semantic result of a domain decision, policy evaluation,
181
+ * or business rule. NOT for technical success/failure — use Result for that.
182
+ *
183
+ * Mental model:
184
+ * "What was the business decision?"
185
+ * NOT "Did the operation succeed?"
186
+ *
187
+ * The status axis represents valid business outcomes (APPROVED, REJECTED,
188
+ * ALLOW, DENY, NO_OP, etc.), never technical Ok/Err.
189
+ *
190
+ * @typeParam S - Union of valid status literals for this outcome
191
+ * @typeParam D - Shape of the decision data carried by this outcome
192
+ */
193
+ declare class Outcome<S extends string, D = undefined> {
194
+ readonly status: S;
195
+ readonly data: D;
196
+ readonly reason: string | undefined;
197
+ readonly metadata: Readonly<Record<string, unknown>>;
198
+ private constructor();
199
+ static of<S extends string, D = undefined>(status: S, data: D, reason?: string, metadata?: Record<string, unknown>): Outcome<S, D>;
200
+ static approved<D = undefined>(data: D, reason?: string): Outcome<"APPROVED", D>;
201
+ static rejected<D = undefined>(data: D, reason: string): Outcome<"REJECTED", D>;
202
+ static noOp<D = undefined>(data: D, reason?: string): Outcome<"NO_OP", D>;
203
+ static deferred<D = undefined>(data: D, reason: string): Outcome<"DEFERRED", D>;
204
+ static requiresReview<D = undefined>(data: D, reason: string): Outcome<"REQUIRES_REVIEW", D>;
205
+ /**
206
+ * Narrows this Outcome to a specific status.
207
+ *
208
+ * @example
209
+ * if (outcome.is('DENY')) {
210
+ * outcome.data.violations // TS knows status is 'DENY'
211
+ * }
212
+ */
213
+ is<T extends S>(status: T): this is Outcome<T, D>;
214
+ /**
215
+ * Exhaustive pattern match over all possible statuses.
216
+ * TypeScript enforces that every status has a handler.
217
+ *
218
+ * @example
219
+ * outcome.match({
220
+ * ALLOW: (o) => handleAllow(o.data),
221
+ * DENY: (o) => handleDeny(o.data.violations),
222
+ * })
223
+ */
224
+ match<THandlers extends { [K in S]: (outcome: Outcome<K, D>) => unknown }>(handlers: THandlers): ReturnType<THandlers[S]>;
225
+ withMetadata(extra: Record<string, unknown>): Outcome<S, D>;
226
+ withReason(reason: string): Outcome<S, D>;
227
+ toString(): string;
228
+ }
229
+ /** Common business outcome statuses. Extend per domain as needed. */
230
+ type CommonOutcomeStatus = "APPROVED" | "REJECTED" | "NO_OP" | "DEFERRED" | "REQUIRES_REVIEW";
231
+ //#endregion
232
+ //#region src/core/policies/engines/v1/condition-types.d.ts
233
+ type ConditionOp = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "notIn" | "isNull" | "isNotNull";
234
+ interface ConditionLeafNode {
235
+ readonly field: string;
236
+ readonly op: ConditionOp;
237
+ readonly value: unknown;
238
+ readonly allowNull?: true;
239
+ }
240
+ interface ConditionAndNode {
241
+ readonly and: readonly ConditionNode[];
242
+ }
243
+ interface ConditionOrNode {
244
+ readonly or: readonly ConditionNode[];
245
+ }
246
+ interface ConditionNotNode {
247
+ readonly not: ConditionNode;
248
+ }
249
+ type ConditionNode = ConditionLeafNode | ConditionAndNode | ConditionOrNode | ConditionNotNode;
250
+ //#endregion
251
+ //#region src/core/policies/engines/v1/gate/gate-types-v1.d.ts
252
+ type GatePayloadV1 = {
253
+ readonly condition: ConditionNode;
254
+ } | {
255
+ readonly allowIf: ConditionNode;
256
+ readonly defaultOutcome: "ALLOW" | "DENY";
257
+ };
258
+ //#endregion
259
+ //#region src/core/policies/engines/gate-payload.d.ts
260
+ type GatePayload = GatePayloadV1;
261
+ //#endregion
262
+ //#region src/core/policies/engines/gate-types.d.ts
263
+ type PolicyContext = Record<string, unknown>;
264
+ interface GateTraceLeafSnapshot {
265
+ readonly kind: "LEAF";
266
+ readonly field: string;
267
+ readonly op: string;
268
+ readonly allowNull?: true;
269
+ }
270
+ type GateTraceNodeSnapshot = GateTraceLeafSnapshot | {
271
+ readonly kind: "AND" | "OR";
272
+ readonly childCount: number;
273
+ } | {
274
+ readonly kind: "NOT";
275
+ };
276
+ interface GateViolationTrace {
277
+ readonly conditionPath: string;
278
+ readonly decisiveNode: GateTraceNodeSnapshot;
279
+ readonly lastEvaluatedLeaf: GateTraceLeafSnapshot;
280
+ readonly lastEvaluatedLeafPath: string;
281
+ readonly lastEvaluatedLeafResult: boolean;
282
+ readonly field: string;
283
+ readonly op: string;
284
+ }
285
+ interface PolicyViolation {
286
+ readonly code: string;
287
+ readonly message: string;
288
+ readonly trace?: GateViolationTrace;
289
+ }
290
+ type GateStatus = "ALLOW" | "DENY";
291
+ interface GateOutcomeData {
292
+ readonly violations: readonly PolicyViolation[];
293
+ }
294
+ /** Semantic outcome of a GATE policy evaluation. */
295
+ type GateOutcome = Outcome<GateStatus, GateOutcomeData>;
296
+ /**
297
+ * Contract every versioned gate engine must satisfy.
298
+ * Receives an already-parsed `GatePayload`; parsing from raw `unknown` is
299
+ * the registry's responsibility via `parseGatePayload`.
300
+ */
301
+ interface VersionedGateEngine {
302
+ readonly version: number;
303
+ evaluate(payload: GatePayload, context: PolicyContext): Result<GateOutcome, string>;
304
+ }
305
+ //#endregion
306
+ export { ConditionEvaluationReport as A, TenantId as C, asTenantId as D, asSchoolId as E, Ok as F, Result as I, ConditionEvaluationReportTag as M, ConditionEvaluatorReporter as N, ConditionEvaluationCause as O, Err as P, SchoolId as S, asPolicyDefinitionId as T, CoreConfigOptions as _, GateTraceNodeSnapshot as a, PolicyDecisionId as b, PolicyViolation as c, GatePayloadV1 as d, ConditionLeafNode as f, CoreConfig as g, Outcome as h, GateTraceLeafSnapshot as i, ConditionEvaluationReportLevel as j, ConditionEvaluationOptions as k, VersionedGateEngine as l, CommonOutcomeStatus as m, GateOutcomeData as n, GateViolationTrace as o, ConditionNode as p, GateStatus as r, PolicyContext as s, GateOutcome as t, GatePayload as u, CoreObservabilityConfig as v, asPolicyDecisionId as w, PolicyDefinitionId as x, PolicyReporter as y };
307
+ //# sourceMappingURL=gate-types.d.ts.map