@carbonbox/domain 0.4.7 → 0.4.9
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 +4 -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 +1 -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 _CarbonFootprintSegmentReferences_segmentReferences, _CarbonFootprintSegmentReferences_options;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CarbonFootprintSegmentReferences = void 0;
|
|
16
16
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
@@ -24,14 +24,13 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
24
24
|
* Constructor protegido para que solo clases hijas puedan instanciar.
|
|
25
25
|
* Aplica todas las validaciones de dominio al momento de construcción.
|
|
26
26
|
*/
|
|
27
|
-
constructor(value, skipDomainValidation, propertyName =
|
|
27
|
+
constructor(value, skipDomainValidation, propertyName = CarbonFootprintSegmentReferences.DEFAULT_PROPERTY_NAME, options = CarbonFootprintSegmentReferences.DEFAULT_OPTIONS) {
|
|
28
28
|
super(value, skipDomainValidation, propertyName, 'The provided value must be of type SegmentReference[] from the domain layer', { allowNull: false, allowUndefined: false });
|
|
29
|
-
_CarbonFootprintSegmentReferences_instances.add(this);
|
|
30
29
|
_CarbonFootprintSegmentReferences_segmentReferences.set(this, void 0);
|
|
31
30
|
_CarbonFootprintSegmentReferences_options.set(this, void 0);
|
|
32
|
-
const finalOptions = { ...
|
|
31
|
+
const finalOptions = { ...CarbonFootprintSegmentReferences.DEFAULT_OPTIONS, ...options };
|
|
33
32
|
if (skipDomainValidation === false) {
|
|
34
|
-
|
|
33
|
+
CarbonFootprintSegmentReferences.validateSegmentReferences(value, finalOptions, propertyName);
|
|
35
34
|
}
|
|
36
35
|
__classPrivateFieldSet(this, _CarbonFootprintSegmentReferences_segmentReferences, [...value], "f"); // Create defensive copy
|
|
37
36
|
__classPrivateFieldSet(this, _CarbonFootprintSegmentReferences_options, finalOptions, "f");
|
|
@@ -40,13 +39,86 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
40
39
|
* Validación estática para reutilización en factory methods y constructores.
|
|
41
40
|
*/
|
|
42
41
|
static validateSegmentReferences(value, options, propertyName) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
this.guardAgainstInvalidArrayType(value, propertyName);
|
|
43
|
+
this.guardAgainstInvalidEmptyArray(value, options, propertyName);
|
|
44
|
+
this.guardAgainstDuplicateSegmentCodes(value, propertyName);
|
|
46
45
|
value.forEach((segmentReference, index) => {
|
|
47
|
-
|
|
46
|
+
this.guardAgainstInvalidSegmentReference(segmentReference, index, propertyName);
|
|
48
47
|
});
|
|
49
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Valida que el valor sea un array.
|
|
51
|
+
*/
|
|
52
|
+
static guardAgainstInvalidArrayType(value, propertyName) {
|
|
53
|
+
if (!Array.isArray(value)) {
|
|
54
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array', typeof value);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Valida que el array no esté vacío si no se permite.
|
|
59
|
+
*/
|
|
60
|
+
static guardAgainstInvalidEmptyArray(value, options, propertyName) {
|
|
61
|
+
if (!options.allowEmpty && value.length === 0) {
|
|
62
|
+
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty array', 'empty array');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Valida que no haya códigos de segmento duplicados.
|
|
67
|
+
*/
|
|
68
|
+
static guardAgainstDuplicateSegmentCodes(value, propertyName) {
|
|
69
|
+
const segmentCodes = value.map((segment) => segment.code);
|
|
70
|
+
const uniqueCodes = new Set(segmentCodes);
|
|
71
|
+
if (segmentCodes.length !== uniqueCodes.size) {
|
|
72
|
+
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.code`, 'unique segment codes', 'duplicate codes found');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Valida una referencia de segmento individual.
|
|
77
|
+
*/
|
|
78
|
+
static guardAgainstInvalidSegmentReference(segmentReference, index, basePropertyName) {
|
|
79
|
+
const propertyName = `${basePropertyName}[${index}]`;
|
|
80
|
+
this.guardAgainstInvalidSegmentStructure(segmentReference, propertyName);
|
|
81
|
+
this.guardAgainstInvalidSegmentId(segmentReference.id, `${propertyName}.id`);
|
|
82
|
+
this.guardAgainstInvalidSegmentCode(segmentReference.code, `${propertyName}.code`);
|
|
83
|
+
this.guardAgainstInvalidSegmentName(segmentReference.name, `${propertyName}.name`);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Valida que el objeto de referencia de segmento tenga la estructura correcta.
|
|
87
|
+
*/
|
|
88
|
+
static guardAgainstInvalidSegmentStructure(segmentReference, propertyName) {
|
|
89
|
+
if (!segmentReference || typeof segmentReference !== 'object') {
|
|
90
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'SegmentReference object', typeof segmentReference);
|
|
91
|
+
}
|
|
92
|
+
if (typeof segmentReference.id !== 'string') {
|
|
93
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof segmentReference.id);
|
|
94
|
+
}
|
|
95
|
+
if (typeof segmentReference.code !== 'string') {
|
|
96
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.code`, 'string', typeof segmentReference.code);
|
|
97
|
+
}
|
|
98
|
+
if (typeof segmentReference.name !== 'string') {
|
|
99
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof segmentReference.name);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Valida el ID de segmento usando las validaciones de AggregateId.
|
|
104
|
+
*/
|
|
105
|
+
static guardAgainstInvalidSegmentId(id, propertyName) {
|
|
106
|
+
String_1.String.guardAgainstEmptyValue(id, propertyName);
|
|
107
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Valida el código de segmento usando las validaciones de Code.
|
|
111
|
+
*/
|
|
112
|
+
static guardAgainstInvalidSegmentCode(code, propertyName) {
|
|
113
|
+
String_1.String.guardAgainstEmptyValue(code, propertyName);
|
|
114
|
+
Code_1.Code.guardAgainstInvalidCode(code, propertyName);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Valida el nombre del segmento.
|
|
118
|
+
*/
|
|
119
|
+
static guardAgainstInvalidSegmentName(name, propertyName) {
|
|
120
|
+
String_1.String.guardAgainstEmptyValue(name, propertyName);
|
|
121
|
+
}
|
|
50
122
|
/**
|
|
51
123
|
* Referencias de segmentos (inmutable).
|
|
52
124
|
*/
|
|
@@ -188,7 +260,7 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
188
260
|
* Compara la igualdad semántica con otra colección de referencias de segmento.
|
|
189
261
|
*/
|
|
190
262
|
equals(other) {
|
|
191
|
-
if (!(other instanceof
|
|
263
|
+
if (!(other instanceof CarbonFootprintSegmentReferences)) {
|
|
192
264
|
return false;
|
|
193
265
|
}
|
|
194
266
|
if (__classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_options, "f").allowEmpty !== __classPrivateFieldGet(other, _CarbonFootprintSegmentReferences_options, "f").allowEmpty) {
|
|
@@ -199,9 +271,17 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
199
271
|
}
|
|
200
272
|
return __classPrivateFieldGet(this, _CarbonFootprintSegmentReferences_segmentReferences, "f").every((segment, index) => {
|
|
201
273
|
const otherSegment = __classPrivateFieldGet(other, _CarbonFootprintSegmentReferences_segmentReferences, "f")[index];
|
|
202
|
-
return
|
|
274
|
+
return this.segmentReferencesAreEqual(segment, otherSegment);
|
|
203
275
|
});
|
|
204
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* Compara si dos referencias de segmento son iguales.
|
|
279
|
+
*/
|
|
280
|
+
segmentReferencesAreEqual(segment1, segment2) {
|
|
281
|
+
return (segment1.id === segment2.id
|
|
282
|
+
&& segment1.code === segment2.code
|
|
283
|
+
&& segment1.name === segment2.name);
|
|
284
|
+
}
|
|
205
285
|
/**
|
|
206
286
|
* Genera un hash code para usar en colecciones.
|
|
207
287
|
*/
|
|
@@ -231,10 +311,10 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
231
311
|
/**
|
|
232
312
|
* Método estático para validar si un array es válido.
|
|
233
313
|
*/
|
|
234
|
-
static isValidSegmentReferences(value, options =
|
|
314
|
+
static isValidSegmentReferences(value, options = CarbonFootprintSegmentReferences.DEFAULT_OPTIONS) {
|
|
235
315
|
try {
|
|
236
|
-
const finalOptions = { ...
|
|
237
|
-
|
|
316
|
+
const finalOptions = { ...CarbonFootprintSegmentReferences.DEFAULT_OPTIONS, ...options };
|
|
317
|
+
CarbonFootprintSegmentReferences.validateSegmentReferences(value, finalOptions, 'test');
|
|
238
318
|
return true;
|
|
239
319
|
}
|
|
240
320
|
catch {
|
|
@@ -243,52 +323,7 @@ class CarbonFootprintSegmentReferences extends ValueObject_1.ValueObject {
|
|
|
243
323
|
}
|
|
244
324
|
}
|
|
245
325
|
exports.CarbonFootprintSegmentReferences = CarbonFootprintSegmentReferences;
|
|
246
|
-
|
|
247
|
-
if (!Array.isArray(value)) {
|
|
248
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array', typeof value);
|
|
249
|
-
}
|
|
250
|
-
}, _CarbonFootprintSegmentReferences_guardAgainstInvalidEmptyArray = function _CarbonFootprintSegmentReferences_guardAgainstInvalidEmptyArray(value, options, propertyName) {
|
|
251
|
-
if (!options.allowEmpty && value.length === 0) {
|
|
252
|
-
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty array', 'empty array');
|
|
253
|
-
}
|
|
254
|
-
}, _CarbonFootprintSegmentReferences_guardAgainstDuplicateSegmentCodes = function _CarbonFootprintSegmentReferences_guardAgainstDuplicateSegmentCodes(value, propertyName) {
|
|
255
|
-
const segmentCodes = value.map((segment) => segment.code);
|
|
256
|
-
const uniqueCodes = new Set(segmentCodes);
|
|
257
|
-
if (segmentCodes.length !== uniqueCodes.size) {
|
|
258
|
-
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.code`, 'unique segment codes', 'duplicate codes found');
|
|
259
|
-
}
|
|
260
|
-
}, _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentReference = function _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentReference(segmentReference, index, basePropertyName) {
|
|
261
|
-
const propertyName = `${basePropertyName}[${index}]`;
|
|
262
|
-
__classPrivateFieldGet(this, _a, "m", _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentStructure).call(this, segmentReference, propertyName);
|
|
263
|
-
__classPrivateFieldGet(this, _a, "m", _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentId).call(this, segmentReference.id, `${propertyName}.id`);
|
|
264
|
-
__classPrivateFieldGet(this, _a, "m", _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentCode).call(this, segmentReference.code, `${propertyName}.code`);
|
|
265
|
-
__classPrivateFieldGet(this, _a, "m", _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentName).call(this, segmentReference.name, `${propertyName}.name`);
|
|
266
|
-
}, _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentStructure = function _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentStructure(segmentReference, propertyName) {
|
|
267
|
-
if (!segmentReference || typeof segmentReference !== 'object') {
|
|
268
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'SegmentReference object', typeof segmentReference);
|
|
269
|
-
}
|
|
270
|
-
if (typeof segmentReference.id !== 'string') {
|
|
271
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof segmentReference.id);
|
|
272
|
-
}
|
|
273
|
-
if (typeof segmentReference.code !== 'string') {
|
|
274
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.code`, 'string', typeof segmentReference.code);
|
|
275
|
-
}
|
|
276
|
-
if (typeof segmentReference.name !== 'string') {
|
|
277
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof segmentReference.name);
|
|
278
|
-
}
|
|
279
|
-
}, _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentId = function _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentId(id, propertyName) {
|
|
280
|
-
String_1.String.guardAgainstEmptyValue(id, propertyName);
|
|
281
|
-
AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
|
|
282
|
-
}, _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentCode = function _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentCode(code, propertyName) {
|
|
283
|
-
String_1.String.guardAgainstEmptyValue(code, propertyName);
|
|
284
|
-
Code_1.Code.guardAgainstInvalidCode(code, propertyName);
|
|
285
|
-
}, _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentName = function _CarbonFootprintSegmentReferences_guardAgainstInvalidSegmentName(name, propertyName) {
|
|
286
|
-
String_1.String.guardAgainstEmptyValue(name, propertyName);
|
|
287
|
-
}, _CarbonFootprintSegmentReferences_segmentReferencesAreEqual = function _CarbonFootprintSegmentReferences_segmentReferencesAreEqual(segment1, segment2) {
|
|
288
|
-
return (segment1.id === segment2.id
|
|
289
|
-
&& segment1.code === segment2.code
|
|
290
|
-
&& segment1.name === segment2.name);
|
|
291
|
-
};
|
|
326
|
+
_CarbonFootprintSegmentReferences_segmentReferences = new WeakMap(), _CarbonFootprintSegmentReferences_options = new WeakMap();
|
|
292
327
|
CarbonFootprintSegmentReferences.DEFAULT_PROPERTY_NAME = 'carbonFootprintSegmentReferences';
|
|
293
328
|
CarbonFootprintSegmentReferences.DEFAULT_OPTIONS = {
|
|
294
329
|
allowEmpty: true,
|
|
@@ -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 _CodeList_codes, _CodeList_options;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CodeList = void 0;
|
|
16
16
|
const StringList_1 = require("./StringList");
|
|
@@ -22,13 +22,13 @@ class CodeList extends StringList_1.StringList {
|
|
|
22
22
|
* Constructor protegido para que solo clases hijas puedan instanciar.
|
|
23
23
|
* Aplica todas las validaciones de dominio al momento de construcción.
|
|
24
24
|
*/
|
|
25
|
-
constructor(value, skipDomainValidation, propertyName =
|
|
25
|
+
constructor(value, skipDomainValidation, propertyName = CodeList.DEFAULT_PROPERTY_NAME, options = CodeList.DEFAULT_CODES_LIST_OPTIONS) {
|
|
26
26
|
super(value, skipDomainValidation, propertyName, options);
|
|
27
27
|
_CodeList_codes.set(this, void 0);
|
|
28
28
|
_CodeList_options.set(this, void 0);
|
|
29
|
-
const finalOptions = { ...
|
|
29
|
+
const finalOptions = { ...CodeList.DEFAULT_CODES_LIST_OPTIONS, ...options };
|
|
30
30
|
if (skipDomainValidation === false) {
|
|
31
|
-
|
|
31
|
+
CodeList.validateCodeList(value, propertyName, finalOptions);
|
|
32
32
|
}
|
|
33
33
|
__classPrivateFieldSet(this, _CodeList_codes, [...value], "f"); // Create defensive copy
|
|
34
34
|
__classPrivateFieldSet(this, _CodeList_options, finalOptions, "f");
|
|
@@ -37,10 +37,54 @@ class CodeList extends StringList_1.StringList {
|
|
|
37
37
|
* Validación estática para reutilización en factory methods y constructores.
|
|
38
38
|
*/
|
|
39
39
|
static validateCodeList(value, propertyName, options) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
this.guardAgainstInvalidArrayType(value, propertyName);
|
|
41
|
+
this.guardAgainstInvalidEmptyArray(value, options, propertyName);
|
|
42
|
+
this.guardAgainstDuplicateCodes(value, propertyName);
|
|
43
|
+
this.guardAgainstInvalidCodes(value, propertyName);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Valida que el valor sea un array.
|
|
47
|
+
*/
|
|
48
|
+
static guardAgainstInvalidArrayType(value, propertyName) {
|
|
49
|
+
if (!Array.isArray(value)) {
|
|
50
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'string[]', typeof value);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Valida que el array no esté vacío si no se permite.
|
|
55
|
+
*/
|
|
56
|
+
static guardAgainstInvalidEmptyArray(value, options, propertyName) {
|
|
57
|
+
if (!options.allowEmpty && value.length === 0) {
|
|
58
|
+
throw InvalidCodeListError_1.InvalidCodeListError.create(propertyName, 'non-empty array', 'empty array');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Valida que no haya códigos duplicados.
|
|
63
|
+
*/
|
|
64
|
+
static guardAgainstDuplicateCodes(value, propertyName) {
|
|
65
|
+
const upperCaseCodes = value.map((code) => code.toUpperCase());
|
|
66
|
+
const uniqueCodes = new Set(upperCaseCodes);
|
|
67
|
+
if (upperCaseCodes.length !== uniqueCodes.size) {
|
|
68
|
+
const duplicates = upperCaseCodes.filter((code, index) => upperCaseCodes.indexOf(code) !== index);
|
|
69
|
+
throw InvalidCodeListError_1.InvalidCodeListError.create(propertyName, 'array with unique codes', 'array with duplicate codes', [...new Set(duplicates)]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Valida que todos los elementos sean códigos válidos.
|
|
74
|
+
*/
|
|
75
|
+
static guardAgainstInvalidCodes(value, propertyName) {
|
|
76
|
+
const invalidCodes = [];
|
|
77
|
+
value.forEach((code, index) => {
|
|
78
|
+
try {
|
|
79
|
+
Code_1.Code.guardAgainstInvalidCode(code, `${propertyName}[${index}]`);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
invalidCodes.push(code);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
if (invalidCodes.length > 0) {
|
|
86
|
+
throw InvalidCodeListError_1.InvalidCodeListError.create(propertyName, 'array of valid codes', 'array with invalid codes', invalidCodes);
|
|
87
|
+
}
|
|
44
88
|
}
|
|
45
89
|
/**
|
|
46
90
|
* Array de códigos (inmutable).
|
|
@@ -206,7 +250,7 @@ class CodeList extends StringList_1.StringList {
|
|
|
206
250
|
* Compara la igualdad semántica con otro array de códigos.
|
|
207
251
|
*/
|
|
208
252
|
equals(other) {
|
|
209
|
-
if (!(other instanceof
|
|
253
|
+
if (!(other instanceof CodeList)) {
|
|
210
254
|
return false;
|
|
211
255
|
}
|
|
212
256
|
if (__classPrivateFieldGet(this, _CodeList_options, "f").allowEmpty !== __classPrivateFieldGet(other, _CodeList_options, "f").allowEmpty) {
|
|
@@ -250,10 +294,10 @@ class CodeList extends StringList_1.StringList {
|
|
|
250
294
|
/**
|
|
251
295
|
* Método estático para validar si un array es válido.
|
|
252
296
|
*/
|
|
253
|
-
static isValidCodeList(value, options =
|
|
297
|
+
static isValidCodeList(value, options = CodeList.DEFAULT_CODES_LIST_OPTIONS) {
|
|
254
298
|
try {
|
|
255
|
-
const finalOptions = { ...
|
|
256
|
-
|
|
299
|
+
const finalOptions = { ...CodeList.DEFAULT_CODES_LIST_OPTIONS, ...options };
|
|
300
|
+
CodeList.validateCodeList(value, 'test', finalOptions);
|
|
257
301
|
return true;
|
|
258
302
|
}
|
|
259
303
|
catch {
|
|
@@ -262,35 +306,7 @@ class CodeList extends StringList_1.StringList {
|
|
|
262
306
|
}
|
|
263
307
|
}
|
|
264
308
|
exports.CodeList = CodeList;
|
|
265
|
-
|
|
266
|
-
if (!Array.isArray(value)) {
|
|
267
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'string[]', typeof value);
|
|
268
|
-
}
|
|
269
|
-
}, _CodeList_guardAgainstInvalidEmptyArray = function _CodeList_guardAgainstInvalidEmptyArray(value, options, propertyName) {
|
|
270
|
-
if (!options.allowEmpty && value.length === 0) {
|
|
271
|
-
throw InvalidCodeListError_1.InvalidCodeListError.create(propertyName, 'non-empty array', 'empty array');
|
|
272
|
-
}
|
|
273
|
-
}, _CodeList_guardAgainstDuplicateCodes = function _CodeList_guardAgainstDuplicateCodes(value, propertyName) {
|
|
274
|
-
const upperCaseCodes = value.map((code) => code.toUpperCase());
|
|
275
|
-
const uniqueCodes = new Set(upperCaseCodes);
|
|
276
|
-
if (upperCaseCodes.length !== uniqueCodes.size) {
|
|
277
|
-
const duplicates = upperCaseCodes.filter((code, index) => upperCaseCodes.indexOf(code) !== index);
|
|
278
|
-
throw InvalidCodeListError_1.InvalidCodeListError.create(propertyName, 'array with unique codes', 'array with duplicate codes', [...new Set(duplicates)]);
|
|
279
|
-
}
|
|
280
|
-
}, _CodeList_guardAgainstInvalidCodes = function _CodeList_guardAgainstInvalidCodes(value, propertyName) {
|
|
281
|
-
const invalidCodes = [];
|
|
282
|
-
value.forEach((code, index) => {
|
|
283
|
-
try {
|
|
284
|
-
Code_1.Code.guardAgainstInvalidCode(code, `${propertyName}[${index}]`);
|
|
285
|
-
}
|
|
286
|
-
catch (error) {
|
|
287
|
-
invalidCodes.push(code);
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
if (invalidCodes.length > 0) {
|
|
291
|
-
throw InvalidCodeListError_1.InvalidCodeListError.create(propertyName, 'array of valid codes', 'array with invalid codes', invalidCodes);
|
|
292
|
-
}
|
|
293
|
-
};
|
|
309
|
+
_CodeList_codes = new WeakMap(), _CodeList_options = new WeakMap();
|
|
294
310
|
CodeList.DEFAULT_PROPERTY_NAME = 'codes';
|
|
295
311
|
CodeList.DEFAULT_CODES_LIST_OPTIONS = {
|
|
296
312
|
allowEmpty: true,
|
|
@@ -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 _CollectionFieldReference_id, _CollectionFieldReference_code, _CollectionFieldReference_name, _CollectionFieldReference_collectionType, _CollectionFieldReference_dataType;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CollectionFieldReference = void 0;
|
|
16
16
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
@@ -25,7 +25,7 @@ class CollectionFieldReference extends ObjectValueObject_1.ObjectValueObject {
|
|
|
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 = CollectionFieldReference.DEFAULT_PROPERTY_NAME) {
|
|
29
29
|
super(value, skipDomainValidation, propertyName, 'The provided value must be of type CollectionFieldReference from the domain layer', { allowNull: false, allowUndefined: false });
|
|
30
30
|
_CollectionFieldReference_id.set(this, void 0);
|
|
31
31
|
_CollectionFieldReference_code.set(this, void 0);
|
|
@@ -33,7 +33,7 @@ class CollectionFieldReference extends ObjectValueObject_1.ObjectValueObject {
|
|
|
33
33
|
_CollectionFieldReference_collectionType.set(this, void 0);
|
|
34
34
|
_CollectionFieldReference_dataType.set(this, void 0);
|
|
35
35
|
if (skipDomainValidation === false) {
|
|
36
|
-
|
|
36
|
+
CollectionFieldReference.validateCollectionFieldReference(value, propertyName);
|
|
37
37
|
}
|
|
38
38
|
__classPrivateFieldSet(this, _CollectionFieldReference_id, value.id.trim(), "f");
|
|
39
39
|
__classPrivateFieldSet(this, _CollectionFieldReference_code, value.code.trim(), "f");
|
|
@@ -45,12 +45,74 @@ class CollectionFieldReference extends ObjectValueObject_1.ObjectValueObject {
|
|
|
45
45
|
* Validación estática para reutilización en factory methods y constructores.
|
|
46
46
|
*/
|
|
47
47
|
static validateCollectionFieldReference(value, propertyName) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
this.guardAgainstInvalidType(value, propertyName);
|
|
49
|
+
this.guardAgainstInvalidId(value.id);
|
|
50
|
+
this.guardAgainstInvalidCode(value.code);
|
|
51
|
+
this.guardAgainstInvalidName(value.name);
|
|
52
|
+
this.guardAgainstInvalidCollectionType(value.collectionType);
|
|
53
|
+
this.guardAgainstInvalidDataType(value.dataType);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Valida que el objeto tenga la estructura correcta.
|
|
57
|
+
*/
|
|
58
|
+
static guardAgainstInvalidType(value, propertyName) {
|
|
59
|
+
if (!value || typeof value !== 'object') {
|
|
60
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CollectionFieldReference object', typeof value);
|
|
61
|
+
}
|
|
62
|
+
if (typeof value.id !== 'string') {
|
|
63
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
|
|
64
|
+
}
|
|
65
|
+
if (typeof value.code !== 'string') {
|
|
66
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'string', typeof value.code);
|
|
67
|
+
}
|
|
68
|
+
if (typeof value.name !== 'string') {
|
|
69
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'string', typeof value.name);
|
|
70
|
+
}
|
|
71
|
+
if (typeof value.collectionType !== 'string') {
|
|
72
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('collectionType', 'CollectionField', typeof value.collectionType);
|
|
73
|
+
}
|
|
74
|
+
if (typeof value.dataType !== 'string') {
|
|
75
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('dataType', 'DataType', typeof value.dataType);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
static guardAgainstInvalidId(id) {
|
|
79
|
+
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
80
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Valida el código del campo de recolección usando las validaciones de Code.
|
|
84
|
+
* El código debe ser un UUID válido.
|
|
85
|
+
*/
|
|
86
|
+
static guardAgainstInvalidCode(code) {
|
|
87
|
+
String_1.String.guardAgainstEmptyValue(code, 'code');
|
|
88
|
+
Code_1.Code.guardAgainstInvalidCode(code);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Valida el nombre del campo de recolección.
|
|
92
|
+
* No debe ser vacío después de aplicar trim.
|
|
93
|
+
*/
|
|
94
|
+
static guardAgainstInvalidName(name) {
|
|
95
|
+
String_1.String.guardAgainstEmptyValue(name, 'name');
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Valida el tipo de recolección.
|
|
99
|
+
* Debe ser un valor válido del enum CollectionField.
|
|
100
|
+
*/
|
|
101
|
+
static guardAgainstInvalidCollectionType(collectionType) {
|
|
102
|
+
const validTypes = Object.values(CollectionField_1.CollectionField);
|
|
103
|
+
if (!validTypes.includes(collectionType)) {
|
|
104
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('collectionType', 'valid CollectionField', collectionType);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Valida el tipo de dato.
|
|
109
|
+
* Debe ser un valor válido del enum DataType.
|
|
110
|
+
*/
|
|
111
|
+
static guardAgainstInvalidDataType(dataType) {
|
|
112
|
+
const validTypes = Object.values(DataType_1.DataType);
|
|
113
|
+
if (!validTypes.includes(dataType)) {
|
|
114
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('dataType', 'valid DataType', dataType);
|
|
115
|
+
}
|
|
54
116
|
}
|
|
55
117
|
get id() {
|
|
56
118
|
return __classPrivateFieldGet(this, _CollectionFieldReference_id, "f");
|
|
@@ -237,7 +299,7 @@ class CollectionFieldReference extends ObjectValueObject_1.ObjectValueObject {
|
|
|
237
299
|
* Dos referencias son iguales si tienen todos los campos idénticos.
|
|
238
300
|
*/
|
|
239
301
|
equals(other) {
|
|
240
|
-
if (!(other instanceof
|
|
302
|
+
if (!(other instanceof CollectionFieldReference)) {
|
|
241
303
|
return false;
|
|
242
304
|
}
|
|
243
305
|
return (__classPrivateFieldGet(this, _CollectionFieldReference_id, "f") === __classPrivateFieldGet(other, _CollectionFieldReference_id, "f")
|
|
@@ -251,7 +313,7 @@ class CollectionFieldReference extends ObjectValueObject_1.ObjectValueObject {
|
|
|
251
313
|
* basándose únicamente en el código (identificador único).
|
|
252
314
|
*/
|
|
253
315
|
hasSameField(other) {
|
|
254
|
-
if (!(other instanceof
|
|
316
|
+
if (!(other instanceof CollectionFieldReference)) {
|
|
255
317
|
return false;
|
|
256
318
|
}
|
|
257
319
|
return __classPrivateFieldGet(this, _CollectionFieldReference_code, "f") === __classPrivateFieldGet(other, _CollectionFieldReference_code, "f");
|
|
@@ -298,42 +360,5 @@ class CollectionFieldReference extends ObjectValueObject_1.ObjectValueObject {
|
|
|
298
360
|
}
|
|
299
361
|
}
|
|
300
362
|
exports.CollectionFieldReference = CollectionFieldReference;
|
|
301
|
-
|
|
302
|
-
if (!value || typeof value !== 'object') {
|
|
303
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CollectionFieldReference object', typeof value);
|
|
304
|
-
}
|
|
305
|
-
if (typeof value.id !== 'string') {
|
|
306
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
|
|
307
|
-
}
|
|
308
|
-
if (typeof value.code !== 'string') {
|
|
309
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'string', typeof value.code);
|
|
310
|
-
}
|
|
311
|
-
if (typeof value.name !== 'string') {
|
|
312
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'string', typeof value.name);
|
|
313
|
-
}
|
|
314
|
-
if (typeof value.collectionType !== 'string') {
|
|
315
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('collectionType', 'CollectionField', typeof value.collectionType);
|
|
316
|
-
}
|
|
317
|
-
if (typeof value.dataType !== 'string') {
|
|
318
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('dataType', 'DataType', typeof value.dataType);
|
|
319
|
-
}
|
|
320
|
-
}, _CollectionFieldReference_guardAgainstInvalidId = function _CollectionFieldReference_guardAgainstInvalidId(id) {
|
|
321
|
-
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
322
|
-
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
323
|
-
}, _CollectionFieldReference_guardAgainstInvalidCode = function _CollectionFieldReference_guardAgainstInvalidCode(code) {
|
|
324
|
-
String_1.String.guardAgainstEmptyValue(code, 'code');
|
|
325
|
-
Code_1.Code.guardAgainstInvalidCode(code);
|
|
326
|
-
}, _CollectionFieldReference_guardAgainstInvalidName = function _CollectionFieldReference_guardAgainstInvalidName(name) {
|
|
327
|
-
String_1.String.guardAgainstEmptyValue(name, 'name');
|
|
328
|
-
}, _CollectionFieldReference_guardAgainstInvalidCollectionType = function _CollectionFieldReference_guardAgainstInvalidCollectionType(collectionType) {
|
|
329
|
-
const validTypes = Object.values(CollectionField_1.CollectionField);
|
|
330
|
-
if (!validTypes.includes(collectionType)) {
|
|
331
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('collectionType', 'valid CollectionField', collectionType);
|
|
332
|
-
}
|
|
333
|
-
}, _CollectionFieldReference_guardAgainstInvalidDataType = function _CollectionFieldReference_guardAgainstInvalidDataType(dataType) {
|
|
334
|
-
const validTypes = Object.values(DataType_1.DataType);
|
|
335
|
-
if (!validTypes.includes(dataType)) {
|
|
336
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('dataType', 'valid DataType', dataType);
|
|
337
|
-
}
|
|
338
|
-
};
|
|
363
|
+
_CollectionFieldReference_id = new WeakMap(), _CollectionFieldReference_code = new WeakMap(), _CollectionFieldReference_name = new WeakMap(), _CollectionFieldReference_collectionType = new WeakMap(), _CollectionFieldReference_dataType = new WeakMap();
|
|
339
364
|
CollectionFieldReference.DEFAULT_PROPERTY_NAME = 'collectionFieldReference';
|