@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.
Files changed (143) hide show
  1. package/dist/gate-engine-registry.js.map +1 -1
  2. package/dist/gate-types.d.ts +1 -1
  3. package/dist/gate-v1-payload.schema.js +43 -0
  4. package/dist/gate-v1-payload.schema.js.map +1 -1
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +9 -3
  7. package/dist/index.js.map +1 -1
  8. package/dist/outcome.js.map +1 -1
  9. package/dist/policies/engines/v1/gate/index.d.ts +4 -0
  10. package/dist/policies/engines/v1/gate/index.js.map +1 -1
  11. package/dist/policy-service.js +14 -11
  12. package/dist/policy-service.js.map +1 -1
  13. package/dist/validation-code.js +43 -9
  14. package/dist/validation-code.js.map +1 -1
  15. package/dist/validation-error.d.ts +15 -1
  16. package/dist/validation-error.js.map +1 -1
  17. package/meta.json +2 -2
  18. package/package.json +1 -1
  19. package/src/core/application/commands/command.ts +4 -4
  20. package/src/core/application/commands/index.ts +2 -2
  21. package/src/core/application/commands/requested-by.ts +3 -3
  22. package/src/core/application/index.ts +8 -8
  23. package/src/core/application/policy-error-mapper.ts +2 -2
  24. package/src/core/application/ports/index.ts +10 -6
  25. package/src/core/application/ports/policy-port.ts +6 -3
  26. package/src/core/application/ports/temporal-repository.port.ts +2 -2
  27. package/src/core/application/queries/index.ts +2 -2
  28. package/src/core/application/queries/query.ts +4 -4
  29. package/src/core/application/temporal/index.ts +2 -2
  30. package/src/core/application/temporal/temporal-context.ts +2 -2
  31. package/src/core/application/temporal/temporal-use-case.ts +4 -4
  32. package/src/core/application/use-case.ts +3 -3
  33. package/src/core/config/core-config.instance.ts +2 -2
  34. package/src/core/config/core-config.ts +3 -3
  35. package/src/core/config/index.ts +8 -5
  36. package/src/core/config/policy-reporter.ts +3 -3
  37. package/src/core/config/silent-policy-reporter.ts +1 -1
  38. package/src/core/domain/entity.ts +11 -5
  39. package/src/core/domain/rulesets/entity-ruleset.contracts.ts +2 -2
  40. package/src/core/domain/rulesets/ruleset-registry.ts +2 -2
  41. package/src/core/domain/rulesets/value-object-ruleset.contracts.ts +2 -2
  42. package/src/core/domain/temporal/index.ts +4 -4
  43. package/src/core/domain/temporal/temporal-range.ts +2 -2
  44. package/src/core/domain/temporal/temporal-snapshot.ts +3 -3
  45. package/src/core/domain/temporal/transaction-time.ts +3 -3
  46. package/src/core/domain/temporal/valid-time.ts +3 -3
  47. package/src/core/domain/value-object.ts +3 -3
  48. package/src/core/errors/app-error.ts +6 -2
  49. package/src/core/errors/authentication-error.ts +3 -3
  50. package/src/core/errors/authorization-error.ts +3 -3
  51. package/src/core/errors/business-rule-violation-error.ts +3 -3
  52. package/src/core/errors/conflict-error.ts +3 -3
  53. package/src/core/errors/idempotency-error.ts +3 -3
  54. package/src/core/errors/index.ts +23 -23
  55. package/src/core/errors/integration-error.ts +3 -3
  56. package/src/core/errors/legacy-incompatible-error.ts +3 -3
  57. package/src/core/errors/not-found-error.ts +3 -3
  58. package/src/core/errors/serialization-error.ts +3 -3
  59. package/src/core/errors/temporal-error.ts +3 -3
  60. package/src/core/errors/unexpected-error.ts +3 -3
  61. package/src/core/errors/utils/index.ts +2 -1
  62. package/src/core/errors/utils/json-safe.ts +25 -7
  63. package/src/core/errors/validation-error.ts +5 -5
  64. package/src/core/exceptions/business-rule-violation-exception.ts +1 -1
  65. package/src/core/exceptions/entity-not-found-exception.ts +1 -1
  66. package/src/core/exceptions/invalid-state-transition-exception.ts +1 -1
  67. package/src/core/exceptions/invariant-violation-exception.ts +1 -1
  68. package/src/core/exceptions/validation-exception.ts +3 -3
  69. package/src/core/index.ts +7 -7
  70. package/src/core/policies/asof/asof.ts +4 -4
  71. package/src/core/policies/asof/index.ts +2 -2
  72. package/src/core/policies/catalog/catalog.instance.ts +3 -3
  73. package/src/core/policies/catalog/index.ts +6 -6
  74. package/src/core/policies/catalog/policy-catalog-entry.ts +3 -3
  75. package/src/core/policies/catalog/policy-catalog.ts +3 -3
  76. package/src/core/policies/catalog/policy-key.ts +1 -1
  77. package/src/core/policies/context/context-builder.ts +5 -5
  78. package/src/core/policies/context/context-registry.instance.ts +3 -3
  79. package/src/core/policies/context/context-registry.ts +2 -2
  80. package/src/core/policies/context/context-resolver.ts +2 -2
  81. package/src/core/policies/context/context-seed.ts +2 -2
  82. package/src/core/policies/context/index.ts +9 -9
  83. package/src/core/policies/context/path.ts +1 -1
  84. package/src/core/policies/defs/in-memory-policy-definition-repo.ts +3 -3
  85. package/src/core/policies/defs/index.ts +8 -8
  86. package/src/core/policies/defs/policy-definition-repository.ts +1 -1
  87. package/src/core/policies/defs/policy-definition.ts +6 -6
  88. package/src/core/policies/defs/policy-payload.contracts.ts +1 -1
  89. package/src/core/policies/defs/policy-scope.ts +2 -2
  90. package/src/core/policies/defs/policy-semver.ts +12 -5
  91. package/src/core/policies/engines/compute-engine-registry.ts +9 -6
  92. package/src/core/policies/engines/compute-evaluator-registry.ts +1 -1
  93. package/src/core/policies/engines/compute-payload.ts +1 -1
  94. package/src/core/policies/engines/compute-registry.ts +7 -7
  95. package/src/core/policies/engines/compute-types.ts +4 -4
  96. package/src/core/policies/engines/condition-evaluator-reporter.ts +2 -0
  97. package/src/core/policies/engines/gate-engine-registry.ts +3 -3
  98. package/src/core/policies/engines/gate-payload.ts +1 -1
  99. package/src/core/policies/engines/gate-types.ts +3 -3
  100. package/src/core/policies/engines/index.ts +14 -14
  101. package/src/core/policies/engines/parse-compute-payload.ts +4 -4
  102. package/src/core/policies/engines/parse-gate-payload.ts +4 -4
  103. package/src/core/policies/engines/v1/compute/compute-engine-v1.ts +6 -6
  104. package/src/core/policies/engines/v1/compute/compute-payload.schema.ts +3 -3
  105. package/src/core/policies/engines/v1/compute/index.ts +4 -4
  106. package/src/core/policies/engines/v1/compute/resolve-decision-table-v1.ts +4 -4
  107. package/src/core/policies/engines/v1/condition-evaluator.ts +90 -6
  108. package/src/core/policies/engines/v1/condition-schema.ts +1 -1
  109. package/src/core/policies/engines/v1/gate/gate-engine-v1.ts +7 -7
  110. package/src/core/policies/engines/v1/gate/gate-types-v1.ts +1 -1
  111. package/src/core/policies/engines/v1/gate/gate-v1-payload.schema.ts +3 -3
  112. package/src/core/policies/engines/v1/gate/index.ts +4 -4
  113. package/src/core/policies/engines/v1/index.ts +3 -3
  114. package/src/core/policies/index.ts +30 -23
  115. package/src/core/policies/package/policy-package.ts +3 -3
  116. package/src/core/policies/policy-ids.ts +3 -3
  117. package/src/core/policies/resolver/index.ts +1 -1
  118. package/src/core/policies/resolver/policy-resolver.ts +4 -4
  119. package/src/core/policies/service/index.ts +3 -3
  120. package/src/core/policies/service/policy-evaluation-error.ts +1 -1
  121. package/src/core/policies/service/policy-service.ts +21 -14
  122. package/src/core/policies/utils/date.ts +1 -1
  123. package/src/core/policies/utils/hash.ts +23 -11
  124. package/src/core/policies/utils/index.ts +3 -3
  125. package/src/core/policies/utils/result.ts +1 -1
  126. package/src/core/result/outcome.ts +1 -1
  127. package/src/core/shared/aggregate-version.ts +1 -1
  128. package/src/core/shared/hashing.ts +33 -4
  129. package/src/core/shared/immutable.ts +13 -2
  130. package/src/core/shared/temporal-guards.ts +1 -1
  131. package/src/core/versioning/domain-event-contracts.ts +5 -5
  132. package/src/examples/rulesets/entity/order-creation-rules-v1.ts +2 -2
  133. package/src/examples/rulesets/entity/order-invariants-v1.ts +2 -2
  134. package/src/examples/rulesets/entity/order-invariants-v2.ts +3 -3
  135. package/src/examples/rulesets/entity/order.ts +1 -1
  136. package/src/examples/rulesets/value-object/cpf-rules-v1.ts +1 -1
  137. package/src/examples/rulesets/value-object/cpf-rules-v2.ts +2 -2
  138. package/src/examples/rulesets/value-object/cpf.ts +1 -1
  139. package/src/examples/rulesets/value-object/customer.ts +3 -3
  140. package/src/examples/rulesets/value-object/person-name-rules-v1.ts +1 -1
  141. package/src/examples/rulesets/value-object/person-name-rules-v2.ts +2 -2
  142. package/src/examples/rulesets/value-object/person-name.ts +1 -1
  143. package/src/version.ts +1 -1
@@ -1,2 +1,2 @@
1
- export type { CommandInput } from "./command";
2
- export { Command } from "./command";
1
+ export type { CommandInput } from "./command.js";
2
+ export { Command } from "./command.js";
@@ -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
  // Identifies who triggered a Command.
6
6
  // Two valid formats:
@@ -1,5 +1,5 @@
1
- export type { CommandInput } from "./commands";
2
- export { Command } from "./commands";
1
+ export type { CommandInput } from "./commands/index.js";
2
+ export { Command } from "./commands/index.js";
3
3
  export type {
4
4
  LogPayload,
5
5
  LoggerPort,
@@ -15,10 +15,10 @@ export type {
15
15
  TracerPort,
16
16
  TemporalHistory,
17
17
  TemporalRepository,
18
- } from "./ports";
19
- export { mapPolicyEvaluationError } from "./policy-error-mapper";
20
- export type { CacheStrategy, Page } from "./queries";
21
- export { Query } from "./queries";
18
+ } from "./ports/index.js";
19
+ export { mapPolicyEvaluationError } from "./policy-error-mapper.js";
20
+ export type { CacheStrategy, Page } from "./queries/index.js";
21
+ export { Query } from "./queries/index.js";
22
22
  export {
23
23
  assertTemporalContext,
24
24
  createTemporalContext,
@@ -27,5 +27,5 @@ export {
27
27
  type TemporalizedContextSeed,
28
28
  TemporalUseCase,
29
29
  type TemporalUseCaseInput,
30
- } from "./temporal";
31
- export { type MaybePromise, UseCase } from "./use-case";
30
+ } from "./temporal/index.js";
31
+ export { type MaybePromise, UseCase } from "./use-case.js";
@@ -3,8 +3,8 @@ import {
3
3
  BusinessRuleViolationError,
4
4
  NotFoundError,
5
5
  UnexpectedError,
6
- } from "../errors";
7
- import type { PolicyEvaluationError } from "../policies";
6
+ } from "../errors/index.js";
7
+ import type { PolicyEvaluationError } from "../policies/index.js";
8
8
 
9
9
  export function mapPolicyEvaluationError(err: PolicyEvaluationError): AppError {
10
10
  switch (err.kind) {
@@ -1,14 +1,18 @@
1
- export type { LogPayload, LoggerPort } from "./logger.port";
2
- export type { MetricLabels, MetricsPort } from "./metrics.port";
1
+ export type { LogPayload, LoggerPort } from "./logger.port.js";
2
+ export type { MetricLabels, MetricsPort } from "./metrics.port.js";
3
3
  export type {
4
4
  PolicyEvaluationError,
5
5
  PolicyEvaluationInput,
6
6
  PolicyEvaluationOutput,
7
7
  PolicyPort,
8
- } from "./policy-port";
9
- export type { Repository } from "./repository.port";
8
+ } from "./policy-port.js";
9
+ export type { Repository } from "./repository.port.js";
10
10
  export type {
11
11
  TemporalHistory,
12
12
  TemporalRepository,
13
- } from "./temporal-repository.port";
14
- export type { TraceAttributeValue, TraceSpan, TracerPort } from "./tracer.port";
13
+ } from "./temporal-repository.port.js";
14
+ export type {
15
+ TraceAttributeValue,
16
+ TraceSpan,
17
+ TracerPort,
18
+ } from "./tracer.port.js";
@@ -1,6 +1,9 @@
1
- import type { AppError } from "../../errors";
2
- import type { EvaluateInput, PolicyEvaluationResult } from "../../policies";
3
- import type { Result } from "../../result/result";
1
+ import type { AppError } from "../../errors/index.js";
2
+ import type {
3
+ EvaluateInput,
4
+ PolicyEvaluationResult,
5
+ } from "../../policies/index.js";
6
+ import type { Result } from "../../result/result.js";
4
7
 
5
8
  type PolicyEvaluationInput = EvaluateInput;
6
9
  type PolicyEvaluationOutput = PolicyEvaluationResult;
@@ -1,6 +1,6 @@
1
- import type { TemporalSnapshot } from "../../domain/temporal";
1
+ import type { TemporalSnapshot } from "../../domain/temporal/index.js";
2
2
 
3
- import type { Repository } from "./repository.port";
3
+ import type { Repository } from "./repository.port.js";
4
4
 
5
5
  type TemporalHistory<TEntity> = readonly TemporalSnapshot<TEntity>[];
6
6
 
@@ -1,2 +1,2 @@
1
- export type { CacheStrategy, Page } from "./query";
2
- export { Query } from "./query";
1
+ export type { CacheStrategy, Page } from "./query.js";
2
+ export { Query } from "./query.js";
@@ -1,7 +1,7 @@
1
- import { UseCase } from "../use-case";
2
- import { version } from "../../versioning/version";
3
- import type { AppError } from "../../errors";
4
- import type { Result } from "../../result/result";
1
+ import { UseCase } from "../use-case.js";
2
+ import { version } from "../../versioning/version.js";
3
+ import type { AppError } from "../../errors/index.js";
4
+ import type { Result } from "../../result/result.js";
5
5
 
6
6
  /**
7
7
  * Paginated result of a list query.
@@ -3,9 +3,9 @@ export {
3
3
  createTemporalContext,
4
4
  type CreateTemporalContextInput,
5
5
  type TemporalContext,
6
- } from "./temporal-context";
6
+ } from "./temporal-context.js";
7
7
  export {
8
8
  type TemporalUseCaseInput,
9
9
  type TemporalizedContextSeed,
10
10
  TemporalUseCase,
11
- } from "./temporal-use-case";
11
+ } from "./temporal-use-case.js";
@@ -1,5 +1,5 @@
1
- import { makeImmutable } from "../../shared/immutable";
2
- import { assertValidDate } from "../../shared/temporal-guards";
1
+ import { makeImmutable } from "../../shared/immutable.js";
2
+ import { assertValidDate } from "../../shared/temporal-guards.js";
3
3
 
4
4
  interface TemporalContext {
5
5
  readonly asOf: Date;
@@ -1,11 +1,11 @@
1
- import { UseCase } from "../use-case";
2
- import type { ContextSeed } from "../../policies";
3
- import type { Result } from "../../result/result";
1
+ import { UseCase } from "../use-case.js";
2
+ import type { ContextSeed } from "../../policies/index.js";
3
+ import type { Result } from "../../result/result.js";
4
4
 
5
5
  import {
6
6
  createTemporalContext,
7
7
  type TemporalContext,
8
- } from "./temporal-context";
8
+ } from "./temporal-context.js";
9
9
 
10
10
  interface TemporalUseCaseInput {
11
11
  readonly temporalContext?: TemporalContext;
@@ -1,5 +1,5 @@
1
- import { type ContractVersion, version } from "../versioning/version";
2
- import type { Result } from "../result/result";
1
+ import { type ContractVersion, version } from "../versioning/version.js";
2
+ import type { Result } from "../result/result.js";
3
3
 
4
4
  type MaybePromise<T> = T | Promise<T>;
5
5
 
@@ -8,7 +8,7 @@ abstract class UseCase<
8
8
  Input = void,
9
9
  Output extends Result<unknown, unknown> = Result<void, never>,
10
10
  > {
11
- public static readonly CONTRACT_VERSION: ContractVersion;
11
+ declare public static readonly CONTRACT_VERSION: ContractVersion;
12
12
 
13
13
  public get contractVersion(): ContractVersion {
14
14
  return UseCase.CONTRACT_VERSION;
@@ -1,5 +1,5 @@
1
- import { CoreConfig } from "./core-config";
2
- import { SilentPolicyReporter } from "./silent-policy-reporter";
1
+ import { CoreConfig } from "./core-config.js";
2
+ import { SilentPolicyReporter } from "./silent-policy-reporter.js";
3
3
 
4
4
  /**
5
5
  * Shared instance for the application composition root.
@@ -1,9 +1,9 @@
1
1
  import type {
2
2
  ConditionEvaluationOptions,
3
3
  ConditionEvaluatorReporter,
4
- } from "../policies/engines/condition-evaluator-reporter";
5
- import type { PolicyEvent, PolicyReporter } from "./policy-reporter";
6
- import { SilentPolicyReporter } from "./silent-policy-reporter";
4
+ } from "../policies/engines/condition-evaluator-reporter.js";
5
+ import type { PolicyEvent, PolicyReporter } from "./policy-reporter.js";
6
+ import { SilentPolicyReporter } from "./silent-policy-reporter.js";
7
7
 
8
8
  export interface CoreObservabilityConfig {
9
9
  readonly reporter?: PolicyReporter;
@@ -1,6 +1,9 @@
1
- export type { CoreConfigOptions, CoreObservabilityConfig } from "./core-config";
2
- export { CoreConfig } from "./core-config";
3
- export { coreConfig } from "./core-config.instance";
1
+ export type {
2
+ CoreConfigOptions,
3
+ CoreObservabilityConfig,
4
+ } from "./core-config.js";
5
+ export { CoreConfig } from "./core-config.js";
6
+ export { coreConfig } from "./core-config.instance.js";
4
7
  export type {
5
8
  PolicyEvent,
6
9
  PolicyReporter,
@@ -8,5 +11,5 @@ export type {
8
11
  PolicyResolutionEvent,
9
12
  PolicyEvaluationFailedEvent,
10
13
  PolicyEvaluationCompletedEvent,
11
- } from "./policy-reporter";
12
- export { SilentPolicyReporter } from "./silent-policy-reporter";
14
+ } from "./policy-reporter.js";
15
+ export { SilentPolicyReporter } from "./silent-policy-reporter.js";
@@ -1,8 +1,8 @@
1
- import type { ConditionEvaluationReport } from "../policies/engines/condition-evaluator-reporter";
1
+ import type { ConditionEvaluationReport } from "../policies/engines/condition-evaluator-reporter.js";
2
2
  import type {
3
3
  PolicyDecisionId,
4
4
  PolicyDefinitionId,
5
- } from "../policies/policy-ids";
5
+ } from "../policies/policy-ids.js";
6
6
 
7
7
  // ─── Event kinds ─────────────────────────────────────────────────────────────
8
8
 
@@ -57,4 +57,4 @@ export interface PolicyReporter {
57
57
  export type {
58
58
  ConditionEvaluationReport,
59
59
  ConditionEvaluationReportTag,
60
- } from "../policies/engines/condition-evaluator-reporter";
60
+ } from "../policies/engines/condition-evaluator-reporter.js";
@@ -1,4 +1,4 @@
1
- import type { PolicyReporter } from "./policy-reporter";
1
+ import type { PolicyReporter } from "./policy-reporter.js";
2
2
 
3
3
  export class SilentPolicyReporter implements PolicyReporter {
4
4
  report(_event: Parameters<PolicyReporter["report"]>[0]): void {}
@@ -1,7 +1,7 @@
1
- import { InvariantViolationException } from "../exceptions/invariant-violation-exception";
2
- import { assertValidAggregateVersion } from "../shared/aggregate-version";
3
- import { assertValidDate, cloneDate } from "../shared/temporal-guards";
4
- import { type ContractVersion, version } from "../versioning/version";
1
+ import { InvariantViolationException } from "../exceptions/invariant-violation-exception.js";
2
+ import { assertValidAggregateVersion } from "../shared/aggregate-version.js";
3
+ import { assertValidDate, cloneDate } from "../shared/temporal-guards.js";
4
+ import { type ContractVersion, version } from "../versioning/version.js";
5
5
 
6
6
  interface EntityState<TIdentifier> {
7
7
  readonly id: TIdentifier;
@@ -12,7 +12,7 @@ interface EntityState<TIdentifier> {
12
12
 
13
13
  @version("1.0")
14
14
  abstract class Entity<TIdentifier> {
15
- public static readonly CONTRACT_VERSION: ContractVersion;
15
+ declare public static readonly CONTRACT_VERSION: ContractVersion;
16
16
 
17
17
  private readonly _id: TIdentifier;
18
18
  private readonly _createdAt: Date;
@@ -59,6 +59,12 @@ abstract class Entity<TIdentifier> {
59
59
  protected markAsModified(updatedAt: Date = new Date()): number {
60
60
  assertValidDate("updatedAt", updatedAt);
61
61
 
62
+ if (updatedAt.getTime() < this._createdAt.getTime()) {
63
+ throw new InvariantViolationException(
64
+ "updatedAt cannot be earlier than createdAt",
65
+ );
66
+ }
67
+
62
68
  this._updatedAt = cloneDate(updatedAt);
63
69
  this._aggregateVersion += 1;
64
70
 
@@ -1,5 +1,5 @@
1
- import { type Ruleset, type RulesetId } from "./ruleset.contracts";
2
- import { DomainException } from "../../exceptions/domain-exception";
1
+ import { type Ruleset, type RulesetId } from "./ruleset.contracts.js";
2
+ import { DomainException } from "../../exceptions/domain-exception.js";
3
3
 
4
4
  interface CreationRuleset<TData> extends Ruleset {
5
5
  validate(data: TData): void;
@@ -1,8 +1,8 @@
1
- import { DomainException } from "../../exceptions/domain-exception";
1
+ import { DomainException } from "../../exceptions/domain-exception.js";
2
2
  import {
3
3
  type Ruleset,
4
4
  type RulesetRegistry as RulesetRegistryContract,
5
- } from "./ruleset.contracts";
5
+ } from "./ruleset.contracts.js";
6
6
 
7
7
  class RulesetRegistryError extends DomainException {}
8
8
 
@@ -1,5 +1,5 @@
1
- import { DomainException } from "../../exceptions/domain-exception";
2
- import { type Ruleset, type RulesetId } from "./ruleset.contracts";
1
+ import { DomainException } from "../../exceptions/domain-exception.js";
2
+ import { type Ruleset, type RulesetId } from "./ruleset.contracts.js";
3
3
 
4
4
  interface ValueObjectRuleset<T> extends Ruleset {
5
5
  validate(value: T): void;
@@ -3,16 +3,16 @@ export {
3
3
  createTransactionTime,
4
4
  type CreateTransactionTimeInput,
5
5
  type TransactionTime,
6
- } from "./transaction-time";
7
- export { contains, isClosed, isOpen, overlaps } from "./temporal-range";
6
+ } from "./transaction-time.js";
7
+ export { contains, isClosed, isOpen, overlaps } from "./temporal-range.js";
8
8
  export {
9
9
  createTemporalSnapshot,
10
10
  type CreateTemporalSnapshotInput,
11
11
  type TemporalSnapshot,
12
- } from "./temporal-snapshot";
12
+ } from "./temporal-snapshot.js";
13
13
  export {
14
14
  assertValidTime,
15
15
  createValidTime,
16
16
  type CreateValidTimeInput,
17
17
  type ValidTime,
18
- } from "./valid-time";
18
+ } from "./valid-time.js";
@@ -1,6 +1,6 @@
1
- import { assertValidDate } from "../../shared/temporal-guards";
1
+ import { assertValidDate } from "../../shared/temporal-guards.js";
2
2
 
3
- import { assertValidTime, type ValidTime } from "./valid-time";
3
+ import { assertValidTime, type ValidTime } from "./valid-time.js";
4
4
 
5
5
  /**
6
6
  * Checks whether a temporal range is "open" (has no end date).
@@ -1,15 +1,15 @@
1
- import { type DeepReadonly, makeImmutable } from "../../shared/immutable";
1
+ import { type DeepReadonly, makeImmutable } from "../../shared/immutable.js";
2
2
 
3
3
  import {
4
4
  createTransactionTime,
5
5
  type CreateTransactionTimeInput,
6
6
  type TransactionTime,
7
- } from "./transaction-time";
7
+ } from "./transaction-time.js";
8
8
  import {
9
9
  createValidTime,
10
10
  type CreateValidTimeInput,
11
11
  type ValidTime,
12
- } from "./valid-time";
12
+ } from "./valid-time.js";
13
13
 
14
14
  /**
15
15
  * Pairs a domain datum with its time dimensions (Business and Transaction).
@@ -1,6 +1,6 @@
1
- import { InvariantViolationException } from "../../exceptions/invariant-violation-exception";
2
- import { makeImmutable } from "../../shared/immutable";
3
- import { assertValidDate } from "../../shared/temporal-guards";
1
+ import { InvariantViolationException } from "../../exceptions/invariant-violation-exception.js";
2
+ import { makeImmutable } from "../../shared/immutable.js";
3
+ import { assertValidDate } from "../../shared/temporal-guards.js";
4
4
 
5
5
  /**
6
6
  * Represents transaction time (Transaction Time).
@@ -1,6 +1,6 @@
1
- import { InvariantViolationException } from "../../exceptions/invariant-violation-exception";
2
- import { makeImmutable } from "../../shared/immutable";
3
- import { assertValidDate } from "../../shared/temporal-guards";
1
+ import { InvariantViolationException } from "../../exceptions/invariant-violation-exception.js";
2
+ import { makeImmutable } from "../../shared/immutable.js";
3
+ import { assertValidDate } from "../../shared/temporal-guards.js";
4
4
 
5
5
  /**
6
6
  * Represents business time (Valid Time).
@@ -1,9 +1,9 @@
1
- import { type DeepReadonly, makeImmutable } from "../shared/immutable";
2
- import { type ContractVersion, version } from "../versioning/version";
1
+ import { type DeepReadonly, makeImmutable } from "../shared/immutable.js";
2
+ import { type ContractVersion, version } from "../versioning/version.js";
3
3
 
4
4
  @version("1.0")
5
5
  abstract class ValueObject<T, P> {
6
- public static readonly CONTRACT_VERSION: ContractVersion;
6
+ declare public static readonly CONTRACT_VERSION: ContractVersion;
7
7
  public readonly value: DeepReadonly<T>;
8
8
 
9
9
  protected constructor(value: T) {
@@ -1,8 +1,12 @@
1
1
  // Base application error for the domain/application layer.
2
2
  // Encapsulates a code, optional cause, and JSON-safe metadata.
3
3
 
4
- import type { AppErrorOptions, ErrorSeverity, JsonSafeRecord } from "./types";
5
- import { assertJsonSafeMetadata } from "./utils";
4
+ import type {
5
+ AppErrorOptions,
6
+ ErrorSeverity,
7
+ JsonSafeRecord,
8
+ } from "./types.js";
9
+ import { assertJsonSafeMetadata } from "./utils/index.js";
6
10
 
7
11
  // ─────────────────────────────────────────────────────────────────────────────
8
12
  // AppError (abstract base class)
@@ -1,6 +1,6 @@
1
- import { AppError } from "./app-error";
2
- import { ErrorCodes } from "./error-codes";
3
- import type { AppErrorOptions, ErrorSeverity } from "./types";
1
+ import { AppError } from "./app-error.js";
2
+ import { ErrorCodes } from "./error-codes.js";
3
+ import type { AppErrorOptions, ErrorSeverity } from "./types.js";
4
4
 
5
5
  // ─────────────────────────────────────────────────────────────────────────────
6
6
  // Types
@@ -1,6 +1,6 @@
1
- import { AppError } from "./app-error";
2
- import { ErrorCodes } from "./error-codes";
3
- import type { AppErrorOptions, ErrorSeverity } from "./types";
1
+ import { AppError } from "./app-error.js";
2
+ import { ErrorCodes } from "./error-codes.js";
3
+ import type { AppErrorOptions, ErrorSeverity } from "./types.js";
4
4
 
5
5
  // ─────────────────────────────────────────────────────────────────────────────
6
6
  // Types
@@ -1,6 +1,6 @@
1
- import { AppError } from "./app-error";
2
- import { ErrorCodes } from "./error-codes";
3
- import type { AppErrorOptions } from "./types";
1
+ import { AppError } from "./app-error.js";
2
+ import { ErrorCodes } from "./error-codes.js";
3
+ import type { AppErrorOptions } from "./types.js";
4
4
 
5
5
  // ─────────────────────────────────────────────────────────────────────────────
6
6
  // BusinessRuleViolationError
@@ -1,6 +1,6 @@
1
- import { AppError } from "./app-error";
2
- import { ErrorCodes } from "./error-codes";
3
- import type { AppErrorOptions } from "./types";
1
+ import { AppError } from "./app-error.js";
2
+ import { ErrorCodes } from "./error-codes.js";
3
+ import type { AppErrorOptions } from "./types.js";
4
4
 
5
5
  /**
6
6
  * Conflict kinds we want to distinguish semantically.
@@ -1,7 +1,7 @@
1
- import { payloadHash, sha256Hex, stableStringify } from "../shared/hashing";
1
+ import { payloadHash, sha256Hex, stableStringify } from "../shared/hashing.js";
2
2
 
3
- import { AppError } from "./app-error";
4
- import { ErrorCodes } from "./error-codes";
3
+ import { AppError } from "./app-error.js";
4
+ import { ErrorCodes } from "./error-codes.js";
5
5
 
6
6
  export type IdempotencyFailureKind =
7
7
  | "key_missing"
@@ -8,48 +8,48 @@ export type {
8
8
  JsonSafePrimitive,
9
9
  JsonSafeRecord,
10
10
  JsonSafeValue,
11
- } from "./types";
11
+ } from "./types.js";
12
12
 
13
13
  // ─────────────────────────────────────────────────────────────────────────────
14
14
  // Utilities
15
15
  // ─────────────────────────────────────────────────────────────────────────────
16
16
 
17
- export { ErrorCodes, serializationErrorCode } from "./error-codes";
18
- export { assertJsonSafeMetadata } from "./utils";
17
+ export { ErrorCodes, serializationErrorCode } from "./error-codes.js";
18
+ export { assertJsonSafeMetadata } from "./utils/index.js";
19
19
 
20
20
  // ─────────────────────────────────────────────────────────────────────────────
21
21
  // Error classes
22
22
  // ─────────────────────────────────────────────────────────────────────────────
23
23
 
24
- export { AppError } from "./app-error";
24
+ export { AppError } from "./app-error.js";
25
25
  export type {
26
26
  AuthenticationErrorMetadata,
27
27
  AuthenticationErrorReason,
28
- } from "./authentication-error";
29
- export { AuthenticationError } from "./authentication-error";
28
+ } from "./authentication-error.js";
29
+ export { AuthenticationError } from "./authentication-error.js";
30
30
  export type {
31
31
  AuthorizationErrorMetadata,
32
32
  AuthorizationErrorReason,
33
33
  AuthorizationRequirement,
34
- } from "./authorization-error";
35
- export { AuthorizationError } from "./authorization-error";
36
- export { BusinessRuleViolationError } from "./business-rule-violation-error";
34
+ } from "./authorization-error.js";
35
+ export { AuthorizationError } from "./authorization-error.js";
36
+ export { BusinessRuleViolationError } from "./business-rule-violation-error.js";
37
37
  export type {
38
38
  ConflictErrorMetadata,
39
39
  ConflictKind,
40
40
  UniqueConstraintViolation,
41
- } from "./conflict-error";
41
+ } from "./conflict-error.js";
42
42
  export {
43
43
  AlreadyExistsError,
44
44
  ConflictError,
45
45
  DuplicateError,
46
46
  translateUniqueViolationToDuplicate,
47
47
  UniqueConstraintViolationError,
48
- } from "./conflict-error";
48
+ } from "./conflict-error.js";
49
49
  export type {
50
50
  IdempotencyErrorMetadata,
51
51
  IdempotencyFailureKind,
52
- } from "./idempotency-error";
52
+ } from "./idempotency-error.js";
53
53
  export {
54
54
  IdempotencyError,
55
55
  IdempotencyInProgressError,
@@ -59,20 +59,20 @@ export {
59
59
  payloadHash,
60
60
  sha256Hex,
61
61
  stableStringify,
62
- } from "./idempotency-error";
62
+ } from "./idempotency-error.js";
63
63
  export type {
64
64
  IntegrationErrorMetadata,
65
65
  IntegrationErrorReason,
66
- } from "./integration-error";
67
- export { IntegrationError } from "./integration-error";
68
- export { LegacyIncompatibleError } from "./legacy-incompatible-error";
69
- export { NotFoundError } from "./not-found-error";
66
+ } from "./integration-error.js";
67
+ export { IntegrationError } from "./integration-error.js";
68
+ export { LegacyIncompatibleError } from "./legacy-incompatible-error.js";
69
+ export { NotFoundError } from "./not-found-error.js";
70
70
  export type {
71
71
  SerializationBoundary,
72
72
  SerializationDirection,
73
73
  SerializationErrorMetadata,
74
74
  SerializationFailureCategory,
75
- } from "./serialization-error";
75
+ } from "./serialization-error.js";
76
76
  export {
77
77
  SerializationInError as DeserializationError,
78
78
  safePreview,
@@ -81,19 +81,19 @@ export {
81
81
  SerializationInError,
82
82
  SerializationMessages,
83
83
  SerializationOutError,
84
- } from "./serialization-error";
84
+ } from "./serialization-error.js";
85
85
  export type {
86
86
  TemporalErrorMetadata as ExpiredErrorMetadata,
87
87
  TemporalPrecision as ExpiredErrorPrecision,
88
88
  TemporalErrorMetadata,
89
89
  TemporalKind,
90
90
  TemporalPrecision,
91
- } from "./temporal-error";
91
+ } from "./temporal-error.js";
92
92
  export {
93
93
  evaluateTemporalWindow,
94
94
  ExpiredError,
95
95
  NotYetValidError,
96
96
  TemporalError,
97
- } from "./temporal-error";
98
- export { UnexpectedError } from "./unexpected-error";
99
- export { ValidationError } from "./validation-error";
97
+ } from "./temporal-error.js";
98
+ export { UnexpectedError } from "./unexpected-error.js";
99
+ export { ValidationError } from "./validation-error.js";
@@ -1,6 +1,6 @@
1
- import type { AppErrorOptions, ErrorSeverity } from "./types";
2
- import { AppError } from "./app-error";
3
- import { ErrorCodes } from "./error-codes";
1
+ import type { AppErrorOptions, ErrorSeverity } from "./types.js";
2
+ import { AppError } from "./app-error.js";
3
+ import { ErrorCodes } from "./error-codes.js";
4
4
 
5
5
  type IntegrationErrorReason =
6
6
  | "timeout"
@@ -1,6 +1,6 @@
1
- import { AppError } from "./app-error";
2
- import { ErrorCodes } from "./error-codes";
3
- import type { AppErrorOptions } from "./types";
1
+ import { AppError } from "./app-error.js";
2
+ import { ErrorCodes } from "./error-codes.js";
3
+ import type { AppErrorOptions } from "./types.js";
4
4
 
5
5
  // ─────────────────────────────────────────────────────────────────────────────
6
6
  // LegacyIncompatibleError
@@ -1,6 +1,6 @@
1
- import { AppError } from "./app-error";
2
- import { ErrorCodes } from "./error-codes";
3
- import type { AppErrorOptions } from "./types";
1
+ import { AppError } from "./app-error.js";
2
+ import { ErrorCodes } from "./error-codes.js";
3
+ import type { AppErrorOptions } from "./types.js";
4
4
 
5
5
  // ─────────────────────────────────────────────────────────────────────────────
6
6
  // NotFoundError