@cullet/erp-core 1.0.6 → 1.0.7
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/dist/gate-engine-registry.js.map +1 -1
- package/dist/gate-v1-payload.schema.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/outcome.js.map +1 -1
- package/dist/policies/engines/v1/gate/index.js.map +1 -1
- package/dist/policy-service.js.map +1 -1
- package/dist/validation-code.js.map +1 -1
- package/dist/validation-error.js.map +1 -1
- package/meta.json +2 -2
- package/package.json +1 -1
- package/src/core/application/commands/command.ts +4 -4
- package/src/core/application/commands/index.ts +2 -2
- package/src/core/application/commands/requested-by.ts +3 -3
- package/src/core/application/index.ts +8 -8
- package/src/core/application/policy-error-mapper.ts +2 -2
- package/src/core/application/ports/index.ts +10 -6
- package/src/core/application/ports/policy-port.ts +6 -3
- package/src/core/application/ports/temporal-repository.port.ts +2 -2
- package/src/core/application/queries/index.ts +2 -2
- package/src/core/application/queries/query.ts +4 -4
- package/src/core/application/temporal/index.ts +2 -2
- package/src/core/application/temporal/temporal-context.ts +2 -2
- package/src/core/application/temporal/temporal-use-case.ts +4 -4
- package/src/core/application/use-case.ts +3 -3
- package/src/core/config/core-config.instance.ts +2 -2
- package/src/core/config/core-config.ts +3 -3
- package/src/core/config/index.ts +8 -5
- package/src/core/config/policy-reporter.ts +3 -3
- package/src/core/config/silent-policy-reporter.ts +1 -1
- package/src/core/domain/entity.ts +5 -5
- package/src/core/domain/rulesets/entity-ruleset.contracts.ts +2 -2
- package/src/core/domain/rulesets/ruleset-registry.ts +2 -2
- package/src/core/domain/rulesets/value-object-ruleset.contracts.ts +2 -2
- package/src/core/domain/temporal/index.ts +4 -4
- package/src/core/domain/temporal/temporal-range.ts +2 -2
- package/src/core/domain/temporal/temporal-snapshot.ts +3 -3
- package/src/core/domain/temporal/transaction-time.ts +3 -3
- package/src/core/domain/temporal/valid-time.ts +3 -3
- package/src/core/domain/value-object.ts +3 -3
- package/src/core/errors/app-error.ts +6 -2
- package/src/core/errors/authentication-error.ts +3 -3
- package/src/core/errors/authorization-error.ts +3 -3
- package/src/core/errors/business-rule-violation-error.ts +3 -3
- package/src/core/errors/conflict-error.ts +3 -3
- package/src/core/errors/idempotency-error.ts +3 -3
- package/src/core/errors/index.ts +23 -23
- package/src/core/errors/integration-error.ts +3 -3
- package/src/core/errors/legacy-incompatible-error.ts +3 -3
- package/src/core/errors/not-found-error.ts +3 -3
- package/src/core/errors/serialization-error.ts +3 -3
- package/src/core/errors/temporal-error.ts +3 -3
- package/src/core/errors/unexpected-error.ts +3 -3
- package/src/core/errors/utils/index.ts +1 -1
- package/src/core/errors/utils/json-safe.ts +1 -1
- package/src/core/errors/validation-error.ts +5 -5
- package/src/core/exceptions/business-rule-violation-exception.ts +1 -1
- package/src/core/exceptions/entity-not-found-exception.ts +1 -1
- package/src/core/exceptions/invalid-state-transition-exception.ts +1 -1
- package/src/core/exceptions/invariant-violation-exception.ts +1 -1
- package/src/core/exceptions/validation-exception.ts +3 -3
- package/src/core/index.ts +7 -7
- package/src/core/policies/asof/asof.ts +4 -4
- package/src/core/policies/asof/index.ts +2 -2
- package/src/core/policies/catalog/catalog.instance.ts +3 -3
- package/src/core/policies/catalog/index.ts +6 -6
- package/src/core/policies/catalog/policy-catalog-entry.ts +3 -3
- package/src/core/policies/catalog/policy-catalog.ts +3 -3
- package/src/core/policies/catalog/policy-key.ts +1 -1
- package/src/core/policies/context/context-builder.ts +5 -5
- package/src/core/policies/context/context-registry.instance.ts +3 -3
- package/src/core/policies/context/context-registry.ts +2 -2
- package/src/core/policies/context/context-resolver.ts +2 -2
- package/src/core/policies/context/context-seed.ts +2 -2
- package/src/core/policies/context/index.ts +9 -9
- package/src/core/policies/context/path.ts +1 -1
- package/src/core/policies/defs/in-memory-policy-definition-repo.ts +3 -3
- package/src/core/policies/defs/index.ts +8 -8
- package/src/core/policies/defs/policy-definition-repository.ts +1 -1
- package/src/core/policies/defs/policy-definition.ts +6 -6
- package/src/core/policies/defs/policy-payload.contracts.ts +1 -1
- package/src/core/policies/defs/policy-scope.ts +2 -2
- package/src/core/policies/engines/compute-engine-registry.ts +9 -6
- package/src/core/policies/engines/compute-evaluator-registry.ts +1 -1
- package/src/core/policies/engines/compute-payload.ts +1 -1
- package/src/core/policies/engines/compute-registry.ts +7 -7
- package/src/core/policies/engines/compute-types.ts +4 -4
- package/src/core/policies/engines/gate-engine-registry.ts +3 -3
- package/src/core/policies/engines/gate-payload.ts +1 -1
- package/src/core/policies/engines/gate-types.ts +3 -3
- package/src/core/policies/engines/index.ts +14 -14
- package/src/core/policies/engines/parse-compute-payload.ts +4 -4
- package/src/core/policies/engines/parse-gate-payload.ts +4 -4
- package/src/core/policies/engines/v1/compute/compute-engine-v1.ts +6 -6
- package/src/core/policies/engines/v1/compute/compute-payload.schema.ts +3 -3
- package/src/core/policies/engines/v1/compute/index.ts +4 -4
- package/src/core/policies/engines/v1/compute/resolve-decision-table-v1.ts +4 -4
- package/src/core/policies/engines/v1/condition-evaluator.ts +6 -6
- package/src/core/policies/engines/v1/condition-schema.ts +1 -1
- package/src/core/policies/engines/v1/gate/gate-engine-v1.ts +7 -7
- package/src/core/policies/engines/v1/gate/gate-types-v1.ts +1 -1
- package/src/core/policies/engines/v1/gate/gate-v1-payload.schema.ts +3 -3
- package/src/core/policies/engines/v1/gate/index.ts +4 -4
- package/src/core/policies/engines/v1/index.ts +3 -3
- package/src/core/policies/index.ts +30 -23
- package/src/core/policies/package/policy-package.ts +3 -3
- package/src/core/policies/policy-ids.ts +3 -3
- package/src/core/policies/resolver/index.ts +1 -1
- package/src/core/policies/resolver/policy-resolver.ts +4 -4
- package/src/core/policies/service/index.ts +3 -3
- package/src/core/policies/service/policy-evaluation-error.ts +1 -1
- package/src/core/policies/service/policy-service.ts +21 -14
- package/src/core/policies/utils/date.ts +1 -1
- package/src/core/policies/utils/hash.ts +2 -2
- package/src/core/policies/utils/index.ts +3 -3
- package/src/core/policies/utils/result.ts +1 -1
- package/src/core/result/outcome.ts +1 -1
- package/src/core/shared/aggregate-version.ts +1 -1
- package/src/core/shared/temporal-guards.ts +1 -1
- package/src/core/versioning/domain-event-contracts.ts +5 -5
- package/src/examples/rulesets/entity/order-creation-rules-v1.ts +2 -2
- package/src/examples/rulesets/entity/order-invariants-v1.ts +2 -2
- package/src/examples/rulesets/entity/order-invariants-v2.ts +3 -3
- package/src/examples/rulesets/entity/order.ts +1 -1
- package/src/examples/rulesets/value-object/cpf-rules-v1.ts +1 -1
- package/src/examples/rulesets/value-object/cpf-rules-v2.ts +2 -2
- package/src/examples/rulesets/value-object/cpf.ts +1 -1
- package/src/examples/rulesets/value-object/customer.ts +3 -3
- package/src/examples/rulesets/value-object/person-name-rules-v1.ts +1 -1
- package/src/examples/rulesets/value-object/person-name-rules-v2.ts +2 -2
- package/src/examples/rulesets/value-object/person-name.ts +1 -1
- package/src/version.ts +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { type CoreConfig, coreConfig } from "../../../../config";
|
|
2
|
-
import { Outcome } from "../../../../result/outcome";
|
|
3
|
-
import { Result } from "../../../../result/result";
|
|
1
|
+
import { type CoreConfig, coreConfig } from "../../../../config/index.js";
|
|
2
|
+
import { Outcome } from "../../../../result/outcome.js";
|
|
3
|
+
import { Result } from "../../../../result/result.js";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
ConditionEvaluatorV1,
|
|
7
7
|
type TracedConditionEvaluation,
|
|
8
|
-
} from "../condition-evaluator";
|
|
9
|
-
import type { ConditionLeafNode, ConditionNode } from "../condition-types";
|
|
10
|
-
import type { GatePayload } from "../../gate-payload";
|
|
8
|
+
} from "../condition-evaluator.js";
|
|
9
|
+
import type { ConditionLeafNode, ConditionNode } from "../condition-types.js";
|
|
10
|
+
import type { GatePayload } from "../../gate-payload.js";
|
|
11
11
|
import type {
|
|
12
12
|
GateOutcome,
|
|
13
13
|
GateStatus,
|
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
PolicyContext,
|
|
17
17
|
PolicyViolation,
|
|
18
18
|
VersionedGateEngine,
|
|
19
|
-
} from "../../gate-types";
|
|
19
|
+
} from "../../gate-types.js";
|
|
20
20
|
|
|
21
21
|
// ─── Gate engine v1 ─────────────────────────────────────────────────────────
|
|
22
22
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// The condition-tree DSL types are shared across the v1 engine family and live
|
|
3
3
|
// in engines/v1. Imported here for the GatePayloadV1 definition only — not
|
|
4
4
|
// re-exported; consumers should import condition types from engines/v1.
|
|
5
|
-
import type { ConditionNode } from "../condition-types";
|
|
5
|
+
import type { ConditionNode } from "../condition-types.js";
|
|
6
6
|
|
|
7
7
|
export type GatePayloadV1 =
|
|
8
8
|
| { readonly condition: ConditionNode }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
import { Result } from "../../../../result/result";
|
|
3
|
+
import { Result } from "../../../../result/result.js";
|
|
4
4
|
|
|
5
|
-
import type { GatePayloadV1 } from "./gate-types-v1";
|
|
5
|
+
import type { GatePayloadV1 } from "./gate-types-v1.js";
|
|
6
6
|
import {
|
|
7
7
|
conditionLeafNodeSchema,
|
|
8
8
|
conditionNodeSchema,
|
|
9
|
-
} from "../condition-schema";
|
|
9
|
+
} from "../condition-schema.js";
|
|
10
10
|
|
|
11
11
|
// Re-export so gate/v1 public API remains unchanged.
|
|
12
12
|
export { conditionLeafNodeSchema, conditionNodeSchema };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { ConditionEvaluatorV1 } from "../condition-evaluator";
|
|
2
|
-
export { GateEngineV1 } from "./gate-engine-v1";
|
|
3
|
-
export type { GatePayloadV1 } from "./gate-types-v1";
|
|
1
|
+
export { ConditionEvaluatorV1 } from "../condition-evaluator.js";
|
|
2
|
+
export { GateEngineV1 } from "./gate-engine-v1.js";
|
|
3
|
+
export type { GatePayloadV1 } from "./gate-types-v1.js";
|
|
4
4
|
export {
|
|
5
5
|
conditionLeafNodeSchema,
|
|
6
6
|
conditionNodeSchema,
|
|
7
7
|
gatePayloadSchema,
|
|
8
8
|
GatePayloadSchemaV1,
|
|
9
|
-
} from "./gate-v1-payload.schema";
|
|
9
|
+
} from "./gate-v1-payload.schema.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { ConditionEvaluatorV1 } from "./condition-evaluator";
|
|
1
|
+
export { ConditionEvaluatorV1 } from "./condition-evaluator.js";
|
|
2
2
|
export {
|
|
3
3
|
conditionLeafNodeSchema,
|
|
4
4
|
conditionNodeSchema,
|
|
5
|
-
} from "./condition-schema";
|
|
5
|
+
} from "./condition-schema.js";
|
|
6
6
|
export type {
|
|
7
7
|
ConditionAndNode,
|
|
8
8
|
ConditionLeafNode,
|
|
@@ -10,4 +10,4 @@ export type {
|
|
|
10
10
|
ConditionNotNode,
|
|
11
11
|
ConditionOp,
|
|
12
12
|
ConditionOrNode,
|
|
13
|
-
} from "./condition-types";
|
|
13
|
+
} from "./condition-types.js";
|
|
@@ -2,30 +2,33 @@
|
|
|
2
2
|
// Re-exports all public types, classes and utilities.
|
|
3
3
|
|
|
4
4
|
// ─── Core Config ────────────────────────────────────────────────────────────
|
|
5
|
-
export type {
|
|
6
|
-
|
|
5
|
+
export type {
|
|
6
|
+
CoreConfigOptions,
|
|
7
|
+
CoreObservabilityConfig,
|
|
8
|
+
} from "../config/index.js";
|
|
9
|
+
export { CoreConfig, coreConfig } from "../config/index.js";
|
|
7
10
|
|
|
8
11
|
// ─── Result (technical execution) ───────────────────────────────────────────
|
|
9
|
-
export { Err, Ok, Result } from "../result/result";
|
|
12
|
+
export { Err, Ok, Result } from "../result/result.js";
|
|
10
13
|
|
|
11
14
|
// ─── Outcome (business decision) ───────────────────────────────────────────
|
|
12
|
-
export type { CommonOutcomeStatus } from "../result/outcome";
|
|
13
|
-
export { Outcome } from "../result/outcome";
|
|
15
|
+
export type { CommonOutcomeStatus } from "../result/outcome.js";
|
|
16
|
+
export { Outcome } from "../result/outcome.js";
|
|
14
17
|
|
|
15
18
|
// ─── Utils ──────────────────────────────────────────────────────────────────
|
|
16
|
-
export { PolicyHashing } from "./utils";
|
|
19
|
+
export { PolicyHashing } from "./utils/index.js";
|
|
17
20
|
export type {
|
|
18
21
|
PolicyDecisionId,
|
|
19
22
|
PolicyDefinitionId,
|
|
20
23
|
SchoolId,
|
|
21
24
|
TenantId,
|
|
22
|
-
} from "./policy-ids";
|
|
25
|
+
} from "./policy-ids.js";
|
|
23
26
|
export {
|
|
24
27
|
asPolicyDecisionId,
|
|
25
28
|
asPolicyDefinitionId,
|
|
26
29
|
asSchoolId,
|
|
27
30
|
asTenantId,
|
|
28
|
-
} from "./policy-ids";
|
|
31
|
+
} from "./policy-ids.js";
|
|
29
32
|
|
|
30
33
|
// ─── Catalog ────────────────────────────────────────────────────────────────
|
|
31
34
|
export type {
|
|
@@ -34,8 +37,12 @@ export type {
|
|
|
34
37
|
PolicyKind,
|
|
35
38
|
PolicyOwner,
|
|
36
39
|
PolicyScopeLevel,
|
|
37
|
-
} from "./catalog";
|
|
38
|
-
export {
|
|
40
|
+
} from "./catalog/index.js";
|
|
41
|
+
export {
|
|
42
|
+
PolicyCatalog,
|
|
43
|
+
PolicyCatalogFactory,
|
|
44
|
+
PolicyKey,
|
|
45
|
+
} from "./catalog/index.js";
|
|
39
46
|
|
|
40
47
|
// ─── Definitions ────────────────────────────────────────────────────────────
|
|
41
48
|
export type {
|
|
@@ -47,12 +54,12 @@ export type {
|
|
|
47
54
|
PolicyDefinitionStatus,
|
|
48
55
|
PolicyScope,
|
|
49
56
|
ScopeChain,
|
|
50
|
-
} from "./defs";
|
|
57
|
+
} from "./defs/index.js";
|
|
51
58
|
export {
|
|
52
59
|
InMemoryPolicyDefinitionRepository,
|
|
53
60
|
PolicyDefinition,
|
|
54
61
|
PolicyScopeMatcher,
|
|
55
|
-
} from "./defs";
|
|
62
|
+
} from "./defs/index.js";
|
|
56
63
|
|
|
57
64
|
// ─── Context ────────────────────────────────────────────────────────────────
|
|
58
65
|
export type {
|
|
@@ -62,7 +69,7 @@ export type {
|
|
|
62
69
|
ContextSeed,
|
|
63
70
|
ContextValueResolver,
|
|
64
71
|
PolicyContextBuilderOptions,
|
|
65
|
-
} from "./context";
|
|
72
|
+
} from "./context/index.js";
|
|
66
73
|
export {
|
|
67
74
|
ContextSeedValidator,
|
|
68
75
|
ContextResolverRegistry,
|
|
@@ -71,11 +78,11 @@ export {
|
|
|
71
78
|
PolicyContextPath,
|
|
72
79
|
registerNamespacedContextResolvers,
|
|
73
80
|
registerNamespacedContextResolversIn,
|
|
74
|
-
} from "./context";
|
|
81
|
+
} from "./context/index.js";
|
|
75
82
|
|
|
76
83
|
// ─── AsOf ───────────────────────────────────────────────────────────────────
|
|
77
|
-
export type { DeriveAsOfOptions } from "./asof";
|
|
78
|
-
export { PolicyAsOfResolver } from "./asof";
|
|
84
|
+
export type { DeriveAsOfOptions } from "./asof/index.js";
|
|
85
|
+
export { PolicyAsOfResolver } from "./asof/index.js";
|
|
79
86
|
|
|
80
87
|
// ─── Engines ────────────────────────────────────────────────────────────────
|
|
81
88
|
export type {
|
|
@@ -95,7 +102,7 @@ export type {
|
|
|
95
102
|
PolicyContext,
|
|
96
103
|
PolicyViolation,
|
|
97
104
|
VersionedGateEngine,
|
|
98
|
-
} from "./engines";
|
|
105
|
+
} from "./engines/index.js";
|
|
99
106
|
export type {
|
|
100
107
|
ComputeEvaluator,
|
|
101
108
|
ComputeEvaluatorRegistration,
|
|
@@ -103,7 +110,7 @@ export type {
|
|
|
103
110
|
ComputeOutcomeData,
|
|
104
111
|
ComputeStatus,
|
|
105
112
|
VersionedComputeEngine,
|
|
106
|
-
} from "./engines";
|
|
113
|
+
} from "./engines/index.js";
|
|
107
114
|
export {
|
|
108
115
|
ComputeEngineRegistry,
|
|
109
116
|
ComputeEvaluatorRegistry,
|
|
@@ -112,10 +119,10 @@ export {
|
|
|
112
119
|
ComputeRegistry,
|
|
113
120
|
GateEngineRegistry,
|
|
114
121
|
GatePayloadParsers,
|
|
115
|
-
} from "./engines";
|
|
122
|
+
} from "./engines/index.js";
|
|
116
123
|
|
|
117
124
|
// ─── Resolver ───────────────────────────────────────────────────────────────
|
|
118
|
-
export { PolicyResolver } from "./resolver";
|
|
125
|
+
export { PolicyResolver } from "./resolver/index.js";
|
|
119
126
|
|
|
120
127
|
// ─── Service ────────────────────────────────────────────────────────────────
|
|
121
128
|
export type {
|
|
@@ -125,8 +132,8 @@ export type {
|
|
|
125
132
|
PolicyEvaluationResult,
|
|
126
133
|
PolicyServiceParams,
|
|
127
134
|
PolicyServiceOptions,
|
|
128
|
-
} from "./service";
|
|
129
|
-
export { PolicyEvaluationErrors, PolicyService } from "./service";
|
|
135
|
+
} from "./service/index.js";
|
|
136
|
+
export { PolicyEvaluationErrors, PolicyService } from "./service/index.js";
|
|
130
137
|
|
|
131
138
|
// ─── Package (contribution protocol) ────────────────────────────────────────
|
|
132
|
-
export type { PolicyPackage } from "./package/policy-package";
|
|
139
|
+
export type { PolicyPackage } from "./package/policy-package.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PolicyCatalogEntryProps } from "../catalog";
|
|
2
|
-
import type { PolicyDefinition } from "../defs";
|
|
3
|
-
import type { ComputeEvaluatorRegistration } from "../engines";
|
|
1
|
+
import type { PolicyCatalogEntryProps } from "../catalog/index.js";
|
|
2
|
+
import type { PolicyDefinition } from "../defs/index.js";
|
|
3
|
+
import type { ComputeEvaluatorRegistration } from "../engines/index.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Protocol of contribution: a module declares what it wants to add to the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ValidationCode } from "../exceptions/validation-code";
|
|
2
|
-
import { InvalidValueException } from "../exceptions/validation-exception";
|
|
3
|
-
import { ValidationField } from "../exceptions/validation-field";
|
|
1
|
+
import { ValidationCode } from "../exceptions/validation-code.js";
|
|
2
|
+
import { InvalidValueException } from "../exceptions/validation-exception.js";
|
|
3
|
+
import { ValidationField } from "../exceptions/validation-field.js";
|
|
4
4
|
|
|
5
5
|
type Brand<TValue, TBrand extends string> = TValue & {
|
|
6
6
|
readonly __brand: TBrand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PolicyResolver } from "./policy-resolver";
|
|
1
|
+
export { PolicyResolver } from "./policy-resolver.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { PolicyDefinition } from "../defs";
|
|
2
|
-
import { PolicyScopeMatcher } from "../defs";
|
|
3
|
-
import { comparePolicySemver } from "../defs/policy-semver";
|
|
4
|
-
import { Result } from "../../result/result";
|
|
1
|
+
import type { PolicyDefinition } from "../defs/index.js";
|
|
2
|
+
import { PolicyScopeMatcher } from "../defs/index.js";
|
|
3
|
+
import { comparePolicySemver } from "../defs/policy-semver.js";
|
|
4
|
+
import { Result } from "../../result/result.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Selects the best policy definition from a list of already-filtered candidates.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { PolicyService } from "./policy-service";
|
|
2
|
-
export { PolicyEvaluationErrors } from "./policy-evaluation-error";
|
|
1
|
+
export { PolicyService } from "./policy-service.js";
|
|
2
|
+
export { PolicyEvaluationErrors } from "./policy-evaluation-error.js";
|
|
3
3
|
export type {
|
|
4
4
|
EvaluateInput,
|
|
5
5
|
PolicyDecision,
|
|
@@ -7,4 +7,4 @@ export type {
|
|
|
7
7
|
PolicyEvaluationResult,
|
|
8
8
|
PolicyServiceOptions,
|
|
9
9
|
PolicyServiceParams,
|
|
10
|
-
} from "./policy-service";
|
|
10
|
+
} from "./policy-service.js";
|
|
@@ -1,31 +1,38 @@
|
|
|
1
|
-
import { PolicyAsOfResolver, type DeriveAsOfOptions } from "../asof";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { PolicyAsOfResolver, type DeriveAsOfOptions } from "../asof/index.js";
|
|
2
|
+
import {
|
|
3
|
+
type PolicyCatalog,
|
|
4
|
+
PolicyCatalogEntry,
|
|
5
|
+
PolicyKey,
|
|
6
|
+
} from "../catalog/index.js";
|
|
7
|
+
import type { ContextSeed, PolicyContextBuilder } from "../context/index.js";
|
|
8
|
+
import { ContextSeedValidator } from "../context/index.js";
|
|
5
9
|
import {
|
|
6
10
|
PolicyDefinition,
|
|
7
11
|
type PolicyDefinitionRepository,
|
|
8
12
|
type PolicyScope,
|
|
9
|
-
} from "../defs";
|
|
10
|
-
import type { PolicyDecisionId, PolicyDefinitionId } from "../policy-ids";
|
|
13
|
+
} from "../defs/index.js";
|
|
14
|
+
import type { PolicyDecisionId, PolicyDefinitionId } from "../policy-ids.js";
|
|
11
15
|
import {
|
|
12
16
|
type ComputeOutcome,
|
|
13
17
|
ComputeRegistry,
|
|
14
18
|
GateEngineRegistry,
|
|
15
19
|
type GateOutcome,
|
|
16
20
|
type PolicyContext,
|
|
17
|
-
} from "../engines";
|
|
18
|
-
import { PolicyResolver } from "../resolver";
|
|
19
|
-
import { Result } from "../../result/result";
|
|
20
|
-
import { isValidDate } from "../../shared/temporal-guards";
|
|
21
|
+
} from "../engines/index.js";
|
|
22
|
+
import { PolicyResolver } from "../resolver/index.js";
|
|
23
|
+
import { Result } from "../../result/result.js";
|
|
24
|
+
import { isValidDate } from "../../shared/temporal-guards.js";
|
|
21
25
|
|
|
22
|
-
import type {
|
|
23
|
-
|
|
26
|
+
import type {
|
|
27
|
+
PolicyEvent,
|
|
28
|
+
PolicyReporter,
|
|
29
|
+
} from "../../config/policy-reporter.js";
|
|
30
|
+
import { SilentPolicyReporter } from "../../config/silent-policy-reporter.js";
|
|
24
31
|
|
|
25
32
|
import {
|
|
26
33
|
PolicyEvaluationErrors,
|
|
27
34
|
type PolicyEvaluationError,
|
|
28
|
-
} from "./policy-evaluation-error";
|
|
35
|
+
} from "./policy-evaluation-error.js";
|
|
29
36
|
|
|
30
37
|
// ─── Input ──────────────────────────────────────────────────────────────────
|
|
31
38
|
|
|
@@ -57,7 +64,7 @@ export interface PolicyServiceParams {
|
|
|
57
64
|
/** Union of all possible policy decision Outcomes. */
|
|
58
65
|
export type PolicyDecision = GateOutcome | ComputeOutcome;
|
|
59
66
|
|
|
60
|
-
export type { PolicyEvaluationError } from "./policy-evaluation-error";
|
|
67
|
+
export type { PolicyEvaluationError } from "./policy-evaluation-error.js";
|
|
61
68
|
|
|
62
69
|
export interface PolicyEvaluationResult {
|
|
63
70
|
readonly decisionId: PolicyDecisionId;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sha256Hex, stableStringify } from "../../shared/hashing";
|
|
2
|
-
import { isValidDate } from "../../shared/temporal-guards";
|
|
1
|
+
import { sha256Hex, stableStringify } from "../../shared/hashing.js";
|
|
2
|
+
import { isValidDate } from "../../shared/temporal-guards.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Produces a deterministic SHA-256 hex digest of a canonical JSON representation.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Result, Ok, Err } from "./result";
|
|
2
|
-
export { PolicyHashing } from "./hash";
|
|
3
|
-
export { PolicyDateUtils } from "./date";
|
|
1
|
+
export { Result, Ok, Err } from "./result.js";
|
|
2
|
+
export { PolicyHashing } from "./hash.js";
|
|
3
|
+
export { PolicyDateUtils } from "./date.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// core/domain/outcome.ts
|
|
2
2
|
|
|
3
|
-
import { InvariantViolationException } from "../exceptions/invariant-violation-exception";
|
|
3
|
+
import { InvariantViolationException } from "../exceptions/invariant-violation-exception.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Outcome — Business decision abstraction.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvariantViolationException } from "../exceptions/invariant-violation-exception";
|
|
1
|
+
import { InvariantViolationException } from "../exceptions/invariant-violation-exception.js";
|
|
2
2
|
|
|
3
3
|
function assertValidAggregateVersion(aggregateVersion: number): void {
|
|
4
4
|
if (!Number.isInteger(aggregateVersion) || aggregateVersion < 0) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvariantViolationException } from "../exceptions/invariant-violation-exception";
|
|
1
|
+
import { InvariantViolationException } from "../exceptions/invariant-violation-exception.js";
|
|
2
2
|
|
|
3
3
|
function isValidDate(value: unknown): value is Date {
|
|
4
4
|
return value instanceof Date && !Number.isNaN(value.getTime());
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { UseCase } from "../application/use-case";
|
|
2
|
-
import { Entity } from "../domain/entity";
|
|
3
|
-
import { ValueObject } from "../domain/value-object";
|
|
4
|
-
import { assertValidAggregateVersion } from "../shared/aggregate-version";
|
|
5
|
-
import { type ContractVersion } from "./version";
|
|
1
|
+
import { UseCase } from "../application/use-case.js";
|
|
2
|
+
import { Entity } from "../domain/entity.js";
|
|
3
|
+
import { ValueObject } from "../domain/value-object.js";
|
|
4
|
+
import { assertValidAggregateVersion } from "../shared/aggregate-version.js";
|
|
5
|
+
import { type ContractVersion } from "./version.js";
|
|
6
6
|
|
|
7
7
|
interface DomainEventContractSelection {
|
|
8
8
|
readonly entity?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DomainException } from "../../../core/domain/rulesets/entity-ruleset.contracts";
|
|
2
|
-
import { type OrderCreationData, type OrderCreationRuleset } from "./order";
|
|
1
|
+
import { DomainException } from "../../../core/domain/rulesets/entity-ruleset.contracts.js";
|
|
2
|
+
import { type OrderCreationData, type OrderCreationRuleset } from "./order.js";
|
|
3
3
|
|
|
4
4
|
class OrderCreationValidationError extends DomainException {}
|
|
5
5
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DomainException,
|
|
3
3
|
type RulesetId,
|
|
4
|
-
} from "../../../core/domain/rulesets/entity-ruleset.contracts";
|
|
4
|
+
} from "../../../core/domain/rulesets/entity-ruleset.contracts.js";
|
|
5
5
|
import {
|
|
6
6
|
type Order,
|
|
7
7
|
type OrderInvariantRuleset,
|
|
8
8
|
type OrderItem,
|
|
9
|
-
} from "./order";
|
|
9
|
+
} from "./order.js";
|
|
10
10
|
|
|
11
11
|
class OrderInvariantError extends DomainException {}
|
|
12
12
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DomainException,
|
|
3
3
|
type RulesetId,
|
|
4
|
-
} from "../../../core/domain/rulesets/entity-ruleset.contracts";
|
|
5
|
-
import { type Order } from "./order";
|
|
6
|
-
import { OrderInvariantsV1 } from "./order-invariants-v1";
|
|
4
|
+
} from "../../../core/domain/rulesets/entity-ruleset.contracts.js";
|
|
5
|
+
import { type Order } from "./order.js";
|
|
6
|
+
import { OrderInvariantsV1 } from "./order-invariants-v1.js";
|
|
7
7
|
|
|
8
8
|
class OrderCancellationWindowError extends DomainException {}
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
type CreationRuleset,
|
|
3
3
|
type InvariantRuleset,
|
|
4
4
|
type RulesetId,
|
|
5
|
-
} from "../../../core/domain/rulesets/entity-ruleset.contracts";
|
|
5
|
+
} from "../../../core/domain/rulesets/entity-ruleset.contracts.js";
|
|
6
6
|
|
|
7
7
|
type OrderStatus = "open" | "cancelled" | "shipped" | "delivered";
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DomainException,
|
|
3
3
|
type ValueObjectRuleset,
|
|
4
|
-
} from "../../../core/domain/rulesets/value-object-ruleset.contracts";
|
|
5
|
-
import { CPFRulesV1 } from "./cpf-rules-v1";
|
|
4
|
+
} from "../../../core/domain/rulesets/value-object-ruleset.contracts.js";
|
|
5
|
+
import { CPFRulesV1 } from "./cpf-rules-v1.js";
|
|
6
6
|
|
|
7
7
|
class CPFBlocklistError extends DomainException {}
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type RulesetId,
|
|
3
3
|
type ValueObjectRuleset,
|
|
4
|
-
} from "../../../core/domain/rulesets/value-object-ruleset.contracts";
|
|
4
|
+
} from "../../../core/domain/rulesets/value-object-ruleset.contracts.js";
|
|
5
5
|
|
|
6
6
|
interface CPFStatic {
|
|
7
7
|
create(raw: string, ruleset: ValueObjectRuleset<string>): CPF;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CPF } from "./cpf";
|
|
2
|
-
import { PersonName } from "./person-name";
|
|
1
|
+
import { CPF } from "./cpf.js";
|
|
2
|
+
import { PersonName } from "./person-name.js";
|
|
3
3
|
import {
|
|
4
4
|
type RulesetId,
|
|
5
5
|
type ValueObjectRuleset,
|
|
6
|
-
} from "../../../core/domain/rulesets/value-object-ruleset.contracts";
|
|
6
|
+
} from "../../../core/domain/rulesets/value-object-ruleset.contracts.js";
|
|
7
7
|
|
|
8
8
|
interface CustomerCreateData {
|
|
9
9
|
readonly cpf: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DomainException,
|
|
3
3
|
type ValueObjectRuleset,
|
|
4
|
-
} from "../../../core/domain/rulesets/value-object-ruleset.contracts";
|
|
4
|
+
} from "../../../core/domain/rulesets/value-object-ruleset.contracts.js";
|
|
5
5
|
|
|
6
6
|
class PersonNameValidationError extends DomainException {}
|
|
7
7
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DomainException,
|
|
3
3
|
type ValueObjectRuleset,
|
|
4
|
-
} from "../../../core/domain/rulesets/value-object-ruleset.contracts";
|
|
5
|
-
import { PersonNameRulesV1 } from "./person-name-rules-v1";
|
|
4
|
+
} from "../../../core/domain/rulesets/value-object-ruleset.contracts.js";
|
|
5
|
+
import { PersonNameRulesV1 } from "./person-name-rules-v1.js";
|
|
6
6
|
|
|
7
7
|
class PersonNameCharacterError extends DomainException {}
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type RulesetId,
|
|
3
3
|
type ValueObjectRuleset,
|
|
4
|
-
} from "../../../core/domain/rulesets/value-object-ruleset.contracts";
|
|
4
|
+
} from "../../../core/domain/rulesets/value-object-ruleset.contracts.js";
|
|
5
5
|
|
|
6
6
|
interface PersonNameStatic {
|
|
7
7
|
create(raw: string, ruleset: ValueObjectRuleset<string>): PersonName;
|
package/src/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// Mantemos a versao aqui, dentro de src/, para que a copia full-control seja
|
|
5
5
|
// auto-contida: ao copiar so o conteudo de src/, o entry nao depende de um
|
|
6
6
|
// `../package.json` que deixaria de existir no projeto consumidor.
|
|
7
|
-
export const version = "1.0.
|
|
7
|
+
export const version = "1.0.7";
|