@cullet/erp-core 1.0.11 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/KIT_CONTEXT.md +1 -0
  2. package/README.md +128 -1
  3. package/dist/app-error.d.ts +108 -0
  4. package/dist/application/index.d.ts +2 -0
  5. package/dist/application/index.js +3 -0
  6. package/dist/domain/index.d.ts +3 -0
  7. package/dist/domain/index.js +3 -0
  8. package/dist/domain-event-contracts.d.ts +27 -0
  9. package/dist/domain-event-contracts.js +22 -0
  10. package/dist/domain-event-contracts.js.map +1 -0
  11. package/dist/domain-exception.d.ts +7 -0
  12. package/dist/domain-exception.js +12 -0
  13. package/dist/domain-exception.js.map +1 -0
  14. package/dist/errors/index.d.ts +2 -1
  15. package/dist/errors/index.js +4 -2
  16. package/dist/exceptions/index.d.ts +5 -0
  17. package/dist/exceptions/index.js +7 -0
  18. package/dist/gate-engine-registry.d.ts +81 -0
  19. package/dist/gate-engine-registry.js +2 -1
  20. package/dist/gate-engine-registry.js.map +1 -1
  21. package/dist/gate-types.d.ts +3 -139
  22. package/dist/gate-v1-payload.schema.js +3 -143
  23. package/dist/gate-v1-payload.schema.js.map +1 -1
  24. package/dist/hashing.js +49 -0
  25. package/dist/hashing.js.map +1 -0
  26. package/dist/immutable.d.ts +6 -0
  27. package/dist/immutable.js +54 -0
  28. package/dist/immutable.js.map +1 -0
  29. package/dist/index.d.ts +21 -200
  30. package/dist/index.js +21 -251
  31. package/dist/index.js.map +1 -1
  32. package/dist/invalid-state-transition-exception.js +30 -0
  33. package/dist/invalid-state-transition-exception.js.map +1 -0
  34. package/dist/invariant-violation-exception.js +11 -0
  35. package/dist/invariant-violation-exception.js.map +1 -0
  36. package/dist/not-found-error.js +54 -0
  37. package/dist/not-found-error.js.map +1 -0
  38. package/dist/outcome.d.ts +140 -0
  39. package/dist/outcome.js +1 -1
  40. package/dist/parse-gate-payload.d.ts +4 -78
  41. package/dist/path.d.ts +90 -0
  42. package/dist/plugin.d.ts +85 -0
  43. package/dist/plugin.js +74 -0
  44. package/dist/plugin.js.map +1 -0
  45. package/dist/plugins/index.d.ts +2 -0
  46. package/dist/plugins/index.js +2 -0
  47. package/dist/policies/engines/index.d.ts +3 -2
  48. package/dist/policies/engines/v1/gate/index.d.ts +2 -1
  49. package/dist/policies/engines/v1/gate/index.js +2 -1
  50. package/dist/policies/engines/v1/gate/index.js.map +1 -1
  51. package/dist/policies/index.d.ts +6 -3
  52. package/dist/policies/index.js +2 -1
  53. package/dist/policy-service.d.ts +4 -86
  54. package/dist/policy-service.js +8 -16
  55. package/dist/policy-service.js.map +1 -1
  56. package/dist/result/index.d.ts +2 -0
  57. package/dist/result/index.js +3 -0
  58. package/dist/result.js +118 -0
  59. package/dist/result.js.map +1 -0
  60. package/dist/ruleset-registry.js +42 -0
  61. package/dist/ruleset-registry.js.map +1 -0
  62. package/dist/rulesets/index.d.ts +2 -0
  63. package/dist/rulesets/index.js +2 -0
  64. package/dist/temporal-guards.js +15 -0
  65. package/dist/temporal-guards.js.map +1 -0
  66. package/dist/temporal-use-case.d.ts +304 -0
  67. package/dist/temporal-use-case.js +150 -0
  68. package/dist/temporal-use-case.js.map +1 -0
  69. package/dist/unexpected-error.js +179 -0
  70. package/dist/unexpected-error.js.map +1 -0
  71. package/dist/use-case.js +91 -0
  72. package/dist/use-case.js.map +1 -0
  73. package/dist/uuid-identifier.d.ts +230 -0
  74. package/dist/uuid-identifier.js +60 -0
  75. package/dist/uuid-identifier.js.map +1 -0
  76. package/dist/validation-code.d.ts +23 -0
  77. package/dist/validation-code.js +1 -223
  78. package/dist/validation-code.js.map +1 -1
  79. package/dist/validation-error.d.ts +3 -128
  80. package/dist/validation-error.js +2 -52
  81. package/dist/validation-error.js.map +1 -1
  82. package/dist/validation-exception.d.ts +50 -0
  83. package/dist/validation-exception.js +24 -0
  84. package/dist/validation-exception.js.map +1 -0
  85. package/dist/value-object-ruleset.contracts.d.ts +36 -0
  86. package/dist/value-object.js +191 -0
  87. package/dist/value-object.js.map +1 -0
  88. package/dist/version.d.ts +10 -0
  89. package/dist/versioning/index.d.ts +3 -0
  90. package/dist/versioning/index.js +3 -0
  91. package/meta.json +18 -3
  92. package/package.json +37 -4
  93. package/src/application/index.ts +1 -0
  94. package/src/core/application/commands/index.ts +1 -0
  95. package/src/core/application/index.ts +12 -3
  96. package/src/core/application/ports/index.ts +2 -2
  97. package/src/core/application/ports/policy-port.ts +13 -3
  98. package/src/core/application/ports/repository.port.ts +37 -1
  99. package/src/core/application/temporal/temporal-use-case.ts +14 -2
  100. package/src/core/application/use-case.ts +133 -2
  101. package/src/core/domain/rulesets/index.ts +7 -0
  102. package/src/core/domain/uuid-identifier.ts +72 -0
  103. package/src/core/domain/value-object.ts +37 -5
  104. package/src/core/exceptions/index.ts +13 -0
  105. package/src/core/index.ts +15 -12
  106. package/src/core/plugins/index.ts +7 -0
  107. package/src/core/plugins/plugin.ts +99 -0
  108. package/src/core/plugins/types.ts +53 -0
  109. package/src/core/versioning/index.ts +14 -0
  110. package/src/domain/index.ts +7 -0
  111. package/src/examples/application/cancel-order.example.ts +124 -0
  112. package/src/examples/application/in-memory-account-repository.example.ts +73 -0
  113. package/src/exceptions/index.ts +1 -0
  114. package/src/plugins/index.ts +1 -0
  115. package/src/result/index.ts +2 -0
  116. package/src/rulesets/index.ts +1 -0
  117. package/src/version.ts +1 -1
  118. package/src/versioning/index.ts +1 -0
package/dist/result.js ADDED
@@ -0,0 +1,118 @@
1
+ //#region src/core/result/result.ts
2
+ /**
3
+ * Represents the outcome of an operation that may succeed or fail.
4
+ * Useful for avoiding excessive exceptions and making error flows explicit.
5
+ */
6
+ var Result = class Result {
7
+ constructor() {}
8
+ /**
9
+ * Creates a success result containing a value.
10
+ */
11
+ static ok(value) {
12
+ return new Ok(value);
13
+ }
14
+ /**
15
+ * Creates an error result containing an error object.
16
+ */
17
+ static err(error) {
18
+ return new Err(error);
19
+ }
20
+ /**
21
+ * Returns the value when this is success, or null when this is an error.
22
+ */
23
+ getOrNull() {
24
+ return this.match({
25
+ ok: (value) => value,
26
+ err: () => null
27
+ });
28
+ }
29
+ /**
30
+ * Returns the error when this is a failure, or null when this is a success.
31
+ */
32
+ errorOrNull() {
33
+ return this.match({
34
+ ok: () => null,
35
+ err: (error) => error
36
+ });
37
+ }
38
+ /**
39
+ * Returns the value when this is a success, or throws the error when this is a failure.
40
+ */
41
+ getOrThrow() {
42
+ return this.match({
43
+ ok: (value) => value,
44
+ err: (error) => {
45
+ throw error instanceof Error ? error : new Error(String(error));
46
+ }
47
+ });
48
+ }
49
+ /**
50
+ * Transforms the success value using the provided function. Keeps the error when this is a failure.
51
+ */
52
+ map(transform) {
53
+ return this.match({
54
+ ok: (value) => Result.ok(transform(value)),
55
+ err: (error) => Result.err(error)
56
+ });
57
+ }
58
+ /**
59
+ * Transforms the error using the provided function. Keeps the value when this is a success.
60
+ */
61
+ mapError(transform) {
62
+ return this.match({
63
+ ok: (value) => Result.ok(value),
64
+ err: (error) => Result.err(transform(error))
65
+ });
66
+ }
67
+ /**
68
+ * Chains another operation that returns a Result when this result is a success.
69
+ */
70
+ flatMap(transform) {
71
+ return this.match({
72
+ ok: (value) => transform(value),
73
+ err: (error) => Result.err(error)
74
+ });
75
+ }
76
+ };
77
+ /**
78
+ * Success variant of Result.
79
+ */
80
+ var Ok = class extends Result {
81
+ constructor(value) {
82
+ super();
83
+ this.value = value;
84
+ Object.freeze(this);
85
+ }
86
+ isOk() {
87
+ return true;
88
+ }
89
+ isErr() {
90
+ return false;
91
+ }
92
+ match(handlers) {
93
+ return handlers.ok(this.value);
94
+ }
95
+ };
96
+ /**
97
+ * Error variant of Result.
98
+ */
99
+ var Err = class extends Result {
100
+ constructor(error) {
101
+ super();
102
+ this.error = error;
103
+ Object.freeze(this);
104
+ }
105
+ isOk() {
106
+ return false;
107
+ }
108
+ isErr() {
109
+ return true;
110
+ }
111
+ match(handlers) {
112
+ return handlers.err(this.error);
113
+ }
114
+ };
115
+ //#endregion
116
+ export { Ok as n, Result as r, Err as t };
117
+
118
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","names":[],"sources":["../src/core/result/result.ts"],"sourcesContent":["/**\n * Represents the outcome of an operation that may succeed or fail.\n * Useful for avoiding excessive exceptions and making error flows explicit.\n */\nexport abstract class Result<T, E> {\n protected constructor() {\n // prevent direct instantiation\n }\n\n /**\n * Creates a success result containing a value.\n */\n static ok<T>(value: T): Result<T, never> {\n return new Ok(value);\n }\n\n /**\n * Creates an error result containing an error object.\n */\n static err<E>(error: E): Result<never, E> {\n return new Err(error);\n }\n\n /**\n * Returns true when this is a success result.\n */\n abstract isOk(): this is Ok<T>;\n\n /**\n * Returns true when this is an error result.\n */\n abstract isErr(): this is Err<E>;\n\n /**\n * Runs a handler based on the result state (similar to pattern matching).\n */\n abstract match<R>(handlers: {\n ok: (value: T) => R;\n err: (error: E) => R;\n }): R;\n\n /**\n * Returns the value when this is success, or null when this is an error.\n */\n getOrNull(): T | null {\n return this.match({\n ok: (value) => value,\n err: () => null,\n });\n }\n\n /**\n * Returns the error when this is a failure, or null when this is a success.\n */\n errorOrNull(): E | null {\n return this.match({\n ok: () => null,\n err: (error) => error,\n });\n }\n\n /**\n * Returns the value when this is a success, or throws the error when this is a failure.\n */\n getOrThrow(): T {\n return this.match({\n ok: (value) => value,\n err: (error) => {\n throw error instanceof Error ? error : new Error(String(error));\n },\n });\n }\n\n /**\n * Transforms the success value using the provided function. Keeps the error when this is a failure.\n */\n map<R>(transform: (value: T) => R): Result<R, E> {\n return this.match<Result<R, E>>({\n ok: (value) => Result.ok(transform(value)),\n // TS does not \"see\" variance here; the cast is intentional and safe:\n // Err carries no T, so it can be widened to Result<R, E> safely.\n err: (error) => Result.err(error) as unknown as Result<R, E>,\n });\n }\n\n /**\n * Transforms the error using the provided function. Keeps the value when this is a success.\n */\n mapError<F>(transform: (error: E) => F): Result<T, F> {\n return this.match<Result<T, F>>({\n // Ok carries no E, so it can be widened to Result<T, F>.\n ok: (value) => Result.ok(value) as unknown as Result<T, F>,\n err: (error) => Result.err(transform(error)),\n });\n }\n\n /**\n * Chains another operation that returns a Result when this result is a success.\n */\n flatMap<R>(transform: (value: T) => Result<R, E>): Result<R, E> {\n return this.match<Result<R, E>>({\n ok: (value) => transform(value),\n err: (error) => Result.err(error) as unknown as Result<R, E>,\n });\n }\n}\n\n/**\n * Success variant of Result.\n */\nexport class Ok<T> extends Result<T, never> {\n public readonly value: T;\n\n constructor(value: T) {\n super();\n this.value = value;\n Object.freeze(this);\n }\n\n isOk(): this is Ok<T> {\n return true;\n }\n\n isErr(): this is Err<never> {\n return false;\n }\n\n match<R>(handlers: { ok: (value: T) => R; err: (error: never) => R }): R {\n return handlers.ok(this.value);\n }\n}\n\n/**\n * Error variant of Result.\n */\nexport class Err<E> extends Result<never, E> {\n public readonly error: E;\n\n constructor(error: E) {\n super();\n this.error = error;\n Object.freeze(this);\n }\n\n isOk(): this is Ok<never> {\n return false;\n }\n\n isErr(): this is Err<E> {\n return true;\n }\n\n match<R>(handlers: { ok: (value: never) => R; err: (error: E) => R }): R {\n return handlers.err(this.error);\n }\n}\n"],"mappings":";;;;;AAIA,IAAsB,SAAtB,MAAsB,OAAa;CAC/B,cAAwB,CAExB;;;;CAKA,OAAO,GAAM,OAA4B;EACrC,OAAO,IAAI,GAAG,KAAK;CACvB;;;;CAKA,OAAO,IAAO,OAA4B;EACtC,OAAO,IAAI,IAAI,KAAK;CACxB;;;;CAuBA,YAAsB;EAClB,OAAO,KAAK,MAAM;GACd,KAAK,UAAU;GACf,WAAW;EACf,CAAC;CACL;;;;CAKA,cAAwB;EACpB,OAAO,KAAK,MAAM;GACd,UAAU;GACV,MAAM,UAAU;EACpB,CAAC;CACL;;;;CAKA,aAAgB;EACZ,OAAO,KAAK,MAAM;GACd,KAAK,UAAU;GACf,MAAM,UAAU;IACZ,MAAM,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;GAClE;EACJ,CAAC;CACL;;;;CAKA,IAAO,WAA0C;EAC7C,OAAO,KAAK,MAAoB;GAC5B,KAAK,UAAU,OAAO,GAAG,UAAU,KAAK,CAAC;GAGzC,MAAM,UAAU,OAAO,IAAI,KAAK;EACpC,CAAC;CACL;;;;CAKA,SAAY,WAA0C;EAClD,OAAO,KAAK,MAAoB;GAE5B,KAAK,UAAU,OAAO,GAAG,KAAK;GAC9B,MAAM,UAAU,OAAO,IAAI,UAAU,KAAK,CAAC;EAC/C,CAAC;CACL;;;;CAKA,QAAW,WAAqD;EAC5D,OAAO,KAAK,MAAoB;GAC5B,KAAK,UAAU,UAAU,KAAK;GAC9B,MAAM,UAAU,OAAO,IAAI,KAAK;EACpC,CAAC;CACL;AACJ;;;;AAKA,IAAa,KAAb,cAA2B,OAAiB;CAGxC,YAAY,OAAU;EAClB,MAAM;EACN,KAAK,QAAQ;EACb,OAAO,OAAO,IAAI;CACtB;CAEA,OAAsB;EAClB,OAAO;CACX;CAEA,QAA4B;EACxB,OAAO;CACX;CAEA,MAAS,UAAgE;EACrE,OAAO,SAAS,GAAG,KAAK,KAAK;CACjC;AACJ;;;;AAKA,IAAa,MAAb,cAA4B,OAAiB;CAGzC,YAAY,OAAU;EAClB,MAAM;EACN,KAAK,QAAQ;EACb,OAAO,OAAO,IAAI;CACtB;CAEA,OAA0B;EACtB,OAAO;CACX;CAEA,QAAwB;EACpB,OAAO;CACX;CAEA,MAAS,UAAgE;EACrE,OAAO,SAAS,IAAI,KAAK,KAAK;CAClC;AACJ"}
@@ -0,0 +1,42 @@
1
+ import { t as DomainException } from "./domain-exception.js";
2
+ //#region src/core/domain/rulesets/ruleset-registry.ts
3
+ var RulesetRegistryError = class extends DomainException {};
4
+ function parseVersion(id) {
5
+ const atIdx = id.lastIndexOf("@");
6
+ const [major, minor] = id.slice(atIdx + 1).split(".").map(Number);
7
+ return [major, minor];
8
+ }
9
+ var RulesetRegistry = class {
10
+ constructor() {
11
+ this._store = /* @__PURE__ */ new Map();
12
+ this._sealed = false;
13
+ }
14
+ register(ruleset) {
15
+ if (this._sealed) throw new RulesetRegistryError("Registry is sealed. No new rulesets can be registered.");
16
+ if (this._store.has(ruleset.id)) throw new RulesetRegistryError(`Ruleset with id "${ruleset.id}" is already registered.`);
17
+ this._store.set(ruleset.id, ruleset);
18
+ }
19
+ seal() {
20
+ this._sealed = true;
21
+ }
22
+ get(id) {
23
+ const ruleset = this._store.get(id);
24
+ if (!ruleset) throw new RulesetRegistryError(`Ruleset "${id}" not found. Available: [${Array.from(this._store.keys()).join(", ")}]`);
25
+ return ruleset;
26
+ }
27
+ getCurrent(prefix) {
28
+ const matchingEntries = Array.from(this._store.entries()).filter(([key]) => key.startsWith(prefix + "@"));
29
+ if (matchingEntries.length === 0) throw new RulesetRegistryError(`No rulesets found with prefix "${prefix}".`);
30
+ const sorted = matchingEntries.sort(([a], [b]) => {
31
+ const [aMajor, aMinor] = parseVersion(a);
32
+ const [bMajor, bMinor] = parseVersion(b);
33
+ if (aMajor !== bMajor) return aMajor - bMajor;
34
+ return aMinor - bMinor;
35
+ });
36
+ return sorted[sorted.length - 1][1];
37
+ }
38
+ };
39
+ //#endregion
40
+ export { RulesetRegistry as t };
41
+
42
+ //# sourceMappingURL=ruleset-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ruleset-registry.js","names":[],"sources":["../src/core/domain/rulesets/ruleset-registry.ts"],"sourcesContent":["import { DomainException } from \"../../exceptions/domain-exception.js\";\nimport {\n type Ruleset,\n type RulesetRegistry as RulesetRegistryContract,\n} from \"./ruleset.contracts.js\";\n\nclass RulesetRegistryError extends DomainException {}\n\nfunction parseVersion(id: string): [number, number] {\n const atIdx = id.lastIndexOf(\"@\");\n const versionStr = id.slice(atIdx + 1);\n const [major, minor] = versionStr.split(\".\").map(Number);\n return [major, minor];\n}\n\nclass RulesetRegistry implements RulesetRegistryContract {\n private readonly _store = new Map<string, Ruleset>();\n private _sealed = false;\n\n register(ruleset: Ruleset): void {\n if (this._sealed) {\n throw new RulesetRegistryError(\n \"Registry is sealed. No new rulesets can be registered.\",\n );\n }\n if (this._store.has(ruleset.id)) {\n throw new RulesetRegistryError(\n `Ruleset with id \"${ruleset.id}\" is already registered.`,\n );\n }\n this._store.set(ruleset.id, ruleset);\n }\n\n seal(): void {\n this._sealed = true;\n }\n\n get<T extends Ruleset>(id: string): T {\n const ruleset = this._store.get(id);\n if (!ruleset) {\n const available = Array.from(this._store.keys()).join(\", \");\n throw new RulesetRegistryError(\n `Ruleset \"${id}\" not found. Available: [${available}]`,\n );\n }\n return ruleset as T;\n }\n\n getCurrent<T extends Ruleset>(prefix: string): T {\n const matchingEntries = Array.from(this._store.entries()).filter(\n ([key]) => key.startsWith(prefix + \"@\"),\n );\n\n if (matchingEntries.length === 0) {\n throw new RulesetRegistryError(\n `No rulesets found with prefix \"${prefix}\".`,\n );\n }\n\n const sorted = matchingEntries.sort(([a], [b]) => {\n const [aMajor, aMinor] = parseVersion(a);\n const [bMajor, bMinor] = parseVersion(b);\n if (aMajor !== bMajor) return aMajor - bMajor;\n return aMinor - bMinor;\n });\n\n return sorted[sorted.length - 1][1] as T;\n }\n}\n\nexport { RulesetRegistry };\n"],"mappings":";;AAMA,IAAM,uBAAN,cAAmC,gBAAgB,CAAC;AAEpD,SAAS,aAAa,IAA8B;CAChD,MAAM,QAAQ,GAAG,YAAY,GAAG;CAEhC,MAAM,CAAC,OAAO,SADK,GAAG,MAAM,QAAQ,CACJ,EAAE,MAAM,GAAG,EAAE,IAAI,MAAM;CACvD,OAAO,CAAC,OAAO,KAAK;AACxB;AAEA,IAAM,kBAAN,MAAyD;;gCAC3B,IAAI,IAAqB;iBACjC;;CAElB,SAAS,SAAwB;EAC7B,IAAI,KAAK,SACL,MAAM,IAAI,qBACN,wDACJ;EAEJ,IAAI,KAAK,OAAO,IAAI,QAAQ,EAAE,GAC1B,MAAM,IAAI,qBACN,oBAAoB,QAAQ,GAAG,yBACnC;EAEJ,KAAK,OAAO,IAAI,QAAQ,IAAI,OAAO;CACvC;CAEA,OAAa;EACT,KAAK,UAAU;CACnB;CAEA,IAAuB,IAAe;EAClC,MAAM,UAAU,KAAK,OAAO,IAAI,EAAE;EAClC,IAAI,CAAC,SAED,MAAM,IAAI,qBACN,YAAY,GAAG,2BAFD,MAAM,KAAK,KAAK,OAAO,KAAK,CAAC,EAAE,KAAK,IAEA,EAAE,EACxD;EAEJ,OAAO;CACX;CAEA,WAA8B,QAAmB;EAC7C,MAAM,kBAAkB,MAAM,KAAK,KAAK,OAAO,QAAQ,CAAC,EAAE,QACrD,CAAC,SAAS,IAAI,WAAW,SAAS,GAAG,CAC1C;EAEA,IAAI,gBAAgB,WAAW,GAC3B,MAAM,IAAI,qBACN,kCAAkC,OAAO,GAC7C;EAGJ,MAAM,SAAS,gBAAgB,MAAM,CAAC,IAAI,CAAC,OAAO;GAC9C,MAAM,CAAC,QAAQ,UAAU,aAAa,CAAC;GACvC,MAAM,CAAC,QAAQ,UAAU,aAAa,CAAC;GACvC,IAAI,WAAW,QAAQ,OAAO,SAAS;GACvC,OAAO,SAAS;EACpB,CAAC;EAED,OAAO,OAAO,OAAO,SAAS,GAAG;CACrC;AACJ"}
@@ -0,0 +1,2 @@
1
+ import { a as Ruleset, i as InvariantRuleset, n as RulesetRegistry, o as RulesetId, r as CreationRuleset, t as ValueObjectRuleset } from "../value-object-ruleset.contracts.js";
2
+ export { CreationRuleset, InvariantRuleset, Ruleset, RulesetId, RulesetRegistry, ValueObjectRuleset };
@@ -0,0 +1,2 @@
1
+ import { t as RulesetRegistry } from "../ruleset-registry.js";
2
+ export { RulesetRegistry };
@@ -0,0 +1,15 @@
1
+ import { t as InvariantViolationException } from "./invariant-violation-exception.js";
2
+ //#region src/core/shared/temporal-guards.ts
3
+ function isValidDate(value) {
4
+ return value instanceof Date && !Number.isNaN(value.getTime());
5
+ }
6
+ function cloneDate(date) {
7
+ return new Date(date.getTime());
8
+ }
9
+ function assertValidDate(fieldName, value) {
10
+ if (!isValidDate(value)) throw new InvariantViolationException(`${fieldName} must be a valid Date instance`);
11
+ }
12
+ //#endregion
13
+ export { cloneDate as n, isValidDate as r, assertValidDate as t };
14
+
15
+ //# sourceMappingURL=temporal-guards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"temporal-guards.js","names":[],"sources":["../src/core/shared/temporal-guards.ts"],"sourcesContent":["import { InvariantViolationException } from \"../exceptions/invariant-violation-exception.js\";\n\nfunction isValidDate(value: unknown): value is Date {\n return value instanceof Date && !Number.isNaN(value.getTime());\n}\n\nfunction cloneDate(date: Date): Date {\n return new Date(date.getTime());\n}\n\nfunction assertValidDate(\n fieldName: string,\n value: unknown,\n): asserts value is Date {\n if (!isValidDate(value)) {\n throw new InvariantViolationException(\n `${fieldName} must be a valid Date instance`,\n );\n }\n}\n\nexport { assertValidDate, cloneDate, isValidDate };\n"],"mappings":";;AAEA,SAAS,YAAY,OAA+B;CAChD,OAAO,iBAAiB,QAAQ,CAAC,OAAO,MAAM,MAAM,QAAQ,CAAC;AACjE;AAEA,SAAS,UAAU,MAAkB;CACjC,OAAO,IAAI,KAAK,KAAK,QAAQ,CAAC;AAClC;AAEA,SAAS,gBACL,WACA,OACqB;CACrB,IAAI,CAAC,YAAY,KAAK,GAClB,MAAM,IAAI,4BACN,GAAG,UAAU,+BACjB;AAER"}
@@ -0,0 +1,304 @@
1
+ import { n as ContractVersion } from "./version.js";
2
+ import { a as Result } from "./outcome.js";
3
+ import { t as AppError } from "./app-error.js";
4
+ import { b as ContextSeed, r as PolicyEvaluationResult, s as PolicyEvaluationError, t as EvaluateInput } from "./policy-service.js";
5
+ import { t as DeepReadonly } from "./immutable.js";
6
+
7
+ //#region src/core/application/ports/logger.port.d.ts
8
+ type LogPayload = Record<string, unknown>;
9
+ interface LoggerPort {
10
+ debug(message: string, payload?: LogPayload): void;
11
+ info(message: string, payload?: LogPayload): void;
12
+ warn(message: string, payload?: LogPayload): void;
13
+ error(message: string, payload?: LogPayload): void;
14
+ }
15
+ //#endregion
16
+ //#region src/core/application/ports/metrics.port.d.ts
17
+ type MetricLabels = Readonly<Record<string, string | number | boolean>>;
18
+ interface MetricsPort {
19
+ counter(name: string, value: number, labels?: MetricLabels): void;
20
+ gauge(name: string, value: number, labels?: MetricLabels): void;
21
+ histogram(name: string, value: number, labels?: MetricLabels): void;
22
+ }
23
+ //#endregion
24
+ //#region src/core/application/ports/tracer.port.d.ts
25
+ type TraceAttributeValue = string | number | boolean;
26
+ interface TraceSpan {
27
+ setAttribute(key: string, value: TraceAttributeValue): void;
28
+ recordException(error: unknown): void;
29
+ end(): void;
30
+ }
31
+ interface TracerPort {
32
+ startSpan(name: string, attributes?: Record<string, TraceAttributeValue>): TraceSpan;
33
+ }
34
+ //#endregion
35
+ //#region src/core/application/use-case.d.ts
36
+ type MaybePromise<T> = T | Promise<T>;
37
+ /**
38
+ * Observability adapters a use case may opt into.
39
+ *
40
+ * All fields are optional: a use case that provides none keeps the plain
41
+ * `input → Result` behavior with zero overhead. When provided, {@link UseCase.run}
42
+ * instruments every execution around `execute()` — opening a span, recording
43
+ * duration, counting outcomes, and logging business/unexpected failures.
44
+ */
45
+ interface UseCaseObservability {
46
+ readonly logger?: LoggerPort;
47
+ readonly metrics?: MetricsPort;
48
+ readonly tracer?: TracerPort;
49
+ }
50
+ declare abstract class UseCase<Input = void, Output extends Result<unknown, unknown> = Result<void, never>> {
51
+ static readonly CONTRACT_VERSION: ContractVersion;
52
+ get contractVersion(): ContractVersion;
53
+ /**
54
+ * Runs the use case.
55
+ *
56
+ * `run()` is the single seam every use case crosses, so it is where
57
+ * cross-cutting instrumentation lives. When {@link observability} exposes
58
+ * any adapter, the call to `execute()` is wrapped with tracing, metrics and
59
+ * failure logging; otherwise it delegates directly with no overhead.
60
+ *
61
+ * Observability is strictly side-effecting: a misbehaving adapter never
62
+ * changes the business result nor masks a thrown error — its own failures
63
+ * are swallowed.
64
+ */
65
+ run(input: Input): Promise<Output>;
66
+ /**
67
+ * Adapters used to instrument {@link run}. Override to opt a use case into
68
+ * tracing/metrics/logging. Returns an empty object by default, which keeps
69
+ * the plain delegating behavior.
70
+ */
71
+ protected observability(): UseCaseObservability;
72
+ /**
73
+ * Stable identity used for span names and metric labels. Defaults to the
74
+ * runtime class name; override when bundling/minification would otherwise
75
+ * erase a meaningful name.
76
+ */
77
+ protected get useCaseName(): string;
78
+ protected abstract execute(input: Input): MaybePromise<Output>;
79
+ private runInstrumented;
80
+ }
81
+ //#endregion
82
+ //#region src/core/application/commands/requested-by.d.ts
83
+ type RequestedByKind = "user" | "system";
84
+ declare class RequestedBy {
85
+ readonly kind: RequestedByKind;
86
+ readonly raw: string;
87
+ private constructor();
88
+ /** Builds from a human user ID (must be a UUID). */
89
+ static fromUser(userId: string): RequestedBy;
90
+ /**
91
+ * Builds from a system identity.
92
+ * Only accepts the format "system:<job>", where <job> matches [a-z][a-z0-9]*(-[a-z0-9]+)*.
93
+ */
94
+ static fromSystem(systemIdentity: string): RequestedBy;
95
+ /**
96
+ * Infers the kind from the raw value.
97
+ * Use when the origin (user vs system) is not known at the call-site.
98
+ */
99
+ static parse(raw: string): RequestedBy;
100
+ get isUser(): boolean;
101
+ get isSystem(): boolean;
102
+ toString(): string;
103
+ }
104
+ //#endregion
105
+ //#region src/core/application/commands/command.d.ts
106
+ interface CommandInput {
107
+ readonly requestedBy: RequestedBy;
108
+ }
109
+ /**
110
+ * Base for use cases that **mutate state** (writes), following CQS.
111
+ *
112
+ * - `Input extends CommandInput` ensures every mutation records who triggered it.
113
+ * - `Output extends Result<unknown, unknown>` ensures business errors are
114
+ * explicit values, never thrown exceptions.
115
+ *
116
+ * The Command/Query distinction is semantic: the type declares the intent
117
+ * before any implementation exists, guiding code review and API contracts.
118
+ */
119
+ declare abstract class Command<Input extends CommandInput, Output extends Result<unknown, unknown> = Result<void, never>> extends UseCase<Input, Output> {}
120
+ //#endregion
121
+ //#region src/core/application/ports/policy-port.d.ts
122
+ type PolicyEvaluationInput = EvaluateInput;
123
+ type PolicyEvaluationOutput = PolicyEvaluationResult;
124
+ /**
125
+ * Failure surfaced by {@link PolicyPort.evaluate}.
126
+ *
127
+ * This is the *post-mapping* boundary: the structured `PolicyEvaluationError`
128
+ * union produced inside the policies module is expected to have already been
129
+ * translated into an {@link AppError} (e.g. via `mapPolicyEvaluationError`)
130
+ * before it reaches a use case. Named distinctly from the policies-layer
131
+ * `PolicyEvaluationError` to avoid a collision on the public surface.
132
+ */
133
+ type PolicyPortError = AppError;
134
+ interface PolicyPort {
135
+ evaluate(input: PolicyEvaluationInput): Promise<Result<PolicyEvaluationOutput, PolicyPortError>>;
136
+ }
137
+ //#endregion
138
+ //#region src/core/application/ports/repository.port.d.ts
139
+ /**
140
+ * Persistence port for an aggregate in the imperative style: absence is
141
+ * modelled as `null`, and failures (missing row on delete, optimistic
142
+ * concurrency conflicts, infrastructure errors) surface as thrown exceptions.
143
+ *
144
+ * Prefer {@link ResultRepository} when you want those persistence outcomes to
145
+ * be explicit, recoverable values rather than exceptions.
146
+ */
147
+ interface Repository<TEntity, TId> {
148
+ findById(id: TId): Promise<TEntity | null>;
149
+ save(entity: TEntity): Promise<void>;
150
+ delete(id: TId): Promise<void>;
151
+ }
152
+ /**
153
+ * `Result`-returning counterpart of {@link Repository}, aligned with the
154
+ * "errors as values" philosophy used by `Command` / `UseCase`.
155
+ *
156
+ * Where {@link Repository} returns `Promise<void>` from `save`/`delete` and
157
+ * relies on thrown exceptions, this variant lets a repository *signal*
158
+ * recoverable persistence outcomes without breaking control flow — for
159
+ * example a `NotFoundError` when updating/deleting a missing aggregate, or a
160
+ * `ConflictError` on an optimistic-concurrency version mismatch. A successful
161
+ * write resolves to `Result.ok(undefined)`.
162
+ *
163
+ * `findById` keeps `null` as the "not present" answer to a lookup (not an
164
+ * error) while still wrapping the call in a `Result` so genuine failures
165
+ * (e.g. a connectivity error) stay in band.
166
+ *
167
+ * `TError` defaults to {@link AppError} to match the rest of the application
168
+ * boundary (see `PolicyPortError`); narrow it per repository when the failure
169
+ * set is known, e.g. `ResultRepository<Order, OrderId, NotFoundError | ConflictError>`.
170
+ */
171
+ interface ResultRepository<TEntity, TId, TError = AppError> {
172
+ findById(id: TId): Promise<Result<TEntity | null, TError>>;
173
+ save(entity: TEntity): Promise<Result<void, TError>>;
174
+ delete(id: TId): Promise<Result<void, TError>>;
175
+ }
176
+ //#endregion
177
+ //#region src/core/domain/temporal/transaction-time.d.ts
178
+ /**
179
+ * Represents transaction time (Transaction Time).
180
+ * Defines when the system learned about or recorded a piece of information.
181
+ * Useful for auditing and reconstructing system state at a specific past moment.
182
+ */
183
+ interface TransactionTime {
184
+ /** When the information was first recorded in the system. */
185
+ readonly recordedAt: Date;
186
+ /** When this information was superseded or invalidated by a newer version. */
187
+ readonly supersededAt?: Date;
188
+ }
189
+ //#endregion
190
+ //#region src/core/domain/temporal/valid-time.d.ts
191
+ /**
192
+ * Represents business time (Valid Time).
193
+ * Defines when a piece of information is considered true or in effect in the real world.
194
+ */
195
+ interface ValidTime {
196
+ /** Start of the validity window (inclusive). */
197
+ readonly from: Date;
198
+ /** End of the validity window (exclusive). When absent, the information is still in effect. */
199
+ readonly to?: Date;
200
+ }
201
+ //#endregion
202
+ //#region src/core/domain/temporal/temporal-snapshot.d.ts
203
+ /**
204
+ * Pairs a domain datum with its time dimensions (Business and Transaction).
205
+ * It is the representation of an entry in the append-only (historical) table.
206
+ */
207
+ interface TemporalSnapshot<T> {
208
+ /** The data or state captured by the snapshot. */
209
+ readonly data: DeepReadonly<T>;
210
+ /** Period during which this datum was valid in the real world. */
211
+ readonly validTime: ValidTime;
212
+ /** Period during which this record was the state known to the system. */
213
+ readonly txTime: TransactionTime;
214
+ }
215
+ //#endregion
216
+ //#region src/core/application/ports/temporal-repository.port.d.ts
217
+ type TemporalHistory<TEntity> = readonly TemporalSnapshot<TEntity>[];
218
+ interface TemporalRepository<TEntity, TId> extends Repository<TEntity, TId> {
219
+ findAsOf(id: TId, asOf: Date): Promise<TEntity | null>;
220
+ findAtTransaction(id: TId, txTime: Date): Promise<TEntity | null>;
221
+ findHistory(id: TId): Promise<TemporalHistory<TEntity>>;
222
+ save(entity: TEntity, validFrom?: Date): Promise<void>;
223
+ }
224
+ //#endregion
225
+ //#region src/core/application/policy-error-mapper.d.ts
226
+ declare function mapPolicyEvaluationError(err: PolicyEvaluationError): AppError;
227
+ //#endregion
228
+ //#region src/core/application/queries/query.d.ts
229
+ /**
230
+ * Paginated result of a list query.
231
+ * Use as `Output` when the query returns a collection with pagination metadata.
232
+ */
233
+ interface Page<T> {
234
+ readonly items: readonly T[];
235
+ readonly total: number;
236
+ readonly page: number;
237
+ readonly pageSize: number;
238
+ }
239
+ /**
240
+ * Cache strategy declared by the query type.
241
+ * Infrastructure reads this value to decide whether and how to cache the result.
242
+ */
243
+ type CacheStrategy = {
244
+ readonly kind: "NO_CACHE";
245
+ } | {
246
+ readonly kind: "TIME_TO_LIVE";
247
+ readonly ttlMs: number;
248
+ } | {
249
+ readonly kind: "STALE_WHILE_REVALIDATE";
250
+ readonly ttlMs: number;
251
+ };
252
+ type QueryOutput = object | string | number | boolean | bigint | symbol | null;
253
+ /**
254
+ * Base for use cases that **only read state**, with no side effects, following CQS.
255
+ *
256
+ * - `Data extends QueryOutput` prevents a query from declaring a `void` or
257
+ * `undefined` success payload, while still allowing primitive projections
258
+ * and `null` when that makes sense for the read. Failures stay explicit in
259
+ * `Result<T, E>`.
260
+ * - Override `cacheStrategy()` to declare how infrastructure should cache the
261
+ * result. By default, no cache is applied.
262
+ *
263
+ * A Query must never mutate persisted data — its execution must be idempotent
264
+ * and safe to call multiple times with the same input.
265
+ */
266
+ declare abstract class Query<Input = void, Data extends QueryOutput = never, Failure = AppError> extends UseCase<Input, Result<Data, Failure>> {
267
+ protected cacheStrategy(): CacheStrategy;
268
+ }
269
+ //#endregion
270
+ //#region src/core/application/temporal/temporal-context.d.ts
271
+ interface TemporalContext {
272
+ readonly asOf: Date;
273
+ readonly requestedAt: Date;
274
+ }
275
+ interface CreateTemporalContextInput {
276
+ readonly asOf?: Date;
277
+ readonly requestedAt?: Date;
278
+ }
279
+ declare function assertTemporalContext(temporalContext: TemporalContext, fieldName?: string): void;
280
+ declare function createTemporalContext(input?: CreateTemporalContextInput): TemporalContext;
281
+ //#endregion
282
+ //#region src/core/application/temporal/temporal-use-case.d.ts
283
+ interface TemporalUseCaseInput {
284
+ readonly temporalContext?: TemporalContext;
285
+ }
286
+ /**
287
+ * A {@link ContextSeed} after temporal enrichment by
288
+ * {@link TemporalUseCase.buildPolicySeed}: structurally identical to `TSeed`,
289
+ * except `fields.now` is now guaranteed present as a `Date` (injected from the
290
+ * resolved {@link TemporalContext}). Downstream policies can therefore read
291
+ * `seed.fields.now` without a presence/type guard.
292
+ */
293
+ type TemporalizedContextSeed<TSeed extends ContextSeed> = Omit<TSeed, "fields"> & {
294
+ readonly fields: TSeed["fields"] & {
295
+ readonly now: Date;
296
+ };
297
+ };
298
+ declare abstract class TemporalUseCase<Input extends object, Output extends Result<unknown, unknown>> extends UseCase<Input & TemporalUseCaseInput, Output> {
299
+ protected resolveTemporalContext(input: Input & TemporalUseCaseInput): TemporalContext;
300
+ protected buildPolicySeed<TSeed extends ContextSeed>(seed: TSeed, temporalContext: TemporalContext): TemporalizedContextSeed<TSeed>;
301
+ }
302
+ //#endregion
303
+ export { MetricLabels as A, RequestedByKind as C, TraceAttributeValue as D, UseCaseObservability as E, LogPayload as M, LoggerPort as N, TraceSpan as O, RequestedBy as S, UseCase as T, PolicyEvaluationOutput as _, TemporalContext as a, Command as b, CacheStrategy as c, mapPolicyEvaluationError as d, TemporalHistory as f, PolicyEvaluationInput as g, ResultRepository as h, CreateTemporalContextInput as i, MetricsPort as j, TracerPort as k, Page as l, Repository as m, TemporalUseCaseInput as n, assertTemporalContext as o, TemporalRepository as p, TemporalizedContextSeed as r, createTemporalContext as s, TemporalUseCase as t, Query as u, PolicyPort as v, MaybePromise as w, CommandInput as x, PolicyPortError as y };
304
+ //# sourceMappingURL=temporal-use-case.d.ts.map
@@ -0,0 +1,150 @@
1
+ import { t as UnexpectedError } from "./unexpected-error.js";
2
+ import { n as BusinessRuleViolationError, t as NotFoundError } from "./not-found-error.js";
3
+ import { t as ValidationCode } from "./validation-code.js";
4
+ import { t as ValidationField } from "./validation-field.js";
5
+ import { t as InvalidValueException } from "./validation-exception.js";
6
+ import { i as version, n as __decorate, t as makeImmutable } from "./immutable.js";
7
+ import { t as UseCase } from "./use-case.js";
8
+ import { t as assertValidDate } from "./temporal-guards.js";
9
+ //#region src/core/application/commands/requested-by.ts
10
+ const REQUESTED_BY_FIELD = ValidationField.of("requestedBy");
11
+ const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
12
+ const SYSTEM_IDENTITY_PATTERN = /^system:[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
13
+ var RequestedBy = class RequestedBy {
14
+ constructor(kind, raw) {
15
+ this.kind = kind;
16
+ this.raw = raw;
17
+ Object.freeze(this);
18
+ }
19
+ /** Builds from a human user ID (must be a UUID). */
20
+ static fromUser(userId) {
21
+ if (!UUID_PATTERN.test(userId)) throw new InvalidValueException(REQUESTED_BY_FIELD, ValidationCode.INVALID_FORMAT, `requestedBy: user identity must be a UUID, got "${userId}"`);
22
+ return new RequestedBy("user", userId);
23
+ }
24
+ /**
25
+ * Builds from a system identity.
26
+ * Only accepts the format "system:<job>", where <job> matches [a-z][a-z0-9]*(-[a-z0-9]+)*.
27
+ */
28
+ static fromSystem(systemIdentity) {
29
+ if (!SYSTEM_IDENTITY_PATTERN.test(systemIdentity)) throw new InvalidValueException(REQUESTED_BY_FIELD, ValidationCode.INVALID_FORMAT, `requestedBy: system identity must match "system:<job>" (e.g. "system:late-fee-job"), got "${systemIdentity}"`);
30
+ return new RequestedBy("system", systemIdentity);
31
+ }
32
+ /**
33
+ * Infers the kind from the raw value.
34
+ * Use when the origin (user vs system) is not known at the call-site.
35
+ */
36
+ static parse(raw) {
37
+ if (UUID_PATTERN.test(raw)) return new RequestedBy("user", raw);
38
+ if (SYSTEM_IDENTITY_PATTERN.test(raw)) return new RequestedBy("system", raw);
39
+ throw new InvalidValueException(REQUESTED_BY_FIELD, ValidationCode.INVALID_FORMAT, `requestedBy must be a UUID (user) or "system:<job>" (system), got "${raw}"`);
40
+ }
41
+ get isUser() {
42
+ return this.kind === "user";
43
+ }
44
+ get isSystem() {
45
+ return this.kind === "system";
46
+ }
47
+ toString() {
48
+ return this.raw;
49
+ }
50
+ };
51
+ //#endregion
52
+ //#region src/core/application/commands/command.ts
53
+ /**
54
+ * Base for use cases that **mutate state** (writes), following CQS.
55
+ *
56
+ * - `Input extends CommandInput` ensures every mutation records who triggered it.
57
+ * - `Output extends Result<unknown, unknown>` ensures business errors are
58
+ * explicit values, never thrown exceptions.
59
+ *
60
+ * The Command/Query distinction is semantic: the type declares the intent
61
+ * before any implementation exists, guiding code review and API contracts.
62
+ */
63
+ let Command = class Command extends UseCase {};
64
+ Command = __decorate([version("1.0")], Command);
65
+ //#endregion
66
+ //#region src/core/application/policy-error-mapper.ts
67
+ function mapPolicyEvaluationError(err) {
68
+ switch (err.kind) {
69
+ case "INVALID_CONTEXT": return new BusinessRuleViolationError(`policy.${err.stage.toLowerCase()}`, err.message, {
70
+ policyKey: err.policyKey,
71
+ stage: err.stage
72
+ }, { cause: err.cause });
73
+ case "INVALID_POLICY_KEY": return new BusinessRuleViolationError("policy.invalid_key", err.message, { rawPolicyKey: err.rawPolicyKey }, { cause: err.cause });
74
+ case "POLICY_NOT_FOUND": return new NotFoundError("Policy", { policyKey: err.policyKey }, { cause: err.cause });
75
+ case "POLICY_DEFINITION_NOT_FOUND": return new NotFoundError("PolicyDefinition", {
76
+ policyKey: err.policyKey,
77
+ contextVersion: err.contextVersion,
78
+ asOf: err.asOf.toISOString()
79
+ }, { cause: err.cause });
80
+ case "POLICY_VARIANT_NOT_FOUND": return new NotFoundError("PolicyVariant", {
81
+ policyKey: err.policyKey,
82
+ policyKind: err.policyKind,
83
+ payloadSchemaVersion: err.payloadSchemaVersion
84
+ }, { cause: err.cause });
85
+ case "ENGINE_FAILURE": return new UnexpectedError(err.message, err.cause, { metadata: {
86
+ policyKey: err.policyKey,
87
+ engine: err.engine,
88
+ engineVersion: err.engineVersion
89
+ } });
90
+ }
91
+ }
92
+ //#endregion
93
+ //#region src/core/application/queries/query.ts
94
+ /**
95
+ * Base for use cases that **only read state**, with no side effects, following CQS.
96
+ *
97
+ * - `Data extends QueryOutput` prevents a query from declaring a `void` or
98
+ * `undefined` success payload, while still allowing primitive projections
99
+ * and `null` when that makes sense for the read. Failures stay explicit in
100
+ * `Result<T, E>`.
101
+ * - Override `cacheStrategy()` to declare how infrastructure should cache the
102
+ * result. By default, no cache is applied.
103
+ *
104
+ * A Query must never mutate persisted data — its execution must be idempotent
105
+ * and safe to call multiple times with the same input.
106
+ */
107
+ let Query = class Query extends UseCase {
108
+ cacheStrategy() {
109
+ return { kind: "NO_CACHE" };
110
+ }
111
+ };
112
+ Query = __decorate([version("1.0")], Query);
113
+ //#endregion
114
+ //#region src/core/application/temporal/temporal-context.ts
115
+ function assertTemporalContext(temporalContext, fieldName = "temporalContext") {
116
+ assertValidDate(`${fieldName}.asOf`, temporalContext.asOf);
117
+ assertValidDate(`${fieldName}.requestedAt`, temporalContext.requestedAt);
118
+ }
119
+ function createTemporalContext(input = {}) {
120
+ const requestedAt = input.requestedAt ?? /* @__PURE__ */ new Date();
121
+ const asOf = input.asOf ?? requestedAt;
122
+ assertTemporalContext({
123
+ asOf,
124
+ requestedAt
125
+ });
126
+ return makeImmutable({
127
+ asOf,
128
+ requestedAt
129
+ });
130
+ }
131
+ //#endregion
132
+ //#region src/core/application/temporal/temporal-use-case.ts
133
+ var TemporalUseCase = class extends UseCase {
134
+ resolveTemporalContext(input) {
135
+ return createTemporalContext(input.temporalContext);
136
+ }
137
+ buildPolicySeed(seed, temporalContext) {
138
+ return Object.freeze({
139
+ ...seed,
140
+ fields: {
141
+ ...seed.fields,
142
+ now: new Date(temporalContext.requestedAt.getTime())
143
+ }
144
+ });
145
+ }
146
+ };
147
+ //#endregion
148
+ export { mapPolicyEvaluationError as a, Query as i, assertTemporalContext as n, Command as o, createTemporalContext as r, RequestedBy as s, TemporalUseCase as t };
149
+
150
+ //# sourceMappingURL=temporal-use-case.js.map