@carbonbox/domain 0.7.22 → 0.7.23
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/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationSegment.js +0 -2
- package/build/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/segments/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentIncludedSubsegments.js +0 -2
- package/build/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/domain/value-objects/EventEditionLifecycleStageConfigurationStage.js +0 -2
- package/build/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/event-edition-lifecycle-stages/domain/value-objects/EventEditionLifecycleStageIncludedSubsegments.js +0 -2
- package/build/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/domain/value-objects/ProductCarbonFootprintSegmentConfigurationSegment.js +0 -2
- package/build/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/segments/domain/value-objects/ProductConfigurationCarbonFootprintSegmentIncludedSubsegments.js +0 -2
- package/build/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.js +16 -103
- package/build/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.js +15 -29
- package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.js +6 -131
- package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.js +6 -131
- package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.js +7 -149
- package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.js +9 -165
- package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.js +42 -50
- package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.js +8 -112
- package/build/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.js +11 -136
- package/build/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.js +11 -168
- package/build/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.js +11 -136
- package/build/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.js +35 -56
- package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.js +6 -172
- package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.js +6 -172
- package/build/types/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationSegment.d.ts.map +1 -1
- package/build/types/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/segments/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentIncludedSubsegments.d.ts.map +1 -1
- package/build/types/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/domain/value-objects/EventEditionLifecycleStageConfigurationStage.d.ts.map +1 -1
- package/build/types/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/event-edition-lifecycle-stages/domain/value-objects/EventEditionLifecycleStageIncludedSubsegments.d.ts.map +1 -1
- package/build/types/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/domain/value-objects/ProductCarbonFootprintSegmentConfigurationSegment.d.ts.map +1 -1
- package/build/types/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/segments/domain/value-objects/ProductConfigurationCarbonFootprintSegmentIncludedSubsegments.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSegmentReference.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSegmentReferencePrimitives.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSegmentReferencePrimitives.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/CorporateConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/EventEditionConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/EventEditionConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/EventEditionLifecycleStageReference.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/EventEditionLifecycleStageReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/EventEditionLifecycleStageReferencePrimitives.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/EventEditionLifecycleStageReferencePrimitives.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSegmentReference.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSegmentReferencePrimitives.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSegmentReferencePrimitives.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts +0 -2
- package/build/types/carbonbox/shared/domain/types/ProductConfigurationCarbonFootprintSubsegmentReferencePrimitives.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.d.ts +7 -43
- package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.d.ts +6 -8
- package/build/types/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.d.ts +1 -62
- package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts +1 -71
- package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +2 -78
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.d.ts +5 -68
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.d.ts +20 -19
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.d.ts +2 -45
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.d.ts +2 -62
- package/build/types/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +2 -77
- package/build/types/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.d.ts +2 -62
- package/build/types/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.d.ts +15 -17
- package/build/types/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.d.ts +1 -81
- package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts +1 -90
- package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -12,8 +12,6 @@ class CorporateCarbonFootprintSegmentConfigurationSegment extends CorporateConfi
|
|
|
12
12
|
static fromPrimitives(primitives) {
|
|
13
13
|
const value = {
|
|
14
14
|
id: primitives.id,
|
|
15
|
-
code: primitives.code,
|
|
16
|
-
name: primitives.name,
|
|
17
15
|
};
|
|
18
16
|
return new CorporateCarbonFootprintSegmentConfigurationSegment(value, true);
|
|
19
17
|
}
|
|
@@ -12,8 +12,6 @@ class CorporateConfigurationCarbonFootprintSegmentIncludedSubsegments extends Ca
|
|
|
12
12
|
static fromPrimitives(primitives) {
|
|
13
13
|
const value = primitives.map((primitive) => ({
|
|
14
14
|
id: primitive.id,
|
|
15
|
-
code: primitive.code,
|
|
16
|
-
name: primitive.name,
|
|
17
15
|
}));
|
|
18
16
|
return new CorporateConfigurationCarbonFootprintSegmentIncludedSubsegments(value, true);
|
|
19
17
|
}
|
|
@@ -12,8 +12,6 @@ class EventEditionLifecycleStageConfigurationStage extends EventEditionLifecycle
|
|
|
12
12
|
static fromPrimitives(primitives) {
|
|
13
13
|
const value = {
|
|
14
14
|
id: primitives.id,
|
|
15
|
-
code: primitives.code,
|
|
16
|
-
name: primitives.name,
|
|
17
15
|
};
|
|
18
16
|
return new EventEditionLifecycleStageConfigurationStage(value, true);
|
|
19
17
|
}
|
|
@@ -13,8 +13,6 @@ class EventEditionLifecycleStageIncludedSubsegments extends EventEditionConfigur
|
|
|
13
13
|
static fromPrimitives(primitives) {
|
|
14
14
|
const value = primitives.map((primitive) => ({
|
|
15
15
|
id: primitive.id,
|
|
16
|
-
code: primitive.code,
|
|
17
|
-
name: primitive.name,
|
|
18
16
|
}));
|
|
19
17
|
return new EventEditionLifecycleStageIncludedSubsegments(value, true);
|
|
20
18
|
}
|
|
@@ -12,8 +12,6 @@ class ProductCarbonFootprintSegmentConfigurationSegment extends ProductConfigura
|
|
|
12
12
|
static fromPrimitives(primitives) {
|
|
13
13
|
const value = {
|
|
14
14
|
id: primitives.id,
|
|
15
|
-
code: primitives.code,
|
|
16
|
-
name: primitives.name,
|
|
17
15
|
};
|
|
18
16
|
return new ProductCarbonFootprintSegmentConfigurationSegment(value, true);
|
|
19
17
|
}
|
|
@@ -12,8 +12,6 @@ class ProductConfigurationCarbonFootprintSegmentIncludedSubsegments extends Carb
|
|
|
12
12
|
static fromPrimitives(primitives) {
|
|
13
13
|
const value = primitives.map((primitive) => ({
|
|
14
14
|
id: primitive.id,
|
|
15
|
-
code: primitive.code,
|
|
16
|
-
name: primitive.name,
|
|
17
15
|
}));
|
|
18
16
|
return new ProductConfigurationCarbonFootprintSegmentIncludedSubsegments(value, true);
|
|
19
17
|
}
|
|
@@ -18,7 +18,6 @@ const InvalidPropertyValueError_1 = require("../exceptions/InvalidPropertyValueE
|
|
|
18
18
|
const ValueObject_1 = require("./ValueObject");
|
|
19
19
|
const String_1 = require("./String");
|
|
20
20
|
const AggregateId_1 = require("./AggregateId");
|
|
21
|
-
const Code_1 = require("./Code");
|
|
22
21
|
class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
23
22
|
/**
|
|
24
23
|
* Constructor protegido para que solo clases hijas puedan instanciar.
|
|
@@ -63,13 +62,13 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
|
-
* Valida que no haya
|
|
65
|
+
* Valida que no haya IDs de segmento duplicados.
|
|
67
66
|
*/
|
|
68
67
|
static guardAgainstDuplicateSegmentCodes(value, propertyName) {
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.
|
|
68
|
+
const segmentIds = value.map((segment) => segment.id);
|
|
69
|
+
const uniqueIds = new Set(segmentIds);
|
|
70
|
+
if (segmentIds.length !== uniqueIds.size) {
|
|
71
|
+
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.id`, 'unique segment IDs', 'duplicate IDs found');
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
/**
|
|
@@ -79,8 +78,6 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
79
78
|
const propertyName = `${basePropertyName}[${index}]`;
|
|
80
79
|
this.guardAgainstInvalidSegmentStructure(segmentReference, propertyName);
|
|
81
80
|
this.guardAgainstInvalidSegmentId(segmentReference.id, `${propertyName}.id`);
|
|
82
|
-
this.guardAgainstInvalidSegmentCode(segmentReference.code, `${propertyName}.code`);
|
|
83
|
-
this.guardAgainstInvalidSegmentName(segmentReference.name, `${propertyName}.name`);
|
|
84
81
|
}
|
|
85
82
|
/**
|
|
86
83
|
* Valida que el objeto de referencia de segmento tenga la estructura correcta.
|
|
@@ -92,12 +89,6 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
92
89
|
if (typeof segmentReference.id !== 'string') {
|
|
93
90
|
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof segmentReference.id);
|
|
94
91
|
}
|
|
95
|
-
if (typeof segmentReference.code !== 'string') {
|
|
96
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.code`, 'string', typeof segmentReference.code);
|
|
97
|
-
}
|
|
98
|
-
if (typeof segmentReference.name !== 'string') {
|
|
99
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof segmentReference.name);
|
|
100
|
-
}
|
|
101
92
|
}
|
|
102
93
|
/**
|
|
103
94
|
* Valida el ID de segmento usando las validaciones de AggregateId.
|
|
@@ -106,19 +97,6 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
106
97
|
String_1.String.guardAgainstEmptyValue(id, propertyName);
|
|
107
98
|
AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
|
|
108
99
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Valida el código de segmento usando las validaciones de Code.
|
|
111
|
-
*/
|
|
112
|
-
static guardAgainstInvalidSegmentCode(code, propertyName) {
|
|
113
|
-
String_1.String.guardAgainstEmptyValue(code, propertyName);
|
|
114
|
-
Code_1.Code.guardAgainstInvalidCode(code, propertyName);
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Valida el nombre del segmento.
|
|
118
|
-
*/
|
|
119
|
-
static guardAgainstInvalidSegmentName(name, propertyName) {
|
|
120
|
-
String_1.String.guardAgainstEmptyValue(name, propertyName);
|
|
121
|
-
}
|
|
122
100
|
/**
|
|
123
101
|
* Referencias de segmentos (inmutable).
|
|
124
102
|
*/
|
|
@@ -150,30 +128,17 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
150
128
|
return !this.isEmpty();
|
|
151
129
|
}
|
|
152
130
|
/**
|
|
153
|
-
* Obtiene un segmento por su
|
|
131
|
+
* Obtiene un segmento por su ID.
|
|
154
132
|
*/
|
|
155
|
-
|
|
156
|
-
const segmentFound = __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").find((segment) => segment.
|
|
133
|
+
getSegmentById(segmentId) {
|
|
134
|
+
const segmentFound = __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").find((segment) => segment.id === segmentId.trim());
|
|
157
135
|
return segmentFound || null;
|
|
158
136
|
}
|
|
159
137
|
/**
|
|
160
|
-
* Verifica si existe un segmento con el
|
|
138
|
+
* Verifica si existe un segmento con el ID especificado.
|
|
161
139
|
*/
|
|
162
|
-
|
|
163
|
-
return this.
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Obtiene un segmento por su nombre.
|
|
167
|
-
*/
|
|
168
|
-
getSegmentByName(segmentName) {
|
|
169
|
-
const segmentFound = __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").find((segment) => segment.name === segmentName.trim());
|
|
170
|
-
return segmentFound || null;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Verifica si existe un segmento con el nombre especificado.
|
|
174
|
-
*/
|
|
175
|
-
hasSegmentName(segmentName) {
|
|
176
|
-
return this.getSegmentByName(segmentName) !== null;
|
|
140
|
+
hasSegmentId(segmentId) {
|
|
141
|
+
return this.getSegmentById(segmentId) !== null;
|
|
177
142
|
}
|
|
178
143
|
/**
|
|
179
144
|
* Obtiene un segmento por su índice.
|
|
@@ -185,31 +150,10 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
185
150
|
return __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f")[index];
|
|
186
151
|
}
|
|
187
152
|
/**
|
|
188
|
-
* Obtiene todos los
|
|
189
|
-
*/
|
|
190
|
-
getAllSegmentCodes() {
|
|
191
|
-
return __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").map((segment) => segment.code);
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Obtiene todos los nombres de segmento.
|
|
195
|
-
*/
|
|
196
|
-
getAllSegmentNames() {
|
|
197
|
-
return __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").map((segment) => segment.name);
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Busca segmentos por texto en el nombre.
|
|
201
|
-
*/
|
|
202
|
-
findSegmentsByNameContaining(searchText) {
|
|
203
|
-
const lowerSearchText = searchText.toLowerCase().trim();
|
|
204
|
-
return __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").filter((segment) => segment.name.toLowerCase().includes(lowerSearchText));
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Busca segmentos que coincidan con un patrón en código o nombre.
|
|
153
|
+
* Obtiene todos los IDs de segmento.
|
|
208
154
|
*/
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").filter((segment) => segment.code.toLowerCase().includes(lowerSearchText)
|
|
212
|
-
|| segment.name.toLowerCase().includes(lowerSearchText));
|
|
155
|
+
getAllSegmentIds() {
|
|
156
|
+
return __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").map((segment) => segment.id);
|
|
213
157
|
}
|
|
214
158
|
/**
|
|
215
159
|
* Obtiene los primeros N segmentos.
|
|
@@ -229,33 +173,6 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
229
173
|
}
|
|
230
174
|
return __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").slice(-count);
|
|
231
175
|
}
|
|
232
|
-
/**
|
|
233
|
-
* Verifica si todos los segmentos tienen nombres únicos.
|
|
234
|
-
*/
|
|
235
|
-
hasUniqueNames() {
|
|
236
|
-
const names = this.getAllSegmentNames();
|
|
237
|
-
const uniqueNames = new Set(names);
|
|
238
|
-
return names.length === uniqueNames.size;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Obtiene segmentos con nombres duplicados.
|
|
242
|
-
*/
|
|
243
|
-
getDuplicateNameSegments() {
|
|
244
|
-
const nameCountMap = new Map();
|
|
245
|
-
const duplicates = [];
|
|
246
|
-
// Contar ocurrencias de nombres
|
|
247
|
-
__classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").forEach((segment) => {
|
|
248
|
-
const count = nameCountMap.get(segment.name) || 0;
|
|
249
|
-
nameCountMap.set(segment.name, count + 1);
|
|
250
|
-
});
|
|
251
|
-
// Encontrar segmentos con nombres duplicados
|
|
252
|
-
__classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").forEach((segment) => {
|
|
253
|
-
if (nameCountMap.get(segment.name) > 1) {
|
|
254
|
-
duplicates.push(segment);
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
return duplicates;
|
|
258
|
-
}
|
|
259
176
|
/**
|
|
260
177
|
* Compara la igualdad semántica con otra colección de referencias de segmento.
|
|
261
178
|
*/
|
|
@@ -278,16 +195,14 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
278
195
|
* Compara si dos referencias de segmento son iguales.
|
|
279
196
|
*/
|
|
280
197
|
segmentReferencesAreEqual(segment1, segment2) {
|
|
281
|
-
return
|
|
282
|
-
&& segment1.code === segment2.code
|
|
283
|
-
&& segment1.name === segment2.name);
|
|
198
|
+
return segment1.id === segment2.id;
|
|
284
199
|
}
|
|
285
200
|
/**
|
|
286
201
|
* Genera un hash code para usar en colecciones.
|
|
287
202
|
*/
|
|
288
203
|
hashCode() {
|
|
289
204
|
const segmentHashes = __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f")
|
|
290
|
-
.map((segment) =>
|
|
205
|
+
.map((segment) => segment.id)
|
|
291
206
|
.join('|');
|
|
292
207
|
const optionsHash = __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_options, "f").allowEmpty ? 'allowEmpty' : 'requireElements';
|
|
293
208
|
return `${optionsHash}_${segmentHashes}`;
|
|
@@ -298,8 +213,6 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
298
213
|
toPrimitives() {
|
|
299
214
|
return __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").map((segment) => ({
|
|
300
215
|
id: segment.id,
|
|
301
|
-
code: segment.code,
|
|
302
|
-
name: segment.name,
|
|
303
216
|
}));
|
|
304
217
|
}
|
|
305
218
|
/**
|
|
@@ -19,7 +19,6 @@ const EmissionSource_1 = require("../enums/EmissionSource");
|
|
|
19
19
|
const ValueObject_1 = require("./ValueObject");
|
|
20
20
|
const String_1 = require("./String");
|
|
21
21
|
const AggregateId_1 = require("./AggregateId");
|
|
22
|
-
const Code_1 = require("./Code");
|
|
23
22
|
class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject_1.ValueObject {
|
|
24
23
|
/**
|
|
25
24
|
* Constructor protegido para que solo clases hijas puedan instanciar.
|
|
@@ -154,17 +153,8 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
154
153
|
if (typeof reference.id !== 'string') {
|
|
155
154
|
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof reference.id);
|
|
156
155
|
}
|
|
157
|
-
if (typeof reference.code !== 'string') {
|
|
158
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.code`, 'string', typeof reference.code);
|
|
159
|
-
}
|
|
160
|
-
if (typeof reference.name !== 'string') {
|
|
161
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof reference.name);
|
|
162
|
-
}
|
|
163
156
|
String_1.String.guardAgainstEmptyValue(reference.id, `${propertyName}.id`);
|
|
164
157
|
AggregateId_1.AggregateId.guardAgainstInvalidId(reference.id, `${propertyName}.id`);
|
|
165
|
-
String_1.String.guardAgainstEmptyValue(reference.code, `${propertyName}.code`);
|
|
166
|
-
Code_1.Code.guardAgainstInvalidCode(reference.code);
|
|
167
|
-
String_1.String.guardAgainstEmptyValue(reference.name, `${propertyName}.name`);
|
|
168
158
|
}
|
|
169
159
|
/**
|
|
170
160
|
* Configuraciones de segmento corporativo (inmutable).
|
|
@@ -240,16 +230,16 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
240
230
|
return __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, "f")[index];
|
|
241
231
|
}
|
|
242
232
|
/**
|
|
243
|
-
* Obtiene todos los
|
|
233
|
+
* Obtiene todos los IDs de configuración.
|
|
244
234
|
*/
|
|
245
235
|
getAllConfigurationIds() {
|
|
246
236
|
return __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, "f").map((config) => config.id);
|
|
247
237
|
}
|
|
248
238
|
/**
|
|
249
|
-
* Obtiene todas las configuraciones por
|
|
239
|
+
* Obtiene todas las configuraciones por ID de segmento corporativo.
|
|
250
240
|
*/
|
|
251
|
-
|
|
252
|
-
return __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, "f").filter((config) => config.segment.
|
|
241
|
+
getConfigurationsBySegmentId(segmentId) {
|
|
242
|
+
return __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, "f").filter((config) => config.segment.id === segmentId.trim());
|
|
253
243
|
}
|
|
254
244
|
/**
|
|
255
245
|
* Obtiene todas las configuraciones por fuente de emisión.
|
|
@@ -276,11 +266,11 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
276
266
|
return __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, "f").some((config) => config.subsegment !== null);
|
|
277
267
|
}
|
|
278
268
|
/**
|
|
279
|
-
* Obtiene todos los
|
|
269
|
+
* Obtiene todos los IDs únicos de segmentos corporativos.
|
|
280
270
|
*/
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
return [...new Set(
|
|
271
|
+
getUniqueSegmentIds() {
|
|
272
|
+
const ids = __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, "f").map((config) => config.segment.id);
|
|
273
|
+
return [...new Set(ids)];
|
|
284
274
|
}
|
|
285
275
|
/**
|
|
286
276
|
* Obtiene todas las fuentes de emisión únicas.
|
|
@@ -290,14 +280,14 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
290
280
|
return [...new Set(sources)];
|
|
291
281
|
}
|
|
292
282
|
/**
|
|
293
|
-
* Busca configuraciones que coincidan con un patrón en
|
|
283
|
+
* Busca configuraciones que coincidan con un patrón en ID de configuración o fuentes de emisión.
|
|
294
284
|
*/
|
|
295
285
|
findConfigurationsMatching(searchText) {
|
|
296
286
|
const lowerSearchText = searchText.toLowerCase().trim();
|
|
297
287
|
return __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, "f").filter((config) => config.id.toLowerCase().includes(lowerSearchText)
|
|
298
|
-
|| config.segment.
|
|
288
|
+
|| config.segment.id.toLowerCase().includes(lowerSearchText)
|
|
299
289
|
|| config.emissionSources.some((source) => source.toLowerCase().includes(lowerSearchText))
|
|
300
|
-
|| (config.subsegment && config.subsegment.
|
|
290
|
+
|| (config.subsegment && config.subsegment.id.toLowerCase().includes(lowerSearchText)));
|
|
301
291
|
}
|
|
302
292
|
/**
|
|
303
293
|
* Obtiene los primeros N configuraciones.
|
|
@@ -324,7 +314,7 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
324
314
|
const totalConfigurations = __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, "f").length;
|
|
325
315
|
const configurationsWithSubsegment = this.getConfigurationsWithSubsegment().length;
|
|
326
316
|
const configurationsWithoutSubsegment = this.getConfigurationsWithoutSubsegment().length;
|
|
327
|
-
const uniqueSegments = this.
|
|
317
|
+
const uniqueSegments = this.getUniqueSegmentIds().length;
|
|
328
318
|
const uniqueEmissionSources = this.getUniqueEmissionSources().length;
|
|
329
319
|
return {
|
|
330
320
|
totalConfigurations,
|
|
@@ -367,7 +357,7 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
367
357
|
* Compara referencias de segmento.
|
|
368
358
|
*/
|
|
369
359
|
segmentReferencesAreEqual(seg1, seg2) {
|
|
370
|
-
return seg1.id === seg2.id
|
|
360
|
+
return seg1.id === seg2.id;
|
|
371
361
|
}
|
|
372
362
|
/**
|
|
373
363
|
* Compara referencias de subsegmento (pueden ser null).
|
|
@@ -379,7 +369,7 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
379
369
|
if (subseg1 === null || subseg2 === null) {
|
|
380
370
|
return false;
|
|
381
371
|
}
|
|
382
|
-
return subseg1.id === subseg2.id
|
|
372
|
+
return subseg1.id === subseg2.id;
|
|
383
373
|
}
|
|
384
374
|
/**
|
|
385
375
|
* Compara arrays de fuentes de emisión.
|
|
@@ -397,7 +387,7 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
397
387
|
*/
|
|
398
388
|
hashCode() {
|
|
399
389
|
const configHashes = __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, "f")
|
|
400
|
-
.map((config) => `${config.id}_${config.segment.
|
|
390
|
+
.map((config) => `${config.id}_${config.segment.id}_${config.emissionSources.sort().join(',')}`)
|
|
401
391
|
.join('|');
|
|
402
392
|
const optionsHash = __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_options, "f").allowEmpty ? 'allowEmpty' : 'requireElements';
|
|
403
393
|
return `corporateSegmentConfigurations_${optionsHash}_${configHashes}`;
|
|
@@ -410,13 +400,9 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
410
400
|
id: config.id,
|
|
411
401
|
segment: {
|
|
412
402
|
id: config.segment.id,
|
|
413
|
-
code: config.segment.code,
|
|
414
|
-
name: config.segment.name,
|
|
415
403
|
},
|
|
416
404
|
subsegment: config.subsegment ? {
|
|
417
405
|
id: config.subsegment.id,
|
|
418
|
-
code: config.subsegment.code,
|
|
419
|
-
name: config.subsegment.name,
|
|
420
406
|
} : null,
|
|
421
407
|
emissionSources: config.emissionSources,
|
|
422
408
|
}));
|
|
@@ -10,14 +10,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
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
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _CorporateConfigurationCarbonFootprintSegmentReference_id
|
|
13
|
+
var _CorporateConfigurationCarbonFootprintSegmentReference_id;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CorporateConfigurationCarbonFootprintSegmentReference = void 0;
|
|
16
16
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
17
17
|
const ObjectValueObject_1 = require("./ObjectValueObject");
|
|
18
18
|
const String_1 = require("./String");
|
|
19
19
|
const AggregateId_1 = require("./AggregateId");
|
|
20
|
-
const Code_1 = require("./Code");
|
|
21
20
|
class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueObject_1.ObjectValueObject {
|
|
22
21
|
/**
|
|
23
22
|
* Constructor protegido para que solo clases hijas puedan instanciar.
|
|
@@ -26,15 +25,11 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
26
25
|
constructor(value, skipDomainValidation, propertyName = CorporateConfigurationCarbonFootprintSegmentReference.DEFAULT_PROPERTY_NAME) {
|
|
27
26
|
super(value, skipDomainValidation, propertyName, 'The provided value must be of type CorporateConfigurationCarbonFootprintSegmentReference from the domain layer', { allowNull: false, allowUndefined: false });
|
|
28
27
|
_CorporateConfigurationCarbonFootprintSegmentReference_id.set(this, void 0);
|
|
29
|
-
_CorporateConfigurationCarbonFootprintSegmentReference_code.set(this, void 0);
|
|
30
|
-
_CorporateConfigurationCarbonFootprintSegmentReference_name.set(this, void 0);
|
|
31
28
|
if (skipDomainValidation === false) {
|
|
32
29
|
CorporateConfigurationCarbonFootprintSegmentReference
|
|
33
30
|
.validateCorporateConfigurationCarbonFootprintSegmentReference(value, propertyName);
|
|
34
31
|
}
|
|
35
32
|
__classPrivateFieldSet(this, _CorporateConfigurationCarbonFootprintSegmentReference_id, value.id.trim(), "f");
|
|
36
|
-
__classPrivateFieldSet(this, _CorporateConfigurationCarbonFootprintSegmentReference_code, value.code.trim().toUpperCase(), "f");
|
|
37
|
-
__classPrivateFieldSet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, value.name.trim(), "f");
|
|
38
33
|
}
|
|
39
34
|
/**
|
|
40
35
|
* Validación estática para reutilización en factory methods y constructores.
|
|
@@ -42,8 +37,6 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
42
37
|
static validateCorporateConfigurationCarbonFootprintSegmentReference(value, propertyName) {
|
|
43
38
|
this.guardAgainstInvalidType(value, propertyName);
|
|
44
39
|
this.guardAgainstInvalidId(value.id);
|
|
45
|
-
this.guardAgainstInvalidCode(value.code);
|
|
46
|
-
this.guardAgainstInvalidName(value.name);
|
|
47
40
|
}
|
|
48
41
|
/**
|
|
49
42
|
* Valida que el objeto tenga la estructura correcta.
|
|
@@ -55,12 +48,6 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
55
48
|
if (typeof value.id !== 'string') {
|
|
56
49
|
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
|
|
57
50
|
}
|
|
58
|
-
if (typeof value.code !== 'string') {
|
|
59
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'string', typeof value.code);
|
|
60
|
-
}
|
|
61
|
-
if (typeof value.name !== 'string') {
|
|
62
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'string', typeof value.name);
|
|
63
|
-
}
|
|
64
51
|
}
|
|
65
52
|
/**
|
|
66
53
|
* Valida si el valor principal es inválido.
|
|
@@ -75,101 +62,12 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
75
62
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
76
63
|
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
77
64
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Valida el código del segmento corporativo.
|
|
80
|
-
*/
|
|
81
|
-
static guardAgainstInvalidCode(code) {
|
|
82
|
-
String_1.String.guardAgainstEmptyValue(code, 'code');
|
|
83
|
-
Code_1.Code.guardAgainstInvalidCode(code);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Valida el nombre del segmento corporativo.
|
|
87
|
-
*/
|
|
88
|
-
static guardAgainstInvalidName(name) {
|
|
89
|
-
String_1.String.guardAgainstEmptyValue(name, 'name');
|
|
90
|
-
if (this.nameLengthIsInvalid(name)) {
|
|
91
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', `string with maximum ${this.MAX_NAME_LENGTH} characters`, `string with ${name.trim().length} characters`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Verifica si la longitud del nombre de segmento es inválida.
|
|
96
|
-
*/
|
|
97
|
-
static nameLengthIsInvalid(name) {
|
|
98
|
-
return name.trim().length > this.MAX_NAME_LENGTH;
|
|
99
|
-
}
|
|
100
65
|
/**
|
|
101
66
|
* ID único del segmento corporativo.
|
|
102
67
|
*/
|
|
103
68
|
get id() {
|
|
104
69
|
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_id, "f");
|
|
105
70
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Código del segmento corporativo.
|
|
108
|
-
*/
|
|
109
|
-
get code() {
|
|
110
|
-
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f");
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Nombre del segmento corporativo.
|
|
114
|
-
*/
|
|
115
|
-
get name() {
|
|
116
|
-
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f");
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Verifica si el segmento tiene un código específico.
|
|
120
|
-
*/
|
|
121
|
-
hasCode(code) {
|
|
122
|
-
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f") === code.trim().toUpperCase();
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Verifica si el nombre del segmento contiene una palabra específica.
|
|
126
|
-
*/
|
|
127
|
-
nameContains(keyword) {
|
|
128
|
-
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f").toLowerCase().includes(keyword.toLowerCase());
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Verifica si es un segmento de tecnología.
|
|
132
|
-
*/
|
|
133
|
-
isTechnologySegment() {
|
|
134
|
-
const techKeywords = ['tech', 'technology', 'digital', 'software', 'it', 'innovation'];
|
|
135
|
-
return techKeywords.some((keyword) => this.nameContains(keyword));
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Verifica si es un segmento financiero.
|
|
139
|
-
*/
|
|
140
|
-
isFinancialSegment() {
|
|
141
|
-
const financialKeywords = ['financial', 'bank', 'finance', 'insurance', 'investment'];
|
|
142
|
-
return financialKeywords.some((keyword) => this.nameContains(keyword));
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Verifica si es un segmento de manufactura.
|
|
146
|
-
*/
|
|
147
|
-
isManufacturingSegment() {
|
|
148
|
-
const manufacturingKeywords = ['manufacturing', 'production', 'factory', 'industrial'];
|
|
149
|
-
return manufacturingKeywords.some((keyword) => this.nameContains(keyword));
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Verifica si es un segmento de servicios.
|
|
153
|
-
*/
|
|
154
|
-
isServicesSegment() {
|
|
155
|
-
const servicesKeywords = ['services', 'consulting', 'professional', 'advisory'];
|
|
156
|
-
return servicesKeywords.some((keyword) => this.nameContains(keyword));
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Obtiene una representación formateada para mostrar al usuario.
|
|
160
|
-
*/
|
|
161
|
-
getFormattedDisplay() {
|
|
162
|
-
return `${__classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f")} - ${__classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f")}`;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Obtiene una versión abreviada del nombre si es muy largo.
|
|
166
|
-
*/
|
|
167
|
-
getAbbreviatedName(maxLength = 50) {
|
|
168
|
-
if (__classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f").length <= maxLength) {
|
|
169
|
-
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f");
|
|
170
|
-
}
|
|
171
|
-
return `${__classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f").substring(0, maxLength - 3)}...`;
|
|
172
|
-
}
|
|
173
71
|
/**
|
|
174
72
|
* Compara la igualdad semántica con otro objeto CorporateConfigurationCarbonFootprintSegmentReference.
|
|
175
73
|
*/
|
|
@@ -177,9 +75,7 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
177
75
|
if (this.otherIsNotCorporateConfigurationCarbonFootprintSegmentReference(other)) {
|
|
178
76
|
return false;
|
|
179
77
|
}
|
|
180
|
-
return
|
|
181
|
-
&& __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f") === __classPrivateFieldGet(other, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f")
|
|
182
|
-
&& __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f") === __classPrivateFieldGet(other, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f"));
|
|
78
|
+
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_id, "f") === __classPrivateFieldGet(other, _CorporateConfigurationCarbonFootprintSegmentReference_id, "f");
|
|
183
79
|
}
|
|
184
80
|
/**
|
|
185
81
|
* Verifica si el otro objeto no es una instancia de CorporateConfigurationCarbonFootprintSegmentReference.
|
|
@@ -187,24 +83,6 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
187
83
|
otherIsNotCorporateConfigurationCarbonFootprintSegmentReference(other) {
|
|
188
84
|
return (other instanceof CorporateConfigurationCarbonFootprintSegmentReference) === false;
|
|
189
85
|
}
|
|
190
|
-
/**
|
|
191
|
-
* Compara si dos segmentos tienen el mismo código.
|
|
192
|
-
*/
|
|
193
|
-
hasSameCode(other) {
|
|
194
|
-
if (this.otherIsNotCorporateConfigurationCarbonFootprintSegmentReference(other)) {
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f") === __classPrivateFieldGet(other, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f");
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Compara si dos segmentos tienen el mismo nombre.
|
|
201
|
-
*/
|
|
202
|
-
hasSameName(other) {
|
|
203
|
-
if (this.otherIsNotCorporateConfigurationCarbonFootprintSegmentReference(other)) {
|
|
204
|
-
return false;
|
|
205
|
-
}
|
|
206
|
-
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f") === __classPrivateFieldGet(other, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f");
|
|
207
|
-
}
|
|
208
86
|
/**
|
|
209
87
|
* Compara si dos segmentos tienen el mismo ID.
|
|
210
88
|
*/
|
|
@@ -218,7 +96,7 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
218
96
|
* Genera un hash code para usar en colecciones.
|
|
219
97
|
*/
|
|
220
98
|
hashCode() {
|
|
221
|
-
return
|
|
99
|
+
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_id, "f");
|
|
222
100
|
}
|
|
223
101
|
/**
|
|
224
102
|
* Convierte a representación primitiva para persistencia.
|
|
@@ -226,15 +104,13 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
226
104
|
toPrimitives() {
|
|
227
105
|
return {
|
|
228
106
|
id: __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_id, "f"),
|
|
229
|
-
code: __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f"),
|
|
230
|
-
name: __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f"),
|
|
231
107
|
};
|
|
232
108
|
}
|
|
233
109
|
/**
|
|
234
|
-
* Representación como string (
|
|
110
|
+
* Representación como string (ID del segmento).
|
|
235
111
|
*/
|
|
236
112
|
toString() {
|
|
237
|
-
return __classPrivateFieldGet(this,
|
|
113
|
+
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_id, "f");
|
|
238
114
|
}
|
|
239
115
|
/**
|
|
240
116
|
* Representación JSON para serialización.
|
|
@@ -250,6 +126,5 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
250
126
|
}
|
|
251
127
|
}
|
|
252
128
|
exports.CorporateConfigurationCarbonFootprintSegmentReference = CorporateConfigurationCarbonFootprintSegmentReference;
|
|
253
|
-
_CorporateConfigurationCarbonFootprintSegmentReference_id = new WeakMap()
|
|
129
|
+
_CorporateConfigurationCarbonFootprintSegmentReference_id = new WeakMap();
|
|
254
130
|
CorporateConfigurationCarbonFootprintSegmentReference.DEFAULT_PROPERTY_NAME = 'corporateSegmentReference';
|
|
255
|
-
CorporateConfigurationCarbonFootprintSegmentReference.MAX_NAME_LENGTH = 255;
|