@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 _CarbonClientReferences_clientReferences, _CarbonClientReferences_options;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CarbonClientReferences = void 0;
|
|
16
16
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
@@ -24,14 +24,13 @@ class CarbonClientReferences 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 = CarbonClientReferences.DEFAULT_PROPERTY_NAME, options = CarbonClientReferences.DEFAULT_OPTIONS) {
|
|
28
28
|
super(value, skipDomainValidation, propertyName, 'The provided value must be of type CarbonClientReference[] from the domain layer', { allowNull: false, allowUndefined: false });
|
|
29
|
-
_CarbonClientReferences_instances.add(this);
|
|
30
29
|
_CarbonClientReferences_clientReferences.set(this, void 0);
|
|
31
30
|
_CarbonClientReferences_options.set(this, void 0);
|
|
32
|
-
const finalOptions = { ...
|
|
31
|
+
const finalOptions = { ...CarbonClientReferences.DEFAULT_OPTIONS, ...options };
|
|
33
32
|
if (skipDomainValidation === false) {
|
|
34
|
-
|
|
33
|
+
CarbonClientReferences.validateClientReferences(value, finalOptions, propertyName);
|
|
35
34
|
}
|
|
36
35
|
__classPrivateFieldSet(this, _CarbonClientReferences_clientReferences, [...value], "f"); // Create defensive copy
|
|
37
36
|
__classPrivateFieldSet(this, _CarbonClientReferences_options, finalOptions, "f");
|
|
@@ -40,13 +39,87 @@ class CarbonClientReferences extends ValueObject_1.ValueObject {
|
|
|
40
39
|
* Validación estática para reutilización en factory methods y constructores.
|
|
41
40
|
*/
|
|
42
41
|
static validateClientReferences(value, options, propertyName) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
this.guardAgainstInvalidArrayType(value, propertyName);
|
|
43
|
+
this.guardAgainstInvalidEmptyArray(value, options, propertyName);
|
|
44
|
+
this.guardAgainstDuplicateClientTaxIdentifications(value, propertyName);
|
|
46
45
|
value.forEach((clientReference, index) => {
|
|
47
|
-
|
|
46
|
+
this.guardAgainstInvalidClientReference(clientReference, 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 identificaciones tributarias duplicadas.
|
|
67
|
+
*/
|
|
68
|
+
static guardAgainstDuplicateClientTaxIdentifications(value, propertyName) {
|
|
69
|
+
const taxIdentifications = value.map((client) => `${client.taxIdentification.type}-${client.taxIdentification.number}-${client.taxIdentification.country}`);
|
|
70
|
+
const uniqueIds = new Set(taxIdentifications);
|
|
71
|
+
if (taxIdentifications.length !== uniqueIds.size) {
|
|
72
|
+
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.taxIdentification`, 'unique tax identifications', 'duplicate tax identifications found');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Valida una referencia de cliente individual.
|
|
77
|
+
*/
|
|
78
|
+
static guardAgainstInvalidClientReference(clientReference, index, basePropertyName) {
|
|
79
|
+
const propertyName = `${basePropertyName}[${index}]`;
|
|
80
|
+
this.guardAgainstInvalidClientStructure(clientReference, propertyName);
|
|
81
|
+
this.guardAgainstInvalidDisplayName(clientReference.displayName, `${propertyName}.displayName`);
|
|
82
|
+
this.guardAgainstInvalidRoleType(clientReference.roleType, `${propertyName}.roleType`);
|
|
83
|
+
// Validar usando el VO CarbonClientReference para aprovechar sus validaciones
|
|
84
|
+
CarbonClientReference_1.CarbonClientReference.validateCompletely(clientReference, propertyName);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Valida que el objeto de referencia de cliente tenga la estructura correcta.
|
|
88
|
+
*/
|
|
89
|
+
static guardAgainstInvalidClientStructure(clientReference, propertyName) {
|
|
90
|
+
if (!clientReference || typeof clientReference !== 'object') {
|
|
91
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CarbonClientReference object', typeof clientReference);
|
|
92
|
+
}
|
|
93
|
+
if (typeof clientReference.id !== 'string') {
|
|
94
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof clientReference.id);
|
|
95
|
+
}
|
|
96
|
+
if (typeof clientReference.displayName !== 'string') {
|
|
97
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.displayName`, 'string', typeof clientReference.displayName);
|
|
98
|
+
}
|
|
99
|
+
if (!clientReference.taxIdentification || typeof clientReference.taxIdentification !== 'object') {
|
|
100
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.taxIdentification`, 'TaxIdentification object', typeof clientReference.taxIdentification);
|
|
101
|
+
}
|
|
102
|
+
if (typeof clientReference.roleType !== 'string') {
|
|
103
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.roleType`, 'string', typeof clientReference.roleType);
|
|
104
|
+
}
|
|
105
|
+
if (typeof clientReference.accountType !== 'string') {
|
|
106
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.accountType`, 'string', typeof clientReference.accountType);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Valida el nombre para mostrar.
|
|
111
|
+
*/
|
|
112
|
+
static guardAgainstInvalidDisplayName(displayName, propertyName) {
|
|
113
|
+
String_1.String.guardAgainstEmptyValue(displayName, propertyName);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Valida que el rol sea CARBON_CLIENT.
|
|
117
|
+
*/
|
|
118
|
+
static guardAgainstInvalidRoleType(roleType, propertyName) {
|
|
119
|
+
if (roleType !== StakeholderRole_1.StakeholderRole.CARBON_CLIENT) {
|
|
120
|
+
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, StakeholderRole_1.StakeholderRole.CARBON_CLIENT, roleType);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
50
123
|
/**
|
|
51
124
|
* Referencias de clientes (inmutable).
|
|
52
125
|
*/
|
|
@@ -207,7 +280,7 @@ class CarbonClientReferences extends ValueObject_1.ValueObject {
|
|
|
207
280
|
* Compara la igualdad semántica con otra colección de referencias de cliente.
|
|
208
281
|
*/
|
|
209
282
|
equals(other) {
|
|
210
|
-
if (!(other instanceof
|
|
283
|
+
if (!(other instanceof CarbonClientReferences)) {
|
|
211
284
|
return false;
|
|
212
285
|
}
|
|
213
286
|
if (__classPrivateFieldGet(this, _CarbonClientReferences_options, "f").allowEmpty !== __classPrivateFieldGet(other, _CarbonClientReferences_options, "f").allowEmpty) {
|
|
@@ -218,9 +291,30 @@ class CarbonClientReferences extends ValueObject_1.ValueObject {
|
|
|
218
291
|
}
|
|
219
292
|
return __classPrivateFieldGet(this, _CarbonClientReferences_clientReferences, "f").every((client, index) => {
|
|
220
293
|
const otherClient = __classPrivateFieldGet(other, _CarbonClientReferences_clientReferences, "f")[index];
|
|
221
|
-
return
|
|
294
|
+
return this.clientReferencesAreEqual(client, otherClient);
|
|
222
295
|
});
|
|
223
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Compara si dos referencias de cliente son iguales.
|
|
299
|
+
*/
|
|
300
|
+
clientReferencesAreEqual(client1, client2) {
|
|
301
|
+
return (client1.id === client2.id
|
|
302
|
+
&& client1.displayName === client2.displayName
|
|
303
|
+
&& client1.roleType === client2.roleType
|
|
304
|
+
&& client1.accountType === client2.accountType
|
|
305
|
+
&& this.taxIdentificationsAreEqual(client1.taxIdentification, client2.taxIdentification));
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Compara si dos identificaciones tributarias son iguales.
|
|
309
|
+
*/
|
|
310
|
+
taxIdentificationsAreEqual(tax1, tax2) {
|
|
311
|
+
return (tax1.type === tax2.type
|
|
312
|
+
&& tax1.number === tax2.number
|
|
313
|
+
&& tax1.country === tax2.country
|
|
314
|
+
&& tax1.issuedBy === tax2.issuedBy
|
|
315
|
+
&& tax1.validFrom === tax2.validFrom
|
|
316
|
+
&& tax1.validUntil === tax2.validUntil);
|
|
317
|
+
}
|
|
224
318
|
/**
|
|
225
319
|
* Genera un hash code para usar en colecciones.
|
|
226
320
|
*/
|
|
@@ -252,10 +346,10 @@ class CarbonClientReferences extends ValueObject_1.ValueObject {
|
|
|
252
346
|
/**
|
|
253
347
|
* Método estático para validar si un array es válido.
|
|
254
348
|
*/
|
|
255
|
-
static isValidClientReferences(value, options =
|
|
349
|
+
static isValidClientReferences(value, options = CarbonClientReferences.DEFAULT_OPTIONS) {
|
|
256
350
|
try {
|
|
257
|
-
const finalOptions = { ...
|
|
258
|
-
|
|
351
|
+
const finalOptions = { ...CarbonClientReferences.DEFAULT_OPTIONS, ...options };
|
|
352
|
+
CarbonClientReferences.validateClientReferences(value, finalOptions, 'test');
|
|
259
353
|
return true;
|
|
260
354
|
}
|
|
261
355
|
catch {
|
|
@@ -264,66 +358,7 @@ class CarbonClientReferences extends ValueObject_1.ValueObject {
|
|
|
264
358
|
}
|
|
265
359
|
}
|
|
266
360
|
exports.CarbonClientReferences = CarbonClientReferences;
|
|
267
|
-
|
|
268
|
-
if (!Array.isArray(value)) {
|
|
269
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array', typeof value);
|
|
270
|
-
}
|
|
271
|
-
}, _CarbonClientReferences_guardAgainstInvalidEmptyArray = function _CarbonClientReferences_guardAgainstInvalidEmptyArray(value, options, propertyName) {
|
|
272
|
-
if (!options.allowEmpty && value.length === 0) {
|
|
273
|
-
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty array', 'empty array');
|
|
274
|
-
}
|
|
275
|
-
}, _CarbonClientReferences_guardAgainstDuplicateClientTaxIdentifications = function _CarbonClientReferences_guardAgainstDuplicateClientTaxIdentifications(value, propertyName) {
|
|
276
|
-
const taxIdentifications = value.map((client) => `${client.taxIdentification.type}-${client.taxIdentification.number}-${client.taxIdentification.country}`);
|
|
277
|
-
const uniqueIds = new Set(taxIdentifications);
|
|
278
|
-
if (taxIdentifications.length !== uniqueIds.size) {
|
|
279
|
-
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.taxIdentification`, 'unique tax identifications', 'duplicate tax identifications found');
|
|
280
|
-
}
|
|
281
|
-
}, _CarbonClientReferences_guardAgainstInvalidClientReference = function _CarbonClientReferences_guardAgainstInvalidClientReference(clientReference, index, basePropertyName) {
|
|
282
|
-
const propertyName = `${basePropertyName}[${index}]`;
|
|
283
|
-
__classPrivateFieldGet(this, _a, "m", _CarbonClientReferences_guardAgainstInvalidClientStructure).call(this, clientReference, propertyName);
|
|
284
|
-
__classPrivateFieldGet(this, _a, "m", _CarbonClientReferences_guardAgainstInvalidDisplayName).call(this, clientReference.displayName, `${propertyName}.displayName`);
|
|
285
|
-
__classPrivateFieldGet(this, _a, "m", _CarbonClientReferences_guardAgainstInvalidRoleType).call(this, clientReference.roleType, `${propertyName}.roleType`);
|
|
286
|
-
// Validar usando el VO CarbonClientReference para aprovechar sus validaciones
|
|
287
|
-
CarbonClientReference_1.CarbonClientReference.validateCompletely(clientReference, propertyName);
|
|
288
|
-
}, _CarbonClientReferences_guardAgainstInvalidClientStructure = function _CarbonClientReferences_guardAgainstInvalidClientStructure(clientReference, propertyName) {
|
|
289
|
-
if (!clientReference || typeof clientReference !== 'object') {
|
|
290
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CarbonClientReference object', typeof clientReference);
|
|
291
|
-
}
|
|
292
|
-
if (typeof clientReference.id !== 'string') {
|
|
293
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof clientReference.id);
|
|
294
|
-
}
|
|
295
|
-
if (typeof clientReference.displayName !== 'string') {
|
|
296
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.displayName`, 'string', typeof clientReference.displayName);
|
|
297
|
-
}
|
|
298
|
-
if (!clientReference.taxIdentification || typeof clientReference.taxIdentification !== 'object') {
|
|
299
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.taxIdentification`, 'TaxIdentification object', typeof clientReference.taxIdentification);
|
|
300
|
-
}
|
|
301
|
-
if (typeof clientReference.roleType !== 'string') {
|
|
302
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.roleType`, 'string', typeof clientReference.roleType);
|
|
303
|
-
}
|
|
304
|
-
if (typeof clientReference.accountType !== 'string') {
|
|
305
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.accountType`, 'string', typeof clientReference.accountType);
|
|
306
|
-
}
|
|
307
|
-
}, _CarbonClientReferences_guardAgainstInvalidDisplayName = function _CarbonClientReferences_guardAgainstInvalidDisplayName(displayName, propertyName) {
|
|
308
|
-
String_1.String.guardAgainstEmptyValue(displayName, propertyName);
|
|
309
|
-
}, _CarbonClientReferences_guardAgainstInvalidRoleType = function _CarbonClientReferences_guardAgainstInvalidRoleType(roleType, propertyName) {
|
|
310
|
-
if (roleType !== StakeholderRole_1.StakeholderRole.CARBON_CLIENT) {
|
|
311
|
-
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, StakeholderRole_1.StakeholderRole.CARBON_CLIENT, roleType);
|
|
312
|
-
}
|
|
313
|
-
}, _CarbonClientReferences_clientReferencesAreEqual = function _CarbonClientReferences_clientReferencesAreEqual(client1, client2) {
|
|
314
|
-
return (client1.id === client2.id
|
|
315
|
-
&& client1.displayName === client2.displayName
|
|
316
|
-
&& client1.roleType === client2.roleType
|
|
317
|
-
&& client1.accountType === client2.accountType
|
|
318
|
-
&& __classPrivateFieldGet(this, _CarbonClientReferences_instances, "m", _CarbonClientReferences_taxIdentificationsAreEqual).call(this, client1.taxIdentification, client2.taxIdentification));
|
|
319
|
-
}, _CarbonClientReferences_taxIdentificationsAreEqual = function _CarbonClientReferences_taxIdentificationsAreEqual(tax1, tax2) {
|
|
320
|
-
return (tax1.type === tax2.type
|
|
321
|
-
&& tax1.number === tax2.number
|
|
322
|
-
&& tax1.country === tax2.country
|
|
323
|
-
&& tax1.issuedBy === tax2.issuedBy
|
|
324
|
-
&& tax1.validFrom === tax2.validFrom
|
|
325
|
-
&& tax1.validUntil === tax2.validUntil);
|
|
326
|
-
};
|
|
361
|
+
_CarbonClientReferences_clientReferences = new WeakMap(), _CarbonClientReferences_options = new WeakMap();
|
|
327
362
|
CarbonClientReferences.DEFAULT_PROPERTY_NAME = 'carbonClientReferences';
|
|
328
363
|
CarbonClientReferences.DEFAULT_OPTIONS = {
|
|
329
364
|
allowEmpty: true,
|
package/build/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.js
CHANGED
|
@@ -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 _CarbonFootprintConfigurationReference_id, _CarbonFootprintConfigurationReference_footprintType;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CarbonFootprintConfigurationReference = void 0;
|
|
16
16
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
@@ -23,12 +23,12 @@ class CarbonFootprintConfigurationReference extends ObjectValueObject_1.ObjectVa
|
|
|
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 = CarbonFootprintConfigurationReference.DEFAULT_PROPERTY_NAME) {
|
|
27
27
|
super(value, skipDomainValidation, propertyName, 'The provided value must be of type CarbonFootprintConfigurationReference from the domain layer', { allowNull: false, allowUndefined: false });
|
|
28
28
|
_CarbonFootprintConfigurationReference_id.set(this, void 0);
|
|
29
29
|
_CarbonFootprintConfigurationReference_footprintType.set(this, void 0);
|
|
30
30
|
if (skipDomainValidation === false) {
|
|
31
|
-
|
|
31
|
+
CarbonFootprintConfigurationReference.validateCarbonFootprintConfigurationReference(value, propertyName);
|
|
32
32
|
}
|
|
33
33
|
__classPrivateFieldSet(this, _CarbonFootprintConfigurationReference_id, value.id.trim(), "f");
|
|
34
34
|
__classPrivateFieldSet(this, _CarbonFootprintConfigurationReference_footprintType, value.footprintType, "f");
|
|
@@ -37,9 +37,37 @@ class CarbonFootprintConfigurationReference extends ObjectValueObject_1.ObjectVa
|
|
|
37
37
|
* Validación estática para reutilización en factory methods y constructores.
|
|
38
38
|
*/
|
|
39
39
|
static validateCarbonFootprintConfigurationReference(value, propertyName) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
this.guardAgainstInvalidType(value, propertyName);
|
|
41
|
+
this.guardAgainstInvalidId(value.id);
|
|
42
|
+
this.guardAgainstInvalidFootprintType(value.footprintType);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Valida que el objeto tenga la estructura correcta.
|
|
46
|
+
*/
|
|
47
|
+
static guardAgainstInvalidType(value, propertyName) {
|
|
48
|
+
if (!value || typeof value !== 'object') {
|
|
49
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CarbonFootprintConfigurationReference object', typeof value);
|
|
50
|
+
}
|
|
51
|
+
if (typeof value.id !== 'string') {
|
|
52
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
|
|
53
|
+
}
|
|
54
|
+
if (typeof value.footprintType !== 'string') {
|
|
55
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('footprintType', 'CarbonFootprint', typeof value.footprintType);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
static guardAgainstInvalidId(id) {
|
|
59
|
+
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
60
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Valida el tipo de huella de carbono.
|
|
64
|
+
* Debe ser un valor válido del enum CarbonFootprint.
|
|
65
|
+
*/
|
|
66
|
+
static guardAgainstInvalidFootprintType(footprintType) {
|
|
67
|
+
const validTypes = Object.values(CarbonFootprint_1.CarbonFootprint);
|
|
68
|
+
if (!validTypes.includes(footprintType)) {
|
|
69
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('footprintType', 'valid CarbonFootprint', footprintType);
|
|
70
|
+
}
|
|
43
71
|
}
|
|
44
72
|
get id() {
|
|
45
73
|
return __classPrivateFieldGet(this, _CarbonFootprintConfigurationReference_id, "f");
|
|
@@ -94,7 +122,7 @@ class CarbonFootprintConfigurationReference extends ObjectValueObject_1.ObjectVa
|
|
|
94
122
|
* Dos referencias son iguales si tienen todos los campos idénticos.
|
|
95
123
|
*/
|
|
96
124
|
equals(other) {
|
|
97
|
-
if (!(other instanceof
|
|
125
|
+
if (!(other instanceof CarbonFootprintConfigurationReference)) {
|
|
98
126
|
return false;
|
|
99
127
|
}
|
|
100
128
|
return (__classPrivateFieldGet(this, _CarbonFootprintConfigurationReference_id, "f") === __classPrivateFieldGet(other, _CarbonFootprintConfigurationReference_id, "f")
|
|
@@ -105,7 +133,7 @@ class CarbonFootprintConfigurationReference extends ObjectValueObject_1.ObjectVa
|
|
|
105
133
|
* basándose únicamente en el ID (identificador único).
|
|
106
134
|
*/
|
|
107
135
|
hasSameConfiguration(other) {
|
|
108
|
-
if (!(other instanceof
|
|
136
|
+
if (!(other instanceof CarbonFootprintConfigurationReference)) {
|
|
109
137
|
return false;
|
|
110
138
|
}
|
|
111
139
|
return __classPrivateFieldGet(this, _CarbonFootprintConfigurationReference_id, "f") === __classPrivateFieldGet(other, _CarbonFootprintConfigurationReference_id, "f");
|
|
@@ -146,23 +174,5 @@ class CarbonFootprintConfigurationReference extends ObjectValueObject_1.ObjectVa
|
|
|
146
174
|
}
|
|
147
175
|
}
|
|
148
176
|
exports.CarbonFootprintConfigurationReference = CarbonFootprintConfigurationReference;
|
|
149
|
-
|
|
150
|
-
if (!value || typeof value !== 'object') {
|
|
151
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CarbonFootprintConfigurationReference object', typeof value);
|
|
152
|
-
}
|
|
153
|
-
if (typeof value.id !== 'string') {
|
|
154
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
|
|
155
|
-
}
|
|
156
|
-
if (typeof value.footprintType !== 'string') {
|
|
157
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('footprintType', 'CarbonFootprint', typeof value.footprintType);
|
|
158
|
-
}
|
|
159
|
-
}, _CarbonFootprintConfigurationReference_guardAgainstInvalidId = function _CarbonFootprintConfigurationReference_guardAgainstInvalidId(id) {
|
|
160
|
-
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
161
|
-
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
162
|
-
}, _CarbonFootprintConfigurationReference_guardAgainstInvalidFootprintType = function _CarbonFootprintConfigurationReference_guardAgainstInvalidFootprintType(footprintType) {
|
|
163
|
-
const validTypes = Object.values(CarbonFootprint_1.CarbonFootprint);
|
|
164
|
-
if (!validTypes.includes(footprintType)) {
|
|
165
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('footprintType', 'valid CarbonFootprint', footprintType);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
177
|
+
_CarbonFootprintConfigurationReference_id = new WeakMap(), _CarbonFootprintConfigurationReference_footprintType = new WeakMap();
|
|
168
178
|
CarbonFootprintConfigurationReference.DEFAULT_PROPERTY_NAME = 'carbonFootprintConfigurationReference';
|
package/build/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.js
CHANGED
|
@@ -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 _CarbonFootprintIntensityIndicatorReference_id, _CarbonFootprintIntensityIndicatorReference_code, _CarbonFootprintIntensityIndicatorReference_name, _CarbonFootprintIntensityIndicatorReference_type, _CarbonFootprintIntensityIndicatorReference_configurationScope, _CarbonFootprintIntensityIndicatorReference_measurementUnit;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CarbonFootprintIntensityIndicatorReference = void 0;
|
|
16
16
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
@@ -25,9 +25,8 @@ class CarbonFootprintIntensityIndicatorReference extends ObjectValueObject_1.Obj
|
|
|
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 = CarbonFootprintIntensityIndicatorReference.DEFAULT_PROPERTY_NAME) {
|
|
29
29
|
super(value, skipDomainValidation, propertyName, 'The provided value must be of type CarbonFootprintIntensityIndicatorReference from the domain layer', { allowNull: false, allowUndefined: false });
|
|
30
|
-
_CarbonFootprintIntensityIndicatorReference_instances.add(this);
|
|
31
30
|
_CarbonFootprintIntensityIndicatorReference_id.set(this, void 0);
|
|
32
31
|
_CarbonFootprintIntensityIndicatorReference_code.set(this, void 0);
|
|
33
32
|
_CarbonFootprintIntensityIndicatorReference_name.set(this, void 0);
|
|
@@ -35,7 +34,7 @@ class CarbonFootprintIntensityIndicatorReference extends ObjectValueObject_1.Obj
|
|
|
35
34
|
_CarbonFootprintIntensityIndicatorReference_configurationScope.set(this, void 0);
|
|
36
35
|
_CarbonFootprintIntensityIndicatorReference_measurementUnit.set(this, void 0);
|
|
37
36
|
if (skipDomainValidation === false) {
|
|
38
|
-
|
|
37
|
+
CarbonFootprintIntensityIndicatorReference.validateCarbonFootprintIntensityIndicatorReference(value, propertyName);
|
|
39
38
|
}
|
|
40
39
|
__classPrivateFieldSet(this, _CarbonFootprintIntensityIndicatorReference_id, value.id.trim(), "f");
|
|
41
40
|
__classPrivateFieldSet(this, _CarbonFootprintIntensityIndicatorReference_code, value.code.trim(), "f");
|
|
@@ -48,13 +47,89 @@ class CarbonFootprintIntensityIndicatorReference extends ObjectValueObject_1.Obj
|
|
|
48
47
|
* Validación estática para reutilización en factory methods y constructores.
|
|
49
48
|
*/
|
|
50
49
|
static validateCarbonFootprintIntensityIndicatorReference(value, propertyName) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
this.guardAgainstInvalidType(value, propertyName);
|
|
51
|
+
this.guardAgainstInvalidId(value.id);
|
|
52
|
+
this.guardAgainstInvalidIndicatorCode(value.code);
|
|
53
|
+
this.guardAgainstInvalidIndicatorName(value.name);
|
|
54
|
+
this.guardAgainstInvalidIndicatorType(value.type);
|
|
55
|
+
this.guardAgainstInvalidConfigurationScope(value.configurationScope);
|
|
56
|
+
this.guardAgainstInvalidMeasurementUnit(value.measurementUnit);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Valida que el objeto tenga la estructura correcta.
|
|
60
|
+
*/
|
|
61
|
+
static guardAgainstInvalidType(value, propertyName) {
|
|
62
|
+
if (!value || typeof value !== 'object') {
|
|
63
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CarbonFootprintIntensityIndicatorReference object', typeof value);
|
|
64
|
+
}
|
|
65
|
+
if (typeof value.id !== 'string') {
|
|
66
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
|
|
67
|
+
}
|
|
68
|
+
if (typeof value.code !== 'string') {
|
|
69
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'string', typeof value.code);
|
|
70
|
+
}
|
|
71
|
+
if (typeof value.name !== 'string') {
|
|
72
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'string', typeof value.name);
|
|
73
|
+
}
|
|
74
|
+
if (typeof value.type !== 'string') {
|
|
75
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('type', 'IntensityIndicator', typeof value.type);
|
|
76
|
+
}
|
|
77
|
+
if (!Array.isArray(value.configurationScope)) {
|
|
78
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('configurationScope', 'CarbonFootprint[]', typeof value.configurationScope);
|
|
79
|
+
}
|
|
80
|
+
if (typeof value.measurementUnit !== 'string') {
|
|
81
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('measurementUnit', 'string', typeof value.measurementUnit);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
static guardAgainstInvalidId(id) {
|
|
85
|
+
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
86
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Valida el código del indicador de intensidad usando las validaciones de DomainCode.
|
|
90
|
+
* El código debe ser un UUID válido.
|
|
91
|
+
*/
|
|
92
|
+
static guardAgainstInvalidIndicatorCode(code) {
|
|
93
|
+
String_1.String.guardAgainstEmptyValue(code, 'code');
|
|
94
|
+
Code_1.Code.guardAgainstInvalidCode(code);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Valida el nombre del indicador de intensidad.
|
|
98
|
+
* No debe ser vacío después de aplicar trim.
|
|
99
|
+
*/
|
|
100
|
+
static guardAgainstInvalidIndicatorName(name) {
|
|
101
|
+
String_1.String.guardAgainstEmptyValue(name, 'name');
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Valida el tipo de indicador de intensidad.
|
|
105
|
+
* Debe ser un valor válido del enum CarbonFootprintIntensityIndicator.
|
|
106
|
+
*/
|
|
107
|
+
static guardAgainstInvalidIndicatorType(type) {
|
|
108
|
+
const validTypes = Object.values(IntensityIndicator_1.IntensityIndicator);
|
|
109
|
+
if (!validTypes.includes(type)) {
|
|
110
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('type', 'valid IntensityIndicator', type);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Valida el alcance de configuración.
|
|
115
|
+
* Debe ser un array no vacío con valores válidos del enum CarbonFootprint.
|
|
116
|
+
*/
|
|
117
|
+
static guardAgainstInvalidConfigurationScope(scope) {
|
|
118
|
+
if (scope.length === 0) {
|
|
119
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('configurationScope', 'non-empty CarbonFootprint[]', 'empty array');
|
|
120
|
+
}
|
|
121
|
+
const validScopes = Object.values(CarbonFootprint_1.CarbonFootprint);
|
|
122
|
+
const invalidScopes = scope.filter((s) => !validScopes.includes(s));
|
|
123
|
+
if (invalidScopes.length > 0) {
|
|
124
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('configurationScope', 'valid CarbonFootprint values', invalidScopes.join(', '));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Valida la unidad de medida.
|
|
129
|
+
* No debe ser vacía después de aplicar trim.
|
|
130
|
+
*/
|
|
131
|
+
static guardAgainstInvalidMeasurementUnit(unit) {
|
|
132
|
+
String_1.String.guardAgainstEmptyValue(unit, 'measurementUnit');
|
|
58
133
|
}
|
|
59
134
|
get id() {
|
|
60
135
|
return __classPrivateFieldGet(this, _CarbonFootprintIntensityIndicatorReference_id, "f");
|
|
@@ -250,25 +325,36 @@ class CarbonFootprintIntensityIndicatorReference extends ObjectValueObject_1.Obj
|
|
|
250
325
|
* Dos referencias son iguales si tienen todos los campos idénticos.
|
|
251
326
|
*/
|
|
252
327
|
equals(other) {
|
|
253
|
-
if (!(other instanceof
|
|
328
|
+
if (!(other instanceof CarbonFootprintIntensityIndicatorReference)) {
|
|
254
329
|
return false;
|
|
255
330
|
}
|
|
256
331
|
return (__classPrivateFieldGet(this, _CarbonFootprintIntensityIndicatorReference_code, "f") === __classPrivateFieldGet(other, _CarbonFootprintIntensityIndicatorReference_code, "f")
|
|
257
332
|
&& __classPrivateFieldGet(this, _CarbonFootprintIntensityIndicatorReference_name, "f") === __classPrivateFieldGet(other, _CarbonFootprintIntensityIndicatorReference_name, "f")
|
|
258
333
|
&& __classPrivateFieldGet(this, _CarbonFootprintIntensityIndicatorReference_type, "f") === __classPrivateFieldGet(other, _CarbonFootprintIntensityIndicatorReference_type, "f")
|
|
259
334
|
&& __classPrivateFieldGet(this, _CarbonFootprintIntensityIndicatorReference_measurementUnit, "f") === __classPrivateFieldGet(other, _CarbonFootprintIntensityIndicatorReference_measurementUnit, "f")
|
|
260
|
-
&&
|
|
335
|
+
&& this.arraysAreEqual(__classPrivateFieldGet(this, _CarbonFootprintIntensityIndicatorReference_configurationScope, "f"), __classPrivateFieldGet(other, _CarbonFootprintIntensityIndicatorReference_configurationScope, "f")));
|
|
261
336
|
}
|
|
262
337
|
/**
|
|
263
338
|
* Compara si dos referencias apuntan al mismo indicador
|
|
264
339
|
* basándose únicamente en el código (identificador único).
|
|
265
340
|
*/
|
|
266
341
|
hasSameIndicator(other) {
|
|
267
|
-
if (!(other instanceof
|
|
342
|
+
if (!(other instanceof CarbonFootprintIntensityIndicatorReference)) {
|
|
268
343
|
return false;
|
|
269
344
|
}
|
|
270
345
|
return __classPrivateFieldGet(this, _CarbonFootprintIntensityIndicatorReference_code, "f") === __classPrivateFieldGet(other, _CarbonFootprintIntensityIndicatorReference_code, "f");
|
|
271
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Compara si dos arrays de CarbonFootprint son iguales.
|
|
349
|
+
*/
|
|
350
|
+
arraysAreEqual(arr1, arr2) {
|
|
351
|
+
if (arr1.length !== arr2.length) {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
const sorted1 = [...arr1].sort();
|
|
355
|
+
const sorted2 = [...arr2].sort();
|
|
356
|
+
return sorted1.every((value, index) => value === sorted2[index]);
|
|
357
|
+
}
|
|
272
358
|
/**
|
|
273
359
|
* Genera un hash code para usar en colecciones.
|
|
274
360
|
* Basado en todos los campos del indicador.
|
|
@@ -304,58 +390,5 @@ class CarbonFootprintIntensityIndicatorReference extends ObjectValueObject_1.Obj
|
|
|
304
390
|
}
|
|
305
391
|
}
|
|
306
392
|
exports.CarbonFootprintIntensityIndicatorReference = CarbonFootprintIntensityIndicatorReference;
|
|
307
|
-
|
|
308
|
-
if (!value || typeof value !== 'object') {
|
|
309
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'CarbonFootprintIntensityIndicatorReference object', typeof value);
|
|
310
|
-
}
|
|
311
|
-
if (typeof value.id !== 'string') {
|
|
312
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
|
|
313
|
-
}
|
|
314
|
-
if (typeof value.code !== 'string') {
|
|
315
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'string', typeof value.code);
|
|
316
|
-
}
|
|
317
|
-
if (typeof value.name !== 'string') {
|
|
318
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'string', typeof value.name);
|
|
319
|
-
}
|
|
320
|
-
if (typeof value.type !== 'string') {
|
|
321
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('type', 'IntensityIndicator', typeof value.type);
|
|
322
|
-
}
|
|
323
|
-
if (!Array.isArray(value.configurationScope)) {
|
|
324
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('configurationScope', 'CarbonFootprint[]', typeof value.configurationScope);
|
|
325
|
-
}
|
|
326
|
-
if (typeof value.measurementUnit !== 'string') {
|
|
327
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('measurementUnit', 'string', typeof value.measurementUnit);
|
|
328
|
-
}
|
|
329
|
-
}, _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidId = function _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidId(id) {
|
|
330
|
-
String_1.String.guardAgainstEmptyValue(id, 'id');
|
|
331
|
-
AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
|
|
332
|
-
}, _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidIndicatorCode = function _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidIndicatorCode(code) {
|
|
333
|
-
String_1.String.guardAgainstEmptyValue(code, 'code');
|
|
334
|
-
Code_1.Code.guardAgainstInvalidCode(code);
|
|
335
|
-
}, _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidIndicatorName = function _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidIndicatorName(name) {
|
|
336
|
-
String_1.String.guardAgainstEmptyValue(name, 'name');
|
|
337
|
-
}, _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidIndicatorType = function _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidIndicatorType(type) {
|
|
338
|
-
const validTypes = Object.values(IntensityIndicator_1.IntensityIndicator);
|
|
339
|
-
if (!validTypes.includes(type)) {
|
|
340
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('type', 'valid IntensityIndicator', type);
|
|
341
|
-
}
|
|
342
|
-
}, _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidConfigurationScope = function _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidConfigurationScope(scope) {
|
|
343
|
-
if (scope.length === 0) {
|
|
344
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('configurationScope', 'non-empty CarbonFootprint[]', 'empty array');
|
|
345
|
-
}
|
|
346
|
-
const validScopes = Object.values(CarbonFootprint_1.CarbonFootprint);
|
|
347
|
-
const invalidScopes = scope.filter((s) => !validScopes.includes(s));
|
|
348
|
-
if (invalidScopes.length > 0) {
|
|
349
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('configurationScope', 'valid CarbonFootprint values', invalidScopes.join(', '));
|
|
350
|
-
}
|
|
351
|
-
}, _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidMeasurementUnit = function _CarbonFootprintIntensityIndicatorReference_guardAgainstInvalidMeasurementUnit(unit) {
|
|
352
|
-
String_1.String.guardAgainstEmptyValue(unit, 'measurementUnit');
|
|
353
|
-
}, _CarbonFootprintIntensityIndicatorReference_arraysAreEqual = function _CarbonFootprintIntensityIndicatorReference_arraysAreEqual(arr1, arr2) {
|
|
354
|
-
if (arr1.length !== arr2.length) {
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
const sorted1 = [...arr1].sort();
|
|
358
|
-
const sorted2 = [...arr2].sort();
|
|
359
|
-
return sorted1.every((value, index) => value === sorted2[index]);
|
|
360
|
-
};
|
|
393
|
+
_CarbonFootprintIntensityIndicatorReference_id = new WeakMap(), _CarbonFootprintIntensityIndicatorReference_code = new WeakMap(), _CarbonFootprintIntensityIndicatorReference_name = new WeakMap(), _CarbonFootprintIntensityIndicatorReference_type = new WeakMap(), _CarbonFootprintIntensityIndicatorReference_configurationScope = new WeakMap(), _CarbonFootprintIntensityIndicatorReference_measurementUnit = new WeakMap();
|
|
361
394
|
CarbonFootprintIntensityIndicatorReference.DEFAULT_PROPERTY_NAME = 'intensityIndicatorReference';
|