@carbonbox/domain 0.43.0 → 0.45.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.
- package/build/carbonbox/emission-calculation-results/ghg-emission-results/domain/entity/GHGEmissionResult.js +7 -0
- package/build/carbonbox/emission-calculation-results/ghg-emission-results/domain/value-objects/GHGEmissionResultGreenhouseGas.js +12 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/entity/IReportContentGenerationJob.js +2 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/entity/ReportContentGenerationJob.js +158 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/enums/ReportContentGenerationStatus.js +14 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/exceptions/ReportContentGenerationJobInvalidStatusTransitionError.js +31 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/repository/IReportContentGenerationJobRepository.js +2 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/types/ReportContentGenerationJobPrimitives.js +2 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/types/ReportContentGenerationJobProps.js +2 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobAttemptCount.js +30 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobCarbonClientId.js +23 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobCompletedAt.js +20 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobCreatedAt.js +20 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobFailureReason.js +20 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobId.js +44 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobReportInstanceId.js +23 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobRequestedByStakeholderId.js +23 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobStartedAt.js +20 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobStatus.js +60 -0
- package/build/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobUpdatedAt.js +20 -0
- package/build/carbonbox/reporting/shared/domain/enums/DataBindingSource.js +3 -2
- package/build/carbonbox/shared/domain/enums/ErrorCode.js +1 -0
- package/build/carbonbox/shared/domain/enums/SemanticUuidPrefix.js +1 -0
- package/build/carbonbox/shared/domain/value-objects/GreenhouseGasSpecies.js +17 -0
- package/build/main/index.js +37 -8
- package/build/types/carbonbox/emission-calculation-results/ghg-emission-results/domain/entity/GHGEmissionResult.d.ts +5 -0
- package/build/types/carbonbox/emission-calculation-results/ghg-emission-results/domain/entity/GHGEmissionResult.d.ts.map +1 -1
- package/build/types/carbonbox/emission-calculation-results/ghg-emission-results/domain/value-objects/GHGEmissionResultGreenhouseGas.d.ts +8 -0
- package/build/types/carbonbox/emission-calculation-results/ghg-emission-results/domain/value-objects/GHGEmissionResultGreenhouseGas.d.ts.map +1 -1
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/entity/IReportContentGenerationJob.d.ts +24 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/entity/IReportContentGenerationJob.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/entity/ReportContentGenerationJob.d.ts +56 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/entity/ReportContentGenerationJob.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/enums/ReportContentGenerationStatus.d.ts +11 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/enums/ReportContentGenerationStatus.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/exceptions/ReportContentGenerationJobInvalidStatusTransitionError.d.ts +7 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/exceptions/ReportContentGenerationJobInvalidStatusTransitionError.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/repository/IReportContentGenerationJobRepository.d.ts +20 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/repository/IReportContentGenerationJobRepository.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/types/ReportContentGenerationJobPrimitives.d.ts +19 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/types/ReportContentGenerationJobPrimitives.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/types/ReportContentGenerationJobProps.d.ts +15 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/types/ReportContentGenerationJobProps.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobAttemptCount.d.ts +10 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobAttemptCount.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobCarbonClientId.d.ts +9 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobCarbonClientId.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobCompletedAt.d.ts +9 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobCompletedAt.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobCreatedAt.d.ts +9 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobCreatedAt.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobFailureReason.d.ts +9 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobFailureReason.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobId.d.ts +11 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobId.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobReportInstanceId.d.ts +9 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobReportInstanceId.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobRequestedByStakeholderId.d.ts +9 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobRequestedByStakeholderId.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobStartedAt.d.ts +9 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobStartedAt.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobStatus.d.ts +21 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobStatus.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobUpdatedAt.d.ts +9 -0
- package/build/types/carbonbox/reporting/report-content-generation-jobs/domain/value-objects/ReportContentGenerationJobUpdatedAt.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/shared/domain/enums/DataBindingSource.d.ts +1 -1
- package/build/types/carbonbox/reporting/shared/domain/enums/DataBindingSource.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/enums/ErrorCode.d.ts +1 -0
- package/build/types/carbonbox/shared/domain/enums/ErrorCode.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/enums/SemanticUuidPrefix.d.ts +2 -1
- package/build/types/carbonbox/shared/domain/enums/SemanticUuidPrefix.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/GreenhouseGasSpecies.d.ts +13 -0
- package/build/types/carbonbox/shared/domain/value-objects/GreenhouseGasSpecies.d.ts.map +1 -1
- package/build/types/main/index.d.ts +18 -0
- package/build/types/main/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -119,6 +119,13 @@ class GHGEmissionResult extends AggregateRoot_1.AggregateRoot {
|
|
|
119
119
|
get unit() {
|
|
120
120
|
return __classPrivateFieldGet(this, _GHGEmissionResult_unit, "f");
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Si este resultado se suma al total del inventario. Falso solo para el CO₂ biogénico
|
|
124
|
+
* (`CO2-BIOGENIC`), que se reporta como partida informativa fuera de los alcances.
|
|
125
|
+
*/
|
|
126
|
+
countsTowardsInventoryTotal() {
|
|
127
|
+
return __classPrivateFieldGet(this, _GHGEmissionResult_greenhouseGas, "f").countsTowardsInventoryTotal();
|
|
128
|
+
}
|
|
122
129
|
}
|
|
123
130
|
exports.GHGEmissionResult = GHGEmissionResult;
|
|
124
131
|
_GHGEmissionResult_emissionCalculation = new WeakMap(), _GHGEmissionResult_greenhouseGas = new WeakMap(), _GHGEmissionResult_activityValue = new WeakMap(), _GHGEmissionResult_emissionFactor = new WeakMap(), _GHGEmissionResult_globalWarmingPotential = new WeakMap(), _GHGEmissionResult_rawEmission = new WeakMap(), _GHGEmissionResult_co2Equivalent = new WeakMap(), _GHGEmissionResult_unit = new WeakMap();
|
|
@@ -45,6 +45,18 @@ class GHGEmissionResultGreenhouseGas extends ValueObject_1.ValueObject {
|
|
|
45
45
|
isFluorinatedGas() {
|
|
46
46
|
return GHGEmissionResultGreenhouseGas.FLUORINATED_CATEGORIES.includes(this.category);
|
|
47
47
|
}
|
|
48
|
+
/** CO₂ de biomasa / biocombustibles (`CO2-BIOGENIC`): partida informativa fuera del total. */
|
|
49
|
+
isBiogenicCarbonDioxide() {
|
|
50
|
+
return GreenhouseGasSpecies_1.GreenhouseGasSpecies.isBiogenicCarbonDioxide(this.species);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Si el resultado de este gas se suma al total del inventario y a sus alcances. Solo el CO₂
|
|
54
|
+
* biogénico queda fuera (GHG Protocol cap. 9 / ISO 14064-1 §9.3.1); el CH₄ y el N₂O de la
|
|
55
|
+
* misma combustión cuentan con su PCG.
|
|
56
|
+
*/
|
|
57
|
+
countsTowardsInventoryTotal() {
|
|
58
|
+
return !this.isBiogenicCarbonDioxide();
|
|
59
|
+
}
|
|
48
60
|
toPrimitives() {
|
|
49
61
|
return {
|
|
50
62
|
greenhouseGasCategory: this.value.greenhouseGasCategory,
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _ReportContentGenerationJob_reportInstanceId, _ReportContentGenerationJob_carbonClientId, _ReportContentGenerationJob_requestedByStakeholderId, _ReportContentGenerationJob_status, _ReportContentGenerationJob_attemptCount, _ReportContentGenerationJob_failureReason, _ReportContentGenerationJob_createdAt, _ReportContentGenerationJob_updatedAt, _ReportContentGenerationJob_startedAt, _ReportContentGenerationJob_completedAt;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ReportContentGenerationJob = void 0;
|
|
16
|
+
const AggregateRoot_1 = require("../../../../shared/domain/entities/AggregateRoot");
|
|
17
|
+
const ReportContentGenerationStatus_1 = require("../enums/ReportContentGenerationStatus");
|
|
18
|
+
const ReportContentGenerationJobInvalidStatusTransitionError_1 = require("../exceptions/ReportContentGenerationJobInvalidStatusTransitionError");
|
|
19
|
+
const ReportContentGenerationJobAttemptCount_1 = require("../value-objects/ReportContentGenerationJobAttemptCount");
|
|
20
|
+
const ReportContentGenerationJobCarbonClientId_1 = require("../value-objects/ReportContentGenerationJobCarbonClientId");
|
|
21
|
+
const ReportContentGenerationJobCompletedAt_1 = require("../value-objects/ReportContentGenerationJobCompletedAt");
|
|
22
|
+
const ReportContentGenerationJobCreatedAt_1 = require("../value-objects/ReportContentGenerationJobCreatedAt");
|
|
23
|
+
const ReportContentGenerationJobFailureReason_1 = require("../value-objects/ReportContentGenerationJobFailureReason");
|
|
24
|
+
const ReportContentGenerationJobId_1 = require("../value-objects/ReportContentGenerationJobId");
|
|
25
|
+
const ReportContentGenerationJobReportInstanceId_1 = require("../value-objects/ReportContentGenerationJobReportInstanceId");
|
|
26
|
+
const ReportContentGenerationJobRequestedByStakeholderId_1 = require("../value-objects/ReportContentGenerationJobRequestedByStakeholderId");
|
|
27
|
+
const ReportContentGenerationJobStartedAt_1 = require("../value-objects/ReportContentGenerationJobStartedAt");
|
|
28
|
+
const ReportContentGenerationJobStatus_1 = require("../value-objects/ReportContentGenerationJobStatus");
|
|
29
|
+
const ReportContentGenerationJobUpdatedAt_1 = require("../value-objects/ReportContentGenerationJobUpdatedAt");
|
|
30
|
+
/**
|
|
31
|
+
* Asynchronous report content generation job (DT-83).
|
|
32
|
+
*
|
|
33
|
+
* One job per generation request of a `ReportInstance`. The API enqueues it (QUEUED), the
|
|
34
|
+
* worker Lambda drives it (PROCESSING → COMPLETED | FAILED) and the web polls it. The
|
|
35
|
+
* `ReportInstance` keeps its own lifecycle (GENERATING → PENDING_INTERNAL, or back to DRAFT
|
|
36
|
+
* when the job fails); the job only records the attempt, its outcome and who asked for it.
|
|
37
|
+
*/
|
|
38
|
+
class ReportContentGenerationJob extends AggregateRoot_1.AggregateRoot {
|
|
39
|
+
constructor(props, skipDomainValidation) {
|
|
40
|
+
const id = skipDomainValidation
|
|
41
|
+
? ReportContentGenerationJobId_1.ReportContentGenerationJobId.fromPrimitives(props.id).toPrimitives()
|
|
42
|
+
: ReportContentGenerationJobId_1.ReportContentGenerationJobId.create(props.id).toPrimitives();
|
|
43
|
+
super({ id }, skipDomainValidation);
|
|
44
|
+
_ReportContentGenerationJob_reportInstanceId.set(this, void 0);
|
|
45
|
+
_ReportContentGenerationJob_carbonClientId.set(this, void 0);
|
|
46
|
+
_ReportContentGenerationJob_requestedByStakeholderId.set(this, void 0);
|
|
47
|
+
_ReportContentGenerationJob_status.set(this, void 0);
|
|
48
|
+
_ReportContentGenerationJob_attemptCount.set(this, void 0);
|
|
49
|
+
_ReportContentGenerationJob_failureReason.set(this, void 0);
|
|
50
|
+
_ReportContentGenerationJob_createdAt.set(this, void 0);
|
|
51
|
+
_ReportContentGenerationJob_updatedAt.set(this, void 0);
|
|
52
|
+
_ReportContentGenerationJob_startedAt.set(this, void 0);
|
|
53
|
+
_ReportContentGenerationJob_completedAt.set(this, void 0);
|
|
54
|
+
if (skipDomainValidation === false) {
|
|
55
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_reportInstanceId, ReportContentGenerationJobReportInstanceId_1.ReportContentGenerationJobReportInstanceId.create(props.reportInstanceId), "f");
|
|
56
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_carbonClientId, ReportContentGenerationJobCarbonClientId_1.ReportContentGenerationJobCarbonClientId.create(props.carbonClientId), "f");
|
|
57
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_requestedByStakeholderId, ReportContentGenerationJobRequestedByStakeholderId_1.ReportContentGenerationJobRequestedByStakeholderId.create(props.requestedByStakeholderId), "f");
|
|
58
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_status, ReportContentGenerationJobStatus_1.ReportContentGenerationJobStatus.create(props.status), "f");
|
|
59
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_attemptCount, ReportContentGenerationJobAttemptCount_1.ReportContentGenerationJobAttemptCount.create(props.attemptCount), "f");
|
|
60
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_failureReason, ReportContentGenerationJobFailureReason_1.ReportContentGenerationJobFailureReason.create(props.failureReason), "f");
|
|
61
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_createdAt, ReportContentGenerationJobCreatedAt_1.ReportContentGenerationJobCreatedAt.create(props.createdAt), "f");
|
|
62
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_updatedAt, ReportContentGenerationJobUpdatedAt_1.ReportContentGenerationJobUpdatedAt.create(props.updatedAt), "f");
|
|
63
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_startedAt, ReportContentGenerationJobStartedAt_1.ReportContentGenerationJobStartedAt.create(props.startedAt), "f");
|
|
64
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_completedAt, ReportContentGenerationJobCompletedAt_1.ReportContentGenerationJobCompletedAt.create(props.completedAt), "f");
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_reportInstanceId, ReportContentGenerationJobReportInstanceId_1.ReportContentGenerationJobReportInstanceId.fromPrimitives(props.reportInstanceId), "f");
|
|
68
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_carbonClientId, ReportContentGenerationJobCarbonClientId_1.ReportContentGenerationJobCarbonClientId.fromPrimitives(props.carbonClientId), "f");
|
|
69
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_requestedByStakeholderId, ReportContentGenerationJobRequestedByStakeholderId_1.ReportContentGenerationJobRequestedByStakeholderId.fromPrimitives(props.requestedByStakeholderId), "f");
|
|
70
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_status, ReportContentGenerationJobStatus_1.ReportContentGenerationJobStatus.fromPrimitives(props.status), "f");
|
|
71
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_attemptCount, ReportContentGenerationJobAttemptCount_1.ReportContentGenerationJobAttemptCount.fromPrimitives(props.attemptCount), "f");
|
|
72
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_failureReason, ReportContentGenerationJobFailureReason_1.ReportContentGenerationJobFailureReason.fromPrimitives(props.failureReason), "f");
|
|
73
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_createdAt, ReportContentGenerationJobCreatedAt_1.ReportContentGenerationJobCreatedAt.fromPrimitives(props.createdAt), "f");
|
|
74
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_updatedAt, ReportContentGenerationJobUpdatedAt_1.ReportContentGenerationJobUpdatedAt.fromPrimitives(props.updatedAt), "f");
|
|
75
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_startedAt, ReportContentGenerationJobStartedAt_1.ReportContentGenerationJobStartedAt.fromPrimitives(props.startedAt), "f");
|
|
76
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_completedAt, ReportContentGenerationJobCompletedAt_1.ReportContentGenerationJobCompletedAt.fromPrimitives(props.completedAt), "f");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
static create(props) {
|
|
80
|
+
return new ReportContentGenerationJob(props, false);
|
|
81
|
+
}
|
|
82
|
+
static fromPrimitives(primitives) {
|
|
83
|
+
return new ReportContentGenerationJob(primitives, true);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Transitions the job to PROCESSING and counts the attempt. Allowed from QUEUED (first
|
|
87
|
+
* delivery) and from PROCESSING (redelivery after a crash or timeout of the worker), so
|
|
88
|
+
* the worker can decide from `attemptCount` whether to resume or give up. Records
|
|
89
|
+
* `startedAt` on the first attempt only. Invalid from COMPLETED/FAILED.
|
|
90
|
+
*/
|
|
91
|
+
markProcessing(nowDateTime) {
|
|
92
|
+
if (!__classPrivateFieldGet(this, _ReportContentGenerationJob_status, "f").canTransitionToProcessing()) {
|
|
93
|
+
throw ReportContentGenerationJobInvalidStatusTransitionError_1.ReportContentGenerationJobInvalidStatusTransitionError.create(this.id.toPrimitives(), __classPrivateFieldGet(this, _ReportContentGenerationJob_status, "f").toEnum(), ReportContentGenerationStatus_1.ReportContentGenerationStatus.PROCESSING);
|
|
94
|
+
}
|
|
95
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_status, ReportContentGenerationJobStatus_1.ReportContentGenerationJobStatus.create(ReportContentGenerationStatus_1.ReportContentGenerationStatus.PROCESSING), "f");
|
|
96
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_attemptCount, __classPrivateFieldGet(this, _ReportContentGenerationJob_attemptCount, "f").increment(), "f");
|
|
97
|
+
if (!__classPrivateFieldGet(this, _ReportContentGenerationJob_startedAt, "f").hasValue()) {
|
|
98
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_startedAt, ReportContentGenerationJobStartedAt_1.ReportContentGenerationJobStartedAt.create(nowDateTime), "f");
|
|
99
|
+
}
|
|
100
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_updatedAt, ReportContentGenerationJobUpdatedAt_1.ReportContentGenerationJobUpdatedAt.create(nowDateTime), "f");
|
|
101
|
+
}
|
|
102
|
+
/** Transitions the job to COMPLETED. Allowed only from PROCESSING. Sets `completedAt`. */
|
|
103
|
+
markCompleted(nowDateTime) {
|
|
104
|
+
if (!__classPrivateFieldGet(this, _ReportContentGenerationJob_status, "f").canTransitionToCompleted()) {
|
|
105
|
+
throw ReportContentGenerationJobInvalidStatusTransitionError_1.ReportContentGenerationJobInvalidStatusTransitionError.create(this.id.toPrimitives(), __classPrivateFieldGet(this, _ReportContentGenerationJob_status, "f").toEnum(), ReportContentGenerationStatus_1.ReportContentGenerationStatus.COMPLETED);
|
|
106
|
+
}
|
|
107
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_status, ReportContentGenerationJobStatus_1.ReportContentGenerationJobStatus.create(ReportContentGenerationStatus_1.ReportContentGenerationStatus.COMPLETED), "f");
|
|
108
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_failureReason, ReportContentGenerationJobFailureReason_1.ReportContentGenerationJobFailureReason.create(null), "f");
|
|
109
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_updatedAt, ReportContentGenerationJobUpdatedAt_1.ReportContentGenerationJobUpdatedAt.create(nowDateTime), "f");
|
|
110
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_completedAt, ReportContentGenerationJobCompletedAt_1.ReportContentGenerationJobCompletedAt.create(nowDateTime), "f");
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Transitions the job to FAILED with the reason shown to the requester. Allowed from
|
|
114
|
+
* QUEUED (the queue rejected the message) or PROCESSING. Sets `completedAt`.
|
|
115
|
+
*/
|
|
116
|
+
markFailed(failureReason, nowDateTime) {
|
|
117
|
+
if (!__classPrivateFieldGet(this, _ReportContentGenerationJob_status, "f").canTransitionToFailed()) {
|
|
118
|
+
throw ReportContentGenerationJobInvalidStatusTransitionError_1.ReportContentGenerationJobInvalidStatusTransitionError.create(this.id.toPrimitives(), __classPrivateFieldGet(this, _ReportContentGenerationJob_status, "f").toEnum(), ReportContentGenerationStatus_1.ReportContentGenerationStatus.FAILED);
|
|
119
|
+
}
|
|
120
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_status, ReportContentGenerationJobStatus_1.ReportContentGenerationJobStatus.create(ReportContentGenerationStatus_1.ReportContentGenerationStatus.FAILED), "f");
|
|
121
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_failureReason, ReportContentGenerationJobFailureReason_1.ReportContentGenerationJobFailureReason.create(failureReason), "f");
|
|
122
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_updatedAt, ReportContentGenerationJobUpdatedAt_1.ReportContentGenerationJobUpdatedAt.create(nowDateTime), "f");
|
|
123
|
+
__classPrivateFieldSet(this, _ReportContentGenerationJob_completedAt, ReportContentGenerationJobCompletedAt_1.ReportContentGenerationJobCompletedAt.create(nowDateTime), "f");
|
|
124
|
+
}
|
|
125
|
+
isActive() {
|
|
126
|
+
return !__classPrivateFieldGet(this, _ReportContentGenerationJob_status, "f").isFinal();
|
|
127
|
+
}
|
|
128
|
+
hasReachedAttemptLimit(maxAttempts) {
|
|
129
|
+
return __classPrivateFieldGet(this, _ReportContentGenerationJob_attemptCount, "f").toPrimitives() >= maxAttempts;
|
|
130
|
+
}
|
|
131
|
+
get toPrimitives() {
|
|
132
|
+
return {
|
|
133
|
+
id: this.id.toPrimitives(),
|
|
134
|
+
reportInstanceId: __classPrivateFieldGet(this, _ReportContentGenerationJob_reportInstanceId, "f").toPrimitives(),
|
|
135
|
+
carbonClientId: __classPrivateFieldGet(this, _ReportContentGenerationJob_carbonClientId, "f").toPrimitives(),
|
|
136
|
+
requestedByStakeholderId: __classPrivateFieldGet(this, _ReportContentGenerationJob_requestedByStakeholderId, "f").toPrimitives(),
|
|
137
|
+
status: __classPrivateFieldGet(this, _ReportContentGenerationJob_status, "f").toEnum(),
|
|
138
|
+
attemptCount: __classPrivateFieldGet(this, _ReportContentGenerationJob_attemptCount, "f").toPrimitives(),
|
|
139
|
+
failureReason: __classPrivateFieldGet(this, _ReportContentGenerationJob_failureReason, "f").toPrimitives(),
|
|
140
|
+
createdAt: __classPrivateFieldGet(this, _ReportContentGenerationJob_createdAt, "f").toPrimitives(),
|
|
141
|
+
updatedAt: __classPrivateFieldGet(this, _ReportContentGenerationJob_updatedAt, "f").toPrimitives(),
|
|
142
|
+
startedAt: __classPrivateFieldGet(this, _ReportContentGenerationJob_startedAt, "f").toPrimitives(),
|
|
143
|
+
completedAt: __classPrivateFieldGet(this, _ReportContentGenerationJob_completedAt, "f").toPrimitives(),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
get reportInstanceId() { return __classPrivateFieldGet(this, _ReportContentGenerationJob_reportInstanceId, "f"); }
|
|
147
|
+
get carbonClientId() { return __classPrivateFieldGet(this, _ReportContentGenerationJob_carbonClientId, "f"); }
|
|
148
|
+
get requestedByStakeholderId() { return __classPrivateFieldGet(this, _ReportContentGenerationJob_requestedByStakeholderId, "f"); }
|
|
149
|
+
get status() { return __classPrivateFieldGet(this, _ReportContentGenerationJob_status, "f"); }
|
|
150
|
+
get attemptCount() { return __classPrivateFieldGet(this, _ReportContentGenerationJob_attemptCount, "f"); }
|
|
151
|
+
get failureReason() { return __classPrivateFieldGet(this, _ReportContentGenerationJob_failureReason, "f"); }
|
|
152
|
+
get createdAt() { return __classPrivateFieldGet(this, _ReportContentGenerationJob_createdAt, "f"); }
|
|
153
|
+
get updatedAt() { return __classPrivateFieldGet(this, _ReportContentGenerationJob_updatedAt, "f"); }
|
|
154
|
+
get startedAt() { return __classPrivateFieldGet(this, _ReportContentGenerationJob_startedAt, "f"); }
|
|
155
|
+
get completedAt() { return __classPrivateFieldGet(this, _ReportContentGenerationJob_completedAt, "f"); }
|
|
156
|
+
}
|
|
157
|
+
exports.ReportContentGenerationJob = ReportContentGenerationJob;
|
|
158
|
+
_ReportContentGenerationJob_reportInstanceId = new WeakMap(), _ReportContentGenerationJob_carbonClientId = new WeakMap(), _ReportContentGenerationJob_requestedByStakeholderId = new WeakMap(), _ReportContentGenerationJob_status = new WeakMap(), _ReportContentGenerationJob_attemptCount = new WeakMap(), _ReportContentGenerationJob_failureReason = new WeakMap(), _ReportContentGenerationJob_createdAt = new WeakMap(), _ReportContentGenerationJob_updatedAt = new WeakMap(), _ReportContentGenerationJob_startedAt = new WeakMap(), _ReportContentGenerationJob_completedAt = new WeakMap();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Lifecycle of an asynchronous report content generation job (DT-83).
|
|
6
|
+
* Mirrors `BulkImportStatus`: QUEUED → PROCESSING → COMPLETED | FAILED.
|
|
7
|
+
*/
|
|
8
|
+
var ReportContentGenerationStatus;
|
|
9
|
+
(function (ReportContentGenerationStatus) {
|
|
10
|
+
ReportContentGenerationStatus["QUEUED"] = "QUEUED";
|
|
11
|
+
ReportContentGenerationStatus["PROCESSING"] = "PROCESSING";
|
|
12
|
+
ReportContentGenerationStatus["COMPLETED"] = "COMPLETED";
|
|
13
|
+
ReportContentGenerationStatus["FAILED"] = "FAILED";
|
|
14
|
+
})(ReportContentGenerationStatus || (exports.ReportContentGenerationStatus = ReportContentGenerationStatus = {}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobInvalidStatusTransitionError = void 0;
|
|
4
|
+
const CodedRootError_1 = require("../../../../shared/domain/exceptions/CodedRootError");
|
|
5
|
+
const ErrorCode_1 = require("../../../../shared/domain/enums/ErrorCode");
|
|
6
|
+
class ReportContentGenerationJobInvalidStatusTransitionError extends CodedRootError_1.CodedRootError {
|
|
7
|
+
constructor(jobId, currentStatus, targetStatus) {
|
|
8
|
+
const technicalMessage = `Invalid status transition for report content generation job '${jobId}'. Cannot transition from '${currentStatus}' to '${targetStatus}'.`;
|
|
9
|
+
const context = {
|
|
10
|
+
jobId,
|
|
11
|
+
currentStatus,
|
|
12
|
+
targetStatus,
|
|
13
|
+
timestamp: new Date().toISOString(),
|
|
14
|
+
};
|
|
15
|
+
const suggestions = [
|
|
16
|
+
'Follow the valid status flow: QUEUED → PROCESSING → COMPLETED | FAILED',
|
|
17
|
+
`Current status '${currentStatus}' does not allow transition to '${targetStatus}'`,
|
|
18
|
+
'A job in a final status (COMPLETED or FAILED) cannot be processed again; request a new generation instead',
|
|
19
|
+
`Verify the report content generation job '${jobId}' state before retrying`,
|
|
20
|
+
];
|
|
21
|
+
super(ErrorCode_1.ErrorCode.REPORT_CONTENT_GENERATION_JOB_INVALID_STATUS_TRANSITION, technicalMessage, context, suggestions);
|
|
22
|
+
this.name = 'ReportContentGenerationJobInvalidStatusTransitionError';
|
|
23
|
+
}
|
|
24
|
+
static create(jobId, currentStatus, targetStatus) {
|
|
25
|
+
return new ReportContentGenerationJobInvalidStatusTransitionError(jobId, currentStatus, targetStatus);
|
|
26
|
+
}
|
|
27
|
+
logError() {
|
|
28
|
+
return `${this.name}: ${this.technicalMessage}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ReportContentGenerationJobInvalidStatusTransitionError = ReportContentGenerationJobInvalidStatusTransitionError;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobAttemptCount = void 0;
|
|
4
|
+
const Numeric_1 = require("../../../../shared/domain/value-objects/Numeric");
|
|
5
|
+
class ReportContentGenerationJobAttemptCount extends Numeric_1.Numeric {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, ReportContentGenerationJobAttemptCount.PROPERTY_NAME, {
|
|
8
|
+
allowDecimals: false,
|
|
9
|
+
allowNegative: false,
|
|
10
|
+
minValue: 0,
|
|
11
|
+
maxValue: Number.MAX_SAFE_INTEGER,
|
|
12
|
+
allowZero: true,
|
|
13
|
+
maxDecimalPlaces: 0,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static create(value) {
|
|
17
|
+
return new ReportContentGenerationJobAttemptCount(value, false);
|
|
18
|
+
}
|
|
19
|
+
static fromPrimitives(primitive) {
|
|
20
|
+
return new ReportContentGenerationJobAttemptCount(primitive, true);
|
|
21
|
+
}
|
|
22
|
+
increment() {
|
|
23
|
+
return ReportContentGenerationJobAttemptCount.create(this.value + 1);
|
|
24
|
+
}
|
|
25
|
+
toPrimitives() {
|
|
26
|
+
return this.value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ReportContentGenerationJobAttemptCount = ReportContentGenerationJobAttemptCount;
|
|
30
|
+
ReportContentGenerationJobAttemptCount.PROPERTY_NAME = 'attemptCount';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobCarbonClientId = void 0;
|
|
4
|
+
const AggregateId_1 = require("../../../../shared/domain/value-objects/AggregateId");
|
|
5
|
+
class ReportContentGenerationJobCarbonClientId extends AggregateId_1.AggregateId {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, ReportContentGenerationJobCarbonClientId.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
AggregateId_1.AggregateId.guardAgainstEmptyValue(value, ReportContentGenerationJobCarbonClientId.PROPERTY_NAME);
|
|
11
|
+
AggregateId_1.AggregateId.guardAgainstInvalidType(value, ReportContentGenerationJobCarbonClientId.PROPERTY_NAME);
|
|
12
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(value, ReportContentGenerationJobCarbonClientId.PROPERTY_NAME);
|
|
13
|
+
return new ReportContentGenerationJobCarbonClientId(value, false);
|
|
14
|
+
}
|
|
15
|
+
static fromPrimitives(primitive) {
|
|
16
|
+
return new ReportContentGenerationJobCarbonClientId(primitive, true);
|
|
17
|
+
}
|
|
18
|
+
toPrimitives() {
|
|
19
|
+
return this.value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ReportContentGenerationJobCarbonClientId = ReportContentGenerationJobCarbonClientId;
|
|
23
|
+
ReportContentGenerationJobCarbonClientId.PROPERTY_NAME = 'carbonClientId';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobCompletedAt = void 0;
|
|
4
|
+
const NullableDateTimeString_1 = require("../../../../shared/domain/value-objects/NullableDateTimeString");
|
|
5
|
+
class ReportContentGenerationJobCompletedAt extends NullableDateTimeString_1.NullableDateTimeString {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, ReportContentGenerationJobCompletedAt.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
return new ReportContentGenerationJobCompletedAt(value, false);
|
|
11
|
+
}
|
|
12
|
+
static fromPrimitives(primitive) {
|
|
13
|
+
return new ReportContentGenerationJobCompletedAt(primitive, true);
|
|
14
|
+
}
|
|
15
|
+
toPrimitives() {
|
|
16
|
+
return this.value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ReportContentGenerationJobCompletedAt = ReportContentGenerationJobCompletedAt;
|
|
20
|
+
ReportContentGenerationJobCompletedAt.PROPERTY_NAME = 'completedAt';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobCreatedAt = void 0;
|
|
4
|
+
const DateTimeString_1 = require("../../../../shared/domain/value-objects/DateTimeString");
|
|
5
|
+
class ReportContentGenerationJobCreatedAt extends DateTimeString_1.DateTimeString {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, ReportContentGenerationJobCreatedAt.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
return new ReportContentGenerationJobCreatedAt(value, false);
|
|
11
|
+
}
|
|
12
|
+
static fromPrimitives(primitive) {
|
|
13
|
+
return new ReportContentGenerationJobCreatedAt(primitive, true);
|
|
14
|
+
}
|
|
15
|
+
toPrimitives() {
|
|
16
|
+
return this.value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ReportContentGenerationJobCreatedAt = ReportContentGenerationJobCreatedAt;
|
|
20
|
+
ReportContentGenerationJobCreatedAt.PROPERTY_NAME = 'createdAt';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobFailureReason = void 0;
|
|
4
|
+
const NullableString_1 = require("../../../../shared/domain/value-objects/NullableString");
|
|
5
|
+
class ReportContentGenerationJobFailureReason extends NullableString_1.NullableString {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, ReportContentGenerationJobFailureReason.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
return new ReportContentGenerationJobFailureReason(value, false);
|
|
11
|
+
}
|
|
12
|
+
static fromPrimitives(primitive) {
|
|
13
|
+
return new ReportContentGenerationJobFailureReason(primitive, true);
|
|
14
|
+
}
|
|
15
|
+
toPrimitives() {
|
|
16
|
+
return this.value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ReportContentGenerationJobFailureReason = ReportContentGenerationJobFailureReason;
|
|
20
|
+
ReportContentGenerationJobFailureReason.PROPERTY_NAME = 'failureReason';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobId = void 0;
|
|
4
|
+
const AggregateId_1 = require("../../../../shared/domain/value-objects/AggregateId");
|
|
5
|
+
const SemanticUuidPrefix_1 = require("../../../../shared/domain/enums/SemanticUuidPrefix");
|
|
6
|
+
const InvalidAggregatePrefixError_1 = require("../../../../shared/domain/exceptions/InvalidAggregatePrefixError");
|
|
7
|
+
class ReportContentGenerationJobId extends AggregateId_1.AggregateId {
|
|
8
|
+
constructor(value, skipDomainValidation) {
|
|
9
|
+
super(value, skipDomainValidation, ReportContentGenerationJobId.PROPERTY_NAME);
|
|
10
|
+
}
|
|
11
|
+
static create(value) {
|
|
12
|
+
AggregateId_1.AggregateId.guardAgainstEmptyValue(value, ReportContentGenerationJobId.PROPERTY_NAME);
|
|
13
|
+
AggregateId_1.AggregateId.guardAgainstInvalidType(value, ReportContentGenerationJobId.PROPERTY_NAME);
|
|
14
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(value, ReportContentGenerationJobId.PROPERTY_NAME);
|
|
15
|
+
ReportContentGenerationJobId.guardAgainstInvalidPrefix(value);
|
|
16
|
+
return new ReportContentGenerationJobId(value, false);
|
|
17
|
+
}
|
|
18
|
+
static guardAgainstInvalidPrefix(value) {
|
|
19
|
+
try {
|
|
20
|
+
const tempInstance = new ReportContentGenerationJobId(value, true);
|
|
21
|
+
const prefix = tempInstance.extractPrefix();
|
|
22
|
+
if (ReportContentGenerationJobId.VALID_PREFIXES.includes(prefix) === false) {
|
|
23
|
+
throw InvalidAggregatePrefixError_1.InvalidAggregatePrefixError.create(value, 'ReportContentGenerationJob', prefix, ReportContentGenerationJobId.VALID_PREFIXES, ReportContentGenerationJobId.PROPERTY_NAME);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
if (error instanceof InvalidAggregatePrefixError_1.InvalidAggregatePrefixError) {
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
throw InvalidAggregatePrefixError_1.InvalidAggregatePrefixError.create(value, 'ReportContentGenerationJob', 'UNKNOWN', ReportContentGenerationJobId.VALID_PREFIXES, ReportContentGenerationJobId.PROPERTY_NAME);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
static fromPrimitives(primitive) {
|
|
34
|
+
return new ReportContentGenerationJobId(primitive, true);
|
|
35
|
+
}
|
|
36
|
+
toPrimitives() {
|
|
37
|
+
return this.value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ReportContentGenerationJobId = ReportContentGenerationJobId;
|
|
41
|
+
ReportContentGenerationJobId.PROPERTY_NAME = 'id';
|
|
42
|
+
ReportContentGenerationJobId.VALID_PREFIXES = [
|
|
43
|
+
SemanticUuidPrefix_1.SemanticUuidPrefix.RPT_CONTENT_GENERATION_JOB,
|
|
44
|
+
];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobReportInstanceId = void 0;
|
|
4
|
+
const AggregateId_1 = require("../../../../shared/domain/value-objects/AggregateId");
|
|
5
|
+
class ReportContentGenerationJobReportInstanceId extends AggregateId_1.AggregateId {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, ReportContentGenerationJobReportInstanceId.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
AggregateId_1.AggregateId.guardAgainstEmptyValue(value, ReportContentGenerationJobReportInstanceId.PROPERTY_NAME);
|
|
11
|
+
AggregateId_1.AggregateId.guardAgainstInvalidType(value, ReportContentGenerationJobReportInstanceId.PROPERTY_NAME);
|
|
12
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(value, ReportContentGenerationJobReportInstanceId.PROPERTY_NAME);
|
|
13
|
+
return new ReportContentGenerationJobReportInstanceId(value, false);
|
|
14
|
+
}
|
|
15
|
+
static fromPrimitives(primitive) {
|
|
16
|
+
return new ReportContentGenerationJobReportInstanceId(primitive, true);
|
|
17
|
+
}
|
|
18
|
+
toPrimitives() {
|
|
19
|
+
return this.value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ReportContentGenerationJobReportInstanceId = ReportContentGenerationJobReportInstanceId;
|
|
23
|
+
ReportContentGenerationJobReportInstanceId.PROPERTY_NAME = 'reportInstanceId';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobRequestedByStakeholderId = void 0;
|
|
4
|
+
const AggregateId_1 = require("../../../../shared/domain/value-objects/AggregateId");
|
|
5
|
+
class ReportContentGenerationJobRequestedByStakeholderId extends AggregateId_1.AggregateId {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, ReportContentGenerationJobRequestedByStakeholderId.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
AggregateId_1.AggregateId.guardAgainstEmptyValue(value, ReportContentGenerationJobRequestedByStakeholderId.PROPERTY_NAME);
|
|
11
|
+
AggregateId_1.AggregateId.guardAgainstInvalidType(value, ReportContentGenerationJobRequestedByStakeholderId.PROPERTY_NAME);
|
|
12
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(value, ReportContentGenerationJobRequestedByStakeholderId.PROPERTY_NAME);
|
|
13
|
+
return new ReportContentGenerationJobRequestedByStakeholderId(value, false);
|
|
14
|
+
}
|
|
15
|
+
static fromPrimitives(primitive) {
|
|
16
|
+
return new ReportContentGenerationJobRequestedByStakeholderId(primitive, true);
|
|
17
|
+
}
|
|
18
|
+
toPrimitives() {
|
|
19
|
+
return this.value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ReportContentGenerationJobRequestedByStakeholderId = ReportContentGenerationJobRequestedByStakeholderId;
|
|
23
|
+
ReportContentGenerationJobRequestedByStakeholderId.PROPERTY_NAME = 'requestedByStakeholderId';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobStartedAt = void 0;
|
|
4
|
+
const NullableDateTimeString_1 = require("../../../../shared/domain/value-objects/NullableDateTimeString");
|
|
5
|
+
class ReportContentGenerationJobStartedAt extends NullableDateTimeString_1.NullableDateTimeString {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, ReportContentGenerationJobStartedAt.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
return new ReportContentGenerationJobStartedAt(value, false);
|
|
11
|
+
}
|
|
12
|
+
static fromPrimitives(primitive) {
|
|
13
|
+
return new ReportContentGenerationJobStartedAt(primitive, true);
|
|
14
|
+
}
|
|
15
|
+
toPrimitives() {
|
|
16
|
+
return this.value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ReportContentGenerationJobStartedAt = ReportContentGenerationJobStartedAt;
|
|
20
|
+
ReportContentGenerationJobStartedAt.PROPERTY_NAME = 'startedAt';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobStatus = void 0;
|
|
4
|
+
const InvalidPropertyValueError_1 = require("../../../../shared/domain/exceptions/InvalidPropertyValueError");
|
|
5
|
+
const String_1 = require("../../../../shared/domain/value-objects/String");
|
|
6
|
+
const ReportContentGenerationStatus_1 = require("../enums/ReportContentGenerationStatus");
|
|
7
|
+
class ReportContentGenerationJobStatus extends String_1.String {
|
|
8
|
+
constructor(value, skipDomainValidation) {
|
|
9
|
+
super(value, skipDomainValidation, ReportContentGenerationJobStatus.PROPERTY_NAME);
|
|
10
|
+
if (skipDomainValidation === false) {
|
|
11
|
+
ReportContentGenerationJobStatus.validateStatus(value);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
static create(value) {
|
|
15
|
+
String_1.String.guardAgainstEmptyValue(value, ReportContentGenerationJobStatus.PROPERTY_NAME);
|
|
16
|
+
String_1.String.guardAgainstInvalidType(value, ReportContentGenerationJobStatus.PROPERTY_NAME);
|
|
17
|
+
return new ReportContentGenerationJobStatus(value, false);
|
|
18
|
+
}
|
|
19
|
+
static fromPrimitives(primitive) {
|
|
20
|
+
return new ReportContentGenerationJobStatus(primitive, true);
|
|
21
|
+
}
|
|
22
|
+
static validateStatus(value) {
|
|
23
|
+
if (!ReportContentGenerationJobStatus.VALID_STATUSES.includes(value)) {
|
|
24
|
+
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(ReportContentGenerationJobStatus.PROPERTY_NAME, `one of ${ReportContentGenerationJobStatus.VALID_STATUSES.join(', ')}`, value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
isQueued() {
|
|
28
|
+
return this.value === ReportContentGenerationStatus_1.ReportContentGenerationStatus.QUEUED;
|
|
29
|
+
}
|
|
30
|
+
isProcessing() {
|
|
31
|
+
return this.value === ReportContentGenerationStatus_1.ReportContentGenerationStatus.PROCESSING;
|
|
32
|
+
}
|
|
33
|
+
isCompleted() {
|
|
34
|
+
return this.value === ReportContentGenerationStatus_1.ReportContentGenerationStatus.COMPLETED;
|
|
35
|
+
}
|
|
36
|
+
isFailed() {
|
|
37
|
+
return this.value === ReportContentGenerationStatus_1.ReportContentGenerationStatus.FAILED;
|
|
38
|
+
}
|
|
39
|
+
isFinal() {
|
|
40
|
+
return this.isCompleted() || this.isFailed();
|
|
41
|
+
}
|
|
42
|
+
canTransitionToProcessing() {
|
|
43
|
+
return this.isQueued() || this.isProcessing();
|
|
44
|
+
}
|
|
45
|
+
canTransitionToCompleted() {
|
|
46
|
+
return this.isProcessing();
|
|
47
|
+
}
|
|
48
|
+
canTransitionToFailed() {
|
|
49
|
+
return this.isQueued() || this.isProcessing();
|
|
50
|
+
}
|
|
51
|
+
toEnum() {
|
|
52
|
+
return this.value;
|
|
53
|
+
}
|
|
54
|
+
toPrimitives() {
|
|
55
|
+
return this.value;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.ReportContentGenerationJobStatus = ReportContentGenerationJobStatus;
|
|
59
|
+
ReportContentGenerationJobStatus.PROPERTY_NAME = 'status';
|
|
60
|
+
ReportContentGenerationJobStatus.VALID_STATUSES = Object.values(ReportContentGenerationStatus_1.ReportContentGenerationStatus);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportContentGenerationJobUpdatedAt = void 0;
|
|
4
|
+
const DateTimeString_1 = require("../../../../shared/domain/value-objects/DateTimeString");
|
|
5
|
+
class ReportContentGenerationJobUpdatedAt extends DateTimeString_1.DateTimeString {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, ReportContentGenerationJobUpdatedAt.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
return new ReportContentGenerationJobUpdatedAt(value, false);
|
|
11
|
+
}
|
|
12
|
+
static fromPrimitives(primitive) {
|
|
13
|
+
return new ReportContentGenerationJobUpdatedAt(primitive, true);
|
|
14
|
+
}
|
|
15
|
+
toPrimitives() {
|
|
16
|
+
return this.value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ReportContentGenerationJobUpdatedAt = ReportContentGenerationJobUpdatedAt;
|
|
20
|
+
ReportContentGenerationJobUpdatedAt.PROPERTY_NAME = 'updatedAt';
|
|
@@ -43,9 +43,10 @@ var DataBindingSource;
|
|
|
43
43
|
DataBindingSource["AGGREGATION_GAS_N2O"] = "aggregation.gas.n2o";
|
|
44
44
|
// Aggregations - By Segment
|
|
45
45
|
DataBindingSource["AGGREGATION_BY_SEGMENT"] = "aggregation.bySegment";
|
|
46
|
-
// Aggregations - Biogenic
|
|
47
|
-
|
|
46
|
+
// Aggregations - Biogenic CO₂ (informational item OUTSIDE the inventory total and the scopes,
|
|
47
|
+
// GHG Protocol cap. 9 / ISO 14064-1 §9.3.1): the `CO2-BIOGENIC` species, total and per source.
|
|
48
48
|
DataBindingSource["AGGREGATION_BIOGENIC_CO2"] = "aggregation.biogenicCO2";
|
|
49
|
+
DataBindingSource["AGGREGATION_BIOGENIC_CO2_BY_SOURCE"] = "aggregation.biogenicCO2.bySource";
|
|
49
50
|
// Aggregations - Uncertainty (GAP 4): inventory-level propagated uncertainty
|
|
50
51
|
DataBindingSource["AGGREGATION_UNCERTAINTY_PERCENTAGE"] = "aggregation.uncertainty.percentage";
|
|
51
52
|
DataBindingSource["AGGREGATION_UNCERTAINTY_LEVEL"] = "aggregation.uncertainty.level";
|
|
@@ -164,6 +164,7 @@ var ErrorCode;
|
|
|
164
164
|
ErrorCode["INVALID_PREPARATION_QUESTION"] = "CBX-RPT-026";
|
|
165
165
|
ErrorCode["INVALID_REPORT_BLOCK_DATA_BINDING"] = "CBX-RPT-027";
|
|
166
166
|
ErrorCode["INVALID_REPORT_ASSURANCE"] = "CBX-RPT-028";
|
|
167
|
+
ErrorCode["REPORT_CONTENT_GENERATION_JOB_INVALID_STATUS_TRANSITION"] = "CBX-RPT-029";
|
|
167
168
|
// Shared/Common Errors (CBX-SHR-XXX)
|
|
168
169
|
ErrorCode["INVALID_EMAIL"] = "CBX-SHR-001";
|
|
169
170
|
ErrorCode["INVALID_DATE_FORMAT"] = "CBX-SHR-002";
|
|
@@ -85,6 +85,7 @@ var SemanticUuidPrefix;
|
|
|
85
85
|
SemanticUuidPrefix["RPT_BLOCK"] = "RPT-BLK";
|
|
86
86
|
SemanticUuidPrefix["RPT_PREPARATION_QUESTIONNAIRE"] = "RPT-PRE";
|
|
87
87
|
SemanticUuidPrefix["RPT_PREPARATION_QUESTION"] = "RPT-PRE-QST";
|
|
88
|
+
SemanticUuidPrefix["RPT_CONTENT_GENERATION_JOB"] = "RPT-CGJ";
|
|
88
89
|
// Future expansion examples (when system grows):
|
|
89
90
|
// ADC_SUB_FIELDS = 'ADC-SUB-FLD', // Activity Data Collection -> Submissions -> Fields
|
|
90
91
|
// USR_STH_CHO_MGT = 'USR-STH-CHO-MGT', // Users -> Stakeholders -> Carbon Host -> Management
|