@cullet/erp-core 1.0.5 → 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-types.d.ts +1 -1
- package/dist/gate-v1-payload.schema.js +43 -0
- package/dist/gate-v1-payload.schema.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/outcome.js.map +1 -1
- package/dist/policies/engines/v1/gate/index.d.ts +4 -0
- package/dist/policies/engines/v1/gate/index.js.map +1 -1
- package/dist/policy-service.js +14 -11
- package/dist/policy-service.js.map +1 -1
- package/dist/validation-code.js +43 -9
- package/dist/validation-code.js.map +1 -1
- package/dist/validation-error.d.ts +15 -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 +11 -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 +2 -1
- package/src/core/errors/utils/json-safe.ts +25 -7
- 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/defs/policy-semver.ts +12 -5
- 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/condition-evaluator-reporter.ts +2 -0
- 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 +90 -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 +23 -11
- 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/hashing.ts +33 -4
- package/src/core/shared/immutable.ts +13 -2
- 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,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.
|
|
@@ -16,7 +16,11 @@ export class PolicyHashing {
|
|
|
16
16
|
return sha256Hex(input);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
private static assertHashable(
|
|
19
|
+
private static assertHashable(
|
|
20
|
+
value: unknown,
|
|
21
|
+
path: string,
|
|
22
|
+
seen: WeakSet<object>,
|
|
23
|
+
): void {
|
|
20
24
|
if (value === null) {
|
|
21
25
|
return;
|
|
22
26
|
}
|
|
@@ -54,22 +58,30 @@ export class PolicyHashing {
|
|
|
54
58
|
return;
|
|
55
59
|
}
|
|
56
60
|
|
|
61
|
+
if (seen.has(value as object)) {
|
|
62
|
+
throw new TypeError(
|
|
63
|
+
`canonicalJson does not accept circular references (at ${path})`,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
seen.add(value as object);
|
|
67
|
+
|
|
57
68
|
if (Array.isArray(value)) {
|
|
58
69
|
value.forEach((item, index) => {
|
|
59
|
-
PolicyHashing.assertHashable(item, `${path}[${index}]
|
|
70
|
+
PolicyHashing.assertHashable(item, `${path}[${index}]`, seen);
|
|
60
71
|
});
|
|
61
|
-
|
|
72
|
+
} else {
|
|
73
|
+
for (const [key, nested] of Object.entries(
|
|
74
|
+
value as Record<string, unknown>,
|
|
75
|
+
)) {
|
|
76
|
+
PolicyHashing.assertHashable(nested, `${path}.${key}`, seen);
|
|
77
|
+
}
|
|
62
78
|
}
|
|
63
79
|
|
|
64
|
-
|
|
65
|
-
value as Record<string, unknown>,
|
|
66
|
-
)) {
|
|
67
|
-
PolicyHashing.assertHashable(nested, `${path}.${key}`);
|
|
68
|
-
}
|
|
80
|
+
seen.delete(value as object);
|
|
69
81
|
}
|
|
70
82
|
|
|
71
83
|
static canonicalJson(value: unknown): string {
|
|
72
|
-
PolicyHashing.assertHashable(value, "$");
|
|
84
|
+
PolicyHashing.assertHashable(value, "$", new WeakSet<object>());
|
|
73
85
|
|
|
74
86
|
return stableStringify(value);
|
|
75
87
|
}
|
|
@@ -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,12 +1,23 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
|
|
3
|
+
const CIRCULAR_STRUCTURE_MESSAGE =
|
|
4
|
+
"Cannot stably stringify a circular structure";
|
|
5
|
+
|
|
3
6
|
function sha256Hex(value: string): string {
|
|
4
7
|
return createHash("sha256").update(value, "utf8").digest("hex");
|
|
5
8
|
}
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
// `seen` holds the current traversal branch so true cycles are rejected while
|
|
11
|
+
// repeated (acyclic) references are still serialized — matching JSON.stringify.
|
|
12
|
+
function sortKeysDeep(value: unknown, seen: WeakSet<object>): unknown {
|
|
8
13
|
if (Array.isArray(value)) {
|
|
9
|
-
|
|
14
|
+
if (seen.has(value)) {
|
|
15
|
+
throw new TypeError(CIRCULAR_STRUCTURE_MESSAGE);
|
|
16
|
+
}
|
|
17
|
+
seen.add(value);
|
|
18
|
+
const mapped = value.map((item) => sortKeysDeep(item, seen));
|
|
19
|
+
seen.delete(value);
|
|
20
|
+
return mapped;
|
|
10
21
|
}
|
|
11
22
|
|
|
12
23
|
if (value instanceof Date) {
|
|
@@ -14,12 +25,17 @@ function sortKeysDeep(value: unknown): unknown {
|
|
|
14
25
|
}
|
|
15
26
|
|
|
16
27
|
if (value && typeof value === "object") {
|
|
28
|
+
if (seen.has(value)) {
|
|
29
|
+
throw new TypeError(CIRCULAR_STRUCTURE_MESSAGE);
|
|
30
|
+
}
|
|
31
|
+
seen.add(value);
|
|
17
32
|
const record = value as Record<string, unknown>;
|
|
18
33
|
const ordered = Object.create(null) as Record<string, unknown>;
|
|
19
34
|
|
|
20
35
|
for (const key of Object.keys(record).sort()) {
|
|
21
|
-
ordered[key] = sortKeysDeep(record[key]);
|
|
36
|
+
ordered[key] = sortKeysDeep(record[key], seen);
|
|
22
37
|
}
|
|
38
|
+
seen.delete(value);
|
|
23
39
|
|
|
24
40
|
return ordered;
|
|
25
41
|
}
|
|
@@ -27,8 +43,21 @@ function sortKeysDeep(value: unknown): unknown {
|
|
|
27
43
|
return value;
|
|
28
44
|
}
|
|
29
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Deterministic JSON string with object keys sorted recursively, so key order
|
|
48
|
+
* does not affect the output.
|
|
49
|
+
*
|
|
50
|
+
* Follows `JSON.stringify` semantics for the values it serializes: `undefined`,
|
|
51
|
+
* functions and symbols are dropped, non-finite numbers become `null`, `bigint`
|
|
52
|
+
* throws, and `Map`/`Set` serialize as `{}`. Distinct payloads can therefore
|
|
53
|
+
* collapse to the same string — for collision-resistant hashing use
|
|
54
|
+
* `PolicyHashing.canonicalJson` (policies/utils), which rejects those values
|
|
55
|
+
* up front.
|
|
56
|
+
*
|
|
57
|
+
* @throws {TypeError} On circular references (mirroring `JSON.stringify`).
|
|
58
|
+
*/
|
|
30
59
|
function stableStringify(value: unknown): string {
|
|
31
|
-
return JSON.stringify(sortKeysDeep(value));
|
|
60
|
+
return JSON.stringify(sortKeysDeep(value, new WeakSet<object>()));
|
|
32
61
|
}
|
|
33
62
|
|
|
34
63
|
function payloadHash(value: unknown): string {
|
|
@@ -14,13 +14,24 @@ type DeepReadonly<T> = T extends PrimitiveValue | Date
|
|
|
14
14
|
: { readonly [TKey in keyof T]: DeepReadonly<T[TKey]> };
|
|
15
15
|
|
|
16
16
|
function deepFreeze<T>(value: T): T {
|
|
17
|
+
return deepFreezeInternal(value, new WeakSet<object>());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function deepFreezeInternal<T>(value: T, seen: WeakSet<object>): T {
|
|
17
21
|
if (typeof value !== "object" || value === null || value instanceof Date) {
|
|
18
22
|
return value;
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
// A value already on `seen` has been visited on this pass (cyclic graph or a
|
|
26
|
+
// shared reference); revisiting it would recurse forever.
|
|
27
|
+
if (seen.has(value)) {
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
seen.add(value);
|
|
31
|
+
|
|
21
32
|
if (Array.isArray(value)) {
|
|
22
33
|
for (const item of value) {
|
|
23
|
-
|
|
34
|
+
deepFreezeInternal(item, seen);
|
|
24
35
|
}
|
|
25
36
|
|
|
26
37
|
return Object.freeze(value);
|
|
@@ -29,7 +40,7 @@ function deepFreeze<T>(value: T): T {
|
|
|
29
40
|
const objectValue = value as Record<PropertyKey, object | PrimitiveValue>;
|
|
30
41
|
|
|
31
42
|
for (const propertyKey of Reflect.ownKeys(objectValue)) {
|
|
32
|
-
|
|
43
|
+
deepFreezeInternal(objectValue[propertyKey], seen);
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
return Object.freeze(value);
|
|
@@ -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";
|