@carbonbox/domain 0.7.34 → 0.8.1

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 (97) hide show
  1. package/build/carbonbox/emission-calculation-process/calculation-jobs/domain/events/CalculationJobCompletedDomainEvent.js +38 -0
  2. package/build/carbonbox/emission-calculation-process/calculation-jobs/domain/events/CalculationJobFailedDomainEvent.js +38 -0
  3. package/build/carbonbox/emission-calculation-process/calculation-jobs/domain/events/CalculationJobStartedDomainEvent.js +38 -0
  4. package/build/carbonbox/emission-calculation-process/calculation-jobs/domain/types/CalculationJobCompletedPayload.js +2 -0
  5. package/build/carbonbox/emission-calculation-process/calculation-jobs/domain/types/CalculationJobFailedPayload.js +2 -0
  6. package/build/carbonbox/emission-calculation-process/calculation-jobs/domain/types/CalculationJobStartedPayload.js +2 -0
  7. package/build/carbonbox/emission-calculation-process/calculation-processes/domain/entity/CalculationProcess.js +11 -2
  8. package/build/carbonbox/emission-calculation-process/calculation-processes/domain/events/CalculationProcessCompletedDomainEvent.js +38 -0
  9. package/build/carbonbox/emission-calculation-process/calculation-processes/domain/events/CalculationProcessFailedDomainEvent.js +38 -0
  10. package/build/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessCompletedPayload.js +2 -0
  11. package/build/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessFailedPayload.js +2 -0
  12. package/build/carbonbox/emission-calculation-process/calculation-processes/domain/value-objects/CalculationProcessParentWorkflow.js +34 -0
  13. package/build/carbonbox/emission-calculation-process/calculation-workflows/domain/events/WorkflowActivatedDomainEvent.js +38 -0
  14. package/build/carbonbox/emission-calculation-process/calculation-workflows/domain/events/WorkflowPausedDomainEvent.js +38 -0
  15. package/build/carbonbox/emission-calculation-process/calculation-workflows/domain/types/WorkflowActivatedPayload.js +2 -0
  16. package/build/carbonbox/emission-calculation-process/calculation-workflows/domain/types/WorkflowPausedPayload.js +2 -0
  17. package/build/carbonbox/shared/domain/events/DomainEvent.js +33 -0
  18. package/build/carbonbox/shared/domain/events/DomainEventEnvelopePrimitives.js +2 -0
  19. package/build/carbonbox/shared/domain/events/DomainEventName.js +113 -0
  20. package/build/carbonbox/shared/domain/events/IDomainEvent.js +2 -0
  21. package/build/carbonbox/shared/domain/exceptions/InvalidDomainEventNameError.js +17 -0
  22. package/build/carbonbox/shared/domain/services/implementations/DateTimeFormattingDomainService.js +14 -0
  23. package/build/carbonbox/shared/domain/types/CalculationWorkflowReference.js +2 -0
  24. package/build/carbonbox/shared/domain/types/CalculationWorkflowReferencePrimitives.js +2 -0
  25. package/build/carbonbox/shared/domain/types/DomainEventEnvelopePrimitives.js +2 -0
  26. package/build/carbonbox/shared/domain/types/DomainEventFromPrimitivesInput.js +2 -0
  27. package/build/carbonbox/shared/domain/value-objects/CalculationWorkflowReference.js +89 -0
  28. package/build/main/index.js +46 -11
  29. package/build/types/carbonbox/emission-calculation-formulas/domain/repository/IEmissionCalculationFormulaRepository.d.ts +11 -0
  30. package/build/types/carbonbox/emission-calculation-formulas/domain/repository/IEmissionCalculationFormulaRepository.d.ts.map +1 -1
  31. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/events/CalculationJobCompletedDomainEvent.d.ts +15 -0
  32. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/events/CalculationJobCompletedDomainEvent.d.ts.map +1 -0
  33. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/events/CalculationJobFailedDomainEvent.d.ts +15 -0
  34. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/events/CalculationJobFailedDomainEvent.d.ts.map +1 -0
  35. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/events/CalculationJobStartedDomainEvent.d.ts +15 -0
  36. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/events/CalculationJobStartedDomainEvent.d.ts.map +1 -0
  37. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/repository/ICalculationJobRepository.d.ts +10 -0
  38. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/repository/ICalculationJobRepository.d.ts.map +1 -1
  39. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/types/CalculationJobCompletedPayload.d.ts +26 -0
  40. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/types/CalculationJobCompletedPayload.d.ts.map +1 -0
  41. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/types/CalculationJobFailedPayload.d.ts +28 -0
  42. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/types/CalculationJobFailedPayload.d.ts.map +1 -0
  43. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/types/CalculationJobStartedPayload.d.ts +17 -0
  44. package/build/types/carbonbox/emission-calculation-process/calculation-jobs/domain/types/CalculationJobStartedPayload.d.ts.map +1 -0
  45. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/entity/CalculationProcess.d.ts +2 -0
  46. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/entity/CalculationProcess.d.ts.map +1 -1
  47. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/entity/ICalculationProcess.d.ts +2 -0
  48. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/entity/ICalculationProcess.d.ts.map +1 -1
  49. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/events/CalculationProcessCompletedDomainEvent.d.ts +15 -0
  50. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/events/CalculationProcessCompletedDomainEvent.d.ts.map +1 -0
  51. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/events/CalculationProcessFailedDomainEvent.d.ts +15 -0
  52. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/events/CalculationProcessFailedDomainEvent.d.ts.map +1 -0
  53. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/repository/ICalculationProcessRepository.d.ts +13 -0
  54. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/repository/ICalculationProcessRepository.d.ts.map +1 -1
  55. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessCompletedPayload.d.ts +21 -0
  56. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessCompletedPayload.d.ts.map +1 -0
  57. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessFailedPayload.d.ts +24 -0
  58. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessFailedPayload.d.ts.map +1 -0
  59. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessPrimitives.d.ts +2 -0
  60. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessPrimitives.d.ts.map +1 -1
  61. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessProps.d.ts +2 -0
  62. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessProps.d.ts.map +1 -1
  63. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/value-objects/CalculationProcessParentWorkflow.d.ts +20 -0
  64. package/build/types/carbonbox/emission-calculation-process/calculation-processes/domain/value-objects/CalculationProcessParentWorkflow.d.ts.map +1 -0
  65. package/build/types/carbonbox/emission-calculation-process/calculation-workflows/domain/events/WorkflowActivatedDomainEvent.d.ts +15 -0
  66. package/build/types/carbonbox/emission-calculation-process/calculation-workflows/domain/events/WorkflowActivatedDomainEvent.d.ts.map +1 -0
  67. package/build/types/carbonbox/emission-calculation-process/calculation-workflows/domain/events/WorkflowPausedDomainEvent.d.ts +15 -0
  68. package/build/types/carbonbox/emission-calculation-process/calculation-workflows/domain/events/WorkflowPausedDomainEvent.d.ts.map +1 -0
  69. package/build/types/carbonbox/emission-calculation-process/calculation-workflows/domain/types/WorkflowActivatedPayload.d.ts +18 -0
  70. package/build/types/carbonbox/emission-calculation-process/calculation-workflows/domain/types/WorkflowActivatedPayload.d.ts.map +1 -0
  71. package/build/types/carbonbox/emission-calculation-process/calculation-workflows/domain/types/WorkflowPausedPayload.d.ts +16 -0
  72. package/build/types/carbonbox/emission-calculation-process/calculation-workflows/domain/types/WorkflowPausedPayload.d.ts.map +1 -0
  73. package/build/types/carbonbox/shared/domain/events/DomainEvent.d.ts +28 -0
  74. package/build/types/carbonbox/shared/domain/events/DomainEvent.d.ts.map +1 -0
  75. package/build/types/carbonbox/shared/domain/events/DomainEventEnvelopePrimitives.d.ts +26 -0
  76. package/build/types/carbonbox/shared/domain/events/DomainEventEnvelopePrimitives.d.ts.map +1 -0
  77. package/build/types/carbonbox/shared/domain/events/DomainEventName.d.ts +40 -0
  78. package/build/types/carbonbox/shared/domain/events/DomainEventName.d.ts.map +1 -0
  79. package/build/types/carbonbox/shared/domain/events/IDomainEvent.d.ts +36 -0
  80. package/build/types/carbonbox/shared/domain/events/IDomainEvent.d.ts.map +1 -0
  81. package/build/types/carbonbox/shared/domain/exceptions/InvalidDomainEventNameError.d.ts +7 -0
  82. package/build/types/carbonbox/shared/domain/exceptions/InvalidDomainEventNameError.d.ts.map +1 -0
  83. package/build/types/carbonbox/shared/domain/services/implementations/DateTimeFormattingDomainService.d.ts +8 -0
  84. package/build/types/carbonbox/shared/domain/services/implementations/DateTimeFormattingDomainService.d.ts.map +1 -1
  85. package/build/types/carbonbox/shared/domain/types/CalculationWorkflowReference.d.ts +13 -0
  86. package/build/types/carbonbox/shared/domain/types/CalculationWorkflowReference.d.ts.map +1 -0
  87. package/build/types/carbonbox/shared/domain/types/CalculationWorkflowReferencePrimitives.d.ts +9 -0
  88. package/build/types/carbonbox/shared/domain/types/CalculationWorkflowReferencePrimitives.d.ts.map +1 -0
  89. package/build/types/carbonbox/shared/domain/types/DomainEventEnvelopePrimitives.d.ts +26 -0
  90. package/build/types/carbonbox/shared/domain/types/DomainEventEnvelopePrimitives.d.ts.map +1 -0
  91. package/build/types/carbonbox/shared/domain/types/DomainEventFromPrimitivesInput.d.ts +15 -0
  92. package/build/types/carbonbox/shared/domain/types/DomainEventFromPrimitivesInput.d.ts.map +1 -0
  93. package/build/types/carbonbox/shared/domain/value-objects/CalculationWorkflowReference.d.ts +32 -0
  94. package/build/types/carbonbox/shared/domain/value-objects/CalculationWorkflowReference.d.ts.map +1 -0
  95. package/build/types/main/index.d.ts +24 -0
  96. package/build/types/main/index.d.ts.map +1 -1
  97. package/package.json +1 -1
@@ -4,6 +4,7 @@ import { CalculationProcessCarbonClient } from '../value-objects/CalculationProc
4
4
  import { CalculationProcessExecutedByStakeholder } from '../value-objects/CalculationProcessExecutedByStakeholder';
5
5
  import { CalculationProcessFootprintConfiguration } from '../value-objects/CalculationProcessFootprintConfiguration';
6
6
  import { CalculationProcessId } from '../value-objects/CalculationProcessId';
7
+ import { CalculationProcessParentWorkflow } from '../value-objects/CalculationProcessParentWorkflow';
7
8
  import { CalculationProcessPriority } from '../value-objects/CalculationProcessPriority';
8
9
  import { CalculationProcessStatus } from '../value-objects/CalculationProcessStatus';
9
10
  export interface ICalculationProcessRepository {
@@ -14,6 +15,18 @@ export interface ICalculationProcessRepository {
14
15
  findAllByPriority(priority: CalculationProcessPriority): Promise<CalculationProcess[]>;
15
16
  findAllByFootprintConfiguration(footprintConfiguration: CalculationProcessFootprintConfiguration): Promise<CalculationProcess[]>;
16
17
  findAllByExecutedByStakeholder(executedByStakeholder: CalculationProcessExecutedByStakeholder): Promise<CalculationProcess[]>;
18
+ findAllByParentWorkflow(parentWorkflow: CalculationProcessParentWorkflow): Promise<CalculationProcess[]>;
19
+ /**
20
+ * Returns the number of processes triggered by the given workflow whose
21
+ * status is currently active (not yet terminal).
22
+ *
23
+ * "Active" is defined by the persistence implementation as the set of
24
+ * statuses that consume a concurrency slot of the workflow. The default
25
+ * contract treats `QUEUED`, `RUNNING` and `PAUSED` as active so the
26
+ * `maxConcurrentProcesses` invariant in the workflow aggregate can be
27
+ * enforced atomically at execution time.
28
+ */
29
+ countRunningByWorkflowId(parentWorkflow: CalculationProcessParentWorkflow): Promise<number>;
17
30
  findAll(): Promise<CalculationProcess[]>;
18
31
  deleteById(id: CalculationProcessId): Promise<void>;
19
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ICalculationProcessRepository.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-processes/domain/repository/ICalculationProcessRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AACjG,OAAO,EAAE,uCAAuC,EAAE,MAAM,0DAA0D,CAAC;AACnH,OAAO,EAAE,wCAAwC,EAAE,MAAM,2DAA2D,CAAC;AACrH,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAErF,MAAM,WAAW,6BAA6B;IAC5C,IAAI,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,QAAQ,CAAC,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC1E,qBAAqB,CAAC,YAAY,EAAE,8BAA8B,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACnG,eAAe,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACjF,iBAAiB,CAAC,QAAQ,EAAE,0BAA0B,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACvF,+BAA+B,CAAC,sBAAsB,EAAE,wCAAwC,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACjI,8BAA8B,CAAC,qBAAqB,EAAE,uCAAuC,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC9H,OAAO,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACzC,UAAU,CAAC,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD"}
1
+ {"version":3,"file":"ICalculationProcessRepository.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-processes/domain/repository/ICalculationProcessRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AACjG,OAAO,EAAE,uCAAuC,EAAE,MAAM,0DAA0D,CAAC;AACnH,OAAO,EAAE,wCAAwC,EAAE,MAAM,2DAA2D,CAAC;AACrH,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,gCAAgC,EAAE,MAAM,mDAAmD,CAAC;AACrG,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAErF,MAAM,WAAW,6BAA6B;IAC5C,IAAI,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,QAAQ,CAAC,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC1E,qBAAqB,CAAC,YAAY,EAAE,8BAA8B,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACnG,eAAe,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACjF,iBAAiB,CAAC,QAAQ,EAAE,0BAA0B,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACvF,+BAA+B,CAAC,sBAAsB,EAAE,wCAAwC,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACjI,8BAA8B,CAAC,qBAAqB,EAAE,uCAAuC,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC9H,uBAAuB,CAAC,cAAc,EAAE,gCAAgC,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACzG;;;;;;;;;OASG;IACH,wBAAwB,CAAC,cAAc,EAAE,gCAAgC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5F,OAAO,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACzC,UAAU,CAAC,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Payload of `CalculationProcessCompletedDomainEvent` — published when
3
+ * a `CalculationProcess` reaches its terminal `COMPLETED` state, i.e.
4
+ * every child job is `COMPLETED` or `SKIPPED` and the Process Coordinator
5
+ * has invoked `CompleteCalculationProcessCommand`. Reactors include:
6
+ * notification senders (email allowedExecutors), workflow
7
+ * `successfulExecutions` counter, search index updaters and the audit
8
+ * pipeline.
9
+ */
10
+ export type CalculationProcessCompletedPayload = Readonly<{
11
+ processId: string;
12
+ parentWorkflowId: string;
13
+ carbonClientId: string;
14
+ footprintConfigurationId: string;
15
+ startedAt: string;
16
+ completedAt: string;
17
+ actualDurationMinutes: number;
18
+ totalEmissionsCalculated: number;
19
+ calculationsGenerated: ReadonlyArray<string>;
20
+ }>;
21
+ //# sourceMappingURL=CalculationProcessCompletedPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalculationProcessCompletedPayload.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessCompletedPayload.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,kCAAkC,GAAG,QAAQ,CAAC;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,wBAAwB,EAAE,MAAM,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,wBAAwB,EAAE,MAAM,CAAC;IACjC,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Payload of `CalculationProcessFailedDomainEvent` — published when a
3
+ * `CalculationProcess` reaches the terminal `FAILED` state, i.e. the
4
+ * Process Coordinator detected at least one job failed irrecoverably
5
+ * and invoked `FailCalculationProcessCommand`. Reactors include:
6
+ * notification senders (failure email + Slack), workflow
7
+ * `failedExecutions` counter, retry orchestrator (if the workflow
8
+ * declares `processLevelRetry`), search index updaters and the audit
9
+ * pipeline.
10
+ */
11
+ export type CalculationProcessFailedPayload = Readonly<{
12
+ processId: string;
13
+ parentWorkflowId: string;
14
+ carbonClientId: string;
15
+ footprintConfigurationId: string;
16
+ startedAt: string | null;
17
+ failedAt: string;
18
+ actualDurationMinutes: number | null;
19
+ errorMessage: string;
20
+ failedJobId: string;
21
+ retryCount: number;
22
+ maxRetries: number;
23
+ }>;
24
+ //# sourceMappingURL=CalculationProcessFailedPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalculationProcessFailedPayload.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessFailedPayload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,+BAA+B,GAAG,QAAQ,CAAC;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,wBAAwB,EAAE,MAAM,CAAC;IACjC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC"}
@@ -2,9 +2,11 @@ import { StakeholderReferencePrimitives } from '../../../../shared/domain/types/
2
2
  import { CarbonClientReferencePrimitives } from '../../../../shared/domain/types/CarbonClientReferencePrimitives';
3
3
  import { AggregateRootPrimitives } from '../../../../shared/domain/types/AggregateRootPrimitives';
4
4
  import { CarbonFootprintConfigurationReferencePrimitives } from '../../../../shared/domain/types/CarbonFootprintConfigurationReferencePrimitives';
5
+ import { CalculationWorkflowReferencePrimitives } from '../../../../shared/domain/types/CalculationWorkflowReferencePrimitives';
5
6
  import { ProcessStatus } from '../enums/ProcessStatus';
6
7
  import { ProcessPriority } from '../enums/ProcessPriority';
7
8
  export type CalculationProcessPrimitives = AggregateRootPrimitives & {
9
+ parentWorkflow: CalculationWorkflowReferencePrimitives;
8
10
  carbonClient: CarbonClientReferencePrimitives;
9
11
  footprintConfiguration: CarbonFootprintConfigurationReferencePrimitives;
10
12
  scheduledAt: string;
@@ -1 +1 @@
1
- {"version":3,"file":"CalculationProcessPrimitives.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessPrimitives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,gEAAgE,CAAC;AAChH,OAAO,EAAE,+BAA+B,EAAE,MAAM,iEAAiE,CAAC;AAClH,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,+CAA+C,EAAE,MAAM,iFAAiF,CAAC;AAClJ,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,MAAM,4BAA4B,GAAG,uBAAuB,GAAG;IACnE,YAAY,EAAE,+BAA+B,CAAC;IAC9C,sBAAsB,EAAE,+CAA+C,CAAC;IAGxE,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;IAGvB,qBAAqB,EAAE,8BAA8B,CAAC;IACtD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAG3B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGxC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
1
+ {"version":3,"file":"CalculationProcessPrimitives.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessPrimitives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,gEAAgE,CAAC;AAChH,OAAO,EAAE,+BAA+B,EAAE,MAAM,iEAAiE,CAAC;AAClH,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,+CAA+C,EAAE,MAAM,iFAAiF,CAAC;AAClJ,OAAO,EAAE,sCAAsC,EAAE,MAAM,wEAAwE,CAAC;AAChI,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,MAAM,4BAA4B,GAAG,uBAAuB,GAAG;IACnE,cAAc,EAAE,sCAAsC,CAAC;IACvD,YAAY,EAAE,+BAA+B,CAAC;IAC9C,sBAAsB,EAAE,+CAA+C,CAAC;IAGxE,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;IAGvB,qBAAqB,EAAE,8BAA8B,CAAC;IACtD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAG3B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGxC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
@@ -4,7 +4,9 @@ import { ProcessStatus } from '../enums/ProcessStatus';
4
4
  import { ProcessPriority } from '../enums/ProcessPriority';
5
5
  import { AggregateRootProps } from '../../../../shared/domain/types/AggregateRootProps';
6
6
  import { CarbonFootprintConfigurationReference } from '../../../../shared/domain/types/CarbonFootprintConfigurationReference';
7
+ import { CalculationWorkflowReference } from '../../../../shared/domain/types/CalculationWorkflowReference';
7
8
  export type CalculationProcessProps = AggregateRootProps & {
9
+ parentWorkflow: CalculationWorkflowReference;
8
10
  carbonClient: CarbonClientReference;
9
11
  footprintConfiguration: CarbonFootprintConfigurationReference;
10
12
  scheduledAt: string;
@@ -1 +1 @@
1
- {"version":3,"file":"CalculationProcessProps.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,uDAAuD,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,qCAAqC,EAAE,MAAM,uEAAuE,CAAC;AAE9H,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,GAAG;IACzD,YAAY,EAAE,qBAAqB,CAAC;IACpC,sBAAsB,EAAE,qCAAqC,CAAC;IAG9D,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;IAGvB,qBAAqB,EAAE,oBAAoB,CAAC;IAC5C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAG3B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGxC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
1
+ {"version":3,"file":"CalculationProcessProps.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-processes/domain/types/CalculationProcessProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,uDAAuD,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,qCAAqC,EAAE,MAAM,uEAAuE,CAAC;AAC9H,OAAO,EAAE,4BAA4B,EAAE,MAAM,8DAA8D,CAAC;AAE5G,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,GAAG;IACzD,cAAc,EAAE,4BAA4B,CAAC;IAC7C,YAAY,EAAE,qBAAqB,CAAC;IACpC,sBAAsB,EAAE,qCAAqC,CAAC;IAG9D,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;IAGvB,qBAAqB,EAAE,oBAAoB,CAAC;IAC5C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAG3B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGxC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { CalculationWorkflowReference } from '../../../../shared/domain/types/CalculationWorkflowReference';
2
+ import { CalculationWorkflowReferencePrimitives } from '../../../../shared/domain/types/CalculationWorkflowReferencePrimitives';
3
+ import { CalculationWorkflowReference as CalculationWorkflowReferenceVO } from '../../../../shared/domain/value-objects/CalculationWorkflowReference';
4
+ /**
5
+ * Reference from a CalculationProcess to the CalculationWorkflow that
6
+ * triggered it.
7
+ *
8
+ * Modelling this relation explicitly is what makes invariants like
9
+ * `maxConcurrentProcesses per workflow` enforceable: the process
10
+ * repository can now answer `countRunningByWorkflowId(...)` without
11
+ * leaking workflow internals across the aggregate boundary.
12
+ */
13
+ export declare class CalculationProcessParentWorkflow extends CalculationWorkflowReferenceVO {
14
+ private static readonly PROPERTY_NAME;
15
+ private constructor();
16
+ static create(value: CalculationWorkflowReference): CalculationProcessParentWorkflow;
17
+ static fromPrimitives(primitives: CalculationWorkflowReferencePrimitives): CalculationProcessParentWorkflow;
18
+ toPrimitives(): CalculationWorkflowReferencePrimitives;
19
+ }
20
+ //# sourceMappingURL=CalculationProcessParentWorkflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalculationProcessParentWorkflow.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-processes/domain/value-objects/CalculationProcessParentWorkflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,8DAA8D,CAAC;AAC5G,OAAO,EAAE,sCAAsC,EAAE,MAAM,wEAAwE,CAAC;AAChI,OAAO,EAAE,4BAA4B,IAAI,8BAA8B,EAAE,MAAM,sEAAsE,CAAC;AAEtJ;;;;;;;;GAQG;AACH,qBAAa,gCAAiC,SAAQ,8BAA8B;IAClF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAoB;IAEzD,OAAO;WAIgB,MAAM,CAAC,KAAK,EAAE,4BAA4B,GAAG,gCAAgC;WAI7E,cAAc,CAAC,UAAU,EAAE,sCAAsC,GAAG,gCAAgC;IAQ3G,YAAY,IAAI,sCAAsC;CAKvE"}
@@ -0,0 +1,15 @@
1
+ import { DomainEvent } from '../../../../shared/domain/events/DomainEvent';
2
+ import { DomainEventName } from '../../../../shared/domain/events/DomainEventName';
3
+ import { DomainEventFromPrimitivesInput } from '../../../../shared/domain/types/DomainEventFromPrimitivesInput';
4
+ import { WorkflowActivatedPayload } from '../types/WorkflowActivatedPayload';
5
+ export declare class WorkflowActivatedDomainEvent extends DomainEvent<WorkflowActivatedPayload> {
6
+ #private;
7
+ static readonly NAME: DomainEventName;
8
+ readonly name: DomainEventName;
9
+ readonly aggregateId: string;
10
+ private constructor();
11
+ static create(payload: WorkflowActivatedPayload): WorkflowActivatedDomainEvent;
12
+ static fromPrimitives(primitives: DomainEventFromPrimitivesInput<WorkflowActivatedPayload>): WorkflowActivatedDomainEvent;
13
+ get payload(): WorkflowActivatedPayload;
14
+ }
15
+ //# sourceMappingURL=WorkflowActivatedDomainEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowActivatedDomainEvent.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-workflows/domain/events/WorkflowActivatedDomainEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,gEAAgE,CAAC;AAChH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,qBAAa,4BAA6B,SAAQ,WAAW,CAAC,wBAAwB,CAAC;;IACrF,gBAAuB,IAAI,EAAE,eAAe,CAA+C;IAE3F,SAAgB,IAAI,EAAE,eAAe,CAAqC;IAE1E,SAAgB,WAAW,EAAE,MAAM,CAAC;IAIpC,OAAO;WAMO,MAAM,CAAC,OAAO,EAAE,wBAAwB,GAAG,4BAA4B;WAIvE,cAAc,CAC1B,UAAU,EAAE,8BAA8B,CAAC,wBAAwB,CAAC,GACnE,4BAA4B;IAI/B,IAAoB,OAAO,IAAI,wBAAwB,CAEtD;CACF"}
@@ -0,0 +1,15 @@
1
+ import { DomainEvent } from '../../../../shared/domain/events/DomainEvent';
2
+ import { DomainEventName } from '../../../../shared/domain/events/DomainEventName';
3
+ import { DomainEventFromPrimitivesInput } from '../../../../shared/domain/types/DomainEventFromPrimitivesInput';
4
+ import { WorkflowPausedPayload } from '../types/WorkflowPausedPayload';
5
+ export declare class WorkflowPausedDomainEvent extends DomainEvent<WorkflowPausedPayload> {
6
+ #private;
7
+ static readonly NAME: DomainEventName;
8
+ readonly name: DomainEventName;
9
+ readonly aggregateId: string;
10
+ private constructor();
11
+ static create(payload: WorkflowPausedPayload): WorkflowPausedDomainEvent;
12
+ static fromPrimitives(primitives: DomainEventFromPrimitivesInput<WorkflowPausedPayload>): WorkflowPausedDomainEvent;
13
+ get payload(): WorkflowPausedPayload;
14
+ }
15
+ //# sourceMappingURL=WorkflowPausedDomainEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowPausedDomainEvent.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-workflows/domain/events/WorkflowPausedDomainEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,gEAAgE,CAAC;AAChH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,qBAAa,yBAA0B,SAAQ,WAAW,CAAC,qBAAqB,CAAC;;IAC/E,gBAAuB,IAAI,EAAE,eAAe,CAA4C;IAExF,SAAgB,IAAI,EAAE,eAAe,CAAkC;IAEvE,SAAgB,WAAW,EAAE,MAAM,CAAC;IAIpC,OAAO;WAMO,MAAM,CAAC,OAAO,EAAE,qBAAqB,GAAG,yBAAyB;WAIjE,cAAc,CAC1B,UAAU,EAAE,8BAA8B,CAAC,qBAAqB,CAAC,GAChE,yBAAyB;IAI5B,IAAoB,OAAO,IAAI,qBAAqB,CAEnD;CACF"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Payload published when a `CalculationWorkflow` transitions from
3
+ * `PAUSED`/`DRAFT` to `ACTIVE`. Downstream consumers (Lambda dispatcher,
4
+ * scheduler integration, audit log) use it to (re)attach the workflow
5
+ * to its automatic trigger sources without mutating EventBridge rules
6
+ * at runtime.
7
+ */
8
+ export type WorkflowActivatedPayload = Readonly<{
9
+ workflowId: string;
10
+ status: string;
11
+ isAutomatic: boolean;
12
+ triggerType: string | null;
13
+ triggerSchedule: string | null;
14
+ nextScheduledAt: string | null;
15
+ allowedExecutors: ReadonlyArray<string>;
16
+ carbonClient: string | null;
17
+ }>;
18
+ //# sourceMappingURL=WorkflowActivatedPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowActivatedPayload.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-workflows/domain/types/WorkflowActivatedPayload.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACxC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Payload published when a `CalculationWorkflow` transitions from `ACTIVE`
3
+ * to `PAUSED`. The Lambda dispatcher uses this fact to remove the workflow
4
+ * from its automatic trigger index, so a paused workflow stops responding
5
+ * to data submissions, configuration changes and period-end schedules
6
+ * without mutating EventBridge rules at runtime.
7
+ */
8
+ export type WorkflowPausedPayload = Readonly<{
9
+ workflowId: string;
10
+ status: string;
11
+ isAutomatic: boolean;
12
+ triggerType: string | null;
13
+ pauseReason: string;
14
+ carbonClient: string | null;
15
+ }>;
16
+ //# sourceMappingURL=WorkflowPausedPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowPausedPayload.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-workflows/domain/types/WorkflowPausedPayload.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { DomainEventEnvelopePrimitives } from '../types/DomainEventEnvelopePrimitives';
2
+ import { DomainEventName } from './DomainEventName';
3
+ import { IDomainEvent } from './IDomainEvent';
4
+ /**
5
+ * Abstract base class every concrete domain event extends.
6
+ *
7
+ * Concrete subclasses MUST:
8
+ * - Declare a `public static readonly NAME: DomainEventName` so callers
9
+ * can reference it statically (e.g. when building EventBridge rule
10
+ * `detail-type` filters) without instantiating the event.
11
+ * - Implement `name`, `aggregateId` and `payload` as readonly members so
12
+ * the event is immutable from the outside.
13
+ * - Provide a `static create(payload)` factory and a
14
+ * `static fromPrimitives({ aggregateId, occurredAt, payload })`
15
+ * factory for the reconstruction path used by consumers.
16
+ *
17
+ * Subclasses MUST NOT add behaviour that mutates state or talks to
18
+ * infrastructure — events are facts, not orchestrators.
19
+ */
20
+ export declare abstract class DomainEvent<TPayload extends Readonly<Record<string, unknown>>> implements IDomainEvent<TPayload> {
21
+ abstract readonly name: DomainEventName;
22
+ abstract readonly aggregateId: string;
23
+ readonly occurredAt: Date;
24
+ protected constructor(occurredAt?: Date);
25
+ abstract get payload(): TPayload;
26
+ toEnvelope(): DomainEventEnvelopePrimitives<TPayload>;
27
+ }
28
+ //# sourceMappingURL=DomainEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DomainEvent.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/events/DomainEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;;;;;GAeG;AACH,8BAAsB,WAAW,CAAC,QAAQ,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CACpF,YAAW,YAAY,CAAC,QAAQ,CAAC;IAC/B,kBAAyB,IAAI,EAAE,eAAe,CAAC;IAE/C,kBAAyB,WAAW,EAAE,MAAM,CAAC;IAE7C,SAAgB,UAAU,EAAE,IAAI,CAAC;IAEjC,SAAS,aAAa,UAAU,CAAC,EAAE,IAAI;IAIvC,aAAoB,OAAO,IAAI,QAAQ,CAAC;IAEjC,UAAU,IAAI,6BAA6B,CAAC,QAAQ,CAAC;CAQ7D"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Lossless serialisation of a domain event used by infrastructure
3
+ * adapters to project the event onto a concrete transport.
4
+ *
5
+ * This type lives in the domain because it is the contract between the
6
+ * domain and any transport adapter (EventBridge, SNS, in-memory bus,
7
+ * Kafka, etc.). Keeping it here ensures the domain remains pure while
8
+ * still letting infrastructure consume a strongly-typed representation
9
+ * of an event without owning the projection logic itself.
10
+ *
11
+ * Naming convention:
12
+ * - `name` is the validated PascalCase past-tense string from
13
+ * `DomainEventName.value`.
14
+ * - `aggregateId` is the originating aggregate's primary key, used for
15
+ * ordering (FIFO group key) and consumer-side idempotency.
16
+ * - `occurredAt` is the producer-side wall-clock instant.
17
+ * - `payload` is a JSON-serialisable, immutable snapshot of the domain
18
+ * facts the consumer needs to react.
19
+ */
20
+ export type DomainEventEnvelopePrimitives<TPayload extends Readonly<Record<string, unknown>>> = {
21
+ readonly name: string;
22
+ readonly aggregateId: string;
23
+ readonly occurredAt: Date;
24
+ readonly payload: TPayload;
25
+ };
26
+ //# sourceMappingURL=DomainEventEnvelopePrimitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DomainEventEnvelopePrimitives.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/events/DomainEventEnvelopePrimitives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,6BAA6B,CAAC,QAAQ,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;IAC9F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;CAC5B,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Value object that enforces the naming convention for domain events.
3
+ *
4
+ * Conventions enforced:
5
+ * - Non-empty string with no leading/trailing whitespace.
6
+ * - PascalCase (each word starts uppercase, no separators).
7
+ * - Past-tense semantics (last word ends in `ed`, `en` or known irregular
8
+ * past participles). Past tense communicates that the event describes a
9
+ * fact that already occurred — never an intent.
10
+ * - Length between 3 and 80 characters to keep EventBridge `DetailType`
11
+ * well-bounded (EventBridge accepts up to 128 characters).
12
+ *
13
+ * The string value is what the infrastructure layer maps to EventBridge
14
+ * `DetailType`, so consumers can build static rules like
15
+ * `detail-type: [CalculationJobCompletedDomainEvent.NAME.value]`.
16
+ */
17
+ export declare class DomainEventName {
18
+ #private;
19
+ private static readonly MIN_LENGTH;
20
+ private static readonly MAX_LENGTH;
21
+ private static readonly PASCAL_CASE_REGEX;
22
+ /**
23
+ * Recognised past-tense suffixes (regular `-ed`/`-en` plus a curated list
24
+ * of irregular forms that may appear in domain events).
25
+ */
26
+ private static readonly PAST_TENSE_SUFFIXES;
27
+ private constructor();
28
+ static create(value: string): DomainEventName;
29
+ /**
30
+ * Reconstruction path used when re-hydrating an event from its
31
+ * persisted/serialised form. Same validation as `create()`; we keep the
32
+ * separate factory only for symmetry with the rest of the domain.
33
+ */
34
+ static fromPrimitives(value: string): DomainEventName;
35
+ get value(): string;
36
+ toPrimitives(): string;
37
+ equals(other: DomainEventName): boolean;
38
+ toString(): string;
39
+ }
40
+ //# sourceMappingURL=DomainEventName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DomainEventName.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/events/DomainEventName.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,eAAe;;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAK;IAEvC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAM;IAExC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAA0B;IAEnE;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAsBzC;IAIF,OAAO;WAIO,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe;IAKpD;;;;OAIG;WACW,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe;IAI5D,IAAW,KAAK,IAAI,MAAM,CAEzB;IAEM,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO;IAIvC,QAAQ,IAAI,MAAM;CAuC1B"}
@@ -0,0 +1,36 @@
1
+ import { DomainEventEnvelopePrimitives } from '../types/DomainEventEnvelopePrimitives';
2
+ import { DomainEventName } from './DomainEventName';
3
+ /**
4
+ * Contract every domain event must satisfy.
5
+ *
6
+ * Domain events are immutable facts — they describe something that has
7
+ * already happened in the model. They are dispatched by aggregates (or
8
+ * application services after a successful unit of work) and consumed by
9
+ * one or more downstream reactors (in our case, AWS Lambdas subscribed
10
+ * to EventBridge rules).
11
+ *
12
+ * Design decisions:
13
+ * - `name` is a value object (`DomainEventName`) instead of a raw string
14
+ * so the PascalCase past-tense convention is enforced at construction
15
+ * time, eliminating "magic string" duplication between producers and
16
+ * consumers.
17
+ * - `aggregateId` is the primary key of the originating aggregate. It is
18
+ * used by infrastructure to preserve ordering (FIFO `MessageGroupId`)
19
+ * and by consumers for idempotency keys (`aggregateId + name`).
20
+ * - `payload` is a strongly-typed snapshot of the domain facts the
21
+ * consumer needs to react without re-querying the writer. The payload
22
+ * type is a phantom generic on the concrete event subclass, giving
23
+ * end-to-end type safety from producer to consumer.
24
+ * - `occurredAt` carries the wall-clock instant from the producing
25
+ * service, which can drift from the time the event reaches the bus.
26
+ * - `toEnvelope()` is the only way infrastructure may serialise the
27
+ * event for transport. The domain itself never imports any AWS SDK.
28
+ */
29
+ export interface IDomainEvent<TPayload extends Readonly<Record<string, unknown>>> {
30
+ readonly name: DomainEventName;
31
+ readonly aggregateId: string;
32
+ readonly occurredAt: Date;
33
+ readonly payload: TPayload;
34
+ toEnvelope(): DomainEventEnvelopePrimitives<TPayload>;
35
+ }
36
+ //# sourceMappingURL=IDomainEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IDomainEvent.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/events/IDomainEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,YAAY,CAAC,QAAQ,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9E,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAE3B,UAAU,IAAI,6BAA6B,CAAC,QAAQ,CAAC,CAAC;CACvD"}
@@ -0,0 +1,7 @@
1
+ import { RootError } from './RootError';
2
+ export declare class InvalidDomainEventNameError extends RootError {
3
+ private constructor();
4
+ static create(value: unknown, reason: string): InvalidDomainEventNameError;
5
+ logError(): string;
6
+ }
7
+ //# sourceMappingURL=InvalidDomainEventNameError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvalidDomainEventNameError.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/exceptions/InvalidDomainEventNameError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,2BAA4B,SAAQ,SAAS;IACxD,OAAO;WAKgB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,2BAA2B;IAM1E,QAAQ,IAAI,MAAM;CAGnC"}
@@ -101,5 +101,13 @@ export declare class DateTimeFormattingDomainService implements IDateTimeFormatt
101
101
  * @deprecated Use instance method instead
102
102
  */
103
103
  static formatDateToString(date: Date): string;
104
+ /**
105
+ * @deprecated Use instance method instead
106
+ */
107
+ static getCurrentDateTimeString(): string;
108
+ /**
109
+ * @deprecated Use instance method instead
110
+ */
111
+ static formatDateTimeToString(date: Date): string;
104
112
  }
105
113
  //# sourceMappingURL=DateTimeFormattingDomainService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeFormattingDomainService.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/shared/domain/services/implementations/DateTimeFormattingDomainService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAGjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,+CAA+C,CAAC;AAEjG;;;;GAIG;AACH,qBAAa,+BAAgC,YAAW,gCAAgC;IACtF,OAAO;WAIO,MAAM,IAAI,+BAA+B;IAIvD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2D;IAEtF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAyG;IAExI;;;;OAIG;IACI,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAmBrF;;;;OAIG;IACI,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAiB7F;;;;OAIG;IACI,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAsB9E;;;;OAIG;IACI,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAyBlF;;;OAGG;IACI,oBAAoB,IAAI,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAItE;;;OAGG;IACI,wBAAwB,IAAI,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAI1E;;;;OAIG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC;IAyBjF;;;;OAIG;IACI,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC;IA4BzF;;;;OAIG;IACI,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAoChF;;;;OAIG;IACI,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAoCxF;;;;;OAKG;IACI,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IA0BtG;;;;;OAKG;IACI,gBAAgB,CAAC,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IA0BlH;;;OAGG;IACI,aAAa,IAAI,MAAM;IAI9B;;;OAGG;IACI,iBAAiB,IAAI,MAAM;IAOlC;;OAEG;WACW,oBAAoB,IAAI,MAAM;IAQ5C;;OAEG;WACW,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;CAOrD"}
1
+ {"version":3,"file":"DateTimeFormattingDomainService.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/shared/domain/services/implementations/DateTimeFormattingDomainService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAGjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,+CAA+C,CAAC;AAEjG;;;;GAIG;AACH,qBAAa,+BAAgC,YAAW,gCAAgC;IACtF,OAAO;WAIO,MAAM,IAAI,+BAA+B;IAIvD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2D;IAEtF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAyG;IAExI;;;;OAIG;IACI,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAmBrF;;;;OAIG;IACI,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAiB7F;;;;OAIG;IACI,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAsB9E;;;;OAIG;IACI,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAyBlF;;;OAGG;IACI,oBAAoB,IAAI,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAItE;;;OAGG;IACI,wBAAwB,IAAI,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAI1E;;;;OAIG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC;IAyBjF;;;;OAIG;IACI,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC;IA4BzF;;;;OAIG;IACI,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAoChF;;;;OAIG;IACI,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAoCxF;;;;;OAKG;IACI,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IA0BtG;;;;;OAKG;IACI,gBAAgB,CAAC,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC;IA0BlH;;;OAGG;IACI,aAAa,IAAI,MAAM;IAI9B;;;OAGG;IACI,iBAAiB,IAAI,MAAM;IAOlC;;OAEG;WACW,oBAAoB,IAAI,MAAM;IAQ5C;;OAEG;WACW,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAQpD;;OAEG;WACW,wBAAwB,IAAI,MAAM;IAQhD;;OAEG;WACW,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;CAOzD"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Lightweight reference to a CalculationWorkflow aggregate.
3
+ *
4
+ * Carries only the identifier — workflow data the consumer needs (e.g.
5
+ * `maxConcurrentProcesses`, `triggerType`) is fetched from the workflow
6
+ * aggregate itself. Keeping the reference minimal preserves the
7
+ * "aggregates know other aggregates by id, not by content" rule of DDD
8
+ * and prevents the workflow's invariants from leaking across boundaries.
9
+ */
10
+ export type CalculationWorkflowReference = {
11
+ id: string;
12
+ };
13
+ //# sourceMappingURL=CalculationWorkflowReference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalculationWorkflowReference.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/types/CalculationWorkflowReference.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Primitive (JSON-serialisable) shape of a CalculationWorkflow reference.
3
+ * Mirrors `CalculationWorkflowReference` and is the type used at
4
+ * persistence and event-bus boundaries.
5
+ */
6
+ export type CalculationWorkflowReferencePrimitives = {
7
+ id: string;
8
+ };
9
+ //# sourceMappingURL=CalculationWorkflowReferencePrimitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalculationWorkflowReferencePrimitives.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/types/CalculationWorkflowReferencePrimitives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Lossless serialisation of a domain event used by infrastructure
3
+ * adapters to project the event onto a concrete transport.
4
+ *
5
+ * This type lives in the domain because it is the contract between the
6
+ * domain and any transport adapter (EventBridge, SNS, in-memory bus,
7
+ * Kafka, etc.). Keeping it here ensures the domain remains pure while
8
+ * still letting infrastructure consume a strongly-typed representation
9
+ * of an event without owning the projection logic itself.
10
+ *
11
+ * Naming convention:
12
+ * - `name` is the validated PascalCase past-tense string from
13
+ * `DomainEventName.value`.
14
+ * - `aggregateId` is the originating aggregate's primary key, used for
15
+ * ordering (FIFO group key) and consumer-side idempotency.
16
+ * - `occurredAt` is the producer-side wall-clock instant.
17
+ * - `payload` is a JSON-serialisable, immutable snapshot of the domain
18
+ * facts the consumer needs to react.
19
+ */
20
+ export type DomainEventEnvelopePrimitives<TPayload extends Readonly<Record<string, unknown>>> = {
21
+ readonly name: string;
22
+ readonly aggregateId: string;
23
+ readonly occurredAt: Date;
24
+ readonly payload: TPayload;
25
+ };
26
+ //# sourceMappingURL=DomainEventEnvelopePrimitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DomainEventEnvelopePrimitives.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/types/DomainEventEnvelopePrimitives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,6BAA6B,CAAC,QAAQ,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;IAC9F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;CAC5B,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generic input shape for the `fromPrimitives()` factory present on
3
+ * every concrete domain event subclass. Centralising the shape here
4
+ * keeps every event factory consistent and removes duplication across
5
+ * bounded contexts.
6
+ *
7
+ * Producers serialise their event with `event.toEnvelope()`, consumers
8
+ * deserialise with `<EventClass>.fromPrimitives({ ... })`.
9
+ */
10
+ export type DomainEventFromPrimitivesInput<TPayload extends Readonly<Record<string, unknown>>> = {
11
+ readonly aggregateId: string;
12
+ readonly occurredAt: Date;
13
+ readonly payload: TPayload;
14
+ };
15
+ //# sourceMappingURL=DomainEventFromPrimitivesInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DomainEventFromPrimitivesInput.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/types/DomainEventFromPrimitivesInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,8BAA8B,CAAC,QAAQ,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;IAC/F,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;CAC5B,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { CalculationWorkflowReferencePrimitives } from '../types/CalculationWorkflowReferencePrimitives';
2
+ import { CalculationWorkflowReference as TCalculationWorkflowReference } from '../types/CalculationWorkflowReference';
3
+ import { ObjectValueObject } from './ObjectValueObject';
4
+ /**
5
+ * Abstract reference to a CalculationWorkflow aggregate.
6
+ *
7
+ * Concrete sub-classes (e.g. `CalculationProcessParentWorkflow`) extend
8
+ * this VO to express "I am a reference to a workflow, used in this
9
+ * context". The abstract base centralises type and id validation so each
10
+ * sub-class only declares its own property name.
11
+ *
12
+ * The reference intentionally carries only `id`: data downstream
13
+ * consumers may need (`maxConcurrentProcesses`, `triggerType`, …) is
14
+ * fetched from the workflow aggregate, never duplicated here.
15
+ */
16
+ export declare abstract class CalculationWorkflowReference extends ObjectValueObject<CalculationWorkflowReferencePrimitives> {
17
+ #private;
18
+ protected static readonly DEFAULT_PROPERTY_NAME = "calculationWorkflowReference";
19
+ protected constructor(value: TCalculationWorkflowReference, skipDomainValidation: boolean, propertyName?: string);
20
+ protected static validateCalculationWorkflowReference(value: TCalculationWorkflowReference, propertyName: string): void;
21
+ protected static guardAgainstInvalidType(value: any, propertyName: string): void;
22
+ protected static guardAgainstInvalidId(id: string): void;
23
+ get id(): string;
24
+ hasId(id: string): boolean;
25
+ equals(other: CalculationWorkflowReference): boolean;
26
+ hashCode(): string;
27
+ toPrimitives(): CalculationWorkflowReferencePrimitives;
28
+ toString(): string;
29
+ toJSON(): CalculationWorkflowReferencePrimitives;
30
+ static validateCompletely(value: TCalculationWorkflowReference, propertyName: string): void;
31
+ }
32
+ //# sourceMappingURL=CalculationWorkflowReference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalculationWorkflowReference.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/value-objects/CalculationWorkflowReference.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sCAAsC,EAAE,MAAM,iDAAiD,CAAC;AACzG,OAAO,EAAE,4BAA4B,IAAI,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD;;;;;;;;;;;GAWG;AACH,8BAAsB,4BACpB,SAAQ,iBAAiB,CAAC,sCAAsC,CAAC;;IACjE,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,kCAAkC;IAIjF,SAAS,aACP,KAAK,EAAE,6BAA6B,EACpC,oBAAoB,EAAE,OAAO,EAC7B,YAAY,GAAE,MAA2D;IAiB3E,SAAS,CAAC,MAAM,CAAC,oCAAoC,CACnD,KAAK,EAAE,6BAA6B,EACpC,YAAY,EAAE,MAAM,GACnB,IAAI;IAKP,SAAS,CAAC,MAAM,CAAC,uBAAuB,CAAC,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAUhF,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKxD,IAAW,EAAE,IAAI,MAAM,CAEtB;IAEM,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIjB,MAAM,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO;IAQ7D,QAAQ,IAAI,MAAM;IAIT,YAAY,IAAI,sCAAsC;IAM/D,QAAQ,IAAI,MAAM;IAIlB,MAAM,IAAI,sCAAsC;WAIzC,kBAAkB,CAC9B,KAAK,EAAE,6BAA6B,EACpC,YAAY,EAAE,MAAM,GACnB,IAAI;CAGR"}