@carbonbox/domain 0.4.13 → 0.4.14
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/activity-data-collection/activity-data-submissions/domain/value-objects/ActivityDataSubmissionId.js +1 -1
- package/build/carbonbox/activity-data-collection/collection-fields/domain/value-objects/CollectionFieldId.js +1 -1
- package/build/carbonbox/activity-data-collection/conditional-logic/domain/value-objects/ConditionalFieldRuleId.js +1 -1
- package/build/carbonbox/activity-data-collection/contextual-labels/domain/value-objects/ContextualLabelId.js +1 -1
- package/build/carbonbox/activity-data-collection/dynamic-forms/domain/value-objects/DynamicFormId.js +1 -1
- package/build/carbonbox/activity-data-collection/stakeholder-adaptations/domain/value-objects/StakeholderAdaptationId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/segments/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/segments/subsegments/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/corporate-configurations/domain/value-objects/CorporateCarbonFootprintConfigurationId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/event-configurations/domain/value-objects/EventCarbonFootprintConfigurationId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/domain/value-objects/EventEditionLifecycleStageConfigurationId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/event-edition-lifecycle-stages/domain/value-objects/EventEditionLifecycleStageId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/product-configurations/domain/value-objects/ProductCarbonFootprintConfigurationId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/domain/value-objects/ProductCarbonFootprintSegmentConfigurationId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/segments/domain/value-objects/ProductConfigurationCarbonFootprintSegmentId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/segments/subsegments/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/product-configurations/system-boundaries/domain/value-objects/ProductConfigurationSystemBoundaryId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/shared/domain/value-objects/CarbonFootprintConfigurationId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/shared/domain/value-objects/CarbonFootprintConfigurationIntensityIndicatorConfigurations.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/shared/domain/value-objects/CarbonFootprintIntensityIndicatorId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/shared/domain/value-objects/CarbonFootprintSegmentId.js +1 -1
- package/build/carbonbox/carbon-footprint-configurations/shared/domain/value-objects/CarbonFootprintSubsegmentId.js +1 -1
- package/build/carbonbox/company-resources/events/domain/value-objects/EventId.js +1 -1
- package/build/carbonbox/company-resources/events/editions/domain/value-objects/EventEditionId.js +1 -1
- package/build/carbonbox/company-resources/facilities/domain/value-objects/FacilityId.js +1 -1
- package/build/carbonbox/company-resources/products/domain/value-objects/ProductId.js +1 -1
- package/build/carbonbox/emission-calculation-formulas/calculation-variables/domain/value-objects/CalculationVariableActivityDataConditions.js +1 -1
- package/build/carbonbox/emission-calculation-formulas/calculation-variables/domain/value-objects/CalculationVariableId.js +1 -1
- package/build/carbonbox/emission-calculation-formulas/domain/value-objects/EmissionCalculationFormulaId.js +1 -1
- package/build/carbonbox/emission-calculation-formulas/emission-factors/domain/value-objects/EmissionFactorId.js +1 -1
- package/build/carbonbox/emission-calculation-formulas/global-warming-potentials/domain/value-objects/GlobalWarmingPotentialId.js +1 -1
- package/build/carbonbox/emission-calculation-process/calculation-jobs/domain/value-objects/CalculationJobId.js +1 -1
- package/build/carbonbox/emission-calculation-process/calculation-processes/domain/value-objects/CalculationProcessId.js +1 -1
- package/build/carbonbox/emission-calculation-process/calculation-workflows/domain/value-objects/CalculationWorkflowId.js +1 -1
- package/build/carbonbox/emission-calculation-process/calculation-workflows/domain/value-objects/CalculationWorkflowParallelJobs.js +1 -1
- package/build/carbonbox/emission-calculation-results/emission-aggregations/domain/value-objects/EmissionAggregationId.js +1 -1
- package/build/carbonbox/emission-calculation-results/emission-calculations/domain/value-objects/EmissionCalculationId.js +1 -1
- package/build/carbonbox/emission-calculation-results/ghg-emission-results/domain/value-objects/GHGEmissionResultId.js +1 -1
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/value-objects/PurchaseContractCarbonClientId.js +1 -1
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/value-objects/PurchaseContractContractAmendments.js +1 -1
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/value-objects/PurchaseContractId.js +1 -1
- package/build/carbonbox/purchase-management-system/purchase-orders/domain/value-objects/PurchaseOrderCarbonClientId.js +1 -1
- package/build/carbonbox/purchase-management-system/purchase-orders/domain/value-objects/PurchaseOrderId.js +1 -1
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceCatalogId.js +1 -1
- package/build/carbonbox/purchase-management-system/service-pricing/domain/value-objects/ServicePricingId.js +1 -1
- package/build/carbonbox/shared/domain/exceptions/InvalidAggregateIdFormatError.js +19 -0
- package/build/carbonbox/shared/domain/services/contracts/IAggregateIdDomainService.js +2 -0
- package/build/carbonbox/shared/domain/services/implementations/AggregateIdDomainService.js +290 -0
- package/build/carbonbox/shared/domain/value-objects/ActivityDataSubmissionReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/AggregateId.js +34 -38
- package/build/carbonbox/shared/domain/value-objects/AggregateIdList.js +3 -3
- package/build/carbonbox/shared/domain/value-objects/CalculationProcessReference.js +3 -3
- package/build/carbonbox/shared/domain/value-objects/CalculationVariableReferences.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/CarbonClientReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/CollectionFieldReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.js +2 -2
- package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/EmissionCalculationFormulaReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/EmissionCalculationReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/EmissionFactorReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.js +2 -2
- package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/EventEditionReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/EventEditionReferences.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/EventReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/FacilityReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/GlobalWarmingPotentialReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.js +2 -2
- package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/ProductConfigurationSystemBoundaryReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/ProductReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/ServiceCatalogReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/StakeholderReference.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/StakeholderReferences.js +1 -1
- package/build/carbonbox/shared/domain/value-objects/UserId.js +1 -1
- package/build/carbonbox/stakeholders/carbon-clients/domain/value-objects/CarbonClientId.js +1 -1
- package/build/carbonbox/stakeholders/carbon-coordinators/domain/value-objects/CarbonCoordinatorId.js +1 -1
- package/build/carbonbox/stakeholders/carbon-host/domain/value-objects/CarbonHostId.js +1 -1
- package/build/carbonbox/stakeholders/carbon-managers/domain/value-objects/CarbonManagerId.js +1 -1
- package/build/carbonbox/stakeholders/shared/domain/value-objects/StakeholderId.js +1 -1
- package/build/main/index.js +6 -6
- package/build/types/carbonbox/shared/domain/exceptions/InvalidAggregateIdFormatError.d.ts +8 -0
- package/build/types/carbonbox/shared/domain/exceptions/InvalidAggregateIdFormatError.d.ts.map +1 -0
- package/build/types/carbonbox/shared/domain/services/contracts/IAggregateIdDomainService.d.ts +85 -0
- package/build/types/carbonbox/shared/domain/services/contracts/IAggregateIdDomainService.d.ts.map +1 -0
- package/build/types/carbonbox/shared/domain/services/implementations/AggregateIdDomainService.d.ts +67 -0
- package/build/types/carbonbox/shared/domain/services/implementations/AggregateIdDomainService.d.ts.map +1 -0
- package/build/types/carbonbox/shared/domain/value-objects/AggregateId.d.ts +17 -19
- package/build/types/carbonbox/shared/domain/value-objects/AggregateId.d.ts.map +1 -1
- package/build/types/main/index.d.ts +3 -3
- package/build/types/main/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AggregateIdDomainService = void 0;
|
|
4
|
+
const either_1 = require("../../../either");
|
|
5
|
+
const SemanticUuidPrefix_1 = require("../../enums/SemanticUuidPrefix");
|
|
6
|
+
const InvalidAggregateIdFormatError_1 = require("../../exceptions/InvalidAggregateIdFormatError");
|
|
7
|
+
const UnknownBoundedContextCodeError_1 = require("../../exceptions/UnknownBoundedContextCodeError");
|
|
8
|
+
const InvalidSemanticUuidFormatError_1 = require("../../exceptions/InvalidSemanticUuidFormatError");
|
|
9
|
+
const InvalidUuidFormatError_1 = require("../../exceptions/InvalidUuidFormatError");
|
|
10
|
+
/**
|
|
11
|
+
* Domain Service for aggregate ID parsing, validation and business logic operations.
|
|
12
|
+
* Provides centralized business logic for aggregate ID handling across the domain.
|
|
13
|
+
* Refactored to support dependency injection and Either pattern for error handling.
|
|
14
|
+
*
|
|
15
|
+
* This service maintains Value Object purity by being used in factories,
|
|
16
|
+
* application services, and other appropriate contexts.
|
|
17
|
+
*/
|
|
18
|
+
class AggregateIdDomainService {
|
|
19
|
+
constructor() {
|
|
20
|
+
// Aggregate ID format: BC_ID or BC-SUB1-SUB2-...SUBn_ID
|
|
21
|
+
this.AGGREGATE_ID_REGEX = /^[A-Z]{3}(-[A-Z]{3})*_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
22
|
+
// Standard ID regex (UUID v4 format)
|
|
23
|
+
this.ID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
24
|
+
// Private constructor to enforce factory pattern
|
|
25
|
+
}
|
|
26
|
+
static create() {
|
|
27
|
+
return new AggregateIdDomainService();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validates if a string is a valid aggregate ID prefix
|
|
31
|
+
*/
|
|
32
|
+
isValidPrefix(prefix) {
|
|
33
|
+
return either_1.EitherFactory.fromTryCatch(() => {
|
|
34
|
+
if (typeof prefix !== 'string') {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return Object.values(SemanticUuidPrefix_1.SemanticUuidPrefix).includes(prefix);
|
|
38
|
+
}, (error) => {
|
|
39
|
+
if (error instanceof InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError) {
|
|
40
|
+
return error;
|
|
41
|
+
}
|
|
42
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(prefix, 'Failed to validate prefix');
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets the bounded context name from an aggregate ID prefix
|
|
47
|
+
*/
|
|
48
|
+
getBoundedContext(prefix) {
|
|
49
|
+
return either_1.EitherFactory.fromTryCatch(() => {
|
|
50
|
+
const boundedContextMap = {
|
|
51
|
+
// BC-Level entities
|
|
52
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.STC]: 'System Technical Configuration',
|
|
53
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.USR]: 'Users',
|
|
54
|
+
// Activity Data Collection bounded context
|
|
55
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_SUBMISSIONS]: 'Activity Data Collection Submissions',
|
|
56
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_FIELDS]: 'Activity Data Collection Fields',
|
|
57
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_LOGIC]: 'Activity Data Collection Logic',
|
|
58
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_LABELS]: 'Activity Data Collection Labels',
|
|
59
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_FORMS]: 'Activity Data Collection Forms',
|
|
60
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_ADAPTATIONS]: 'Activity Data Collection Adaptations',
|
|
61
|
+
// Carbon Footprint Configurations bounded context
|
|
62
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.CFC_CORPORATE]: 'Carbon Footprint Corporate Configuration',
|
|
63
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.CFC_EVENT]: 'Carbon Footprint Event Configuration',
|
|
64
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.CFC_PRODUCT]: 'Carbon Footprint Product Configuration',
|
|
65
|
+
// Company Resources bounded context
|
|
66
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.CPR_EVENTS]: 'Company Resources Events',
|
|
67
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.CPR_FACILITIES]: 'Company Resources Facilities',
|
|
68
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.CPR_PRODUCTS]: 'Company Resources Products',
|
|
69
|
+
// Emission Calculation Formulas bounded context
|
|
70
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ECF_VARIABLES]: 'Emission Calculation Formula Variables',
|
|
71
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ECF_FACTORS]: 'Emission Calculation Formula Factors',
|
|
72
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ECF_GWP]: 'Emission Calculation Formula GWP',
|
|
73
|
+
// Emission Calculation Process bounded context
|
|
74
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ECP_JOBS]: 'Emission Calculation Process Jobs',
|
|
75
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ECP_PROCESSES]: 'Emission Calculation Process Processes',
|
|
76
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ECP_WORKFLOWS]: 'Emission Calculation Process Workflows',
|
|
77
|
+
// Emission Calculation Results bounded context
|
|
78
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ECR_AGGREGATIONS]: 'Emission Calculation Results Aggregations',
|
|
79
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ECR_CALCULATIONS]: 'Emission Calculation Results Calculations',
|
|
80
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.ECR_GHG_RESULTS]: 'Emission Calculation Results GHG',
|
|
81
|
+
// Users - Stakeholders
|
|
82
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_CLIENT]: 'User Stakeholder Client',
|
|
83
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_COORDINATOR]: 'User Stakeholder Coordinator',
|
|
84
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_HOST]: 'User Stakeholder Carbon Host',
|
|
85
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_MANAGER]: 'User Stakeholder Manager',
|
|
86
|
+
// Shared Domain
|
|
87
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.SHR_DOMAIN]: 'Shared Domain',
|
|
88
|
+
[SemanticUuidPrefix_1.SemanticUuidPrefix.SHR_EITHER]: 'Shared Either',
|
|
89
|
+
};
|
|
90
|
+
const boundedContext = boundedContextMap[prefix];
|
|
91
|
+
if (!boundedContext) {
|
|
92
|
+
throw UnknownBoundedContextCodeError_1.UnknownBoundedContextCodeError.create(prefix, 'Unknown bounded context for prefix');
|
|
93
|
+
}
|
|
94
|
+
return boundedContext;
|
|
95
|
+
}, (error) => {
|
|
96
|
+
if (error instanceof InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError || error instanceof UnknownBoundedContextCodeError_1.UnknownBoundedContextCodeError) {
|
|
97
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(prefix, error.message);
|
|
98
|
+
}
|
|
99
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(prefix, 'Failed to get bounded context');
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Gets the subdomain from an aggregate ID prefix
|
|
104
|
+
*/
|
|
105
|
+
getSubdomain(prefix) {
|
|
106
|
+
return either_1.EitherFactory.fromTryCatch(() => {
|
|
107
|
+
// Extract subdomain from prefix (everything after the first hyphen)
|
|
108
|
+
if (!prefix.includes('-')) {
|
|
109
|
+
return ''; // No subdomain for BC-level prefixes
|
|
110
|
+
}
|
|
111
|
+
const parts = prefix.split('-');
|
|
112
|
+
return parts.slice(1).join('-'); // Return all subdomain parts joined
|
|
113
|
+
}, (error) => {
|
|
114
|
+
if (error instanceof InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError) {
|
|
115
|
+
return error;
|
|
116
|
+
}
|
|
117
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(prefix, 'Failed to extract subdomain');
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Gets all available prefixes as an array
|
|
122
|
+
*/
|
|
123
|
+
getAllPrefixes() {
|
|
124
|
+
return either_1.EitherFactory.fromTryCatch(() => Object.values(SemanticUuidPrefix_1.SemanticUuidPrefix), (error) => {
|
|
125
|
+
if (error instanceof InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError) {
|
|
126
|
+
return error;
|
|
127
|
+
}
|
|
128
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create('', 'Failed to get all prefixes');
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Gets prefixes by bounded context
|
|
133
|
+
*/
|
|
134
|
+
getPrefixesByBoundedContext(boundedContext) {
|
|
135
|
+
return either_1.EitherFactory.fromTryCatch(() => {
|
|
136
|
+
const prefixesByContext = {
|
|
137
|
+
'Activity Data Collection Submissions': [SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_SUBMISSIONS],
|
|
138
|
+
'Activity Data Collection Fields': [SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_FIELDS],
|
|
139
|
+
'Activity Data Collection Logic': [SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_LOGIC],
|
|
140
|
+
'Activity Data Collection Labels': [SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_LABELS],
|
|
141
|
+
'Activity Data Collection Forms': [SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_FORMS],
|
|
142
|
+
'Activity Data Collection Adaptations': [SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_ADAPTATIONS],
|
|
143
|
+
'Carbon Footprint Corporate Configuration': [SemanticUuidPrefix_1.SemanticUuidPrefix.CFC_CORPORATE],
|
|
144
|
+
'Carbon Footprint Event Configuration': [SemanticUuidPrefix_1.SemanticUuidPrefix.CFC_EVENT],
|
|
145
|
+
'Carbon Footprint Product Configuration': [SemanticUuidPrefix_1.SemanticUuidPrefix.CFC_PRODUCT],
|
|
146
|
+
'Company Resources Events': [SemanticUuidPrefix_1.SemanticUuidPrefix.CPR_EVENTS],
|
|
147
|
+
'Company Resources Facilities': [SemanticUuidPrefix_1.SemanticUuidPrefix.CPR_FACILITIES],
|
|
148
|
+
'Company Resources Products': [SemanticUuidPrefix_1.SemanticUuidPrefix.CPR_PRODUCTS],
|
|
149
|
+
'Emission Calculation Formula Variables': [SemanticUuidPrefix_1.SemanticUuidPrefix.ECF_VARIABLES],
|
|
150
|
+
'Emission Calculation Formula Factors': [SemanticUuidPrefix_1.SemanticUuidPrefix.ECF_FACTORS],
|
|
151
|
+
'Emission Calculation Formula GWP': [SemanticUuidPrefix_1.SemanticUuidPrefix.ECF_GWP],
|
|
152
|
+
'Emission Calculation Process Jobs': [SemanticUuidPrefix_1.SemanticUuidPrefix.ECP_JOBS],
|
|
153
|
+
'Emission Calculation Process Processes': [SemanticUuidPrefix_1.SemanticUuidPrefix.ECP_PROCESSES],
|
|
154
|
+
'Emission Calculation Process Workflows': [SemanticUuidPrefix_1.SemanticUuidPrefix.ECP_WORKFLOWS],
|
|
155
|
+
'Emission Calculation Results Aggregations': [SemanticUuidPrefix_1.SemanticUuidPrefix.ECR_AGGREGATIONS],
|
|
156
|
+
'Emission Calculation Results Calculations': [SemanticUuidPrefix_1.SemanticUuidPrefix.ECR_CALCULATIONS],
|
|
157
|
+
'Emission Calculation Results GHG': [SemanticUuidPrefix_1.SemanticUuidPrefix.ECR_GHG_RESULTS],
|
|
158
|
+
'System Technical Configuration': [SemanticUuidPrefix_1.SemanticUuidPrefix.STC],
|
|
159
|
+
Users: [SemanticUuidPrefix_1.SemanticUuidPrefix.USR],
|
|
160
|
+
'User Stakeholder Client': [SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_CLIENT],
|
|
161
|
+
'User Stakeholder Coordinator': [SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_COORDINATOR],
|
|
162
|
+
'User Stakeholder Carbon Host': [SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_HOST],
|
|
163
|
+
'User Stakeholder Manager': [SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_MANAGER],
|
|
164
|
+
'Shared Domain': [SemanticUuidPrefix_1.SemanticUuidPrefix.SHR_DOMAIN],
|
|
165
|
+
'Shared Either': [SemanticUuidPrefix_1.SemanticUuidPrefix.SHR_EITHER],
|
|
166
|
+
};
|
|
167
|
+
const prefixes = prefixesByContext[boundedContext];
|
|
168
|
+
if (!prefixes) {
|
|
169
|
+
throw UnknownBoundedContextCodeError_1.UnknownBoundedContextCodeError.create(boundedContext, 'Unknown bounded context');
|
|
170
|
+
}
|
|
171
|
+
return prefixes;
|
|
172
|
+
}, (error) => {
|
|
173
|
+
if (error instanceof InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError || error instanceof UnknownBoundedContextCodeError_1.UnknownBoundedContextCodeError) {
|
|
174
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(boundedContext, error.message);
|
|
175
|
+
}
|
|
176
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(boundedContext, 'Failed to get prefixes by bounded context');
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Validates a complete aggregate ID format
|
|
181
|
+
*/
|
|
182
|
+
validateAggregateIdFormat(aggregateId) {
|
|
183
|
+
return either_1.EitherFactory.fromTryCatch(() => {
|
|
184
|
+
if (typeof aggregateId !== 'string') {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
return this.AGGREGATE_ID_REGEX.test(aggregateId);
|
|
188
|
+
}, (error) => {
|
|
189
|
+
if (error instanceof InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError) {
|
|
190
|
+
return error;
|
|
191
|
+
}
|
|
192
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(aggregateId, 'Failed to validate aggregate ID format');
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Extracts and validates the prefix from an aggregate ID
|
|
197
|
+
*/
|
|
198
|
+
extractPrefix(aggregateId) {
|
|
199
|
+
return either_1.EitherFactory.fromTryCatch(() => {
|
|
200
|
+
if (!this.AGGREGATE_ID_REGEX.test(aggregateId)) {
|
|
201
|
+
throw InvalidSemanticUuidFormatError_1.InvalidSemanticUuidFormatError.create(aggregateId, 'Invalid aggregate ID format');
|
|
202
|
+
}
|
|
203
|
+
const parts = aggregateId.split('_');
|
|
204
|
+
if (parts.length !== 2) {
|
|
205
|
+
throw InvalidSemanticUuidFormatError_1.InvalidSemanticUuidFormatError.create(aggregateId, 'Invalid aggregate ID structure');
|
|
206
|
+
}
|
|
207
|
+
return parts[0];
|
|
208
|
+
}, (error) => {
|
|
209
|
+
if (error instanceof InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError || error instanceof InvalidSemanticUuidFormatError_1.InvalidSemanticUuidFormatError) {
|
|
210
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(aggregateId, error.message);
|
|
211
|
+
}
|
|
212
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(aggregateId, 'Failed to extract prefix');
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Extracts and validates the ID from an aggregate ID
|
|
217
|
+
*/
|
|
218
|
+
extractId(aggregateId) {
|
|
219
|
+
return either_1.EitherFactory.fromTryCatch(() => {
|
|
220
|
+
if (!this.AGGREGATE_ID_REGEX.test(aggregateId)) {
|
|
221
|
+
throw InvalidSemanticUuidFormatError_1.InvalidSemanticUuidFormatError.create(aggregateId, 'Invalid aggregate ID format');
|
|
222
|
+
}
|
|
223
|
+
const parts = aggregateId.split('_');
|
|
224
|
+
if (parts.length !== 2) {
|
|
225
|
+
throw InvalidSemanticUuidFormatError_1.InvalidSemanticUuidFormatError.create(aggregateId, 'Invalid aggregate ID structure');
|
|
226
|
+
}
|
|
227
|
+
const rawId = parts[1];
|
|
228
|
+
if (!this.ID_REGEX.test(rawId)) {
|
|
229
|
+
throw InvalidUuidFormatError_1.InvalidUuidFormatError.create(rawId, 'Invalid ID format');
|
|
230
|
+
}
|
|
231
|
+
return rawId;
|
|
232
|
+
}, (error) => {
|
|
233
|
+
if (error instanceof InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError
|
|
234
|
+
|| error instanceof InvalidSemanticUuidFormatError_1.InvalidSemanticUuidFormatError
|
|
235
|
+
|| error instanceof InvalidUuidFormatError_1.InvalidUuidFormatError) {
|
|
236
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(aggregateId, error.message);
|
|
237
|
+
}
|
|
238
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(aggregateId, 'Failed to extract ID');
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Extracts the bounded context code (first 3 letters) from an aggregate ID
|
|
243
|
+
*/
|
|
244
|
+
extractBoundedContextCode(aggregateId) {
|
|
245
|
+
return this.extractPrefix(aggregateId).flatMap((prefix) => either_1.EitherFactory.fromTryCatch(() => prefix.substring(0, 3), (error) => {
|
|
246
|
+
if (error instanceof InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError) {
|
|
247
|
+
return error;
|
|
248
|
+
}
|
|
249
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(aggregateId, 'Failed to extract bounded context code');
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Extracts all subdomain parts from an aggregate ID
|
|
254
|
+
*/
|
|
255
|
+
extractSubdomains(aggregateId) {
|
|
256
|
+
return this.extractPrefix(aggregateId).flatMap((prefix) => either_1.EitherFactory.fromTryCatch(() => {
|
|
257
|
+
const parts = prefix.split('-');
|
|
258
|
+
// Remove the first part (BC) and return the rest (SUB1, SUB2, ...)
|
|
259
|
+
return parts.slice(1);
|
|
260
|
+
}, (error) => {
|
|
261
|
+
if (error instanceof InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError) {
|
|
262
|
+
return error;
|
|
263
|
+
}
|
|
264
|
+
return InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(aggregateId, 'Failed to extract subdomains');
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Checks if an aggregate ID has subdomains or is BC-level only
|
|
269
|
+
*/
|
|
270
|
+
hasSubdomains(aggregateId) {
|
|
271
|
+
return this.extractSubdomains(aggregateId).map((subdomains) => subdomains.length > 0);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Creates a human-readable log representation of an aggregate ID
|
|
275
|
+
*/
|
|
276
|
+
toLogString(aggregateId) {
|
|
277
|
+
return this.extractPrefix(aggregateId)
|
|
278
|
+
.flatMap((prefix) => this.extractId(aggregateId).map((id) => ({ prefix, id })))
|
|
279
|
+
.flatMap(({ prefix, id }) => this.getBoundedContext(prefix).map((boundedContext) => ({
|
|
280
|
+
prefix,
|
|
281
|
+
id,
|
|
282
|
+
boundedContext,
|
|
283
|
+
})))
|
|
284
|
+
.map(({ prefix, id, boundedContext }) => {
|
|
285
|
+
const shortId = id.substring(0, 8);
|
|
286
|
+
return `[${boundedContext}] ${prefix}_${shortId}...`;
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
exports.AggregateIdDomainService = AggregateIdDomainService;
|
|
@@ -88,7 +88,7 @@ class ActivityDataSubmissionReference extends ObjectValueObject_1.ObjectValueObj
|
|
|
88
88
|
*/
|
|
89
89
|
static guardAgainstInvalidId(id) {
|
|
90
90
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
91
|
-
AggregateId_1.AggregateId.
|
|
91
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* Valida el código del formulario dinámico.
|
|
@@ -3,18 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AggregateId = void 0;
|
|
4
4
|
const String_1 = require("./String");
|
|
5
5
|
const InvalidAggregateIdError_1 = require("../exceptions/InvalidAggregateIdError");
|
|
6
|
-
const
|
|
6
|
+
const InvalidAggregateIdFormatError_1 = require("../exceptions/InvalidAggregateIdFormatError");
|
|
7
7
|
/**
|
|
8
|
-
* Pure AggregateId Value Object with
|
|
8
|
+
* Pure AggregateId Value Object with structured ID format
|
|
9
9
|
*
|
|
10
|
-
* Format: {BC}_{
|
|
10
|
+
* Format: {BC}_{ID} or {BC}-{SUB1}-{SUB2}-...{SUBn}_{ID}
|
|
11
11
|
* Examples:
|
|
12
12
|
* - STC_550e8400-e29b-41d4-a716-446655440000 (BC-level entity)
|
|
13
13
|
* - USR-STH-CHO_550e8400-e29b-41d4-a716-446655440000 (subdomain entity)
|
|
14
14
|
* - ADC-SUB-FLD_123e4567-e89b-12d3-a456-426614174000 (future N-level expansion)
|
|
15
15
|
*
|
|
16
16
|
* This is a PURE Value Object - no external dependencies or business logic.
|
|
17
|
-
* For semantic parsing and business logic, use SemanticUuidDomainService.
|
|
18
17
|
*
|
|
19
18
|
* Benefits:
|
|
20
19
|
* - Immutable and pure value object design
|
|
@@ -26,7 +25,7 @@ class AggregateId extends String_1.String {
|
|
|
26
25
|
constructor(value, skipDomainValidation, propertyName = AggregateId.DEFAULT_PROPERTY_NAME) {
|
|
27
26
|
super(value, skipDomainValidation, propertyName);
|
|
28
27
|
if (skipDomainValidation === false) {
|
|
29
|
-
AggregateId.
|
|
28
|
+
AggregateId.guardAgainstInvalidId(value, propertyName);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
static create(id) {
|
|
@@ -36,22 +35,22 @@ class AggregateId extends String_1.String {
|
|
|
36
35
|
return new AggregateId(id, true);
|
|
37
36
|
}
|
|
38
37
|
/**
|
|
39
|
-
* Extracts the raw
|
|
38
|
+
* Extracts the raw ID from the aggregate ID
|
|
40
39
|
*/
|
|
41
|
-
|
|
40
|
+
extractId() {
|
|
42
41
|
const parts = this.value.split('_');
|
|
43
42
|
if (parts.length !== 2) {
|
|
44
|
-
throw
|
|
43
|
+
throw InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(this.value, 'Invalid aggregate ID format');
|
|
45
44
|
}
|
|
46
45
|
return parts[1];
|
|
47
46
|
}
|
|
48
47
|
/**
|
|
49
|
-
* Extracts the full prefix from the
|
|
48
|
+
* Extracts the full prefix from the aggregate ID (BC-SUB1-SUB2-...SUBn)
|
|
50
49
|
*/
|
|
51
50
|
extractPrefix() {
|
|
52
51
|
const parts = this.value.split('_');
|
|
53
52
|
if (parts.length !== 2) {
|
|
54
|
-
throw
|
|
53
|
+
throw InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(this.value, 'Invalid aggregate ID format');
|
|
55
54
|
}
|
|
56
55
|
return parts[0];
|
|
57
56
|
}
|
|
@@ -64,7 +63,7 @@ class AggregateId extends String_1.String {
|
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
65
|
* Extracts all subdomain parts from the prefix
|
|
67
|
-
* Returns empty array if BC has no subdomains (e.g.,
|
|
66
|
+
* Returns empty array if BC has no subdomains (e.g., STC_id)
|
|
68
67
|
*/
|
|
69
68
|
extractSubdomains() {
|
|
70
69
|
const prefix = this.extractPrefix();
|
|
@@ -82,7 +81,7 @@ class AggregateId extends String_1.String {
|
|
|
82
81
|
return subdomains.length > 0 ? subdomains[0] : '';
|
|
83
82
|
}
|
|
84
83
|
/**
|
|
85
|
-
* Checks if this
|
|
84
|
+
* Checks if this ID has subdomains or is BC-level only
|
|
86
85
|
*/
|
|
87
86
|
hasSubdomains() {
|
|
88
87
|
return this.extractSubdomains().length > 0;
|
|
@@ -90,36 +89,33 @@ class AggregateId extends String_1.String {
|
|
|
90
89
|
/**
|
|
91
90
|
* Validation methods
|
|
92
91
|
*/
|
|
93
|
-
static
|
|
94
|
-
if (this.
|
|
95
|
-
throw
|
|
92
|
+
static guardAgainstInvalidId(id, propertyName = AggregateId.DEFAULT_PROPERTY_NAME) {
|
|
93
|
+
if (this.isInvalidId(id)) {
|
|
94
|
+
throw InvalidAggregateIdFormatError_1.InvalidAggregateIdFormatError.create(id, propertyName);
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
|
-
static
|
|
99
|
-
if (this.
|
|
100
|
-
throw InvalidAggregateIdError_1.InvalidAggregateIdError.create(
|
|
97
|
+
static guardAgainstInvalidRawId(rawId, propertyName = 'id') {
|
|
98
|
+
if (this.isInvalidRawId(rawId)) {
|
|
99
|
+
throw InvalidAggregateIdError_1.InvalidAggregateIdError.create(rawId, `Invalid ID format for ${propertyName}`);
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
|
-
static
|
|
104
|
-
return this.
|
|
102
|
+
static isInvalidId(id) {
|
|
103
|
+
return this.isValidId(id) === false;
|
|
105
104
|
}
|
|
106
|
-
static
|
|
107
|
-
return this.
|
|
108
|
-
}
|
|
109
|
-
static isValidSemanticId(semanticId) {
|
|
110
|
-
return AggregateId.SEMANTIC_UUID_REGEX.test(semanticId);
|
|
111
|
-
}
|
|
112
|
-
static isValidUuid(uuid) {
|
|
113
|
-
return AggregateId.UUID_REGEX.test(uuid);
|
|
105
|
+
static isInvalidRawId(rawId) {
|
|
106
|
+
return this.isValidRawId(rawId) === false;
|
|
114
107
|
}
|
|
115
108
|
static isValidId(id) {
|
|
116
|
-
return
|
|
109
|
+
return AggregateId.AGGREGATE_ID_REGEX.test(id);
|
|
110
|
+
}
|
|
111
|
+
static isValidRawId(rawId) {
|
|
112
|
+
return AggregateId.ID_REGEX.test(rawId);
|
|
117
113
|
}
|
|
118
|
-
static
|
|
119
|
-
return this.
|
|
114
|
+
static isValidIdValue(id) {
|
|
115
|
+
return this.isValidId(id);
|
|
120
116
|
}
|
|
121
|
-
static
|
|
122
|
-
return this.
|
|
117
|
+
static isValidRawIdValue(rawId) {
|
|
118
|
+
return this.isValidRawId(rawId);
|
|
123
119
|
}
|
|
124
120
|
toPrimitives() {
|
|
125
121
|
return this.value;
|
|
@@ -127,8 +123,8 @@ class AggregateId extends String_1.String {
|
|
|
127
123
|
}
|
|
128
124
|
exports.AggregateId = AggregateId;
|
|
129
125
|
AggregateId.DEFAULT_PROPERTY_NAME = 'id';
|
|
130
|
-
// Standard UUID v4
|
|
131
|
-
AggregateId.
|
|
132
|
-
//
|
|
133
|
-
// Pattern: [A-Z]{3}(-[A-Z]{3})*_[
|
|
134
|
-
AggregateId.
|
|
126
|
+
// Standard ID regex (UUID v4 format)
|
|
127
|
+
AggregateId.ID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
128
|
+
// Aggregate ID format: BC_ID or BC-SUB1-SUB2-...SUBn_ID (flexible N-level subdomain support)
|
|
129
|
+
// Pattern: [A-Z]{3}(-[A-Z]{3})*_[ID] - BC alone OR BC with unlimited SUBn levels
|
|
130
|
+
AggregateId.AGGREGATE_ID_REGEX = /^[A-Z]{3}(-[A-Z]{3})*_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
@@ -17,7 +17,7 @@ class AggregateIdList extends StringList_1.StringList {
|
|
|
17
17
|
}
|
|
18
18
|
static guardAgainstInvalidIds(ids, propertyName = AggregateIdList.DEFAULT_PROPERTY_NAME) {
|
|
19
19
|
ids.forEach((id, index) => {
|
|
20
|
-
if (!AggregateId_1.AggregateId.
|
|
20
|
+
if (!AggregateId_1.AggregateId.isValidIdValue(id)) {
|
|
21
21
|
throw InvalidAggregateIdError_1.InvalidAggregateIdError.create(id, `${propertyName}[${index}]`);
|
|
22
22
|
}
|
|
23
23
|
});
|
|
@@ -31,7 +31,7 @@ class AggregateIdList extends StringList_1.StringList {
|
|
|
31
31
|
return this.value.includes(id);
|
|
32
32
|
}
|
|
33
33
|
addId(id) {
|
|
34
|
-
AggregateId_1.AggregateId.
|
|
34
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id);
|
|
35
35
|
if (this.hasId(id)) {
|
|
36
36
|
return this.value;
|
|
37
37
|
}
|
|
@@ -47,7 +47,7 @@ class AggregateIdList extends StringList_1.StringList {
|
|
|
47
47
|
return this.value.length;
|
|
48
48
|
}
|
|
49
49
|
static isValidIdList(ids) {
|
|
50
|
-
return ids.every((id) => AggregateId_1.AggregateId.
|
|
50
|
+
return ids.every((id) => AggregateId_1.AggregateId.isValidIdValue(id));
|
|
51
51
|
}
|
|
52
52
|
toPrimitives() {
|
|
53
53
|
return this.value;
|
|
@@ -59,15 +59,15 @@ class CalculationProcessReference extends ObjectValueObject_1.ObjectValueObject
|
|
|
59
59
|
}
|
|
60
60
|
static guardAgainstInvalidId(id) {
|
|
61
61
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
62
|
-
AggregateId_1.AggregateId.
|
|
62
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
63
63
|
}
|
|
64
64
|
static guardAgainstInvalidCarbonClient(carbonClient) {
|
|
65
65
|
String_1.String.guardAgainstEmptyValue(carbonClient, 'carbonClient');
|
|
66
|
-
AggregateId_1.AggregateId.
|
|
66
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(carbonClient, 'carbonClient');
|
|
67
67
|
}
|
|
68
68
|
static guardAgainstInvalidFootprintConfiguration(footprintConfiguration) {
|
|
69
69
|
String_1.String.guardAgainstEmptyValue(footprintConfiguration, 'footprintConfiguration');
|
|
70
|
-
AggregateId_1.AggregateId.
|
|
70
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(footprintConfiguration, 'footprintConfiguration');
|
|
71
71
|
}
|
|
72
72
|
get id() {
|
|
73
73
|
return __classPrivateFieldGet(this, _CalculationProcessReference_id, "f");
|
|
@@ -108,7 +108,7 @@ class CalculationVariableReferences extends ValueObject_1.ValueObject {
|
|
|
108
108
|
}
|
|
109
109
|
// Validar usando las reglas de dominio
|
|
110
110
|
String_1.String.guardAgainstEmptyValue(reference.id, `${propertyName}.id`);
|
|
111
|
-
AggregateId_1.AggregateId.
|
|
111
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(reference.id, `${propertyName}.id`);
|
|
112
112
|
String_1.String.guardAgainstEmptyValue(reference.code, `${propertyName}.code`);
|
|
113
113
|
Code_1.Code.guardAgainstInvalidCode(reference.code);
|
|
114
114
|
String_1.String.guardAgainstEmptyValue(reference.symbol, `${propertyName}.symbol`);
|
|
@@ -94,7 +94,7 @@ class CarbonClientReference extends ObjectValueObject_1.ObjectValueObject {
|
|
|
94
94
|
*/
|
|
95
95
|
static guardAgainstInvalidId(id) {
|
|
96
96
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
97
|
-
AggregateId_1.AggregateId.
|
|
97
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* Valida el nombre para mostrar.
|
package/build/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.js
CHANGED
|
@@ -57,7 +57,7 @@ class CarbonFootprintConfigurationReference extends ObjectValueObject_1.ObjectVa
|
|
|
57
57
|
}
|
|
58
58
|
static guardAgainstInvalidId(id) {
|
|
59
59
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
60
|
-
AggregateId_1.AggregateId.
|
|
60
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Valida el tipo de huella de carbono.
|
package/build/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.js
CHANGED
|
@@ -83,7 +83,7 @@ class CarbonFootprintIntensityIndicatorReference extends ObjectValueObject_1.Obj
|
|
|
83
83
|
}
|
|
84
84
|
static guardAgainstInvalidId(id) {
|
|
85
85
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
86
|
-
AggregateId_1.AggregateId.
|
|
86
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Valida el código del indicador de intensidad usando las validaciones de DomainCode.
|
|
@@ -104,7 +104,7 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
104
104
|
*/
|
|
105
105
|
static guardAgainstInvalidSegmentId(id, propertyName) {
|
|
106
106
|
String_1.String.guardAgainstEmptyValue(id, propertyName);
|
|
107
|
-
AggregateId_1.AggregateId.
|
|
107
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
* Valida el código de segmento usando las validaciones de Code.
|
|
@@ -77,7 +77,7 @@ class CollectionFieldReference extends ObjectValueObject_1.ObjectValueObject {
|
|
|
77
77
|
}
|
|
78
78
|
static guardAgainstInvalidId(id) {
|
|
79
79
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
80
|
-
AggregateId_1.AggregateId.
|
|
80
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Valida el código del campo de recolección usando las validaciones de Code.
|
|
@@ -109,7 +109,7 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
109
109
|
*/
|
|
110
110
|
static guardAgainstInvalidConfigurationId(id, propertyName) {
|
|
111
111
|
String_1.String.guardAgainstEmptyValue(id, propertyName);
|
|
112
|
-
AggregateId_1.AggregateId.
|
|
112
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* Valida la referencia de segmento corporativo.
|
|
@@ -161,7 +161,7 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
161
161
|
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof reference.name);
|
|
162
162
|
}
|
|
163
163
|
String_1.String.guardAgainstEmptyValue(reference.id, `${propertyName}.id`);
|
|
164
|
-
AggregateId_1.AggregateId.
|
|
164
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(reference.id, `${propertyName}.id`);
|
|
165
165
|
String_1.String.guardAgainstEmptyValue(reference.code, `${propertyName}.code`);
|
|
166
166
|
Code_1.Code.guardAgainstInvalidCode(reference.code);
|
|
167
167
|
String_1.String.guardAgainstEmptyValue(reference.name, `${propertyName}.name`);
|
|
@@ -73,7 +73,7 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
73
73
|
*/
|
|
74
74
|
static guardAgainstInvalidId(id) {
|
|
75
75
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
76
|
-
AggregateId_1.AggregateId.
|
|
76
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Valida el código del segmento corporativo.
|
|
@@ -73,7 +73,7 @@ class CorporateConfigurationCarbonFootprintSubsegmentReference extends ObjectVal
|
|
|
73
73
|
*/
|
|
74
74
|
static guardAgainstInvalidId(id) {
|
|
75
75
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
76
|
-
AggregateId_1.AggregateId.
|
|
76
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Valida el código del subsegmento corporativo.
|
|
@@ -64,7 +64,7 @@ class EmissionCalculationFormulaReference extends ObjectValueObject_1.ObjectValu
|
|
|
64
64
|
}
|
|
65
65
|
static guardAgainstInvalidId(id) {
|
|
66
66
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
67
|
-
AggregateId_1.AggregateId.
|
|
67
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* Valida el código de la fórmula de cálculo de emisiones usando las validaciones de Code.
|
|
@@ -82,7 +82,7 @@ class EmissionCalculationReference extends ObjectValueObject_1.ObjectValueObject
|
|
|
82
82
|
}
|
|
83
83
|
static guardAgainstInvalidId(id) {
|
|
84
84
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
85
|
-
AggregateId_1.AggregateId.
|
|
85
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* Valida la referencia de activity data submission.
|
|
@@ -67,7 +67,7 @@ class EmissionFactorReference extends ObjectValueObject_1.ObjectValueObject {
|
|
|
67
67
|
*/
|
|
68
68
|
static guardAgainstInvalidId(id) {
|
|
69
69
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
70
|
-
AggregateId_1.AggregateId.
|
|
70
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* Valida el código del factor de emisión.
|
|
@@ -67,7 +67,7 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReference extends Object
|
|
|
67
67
|
*/
|
|
68
68
|
static guardAgainstInvalidId(id) {
|
|
69
69
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
70
|
-
AggregateId_1.AggregateId.
|
|
70
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* Valida el código de subsegmento usando las validaciones de Code.
|
|
@@ -105,7 +105,7 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReferences extends Value
|
|
|
105
105
|
*/
|
|
106
106
|
static guardAgainstInvalidSubsegmentId(id, propertyName) {
|
|
107
107
|
String_1.String.guardAgainstEmptyValue(id, propertyName);
|
|
108
|
-
AggregateId_1.AggregateId.
|
|
108
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* Valida el código de subsegmento usando las validaciones de Code.
|