@carbonbox/domain 0.7.22 → 0.7.24
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/emission-calculation-process/calculation-workflows/domain/value-objects/CalculationWorkflowJobSequence.js +3 -5
- package/build/carbonbox/emission-calculation-process/calculation-workflows/domain/value-objects/CalculationWorkflowParallelJobs.js +28 -27
- 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/emission-calculation-process/calculation-workflows/domain/value-objects/CalculationWorkflowJobSequence.d.ts +2 -2
- package/build/types/carbonbox/emission-calculation-process/calculation-workflows/domain/value-objects/CalculationWorkflowJobSequence.d.ts.map +1 -1
- package/build/types/carbonbox/emission-calculation-process/calculation-workflows/domain/value-objects/CalculationWorkflowParallelJobs.d.ts +5 -5
- package/build/types/carbonbox/emission-calculation-process/calculation-workflows/domain/value-objects/CalculationWorkflowParallelJobs.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
|
@@ -10,13 +10,12 @@ 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 _EventEditionConfigurationCarbonFootprintSubsegmentReference_id
|
|
13
|
+
var _EventEditionConfigurationCarbonFootprintSubsegmentReference_id;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.EventEditionConfigurationCarbonFootprintSubsegmentReference = void 0;
|
|
16
16
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
17
17
|
const ObjectValueObject_1 = require("./ObjectValueObject");
|
|
18
18
|
const AggregateId_1 = require("./AggregateId");
|
|
19
|
-
const Code_1 = require("./Code");
|
|
20
19
|
const String_1 = require("./String");
|
|
21
20
|
class EventEditionConfigurationCarbonFootprintSubsegmentReference extends ObjectValueObject_1.ObjectValueObject {
|
|
22
21
|
/**
|
|
@@ -26,15 +25,11 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReference extends Object
|
|
|
26
25
|
constructor(value, skipDomainValidation, propertyName = EventEditionConfigurationCarbonFootprintSubsegmentReference.DEFAULT_PROPERTY_NAME) {
|
|
27
26
|
super(value, skipDomainValidation, propertyName, 'The provided value must be of type EventEditionConfigurationCarbonFootprintSubsegmentReference from the domain layer', { allowNull: false, allowUndefined: false });
|
|
28
27
|
_EventEditionConfigurationCarbonFootprintSubsegmentReference_id.set(this, void 0);
|
|
29
|
-
_EventEditionConfigurationCarbonFootprintSubsegmentReference_code.set(this, void 0);
|
|
30
|
-
_EventEditionConfigurationCarbonFootprintSubsegmentReference_name.set(this, void 0);
|
|
31
28
|
if (skipDomainValidation === false) {
|
|
32
29
|
EventEditionConfigurationCarbonFootprintSubsegmentReference
|
|
33
30
|
.validateEventEditionConfigurationCarbonFootprintSubsegmentReference(value, propertyName);
|
|
34
31
|
}
|
|
35
32
|
__classPrivateFieldSet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, value.id.trim(), "f");
|
|
36
|
-
__classPrivateFieldSet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, value.code.trim().toUpperCase(), "f");
|
|
37
|
-
__classPrivateFieldSet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_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 EventEditionConfigurationCarbonFootprintSubsegmentReference extends Object
|
|
|
42
37
|
static validateEventEditionConfigurationCarbonFootprintSubsegmentReference(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 EventEditionConfigurationCarbonFootprintSubsegmentReference extends Object
|
|
|
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 el ID usando las validaciones de AggregateId.
|
|
@@ -69,136 +56,29 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReference extends Object
|
|
|
69
56
|
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
70
57
|
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
71
58
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Valida el código de subsegmento usando las validaciones de Code.
|
|
74
|
-
*/
|
|
75
|
-
static guardAgainstInvalidCode(code) {
|
|
76
|
-
String_1.String.guardAgainstEmptyValue(code, 'code');
|
|
77
|
-
Code_1.Code.guardAgainstInvalidCode(code);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Valida el nombre del subsegmento.
|
|
81
|
-
*/
|
|
82
|
-
static guardAgainstInvalidName(name) {
|
|
83
|
-
String_1.String.guardAgainstEmptyValue(name, 'name');
|
|
84
|
-
if (this.nameLengthIsInvalid(name)) {
|
|
85
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', `string with maximum ${this.MAX_NAME_LENGTH} characters`, `string with ${name.trim().length} characters`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Verifica si la longitud del nombre es inválida.
|
|
90
|
-
*/
|
|
91
|
-
static nameLengthIsInvalid(name) {
|
|
92
|
-
return name.trim().length > this.MAX_NAME_LENGTH;
|
|
93
|
-
}
|
|
94
59
|
/**
|
|
95
60
|
* ID único del subsegmento (UUID).
|
|
96
61
|
*/
|
|
97
62
|
get id() {
|
|
98
63
|
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f");
|
|
99
64
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Código del subsegmento.
|
|
102
|
-
*/
|
|
103
|
-
get code() {
|
|
104
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, "f");
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Nombre descriptivo del subsegmento.
|
|
108
|
-
*/
|
|
109
|
-
get name() {
|
|
110
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f");
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Verifica si el subsegmento corresponde a un código específico.
|
|
114
|
-
*/
|
|
115
|
-
hasCode(code) {
|
|
116
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, "f") === code.trim().toUpperCase();
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Verifica si el subsegmento tiene un nombre específico.
|
|
120
|
-
*/
|
|
121
|
-
hasName(name) {
|
|
122
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f") === name.trim();
|
|
123
|
-
}
|
|
124
65
|
/**
|
|
125
66
|
* Verifica si el subsegmento tiene un ID específico.
|
|
126
67
|
*/
|
|
127
68
|
hasId(id) {
|
|
128
69
|
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f") === id.trim();
|
|
129
70
|
}
|
|
130
|
-
/**
|
|
131
|
-
* Obtiene una representación legible del subsegmento.
|
|
132
|
-
*/
|
|
133
|
-
getDisplayName() {
|
|
134
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f");
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Obtiene una representación completa con código y nombre.
|
|
138
|
-
*/
|
|
139
|
-
getFullDisplayName() {
|
|
140
|
-
return `${__classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, "f")} - ${__classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f")}`;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Verifica si el nombre del subsegmento contiene un texto específico.
|
|
144
|
-
*/
|
|
145
|
-
nameContains(searchText) {
|
|
146
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f").toLowerCase().includes(searchText.toLowerCase().trim());
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Verifica si el subsegmento coincide con un patrón de búsqueda en código o nombre.
|
|
150
|
-
*/
|
|
151
|
-
matches(searchText) {
|
|
152
|
-
const trimmedSearch = searchText.toLowerCase().trim();
|
|
153
|
-
return (__classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f").toLowerCase().includes(trimmedSearch)
|
|
154
|
-
|| __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, "f").toLowerCase().includes(trimmedSearch)
|
|
155
|
-
|| __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f").toLowerCase().includes(trimmedSearch));
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Verifica si el subsegmento es de un tipo específico basado en su nombre.
|
|
159
|
-
* Útil para categorizar subsegmentos de etapa (técnico, comercial, logístico, etc.).
|
|
160
|
-
*/
|
|
161
|
-
isSubsegmentType(subsegmentType) {
|
|
162
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f").toLowerCase().includes(subsegmentType.toLowerCase().trim());
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Verifica si es un subsegmento crítico para la etapa.
|
|
166
|
-
* Basado en palabras clave que indican criticidad.
|
|
167
|
-
*/
|
|
168
|
-
isCriticalSubsegment() {
|
|
169
|
-
const criticalKeywords = ['crítico', 'critical', 'esencial', 'essential', 'prioritario', 'priority', 'urgente', 'urgent'];
|
|
170
|
-
const lowerSubsegmentName = __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f").toLowerCase();
|
|
171
|
-
return criticalKeywords.some((keyword) => lowerSubsegmentName.includes(keyword));
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Ejecuta una función con el código y nombre del subsegmento.
|
|
175
|
-
* Útil para operaciones funcionales.
|
|
176
|
-
*/
|
|
177
|
-
apply(callback) {
|
|
178
|
-
callback(__classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f"), __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, "f"), __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f"));
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Transforma el subsegmento aplicando una función.
|
|
182
|
-
* Útil para transformaciones funcionales.
|
|
183
|
-
*/
|
|
184
|
-
map(transform) {
|
|
185
|
-
return transform(__classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f"), __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, "f"), __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f"));
|
|
186
|
-
}
|
|
187
71
|
/**
|
|
188
72
|
* Compara la igualdad semántica con otra referencia de subsegmento.
|
|
189
|
-
* Dos referencias son iguales si tienen el mismo código y nombre.
|
|
190
73
|
*/
|
|
191
74
|
equals(other) {
|
|
192
75
|
if (!(other instanceof EventEditionConfigurationCarbonFootprintSubsegmentReference)) {
|
|
193
76
|
return false;
|
|
194
77
|
}
|
|
195
|
-
return
|
|
196
|
-
&& __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, "f") === __classPrivateFieldGet(other, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, "f")
|
|
197
|
-
&& __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f") === __classPrivateFieldGet(other, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f"));
|
|
78
|
+
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f") === __classPrivateFieldGet(other, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f");
|
|
198
79
|
}
|
|
199
80
|
/**
|
|
200
|
-
* Compara si dos referencias apuntan al mismo subsegmento
|
|
201
|
-
* basándose únicamente en el código (identificador único).
|
|
81
|
+
* Compara si dos referencias apuntan al mismo subsegmento.
|
|
202
82
|
*/
|
|
203
83
|
hasSameSubsegment(other) {
|
|
204
84
|
if (!(other instanceof EventEditionConfigurationCarbonFootprintSubsegmentReference)) {
|
|
@@ -206,30 +86,11 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReference extends Object
|
|
|
206
86
|
}
|
|
207
87
|
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f") === __classPrivateFieldGet(other, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f");
|
|
208
88
|
}
|
|
209
|
-
/**
|
|
210
|
-
* Compara si dos subsegmentos tienen el mismo código.
|
|
211
|
-
*/
|
|
212
|
-
hasSameCode(other) {
|
|
213
|
-
if (!(other instanceof EventEditionConfigurationCarbonFootprintSubsegmentReference)) {
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, "f") === __classPrivateFieldGet(other, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, "f");
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Compara si dos subsegmentos tienen el mismo nombre.
|
|
220
|
-
*/
|
|
221
|
-
hasSameName(other) {
|
|
222
|
-
if (!(other instanceof EventEditionConfigurationCarbonFootprintSubsegmentReference)) {
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f") === __classPrivateFieldGet(other, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f");
|
|
226
|
-
}
|
|
227
89
|
/**
|
|
228
90
|
* Genera un hash code para usar en colecciones.
|
|
229
|
-
* Basado en el código de subsegmento y nombre.
|
|
230
91
|
*/
|
|
231
92
|
hashCode() {
|
|
232
|
-
return
|
|
93
|
+
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f");
|
|
233
94
|
}
|
|
234
95
|
/**
|
|
235
96
|
* Convierte a representación primitiva para persistencia.
|
|
@@ -237,15 +98,13 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReference extends Object
|
|
|
237
98
|
toPrimitives() {
|
|
238
99
|
return {
|
|
239
100
|
id: __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f"),
|
|
240
|
-
code: __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_code, "f"),
|
|
241
|
-
name: __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_name, "f"),
|
|
242
101
|
};
|
|
243
102
|
}
|
|
244
103
|
/**
|
|
245
|
-
* Representación como string (
|
|
104
|
+
* Representación como string (id del subsegmento).
|
|
246
105
|
*/
|
|
247
106
|
toString() {
|
|
248
|
-
return __classPrivateFieldGet(this,
|
|
107
|
+
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReference_id, "f");
|
|
249
108
|
}
|
|
250
109
|
/**
|
|
251
110
|
* Representación JSON para serialización.
|
|
@@ -255,6 +114,5 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReference extends Object
|
|
|
255
114
|
}
|
|
256
115
|
}
|
|
257
116
|
exports.EventEditionConfigurationCarbonFootprintSubsegmentReference = EventEditionConfigurationCarbonFootprintSubsegmentReference;
|
|
258
|
-
_EventEditionConfigurationCarbonFootprintSubsegmentReference_id = new WeakMap()
|
|
117
|
+
_EventEditionConfigurationCarbonFootprintSubsegmentReference_id = new WeakMap();
|
|
259
118
|
EventEditionConfigurationCarbonFootprintSubsegmentReference.DEFAULT_PROPERTY_NAME = 'eventEditionStageSubsegmentReference';
|
|
260
|
-
EventEditionConfigurationCarbonFootprintSubsegmentReference.MAX_NAME_LENGTH = 255;
|
|
@@ -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 EventEditionConfigurationCarbonFootprintSubsegmentReferences extends ValueObject_1.ValueObject {
|
|
23
22
|
/**
|
|
24
23
|
* Constructor protegido para que solo clases hijas puedan instanciar.
|
|
@@ -80,8 +79,6 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReferences extends Value
|
|
|
80
79
|
const propertyName = `${basePropertyName}[${index}]`;
|
|
81
80
|
this.guardAgainstInvalidSubsegmentStructure(subsegmentReference, propertyName);
|
|
82
81
|
this.guardAgainstInvalidSubsegmentId(subsegmentReference.id, `${propertyName}.id`);
|
|
83
|
-
this.guardAgainstInvalidSubsegmentCode(subsegmentReference.code, `${propertyName}.code`);
|
|
84
|
-
this.guardAgainstInvalidSubsegmentName(subsegmentReference.name, `${propertyName}.name`);
|
|
85
82
|
}
|
|
86
83
|
/**
|
|
87
84
|
* Valida que el objeto de referencia de subsegmento tenga la estructura correcta.
|
|
@@ -93,12 +90,6 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReferences extends Value
|
|
|
93
90
|
if (typeof subsegmentReference.id !== 'string') {
|
|
94
91
|
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof subsegmentReference.id);
|
|
95
92
|
}
|
|
96
|
-
if (typeof subsegmentReference.code !== 'string') {
|
|
97
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.code`, 'string', typeof subsegmentReference.code);
|
|
98
|
-
}
|
|
99
|
-
if (typeof subsegmentReference.name !== 'string') {
|
|
100
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof subsegmentReference.name);
|
|
101
|
-
}
|
|
102
93
|
}
|
|
103
94
|
/**
|
|
104
95
|
* Valida el ID de subsegmento usando las validaciones de AggregateId.
|
|
@@ -107,19 +98,6 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReferences extends Value
|
|
|
107
98
|
String_1.String.guardAgainstEmptyValue(id, propertyName);
|
|
108
99
|
AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
|
|
109
100
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Valida el código de subsegmento usando las validaciones de Code.
|
|
112
|
-
*/
|
|
113
|
-
static guardAgainstInvalidSubsegmentCode(code, propertyName) {
|
|
114
|
-
String_1.String.guardAgainstEmptyValue(code, propertyName);
|
|
115
|
-
Code_1.Code.guardAgainstInvalidCode(code, propertyName);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Valida el nombre del subsegmento.
|
|
119
|
-
*/
|
|
120
|
-
static guardAgainstInvalidSubsegmentName(name, propertyName) {
|
|
121
|
-
String_1.String.guardAgainstEmptyValue(name, propertyName);
|
|
122
|
-
}
|
|
123
101
|
/**
|
|
124
102
|
* Referencias de subsegmentos de etapa de edición de evento (inmutable).
|
|
125
103
|
*/
|
|
@@ -172,34 +150,17 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReferences extends Value
|
|
|
172
150
|
return true;
|
|
173
151
|
}
|
|
174
152
|
/**
|
|
175
|
-
* Obtiene un subsegmento por su
|
|
153
|
+
* Obtiene un subsegmento por su ID.
|
|
176
154
|
*/
|
|
177
155
|
getSubsegmentById(subsegmentId) {
|
|
178
156
|
const subsegmentFound = __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").find((subsegment) => subsegment.id === subsegmentId.trim());
|
|
179
157
|
return subsegmentFound || null;
|
|
180
158
|
}
|
|
181
|
-
getSubsegmentByCode(subsegmentCode) {
|
|
182
|
-
const subsegmentFound = __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").find((subsegment) => subsegment.code === subsegmentCode.trim().toUpperCase());
|
|
183
|
-
return subsegmentFound || null;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Verifica si existe un subsegmento con el código especificado.
|
|
187
|
-
*/
|
|
188
|
-
hasSubsegmentCode(subsegmentCode) {
|
|
189
|
-
return this.getSubsegmentByCode(subsegmentCode) !== null;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Obtiene un subsegmento por su nombre.
|
|
193
|
-
*/
|
|
194
|
-
getSubsegmentByName(subsegmentName) {
|
|
195
|
-
const subsegmentFound = __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").find((subsegment) => subsegment.name === subsegmentName.trim());
|
|
196
|
-
return subsegmentFound || null;
|
|
197
|
-
}
|
|
198
159
|
/**
|
|
199
|
-
* Verifica si existe un subsegmento con el
|
|
160
|
+
* Verifica si existe un subsegmento con el ID especificado.
|
|
200
161
|
*/
|
|
201
|
-
|
|
202
|
-
return this.
|
|
162
|
+
hasSubsegmentId(subsegmentId) {
|
|
163
|
+
return this.getSubsegmentById(subsegmentId) !== null;
|
|
203
164
|
}
|
|
204
165
|
/**
|
|
205
166
|
* Obtiene un subsegmento por su índice.
|
|
@@ -211,35 +172,17 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReferences extends Value
|
|
|
211
172
|
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f")[index];
|
|
212
173
|
}
|
|
213
174
|
/**
|
|
214
|
-
* Obtiene todos los
|
|
175
|
+
* Obtiene todos los IDs de subsegmento.
|
|
215
176
|
*/
|
|
216
177
|
getAllSubsegmentIds() {
|
|
217
178
|
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").map((subsegment) => subsegment.id);
|
|
218
179
|
}
|
|
219
|
-
getAllSubsegmentCodes() {
|
|
220
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").map((subsegment) => subsegment.code);
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Obtiene todos los nombres de subsegmento.
|
|
224
|
-
*/
|
|
225
|
-
getAllSubsegmentNames() {
|
|
226
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").map((subsegment) => subsegment.name);
|
|
227
|
-
}
|
|
228
180
|
/**
|
|
229
|
-
* Busca subsegmentos
|
|
230
|
-
*/
|
|
231
|
-
findSubsegmentsByNameContaining(searchText) {
|
|
232
|
-
const lowerSearchText = searchText.toLowerCase().trim();
|
|
233
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").filter((subsegment) => subsegment.name.toLowerCase().includes(lowerSearchText));
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Busca subsegmentos que coincidan con un patrón en código o nombre.
|
|
181
|
+
* Busca subsegmentos que coincidan con un patrón en el ID.
|
|
237
182
|
*/
|
|
238
183
|
findSubsegmentsMatching(searchText) {
|
|
239
184
|
const lowerSearchText = searchText.toLowerCase().trim();
|
|
240
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").filter((subsegment) => subsegment.id.toLowerCase().includes(lowerSearchText)
|
|
241
|
-
|| subsegment.code.toLowerCase().includes(lowerSearchText)
|
|
242
|
-
|| subsegment.name.toLowerCase().includes(lowerSearchText));
|
|
185
|
+
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").filter((subsegment) => subsegment.id.toLowerCase().includes(lowerSearchText));
|
|
243
186
|
}
|
|
244
187
|
/**
|
|
245
188
|
* Obtiene los primeros N subsegmentos.
|
|
@@ -259,108 +202,13 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReferences extends Value
|
|
|
259
202
|
}
|
|
260
203
|
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").slice(-count);
|
|
261
204
|
}
|
|
262
|
-
/**
|
|
263
|
-
* Verifica si todos los subsegmentos tienen nombres únicos.
|
|
264
|
-
*/
|
|
265
|
-
hasUniqueNames() {
|
|
266
|
-
const names = this.getAllSubsegmentNames();
|
|
267
|
-
const uniqueNames = new Set(names);
|
|
268
|
-
return names.length === uniqueNames.size;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Obtiene subsegmentos con nombres duplicados.
|
|
272
|
-
*/
|
|
273
|
-
getDuplicateNameSubsegments() {
|
|
274
|
-
const nameCountMap = new Map();
|
|
275
|
-
const duplicates = [];
|
|
276
|
-
// Contar ocurrencias de nombres
|
|
277
|
-
__classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").forEach((subsegment) => {
|
|
278
|
-
const count = nameCountMap.get(subsegment.name) || 0;
|
|
279
|
-
nameCountMap.set(subsegment.name, count + 1);
|
|
280
|
-
});
|
|
281
|
-
// Encontrar subsegmentos con nombres duplicados
|
|
282
|
-
__classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").forEach((subsegment) => {
|
|
283
|
-
if (nameCountMap.get(subsegment.name) > 1) {
|
|
284
|
-
duplicates.push(subsegment);
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
return duplicates;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Filtra subsegmentos por tipo basado en palabras clave en el nombre.
|
|
291
|
-
*/
|
|
292
|
-
getSubsegmentsByType(typeKeyword) {
|
|
293
|
-
const lowerKeyword = typeKeyword.toLowerCase().trim();
|
|
294
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").filter((subsegment) => subsegment.name.toLowerCase().includes(lowerKeyword));
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Verifica si hay subsegmentos de un tipo específico.
|
|
298
|
-
*/
|
|
299
|
-
hasSubsegmentsOfType(typeKeyword) {
|
|
300
|
-
return this.getSubsegmentsByType(typeKeyword).length > 0;
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Obtiene subsegmentos que contengan palabras clave relacionadas con logística.
|
|
304
|
-
*/
|
|
305
|
-
getLogisticSubsegments() {
|
|
306
|
-
const logisticKeywords = ['logística', 'transporte', 'envío', 'distribución', 'almacén', 'logistics', 'transport', 'shipping', 'distribution', 'warehouse'];
|
|
307
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").filter((subsegment) => {
|
|
308
|
-
const lowerName = subsegment.name.toLowerCase();
|
|
309
|
-
return logisticKeywords.some((keyword) => lowerName.includes(keyword));
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Obtiene subsegmentos que contengan palabras clave relacionadas con marketing.
|
|
314
|
-
*/
|
|
315
|
-
getMarketingSubsegments() {
|
|
316
|
-
const marketingKeywords = ['marketing', 'promoción', 'publicidad', 'comunicación', 'branding', 'promotion', 'advertising', 'communication'];
|
|
317
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").filter((subsegment) => {
|
|
318
|
-
const lowerName = subsegment.name.toLowerCase();
|
|
319
|
-
return marketingKeywords.some((keyword) => lowerName.includes(keyword));
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Obtiene subsegmentos que contengan palabras clave relacionadas con tecnología.
|
|
324
|
-
*/
|
|
325
|
-
getTechnicalSubsegments() {
|
|
326
|
-
const technicalKeywords = ['técnico', 'tecnología', 'sistema', 'digital', 'software', 'hardware', 'technical', 'technology', 'system', 'digital'];
|
|
327
|
-
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").filter((subsegment) => {
|
|
328
|
-
const lowerName = subsegment.name.toLowerCase();
|
|
329
|
-
return technicalKeywords.some((keyword) => lowerName.includes(keyword));
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Agrupa subsegmentos por la primera palabra de su nombre.
|
|
334
|
-
*/
|
|
335
|
-
groupSubsegmentsByFirstWord() {
|
|
336
|
-
const groupMap = new Map();
|
|
337
|
-
__classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").forEach((subsegment) => {
|
|
338
|
-
const firstWord = subsegment.name.split(' ')[0].toLowerCase();
|
|
339
|
-
const existing = groupMap.get(firstWord) || [];
|
|
340
|
-
existing.push(subsegment);
|
|
341
|
-
groupMap.set(firstWord, existing);
|
|
342
|
-
});
|
|
343
|
-
return groupMap;
|
|
344
|
-
}
|
|
345
205
|
/**
|
|
346
206
|
* Obtiene estadísticas de la colección.
|
|
347
207
|
*/
|
|
348
208
|
getStatistics() {
|
|
349
209
|
const totalSubsegments = __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").length;
|
|
350
|
-
const hasUniqueNames = this.hasUniqueNames();
|
|
351
|
-
const averageNameLength = totalSubsegments > 0
|
|
352
|
-
? __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").reduce((sum, subsegment) => sum + subsegment.name.length, 0) / totalSubsegments
|
|
353
|
-
: 0;
|
|
354
|
-
const logisticSubsegments = this.getLogisticSubsegments().length;
|
|
355
|
-
const marketingSubsegments = this.getMarketingSubsegments().length;
|
|
356
|
-
const technicalSubsegments = this.getTechnicalSubsegments().length;
|
|
357
210
|
return {
|
|
358
211
|
totalSubsegments,
|
|
359
|
-
hasUniqueNames,
|
|
360
|
-
averageNameLength: Math.round(averageNameLength * 100) / 100, // Redondear a 2 decimales
|
|
361
|
-
logisticSubsegments,
|
|
362
|
-
marketingSubsegments,
|
|
363
|
-
technicalSubsegments,
|
|
364
212
|
allowsEmpty: __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_options, "f").allowEmpty === true,
|
|
365
213
|
isValidState: this.isValidState(),
|
|
366
214
|
};
|
|
@@ -387,16 +235,14 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReferences extends Value
|
|
|
387
235
|
* Compara si dos referencias de subsegmento son iguales.
|
|
388
236
|
*/
|
|
389
237
|
subsegmentReferencesAreEqual(subsegment1, subsegment2) {
|
|
390
|
-
return
|
|
391
|
-
&& subsegment1.code === subsegment2.code
|
|
392
|
-
&& subsegment1.name === subsegment2.name);
|
|
238
|
+
return subsegment1.id === subsegment2.id;
|
|
393
239
|
}
|
|
394
240
|
/**
|
|
395
241
|
* Genera un hash code para usar en colecciones.
|
|
396
242
|
*/
|
|
397
243
|
hashCode() {
|
|
398
244
|
const subsegmentHashes = __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f")
|
|
399
|
-
.map((subsegment) =>
|
|
245
|
+
.map((subsegment) => subsegment.id)
|
|
400
246
|
.join('|');
|
|
401
247
|
const optionsHash = __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_options, "f").allowEmpty ? 'allowEmpty' : 'requireElements';
|
|
402
248
|
return `eventEditionStageSubsegments_${optionsHash}_${subsegmentHashes}`;
|
|
@@ -407,8 +253,6 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReferences extends Value
|
|
|
407
253
|
toPrimitives() {
|
|
408
254
|
return __classPrivateFieldGet(this, _EventEditionConfigurationCarbonFootprintSubsegmentReferences_subsegmentReferences, "f").map((subsegment) => ({
|
|
409
255
|
id: subsegment.id,
|
|
410
|
-
code: subsegment.code,
|
|
411
|
-
name: subsegment.name,
|
|
412
256
|
}));
|
|
413
257
|
}
|
|
414
258
|
/**
|