@cullet/erp-core 1.5.0 → 2.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.
- package/KIT_CONTEXT.md +2 -2
- package/dist/abac/index.d.cts +2 -2
- package/dist/abac/index.d.ts +2 -2
- package/dist/aggregate-version.cjs +14 -0
- package/dist/aggregate-version.cjs.map +1 -0
- package/dist/aggregate-version.js +9 -0
- package/dist/aggregate-version.js.map +1 -0
- package/dist/app-error.cjs +8 -1
- package/dist/app-error.cjs.map +1 -1
- package/dist/app-error.js +8 -1
- package/dist/app-error.js.map +1 -1
- package/dist/application/index.cjs +8 -4
- package/dist/application/index.d.cts +2 -2
- package/dist/application/index.d.ts +2 -2
- package/dist/application/index.js +1 -2
- package/dist/authorization-error.cjs +67 -17
- package/dist/authorization-error.cjs.map +1 -1
- package/dist/authorization-error.d.cts +6 -2
- package/dist/authorization-error.d.ts +6 -2
- package/dist/authorization-error.js +50 -18
- package/dist/authorization-error.js.map +1 -1
- package/dist/authorizer.port.d.cts +18 -3
- package/dist/authorizer.port.d.ts +18 -3
- package/dist/composite-authorizer.d.cts +63 -10
- package/dist/composite-authorizer.d.ts +63 -10
- package/dist/condition-evaluator.cjs +115 -184
- package/dist/condition-evaluator.cjs.map +1 -1
- package/dist/condition-evaluator.js +116 -179
- package/dist/condition-evaluator.js.map +1 -1
- package/dist/core-config.d.cts +53 -6
- package/dist/core-config.d.ts +53 -6
- package/dist/decorate.cjs +14 -0
- package/dist/decorate.js +9 -0
- package/dist/domain/index.cjs +107 -2
- package/dist/domain/index.cjs.map +1 -0
- package/dist/domain/index.d.cts +25 -1
- package/dist/domain/index.d.ts +25 -1
- package/dist/domain/index.js +99 -3
- package/dist/domain/index.js.map +1 -0
- package/dist/domain-event-contracts.cjs +12 -8
- package/dist/domain-event-contracts.cjs.map +1 -1
- package/dist/domain-event-contracts.d.cts +29 -4
- package/dist/domain-event-contracts.d.ts +29 -4
- package/dist/domain-event-contracts.js +11 -7
- package/dist/domain-event-contracts.js.map +1 -1
- package/dist/domain-exception.cjs +2 -1
- package/dist/domain-exception.cjs.map +1 -1
- package/dist/domain-exception.js +2 -1
- package/dist/domain-exception.js.map +1 -1
- package/dist/errors/index.cjs +1 -1
- package/dist/errors/index.d.cts +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +2 -2
- package/dist/exceptions/index.cjs +2 -2
- package/dist/exceptions/index.d.cts +1 -2
- package/dist/exceptions/index.d.ts +1 -2
- package/dist/exceptions/index.js +2 -2
- package/dist/gate-engine-registry.cjs.map +1 -1
- package/dist/gate-engine-registry.d.cts +1 -1
- package/dist/gate-engine-registry.d.ts +1 -1
- package/dist/gate-engine-registry.js.map +1 -1
- package/dist/gate-v1-payload.schema.cjs +11 -6
- package/dist/gate-v1-payload.schema.cjs.map +1 -1
- package/dist/gate-v1-payload.schema.js +11 -6
- package/dist/gate-v1-payload.schema.js.map +1 -1
- package/dist/hashing.cjs +1 -1
- package/dist/hashing.cjs.map +1 -1
- package/dist/hashing.js +2 -2
- package/dist/hashing.js.map +1 -1
- package/dist/immutable.cjs +25 -12
- package/dist/immutable.cjs.map +1 -1
- package/dist/immutable.js +24 -11
- package/dist/immutable.js.map +1 -1
- package/dist/index.cjs +13 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -10
- package/dist/index.d.ts +9 -10
- package/dist/index.js +7 -9
- package/dist/index.js.map +1 -1
- package/dist/invalid-state-transition-exception.cjs +6 -6
- package/dist/invalid-state-transition-exception.cjs.map +1 -1
- package/dist/invalid-state-transition-exception.js +6 -6
- package/dist/invalid-state-transition-exception.js.map +1 -1
- package/dist/invariant-violation-exception.cjs +2 -2
- package/dist/invariant-violation-exception.cjs.map +1 -1
- package/dist/invariant-violation-exception.js +2 -2
- package/dist/invariant-violation-exception.js.map +1 -1
- package/dist/not-found-error.cjs +6 -4
- package/dist/not-found-error.cjs.map +1 -1
- package/dist/not-found-error.js +6 -4
- package/dist/not-found-error.js.map +1 -1
- package/dist/outcome.cjs +5 -5
- package/dist/outcome.cjs.map +1 -1
- package/dist/outcome.js +5 -5
- package/dist/outcome.js.map +1 -1
- package/dist/parse-gate-payload.d.cts +1 -1
- package/dist/parse-gate-payload.d.ts +1 -1
- package/dist/path.d.cts +2 -2
- package/dist/path.d.ts +2 -2
- package/dist/plugin.cjs +23 -13
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +22 -8
- package/dist/plugin.d.ts +22 -8
- package/dist/plugin.js +23 -13
- package/dist/plugin.js.map +1 -1
- package/dist/policies/engines/index.d.cts +1 -1
- package/dist/policies/engines/index.d.ts +1 -1
- package/dist/policies/engines/v1/gate/index.d.cts +3 -15
- package/dist/policies/engines/v1/gate/index.d.ts +3 -15
- package/dist/policies/index.d.cts +1 -1
- package/dist/policies/index.d.ts +1 -1
- package/dist/policy-bridge.cjs +30 -2
- package/dist/policy-bridge.cjs.map +1 -1
- package/dist/policy-bridge.d.cts +18 -0
- package/dist/policy-bridge.d.ts +18 -0
- package/dist/policy-bridge.js +30 -2
- package/dist/policy-bridge.js.map +1 -1
- package/dist/policy-service.cjs +40 -46
- package/dist/policy-service.cjs.map +1 -1
- package/dist/policy-service.d.cts +72 -9
- package/dist/policy-service.d.ts +72 -9
- package/dist/policy-service.js +42 -48
- package/dist/policy-service.js.map +1 -1
- package/dist/requested-by.cjs +1 -1
- package/dist/requested-by.cjs.map +1 -1
- package/dist/requested-by.js +1 -1
- package/dist/requested-by.js.map +1 -1
- package/dist/result.cjs +29 -1
- package/dist/result.cjs.map +1 -1
- package/dist/result.d.cts +12 -0
- package/dist/result.d.ts +12 -0
- package/dist/result.js +29 -1
- package/dist/result.js.map +1 -1
- package/dist/rule.cjs +94 -24
- package/dist/rule.cjs.map +1 -1
- package/dist/rule.js +94 -24
- package/dist/rule.js.map +1 -1
- package/dist/ruleset-registry.cjs +19 -0
- package/dist/ruleset-registry.cjs.map +1 -1
- package/dist/ruleset-registry.js +19 -0
- package/dist/ruleset-registry.js.map +1 -1
- package/dist/stable-stringify.cjs +43 -3
- package/dist/stable-stringify.cjs.map +1 -1
- package/dist/stable-stringify.js +38 -4
- package/dist/stable-stringify.js.map +1 -1
- package/dist/temporal-snapshot.d.cts +87 -0
- package/dist/temporal-snapshot.d.ts +87 -0
- package/dist/temporal-use-case.cjs +169 -16
- package/dist/temporal-use-case.cjs.map +1 -1
- package/dist/temporal-use-case.d.cts +76 -43
- package/dist/temporal-use-case.d.ts +76 -43
- package/dist/temporal-use-case.js +162 -15
- package/dist/temporal-use-case.js.map +1 -1
- package/dist/unexpected-error.cjs +4 -2
- package/dist/unexpected-error.cjs.map +1 -1
- package/dist/unexpected-error.js +4 -2
- package/dist/unexpected-error.js.map +1 -1
- package/dist/uuid-identifier.cjs +140 -2
- package/dist/uuid-identifier.cjs.map +1 -1
- package/dist/uuid-identifier.d.cts +26 -7
- package/dist/uuid-identifier.d.ts +26 -7
- package/dist/uuid-identifier.js +135 -3
- package/dist/uuid-identifier.js.map +1 -1
- package/dist/uuid.cjs +11 -6
- package/dist/uuid.cjs.map +1 -1
- package/dist/uuid.js +11 -6
- package/dist/uuid.js.map +1 -1
- package/dist/validation-code.cjs +9 -0
- package/dist/validation-code.cjs.map +1 -1
- package/dist/validation-code.d.cts +3 -0
- package/dist/validation-code.d.ts +3 -0
- package/dist/validation-code.js +9 -0
- package/dist/validation-code.js.map +1 -1
- package/dist/validation-error.cjs +42 -67
- package/dist/validation-error.cjs.map +1 -1
- package/dist/validation-error.d.cts +24 -8
- package/dist/validation-error.d.ts +24 -8
- package/dist/validation-error.js +41 -66
- package/dist/validation-error.js.map +1 -1
- package/dist/validation-exception.cjs +17 -6
- package/dist/validation-exception.cjs.map +1 -1
- package/dist/validation-exception.d.cts +33 -9
- package/dist/validation-exception.d.ts +33 -9
- package/dist/validation-exception.js +17 -6
- package/dist/validation-exception.js.map +1 -1
- package/dist/validation-field.cjs +3 -0
- package/dist/validation-field.cjs.map +1 -1
- package/dist/validation-field.d.cts +1 -0
- package/dist/validation-field.d.ts +1 -0
- package/dist/validation-field.js +3 -0
- package/dist/validation-field.js.map +1 -1
- package/dist/value-object-ruleset.contracts.d.cts +10 -0
- package/dist/value-object-ruleset.contracts.d.ts +10 -0
- package/dist/value-object.cjs +12 -2
- package/dist/value-object.cjs.map +1 -1
- package/dist/value-object.d.cts +16 -0
- package/dist/value-object.d.ts +16 -0
- package/dist/value-object.js +13 -3
- package/dist/value-object.js.map +1 -1
- package/dist/version.d.cts +27 -0
- package/dist/version.d.ts +27 -0
- package/dist/versioning/index.d.cts +2 -2
- package/dist/versioning/index.d.ts +2 -2
- package/meta.json +3 -2
- package/package.json +1 -1
- package/src/core/abac/authorizer.ts +60 -10
- package/src/core/abac/domain/policy-set.ts +52 -5
- package/src/core/abac/domain/rule.ts +28 -16
- package/src/core/abac/index.ts +7 -1
- package/src/core/application/commands/command.ts +14 -1
- package/src/core/application/commands/requested-by.ts +12 -3
- package/src/core/application/index.ts +2 -1
- package/src/core/application/policy-error-mapper.ts +6 -0
- package/src/core/application/ports/index.ts +7 -0
- package/src/core/application/ports/temporal-repository.port.ts +35 -2
- package/src/core/application/queries/index.ts +1 -1
- package/src/core/application/queries/query.ts +19 -2
- package/src/core/application/temporal/temporal-use-case.ts +31 -4
- package/src/core/application/use-case.ts +44 -7
- package/src/core/config/core-config.ts +46 -25
- package/src/core/config/index.ts +1 -0
- package/src/core/config/policy-reporter.ts +32 -1
- package/src/core/domain/entity.ts +50 -7
- package/src/core/domain/rulesets/entity-ruleset.contracts.ts +0 -2
- package/src/core/domain/rulesets/ruleset-registry.ts +24 -0
- package/src/core/domain/rulesets/value-object-ruleset.contracts.ts +1 -7
- package/src/core/domain/temporal/half-open-interval.ts +34 -0
- package/src/core/domain/temporal/temporal-snapshot.ts +13 -2
- package/src/core/domain/temporal/transaction-time.ts +19 -15
- package/src/core/domain/temporal/valid-time.ts +20 -15
- package/src/core/domain/uuid-identifier.ts +5 -3
- package/src/core/domain/value-object.ts +17 -0
- package/src/core/errors/authentication-error.ts +5 -31
- package/src/core/errors/authorization-error.ts +12 -20
- package/src/core/errors/business-rule-violation-error.ts +4 -1
- package/src/core/errors/idempotency-error.ts +5 -2
- package/src/core/errors/index.ts +4 -0
- package/src/core/errors/integration-error.ts +4 -24
- package/src/core/errors/legacy-incompatible-error.ts +1 -0
- package/src/core/errors/not-found-error.ts +4 -1
- package/src/core/errors/temporal-error.ts +22 -20
- package/src/core/errors/unexpected-error.ts +5 -1
- package/src/core/errors/utils/factory-helpers.ts +70 -0
- package/src/core/errors/utils/index.ts +5 -0
- package/src/core/errors/utils/json-safe.ts +15 -1
- package/src/core/errors/validation-error.ts +4 -1
- package/src/core/exceptions/business-rule-violation-exception.ts +2 -1
- package/src/core/exceptions/domain-exception.ts +9 -1
- package/src/core/exceptions/entity-not-found-exception.ts +5 -1
- package/src/core/exceptions/invalid-state-transition-exception.ts +5 -2
- package/src/core/exceptions/invariant-violation-exception.ts +2 -2
- package/src/core/exceptions/validation-code.ts +14 -0
- package/src/core/exceptions/validation-exception.ts +44 -5
- package/src/core/exceptions/validation-field.ts +11 -1
- package/src/core/plugins/plugin.ts +25 -15
- package/src/core/plugins/types.ts +4 -2
- package/src/core/policies/asof/asof.ts +12 -0
- package/src/core/policies/catalog/policy-catalog-entry.ts +3 -1
- package/src/core/policies/catalog/policy-catalog.ts +5 -1
- package/src/core/policies/context/context-builder.ts +20 -0
- package/src/core/policies/context/context-resolver.ts +5 -0
- package/src/core/policies/context/context-seed.ts +11 -0
- package/src/core/policies/defs/in-memory-policy-definition-repo.ts +0 -2
- package/src/core/policies/engines/parse-gate-payload.ts +9 -0
- package/src/core/policies/engines/v1/condition-date-operands.ts +112 -0
- package/src/core/policies/engines/v1/condition-evaluator.ts +99 -325
- package/src/core/policies/engines/v1/condition-schema.ts +23 -19
- package/src/core/policies/engines/v1/condition-types.ts +18 -11
- package/src/core/policies/index.ts +4 -6
- package/src/core/policies/service/policy-service.ts +46 -35
- package/src/core/policies/utils/hash.ts +5 -69
- package/src/core/policies/utils/result.ts +1 -1
- package/src/core/rbac/access-request.ts +12 -2
- package/src/core/rbac/authorizer.ts +8 -1
- package/src/core/rbac/domain/role.ts +20 -0
- package/src/core/rbac/domain/scope.ts +6 -1
- package/src/core/result/index.ts +5 -0
- package/src/core/result/outcome.ts +5 -7
- package/src/core/result/result.ts +34 -1
- package/src/core/shared/hashing.ts +6 -3
- package/src/core/shared/immutable.ts +22 -4
- package/src/core/shared/stable-stringify.ts +91 -4
- package/src/core/shared/uuid.ts +11 -6
- package/src/core/versioning/domain-event-contracts.ts +43 -15
- package/src/core/versioning/index.ts +1 -0
- package/src/core/versioning/version.ts +30 -1
- package/src/domain/index.ts +5 -0
- package/src/examples/rulesets/entity/order-creation-rules-v1.ts +1 -1
- package/src/examples/rulesets/entity/order-invariants-v1.ts +2 -4
- package/src/examples/rulesets/entity/order-invariants-v2.ts +2 -4
- package/src/examples/rulesets/value-object/cpf-rules-v1.ts +2 -4
- package/src/examples/rulesets/value-object/cpf-rules-v2.ts +2 -4
- package/src/examples/rulesets/value-object/person-name-rules-v1.ts +2 -4
- package/src/examples/rulesets/value-object/person-name-rules-v2.ts +2 -4
- package/src/result/index.ts +7 -2
- package/src/version.ts +1 -1
- package/dist/domain-exception.d.cts +0 -7
- package/dist/domain-exception.d.ts +0 -7
- package/dist/entity.cjs +0 -122
- package/dist/entity.cjs.map +0 -1
- package/dist/entity.js +0 -111
- package/dist/entity.js.map +0 -1
- package/dist/use-case.cjs +0 -92
- package/dist/use-case.cjs.map +0 -1
- package/dist/use-case.js +0 -87
- package/dist/use-case.js.map +0 -1
package/dist/outcome.cjs
CHANGED
|
@@ -28,19 +28,19 @@ var Outcome = class Outcome {
|
|
|
28
28
|
return new Outcome(status, data, reason, Object.freeze({ ...metadata }));
|
|
29
29
|
}
|
|
30
30
|
static approved(data, reason) {
|
|
31
|
-
return
|
|
31
|
+
return Outcome.of("APPROVED", data, reason);
|
|
32
32
|
}
|
|
33
33
|
static rejected(data, reason) {
|
|
34
|
-
return
|
|
34
|
+
return Outcome.of("REJECTED", data, reason);
|
|
35
35
|
}
|
|
36
36
|
static noOp(data, reason) {
|
|
37
|
-
return
|
|
37
|
+
return Outcome.of("NO_OP", data, reason);
|
|
38
38
|
}
|
|
39
39
|
static deferred(data, reason) {
|
|
40
|
-
return
|
|
40
|
+
return Outcome.of("DEFERRED", data, reason);
|
|
41
41
|
}
|
|
42
42
|
static requiresReview(data, reason) {
|
|
43
|
-
return
|
|
43
|
+
return Outcome.of("REQUIRES_REVIEW", data, reason);
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Narrows this Outcome to a specific status.
|
package/dist/outcome.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcome.cjs","names":["InvariantViolationException"],"sources":["../src/core/result/outcome.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"outcome.cjs","names":["InvariantViolationException"],"sources":["../src/core/result/outcome.ts"],"sourcesContent":["import { InvariantViolationException } from \"../exceptions/invariant-violation-exception.js\";\n\n/**\n * Outcome — Business decision abstraction.\n *\n * Represents the semantic result of a domain decision, policy evaluation,\n * or business rule. NOT for technical success/failure — use Result for that.\n *\n * Mental model:\n * \"What was the business decision?\"\n * NOT \"Did the operation succeed?\"\n *\n * The status axis represents valid business outcomes (APPROVED, REJECTED,\n * ALLOW, DENY, NO_OP, etc.), never technical Ok/Err.\n *\n * @typeParam S - Union of valid status literals for this outcome\n * @typeParam D - Shape of the decision data carried by this outcome\n */\nexport class Outcome<S extends string, D = undefined> {\n readonly status: S;\n readonly data: D;\n readonly reason: string | undefined;\n readonly metadata: Readonly<Record<string, unknown>>;\n\n private constructor(\n status: S,\n data: D,\n reason: string | undefined,\n metadata: Readonly<Record<string, unknown>>,\n ) {\n this.status = status;\n this.data = data;\n this.reason = reason;\n this.metadata = metadata;\n Object.freeze(this);\n }\n\n // ─── Generic factory ────────────────────────────────────────────────\n\n static of<S extends string, D = undefined>(\n status: S,\n data: D,\n reason?: string,\n metadata?: Record<string, unknown>,\n ): Outcome<S, D> {\n return new Outcome(\n status,\n data,\n reason,\n Object.freeze({ ...metadata }),\n );\n }\n\n // ─── Convenience factories for common business statuses ─────────────\n\n static approved<D = undefined>(\n data: D,\n reason?: string,\n ): Outcome<\"APPROVED\", D> {\n return Outcome.of(\"APPROVED\", data, reason);\n }\n\n static rejected<D = undefined>(\n data: D,\n reason: string,\n ): Outcome<\"REJECTED\", D> {\n return Outcome.of(\"REJECTED\", data, reason);\n }\n\n static noOp<D = undefined>(data: D, reason?: string): Outcome<\"NO_OP\", D> {\n return Outcome.of(\"NO_OP\", data, reason);\n }\n\n static deferred<D = undefined>(\n data: D,\n reason: string,\n ): Outcome<\"DEFERRED\", D> {\n return Outcome.of(\"DEFERRED\", data, reason);\n }\n\n static requiresReview<D = undefined>(\n data: D,\n reason: string,\n ): Outcome<\"REQUIRES_REVIEW\", D> {\n return Outcome.of(\"REQUIRES_REVIEW\", data, reason);\n }\n\n // ─── Type narrowing ────────────────────────────────────────────────\n\n /**\n * Narrows this Outcome to a specific status.\n *\n * @example\n * if (outcome.is('DENY')) {\n * outcome.data.violations // TS knows status is 'DENY'\n * }\n */\n is<T extends S>(status: T): this is Outcome<T, D> {\n return (this.status as string) === status;\n }\n\n // ─── Exhaustive match ──────────────────────────────────────────────\n\n /**\n * Exhaustive pattern match over all possible statuses.\n * TypeScript enforces that every status has a handler.\n *\n * @example\n * outcome.match({\n * ALLOW: (o) => handleAllow(o.data),\n * DENY: (o) => handleDeny(o.data.violations),\n * })\n */\n match<THandlers extends { [K in S]: (outcome: Outcome<K, D>) => unknown }>(\n handlers: THandlers,\n ): ReturnType<THandlers[S]> {\n const handler = (\n handlers as Partial<Record<string, (o: unknown) => unknown>>\n )[this.status];\n\n if (typeof handler !== \"function\") {\n const availableStatuses = Object.keys(handlers);\n throw new InvariantViolationException(\n `Outcome.match is missing a handler for runtime status \"${this.status}\". Available handlers: ${availableStatuses.join(\", \") || \"(none)\"}`,\n );\n }\n\n return handler(this) as ReturnType<THandlers[S]>;\n }\n\n // ─── Derived copies ────────────────────────────────────────────────\n\n withMetadata(extra: Record<string, unknown>): Outcome<S, D> {\n return new Outcome(\n this.status,\n this.data,\n this.reason,\n Object.freeze({ ...this.metadata, ...extra }),\n );\n }\n\n withReason(reason: string): Outcome<S, D> {\n return new Outcome(this.status, this.data, reason, this.metadata);\n }\n\n // ─── Debug ─────────────────────────────────────────────────────────\n\n toString(): string {\n const parts: string[] = [this.status];\n if (this.reason) parts.push(`reason=\"${this.reason}\"`);\n return `Outcome(${parts.join(\", \")})`;\n }\n}\n\n/** Common business outcome statuses. Extend per domain as needed. */\nexport type CommonOutcomeStatus =\n | \"APPROVED\"\n | \"REJECTED\"\n | \"NO_OP\"\n | \"DEFERRED\"\n | \"REQUIRES_REVIEW\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAa,UAAb,MAAa,QAAyC;CAMlD,YACI,QACA,MACA,QACA,UACF;EACE,KAAK,SAAS;EACd,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,WAAW;EAChB,OAAO,OAAO,IAAI;CACtB;CAIA,OAAO,GACH,QACA,MACA,QACA,UACa;EACb,OAAO,IAAI,QACP,QACA,MACA,QACA,OAAO,OAAO,EAAE,GAAG,SAAS,CAAC,CACjC;CACJ;CAIA,OAAO,SACH,MACA,QACsB;EACtB,OAAO,QAAQ,GAAG,YAAY,MAAM,MAAM;CAC9C;CAEA,OAAO,SACH,MACA,QACsB;EACtB,OAAO,QAAQ,GAAG,YAAY,MAAM,MAAM;CAC9C;CAEA,OAAO,KAAoB,MAAS,QAAsC;EACtE,OAAO,QAAQ,GAAG,SAAS,MAAM,MAAM;CAC3C;CAEA,OAAO,SACH,MACA,QACsB;EACtB,OAAO,QAAQ,GAAG,YAAY,MAAM,MAAM;CAC9C;CAEA,OAAO,eACH,MACA,QAC6B;EAC7B,OAAO,QAAQ,GAAG,mBAAmB,MAAM,MAAM;CACrD;;;;;;;;;CAYA,GAAgB,QAAkC;EAC9C,OAAQ,KAAK,WAAsB;CACvC;;;;;;;;;;;CAcA,MACI,UACwB;EACxB,MAAM,UACF,SACF,KAAK;EAEP,IAAI,OAAO,YAAY,YAAY;GAC/B,MAAM,oBAAoB,OAAO,KAAK,QAAQ;GAC9C,MAAM,IAAIA,sCAAAA,4BACN,0DAA0D,KAAK,OAAO,yBAAyB,kBAAkB,KAAK,IAAI,KAAK,UACnI;EACJ;EAEA,OAAO,QAAQ,IAAI;CACvB;CAIA,aAAa,OAA+C;EACxD,OAAO,IAAI,QACP,KAAK,QACL,KAAK,MACL,KAAK,QACL,OAAO,OAAO;GAAE,GAAG,KAAK;GAAU,GAAG;EAAM,CAAC,CAChD;CACJ;CAEA,WAAW,QAA+B;EACtC,OAAO,IAAI,QAAQ,KAAK,QAAQ,KAAK,MAAM,QAAQ,KAAK,QAAQ;CACpE;CAIA,WAAmB;EACf,MAAM,QAAkB,CAAC,KAAK,MAAM;EACpC,IAAI,KAAK,QAAQ,MAAM,KAAK,WAAW,KAAK,OAAO,EAAE;EACrD,OAAO,WAAW,MAAM,KAAK,IAAI,EAAE;CACvC;AACJ"}
|
package/dist/outcome.js
CHANGED
|
@@ -28,19 +28,19 @@ var Outcome = class Outcome {
|
|
|
28
28
|
return new Outcome(status, data, reason, Object.freeze({ ...metadata }));
|
|
29
29
|
}
|
|
30
30
|
static approved(data, reason) {
|
|
31
|
-
return
|
|
31
|
+
return Outcome.of("APPROVED", data, reason);
|
|
32
32
|
}
|
|
33
33
|
static rejected(data, reason) {
|
|
34
|
-
return
|
|
34
|
+
return Outcome.of("REJECTED", data, reason);
|
|
35
35
|
}
|
|
36
36
|
static noOp(data, reason) {
|
|
37
|
-
return
|
|
37
|
+
return Outcome.of("NO_OP", data, reason);
|
|
38
38
|
}
|
|
39
39
|
static deferred(data, reason) {
|
|
40
|
-
return
|
|
40
|
+
return Outcome.of("DEFERRED", data, reason);
|
|
41
41
|
}
|
|
42
42
|
static requiresReview(data, reason) {
|
|
43
|
-
return
|
|
43
|
+
return Outcome.of("REQUIRES_REVIEW", data, reason);
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Narrows this Outcome to a specific status.
|
package/dist/outcome.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcome.js","names":[],"sources":["../src/core/result/outcome.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"outcome.js","names":[],"sources":["../src/core/result/outcome.ts"],"sourcesContent":["import { InvariantViolationException } from \"../exceptions/invariant-violation-exception.js\";\n\n/**\n * Outcome — Business decision abstraction.\n *\n * Represents the semantic result of a domain decision, policy evaluation,\n * or business rule. NOT for technical success/failure — use Result for that.\n *\n * Mental model:\n * \"What was the business decision?\"\n * NOT \"Did the operation succeed?\"\n *\n * The status axis represents valid business outcomes (APPROVED, REJECTED,\n * ALLOW, DENY, NO_OP, etc.), never technical Ok/Err.\n *\n * @typeParam S - Union of valid status literals for this outcome\n * @typeParam D - Shape of the decision data carried by this outcome\n */\nexport class Outcome<S extends string, D = undefined> {\n readonly status: S;\n readonly data: D;\n readonly reason: string | undefined;\n readonly metadata: Readonly<Record<string, unknown>>;\n\n private constructor(\n status: S,\n data: D,\n reason: string | undefined,\n metadata: Readonly<Record<string, unknown>>,\n ) {\n this.status = status;\n this.data = data;\n this.reason = reason;\n this.metadata = metadata;\n Object.freeze(this);\n }\n\n // ─── Generic factory ────────────────────────────────────────────────\n\n static of<S extends string, D = undefined>(\n status: S,\n data: D,\n reason?: string,\n metadata?: Record<string, unknown>,\n ): Outcome<S, D> {\n return new Outcome(\n status,\n data,\n reason,\n Object.freeze({ ...metadata }),\n );\n }\n\n // ─── Convenience factories for common business statuses ─────────────\n\n static approved<D = undefined>(\n data: D,\n reason?: string,\n ): Outcome<\"APPROVED\", D> {\n return Outcome.of(\"APPROVED\", data, reason);\n }\n\n static rejected<D = undefined>(\n data: D,\n reason: string,\n ): Outcome<\"REJECTED\", D> {\n return Outcome.of(\"REJECTED\", data, reason);\n }\n\n static noOp<D = undefined>(data: D, reason?: string): Outcome<\"NO_OP\", D> {\n return Outcome.of(\"NO_OP\", data, reason);\n }\n\n static deferred<D = undefined>(\n data: D,\n reason: string,\n ): Outcome<\"DEFERRED\", D> {\n return Outcome.of(\"DEFERRED\", data, reason);\n }\n\n static requiresReview<D = undefined>(\n data: D,\n reason: string,\n ): Outcome<\"REQUIRES_REVIEW\", D> {\n return Outcome.of(\"REQUIRES_REVIEW\", data, reason);\n }\n\n // ─── Type narrowing ────────────────────────────────────────────────\n\n /**\n * Narrows this Outcome to a specific status.\n *\n * @example\n * if (outcome.is('DENY')) {\n * outcome.data.violations // TS knows status is 'DENY'\n * }\n */\n is<T extends S>(status: T): this is Outcome<T, D> {\n return (this.status as string) === status;\n }\n\n // ─── Exhaustive match ──────────────────────────────────────────────\n\n /**\n * Exhaustive pattern match over all possible statuses.\n * TypeScript enforces that every status has a handler.\n *\n * @example\n * outcome.match({\n * ALLOW: (o) => handleAllow(o.data),\n * DENY: (o) => handleDeny(o.data.violations),\n * })\n */\n match<THandlers extends { [K in S]: (outcome: Outcome<K, D>) => unknown }>(\n handlers: THandlers,\n ): ReturnType<THandlers[S]> {\n const handler = (\n handlers as Partial<Record<string, (o: unknown) => unknown>>\n )[this.status];\n\n if (typeof handler !== \"function\") {\n const availableStatuses = Object.keys(handlers);\n throw new InvariantViolationException(\n `Outcome.match is missing a handler for runtime status \"${this.status}\". Available handlers: ${availableStatuses.join(\", \") || \"(none)\"}`,\n );\n }\n\n return handler(this) as ReturnType<THandlers[S]>;\n }\n\n // ─── Derived copies ────────────────────────────────────────────────\n\n withMetadata(extra: Record<string, unknown>): Outcome<S, D> {\n return new Outcome(\n this.status,\n this.data,\n this.reason,\n Object.freeze({ ...this.metadata, ...extra }),\n );\n }\n\n withReason(reason: string): Outcome<S, D> {\n return new Outcome(this.status, this.data, reason, this.metadata);\n }\n\n // ─── Debug ─────────────────────────────────────────────────────────\n\n toString(): string {\n const parts: string[] = [this.status];\n if (this.reason) parts.push(`reason=\"${this.reason}\"`);\n return `Outcome(${parts.join(\", \")})`;\n }\n}\n\n/** Common business outcome statuses. Extend per domain as needed. */\nexport type CommonOutcomeStatus =\n | \"APPROVED\"\n | \"REJECTED\"\n | \"NO_OP\"\n | \"DEFERRED\"\n | \"REQUIRES_REVIEW\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAa,UAAb,MAAa,QAAyC;CAMlD,YACI,QACA,MACA,QACA,UACF;EACE,KAAK,SAAS;EACd,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,WAAW;EAChB,OAAO,OAAO,IAAI;CACtB;CAIA,OAAO,GACH,QACA,MACA,QACA,UACa;EACb,OAAO,IAAI,QACP,QACA,MACA,QACA,OAAO,OAAO,EAAE,GAAG,SAAS,CAAC,CACjC;CACJ;CAIA,OAAO,SACH,MACA,QACsB;EACtB,OAAO,QAAQ,GAAG,YAAY,MAAM,MAAM;CAC9C;CAEA,OAAO,SACH,MACA,QACsB;EACtB,OAAO,QAAQ,GAAG,YAAY,MAAM,MAAM;CAC9C;CAEA,OAAO,KAAoB,MAAS,QAAsC;EACtE,OAAO,QAAQ,GAAG,SAAS,MAAM,MAAM;CAC3C;CAEA,OAAO,SACH,MACA,QACsB;EACtB,OAAO,QAAQ,GAAG,YAAY,MAAM,MAAM;CAC9C;CAEA,OAAO,eACH,MACA,QAC6B;EAC7B,OAAO,QAAQ,GAAG,mBAAmB,MAAM,MAAM;CACrD;;;;;;;;;CAYA,GAAgB,QAAkC;EAC9C,OAAQ,KAAK,WAAsB;CACvC;;;;;;;;;;;CAcA,MACI,UACwB;EACxB,MAAM,UACF,SACF,KAAK;EAEP,IAAI,OAAO,YAAY,YAAY;GAC/B,MAAM,oBAAoB,OAAO,KAAK,QAAQ;GAC9C,MAAM,IAAI,4BACN,0DAA0D,KAAK,OAAO,yBAAyB,kBAAkB,KAAK,IAAI,KAAK,UACnI;EACJ;EAEA,OAAO,QAAQ,IAAI;CACvB;CAIA,aAAa,OAA+C;EACxD,OAAO,IAAI,QACP,KAAK,QACL,KAAK,MACL,KAAK,QACL,OAAO,OAAO;GAAE,GAAG,KAAK;GAAU,GAAG;EAAM,CAAC,CAChD;CACJ;CAEA,WAAW,QAA+B;EACtC,OAAO,IAAI,QAAQ,KAAK,QAAQ,KAAK,MAAM,QAAQ,KAAK,QAAQ;CACpE;CAIA,WAAmB;EACf,MAAM,QAAkB,CAAC,KAAK,MAAM;EACpC,IAAI,KAAK,QAAQ,MAAM,KAAK,WAAW,KAAK,OAAO,EAAE;EACrD,OAAO,WAAW,MAAM,KAAK,IAAI,EAAE;CACvC;AACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as Result } from "./result.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { D as GatePayload, O as GatePayloadV1, w as PolicyContext } from "./core-config.cjs";
|
|
3
3
|
import { a as ComputeOutcome, c as VersionedComputeEngine, i as ComputeEvaluatorRegistration, l as ComputePayload, p as ComputePayloadV1, r as ComputeEvaluator } from "./gate-engine-registry.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/core/policies/engines/compute-evaluator-registry.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as Result } from "./result.js";
|
|
2
|
-
import {
|
|
2
|
+
import { D as GatePayload, O as GatePayloadV1, w as PolicyContext } from "./core-config.js";
|
|
3
3
|
import { a as ComputeOutcome, c as VersionedComputeEngine, i as ComputeEvaluatorRegistration, l as ComputePayload, p as ComputePayloadV1, r as ComputeEvaluator } from "./gate-engine-registry.js";
|
|
4
4
|
|
|
5
5
|
//#region src/core/policies/engines/compute-evaluator-registry.d.ts
|
package/dist/path.d.cts
CHANGED
|
@@ -22,20 +22,20 @@ declare const coreConfig: CoreConfig;
|
|
|
22
22
|
* Array item order is preserved on purpose; callers that treat arrays as sets
|
|
23
23
|
* must normalize or sort them before hashing.
|
|
24
24
|
*
|
|
25
|
+
* The strict canonical form is owned by `shared/stable-stringify`
|
|
26
|
+
* ({@link canonicalStringify}); this class just composes it with SHA-256.
|
|
25
27
|
* Values that JSON.stringify would silently drop or coerce (undefined,
|
|
26
28
|
* non-finite numbers, functions, symbols, bigint) are rejected up-front to
|
|
27
29
|
* prevent semantically different payloads from collapsing to the same hash.
|
|
28
30
|
*/
|
|
29
31
|
declare class PolicyHashing {
|
|
30
32
|
static sha256(input: string): string;
|
|
31
|
-
private static assertHashable;
|
|
32
33
|
static canonicalJson(value: unknown): string;
|
|
33
34
|
static computePayloadHash(payload: unknown, policyKey: string, policyVersion: string): string;
|
|
34
35
|
}
|
|
35
36
|
//#endregion
|
|
36
37
|
//#region src/core/policies/defs/in-memory-policy-definition-repo.d.ts
|
|
37
38
|
declare class InMemoryPolicyDefinitionRepository implements PolicyDefinitionRepository {
|
|
38
|
-
private readonly definitions;
|
|
39
39
|
private readonly definitionsByPolicyKey;
|
|
40
40
|
constructor(definitions: readonly PolicyDefinition[]);
|
|
41
41
|
findCandidates(params: FindCandidatesParams): PolicyDefinition[];
|
package/dist/path.d.ts
CHANGED
|
@@ -22,20 +22,20 @@ declare const coreConfig: CoreConfig;
|
|
|
22
22
|
* Array item order is preserved on purpose; callers that treat arrays as sets
|
|
23
23
|
* must normalize or sort them before hashing.
|
|
24
24
|
*
|
|
25
|
+
* The strict canonical form is owned by `shared/stable-stringify`
|
|
26
|
+
* ({@link canonicalStringify}); this class just composes it with SHA-256.
|
|
25
27
|
* Values that JSON.stringify would silently drop or coerce (undefined,
|
|
26
28
|
* non-finite numbers, functions, symbols, bigint) are rejected up-front to
|
|
27
29
|
* prevent semantically different payloads from collapsing to the same hash.
|
|
28
30
|
*/
|
|
29
31
|
declare class PolicyHashing {
|
|
30
32
|
static sha256(input: string): string;
|
|
31
|
-
private static assertHashable;
|
|
32
33
|
static canonicalJson(value: unknown): string;
|
|
33
34
|
static computePayloadHash(payload: unknown, policyKey: string, policyVersion: string): string;
|
|
34
35
|
}
|
|
35
36
|
//#endregion
|
|
36
37
|
//#region src/core/policies/defs/in-memory-policy-definition-repo.d.ts
|
|
37
38
|
declare class InMemoryPolicyDefinitionRepository implements PolicyDefinitionRepository {
|
|
38
|
-
private readonly definitions;
|
|
39
39
|
private readonly definitionsByPolicyKey;
|
|
40
40
|
constructor(definitions: readonly PolicyDefinition[]);
|
|
41
41
|
findCandidates(params: FindCandidatesParams): PolicyDefinition[];
|
package/dist/plugin.cjs
CHANGED
|
@@ -3,11 +3,23 @@
|
|
|
3
3
|
* Registry that holds a set of plugins implementing a shared {@link PluginContract}
|
|
4
4
|
* and resolves which of them answer a given extension point.
|
|
5
5
|
*
|
|
6
|
-
* Plugins are kept sorted by priority (descending)
|
|
7
|
-
* {@link invoke} either
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* Plugins are kept sorted by priority (descending); ties keep registration
|
|
7
|
+
* order (the sort is stable). For a given method, {@link invoke} either
|
|
8
|
+
* delegates to the highest-priority enabled plugin (`'first'`) or folds every
|
|
9
|
+
* enabled plugin into a single value (`'pipeline'`). When no plugin is enabled,
|
|
10
|
+
* the supplied `fallback` runs instead, so the host always has defined
|
|
11
|
+
* behaviour even with an empty registry.
|
|
12
|
+
*
|
|
13
|
+
* `name` is a unique key: registering a plugin whose name already exists
|
|
14
|
+
* replaces the previous one, so register/enable/disable/unregister all address
|
|
15
|
+
* the same single plugin.
|
|
16
|
+
*
|
|
17
|
+
* Plugins run arbitrary host code and are trusted: {@link invoke} does NOT wrap
|
|
18
|
+
* them in try/catch. A throwing plugin propagates to the caller (and, in
|
|
19
|
+
* `'pipeline'` mode, discards the accumulated result). Error handling, logging
|
|
20
|
+
* and retries are the host's responsibility by design — the registry's only
|
|
21
|
+
* defined-behaviour guarantee is `fallback` for an empty registry. Every plugin
|
|
22
|
+
* is expected to implement the full contract `P` (the types enforce it).
|
|
11
23
|
*
|
|
12
24
|
* @typeParam P - The plugin contract this manager coordinates.
|
|
13
25
|
*/
|
|
@@ -15,8 +27,10 @@ var PluginManager = class {
|
|
|
15
27
|
constructor() {
|
|
16
28
|
this.plugins = [];
|
|
17
29
|
}
|
|
18
|
-
/** Registers one or more plugins and re-sorts by priority. */
|
|
30
|
+
/** Registers one or more plugins (replacing any with the same name) and re-sorts by priority. */
|
|
19
31
|
register(...plugins) {
|
|
32
|
+
const incoming = new Set(plugins.map((p) => p.name));
|
|
33
|
+
this.plugins = this.plugins.filter((p) => !incoming.has(p.name));
|
|
20
34
|
this.plugins.push(...plugins);
|
|
21
35
|
this.reorder();
|
|
22
36
|
}
|
|
@@ -48,18 +62,14 @@ var PluginManager = class {
|
|
|
48
62
|
*/
|
|
49
63
|
invoke(method, args, opts) {
|
|
50
64
|
const { mode = "first", fallback, reducer } = opts;
|
|
51
|
-
const enabled = this.list()
|
|
65
|
+
const enabled = this.list();
|
|
52
66
|
if (enabled.length === 0) return fallback(...args);
|
|
53
|
-
if (mode === "first")
|
|
54
|
-
const fn = enabled[0][method];
|
|
55
|
-
return fn(...args);
|
|
56
|
-
}
|
|
67
|
+
if (mode === "first") return enabled[0][method](...args);
|
|
57
68
|
const defaultReducer = (_, curr) => curr;
|
|
58
69
|
const red = reducer ?? defaultReducer;
|
|
59
70
|
let acc = enabled[0][method](...args);
|
|
60
71
|
enabled.slice(1).forEach((plugin, idx) => {
|
|
61
|
-
|
|
62
|
-
acc = red(acc, res, plugin, idx + 1);
|
|
72
|
+
acc = red(acc, plugin[method](...args), plugin, idx + 1);
|
|
63
73
|
});
|
|
64
74
|
return acc;
|
|
65
75
|
}
|
package/dist/plugin.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs","names":[],"sources":["../src/core/plugins/plugin.ts"],"sourcesContent":["import {\n type BasePlugin,\n type InvokeOptions,\n type PipelineReducer,\n type PluginContract,\n} from \"./types.js\";\n\n/**\n * Registry that holds a set of plugins implementing a shared {@link PluginContract}\n * and resolves which of them answer a given extension point.\n *\n * Plugins are kept sorted by priority (descending). For a given method
|
|
1
|
+
{"version":3,"file":"plugin.cjs","names":[],"sources":["../src/core/plugins/plugin.ts"],"sourcesContent":["import {\n type BasePlugin,\n type InvokeOptions,\n type PipelineReducer,\n type PluginContract,\n} from \"./types.js\";\n\n/**\n * Registry that holds a set of plugins implementing a shared {@link PluginContract}\n * and resolves which of them answer a given extension point.\n *\n * Plugins are kept sorted by priority (descending); ties keep registration\n * order (the sort is stable). For a given method, {@link invoke} either\n * delegates to the highest-priority enabled plugin (`'first'`) or folds every\n * enabled plugin into a single value (`'pipeline'`). When no plugin is enabled,\n * the supplied `fallback` runs instead, so the host always has defined\n * behaviour even with an empty registry.\n *\n * `name` is a unique key: registering a plugin whose name already exists\n * replaces the previous one, so register/enable/disable/unregister all address\n * the same single plugin.\n *\n * Plugins run arbitrary host code and are trusted: {@link invoke} does NOT wrap\n * them in try/catch. A throwing plugin propagates to the caller (and, in\n * `'pipeline'` mode, discards the accumulated result). Error handling, logging\n * and retries are the host's responsibility by design — the registry's only\n * defined-behaviour guarantee is `fallback` for an empty registry. Every plugin\n * is expected to implement the full contract `P` (the types enforce it).\n *\n * @typeParam P - The plugin contract this manager coordinates.\n */\nclass PluginManager<P extends PluginContract> {\n /** Internal list, kept sorted by priority (desc). */\n private plugins: (P & BasePlugin)[] = [];\n\n /** Registers one or more plugins (replacing any with the same name) and re-sorts by priority. */\n public register(...plugins: (P & BasePlugin)[]): void {\n const incoming = new Set(plugins.map((p) => p.name));\n this.plugins = this.plugins.filter((p) => !incoming.has(p.name));\n this.plugins.push(...plugins);\n this.reorder();\n }\n\n /** Removes a previously registered plugin by name. */\n public unregister(name: string): void {\n this.plugins = this.plugins.filter((p) => p.name !== name);\n }\n\n /** Enables a registered plugin by name. */\n public enable(name: string): void {\n const plugin = this.plugins.find((p) => p.name === name);\n if (plugin) plugin.enabled = true;\n }\n\n /** Disables a registered plugin by name (without removing it). */\n public disable(name: string): void {\n const plugin = this.plugins.find((p) => p.name === name);\n if (plugin) plugin.enabled = false;\n }\n\n /** Lists enabled plugins only, already in priority order. */\n public list(): readonly (P & BasePlugin)[] {\n return this.plugins.filter((p) => p.enabled !== false);\n }\n\n /**\n * Resolves `method` against the registered plugins.\n *\n * In `'first'` mode the highest-priority enabled plugin that implements\n * `method` answers. In `'pipeline'` mode every enabled plugin runs and the\n * results are folded with `reducer` (defaults to \"keep the last result\").\n * When no enabled plugin implements `method`, `fallback` is called.\n */\n public invoke<K extends keyof P>(\n method: K,\n args: Parameters<P[K]>,\n opts: InvokeOptions<P, K>,\n ): ReturnType<P[K]> {\n const { mode = \"first\", fallback, reducer } = opts;\n const enabled = this.list();\n\n if (enabled.length === 0) {\n return fallback(...args);\n }\n\n if (mode === \"first\") {\n return enabled[0][method](...args);\n }\n\n const defaultReducer: PipelineReducer<ReturnType<P[K]>, P> = (\n _,\n curr,\n ) => curr;\n const red = reducer ?? defaultReducer;\n\n let acc: ReturnType<P[K]> = enabled[0][method](...args);\n enabled.slice(1).forEach((plugin, idx) => {\n acc = red(acc, plugin[method](...args), plugin, idx + 1);\n });\n return acc;\n }\n\n /** Re-sorts the internal list by priority (desc; default priority = 0). */\n private reorder(): void {\n this.plugins.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n }\n}\n\nexport { PluginManager };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAM,gBAAN,MAA8C;;iBAEJ,CAAC;;;CAGvC,SAAgB,GAAG,SAAmC;EAClD,MAAM,WAAW,IAAI,IAAI,QAAQ,KAAK,MAAM,EAAE,IAAI,CAAC;EACnD,KAAK,UAAU,KAAK,QAAQ,QAAQ,MAAM,CAAC,SAAS,IAAI,EAAE,IAAI,CAAC;EAC/D,KAAK,QAAQ,KAAK,GAAG,OAAO;EAC5B,KAAK,QAAQ;CACjB;;CAGA,WAAkB,MAAoB;EAClC,KAAK,UAAU,KAAK,QAAQ,QAAQ,MAAM,EAAE,SAAS,IAAI;CAC7D;;CAGA,OAAc,MAAoB;EAC9B,MAAM,SAAS,KAAK,QAAQ,MAAM,MAAM,EAAE,SAAS,IAAI;EACvD,IAAI,QAAQ,OAAO,UAAU;CACjC;;CAGA,QAAe,MAAoB;EAC/B,MAAM,SAAS,KAAK,QAAQ,MAAM,MAAM,EAAE,SAAS,IAAI;EACvD,IAAI,QAAQ,OAAO,UAAU;CACjC;;CAGA,OAA2C;EACvC,OAAO,KAAK,QAAQ,QAAQ,MAAM,EAAE,YAAY,KAAK;CACzD;;;;;;;;;CAUA,OACI,QACA,MACA,MACgB;EAChB,MAAM,EAAE,OAAO,SAAS,UAAU,YAAY;EAC9C,MAAM,UAAU,KAAK,KAAK;EAE1B,IAAI,QAAQ,WAAW,GACnB,OAAO,SAAS,GAAG,IAAI;EAG3B,IAAI,SAAS,SACT,OAAO,QAAQ,GAAG,QAAQ,GAAG,IAAI;EAGrC,MAAM,kBACF,GACA,SACC;EACL,MAAM,MAAM,WAAW;EAEvB,IAAI,MAAwB,QAAQ,GAAG,QAAQ,GAAG,IAAI;EACtD,QAAQ,MAAM,CAAC,EAAE,SAAS,QAAQ,QAAQ;GACtC,MAAM,IAAI,KAAK,OAAO,QAAQ,GAAG,IAAI,GAAG,QAAQ,MAAM,CAAC;EAC3D,CAAC;EACD,OAAO;CACX;;CAGA,UAAwB;EACpB,KAAK,QAAQ,MAAM,GAAG,OAAO,EAAE,YAAY,MAAM,EAAE,YAAY,EAAE;CACrE;AACJ"}
|
package/dist/plugin.d.cts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
interface BasePlugin {
|
|
8
8
|
/** Unique identifier, used for logs / debugging and for enable/disable. */
|
|
9
9
|
readonly name: string;
|
|
10
|
-
/** Weight; the highest priority wins (default = 0). */
|
|
10
|
+
/** Weight; the highest priority wins (default = 0). Ties keep registration order. */
|
|
11
11
|
readonly priority?: number;
|
|
12
12
|
/** Shortcut to disable a plugin without removing it. */
|
|
13
13
|
enabled?: boolean;
|
|
@@ -32,7 +32,9 @@ type PipelineReducer<R, P extends PluginContract> = (accumulated: R, current: R,
|
|
|
32
32
|
interface InvokeOptions<P extends PluginContract, K extends keyof P> {
|
|
33
33
|
/**
|
|
34
34
|
* `'first'` → returns the first enabled plugin with the highest priority.
|
|
35
|
-
* `'pipeline'` →
|
|
35
|
+
* `'pipeline'` → fan-out + reduce: every enabled plugin runs against the
|
|
36
|
+
* same original `args` (results are NOT chained into the next plugin's
|
|
37
|
+
* input), and the results are folded together via `reducer`.
|
|
36
38
|
* default = `'first'`.
|
|
37
39
|
*/
|
|
38
40
|
mode?: "first" | "pipeline";
|
|
@@ -47,18 +49,30 @@ interface InvokeOptions<P extends PluginContract, K extends keyof P> {
|
|
|
47
49
|
* Registry that holds a set of plugins implementing a shared {@link PluginContract}
|
|
48
50
|
* and resolves which of them answer a given extension point.
|
|
49
51
|
*
|
|
50
|
-
* Plugins are kept sorted by priority (descending)
|
|
51
|
-
* {@link invoke} either
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
52
|
+
* Plugins are kept sorted by priority (descending); ties keep registration
|
|
53
|
+
* order (the sort is stable). For a given method, {@link invoke} either
|
|
54
|
+
* delegates to the highest-priority enabled plugin (`'first'`) or folds every
|
|
55
|
+
* enabled plugin into a single value (`'pipeline'`). When no plugin is enabled,
|
|
56
|
+
* the supplied `fallback` runs instead, so the host always has defined
|
|
57
|
+
* behaviour even with an empty registry.
|
|
58
|
+
*
|
|
59
|
+
* `name` is a unique key: registering a plugin whose name already exists
|
|
60
|
+
* replaces the previous one, so register/enable/disable/unregister all address
|
|
61
|
+
* the same single plugin.
|
|
62
|
+
*
|
|
63
|
+
* Plugins run arbitrary host code and are trusted: {@link invoke} does NOT wrap
|
|
64
|
+
* them in try/catch. A throwing plugin propagates to the caller (and, in
|
|
65
|
+
* `'pipeline'` mode, discards the accumulated result). Error handling, logging
|
|
66
|
+
* and retries are the host's responsibility by design — the registry's only
|
|
67
|
+
* defined-behaviour guarantee is `fallback` for an empty registry. Every plugin
|
|
68
|
+
* is expected to implement the full contract `P` (the types enforce it).
|
|
55
69
|
*
|
|
56
70
|
* @typeParam P - The plugin contract this manager coordinates.
|
|
57
71
|
*/
|
|
58
72
|
declare class PluginManager<P extends PluginContract> {
|
|
59
73
|
/** Internal list, kept sorted by priority (desc). */
|
|
60
74
|
private plugins;
|
|
61
|
-
/** Registers one or more plugins and re-sorts by priority. */
|
|
75
|
+
/** Registers one or more plugins (replacing any with the same name) and re-sorts by priority. */
|
|
62
76
|
register(...plugins: (P & BasePlugin)[]): void;
|
|
63
77
|
/** Removes a previously registered plugin by name. */
|
|
64
78
|
unregister(name: string): void;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
interface BasePlugin {
|
|
8
8
|
/** Unique identifier, used for logs / debugging and for enable/disable. */
|
|
9
9
|
readonly name: string;
|
|
10
|
-
/** Weight; the highest priority wins (default = 0). */
|
|
10
|
+
/** Weight; the highest priority wins (default = 0). Ties keep registration order. */
|
|
11
11
|
readonly priority?: number;
|
|
12
12
|
/** Shortcut to disable a plugin without removing it. */
|
|
13
13
|
enabled?: boolean;
|
|
@@ -32,7 +32,9 @@ type PipelineReducer<R, P extends PluginContract> = (accumulated: R, current: R,
|
|
|
32
32
|
interface InvokeOptions<P extends PluginContract, K extends keyof P> {
|
|
33
33
|
/**
|
|
34
34
|
* `'first'` → returns the first enabled plugin with the highest priority.
|
|
35
|
-
* `'pipeline'` →
|
|
35
|
+
* `'pipeline'` → fan-out + reduce: every enabled plugin runs against the
|
|
36
|
+
* same original `args` (results are NOT chained into the next plugin's
|
|
37
|
+
* input), and the results are folded together via `reducer`.
|
|
36
38
|
* default = `'first'`.
|
|
37
39
|
*/
|
|
38
40
|
mode?: "first" | "pipeline";
|
|
@@ -47,18 +49,30 @@ interface InvokeOptions<P extends PluginContract, K extends keyof P> {
|
|
|
47
49
|
* Registry that holds a set of plugins implementing a shared {@link PluginContract}
|
|
48
50
|
* and resolves which of them answer a given extension point.
|
|
49
51
|
*
|
|
50
|
-
* Plugins are kept sorted by priority (descending)
|
|
51
|
-
* {@link invoke} either
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
52
|
+
* Plugins are kept sorted by priority (descending); ties keep registration
|
|
53
|
+
* order (the sort is stable). For a given method, {@link invoke} either
|
|
54
|
+
* delegates to the highest-priority enabled plugin (`'first'`) or folds every
|
|
55
|
+
* enabled plugin into a single value (`'pipeline'`). When no plugin is enabled,
|
|
56
|
+
* the supplied `fallback` runs instead, so the host always has defined
|
|
57
|
+
* behaviour even with an empty registry.
|
|
58
|
+
*
|
|
59
|
+
* `name` is a unique key: registering a plugin whose name already exists
|
|
60
|
+
* replaces the previous one, so register/enable/disable/unregister all address
|
|
61
|
+
* the same single plugin.
|
|
62
|
+
*
|
|
63
|
+
* Plugins run arbitrary host code and are trusted: {@link invoke} does NOT wrap
|
|
64
|
+
* them in try/catch. A throwing plugin propagates to the caller (and, in
|
|
65
|
+
* `'pipeline'` mode, discards the accumulated result). Error handling, logging
|
|
66
|
+
* and retries are the host's responsibility by design — the registry's only
|
|
67
|
+
* defined-behaviour guarantee is `fallback` for an empty registry. Every plugin
|
|
68
|
+
* is expected to implement the full contract `P` (the types enforce it).
|
|
55
69
|
*
|
|
56
70
|
* @typeParam P - The plugin contract this manager coordinates.
|
|
57
71
|
*/
|
|
58
72
|
declare class PluginManager<P extends PluginContract> {
|
|
59
73
|
/** Internal list, kept sorted by priority (desc). */
|
|
60
74
|
private plugins;
|
|
61
|
-
/** Registers one or more plugins and re-sorts by priority. */
|
|
75
|
+
/** Registers one or more plugins (replacing any with the same name) and re-sorts by priority. */
|
|
62
76
|
register(...plugins: (P & BasePlugin)[]): void;
|
|
63
77
|
/** Removes a previously registered plugin by name. */
|
|
64
78
|
unregister(name: string): void;
|
package/dist/plugin.js
CHANGED
|
@@ -3,11 +3,23 @@
|
|
|
3
3
|
* Registry that holds a set of plugins implementing a shared {@link PluginContract}
|
|
4
4
|
* and resolves which of them answer a given extension point.
|
|
5
5
|
*
|
|
6
|
-
* Plugins are kept sorted by priority (descending)
|
|
7
|
-
* {@link invoke} either
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* Plugins are kept sorted by priority (descending); ties keep registration
|
|
7
|
+
* order (the sort is stable). For a given method, {@link invoke} either
|
|
8
|
+
* delegates to the highest-priority enabled plugin (`'first'`) or folds every
|
|
9
|
+
* enabled plugin into a single value (`'pipeline'`). When no plugin is enabled,
|
|
10
|
+
* the supplied `fallback` runs instead, so the host always has defined
|
|
11
|
+
* behaviour even with an empty registry.
|
|
12
|
+
*
|
|
13
|
+
* `name` is a unique key: registering a plugin whose name already exists
|
|
14
|
+
* replaces the previous one, so register/enable/disable/unregister all address
|
|
15
|
+
* the same single plugin.
|
|
16
|
+
*
|
|
17
|
+
* Plugins run arbitrary host code and are trusted: {@link invoke} does NOT wrap
|
|
18
|
+
* them in try/catch. A throwing plugin propagates to the caller (and, in
|
|
19
|
+
* `'pipeline'` mode, discards the accumulated result). Error handling, logging
|
|
20
|
+
* and retries are the host's responsibility by design — the registry's only
|
|
21
|
+
* defined-behaviour guarantee is `fallback` for an empty registry. Every plugin
|
|
22
|
+
* is expected to implement the full contract `P` (the types enforce it).
|
|
11
23
|
*
|
|
12
24
|
* @typeParam P - The plugin contract this manager coordinates.
|
|
13
25
|
*/
|
|
@@ -15,8 +27,10 @@ var PluginManager = class {
|
|
|
15
27
|
constructor() {
|
|
16
28
|
this.plugins = [];
|
|
17
29
|
}
|
|
18
|
-
/** Registers one or more plugins and re-sorts by priority. */
|
|
30
|
+
/** Registers one or more plugins (replacing any with the same name) and re-sorts by priority. */
|
|
19
31
|
register(...plugins) {
|
|
32
|
+
const incoming = new Set(plugins.map((p) => p.name));
|
|
33
|
+
this.plugins = this.plugins.filter((p) => !incoming.has(p.name));
|
|
20
34
|
this.plugins.push(...plugins);
|
|
21
35
|
this.reorder();
|
|
22
36
|
}
|
|
@@ -48,18 +62,14 @@ var PluginManager = class {
|
|
|
48
62
|
*/
|
|
49
63
|
invoke(method, args, opts) {
|
|
50
64
|
const { mode = "first", fallback, reducer } = opts;
|
|
51
|
-
const enabled = this.list()
|
|
65
|
+
const enabled = this.list();
|
|
52
66
|
if (enabled.length === 0) return fallback(...args);
|
|
53
|
-
if (mode === "first")
|
|
54
|
-
const fn = enabled[0][method];
|
|
55
|
-
return fn(...args);
|
|
56
|
-
}
|
|
67
|
+
if (mode === "first") return enabled[0][method](...args);
|
|
57
68
|
const defaultReducer = (_, curr) => curr;
|
|
58
69
|
const red = reducer ?? defaultReducer;
|
|
59
70
|
let acc = enabled[0][method](...args);
|
|
60
71
|
enabled.slice(1).forEach((plugin, idx) => {
|
|
61
|
-
|
|
62
|
-
acc = red(acc, res, plugin, idx + 1);
|
|
72
|
+
acc = red(acc, plugin[method](...args), plugin, idx + 1);
|
|
63
73
|
});
|
|
64
74
|
return acc;
|
|
65
75
|
}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","names":[],"sources":["../src/core/plugins/plugin.ts"],"sourcesContent":["import {\n type BasePlugin,\n type InvokeOptions,\n type PipelineReducer,\n type PluginContract,\n} from \"./types.js\";\n\n/**\n * Registry that holds a set of plugins implementing a shared {@link PluginContract}\n * and resolves which of them answer a given extension point.\n *\n * Plugins are kept sorted by priority (descending). For a given method
|
|
1
|
+
{"version":3,"file":"plugin.js","names":[],"sources":["../src/core/plugins/plugin.ts"],"sourcesContent":["import {\n type BasePlugin,\n type InvokeOptions,\n type PipelineReducer,\n type PluginContract,\n} from \"./types.js\";\n\n/**\n * Registry that holds a set of plugins implementing a shared {@link PluginContract}\n * and resolves which of them answer a given extension point.\n *\n * Plugins are kept sorted by priority (descending); ties keep registration\n * order (the sort is stable). For a given method, {@link invoke} either\n * delegates to the highest-priority enabled plugin (`'first'`) or folds every\n * enabled plugin into a single value (`'pipeline'`). When no plugin is enabled,\n * the supplied `fallback` runs instead, so the host always has defined\n * behaviour even with an empty registry.\n *\n * `name` is a unique key: registering a plugin whose name already exists\n * replaces the previous one, so register/enable/disable/unregister all address\n * the same single plugin.\n *\n * Plugins run arbitrary host code and are trusted: {@link invoke} does NOT wrap\n * them in try/catch. A throwing plugin propagates to the caller (and, in\n * `'pipeline'` mode, discards the accumulated result). Error handling, logging\n * and retries are the host's responsibility by design — the registry's only\n * defined-behaviour guarantee is `fallback` for an empty registry. Every plugin\n * is expected to implement the full contract `P` (the types enforce it).\n *\n * @typeParam P - The plugin contract this manager coordinates.\n */\nclass PluginManager<P extends PluginContract> {\n /** Internal list, kept sorted by priority (desc). */\n private plugins: (P & BasePlugin)[] = [];\n\n /** Registers one or more plugins (replacing any with the same name) and re-sorts by priority. */\n public register(...plugins: (P & BasePlugin)[]): void {\n const incoming = new Set(plugins.map((p) => p.name));\n this.plugins = this.plugins.filter((p) => !incoming.has(p.name));\n this.plugins.push(...plugins);\n this.reorder();\n }\n\n /** Removes a previously registered plugin by name. */\n public unregister(name: string): void {\n this.plugins = this.plugins.filter((p) => p.name !== name);\n }\n\n /** Enables a registered plugin by name. */\n public enable(name: string): void {\n const plugin = this.plugins.find((p) => p.name === name);\n if (plugin) plugin.enabled = true;\n }\n\n /** Disables a registered plugin by name (without removing it). */\n public disable(name: string): void {\n const plugin = this.plugins.find((p) => p.name === name);\n if (plugin) plugin.enabled = false;\n }\n\n /** Lists enabled plugins only, already in priority order. */\n public list(): readonly (P & BasePlugin)[] {\n return this.plugins.filter((p) => p.enabled !== false);\n }\n\n /**\n * Resolves `method` against the registered plugins.\n *\n * In `'first'` mode the highest-priority enabled plugin that implements\n * `method` answers. In `'pipeline'` mode every enabled plugin runs and the\n * results are folded with `reducer` (defaults to \"keep the last result\").\n * When no enabled plugin implements `method`, `fallback` is called.\n */\n public invoke<K extends keyof P>(\n method: K,\n args: Parameters<P[K]>,\n opts: InvokeOptions<P, K>,\n ): ReturnType<P[K]> {\n const { mode = \"first\", fallback, reducer } = opts;\n const enabled = this.list();\n\n if (enabled.length === 0) {\n return fallback(...args);\n }\n\n if (mode === \"first\") {\n return enabled[0][method](...args);\n }\n\n const defaultReducer: PipelineReducer<ReturnType<P[K]>, P> = (\n _,\n curr,\n ) => curr;\n const red = reducer ?? defaultReducer;\n\n let acc: ReturnType<P[K]> = enabled[0][method](...args);\n enabled.slice(1).forEach((plugin, idx) => {\n acc = red(acc, plugin[method](...args), plugin, idx + 1);\n });\n return acc;\n }\n\n /** Re-sorts the internal list by priority (desc; default priority = 0). */\n private reorder(): void {\n this.plugins.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n }\n}\n\nexport { PluginManager };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAM,gBAAN,MAA8C;;iBAEJ,CAAC;;;CAGvC,SAAgB,GAAG,SAAmC;EAClD,MAAM,WAAW,IAAI,IAAI,QAAQ,KAAK,MAAM,EAAE,IAAI,CAAC;EACnD,KAAK,UAAU,KAAK,QAAQ,QAAQ,MAAM,CAAC,SAAS,IAAI,EAAE,IAAI,CAAC;EAC/D,KAAK,QAAQ,KAAK,GAAG,OAAO;EAC5B,KAAK,QAAQ;CACjB;;CAGA,WAAkB,MAAoB;EAClC,KAAK,UAAU,KAAK,QAAQ,QAAQ,MAAM,EAAE,SAAS,IAAI;CAC7D;;CAGA,OAAc,MAAoB;EAC9B,MAAM,SAAS,KAAK,QAAQ,MAAM,MAAM,EAAE,SAAS,IAAI;EACvD,IAAI,QAAQ,OAAO,UAAU;CACjC;;CAGA,QAAe,MAAoB;EAC/B,MAAM,SAAS,KAAK,QAAQ,MAAM,MAAM,EAAE,SAAS,IAAI;EACvD,IAAI,QAAQ,OAAO,UAAU;CACjC;;CAGA,OAA2C;EACvC,OAAO,KAAK,QAAQ,QAAQ,MAAM,EAAE,YAAY,KAAK;CACzD;;;;;;;;;CAUA,OACI,QACA,MACA,MACgB;EAChB,MAAM,EAAE,OAAO,SAAS,UAAU,YAAY;EAC9C,MAAM,UAAU,KAAK,KAAK;EAE1B,IAAI,QAAQ,WAAW,GACnB,OAAO,SAAS,GAAG,IAAI;EAG3B,IAAI,SAAS,SACT,OAAO,QAAQ,GAAG,QAAQ,GAAG,IAAI;EAGrC,MAAM,kBACF,GACA,SACC;EACL,MAAM,MAAM,WAAW;EAEvB,IAAI,MAAwB,QAAQ,GAAG,QAAQ,GAAG,IAAI;EACtD,QAAQ,MAAM,CAAC,EAAE,SAAS,QAAQ,QAAQ;GACtC,MAAM,IAAI,KAAK,OAAO,QAAQ,GAAG,IAAI,GAAG,QAAQ,MAAM,CAAC;EAC3D,CAAC;EACD,OAAO;CACX;;CAGA,UAAwB;EACpB,KAAK,QAAQ,MAAM,GAAG,OAAO,EAAE,YAAY,MAAM,EAAE,YAAY,EAAE;CACrE;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as GateViolationTrace, D as GatePayload, E as VersionedGateEngine, O as GatePayloadV1, S as GateTraceNodeSnapshot, T as PolicyViolation, _ as ConditionEvaluatorReporter, b as GateStatus, f as ConditionEvaluationCause, g as ConditionEvaluationReportTag, h as ConditionEvaluationReportLevel, m as ConditionEvaluationReport, p as ConditionEvaluationOptions, v as GateOutcome, w as PolicyContext, x as GateTraceLeafSnapshot, y as GateOutcomeData } from "../../core-config.cjs";
|
|
2
2
|
import { a as ComputeOutcome, c as VersionedComputeEngine, d as ComputeDecisionTableRule, f as ComputeParamsPayload, i as ComputeEvaluatorRegistration, l as ComputePayload, n as ComputeRegistry, o as ComputeOutcomeData, p as ComputePayloadV1, r as ComputeEvaluator, s as ComputeStatus, t as GateEngineRegistry, u as ComputeDecisionTablePayload } from "../../gate-engine-registry.cjs";
|
|
3
3
|
import { a as ComputePayloadParserRegistry, c as ComputeEvaluatorRegistry, i as ComputePayloadParser, n as GatePayloadParserRegistry, o as ComputePayloadParsers, r as GatePayloadParsers, s as ComputeEngineRegistry, t as GatePayloadParser } from "../../parse-gate-payload.cjs";
|
|
4
4
|
export { ComputeDecisionTablePayload, ComputeDecisionTableRule, ComputeEngineRegistry, ComputeEvaluator, ComputeEvaluatorRegistration, ComputeEvaluatorRegistry, ComputeOutcome, ComputeOutcomeData, ComputeParamsPayload, ComputePayload, ComputePayloadParser, ComputePayloadParserRegistry, ComputePayloadParsers, ComputePayloadV1, ComputeRegistry, ComputeStatus, ConditionEvaluationCause, ConditionEvaluationOptions, ConditionEvaluationReport, ConditionEvaluationReportLevel, ConditionEvaluationReportTag, ConditionEvaluatorReporter, GateEngineRegistry, GateOutcome, GateOutcomeData, GatePayload, GatePayloadParser, GatePayloadParserRegistry, GatePayloadParsers, GatePayloadV1, GateStatus, GateTraceLeafSnapshot, GateTraceNodeSnapshot, GateViolationTrace, PolicyContext, PolicyViolation, VersionedComputeEngine, VersionedGateEngine };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as GateViolationTrace, D as GatePayload, E as VersionedGateEngine, O as GatePayloadV1, S as GateTraceNodeSnapshot, T as PolicyViolation, _ as ConditionEvaluatorReporter, b as GateStatus, f as ConditionEvaluationCause, g as ConditionEvaluationReportTag, h as ConditionEvaluationReportLevel, m as ConditionEvaluationReport, p as ConditionEvaluationOptions, v as GateOutcome, w as PolicyContext, x as GateTraceLeafSnapshot, y as GateOutcomeData } from "../../core-config.js";
|
|
2
2
|
import { a as ComputeOutcome, c as VersionedComputeEngine, d as ComputeDecisionTableRule, f as ComputeParamsPayload, i as ComputeEvaluatorRegistration, l as ComputePayload, n as ComputeRegistry, o as ComputeOutcomeData, p as ComputePayloadV1, r as ComputeEvaluator, s as ComputeStatus, t as GateEngineRegistry, u as ComputeDecisionTablePayload } from "../../gate-engine-registry.js";
|
|
3
3
|
import { a as ComputePayloadParserRegistry, c as ComputeEvaluatorRegistry, i as ComputePayloadParser, n as GatePayloadParserRegistry, o as ComputePayloadParsers, r as GatePayloadParsers, s as ComputeEngineRegistry, t as GatePayloadParser } from "../../parse-gate-payload.js";
|
|
4
4
|
export { ComputeDecisionTablePayload, ComputeDecisionTableRule, ComputeEngineRegistry, ComputeEvaluator, ComputeEvaluatorRegistration, ComputeEvaluatorRegistry, ComputeOutcome, ComputeOutcomeData, ComputeParamsPayload, ComputePayload, ComputePayloadParser, ComputePayloadParserRegistry, ComputePayloadParsers, ComputePayloadV1, ComputeRegistry, ComputeStatus, ConditionEvaluationCause, ConditionEvaluationOptions, ConditionEvaluationReport, ConditionEvaluationReportLevel, ConditionEvaluationReportTag, ConditionEvaluatorReporter, GateEngineRegistry, GateOutcome, GateOutcomeData, GatePayload, GatePayloadParser, GatePayloadParserRegistry, GatePayloadParsers, GatePayloadV1, GateStatus, GateTraceLeafSnapshot, GateTraceNodeSnapshot, GateViolationTrace, PolicyContext, PolicyViolation, VersionedComputeEngine, VersionedGateEngine };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as Result } from "../../../../result.cjs";
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as ConditionNode, D as GatePayload, E as VersionedGateEngine, O as GatePayloadV1, k as ConditionLeafNode, p as ConditionEvaluationOptions, t as CoreConfig, v as GateOutcome, w as PolicyContext } from "../../../../core-config.cjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/core/policies/engines/v1/condition-evaluator.d.ts
|
|
@@ -24,22 +24,10 @@ declare class ConditionEvaluatorV1 {
|
|
|
24
24
|
private static isNotNode;
|
|
25
25
|
private static isRelationalOperator;
|
|
26
26
|
private static describeError;
|
|
27
|
-
private static
|
|
28
|
-
private static buildNullishDateOperandMessage;
|
|
29
|
-
private static buildInvalidDateOperandMessage;
|
|
30
|
-
private static buildInvalidNumericOperandMessage;
|
|
31
|
-
private static buildInvalidSetOperandMessage;
|
|
32
|
-
private static buildEmptyOrConditionMessage;
|
|
33
|
-
private static buildEmptyAndConditionMessage;
|
|
34
|
-
private static parseComparableDate;
|
|
35
|
-
private static evaluateRelationalNumbers;
|
|
27
|
+
private static invalidDateOperandMessage;
|
|
36
28
|
private buildReport;
|
|
29
|
+
private reportLeafError;
|
|
37
30
|
private conditionEvalErr;
|
|
38
|
-
private static containsInvalidDate;
|
|
39
|
-
private static normalizeDateOperand;
|
|
40
|
-
private reportDateOperandError;
|
|
41
|
-
private reportInvalidNumericOperand;
|
|
42
|
-
private reportInvalidSetOperand;
|
|
43
31
|
private evaluateDateRelationalNode;
|
|
44
32
|
private evaluateOperator;
|
|
45
33
|
private evaluateNumericRelationalNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as Result } from "../../../../result.js";
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as ConditionNode, D as GatePayload, E as VersionedGateEngine, O as GatePayloadV1, k as ConditionLeafNode, p as ConditionEvaluationOptions, t as CoreConfig, v as GateOutcome, w as PolicyContext } from "../../../../core-config.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/core/policies/engines/v1/condition-evaluator.d.ts
|
|
@@ -24,22 +24,10 @@ declare class ConditionEvaluatorV1 {
|
|
|
24
24
|
private static isNotNode;
|
|
25
25
|
private static isRelationalOperator;
|
|
26
26
|
private static describeError;
|
|
27
|
-
private static
|
|
28
|
-
private static buildNullishDateOperandMessage;
|
|
29
|
-
private static buildInvalidDateOperandMessage;
|
|
30
|
-
private static buildInvalidNumericOperandMessage;
|
|
31
|
-
private static buildInvalidSetOperandMessage;
|
|
32
|
-
private static buildEmptyOrConditionMessage;
|
|
33
|
-
private static buildEmptyAndConditionMessage;
|
|
34
|
-
private static parseComparableDate;
|
|
35
|
-
private static evaluateRelationalNumbers;
|
|
27
|
+
private static invalidDateOperandMessage;
|
|
36
28
|
private buildReport;
|
|
29
|
+
private reportLeafError;
|
|
37
30
|
private conditionEvalErr;
|
|
38
|
-
private static containsInvalidDate;
|
|
39
|
-
private static normalizeDateOperand;
|
|
40
|
-
private reportDateOperandError;
|
|
41
|
-
private reportInvalidNumericOperand;
|
|
42
|
-
private reportInvalidSetOperand;
|
|
43
31
|
private evaluateDateRelationalNode;
|
|
44
32
|
private evaluateOperator;
|
|
45
33
|
private evaluateNumericRelationalNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as Ok, r as Result, t as Err } from "../result.cjs";
|
|
2
2
|
import { n as Outcome, t as CommonOutcomeStatus } from "../outcome.cjs";
|
|
3
|
-
import { C as
|
|
3
|
+
import { C as GateViolationTrace, D as GatePayload, E as VersionedGateEngine, S as GateTraceNodeSnapshot, T as PolicyViolation, _ as ConditionEvaluatorReporter, a as PolicyDefinitionId, b as GateStatus, c as asPolicyDecisionId, d as asTenantId, f as ConditionEvaluationCause, g as ConditionEvaluationReportTag, h as ConditionEvaluationReportLevel, i as PolicyDecisionId, l as asPolicyDefinitionId, m as ConditionEvaluationReport, n as CoreConfigOptions, o as SchoolId, p as ConditionEvaluationOptions, r as CoreObservabilityConfig, s as TenantId, t as CoreConfig, u as asSchoolId, v as GateOutcome, w as PolicyContext, x as GateTraceLeafSnapshot, y as GateOutcomeData } from "../core-config.cjs";
|
|
4
4
|
import { a as PolicyPackage, c as coreConfig, i as PolicyCatalogFactory, n as contextResolverRegistry, o as InMemoryPolicyDefinitionRepository, r as registerNamespacedContextResolvers, s as PolicyHashing, t as PolicyContextPath } from "../path.cjs";
|
|
5
5
|
import { A as PolicyScope, C as BasePolicyDefinitionProps, D as PolicyDefinition, E as GatePolicyDefinitionProps, F as PolicyKey, I as AsOfSource, L as PolicyKind, M as ScopeChain, N as PolicyCatalog, O as PolicyDefinitionProps, P as PolicyCatalogEntryProps, R as PolicyOwner, T as FindCandidatesParams, _ as ContextResolverResilienceOptions, a as PolicyServiceOptions, b as ContextSeed, c as PolicyEvaluationErrors, d as PolicyAsOfResolver, f as PolicyContextBuilder, g as ContextResolverCircuitBreakerOptions, h as registerNamespacedContextResolversIn, i as PolicyService, j as PolicyScopeMatcher, k as PolicyDefinitionStatus, l as PolicyResolver, m as ContextResolverRegistry, n as PolicyDecision, o as PolicyServiceParams, p as PolicyContextBuilderOptions, r as PolicyEvaluationResult, s as PolicyEvaluationError, t as EvaluateInput, u as DeriveAsOfOptions, v as ContextResolverRetryOptions, w as ComputePolicyDefinitionProps, x as ContextSeedValidator, y as ContextValueResolver, z as PolicyScopeLevel } from "../policy-service.cjs";
|
|
6
6
|
import { a as ComputeOutcome, c as VersionedComputeEngine, i as ComputeEvaluatorRegistration, n as ComputeRegistry, o as ComputeOutcomeData, r as ComputeEvaluator, s as ComputeStatus, t as GateEngineRegistry } from "../gate-engine-registry.cjs";
|