@carbonbox/domain 0.4.8 → 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/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/package.json +1 -1
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
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");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var _a, _StringList_guardAgainstNonArrayValue, _StringList_guardAgainstEmptyArray, _StringList_guardAgainstNonStringElements, _StringList_valueIsNotArray, _StringList_emptyArrayIsNotAllowed, _StringList_findNonStringElements, _StringList_hasInvalidElements;
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.StringList = void 0;
|
|
10
4
|
const ValueObject_1 = require("./ValueObject");
|
|
11
5
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
12
6
|
const InvalidStringListError_1 = require("../exceptions/InvalidStringListError");
|
|
13
7
|
class StringList extends ValueObject_1.ValueObject {
|
|
14
|
-
constructor(value, skipDomainValidation, propertyName, options =
|
|
8
|
+
constructor(value, skipDomainValidation, propertyName, options = StringList.DEFAULT_OPTIONS) {
|
|
15
9
|
super(value, skipDomainValidation, propertyName, 'The provided value must be of type string[] from the domain layer', {
|
|
16
10
|
allowNull: false,
|
|
17
11
|
allowUndefined: false,
|
|
18
12
|
});
|
|
19
13
|
if (skipDomainValidation === false) {
|
|
20
|
-
|
|
14
|
+
StringList.guardAgainstInvalidStringList(value, propertyName, options);
|
|
21
15
|
}
|
|
22
16
|
}
|
|
23
|
-
static guardAgainstInvalidStringList(value, propertyName, options =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
static guardAgainstInvalidStringList(value, propertyName, options = StringList.DEFAULT_OPTIONS) {
|
|
18
|
+
this.guardAgainstNonArrayValue(value, propertyName);
|
|
19
|
+
this.guardAgainstEmptyArray(value, propertyName, options);
|
|
20
|
+
this.guardAgainstNonStringElements(value, propertyName);
|
|
21
|
+
}
|
|
22
|
+
static guardAgainstNonArrayValue(value, propertyName) {
|
|
23
|
+
if (this.valueIsNotArray(value)) {
|
|
24
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'string[]', typeof value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
static guardAgainstEmptyArray(value, propertyName, options) {
|
|
28
|
+
const { allowEmpty } = options;
|
|
29
|
+
if (this.emptyArrayIsNotAllowed(allowEmpty, value)) {
|
|
30
|
+
throw InvalidStringListError_1.InvalidStringListError.create(propertyName, 'string[]', 'empty array', ['Array cannot be empty']);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
static guardAgainstNonStringElements(value, propertyName) {
|
|
34
|
+
const invalidElements = this.findNonStringElements(value);
|
|
35
|
+
if (this.hasInvalidElements(invalidElements)) {
|
|
36
|
+
throw InvalidStringListError_1.InvalidStringListError.create(propertyName, 'string[]', 'mixed types', invalidElements);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
static valueIsNotArray(value) {
|
|
40
|
+
return Array.isArray(value) === false;
|
|
41
|
+
}
|
|
42
|
+
static emptyArrayIsNotAllowed(allowEmpty, value) {
|
|
43
|
+
return allowEmpty === false && value.length === 0;
|
|
44
|
+
}
|
|
45
|
+
static findNonStringElements(value) {
|
|
46
|
+
return value.filter((item) => typeof item !== 'string');
|
|
47
|
+
}
|
|
48
|
+
static hasInvalidElements(invalidElements) {
|
|
49
|
+
return invalidElements.length > 0;
|
|
27
50
|
}
|
|
28
51
|
}
|
|
29
52
|
exports.StringList = StringList;
|
|
30
|
-
_a = StringList, _StringList_guardAgainstNonArrayValue = function _StringList_guardAgainstNonArrayValue(value, propertyName) {
|
|
31
|
-
if (__classPrivateFieldGet(this, _a, "m", _StringList_valueIsNotArray).call(this, value)) {
|
|
32
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'string[]', typeof value);
|
|
33
|
-
}
|
|
34
|
-
}, _StringList_guardAgainstEmptyArray = function _StringList_guardAgainstEmptyArray(value, propertyName, options) {
|
|
35
|
-
const { allowEmpty } = options;
|
|
36
|
-
if (__classPrivateFieldGet(this, _a, "m", _StringList_emptyArrayIsNotAllowed).call(this, allowEmpty, value)) {
|
|
37
|
-
throw InvalidStringListError_1.InvalidStringListError.create(propertyName, 'string[]', 'empty array', ['Array cannot be empty']);
|
|
38
|
-
}
|
|
39
|
-
}, _StringList_guardAgainstNonStringElements = function _StringList_guardAgainstNonStringElements(value, propertyName) {
|
|
40
|
-
const invalidElements = __classPrivateFieldGet(this, _a, "m", _StringList_findNonStringElements).call(this, value);
|
|
41
|
-
if (__classPrivateFieldGet(this, _a, "m", _StringList_hasInvalidElements).call(this, invalidElements)) {
|
|
42
|
-
throw InvalidStringListError_1.InvalidStringListError.create(propertyName, 'string[]', 'mixed types', invalidElements);
|
|
43
|
-
}
|
|
44
|
-
}, _StringList_valueIsNotArray = function _StringList_valueIsNotArray(value) {
|
|
45
|
-
return Array.isArray(value) === false;
|
|
46
|
-
}, _StringList_emptyArrayIsNotAllowed = function _StringList_emptyArrayIsNotAllowed(allowEmpty, value) {
|
|
47
|
-
return allowEmpty === false && value.length === 0;
|
|
48
|
-
}, _StringList_findNonStringElements = function _StringList_findNonStringElements(value) {
|
|
49
|
-
return value.filter((item) => typeof item !== 'string');
|
|
50
|
-
}, _StringList_hasInvalidElements = function _StringList_hasInvalidElements(invalidElements) {
|
|
51
|
-
return invalidElements.length > 0;
|
|
52
|
-
};
|
|
53
53
|
StringList.DEFAULT_OPTIONS = { 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 _TaxIdentification_type, _TaxIdentification_number, _TaxIdentification_country, _TaxIdentification_issuedBy, _TaxIdentification_validFrom, _TaxIdentification_validUntil;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.TaxIdentification = void 0;
|
|
16
16
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
@@ -28,7 +28,7 @@ class TaxIdentification extends ObjectValueObject_1.ObjectValueObject {
|
|
|
28
28
|
* Constructor protegido para que solo clases hijas puedan instanciar.
|
|
29
29
|
* Aplica todas las validaciones de dominio al momento de construcción.
|
|
30
30
|
*/
|
|
31
|
-
constructor(value, skipDomainValidation, propertyName =
|
|
31
|
+
constructor(value, skipDomainValidation, propertyName = TaxIdentification.DEFAULT_PROPERTY_NAME) {
|
|
32
32
|
super(value, skipDomainValidation, propertyName, 'The provided value must be of type TaxIdentification from the domain layer', { allowNull: false, allowUndefined: false });
|
|
33
33
|
_TaxIdentification_type.set(this, void 0);
|
|
34
34
|
_TaxIdentification_number.set(this, void 0);
|
|
@@ -37,7 +37,7 @@ class TaxIdentification extends ObjectValueObject_1.ObjectValueObject {
|
|
|
37
37
|
_TaxIdentification_validFrom.set(this, void 0);
|
|
38
38
|
_TaxIdentification_validUntil.set(this, void 0);
|
|
39
39
|
if (skipDomainValidation === false) {
|
|
40
|
-
|
|
40
|
+
TaxIdentification.validateTaxIdentification(value, propertyName);
|
|
41
41
|
}
|
|
42
42
|
__classPrivateFieldSet(this, _TaxIdentification_type, value.type.trim().toUpperCase(), "f");
|
|
43
43
|
__classPrivateFieldSet(this, _TaxIdentification_number, value.number.trim(), "f");
|
|
@@ -50,14 +50,117 @@ class TaxIdentification extends ObjectValueObject_1.ObjectValueObject {
|
|
|
50
50
|
* Validación estática para reutilización en factory methods y constructores.
|
|
51
51
|
*/
|
|
52
52
|
static validateTaxIdentification(value, propertyName) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
this.guardAgainstInvalidType(value, propertyName);
|
|
54
|
+
this.guardAgainstInvalidTaxType(value.type);
|
|
55
|
+
this.guardAgainstInvalidTaxNumber(value.number);
|
|
56
|
+
this.guardAgainstInvalidCountryCode(value.country);
|
|
57
|
+
this.guardAgainstInvalidIssuedBy(value.issuedBy);
|
|
58
|
+
this.guardAgainstInvalidValidFrom(value.validFrom);
|
|
59
|
+
this.guardAgainstInvalidValidUntil(value.validUntil);
|
|
60
|
+
this.guardAgainstInvalidDateRange(value.validFrom, value.validUntil);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Valida que el objeto tenga la estructura correcta.
|
|
64
|
+
*/
|
|
65
|
+
static guardAgainstInvalidType(value, propertyName) {
|
|
66
|
+
if (!value || typeof value !== 'object') {
|
|
67
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'TaxIdentification object', typeof value);
|
|
68
|
+
}
|
|
69
|
+
if (typeof value.type !== 'string') {
|
|
70
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('type', 'string', typeof value.type);
|
|
71
|
+
}
|
|
72
|
+
if (typeof value.number !== 'string') {
|
|
73
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('number', 'string', typeof value.number);
|
|
74
|
+
}
|
|
75
|
+
if (typeof value.country !== 'string') {
|
|
76
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('country', 'string', typeof value.country);
|
|
77
|
+
}
|
|
78
|
+
if (value.issuedBy !== null && typeof value.issuedBy !== 'string') {
|
|
79
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('issuedBy', 'string | null', typeof value.issuedBy);
|
|
80
|
+
}
|
|
81
|
+
if (value.validFrom !== null && typeof value.validFrom !== 'string') {
|
|
82
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('validFrom', 'string | null', typeof value.validFrom);
|
|
83
|
+
}
|
|
84
|
+
if (value.validUntil !== null && typeof value.validUntil !== 'string') {
|
|
85
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('validUntil', 'string | null', typeof value.validUntil);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Valida que el tipo de identificación tributaria sea válido.
|
|
90
|
+
*/
|
|
91
|
+
static guardAgainstInvalidTaxType(type) {
|
|
92
|
+
const trimmedType = type.trim().toUpperCase();
|
|
93
|
+
if (trimmedType.length === 0) {
|
|
94
|
+
throw InvalidTaxIdentificationTypeError_1.InvalidTaxIdentificationTypeError.create('empty tax identification type', this.VALID_TYPES);
|
|
95
|
+
}
|
|
96
|
+
if (!this.VALID_TYPES.includes(trimmedType)) {
|
|
97
|
+
throw InvalidTaxIdentificationTypeError_1.InvalidTaxIdentificationTypeError.create(trimmedType, this.VALID_TYPES);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Valida el número de identificación tributaria usando el VO TaxIdentificationNumber.
|
|
102
|
+
*/
|
|
103
|
+
static guardAgainstInvalidTaxNumber(number) {
|
|
104
|
+
TaxIdentificationNumber_1.TaxIdentificationNumber.validateCompletely(number, 'number');
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Valida el código de país según los valores permitidos en el enum CountryCode.
|
|
108
|
+
*/
|
|
109
|
+
static guardAgainstInvalidCountryCode(country) {
|
|
110
|
+
const trimmedCountry = country.trim().toUpperCase();
|
|
111
|
+
if (trimmedCountry.length === 0) {
|
|
112
|
+
throw InvalidCountryCodeError_1.InvalidCountryCodeError.create('empty country code');
|
|
113
|
+
}
|
|
114
|
+
if (!this.VALID_COUNTRY_CODES.includes(trimmedCountry)) {
|
|
115
|
+
throw InvalidCountryCodeError_1.InvalidCountryCodeError.create(trimmedCountry);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Valida la entidad emisora si está presente.
|
|
120
|
+
*/
|
|
121
|
+
static guardAgainstInvalidIssuedBy(issuedBy) {
|
|
122
|
+
if (issuedBy !== null) {
|
|
123
|
+
String_1.String.guardAgainstEmptyValue(issuedBy, 'issuedBy');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Valida la fecha de inicio de validez si está presente.
|
|
128
|
+
*/
|
|
129
|
+
static guardAgainstInvalidValidFrom(validFrom) {
|
|
130
|
+
if (validFrom !== null) {
|
|
131
|
+
if (!NullableDate_1.NullableDate.isValidNullableDate(validFrom)) {
|
|
132
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('validFrom', 'valid date string (DD/MM/YYYY)', validFrom);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Valida la fecha de fin de validez si está presente.
|
|
138
|
+
*/
|
|
139
|
+
static guardAgainstInvalidValidUntil(validUntil) {
|
|
140
|
+
if (validUntil !== null) {
|
|
141
|
+
if (!NullableDate_1.NullableDate.isValidNullableDate(validUntil)) {
|
|
142
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('validUntil', 'valid date string (DD/MM/YYYY)', validUntil);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Valida que el rango de fechas sea consistente.
|
|
148
|
+
*/
|
|
149
|
+
static guardAgainstInvalidDateRange(validFrom, validUntil) {
|
|
150
|
+
if (validFrom && validUntil) {
|
|
151
|
+
const fromDate = this.parseDate(validFrom);
|
|
152
|
+
const untilDate = this.parseDate(validUntil);
|
|
153
|
+
if (fromDate >= untilDate) {
|
|
154
|
+
throw InvalidDateRangeError_1.InvalidDateRangeError.create(validFrom, validUntil);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Método auxiliar para parsear fechas en formato DD/MM/YYYY.
|
|
160
|
+
*/
|
|
161
|
+
static parseDate(dateString) {
|
|
162
|
+
const [day, month, year] = dateString.split('/').map(Number);
|
|
163
|
+
return new Date(year, month - 1, day);
|
|
61
164
|
}
|
|
62
165
|
/**
|
|
63
166
|
* Tipo de identificación tributaria (NIT, RUC, etc.).
|
|
@@ -114,13 +217,13 @@ class TaxIdentification extends ObjectValueObject_1.ObjectValueObject {
|
|
|
114
217
|
const now = new Date();
|
|
115
218
|
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
116
219
|
if (__classPrivateFieldGet(this, _TaxIdentification_validFrom, "f")) {
|
|
117
|
-
const fromDate =
|
|
220
|
+
const fromDate = TaxIdentification.parseDate(__classPrivateFieldGet(this, _TaxIdentification_validFrom, "f"));
|
|
118
221
|
if (today < fromDate) {
|
|
119
222
|
return false;
|
|
120
223
|
}
|
|
121
224
|
}
|
|
122
225
|
if (__classPrivateFieldGet(this, _TaxIdentification_validUntil, "f")) {
|
|
123
|
-
const untilDate =
|
|
226
|
+
const untilDate = TaxIdentification.parseDate(__classPrivateFieldGet(this, _TaxIdentification_validUntil, "f"));
|
|
124
227
|
if (today > untilDate) {
|
|
125
228
|
return false;
|
|
126
229
|
}
|
|
@@ -133,13 +236,13 @@ class TaxIdentification extends ObjectValueObject_1.ObjectValueObject {
|
|
|
133
236
|
isValidOnDate(date) {
|
|
134
237
|
const checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
135
238
|
if (__classPrivateFieldGet(this, _TaxIdentification_validFrom, "f")) {
|
|
136
|
-
const fromDate =
|
|
239
|
+
const fromDate = TaxIdentification.parseDate(__classPrivateFieldGet(this, _TaxIdentification_validFrom, "f"));
|
|
137
240
|
if (checkDate < fromDate) {
|
|
138
241
|
return false;
|
|
139
242
|
}
|
|
140
243
|
}
|
|
141
244
|
if (__classPrivateFieldGet(this, _TaxIdentification_validUntil, "f")) {
|
|
142
|
-
const untilDate =
|
|
245
|
+
const untilDate = TaxIdentification.parseDate(__classPrivateFieldGet(this, _TaxIdentification_validUntil, "f"));
|
|
143
246
|
if (checkDate > untilDate) {
|
|
144
247
|
return false;
|
|
145
248
|
}
|
|
@@ -177,7 +280,7 @@ class TaxIdentification extends ObjectValueObject_1.ObjectValueObject {
|
|
|
177
280
|
* Compara la igualdad semántica con otro objeto TaxIdentification.
|
|
178
281
|
*/
|
|
179
282
|
equals(other) {
|
|
180
|
-
if (!(other instanceof
|
|
283
|
+
if (!(other instanceof TaxIdentification)) {
|
|
181
284
|
return false;
|
|
182
285
|
}
|
|
183
286
|
return (__classPrivateFieldGet(this, _TaxIdentification_type, "f") === __classPrivateFieldGet(other, _TaxIdentification_type, "f")
|
|
@@ -192,7 +295,7 @@ class TaxIdentification extends ObjectValueObject_1.ObjectValueObject {
|
|
|
192
295
|
* independientemente de fechas de validez y entidad emisora.
|
|
193
296
|
*/
|
|
194
297
|
hasSameIdentifier(other) {
|
|
195
|
-
if (!(other instanceof
|
|
298
|
+
if (!(other instanceof TaxIdentification)) {
|
|
196
299
|
return false;
|
|
197
300
|
}
|
|
198
301
|
return (__classPrivateFieldGet(this, _TaxIdentification_type, "f") === __classPrivateFieldGet(other, _TaxIdentification_type, "f")
|
|
@@ -238,74 +341,7 @@ class TaxIdentification extends ObjectValueObject_1.ObjectValueObject {
|
|
|
238
341
|
}
|
|
239
342
|
}
|
|
240
343
|
exports.TaxIdentification = TaxIdentification;
|
|
241
|
-
|
|
242
|
-
if (!value || typeof value !== 'object') {
|
|
243
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'TaxIdentification object', typeof value);
|
|
244
|
-
}
|
|
245
|
-
if (typeof value.type !== 'string') {
|
|
246
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('type', 'string', typeof value.type);
|
|
247
|
-
}
|
|
248
|
-
if (typeof value.number !== 'string') {
|
|
249
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('number', 'string', typeof value.number);
|
|
250
|
-
}
|
|
251
|
-
if (typeof value.country !== 'string') {
|
|
252
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('country', 'string', typeof value.country);
|
|
253
|
-
}
|
|
254
|
-
if (value.issuedBy !== null && typeof value.issuedBy !== 'string') {
|
|
255
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('issuedBy', 'string | null', typeof value.issuedBy);
|
|
256
|
-
}
|
|
257
|
-
if (value.validFrom !== null && typeof value.validFrom !== 'string') {
|
|
258
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('validFrom', 'string | null', typeof value.validFrom);
|
|
259
|
-
}
|
|
260
|
-
if (value.validUntil !== null && typeof value.validUntil !== 'string') {
|
|
261
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('validUntil', 'string | null', typeof value.validUntil);
|
|
262
|
-
}
|
|
263
|
-
}, _TaxIdentification_guardAgainstInvalidTaxType = function _TaxIdentification_guardAgainstInvalidTaxType(type) {
|
|
264
|
-
const trimmedType = type.trim().toUpperCase();
|
|
265
|
-
if (trimmedType.length === 0) {
|
|
266
|
-
throw InvalidTaxIdentificationTypeError_1.InvalidTaxIdentificationTypeError.create('empty tax identification type', this.VALID_TYPES);
|
|
267
|
-
}
|
|
268
|
-
if (!this.VALID_TYPES.includes(trimmedType)) {
|
|
269
|
-
throw InvalidTaxIdentificationTypeError_1.InvalidTaxIdentificationTypeError.create(trimmedType, this.VALID_TYPES);
|
|
270
|
-
}
|
|
271
|
-
}, _TaxIdentification_guardAgainstInvalidTaxNumber = function _TaxIdentification_guardAgainstInvalidTaxNumber(number) {
|
|
272
|
-
TaxIdentificationNumber_1.TaxIdentificationNumber.validateCompletely(number, 'number');
|
|
273
|
-
}, _TaxIdentification_guardAgainstInvalidCountryCode = function _TaxIdentification_guardAgainstInvalidCountryCode(country) {
|
|
274
|
-
const trimmedCountry = country.trim().toUpperCase();
|
|
275
|
-
if (trimmedCountry.length === 0) {
|
|
276
|
-
throw InvalidCountryCodeError_1.InvalidCountryCodeError.create('empty country code');
|
|
277
|
-
}
|
|
278
|
-
if (!this.VALID_COUNTRY_CODES.includes(trimmedCountry)) {
|
|
279
|
-
throw InvalidCountryCodeError_1.InvalidCountryCodeError.create(trimmedCountry);
|
|
280
|
-
}
|
|
281
|
-
}, _TaxIdentification_guardAgainstInvalidIssuedBy = function _TaxIdentification_guardAgainstInvalidIssuedBy(issuedBy) {
|
|
282
|
-
if (issuedBy !== null) {
|
|
283
|
-
String_1.String.guardAgainstEmptyValue(issuedBy, 'issuedBy');
|
|
284
|
-
}
|
|
285
|
-
}, _TaxIdentification_guardAgainstInvalidValidFrom = function _TaxIdentification_guardAgainstInvalidValidFrom(validFrom) {
|
|
286
|
-
if (validFrom !== null) {
|
|
287
|
-
if (!NullableDate_1.NullableDate.isValidNullableDate(validFrom)) {
|
|
288
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('validFrom', 'valid date string (DD/MM/YYYY)', validFrom);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}, _TaxIdentification_guardAgainstInvalidValidUntil = function _TaxIdentification_guardAgainstInvalidValidUntil(validUntil) {
|
|
292
|
-
if (validUntil !== null) {
|
|
293
|
-
if (!NullableDate_1.NullableDate.isValidNullableDate(validUntil)) {
|
|
294
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('validUntil', 'valid date string (DD/MM/YYYY)', validUntil);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}, _TaxIdentification_guardAgainstInvalidDateRange = function _TaxIdentification_guardAgainstInvalidDateRange(validFrom, validUntil) {
|
|
298
|
-
if (validFrom && validUntil) {
|
|
299
|
-
const fromDate = __classPrivateFieldGet(this, _a, "m", _TaxIdentification_parseDate).call(this, validFrom);
|
|
300
|
-
const untilDate = __classPrivateFieldGet(this, _a, "m", _TaxIdentification_parseDate).call(this, validUntil);
|
|
301
|
-
if (fromDate >= untilDate) {
|
|
302
|
-
throw InvalidDateRangeError_1.InvalidDateRangeError.create(validFrom, validUntil);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}, _TaxIdentification_parseDate = function _TaxIdentification_parseDate(dateString) {
|
|
306
|
-
const [day, month, year] = dateString.split('/').map(Number);
|
|
307
|
-
return new Date(year, month - 1, day);
|
|
308
|
-
};
|
|
344
|
+
_TaxIdentification_type = new WeakMap(), _TaxIdentification_number = new WeakMap(), _TaxIdentification_country = new WeakMap(), _TaxIdentification_issuedBy = new WeakMap(), _TaxIdentification_validFrom = new WeakMap(), _TaxIdentification_validUntil = new WeakMap();
|
|
309
345
|
TaxIdentification.DEFAULT_PROPERTY_NAME = 'taxIdentification';
|
|
310
346
|
// Tipos de identificación tributaria válidos
|
|
311
347
|
TaxIdentification.VALID_TYPES = Object.values(TaxIdentification_1.TaxIdentification);
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
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");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var _TaxIdentificationNumberList_instances, _a, _TaxIdentificationNumberList_guardAgainstInvalidList, _TaxIdentificationNumberList_validateEachTaxIdentificationNumber, _TaxIdentificationNumberList_guardAgainstInvalidTinType, _TaxIdentificationNumberList_guardAgainstEmptyTin, _TaxIdentificationNumberList_guardAgainstInvalidTinLength, _TaxIdentificationNumberList_guardAgainstInvalidTinFormat, _TaxIdentificationNumberList_guardAgainstControlCharacters;
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.TaxIdentificationNumberList = void 0;
|
|
10
4
|
const ValueObject_1 = require("./ValueObject");
|
|
@@ -17,10 +11,64 @@ const InvalidPropertyValueError_1 = require("../exceptions/InvalidPropertyValueE
|
|
|
17
11
|
class TaxIdentificationNumberList extends ValueObject_1.ValueObject {
|
|
18
12
|
constructor(value, skipDomainValidation, propertyName) {
|
|
19
13
|
super(value, skipDomainValidation, propertyName, 'string[]', { allowNull: false, allowUndefined: false });
|
|
20
|
-
_TaxIdentificationNumberList_instances.add(this);
|
|
21
14
|
if (skipDomainValidation === false) {
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
this.guardAgainstInvalidList(value, propertyName);
|
|
16
|
+
this.validateEachTaxIdentificationNumber(value, propertyName);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Valida que la lista sea válida
|
|
21
|
+
*/
|
|
22
|
+
guardAgainstInvalidList(value, propertyName) {
|
|
23
|
+
if (!Array.isArray(value)) {
|
|
24
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array', typeof value);
|
|
25
|
+
}
|
|
26
|
+
// Permitir listas vacías - depende del contexto de negocio
|
|
27
|
+
// Si no quieres listas vacías, descomenta la siguiente línea:
|
|
28
|
+
// if (value.length === 0) {
|
|
29
|
+
// throw InvalidPropertyValueError.create(propertyName, 'non-empty array', 'empty array');
|
|
30
|
+
// }
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Valida cada TIN en la lista
|
|
34
|
+
*/
|
|
35
|
+
validateEachTaxIdentificationNumber(value, propertyName) {
|
|
36
|
+
value.forEach((tin, index) => {
|
|
37
|
+
const indexedPropertyName = `${propertyName}[${index}]`;
|
|
38
|
+
this.guardAgainstInvalidTinType(tin, indexedPropertyName);
|
|
39
|
+
this.guardAgainstEmptyTin(tin, indexedPropertyName);
|
|
40
|
+
this.guardAgainstInvalidTinLength(tin, indexedPropertyName);
|
|
41
|
+
this.guardAgainstInvalidTinFormat(tin, indexedPropertyName);
|
|
42
|
+
this.guardAgainstControlCharacters(tin, indexedPropertyName);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
guardAgainstInvalidTinType(tin, propertyName) {
|
|
46
|
+
if (typeof tin !== 'string') {
|
|
47
|
+
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'string', typeof tin);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
guardAgainstEmptyTin(tin, propertyName) {
|
|
51
|
+
if (tin.trim().length === 0) {
|
|
52
|
+
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty string', 'empty string');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
guardAgainstInvalidTinLength(tin, propertyName) {
|
|
56
|
+
const trimmedValue = tin.trim();
|
|
57
|
+
if (trimmedValue.length < TaxIdentificationNumberList.MIN_LENGTH
|
|
58
|
+
|| trimmedValue.length > TaxIdentificationNumberList.MAX_LENGTH) {
|
|
59
|
+
throw InvalidTaxIdentificationNumberLengthError_1.InvalidTaxIdentificationNumberLengthError.create(propertyName, trimmedValue.length, TaxIdentificationNumberList.MIN_LENGTH, TaxIdentificationNumberList.MAX_LENGTH);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
guardAgainstInvalidTinFormat(tin, propertyName) {
|
|
63
|
+
const trimmedValue = tin.trim();
|
|
64
|
+
if (!TaxIdentificationNumberList.VALID_PATTERN.test(trimmedValue)) {
|
|
65
|
+
throw InvalidTaxIdentificationNumberFormatError_1.InvalidTaxIdentificationNumberFormatError.create(propertyName, trimmedValue, 'alphanumeric characters and basic separators (-, _, ., /, \\)');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
guardAgainstControlCharacters(tin, propertyName) {
|
|
69
|
+
const hasControlChars = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/.test(tin);
|
|
70
|
+
if (hasControlChars) {
|
|
71
|
+
throw TaxIdentificationNumberWithControlCharactersError_1.TaxIdentificationNumberWithControlCharactersError.create(propertyName);
|
|
24
72
|
}
|
|
25
73
|
}
|
|
26
74
|
/**
|
|
@@ -160,49 +208,6 @@ class TaxIdentificationNumberList extends ValueObject_1.ValueObject {
|
|
|
160
208
|
}
|
|
161
209
|
}
|
|
162
210
|
exports.TaxIdentificationNumberList = TaxIdentificationNumberList;
|
|
163
|
-
_a = TaxIdentificationNumberList, _TaxIdentificationNumberList_instances = new WeakSet(), _TaxIdentificationNumberList_guardAgainstInvalidList = function _TaxIdentificationNumberList_guardAgainstInvalidList(value, propertyName) {
|
|
164
|
-
if (!Array.isArray(value)) {
|
|
165
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array', typeof value);
|
|
166
|
-
}
|
|
167
|
-
// Permitir listas vacías - depende del contexto de negocio
|
|
168
|
-
// Si no quieres listas vacías, descomenta la siguiente línea:
|
|
169
|
-
// if (value.length === 0) {
|
|
170
|
-
// throw InvalidPropertyValueError.create(propertyName, 'non-empty array', 'empty array');
|
|
171
|
-
// }
|
|
172
|
-
}, _TaxIdentificationNumberList_validateEachTaxIdentificationNumber = function _TaxIdentificationNumberList_validateEachTaxIdentificationNumber(value, propertyName) {
|
|
173
|
-
value.forEach((tin, index) => {
|
|
174
|
-
const indexedPropertyName = `${propertyName}[${index}]`;
|
|
175
|
-
__classPrivateFieldGet(this, _TaxIdentificationNumberList_instances, "m", _TaxIdentificationNumberList_guardAgainstInvalidTinType).call(this, tin, indexedPropertyName);
|
|
176
|
-
__classPrivateFieldGet(this, _TaxIdentificationNumberList_instances, "m", _TaxIdentificationNumberList_guardAgainstEmptyTin).call(this, tin, indexedPropertyName);
|
|
177
|
-
__classPrivateFieldGet(this, _TaxIdentificationNumberList_instances, "m", _TaxIdentificationNumberList_guardAgainstInvalidTinLength).call(this, tin, indexedPropertyName);
|
|
178
|
-
__classPrivateFieldGet(this, _TaxIdentificationNumberList_instances, "m", _TaxIdentificationNumberList_guardAgainstInvalidTinFormat).call(this, tin, indexedPropertyName);
|
|
179
|
-
__classPrivateFieldGet(this, _TaxIdentificationNumberList_instances, "m", _TaxIdentificationNumberList_guardAgainstControlCharacters).call(this, tin, indexedPropertyName);
|
|
180
|
-
});
|
|
181
|
-
}, _TaxIdentificationNumberList_guardAgainstInvalidTinType = function _TaxIdentificationNumberList_guardAgainstInvalidTinType(tin, propertyName) {
|
|
182
|
-
if (typeof tin !== 'string') {
|
|
183
|
-
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'string', typeof tin);
|
|
184
|
-
}
|
|
185
|
-
}, _TaxIdentificationNumberList_guardAgainstEmptyTin = function _TaxIdentificationNumberList_guardAgainstEmptyTin(tin, propertyName) {
|
|
186
|
-
if (tin.trim().length === 0) {
|
|
187
|
-
throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty string', 'empty string');
|
|
188
|
-
}
|
|
189
|
-
}, _TaxIdentificationNumberList_guardAgainstInvalidTinLength = function _TaxIdentificationNumberList_guardAgainstInvalidTinLength(tin, propertyName) {
|
|
190
|
-
const trimmedValue = tin.trim();
|
|
191
|
-
if (trimmedValue.length < _a.MIN_LENGTH
|
|
192
|
-
|| trimmedValue.length > _a.MAX_LENGTH) {
|
|
193
|
-
throw InvalidTaxIdentificationNumberLengthError_1.InvalidTaxIdentificationNumberLengthError.create(propertyName, trimmedValue.length, _a.MIN_LENGTH, _a.MAX_LENGTH);
|
|
194
|
-
}
|
|
195
|
-
}, _TaxIdentificationNumberList_guardAgainstInvalidTinFormat = function _TaxIdentificationNumberList_guardAgainstInvalidTinFormat(tin, propertyName) {
|
|
196
|
-
const trimmedValue = tin.trim();
|
|
197
|
-
if (!_a.VALID_PATTERN.test(trimmedValue)) {
|
|
198
|
-
throw InvalidTaxIdentificationNumberFormatError_1.InvalidTaxIdentificationNumberFormatError.create(propertyName, trimmedValue, 'alphanumeric characters and basic separators (-, _, ., /, \\)');
|
|
199
|
-
}
|
|
200
|
-
}, _TaxIdentificationNumberList_guardAgainstControlCharacters = function _TaxIdentificationNumberList_guardAgainstControlCharacters(tin, propertyName) {
|
|
201
|
-
const hasControlChars = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/.test(tin);
|
|
202
|
-
if (hasControlChars) {
|
|
203
|
-
throw TaxIdentificationNumberWithControlCharactersError_1.TaxIdentificationNumberWithControlCharactersError.create(propertyName);
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
211
|
TaxIdentificationNumberList.MIN_LENGTH = 1;
|
|
207
212
|
TaxIdentificationNumberList.MAX_LENGTH = 50;
|
|
208
213
|
TaxIdentificationNumberList.VALID_PATTERN = /^[A-Za-z0-9\-_.\/\\]+$/;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
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");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var _a, _Url_urlIsInvalid, _Url_urlIsValid;
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.Url = void 0;
|
|
10
4
|
const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
|
|
@@ -13,26 +7,27 @@ class Url extends String_1.String {
|
|
|
13
7
|
constructor(value, skipDomainValidation, propertyName) {
|
|
14
8
|
super(value, skipDomainValidation, propertyName);
|
|
15
9
|
if (skipDomainValidation === false) {
|
|
16
|
-
|
|
10
|
+
Url.guardAgainstInvalidUrl(value, propertyName);
|
|
17
11
|
}
|
|
18
12
|
}
|
|
19
13
|
static guardAgainstInvalidUrl(value, propertyName) {
|
|
20
14
|
String_1.String.guardAgainstInvalidType(value, propertyName);
|
|
21
15
|
String_1.String.guardAgainstEmptyValue(value, propertyName);
|
|
22
|
-
if (
|
|
16
|
+
if (this.urlIsInvalid(value)) {
|
|
23
17
|
throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'valid URL', 'invalid URL');
|
|
24
18
|
}
|
|
25
19
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
_a = Url, _Url_urlIsInvalid = function _Url_urlIsInvalid(value) {
|
|
29
|
-
return __classPrivateFieldGet(this, _a, "m", _Url_urlIsValid).call(this, value) === false;
|
|
30
|
-
}, _Url_urlIsValid = function _Url_urlIsValid(value) {
|
|
31
|
-
try {
|
|
32
|
-
const url = new URL(value);
|
|
33
|
-
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
20
|
+
static urlIsInvalid(value) {
|
|
21
|
+
return this.urlIsValid(value) === false;
|
|
34
22
|
}
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
static urlIsValid(value) {
|
|
24
|
+
try {
|
|
25
|
+
const url = new URL(value);
|
|
26
|
+
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
37
31
|
}
|
|
38
|
-
}
|
|
32
|
+
}
|
|
33
|
+
exports.Url = Url;
|