@carbonbox/domain 0.4.8 → 0.4.10
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/shared/domain/value-objects/ActivityDataSubmissionReference.js +97 -61
- package/build/carbonbox/shared/domain/value-objects/Address.js +63 -52
- package/build/carbonbox/shared/domain/value-objects/AggregateId.js +13 -18
- package/build/carbonbox/shared/domain/value-objects/Boolean.js +29 -30
- package/build/carbonbox/shared/domain/value-objects/CalculationProcessReference.js +36 -32
- package/build/carbonbox/shared/domain/value-objects/CalculationVariableReferences.js +82 -62
- package/build/carbonbox/shared/domain/value-objects/CarbonClientReference.js +181 -114
- package/build/carbonbox/shared/domain/value-objects/CarbonClientReferences.js +109 -74
- package/build/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.js +37 -27
- package/build/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.js +101 -68
- package/build/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.js +95 -60
- package/build/carbonbox/shared/domain/value-objects/CodeList.js +57 -41
- package/build/carbonbox/shared/domain/value-objects/CollectionFieldReference.js +74 -49
- package/build/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.js +171 -116
- package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.js +70 -43
- package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.js +70 -43
- package/build/carbonbox/shared/domain/value-objects/Currency.js +10 -15
- package/build/carbonbox/shared/domain/value-objects/DateString.js +15 -20
- package/build/carbonbox/shared/domain/value-objects/DateTimeString.js +17 -22
- package/build/carbonbox/shared/domain/value-objects/Email.js +9 -14
- package/build/carbonbox/shared/domain/value-objects/EmissionCalculationFormulaReference.js +46 -31
- package/build/carbonbox/shared/domain/value-objects/EmissionCalculationReference.js +102 -77
- package/build/carbonbox/shared/domain/value-objects/EmissionFactorReference.js +56 -40
- package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.js +58 -38
- package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.js +95 -60
- package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.js +171 -116
- package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.js +43 -30
- package/build/carbonbox/shared/domain/value-objects/EventEditionReference.js +49 -33
- package/build/carbonbox/shared/domain/value-objects/EventEditionReferences.js +65 -49
- package/build/carbonbox/shared/domain/value-objects/EventReference.js +41 -31
- package/build/carbonbox/shared/domain/value-objects/ExecutionPeriod.js +95 -79
- package/build/carbonbox/shared/domain/value-objects/FacilityReference.js +34 -24
- package/build/carbonbox/shared/domain/value-objects/Gender.js +11 -16
- package/build/carbonbox/shared/domain/value-objects/GlobalWarmingPotentialReference.js +72 -53
- package/build/carbonbox/shared/domain/value-objects/Image.js +46 -38
- package/build/carbonbox/shared/domain/value-objects/Integer.js +13 -18
- package/build/carbonbox/shared/domain/value-objects/NullableCode.js +17 -22
- package/build/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.js +49 -31
- package/build/carbonbox/shared/domain/value-objects/NullableDate.js +25 -27
- package/build/carbonbox/shared/domain/value-objects/NullableDateTimeString.js +34 -37
- package/build/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.js +49 -31
- package/build/carbonbox/shared/domain/value-objects/NullableNumeric.js +60 -63
- package/build/carbonbox/shared/domain/value-objects/NullablePositiveInteger.js +4 -11
- package/build/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.js +49 -31
- package/build/carbonbox/shared/domain/value-objects/NullableStakeholderReference.js +8 -8
- package/build/carbonbox/shared/domain/value-objects/NullableString.js +22 -25
- package/build/carbonbox/shared/domain/value-objects/NullableTaxIdentificationNumber.js +43 -35
- package/build/carbonbox/shared/domain/value-objects/Numeric.js +72 -69
- package/build/carbonbox/shared/domain/value-objects/Phone.js +66 -47
- package/build/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.js +176 -121
- package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.js +101 -61
- package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.js +101 -61
- package/build/carbonbox/shared/domain/value-objects/ProductConfigurationSystemBoundaryReference.js +60 -40
- package/build/carbonbox/shared/domain/value-objects/ProductReference.js +46 -31
- package/build/carbonbox/shared/domain/value-objects/ServiceCatalogReference.js +60 -40
- package/build/carbonbox/shared/domain/value-objects/StakeholderReference.js +123 -75
- package/build/carbonbox/shared/domain/value-objects/StakeholderReferences.js +124 -81
- package/build/carbonbox/shared/domain/value-objects/String.js +13 -17
- package/build/carbonbox/shared/domain/value-objects/StringList.js +35 -35
- package/build/carbonbox/shared/domain/value-objects/TaxIdentification.js +121 -85
- package/build/carbonbox/shared/domain/value-objects/TaxIdentificationNumberList.js +57 -52
- package/build/carbonbox/shared/domain/value-objects/Url.js +14 -19
- package/build/carbonbox/shared/domain/value-objects/UrlList.js +57 -41
- package/build/carbonbox/shared/domain/value-objects/UserBusinessStatus.js +17 -22
- package/build/carbonbox/shared/domain/value-objects/UserEmail.js +48 -40
- package/build/carbonbox/shared/domain/value-objects/UserPassword.js +29 -32
- package/build/carbonbox/shared/domain/value-objects/UserPermissions.js +47 -46
- package/build/carbonbox/shared/domain/value-objects/UserType.js +17 -22
- package/build/carbonbox/shared/domain/value-objects/ValueObject.js +17 -16
- package/build/main/index.js +6 -2
- package/build/types/carbonbox/shared/domain/value-objects/ActivityDataSubmissionReference.d.ts +37 -1
- package/build/types/carbonbox/shared/domain/value-objects/ActivityDataSubmissionReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Address.d.ts +22 -4
- package/build/types/carbonbox/shared/domain/value-objects/Address.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/AggregateId.d.ts +4 -3
- package/build/types/carbonbox/shared/domain/value-objects/AggregateId.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/AggregateIdList.d.ts +2 -2
- package/build/types/carbonbox/shared/domain/value-objects/AggregateIdList.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Boolean.d.ts +5 -1
- package/build/types/carbonbox/shared/domain/value-objects/Boolean.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CalculationProcessReference.d.ts +5 -1
- package/build/types/carbonbox/shared/domain/value-objects/CalculationProcessReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CalculationVariableReferences.d.ts +24 -4
- package/build/types/carbonbox/shared/domain/value-objects/CalculationVariableReferences.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReference.d.ts +70 -2
- package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReferences.d.ts +39 -2
- package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReferences.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.d.ts +11 -1
- package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.d.ts +35 -1
- package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.d.ts +38 -2
- package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Code.d.ts +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Code.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CodeList.d.ts +18 -2
- package/build/types/carbonbox/shared/domain/value-objects/CodeList.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CollectionFieldReference.d.ts +26 -1
- package/build/types/carbonbox/shared/domain/value-objects/CollectionFieldReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.d.ts +64 -2
- 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 +30 -2
- 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 +30 -2
- package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Currency.d.ts +3 -2
- package/build/types/carbonbox/shared/domain/value-objects/Currency.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/DateString.d.ts +5 -3
- package/build/types/carbonbox/shared/domain/value-objects/DateString.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/DateTimeString.d.ts +5 -3
- package/build/types/carbonbox/shared/domain/value-objects/DateTimeString.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Email.d.ts +3 -2
- package/build/types/carbonbox/shared/domain/value-objects/Email.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationFormulaReference.d.ts +16 -1
- package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationFormulaReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationReference.d.ts +26 -1
- package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EmissionFactorReference.d.ts +17 -1
- package/build/types/carbonbox/shared/domain/value-objects/EmissionFactorReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EmissionSource.d.ts +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EmissionSource.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EmissionSources.d.ts +3 -3
- package/build/types/carbonbox/shared/domain/value-objects/EmissionSources.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +22 -2
- 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 +38 -2
- 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 +64 -2
- 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 +14 -1
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionReference.d.ts +17 -1
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionReferences.d.ts +20 -4
- package/build/types/carbonbox/shared/domain/value-objects/EventEditionReferences.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/EventReference.d.ts +11 -1
- package/build/types/carbonbox/shared/domain/value-objects/EventReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/ExecutionPeriod.d.ts +16 -1
- package/build/types/carbonbox/shared/domain/value-objects/ExecutionPeriod.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/FacilityReference.d.ts +11 -1
- package/build/types/carbonbox/shared/domain/value-objects/FacilityReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Gender.d.ts +4 -3
- package/build/types/carbonbox/shared/domain/value-objects/Gender.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/GlobalWarmingPotentialReference.d.ts +21 -2
- package/build/types/carbonbox/shared/domain/value-objects/GlobalWarmingPotentialReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Image.d.ts +12 -0
- package/build/types/carbonbox/shared/domain/value-objects/Image.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Integer.d.ts +4 -2
- package/build/types/carbonbox/shared/domain/value-objects/Integer.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableCode.d.ts +4 -2
- package/build/types/carbonbox/shared/domain/value-objects/NullableCode.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.d.ts +19 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableDate.d.ts +6 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableDate.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableDateTimeString.d.ts +5 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableDateTimeString.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +19 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableNumeric.d.ts +6 -2
- package/build/types/carbonbox/shared/domain/value-objects/NullableNumeric.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullablePositiveInteger.d.ts +3 -2
- package/build/types/carbonbox/shared/domain/value-objects/NullablePositiveInteger.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.d.ts +19 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableStakeholderReference.d.ts +2 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableStakeholderReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableString.d.ts +5 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableString.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/NullableTaxIdentificationNumber.d.ts +20 -5
- package/build/types/carbonbox/shared/domain/value-objects/NullableTaxIdentificationNumber.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Numeric.d.ts +11 -2
- package/build/types/carbonbox/shared/domain/value-objects/Numeric.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Phone.d.ts +21 -2
- package/build/types/carbonbox/shared/domain/value-objects/Phone.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/PositiveInteger.d.ts +2 -1
- package/build/types/carbonbox/shared/domain/value-objects/PositiveInteger.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.d.ts +60 -2
- 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 +45 -4
- 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 +45 -4
- package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationSystemBoundaryReference.d.ts +21 -1
- package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationSystemBoundaryReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/ProductReference.d.ts +16 -1
- package/build/types/carbonbox/shared/domain/value-objects/ProductReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/ServiceCatalogReference.d.ts +21 -1
- package/build/types/carbonbox/shared/domain/value-objects/ServiceCatalogReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/StakeholderReference.d.ts +51 -2
- package/build/types/carbonbox/shared/domain/value-objects/StakeholderReference.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/StakeholderReferences.d.ts +46 -2
- package/build/types/carbonbox/shared/domain/value-objects/StakeholderReferences.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/String.d.ts +3 -1
- package/build/types/carbonbox/shared/domain/value-objects/String.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/StringList.d.ts +7 -1
- package/build/types/carbonbox/shared/domain/value-objects/StringList.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/TaxIdentification.d.ts +41 -3
- package/build/types/carbonbox/shared/domain/value-objects/TaxIdentification.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumber.d.ts +4 -4
- package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumber.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumberList.d.ts +16 -4
- package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumberList.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/Url.d.ts +2 -1
- package/build/types/carbonbox/shared/domain/value-objects/Url.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/UrlList.d.ts +18 -2
- package/build/types/carbonbox/shared/domain/value-objects/UrlList.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/UserBusinessStatus.d.ts +4 -2
- package/build/types/carbonbox/shared/domain/value-objects/UserBusinessStatus.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/UserEmail.d.ts +10 -1
- package/build/types/carbonbox/shared/domain/value-objects/UserEmail.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/UserPassword.d.ts +7 -3
- package/build/types/carbonbox/shared/domain/value-objects/UserPassword.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/UserPermissions.d.ts +11 -3
- package/build/types/carbonbox/shared/domain/value-objects/UserPermissions.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/UserType.d.ts +4 -2
- package/build/types/carbonbox/shared/domain/value-objects/UserType.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/ValueObject.d.ts +2 -0
- package/build/types/carbonbox/shared/domain/value-objects/ValueObject.d.ts.map +1 -1
- package/build/types/main/index.d.ts +2 -0
- package/build/types/main/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ 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
|
|
13
|
+
var _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, _CorporateCarbonFootprintSegmentConfigurationReferences_options;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CorporateCarbonFootprintSegmentConfigurationReferences = void 0;
|
|
16
16
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
@@ -25,14 +25,13 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
25
25
|
* Constructor protegido para que solo clases hijas puedan instanciar.
|
|
26
26
|
* Aplica todas las validaciones de dominio al momento de construcción.
|
|
27
27
|
*/
|
|
28
|
-
constructor(value, skipDomainValidation, propertyName =
|
|
28
|
+
constructor(value, skipDomainValidation, propertyName = CorporateCarbonFootprintSegmentConfigurationReferences.DEFAULT_PROPERTY_NAME, options = CorporateCarbonFootprintSegmentConfigurationReferences.DEFAULT_OPTIONS) {
|
|
29
29
|
super(value, skipDomainValidation, propertyName, 'The provided value must be of type CorporateCarbonFootprintSegmentConfigurationReference[] from the domain layer', { allowNull: false, allowUndefined: false });
|
|
30
|
-
_CorporateCarbonFootprintSegmentConfigurationReferences_instances.add(this);
|
|
31
30
|
_CorporateCarbonFootprintSegmentConfigurationReferences_configurations.set(this, void 0);
|
|
32
31
|
_CorporateCarbonFootprintSegmentConfigurationReferences_options.set(this, void 0);
|
|
33
|
-
const finalOptions = { ...
|
|
32
|
+
const finalOptions = { ...CorporateCarbonFootprintSegmentConfigurationReferences.DEFAULT_OPTIONS, ...options };
|
|
34
33
|
if (skipDomainValidation === false) {
|
|
35
|
-
|
|
34
|
+
CorporateCarbonFootprintSegmentConfigurationReferences.validateConfigurations(value, propertyName, finalOptions);
|
|
36
35
|
}
|
|
37
36
|
__classPrivateFieldSet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, [...value], "f"); // Create defensive copy
|
|
38
37
|
__classPrivateFieldSet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_options, finalOptions, "f");
|
|
@@ -41,13 +40,132 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
41
40
|
* Validación estática para reutilización en factory methods y constructores.
|
|
42
41
|
*/
|
|
43
42
|
static validateConfigurations(value, propertyName, options) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
this.guardAgainstInvalidArrayType(value, propertyName);
|
|
44
|
+
this.guardAgainstInvalidEmptyArray(value, options, propertyName);
|
|
45
|
+
this.guardAgainstDuplicateConfigurationIds(value, propertyName);
|
|
47
46
|
value.forEach((configuration, index) => {
|
|
48
|
-
|
|
47
|
+
this.guardAgainstInvalidConfiguration(configuration, index, propertyName);
|
|
49
48
|
});
|
|
50
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Valida que el valor sea un array.
|
|
52
|
+
*/
|
|
53
|
+
static guardAgainstInvalidArrayType(value, propertyName) {
|
|
54
|
+
if (!Array.isArray(value)) {
|
|
55
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array', typeof value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Valida que el array no esté vacío si no se permite.
|
|
60
|
+
*/
|
|
61
|
+
static guardAgainstInvalidEmptyArray(value, options, propertyName) {
|
|
62
|
+
if (!options.allowEmpty && value.length === 0) {
|
|
63
|
+
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty array', 'empty array');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Valida que no haya códigos de configuración duplicados.
|
|
68
|
+
*/
|
|
69
|
+
static guardAgainstDuplicateConfigurationIds(value, propertyName) {
|
|
70
|
+
const configurationIds = value.map((config) => config.id);
|
|
71
|
+
const uniqueIds = new Set(configurationIds);
|
|
72
|
+
if (configurationIds.length !== uniqueIds.size) {
|
|
73
|
+
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.id`, 'unique configuration IDs', 'duplicate IDs found');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Valida una configuración individual.
|
|
78
|
+
*/
|
|
79
|
+
static guardAgainstInvalidConfiguration(configuration, index, basePropertyName) {
|
|
80
|
+
const propertyName = `${basePropertyName}[${index}]`;
|
|
81
|
+
this.guardAgainstInvalidConfigurationStructure(configuration, propertyName);
|
|
82
|
+
this.guardAgainstInvalidConfigurationId(configuration.id, `${propertyName}.id`);
|
|
83
|
+
this.guardAgainstInvalidCorporateSegment(configuration.segment, `${propertyName}.segment`);
|
|
84
|
+
this.guardAgainstInvalidCorporateSubsegment(configuration.subsegment, `${propertyName}.subsegment`);
|
|
85
|
+
this.guardAgainstInvalidEmissionSources(configuration.emissionSources, `${propertyName}.emissionSources`);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Valida que el objeto de configuración tenga la estructura correcta.
|
|
89
|
+
*/
|
|
90
|
+
static guardAgainstInvalidConfigurationStructure(configuration, propertyName) {
|
|
91
|
+
if (!configuration || typeof configuration !== 'object') {
|
|
92
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CorporateCarbonFootprintSegmentConfigurationReference object', typeof configuration);
|
|
93
|
+
}
|
|
94
|
+
if (typeof configuration.id !== 'string') {
|
|
95
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof configuration.id);
|
|
96
|
+
}
|
|
97
|
+
if (!configuration.segment || typeof configuration.segment !== 'object') {
|
|
98
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.segment`, 'CorporateSegmentReference object', typeof configuration.segment);
|
|
99
|
+
}
|
|
100
|
+
if (configuration.subsegment !== null && typeof configuration.subsegment !== 'object') {
|
|
101
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.subsegment`, 'CorporateSubsegmentReference object or null', typeof configuration.subsegment);
|
|
102
|
+
}
|
|
103
|
+
if (!Array.isArray(configuration.emissionSources)) {
|
|
104
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.emissionSources`, 'EmissionSource array', typeof configuration.emissionSources);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Valida el ID de configuración usando las validaciones de AggregateId.
|
|
109
|
+
*/
|
|
110
|
+
static guardAgainstInvalidConfigurationId(id, propertyName) {
|
|
111
|
+
String_1.String.guardAgainstEmptyValue(id, propertyName);
|
|
112
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Valida la referencia de segmento corporativo.
|
|
116
|
+
*/
|
|
117
|
+
static guardAgainstInvalidCorporateSegment(segment, propertyName) {
|
|
118
|
+
this.guardAgainstInvalidSegmentReference(segment, propertyName, 'CorporateConfigurationCarbonFootprintSegmentReference');
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Valida la referencia de subsegmento corporativo (puede ser null).
|
|
122
|
+
*/
|
|
123
|
+
static guardAgainstInvalidCorporateSubsegment(subsegment, propertyName) {
|
|
124
|
+
if (subsegment !== null) {
|
|
125
|
+
this.guardAgainstInvalidSegmentReference(subsegment, propertyName, 'CorporateConfigurationCarbonFootprintSubsegmentReference');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Valida el array de fuentes de emisión.
|
|
130
|
+
*/
|
|
131
|
+
static guardAgainstInvalidEmissionSources(emissionSources, propertyName) {
|
|
132
|
+
if (!Array.isArray(emissionSources)) {
|
|
133
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'EmissionSource array', typeof emissionSources);
|
|
134
|
+
}
|
|
135
|
+
if (emissionSources.length === 0) {
|
|
136
|
+
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty EmissionSource array', 'empty array');
|
|
137
|
+
}
|
|
138
|
+
emissionSources.forEach((emissionSource, index) => {
|
|
139
|
+
if (typeof emissionSource !== 'string') {
|
|
140
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}[${index}]`, 'EmissionSource enum value', typeof emissionSource);
|
|
141
|
+
}
|
|
142
|
+
if (!Object.values(EmissionSource_1.EmissionSource).includes(emissionSource)) {
|
|
143
|
+
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}[${index}]`, `valid EmissionSource enum value (${Object.values(EmissionSource_1.EmissionSource).join(', ')})`, emissionSource);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Valida una referencia de segmento genérica.
|
|
149
|
+
*/
|
|
150
|
+
static guardAgainstInvalidSegmentReference(reference, propertyName, typeName) {
|
|
151
|
+
if (!reference || typeof reference !== 'object') {
|
|
152
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, `${typeName} object`, typeof reference);
|
|
153
|
+
}
|
|
154
|
+
if (typeof reference.id !== 'string') {
|
|
155
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof reference.id);
|
|
156
|
+
}
|
|
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
|
+
String_1.String.guardAgainstEmptyValue(reference.id, `${propertyName}.id`);
|
|
164
|
+
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
|
+
}
|
|
51
169
|
/**
|
|
52
170
|
* Configuraciones de segmento corporativo (inmutable).
|
|
53
171
|
*/
|
|
@@ -222,7 +340,7 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
222
340
|
* Compara la igualdad semántica con otra colección de configuraciones.
|
|
223
341
|
*/
|
|
224
342
|
equals(other) {
|
|
225
|
-
if (!(other instanceof
|
|
343
|
+
if (!(other instanceof CorporateCarbonFootprintSegmentConfigurationReferences)) {
|
|
226
344
|
return false;
|
|
227
345
|
}
|
|
228
346
|
if (__classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_options, "f").allowEmpty !== __classPrivateFieldGet(other, _CorporateCarbonFootprintSegmentConfigurationReferences_options, "f").allowEmpty) {
|
|
@@ -233,9 +351,47 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
233
351
|
}
|
|
234
352
|
return __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, "f").every((config, index) => {
|
|
235
353
|
const otherConfig = __classPrivateFieldGet(other, _CorporateCarbonFootprintSegmentConfigurationReferences_configurations, "f")[index];
|
|
236
|
-
return
|
|
354
|
+
return this.configurationsAreEqual(config, otherConfig);
|
|
237
355
|
});
|
|
238
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Compara si dos configuraciones son iguales.
|
|
359
|
+
*/
|
|
360
|
+
configurationsAreEqual(config1, config2) {
|
|
361
|
+
return (config1.id === config2.id
|
|
362
|
+
&& this.segmentReferencesAreEqual(config1.segment, config2.segment)
|
|
363
|
+
&& this.subsegmentReferencesAreEqual(config1.subsegment, config2.subsegment)
|
|
364
|
+
&& this.emissionSourcesAreEqual(config1.emissionSources, config2.emissionSources));
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Compara referencias de segmento.
|
|
368
|
+
*/
|
|
369
|
+
segmentReferencesAreEqual(seg1, seg2) {
|
|
370
|
+
return seg1.id === seg2.id && seg1.code === seg2.code && seg1.name === seg2.name;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Compara referencias de subsegmento (pueden ser null).
|
|
374
|
+
*/
|
|
375
|
+
subsegmentReferencesAreEqual(subseg1, subseg2) {
|
|
376
|
+
if (subseg1 === null && subseg2 === null) {
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
379
|
+
if (subseg1 === null || subseg2 === null) {
|
|
380
|
+
return false;
|
|
381
|
+
}
|
|
382
|
+
return subseg1.id === subseg2.id && subseg1.code === subseg2.code && subseg1.name === subseg2.name;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Compara arrays de fuentes de emisión.
|
|
386
|
+
*/
|
|
387
|
+
emissionSourcesAreEqual(sources1, sources2) {
|
|
388
|
+
if (sources1.length !== sources2.length) {
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
const sorted1 = [...sources1].sort();
|
|
392
|
+
const sorted2 = [...sources2].sort();
|
|
393
|
+
return sorted1.every((source, index) => source === sorted2[index]);
|
|
394
|
+
}
|
|
239
395
|
/**
|
|
240
396
|
* Genera un hash code para usar en colecciones.
|
|
241
397
|
*/
|
|
@@ -281,10 +437,10 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
281
437
|
/**
|
|
282
438
|
* Método estático para validar si un array es válido.
|
|
283
439
|
*/
|
|
284
|
-
static isValidConfigurations(value, options =
|
|
440
|
+
static isValidConfigurations(value, options = CorporateCarbonFootprintSegmentConfigurationReferences.DEFAULT_OPTIONS) {
|
|
285
441
|
try {
|
|
286
|
-
const finalOptions = { ...
|
|
287
|
-
|
|
442
|
+
const finalOptions = { ...CorporateCarbonFootprintSegmentConfigurationReferences.DEFAULT_OPTIONS, ...options };
|
|
443
|
+
CorporateCarbonFootprintSegmentConfigurationReferences.validateConfigurations(value, 'test', finalOptions);
|
|
288
444
|
return true;
|
|
289
445
|
}
|
|
290
446
|
catch {
|
|
@@ -293,108 +449,7 @@ class CorporateCarbonFootprintSegmentConfigurationReferences extends ValueObject
|
|
|
293
449
|
}
|
|
294
450
|
}
|
|
295
451
|
exports.CorporateCarbonFootprintSegmentConfigurationReferences = CorporateCarbonFootprintSegmentConfigurationReferences;
|
|
296
|
-
|
|
297
|
-
if (!Array.isArray(value)) {
|
|
298
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array', typeof value);
|
|
299
|
-
}
|
|
300
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmptyArray = function _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmptyArray(value, options, propertyName) {
|
|
301
|
-
if (!options.allowEmpty && value.length === 0) {
|
|
302
|
-
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty array', 'empty array');
|
|
303
|
-
}
|
|
304
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstDuplicateConfigurationIds = function _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstDuplicateConfigurationIds(value, propertyName) {
|
|
305
|
-
const configurationIds = value.map((config) => config.id);
|
|
306
|
-
const uniqueIds = new Set(configurationIds);
|
|
307
|
-
if (configurationIds.length !== uniqueIds.size) {
|
|
308
|
-
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.id`, 'unique configuration IDs', 'duplicate IDs found');
|
|
309
|
-
}
|
|
310
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfiguration = function _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfiguration(configuration, index, basePropertyName) {
|
|
311
|
-
const propertyName = `${basePropertyName}[${index}]`;
|
|
312
|
-
__classPrivateFieldGet(this, _a, "m", _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfigurationStructure).call(this, configuration, propertyName);
|
|
313
|
-
__classPrivateFieldGet(this, _a, "m", _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfigurationId).call(this, configuration.id, `${propertyName}.id`);
|
|
314
|
-
__classPrivateFieldGet(this, _a, "m", _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidCorporateSegment).call(this, configuration.segment, `${propertyName}.segment`);
|
|
315
|
-
__classPrivateFieldGet(this, _a, "m", _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidCorporateSubsegment).call(this, configuration.subsegment, `${propertyName}.subsegment`);
|
|
316
|
-
__classPrivateFieldGet(this, _a, "m", _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmissionSources).call(this, configuration.emissionSources, `${propertyName}.emissionSources`);
|
|
317
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfigurationStructure = function _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfigurationStructure(configuration, propertyName) {
|
|
318
|
-
if (!configuration || typeof configuration !== 'object') {
|
|
319
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CorporateCarbonFootprintSegmentConfigurationReference object', typeof configuration);
|
|
320
|
-
}
|
|
321
|
-
if (typeof configuration.id !== 'string') {
|
|
322
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof configuration.id);
|
|
323
|
-
}
|
|
324
|
-
if (!configuration.segment || typeof configuration.segment !== 'object') {
|
|
325
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.segment`, 'CorporateSegmentReference object', typeof configuration.segment);
|
|
326
|
-
}
|
|
327
|
-
if (configuration.subsegment !== null && typeof configuration.subsegment !== 'object') {
|
|
328
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.subsegment`, 'CorporateSubsegmentReference object or null', typeof configuration.subsegment);
|
|
329
|
-
}
|
|
330
|
-
if (!Array.isArray(configuration.emissionSources)) {
|
|
331
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.emissionSources`, 'EmissionSource array', typeof configuration.emissionSources);
|
|
332
|
-
}
|
|
333
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfigurationId = function _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfigurationId(id, propertyName) {
|
|
334
|
-
String_1.String.guardAgainstEmptyValue(id, propertyName);
|
|
335
|
-
AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
|
|
336
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidCorporateSegment = function _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidCorporateSegment(segment, propertyName) {
|
|
337
|
-
__classPrivateFieldGet(this, _a, "m", _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegmentReference).call(this, segment, propertyName, 'CorporateConfigurationCarbonFootprintSegmentReference');
|
|
338
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidCorporateSubsegment = function _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidCorporateSubsegment(subsegment, propertyName) {
|
|
339
|
-
if (subsegment !== null) {
|
|
340
|
-
__classPrivateFieldGet(this, _a, "m", _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegmentReference).call(this, subsegment, propertyName, 'CorporateConfigurationCarbonFootprintSubsegmentReference');
|
|
341
|
-
}
|
|
342
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmissionSources = function _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmissionSources(emissionSources, propertyName) {
|
|
343
|
-
if (!Array.isArray(emissionSources)) {
|
|
344
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'EmissionSource array', typeof emissionSources);
|
|
345
|
-
}
|
|
346
|
-
if (emissionSources.length === 0) {
|
|
347
|
-
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty EmissionSource array', 'empty array');
|
|
348
|
-
}
|
|
349
|
-
emissionSources.forEach((emissionSource, index) => {
|
|
350
|
-
if (typeof emissionSource !== 'string') {
|
|
351
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}[${index}]`, 'EmissionSource enum value', typeof emissionSource);
|
|
352
|
-
}
|
|
353
|
-
if (!Object.values(EmissionSource_1.EmissionSource).includes(emissionSource)) {
|
|
354
|
-
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}[${index}]`, `valid EmissionSource enum value (${Object.values(EmissionSource_1.EmissionSource).join(', ')})`, emissionSource);
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegmentReference = function _CorporateCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegmentReference(reference, propertyName, typeName) {
|
|
358
|
-
if (!reference || typeof reference !== 'object') {
|
|
359
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, `${typeName} object`, typeof reference);
|
|
360
|
-
}
|
|
361
|
-
if (typeof reference.id !== 'string') {
|
|
362
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof reference.id);
|
|
363
|
-
}
|
|
364
|
-
if (typeof reference.code !== 'string') {
|
|
365
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.code`, 'string', typeof reference.code);
|
|
366
|
-
}
|
|
367
|
-
if (typeof reference.name !== 'string') {
|
|
368
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof reference.name);
|
|
369
|
-
}
|
|
370
|
-
String_1.String.guardAgainstEmptyValue(reference.id, `${propertyName}.id`);
|
|
371
|
-
AggregateId_1.AggregateId.guardAgainstInvalidId(reference.id, `${propertyName}.id`);
|
|
372
|
-
String_1.String.guardAgainstEmptyValue(reference.code, `${propertyName}.code`);
|
|
373
|
-
Code_1.Code.guardAgainstInvalidCode(reference.code);
|
|
374
|
-
String_1.String.guardAgainstEmptyValue(reference.name, `${propertyName}.name`);
|
|
375
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_configurationsAreEqual = function _CorporateCarbonFootprintSegmentConfigurationReferences_configurationsAreEqual(config1, config2) {
|
|
376
|
-
return (config1.id === config2.id
|
|
377
|
-
&& __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_instances, "m", _CorporateCarbonFootprintSegmentConfigurationReferences_segmentReferencesAreEqual).call(this, config1.segment, config2.segment)
|
|
378
|
-
&& __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_instances, "m", _CorporateCarbonFootprintSegmentConfigurationReferences_subsegmentReferencesAreEqual).call(this, config1.subsegment, config2.subsegment)
|
|
379
|
-
&& __classPrivateFieldGet(this, _CorporateCarbonFootprintSegmentConfigurationReferences_instances, "m", _CorporateCarbonFootprintSegmentConfigurationReferences_emissionSourcesAreEqual).call(this, config1.emissionSources, config2.emissionSources));
|
|
380
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_segmentReferencesAreEqual = function _CorporateCarbonFootprintSegmentConfigurationReferences_segmentReferencesAreEqual(seg1, seg2) {
|
|
381
|
-
return seg1.id === seg2.id && seg1.code === seg2.code && seg1.name === seg2.name;
|
|
382
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_subsegmentReferencesAreEqual = function _CorporateCarbonFootprintSegmentConfigurationReferences_subsegmentReferencesAreEqual(subseg1, subseg2) {
|
|
383
|
-
if (subseg1 === null && subseg2 === null) {
|
|
384
|
-
return true;
|
|
385
|
-
}
|
|
386
|
-
if (subseg1 === null || subseg2 === null) {
|
|
387
|
-
return false;
|
|
388
|
-
}
|
|
389
|
-
return subseg1.id === subseg2.id && subseg1.code === subseg2.code && subseg1.name === subseg2.name;
|
|
390
|
-
}, _CorporateCarbonFootprintSegmentConfigurationReferences_emissionSourcesAreEqual = function _CorporateCarbonFootprintSegmentConfigurationReferences_emissionSourcesAreEqual(sources1, sources2) {
|
|
391
|
-
if (sources1.length !== sources2.length) {
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
const sorted1 = [...sources1].sort();
|
|
395
|
-
const sorted2 = [...sources2].sort();
|
|
396
|
-
return sorted1.every((source, index) => source === sorted2[index]);
|
|
397
|
-
};
|
|
452
|
+
_CorporateCarbonFootprintSegmentConfigurationReferences_configurations = new WeakMap(), _CorporateCarbonFootprintSegmentConfigurationReferences_options = new WeakMap();
|
|
398
453
|
CorporateCarbonFootprintSegmentConfigurationReferences.DEFAULT_PROPERTY_NAME = 'corporateSegmentConfigurationReferences';
|
|
399
454
|
CorporateCarbonFootprintSegmentConfigurationReferences.DEFAULT_OPTIONS = {
|
|
400
455
|
allowEmpty: false, // Por defecto no permite estar vacío
|
|
@@ -10,7 +10,7 @@ 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
|
|
13
|
+
var _CorporateConfigurationCarbonFootprintSegmentReference_id, _CorporateConfigurationCarbonFootprintSegmentReference_code, _CorporateConfigurationCarbonFootprintSegmentReference_name;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CorporateConfigurationCarbonFootprintSegmentReference = void 0;
|
|
16
16
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
@@ -23,14 +23,13 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
23
23
|
* Constructor protegido para que solo clases hijas puedan instanciar.
|
|
24
24
|
* Aplica todas las validaciones de dominio al momento de construcción.
|
|
25
25
|
*/
|
|
26
|
-
constructor(value, skipDomainValidation, propertyName =
|
|
26
|
+
constructor(value, skipDomainValidation, propertyName = CorporateConfigurationCarbonFootprintSegmentReference.DEFAULT_PROPERTY_NAME) {
|
|
27
27
|
super(value, skipDomainValidation, propertyName, 'The provided value must be of type CorporateConfigurationCarbonFootprintSegmentReference from the domain layer', { allowNull: false, allowUndefined: false });
|
|
28
|
-
_CorporateConfigurationCarbonFootprintSegmentReference_instances.add(this);
|
|
29
28
|
_CorporateConfigurationCarbonFootprintSegmentReference_id.set(this, void 0);
|
|
30
29
|
_CorporateConfigurationCarbonFootprintSegmentReference_code.set(this, void 0);
|
|
31
30
|
_CorporateConfigurationCarbonFootprintSegmentReference_name.set(this, void 0);
|
|
32
31
|
if (skipDomainValidation === false) {
|
|
33
|
-
|
|
32
|
+
CorporateConfigurationCarbonFootprintSegmentReference
|
|
34
33
|
.validateCorporateConfigurationCarbonFootprintSegmentReference(value, propertyName);
|
|
35
34
|
}
|
|
36
35
|
__classPrivateFieldSet(this, _CorporateConfigurationCarbonFootprintSegmentReference_id, value.id.trim(), "f");
|
|
@@ -41,10 +40,62 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
41
40
|
* Validación estática para reutilización en factory methods y constructores.
|
|
42
41
|
*/
|
|
43
42
|
static validateCorporateConfigurationCarbonFootprintSegmentReference(value, propertyName) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
this.guardAgainstInvalidType(value, propertyName);
|
|
44
|
+
this.guardAgainstInvalidId(value.id);
|
|
45
|
+
this.guardAgainstInvalidCode(value.code);
|
|
46
|
+
this.guardAgainstInvalidName(value.name);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Valida que el objeto tenga la estructura correcta.
|
|
50
|
+
*/
|
|
51
|
+
static guardAgainstInvalidType(value, propertyName) {
|
|
52
|
+
if (this.valueIsInvalid(value)) {
|
|
53
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CorporateConfigurationCarbonFootprintSegmentReference object', typeof value);
|
|
54
|
+
}
|
|
55
|
+
if (typeof value.id !== 'string') {
|
|
56
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
|
|
57
|
+
}
|
|
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
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Valida si el valor principal es inválido.
|
|
67
|
+
*/
|
|
68
|
+
static valueIsInvalid(value) {
|
|
69
|
+
return value === null || value === undefined || typeof value !== 'object';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Valida el ID usando las validaciones de AggregateId.
|
|
73
|
+
*/
|
|
74
|
+
static guardAgainstInvalidId(id) {
|
|
75
|
+
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
76
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
77
|
+
}
|
|
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;
|
|
48
99
|
}
|
|
49
100
|
/**
|
|
50
101
|
* ID único del segmento corporativo.
|
|
@@ -123,18 +174,24 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
123
174
|
* Compara la igualdad semántica con otro objeto CorporateConfigurationCarbonFootprintSegmentReference.
|
|
124
175
|
*/
|
|
125
176
|
equals(other) {
|
|
126
|
-
if (
|
|
177
|
+
if (this.otherIsNotCorporateConfigurationCarbonFootprintSegmentReference(other)) {
|
|
127
178
|
return false;
|
|
128
179
|
}
|
|
129
180
|
return (__classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_id, "f") === __classPrivateFieldGet(other, _CorporateConfigurationCarbonFootprintSegmentReference_id, "f")
|
|
130
181
|
&& __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f") === __classPrivateFieldGet(other, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f")
|
|
131
182
|
&& __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f") === __classPrivateFieldGet(other, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f"));
|
|
132
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Verifica si el otro objeto no es una instancia de CorporateConfigurationCarbonFootprintSegmentReference.
|
|
186
|
+
*/
|
|
187
|
+
otherIsNotCorporateConfigurationCarbonFootprintSegmentReference(other) {
|
|
188
|
+
return (other instanceof CorporateConfigurationCarbonFootprintSegmentReference) === false;
|
|
189
|
+
}
|
|
133
190
|
/**
|
|
134
191
|
* Compara si dos segmentos tienen el mismo código.
|
|
135
192
|
*/
|
|
136
193
|
hasSameCode(other) {
|
|
137
|
-
if (
|
|
194
|
+
if (this.otherIsNotCorporateConfigurationCarbonFootprintSegmentReference(other)) {
|
|
138
195
|
return false;
|
|
139
196
|
}
|
|
140
197
|
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f") === __classPrivateFieldGet(other, _CorporateConfigurationCarbonFootprintSegmentReference_code, "f");
|
|
@@ -143,7 +200,7 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
143
200
|
* Compara si dos segmentos tienen el mismo nombre.
|
|
144
201
|
*/
|
|
145
202
|
hasSameName(other) {
|
|
146
|
-
if (
|
|
203
|
+
if (this.otherIsNotCorporateConfigurationCarbonFootprintSegmentReference(other)) {
|
|
147
204
|
return false;
|
|
148
205
|
}
|
|
149
206
|
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f") === __classPrivateFieldGet(other, _CorporateConfigurationCarbonFootprintSegmentReference_name, "f");
|
|
@@ -152,7 +209,7 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
152
209
|
* Compara si dos segmentos tienen el mismo ID.
|
|
153
210
|
*/
|
|
154
211
|
hasSameId(other) {
|
|
155
|
-
if (
|
|
212
|
+
if (this.otherIsNotCorporateConfigurationCarbonFootprintSegmentReference(other)) {
|
|
156
213
|
return false;
|
|
157
214
|
}
|
|
158
215
|
return __classPrivateFieldGet(this, _CorporateConfigurationCarbonFootprintSegmentReference_id, "f") === __classPrivateFieldGet(other, _CorporateConfigurationCarbonFootprintSegmentReference_id, "f");
|
|
@@ -193,36 +250,6 @@ class CorporateConfigurationCarbonFootprintSegmentReference extends ObjectValueO
|
|
|
193
250
|
}
|
|
194
251
|
}
|
|
195
252
|
exports.CorporateConfigurationCarbonFootprintSegmentReference = CorporateConfigurationCarbonFootprintSegmentReference;
|
|
196
|
-
|
|
197
|
-
if (__classPrivateFieldGet(this, _a, "m", _CorporateConfigurationCarbonFootprintSegmentReference_valueIsInvalid).call(this, value)) {
|
|
198
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CorporateConfigurationCarbonFootprintSegmentReference object', typeof value);
|
|
199
|
-
}
|
|
200
|
-
if (typeof value.id !== 'string') {
|
|
201
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
|
|
202
|
-
}
|
|
203
|
-
if (typeof value.code !== 'string') {
|
|
204
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'string', typeof value.code);
|
|
205
|
-
}
|
|
206
|
-
if (typeof value.name !== 'string') {
|
|
207
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'string', typeof value.name);
|
|
208
|
-
}
|
|
209
|
-
}, _CorporateConfigurationCarbonFootprintSegmentReference_valueIsInvalid = function _CorporateConfigurationCarbonFootprintSegmentReference_valueIsInvalid(value) {
|
|
210
|
-
return value === null || value === undefined || typeof value !== 'object';
|
|
211
|
-
}, _CorporateConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidId = function _CorporateConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidId(id) {
|
|
212
|
-
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
213
|
-
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
214
|
-
}, _CorporateConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidCode = function _CorporateConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidCode(code) {
|
|
215
|
-
String_1.String.guardAgainstEmptyValue(code, 'code');
|
|
216
|
-
Code_1.Code.guardAgainstInvalidCode(code);
|
|
217
|
-
}, _CorporateConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidName = function _CorporateConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidName(name) {
|
|
218
|
-
String_1.String.guardAgainstEmptyValue(name, 'name');
|
|
219
|
-
if (__classPrivateFieldGet(this, _a, "m", _CorporateConfigurationCarbonFootprintSegmentReference_nameLengthIsInvalid).call(this, name)) {
|
|
220
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', `string with maximum ${this.MAX_NAME_LENGTH} characters`, `string with ${name.trim().length} characters`);
|
|
221
|
-
}
|
|
222
|
-
}, _CorporateConfigurationCarbonFootprintSegmentReference_nameLengthIsInvalid = function _CorporateConfigurationCarbonFootprintSegmentReference_nameLengthIsInvalid(name) {
|
|
223
|
-
return name.trim().length > this.MAX_NAME_LENGTH;
|
|
224
|
-
}, _CorporateConfigurationCarbonFootprintSegmentReference_otherIsNotCorporateConfigurationCarbonFootprintSegmentReference = function _CorporateConfigurationCarbonFootprintSegmentReference_otherIsNotCorporateConfigurationCarbonFootprintSegmentReference(other) {
|
|
225
|
-
return (other instanceof _a) === false;
|
|
226
|
-
};
|
|
253
|
+
_CorporateConfigurationCarbonFootprintSegmentReference_id = new WeakMap(), _CorporateConfigurationCarbonFootprintSegmentReference_code = new WeakMap(), _CorporateConfigurationCarbonFootprintSegmentReference_name = new WeakMap();
|
|
227
254
|
CorporateConfigurationCarbonFootprintSegmentReference.DEFAULT_PROPERTY_NAME = 'corporateSegmentReference';
|
|
228
255
|
CorporateConfigurationCarbonFootprintSegmentReference.MAX_NAME_LENGTH = 255;
|