@carbonbox/domain 0.4.7 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/build/carbonbox/shared/domain/value-objects/ActivityDataSubmissionReference.js +97 -61
  2. package/build/carbonbox/shared/domain/value-objects/Address.js +63 -52
  3. package/build/carbonbox/shared/domain/value-objects/AggregateId.js +13 -18
  4. package/build/carbonbox/shared/domain/value-objects/Boolean.js +29 -30
  5. package/build/carbonbox/shared/domain/value-objects/CalculationProcessReference.js +36 -32
  6. package/build/carbonbox/shared/domain/value-objects/CalculationVariableReferences.js +82 -62
  7. package/build/carbonbox/shared/domain/value-objects/CarbonClientReference.js +181 -114
  8. package/build/carbonbox/shared/domain/value-objects/CarbonClientReferences.js +109 -74
  9. package/build/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.js +37 -27
  10. package/build/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.js +101 -68
  11. package/build/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.js +95 -60
  12. package/build/carbonbox/shared/domain/value-objects/CodeList.js +57 -41
  13. package/build/carbonbox/shared/domain/value-objects/CollectionFieldReference.js +74 -49
  14. package/build/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.js +171 -116
  15. package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.js +70 -43
  16. package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.js +70 -43
  17. package/build/carbonbox/shared/domain/value-objects/Currency.js +10 -15
  18. package/build/carbonbox/shared/domain/value-objects/DateString.js +15 -20
  19. package/build/carbonbox/shared/domain/value-objects/DateTimeString.js +17 -22
  20. package/build/carbonbox/shared/domain/value-objects/Email.js +9 -14
  21. package/build/carbonbox/shared/domain/value-objects/EmissionCalculationFormulaReference.js +46 -31
  22. package/build/carbonbox/shared/domain/value-objects/EmissionCalculationReference.js +102 -77
  23. package/build/carbonbox/shared/domain/value-objects/EmissionFactorReference.js +56 -40
  24. package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.js +58 -38
  25. package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.js +95 -60
  26. package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.js +171 -116
  27. package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.js +43 -30
  28. package/build/carbonbox/shared/domain/value-objects/EventEditionReference.js +49 -33
  29. package/build/carbonbox/shared/domain/value-objects/EventEditionReferences.js +65 -49
  30. package/build/carbonbox/shared/domain/value-objects/EventReference.js +41 -31
  31. package/build/carbonbox/shared/domain/value-objects/ExecutionPeriod.js +95 -79
  32. package/build/carbonbox/shared/domain/value-objects/FacilityReference.js +34 -24
  33. package/build/carbonbox/shared/domain/value-objects/Gender.js +11 -16
  34. package/build/carbonbox/shared/domain/value-objects/GlobalWarmingPotentialReference.js +72 -53
  35. package/build/carbonbox/shared/domain/value-objects/Image.js +46 -38
  36. package/build/carbonbox/shared/domain/value-objects/Integer.js +13 -18
  37. package/build/carbonbox/shared/domain/value-objects/NullableCode.js +17 -22
  38. package/build/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.js +49 -31
  39. package/build/carbonbox/shared/domain/value-objects/NullableDate.js +25 -27
  40. package/build/carbonbox/shared/domain/value-objects/NullableDateTimeString.js +34 -37
  41. package/build/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.js +49 -31
  42. package/build/carbonbox/shared/domain/value-objects/NullableNumeric.js +60 -63
  43. package/build/carbonbox/shared/domain/value-objects/NullablePositiveInteger.js +4 -11
  44. package/build/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.js +49 -31
  45. package/build/carbonbox/shared/domain/value-objects/NullableStakeholderReference.js +8 -8
  46. package/build/carbonbox/shared/domain/value-objects/NullableString.js +22 -25
  47. package/build/carbonbox/shared/domain/value-objects/NullableTaxIdentificationNumber.js +43 -35
  48. package/build/carbonbox/shared/domain/value-objects/Numeric.js +72 -69
  49. package/build/carbonbox/shared/domain/value-objects/Phone.js +66 -47
  50. package/build/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.js +176 -121
  51. package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.js +101 -61
  52. package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.js +101 -61
  53. package/build/carbonbox/shared/domain/value-objects/ProductConfigurationSystemBoundaryReference.js +60 -40
  54. package/build/carbonbox/shared/domain/value-objects/ProductReference.js +46 -31
  55. package/build/carbonbox/shared/domain/value-objects/ServiceCatalogReference.js +60 -40
  56. package/build/carbonbox/shared/domain/value-objects/StakeholderReference.js +123 -75
  57. package/build/carbonbox/shared/domain/value-objects/StakeholderReferences.js +124 -81
  58. package/build/carbonbox/shared/domain/value-objects/String.js +13 -17
  59. package/build/carbonbox/shared/domain/value-objects/StringList.js +35 -35
  60. package/build/carbonbox/shared/domain/value-objects/TaxIdentification.js +121 -85
  61. package/build/carbonbox/shared/domain/value-objects/TaxIdentificationNumberList.js +57 -52
  62. package/build/carbonbox/shared/domain/value-objects/Url.js +14 -19
  63. package/build/carbonbox/shared/domain/value-objects/UrlList.js +57 -41
  64. package/build/carbonbox/shared/domain/value-objects/UserBusinessStatus.js +17 -22
  65. package/build/carbonbox/shared/domain/value-objects/UserEmail.js +48 -40
  66. package/build/carbonbox/shared/domain/value-objects/UserPassword.js +29 -32
  67. package/build/carbonbox/shared/domain/value-objects/UserPermissions.js +47 -46
  68. package/build/carbonbox/shared/domain/value-objects/UserType.js +17 -22
  69. package/build/carbonbox/shared/domain/value-objects/ValueObject.js +17 -16
  70. package/build/main/index.js +4 -2
  71. package/build/types/carbonbox/shared/domain/value-objects/ActivityDataSubmissionReference.d.ts +37 -1
  72. package/build/types/carbonbox/shared/domain/value-objects/ActivityDataSubmissionReference.d.ts.map +1 -1
  73. package/build/types/carbonbox/shared/domain/value-objects/Address.d.ts +22 -4
  74. package/build/types/carbonbox/shared/domain/value-objects/Address.d.ts.map +1 -1
  75. package/build/types/carbonbox/shared/domain/value-objects/AggregateId.d.ts +4 -3
  76. package/build/types/carbonbox/shared/domain/value-objects/AggregateId.d.ts.map +1 -1
  77. package/build/types/carbonbox/shared/domain/value-objects/AggregateIdList.d.ts +2 -2
  78. package/build/types/carbonbox/shared/domain/value-objects/AggregateIdList.d.ts.map +1 -1
  79. package/build/types/carbonbox/shared/domain/value-objects/Boolean.d.ts +5 -1
  80. package/build/types/carbonbox/shared/domain/value-objects/Boolean.d.ts.map +1 -1
  81. package/build/types/carbonbox/shared/domain/value-objects/CalculationProcessReference.d.ts +5 -1
  82. package/build/types/carbonbox/shared/domain/value-objects/CalculationProcessReference.d.ts.map +1 -1
  83. package/build/types/carbonbox/shared/domain/value-objects/CalculationVariableReferences.d.ts +24 -4
  84. package/build/types/carbonbox/shared/domain/value-objects/CalculationVariableReferences.d.ts.map +1 -1
  85. package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReference.d.ts +70 -2
  86. package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReference.d.ts.map +1 -1
  87. package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReferences.d.ts +39 -2
  88. package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReferences.d.ts.map +1 -1
  89. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.d.ts +11 -1
  90. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.d.ts.map +1 -1
  91. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.d.ts +35 -1
  92. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.d.ts.map +1 -1
  93. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.d.ts +38 -2
  94. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.d.ts.map +1 -1
  95. package/build/types/carbonbox/shared/domain/value-objects/Code.d.ts +1 -1
  96. package/build/types/carbonbox/shared/domain/value-objects/Code.d.ts.map +1 -1
  97. package/build/types/carbonbox/shared/domain/value-objects/CodeList.d.ts +18 -2
  98. package/build/types/carbonbox/shared/domain/value-objects/CodeList.d.ts.map +1 -1
  99. package/build/types/carbonbox/shared/domain/value-objects/CollectionFieldReference.d.ts +26 -1
  100. package/build/types/carbonbox/shared/domain/value-objects/CollectionFieldReference.d.ts.map +1 -1
  101. package/build/types/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.d.ts +64 -2
  102. package/build/types/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.d.ts.map +1 -1
  103. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.d.ts +30 -2
  104. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
  105. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts +30 -2
  106. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  107. package/build/types/carbonbox/shared/domain/value-objects/Currency.d.ts +3 -2
  108. package/build/types/carbonbox/shared/domain/value-objects/Currency.d.ts.map +1 -1
  109. package/build/types/carbonbox/shared/domain/value-objects/DateString.d.ts +5 -3
  110. package/build/types/carbonbox/shared/domain/value-objects/DateString.d.ts.map +1 -1
  111. package/build/types/carbonbox/shared/domain/value-objects/DateTimeString.d.ts +5 -3
  112. package/build/types/carbonbox/shared/domain/value-objects/DateTimeString.d.ts.map +1 -1
  113. package/build/types/carbonbox/shared/domain/value-objects/Email.d.ts +3 -2
  114. package/build/types/carbonbox/shared/domain/value-objects/Email.d.ts.map +1 -1
  115. package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationFormulaReference.d.ts +16 -1
  116. package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationFormulaReference.d.ts.map +1 -1
  117. package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationReference.d.ts +26 -1
  118. package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationReference.d.ts.map +1 -1
  119. package/build/types/carbonbox/shared/domain/value-objects/EmissionFactorReference.d.ts +17 -1
  120. package/build/types/carbonbox/shared/domain/value-objects/EmissionFactorReference.d.ts.map +1 -1
  121. package/build/types/carbonbox/shared/domain/value-objects/EmissionSource.d.ts +1 -1
  122. package/build/types/carbonbox/shared/domain/value-objects/EmissionSource.d.ts.map +1 -1
  123. package/build/types/carbonbox/shared/domain/value-objects/EmissionSources.d.ts +3 -3
  124. package/build/types/carbonbox/shared/domain/value-objects/EmissionSources.d.ts.map +1 -1
  125. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +22 -2
  126. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  127. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.d.ts +38 -2
  128. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.d.ts.map +1 -1
  129. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.d.ts +64 -2
  130. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.d.ts.map +1 -1
  131. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.d.ts +14 -1
  132. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.d.ts.map +1 -1
  133. package/build/types/carbonbox/shared/domain/value-objects/EventEditionReference.d.ts +17 -1
  134. package/build/types/carbonbox/shared/domain/value-objects/EventEditionReference.d.ts.map +1 -1
  135. package/build/types/carbonbox/shared/domain/value-objects/EventEditionReferences.d.ts +20 -4
  136. package/build/types/carbonbox/shared/domain/value-objects/EventEditionReferences.d.ts.map +1 -1
  137. package/build/types/carbonbox/shared/domain/value-objects/EventReference.d.ts +11 -1
  138. package/build/types/carbonbox/shared/domain/value-objects/EventReference.d.ts.map +1 -1
  139. package/build/types/carbonbox/shared/domain/value-objects/ExecutionPeriod.d.ts +16 -1
  140. package/build/types/carbonbox/shared/domain/value-objects/ExecutionPeriod.d.ts.map +1 -1
  141. package/build/types/carbonbox/shared/domain/value-objects/FacilityReference.d.ts +11 -1
  142. package/build/types/carbonbox/shared/domain/value-objects/FacilityReference.d.ts.map +1 -1
  143. package/build/types/carbonbox/shared/domain/value-objects/Gender.d.ts +4 -3
  144. package/build/types/carbonbox/shared/domain/value-objects/Gender.d.ts.map +1 -1
  145. package/build/types/carbonbox/shared/domain/value-objects/GlobalWarmingPotentialReference.d.ts +21 -2
  146. package/build/types/carbonbox/shared/domain/value-objects/GlobalWarmingPotentialReference.d.ts.map +1 -1
  147. package/build/types/carbonbox/shared/domain/value-objects/Image.d.ts +12 -0
  148. package/build/types/carbonbox/shared/domain/value-objects/Image.d.ts.map +1 -1
  149. package/build/types/carbonbox/shared/domain/value-objects/Integer.d.ts +4 -2
  150. package/build/types/carbonbox/shared/domain/value-objects/Integer.d.ts.map +1 -1
  151. package/build/types/carbonbox/shared/domain/value-objects/NullableCode.d.ts +4 -2
  152. package/build/types/carbonbox/shared/domain/value-objects/NullableCode.d.ts.map +1 -1
  153. package/build/types/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.d.ts +19 -1
  154. package/build/types/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  155. package/build/types/carbonbox/shared/domain/value-objects/NullableDate.d.ts +6 -1
  156. package/build/types/carbonbox/shared/domain/value-objects/NullableDate.d.ts.map +1 -1
  157. package/build/types/carbonbox/shared/domain/value-objects/NullableDateTimeString.d.ts +5 -1
  158. package/build/types/carbonbox/shared/domain/value-objects/NullableDateTimeString.d.ts.map +1 -1
  159. package/build/types/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +19 -1
  160. package/build/types/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  161. package/build/types/carbonbox/shared/domain/value-objects/NullableNumeric.d.ts +6 -2
  162. package/build/types/carbonbox/shared/domain/value-objects/NullableNumeric.d.ts.map +1 -1
  163. package/build/types/carbonbox/shared/domain/value-objects/NullablePositiveInteger.d.ts +3 -2
  164. package/build/types/carbonbox/shared/domain/value-objects/NullablePositiveInteger.d.ts.map +1 -1
  165. package/build/types/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.d.ts +19 -1
  166. package/build/types/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  167. package/build/types/carbonbox/shared/domain/value-objects/NullableStakeholderReference.d.ts +2 -1
  168. package/build/types/carbonbox/shared/domain/value-objects/NullableStakeholderReference.d.ts.map +1 -1
  169. package/build/types/carbonbox/shared/domain/value-objects/NullableString.d.ts +5 -1
  170. package/build/types/carbonbox/shared/domain/value-objects/NullableString.d.ts.map +1 -1
  171. package/build/types/carbonbox/shared/domain/value-objects/NullableTaxIdentificationNumber.d.ts +20 -5
  172. package/build/types/carbonbox/shared/domain/value-objects/NullableTaxIdentificationNumber.d.ts.map +1 -1
  173. package/build/types/carbonbox/shared/domain/value-objects/Numeric.d.ts +11 -2
  174. package/build/types/carbonbox/shared/domain/value-objects/Numeric.d.ts.map +1 -1
  175. package/build/types/carbonbox/shared/domain/value-objects/Phone.d.ts +21 -2
  176. package/build/types/carbonbox/shared/domain/value-objects/Phone.d.ts.map +1 -1
  177. package/build/types/carbonbox/shared/domain/value-objects/PositiveInteger.d.ts +2 -1
  178. package/build/types/carbonbox/shared/domain/value-objects/PositiveInteger.d.ts.map +1 -1
  179. package/build/types/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.d.ts +60 -2
  180. package/build/types/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.d.ts.map +1 -1
  181. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.d.ts +45 -4
  182. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
  183. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts +45 -4
  184. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  185. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationSystemBoundaryReference.d.ts +21 -1
  186. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationSystemBoundaryReference.d.ts.map +1 -1
  187. package/build/types/carbonbox/shared/domain/value-objects/ProductReference.d.ts +16 -1
  188. package/build/types/carbonbox/shared/domain/value-objects/ProductReference.d.ts.map +1 -1
  189. package/build/types/carbonbox/shared/domain/value-objects/ServiceCatalogReference.d.ts +21 -1
  190. package/build/types/carbonbox/shared/domain/value-objects/ServiceCatalogReference.d.ts.map +1 -1
  191. package/build/types/carbonbox/shared/domain/value-objects/StakeholderReference.d.ts +51 -2
  192. package/build/types/carbonbox/shared/domain/value-objects/StakeholderReference.d.ts.map +1 -1
  193. package/build/types/carbonbox/shared/domain/value-objects/StakeholderReferences.d.ts +46 -2
  194. package/build/types/carbonbox/shared/domain/value-objects/StakeholderReferences.d.ts.map +1 -1
  195. package/build/types/carbonbox/shared/domain/value-objects/String.d.ts +3 -1
  196. package/build/types/carbonbox/shared/domain/value-objects/String.d.ts.map +1 -1
  197. package/build/types/carbonbox/shared/domain/value-objects/StringList.d.ts +7 -1
  198. package/build/types/carbonbox/shared/domain/value-objects/StringList.d.ts.map +1 -1
  199. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentification.d.ts +41 -3
  200. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentification.d.ts.map +1 -1
  201. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumber.d.ts +4 -4
  202. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumber.d.ts.map +1 -1
  203. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumberList.d.ts +16 -4
  204. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumberList.d.ts.map +1 -1
  205. package/build/types/carbonbox/shared/domain/value-objects/Url.d.ts +2 -1
  206. package/build/types/carbonbox/shared/domain/value-objects/Url.d.ts.map +1 -1
  207. package/build/types/carbonbox/shared/domain/value-objects/UrlList.d.ts +18 -2
  208. package/build/types/carbonbox/shared/domain/value-objects/UrlList.d.ts.map +1 -1
  209. package/build/types/carbonbox/shared/domain/value-objects/UserBusinessStatus.d.ts +4 -2
  210. package/build/types/carbonbox/shared/domain/value-objects/UserBusinessStatus.d.ts.map +1 -1
  211. package/build/types/carbonbox/shared/domain/value-objects/UserEmail.d.ts +10 -1
  212. package/build/types/carbonbox/shared/domain/value-objects/UserEmail.d.ts.map +1 -1
  213. package/build/types/carbonbox/shared/domain/value-objects/UserPassword.d.ts +7 -3
  214. package/build/types/carbonbox/shared/domain/value-objects/UserPassword.d.ts.map +1 -1
  215. package/build/types/carbonbox/shared/domain/value-objects/UserPermissions.d.ts +11 -3
  216. package/build/types/carbonbox/shared/domain/value-objects/UserPermissions.d.ts.map +1 -1
  217. package/build/types/carbonbox/shared/domain/value-objects/UserType.d.ts +4 -2
  218. package/build/types/carbonbox/shared/domain/value-objects/UserType.d.ts.map +1 -1
  219. package/build/types/carbonbox/shared/domain/value-objects/ValueObject.d.ts +2 -0
  220. package/build/types/carbonbox/shared/domain/value-objects/ValueObject.d.ts.map +1 -1
  221. package/build/types/main/index.d.ts +1 -0
  222. package/build/types/main/index.d.ts.map +1 -1
  223. package/package.json +1 -1
@@ -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 _NullableString_instances, _NullableString_guardAgainstInvalidNullableString, _NullableString_guardAgainstInvalidStringValue, _NullableString_guardAgainstEmptyString, _NullableString_guardAgainstInvalidStringType, _NullableString_valueIsNotNull;
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.NullableString = void 0;
10
4
  const String_1 = require("./String");
@@ -12,16 +6,33 @@ const ValueObject_1 = require("./ValueObject");
12
6
  class NullableString extends ValueObject_1.ValueObject {
13
7
  constructor(value, skipDomainValidation, propertyName) {
14
8
  super(value, skipDomainValidation, propertyName, 'string | null', { allowNull: true, allowUndefined: false });
15
- _NullableString_instances.add(this);
16
9
  if (skipDomainValidation === false) {
17
- __classPrivateFieldGet(this, _NullableString_instances, "m", _NullableString_guardAgainstInvalidNullableString).call(this, value, propertyName);
10
+ this.guardAgainstInvalidNullableString(value, propertyName);
18
11
  }
19
12
  }
13
+ guardAgainstInvalidNullableString(value, propertyName) {
14
+ if (this.valueIsNotNull(value)) {
15
+ this.guardAgainstInvalidStringValue(value, propertyName);
16
+ }
17
+ }
18
+ guardAgainstInvalidStringValue(value, propertyName) {
19
+ this.guardAgainstEmptyString(value, propertyName);
20
+ this.guardAgainstInvalidStringType(value, propertyName);
21
+ }
22
+ guardAgainstEmptyString(value, propertyName) {
23
+ String_1.String.guardAgainstEmptyValue(value, propertyName);
24
+ }
25
+ guardAgainstInvalidStringType(value, propertyName) {
26
+ String_1.String.guardAgainstInvalidType(value, propertyName);
27
+ }
28
+ valueIsNotNull(value) {
29
+ return value !== null;
30
+ }
20
31
  hasValue() {
21
- return __classPrivateFieldGet(this, _NullableString_instances, "m", _NullableString_valueIsNotNull).call(this, this.value);
32
+ return this.valueIsNotNull(this.value);
22
33
  }
23
34
  getLength() {
24
- if (__classPrivateFieldGet(this, _NullableString_instances, "m", _NullableString_valueIsNotNull).call(this, this.value)) {
35
+ if (this.valueIsNotNull(this.value)) {
25
36
  return this.value.length;
26
37
  }
27
38
  return null;
@@ -40,7 +51,7 @@ class NullableString extends ValueObject_1.ValueObject {
40
51
  }
41
52
  }
42
53
  isEmpty() {
43
- if (__classPrivateFieldGet(this, _NullableString_instances, "m", _NullableString_valueIsNotNull).call(this, this.value)) {
54
+ if (this.valueIsNotNull(this.value)) {
44
55
  return this.value.trim().length === 0;
45
56
  }
46
57
  return null;
@@ -50,17 +61,3 @@ class NullableString extends ValueObject_1.ValueObject {
50
61
  }
51
62
  }
52
63
  exports.NullableString = NullableString;
53
- _NullableString_instances = new WeakSet(), _NullableString_guardAgainstInvalidNullableString = function _NullableString_guardAgainstInvalidNullableString(value, propertyName) {
54
- if (__classPrivateFieldGet(this, _NullableString_instances, "m", _NullableString_valueIsNotNull).call(this, value)) {
55
- __classPrivateFieldGet(this, _NullableString_instances, "m", _NullableString_guardAgainstInvalidStringValue).call(this, value, propertyName);
56
- }
57
- }, _NullableString_guardAgainstInvalidStringValue = function _NullableString_guardAgainstInvalidStringValue(value, propertyName) {
58
- __classPrivateFieldGet(this, _NullableString_instances, "m", _NullableString_guardAgainstEmptyString).call(this, value, propertyName);
59
- __classPrivateFieldGet(this, _NullableString_instances, "m", _NullableString_guardAgainstInvalidStringType).call(this, value, propertyName);
60
- }, _NullableString_guardAgainstEmptyString = function _NullableString_guardAgainstEmptyString(value, propertyName) {
61
- String_1.String.guardAgainstEmptyValue(value, propertyName);
62
- }, _NullableString_guardAgainstInvalidStringType = function _NullableString_guardAgainstInvalidStringType(value, propertyName) {
63
- String_1.String.guardAgainstInvalidType(value, propertyName);
64
- }, _NullableString_valueIsNotNull = function _NullableString_valueIsNotNull(value) {
65
- return value !== null;
66
- };
@@ -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 _NullableTaxIdentificationNumber_instances, _a, _NullableTaxIdentificationNumber_validateTaxIdentificationNumber, _NullableTaxIdentificationNumber_guardAgainstInvalidLength, _NullableTaxIdentificationNumber_guardAgainstInvalidFormat, _NullableTaxIdentificationNumber_guardAgainstControlCharacters;
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.NullableTaxIdentificationNumber = void 0;
10
4
  const InvalidTaxIdentificationNumberFormatError_1 = require("../exceptions/InvalidTaxIdentificationNumberFormatError");
@@ -12,16 +6,51 @@ const InvalidTaxIdentificationNumberLengthError_1 = require("../exceptions/Inval
12
6
  const TaxIdentificationNumberWithControlCharactersError_1 = require("../exceptions/TaxIdentificationNumberWithControlCharactersError");
13
7
  const NullableString_1 = require("./NullableString");
14
8
  class NullableTaxIdentificationNumber extends NullableString_1.NullableString {
15
- constructor(value, skipDomainValidation, propertyName = _a.DEFAULT_PROPERTY_NAME) {
9
+ constructor(value, skipDomainValidation, propertyName = NullableTaxIdentificationNumber.DEFAULT_PROPERTY_NAME) {
16
10
  super(value, skipDomainValidation, propertyName);
17
- _NullableTaxIdentificationNumber_instances.add(this);
18
11
  if (skipDomainValidation === false) {
19
12
  // Solo validar si el valor no es null
20
13
  if (value !== null) {
21
- __classPrivateFieldGet(this, _NullableTaxIdentificationNumber_instances, "m", _NullableTaxIdentificationNumber_validateTaxIdentificationNumber).call(this, value, propertyName);
14
+ this.validateTaxIdentificationNumber(value, propertyName);
22
15
  }
23
16
  }
24
17
  }
18
+ /**
19
+ * Validaciones específicas para TaxIdentificationNumber cuando no es null
20
+ */
21
+ validateTaxIdentificationNumber(value, propertyName) {
22
+ this.guardAgainstInvalidLength(value, propertyName);
23
+ this.guardAgainstInvalidFormat(value, propertyName);
24
+ this.guardAgainstControlCharacters(value, propertyName);
25
+ }
26
+ /**
27
+ * Valida que el valor tenga una longitud apropiada
28
+ */
29
+ guardAgainstInvalidLength(value, propertyName) {
30
+ const trimmedValue = value.trim();
31
+ if (trimmedValue.length < NullableTaxIdentificationNumber.MIN_LENGTH
32
+ || trimmedValue.length > NullableTaxIdentificationNumber.MAX_LENGTH) {
33
+ throw InvalidTaxIdentificationNumberLengthError_1.InvalidTaxIdentificationNumberLengthError.create(propertyName, trimmedValue.length, NullableTaxIdentificationNumber.MIN_LENGTH, NullableTaxIdentificationNumber.MAX_LENGTH);
34
+ }
35
+ }
36
+ /**
37
+ * Valida que el formato contenga solo caracteres válidos para un TIN
38
+ */
39
+ guardAgainstInvalidFormat(value, propertyName) {
40
+ const trimmedValue = value.trim();
41
+ if (!NullableTaxIdentificationNumber.VALID_PATTERN.test(trimmedValue)) {
42
+ throw InvalidTaxIdentificationNumberFormatError_1.InvalidTaxIdentificationNumberFormatError.create(propertyName, trimmedValue, 'alphanumeric characters and basic separators (-, _, ., /, \\)');
43
+ }
44
+ }
45
+ /**
46
+ * Valida que no contenga caracteres de control
47
+ */
48
+ guardAgainstControlCharacters(value, propertyName) {
49
+ const hasControlChars = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/.test(value);
50
+ if (hasControlChars) {
51
+ throw TaxIdentificationNumberWithControlCharactersError_1.TaxIdentificationNumberWithControlCharactersError.create(propertyName);
52
+ }
53
+ }
25
54
  /**
26
55
  * Normaliza el valor eliminando espacios extra y convirtiendo a mayúsculas si es necesario
27
56
  */
@@ -48,7 +77,7 @@ class NullableTaxIdentificationNumber extends NullableString_1.NullableString {
48
77
  return true; // null es válido para nullable
49
78
  }
50
79
  try {
51
- __classPrivateFieldGet(this, _NullableTaxIdentificationNumber_instances, "m", _NullableTaxIdentificationNumber_validateTaxIdentificationNumber).call(this, this.value, 'temp');
80
+ this.validateTaxIdentificationNumber(this.value, 'temp');
52
81
  return true;
53
82
  }
54
83
  catch {
@@ -77,7 +106,7 @@ class NullableTaxIdentificationNumber extends NullableString_1.NullableString {
77
106
  if (value === null) {
78
107
  return true;
79
108
  }
80
- return NullableString_1.NullableString.isValidNullableString(value) && _a.isValidTaxIdentificationNumberFormat(value);
109
+ return NullableString_1.NullableString.isValidNullableString(value) && NullableTaxIdentificationNumber.isValidTaxIdentificationNumberFormat(value);
81
110
  }
82
111
  /**
83
112
  * Valida formato específico de TIN
@@ -85,12 +114,12 @@ class NullableTaxIdentificationNumber extends NullableString_1.NullableString {
85
114
  static isValidTaxIdentificationNumberFormat(value) {
86
115
  const trimmedValue = value.trim();
87
116
  // Validar longitud
88
- if (trimmedValue.length < _a.MIN_LENGTH
89
- || trimmedValue.length > _a.MAX_LENGTH) {
117
+ if (trimmedValue.length < NullableTaxIdentificationNumber.MIN_LENGTH
118
+ || trimmedValue.length > NullableTaxIdentificationNumber.MAX_LENGTH) {
90
119
  return false;
91
120
  }
92
121
  // Validar patrón
93
- if (!_a.VALID_PATTERN.test(trimmedValue)) {
122
+ if (!NullableTaxIdentificationNumber.VALID_PATTERN.test(trimmedValue)) {
94
123
  return false;
95
124
  }
96
125
  // Validar caracteres de control
@@ -124,27 +153,6 @@ class NullableTaxIdentificationNumber extends NullableString_1.NullableString {
124
153
  }
125
154
  }
126
155
  exports.NullableTaxIdentificationNumber = NullableTaxIdentificationNumber;
127
- _a = NullableTaxIdentificationNumber, _NullableTaxIdentificationNumber_instances = new WeakSet(), _NullableTaxIdentificationNumber_validateTaxIdentificationNumber = function _NullableTaxIdentificationNumber_validateTaxIdentificationNumber(value, propertyName) {
128
- __classPrivateFieldGet(this, _NullableTaxIdentificationNumber_instances, "m", _NullableTaxIdentificationNumber_guardAgainstInvalidLength).call(this, value, propertyName);
129
- __classPrivateFieldGet(this, _NullableTaxIdentificationNumber_instances, "m", _NullableTaxIdentificationNumber_guardAgainstInvalidFormat).call(this, value, propertyName);
130
- __classPrivateFieldGet(this, _NullableTaxIdentificationNumber_instances, "m", _NullableTaxIdentificationNumber_guardAgainstControlCharacters).call(this, value, propertyName);
131
- }, _NullableTaxIdentificationNumber_guardAgainstInvalidLength = function _NullableTaxIdentificationNumber_guardAgainstInvalidLength(value, propertyName) {
132
- const trimmedValue = value.trim();
133
- if (trimmedValue.length < _a.MIN_LENGTH
134
- || trimmedValue.length > _a.MAX_LENGTH) {
135
- throw InvalidTaxIdentificationNumberLengthError_1.InvalidTaxIdentificationNumberLengthError.create(propertyName, trimmedValue.length, _a.MIN_LENGTH, _a.MAX_LENGTH);
136
- }
137
- }, _NullableTaxIdentificationNumber_guardAgainstInvalidFormat = function _NullableTaxIdentificationNumber_guardAgainstInvalidFormat(value, propertyName) {
138
- const trimmedValue = value.trim();
139
- if (!_a.VALID_PATTERN.test(trimmedValue)) {
140
- throw InvalidTaxIdentificationNumberFormatError_1.InvalidTaxIdentificationNumberFormatError.create(propertyName, trimmedValue, 'alphanumeric characters and basic separators (-, _, ., /, \\)');
141
- }
142
- }, _NullableTaxIdentificationNumber_guardAgainstControlCharacters = function _NullableTaxIdentificationNumber_guardAgainstControlCharacters(value, propertyName) {
143
- const hasControlChars = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/.test(value);
144
- if (hasControlChars) {
145
- throw TaxIdentificationNumberWithControlCharactersError_1.TaxIdentificationNumberWithControlCharactersError.create(propertyName);
146
- }
147
- };
148
156
  NullableTaxIdentificationNumber.DEFAULT_PROPERTY_NAME = 'taxIdentificationNumber';
149
157
  NullableTaxIdentificationNumber.MIN_LENGTH = 1;
150
158
  NullableTaxIdentificationNumber.MAX_LENGTH = 50;
@@ -1,72 +1,82 @@
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 _Numeric_instances, _a, _Numeric_guardAgainstOptionsViolations, _Numeric_typeIsInvalid, _Numeric_isNaN, _Numeric_isInfinite, _Numeric_isNegative, _Numeric_isZero, _Numeric_isNonPositive, _Numeric_isOutOfRange, _Numeric_isNotInteger, _Numeric_hasExcessiveDecimalPlaces;
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.Numeric = void 0;
10
4
  const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
11
5
  const InvalidPropertyValueError_1 = require("../exceptions/InvalidPropertyValueError");
12
6
  const PrimitiveValueObject_1 = require("./PrimitiveValueObject");
13
7
  class Numeric extends PrimitiveValueObject_1.PrimitiveValueObject {
14
- constructor(value, skipDomainValidation, propertyName, options = _a.DEFAULT_OPTIONS) {
8
+ constructor(value, skipDomainValidation, propertyName, options = Numeric.DEFAULT_OPTIONS) {
15
9
  super(value, skipDomainValidation, propertyName, 'number', { allowNull: false, allowUndefined: false });
16
- _Numeric_instances.add(this);
17
10
  if (skipDomainValidation === false) {
18
- _a.guardAgainstInvalidType(value, propertyName);
19
- _a.guardAgainstInvalidNumber(value, propertyName);
20
- __classPrivateFieldGet(this, _Numeric_instances, "m", _Numeric_guardAgainstOptionsViolations).call(this, value, propertyName, options);
11
+ Numeric.guardAgainstInvalidType(value, propertyName);
12
+ Numeric.guardAgainstInvalidNumber(value, propertyName);
13
+ this.guardAgainstOptionsViolations(value, propertyName, options);
14
+ }
15
+ }
16
+ guardAgainstOptionsViolations(value, propertyName, options) {
17
+ if (!options.allowNegative && Numeric.isNegative(value)) {
18
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-negative number', value.toString());
19
+ }
20
+ if (!options.allowZero && Numeric.isZero(value)) {
21
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-zero number', '0');
22
+ }
23
+ if (!options.allowDecimals && Numeric.isNotInteger(value)) {
24
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'integer number', value.toString());
25
+ }
26
+ if (options.allowDecimals && Numeric.hasExcessiveDecimalPlaces(value, options.maxDecimalPlaces)) {
27
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, `number with maximum ${options.maxDecimalPlaces} decimal places`, value.toString());
28
+ }
29
+ if (Numeric.isOutOfRange(value, options.minValue, options.maxValue)) {
30
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, `number between ${options.minValue} and ${options.maxValue}`, value.toString());
21
31
  }
22
32
  }
23
33
  static guardAgainstInvalidType(value, propertyName) {
24
- if (__classPrivateFieldGet(this, _a, "m", _Numeric_typeIsInvalid).call(this, value)) {
34
+ if (this.typeIsInvalid(value)) {
25
35
  throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'number', typeof value);
26
36
  }
27
37
  }
28
38
  static guardAgainstInvalidNumber(value, propertyName) {
29
- _a.guardAgainstInvalidType(value, propertyName);
30
- if (__classPrivateFieldGet(this, _a, "m", _Numeric_isNaN).call(this, value)) {
39
+ Numeric.guardAgainstInvalidType(value, propertyName);
40
+ if (this.isNaN(value)) {
31
41
  throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'valid number', 'NaN');
32
42
  }
33
- if (__classPrivateFieldGet(this, _a, "m", _Numeric_isInfinite).call(this, value)) {
43
+ if (this.isInfinite(value)) {
34
44
  throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'finite number', 'Infinity');
35
45
  }
36
46
  }
37
47
  static guardAgainstNegativeValue(value, propertyName) {
38
- _a.guardAgainstInvalidNumber(value, propertyName);
39
- if (__classPrivateFieldGet(this, _a, "m", _Numeric_isNegative).call(this, value)) {
48
+ Numeric.guardAgainstInvalidNumber(value, propertyName);
49
+ if (this.isNegative(value)) {
40
50
  throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'positive number', value.toString());
41
51
  }
42
52
  }
43
53
  static guardAgainstZeroValue(value, propertyName) {
44
- _a.guardAgainstInvalidNumber(value, propertyName);
45
- if (__classPrivateFieldGet(this, _a, "m", _Numeric_isZero).call(this, value)) {
54
+ Numeric.guardAgainstInvalidNumber(value, propertyName);
55
+ if (this.isZero(value)) {
46
56
  throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-zero number', '0');
47
57
  }
48
58
  }
49
59
  static guardAgainstNonPositiveValue(value, propertyName) {
50
- _a.guardAgainstInvalidNumber(value, propertyName);
51
- if (__classPrivateFieldGet(this, _a, "m", _Numeric_isNonPositive).call(this, value)) {
60
+ Numeric.guardAgainstInvalidNumber(value, propertyName);
61
+ if (this.isNonPositive(value)) {
52
62
  throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'positive number', value.toString());
53
63
  }
54
64
  }
55
65
  static guardAgainstValueOutOfRange(value, propertyName, min, max) {
56
- _a.guardAgainstInvalidNumber(value, propertyName);
57
- if (__classPrivateFieldGet(this, _a, "m", _Numeric_isOutOfRange).call(this, value, min, max)) {
66
+ Numeric.guardAgainstInvalidNumber(value, propertyName);
67
+ if (this.isOutOfRange(value, min, max)) {
58
68
  throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, `number between ${min} and ${max}`, value.toString());
59
69
  }
60
70
  }
61
71
  static guardAgainstNonIntegerValue(value, propertyName) {
62
- _a.guardAgainstInvalidNumber(value, propertyName);
63
- if (__classPrivateFieldGet(this, _a, "m", _Numeric_isNotInteger).call(this, value)) {
72
+ Numeric.guardAgainstInvalidNumber(value, propertyName);
73
+ if (this.isNotInteger(value)) {
64
74
  throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'integer number', value.toString());
65
75
  }
66
76
  }
67
77
  static guardAgainstExcessiveDecimalPlaces(value, propertyName, maxDecimalPlaces) {
68
- _a.guardAgainstInvalidNumber(value, propertyName);
69
- if (__classPrivateFieldGet(this, _a, "m", _Numeric_hasExcessiveDecimalPlaces).call(this, value, maxDecimalPlaces)) {
78
+ Numeric.guardAgainstInvalidNumber(value, propertyName);
79
+ if (this.hasExcessiveDecimalPlaces(value, maxDecimalPlaces)) {
70
80
  throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, `number with maximum ${maxDecimalPlaces} decimal places`, value.toString());
71
81
  }
72
82
  }
@@ -104,61 +114,54 @@ class Numeric extends PrimitiveValueObject_1.PrimitiveValueObject {
104
114
  }
105
115
  // Métodos de comparación
106
116
  isGreaterThan(other) {
107
- const compareValue = other instanceof _a ? other.value : other;
117
+ const compareValue = other instanceof Numeric ? other.value : other;
108
118
  return this.value > compareValue;
109
119
  }
110
120
  isLessThan(other) {
111
- const compareValue = other instanceof _a ? other.value : other;
121
+ const compareValue = other instanceof Numeric ? other.value : other;
112
122
  return this.value < compareValue;
113
123
  }
114
124
  isEqualTo(other) {
115
- const compareValue = other instanceof _a ? other.value : other;
125
+ const compareValue = other instanceof Numeric ? other.value : other;
116
126
  return this.value === compareValue;
117
127
  }
128
+ // Métodos privados de validación
129
+ static typeIsInvalid(value) {
130
+ return typeof value !== 'number';
131
+ }
132
+ static isNaN(value) {
133
+ return Number.isNaN(value);
134
+ }
135
+ static isInfinite(value) {
136
+ return !Number.isFinite(value);
137
+ }
138
+ static isNegative(value) {
139
+ return value < 0;
140
+ }
141
+ static isZero(value) {
142
+ return value === 0;
143
+ }
144
+ static isNonPositive(value) {
145
+ return value <= 0;
146
+ }
147
+ static isOutOfRange(value, min, max) {
148
+ return value < min || value > max;
149
+ }
150
+ static isNotInteger(value) {
151
+ return !Number.isInteger(value);
152
+ }
153
+ static hasExcessiveDecimalPlaces(value, maxDecimalPlaces) {
154
+ if (Number.isInteger(value)) {
155
+ return false;
156
+ }
157
+ const decimalPart = value.toString().split('.')[1];
158
+ return decimalPart ? decimalPart.length > maxDecimalPlaces : false;
159
+ }
118
160
  toPrimitives() {
119
161
  return this.value;
120
162
  }
121
163
  }
122
164
  exports.Numeric = Numeric;
123
- _a = Numeric, _Numeric_instances = new WeakSet(), _Numeric_guardAgainstOptionsViolations = function _Numeric_guardAgainstOptionsViolations(value, propertyName, options) {
124
- if (!options.allowNegative && __classPrivateFieldGet(_a, _a, "m", _Numeric_isNegative).call(_a, value)) {
125
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-negative number', value.toString());
126
- }
127
- if (!options.allowZero && __classPrivateFieldGet(_a, _a, "m", _Numeric_isZero).call(_a, value)) {
128
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-zero number', '0');
129
- }
130
- if (!options.allowDecimals && __classPrivateFieldGet(_a, _a, "m", _Numeric_isNotInteger).call(_a, value)) {
131
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'integer number', value.toString());
132
- }
133
- if (options.allowDecimals && __classPrivateFieldGet(_a, _a, "m", _Numeric_hasExcessiveDecimalPlaces).call(_a, value, options.maxDecimalPlaces)) {
134
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, `number with maximum ${options.maxDecimalPlaces} decimal places`, value.toString());
135
- }
136
- if (__classPrivateFieldGet(_a, _a, "m", _Numeric_isOutOfRange).call(_a, value, options.minValue, options.maxValue)) {
137
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, `number between ${options.minValue} and ${options.maxValue}`, value.toString());
138
- }
139
- }, _Numeric_typeIsInvalid = function _Numeric_typeIsInvalid(value) {
140
- return typeof value !== 'number';
141
- }, _Numeric_isNaN = function _Numeric_isNaN(value) {
142
- return Number.isNaN(value);
143
- }, _Numeric_isInfinite = function _Numeric_isInfinite(value) {
144
- return !Number.isFinite(value);
145
- }, _Numeric_isNegative = function _Numeric_isNegative(value) {
146
- return value < 0;
147
- }, _Numeric_isZero = function _Numeric_isZero(value) {
148
- return value === 0;
149
- }, _Numeric_isNonPositive = function _Numeric_isNonPositive(value) {
150
- return value <= 0;
151
- }, _Numeric_isOutOfRange = function _Numeric_isOutOfRange(value, min, max) {
152
- return value < min || value > max;
153
- }, _Numeric_isNotInteger = function _Numeric_isNotInteger(value) {
154
- return !Number.isInteger(value);
155
- }, _Numeric_hasExcessiveDecimalPlaces = function _Numeric_hasExcessiveDecimalPlaces(value, maxDecimalPlaces) {
156
- if (Number.isInteger(value)) {
157
- return false;
158
- }
159
- const decimalPart = value.toString().split('.')[1];
160
- return decimalPart ? decimalPart.length > maxDecimalPlaces : false;
161
- };
162
165
  Numeric.DEFAULT_OPTIONS = {
163
166
  allowNegative: true,
164
167
  allowZero: 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 _a, _Phone_countryCode, _Phone_nationalNumber, _Phone_fullInternationalNumber, _Phone_phoneVerified, _Phone_guardAgainstInvalidType, _Phone_guardAgainstInvalidCountryCode, _Phone_guardAgainstInvalidNationalNumber, _Phone_guardAgainstInvalidFullInternationalNumber;
13
+ var _Phone_countryCode, _Phone_nationalNumber, _Phone_fullInternationalNumber, _Phone_phoneVerified;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.Phone = void 0;
16
16
  const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
@@ -30,7 +30,7 @@ class Phone extends ObjectValueObject_1.ObjectValueObject {
30
30
  _Phone_fullInternationalNumber.set(this, void 0);
31
31
  _Phone_phoneVerified.set(this, void 0);
32
32
  if (skipDomainValidation === false) {
33
- _a.validatePhone(props, propertyName);
33
+ Phone.validatePhone(props, propertyName);
34
34
  }
35
35
  __classPrivateFieldSet(this, _Phone_countryCode, props.countryCode.trim(), "f");
36
36
  __classPrivateFieldSet(this, _Phone_nationalNumber, props.nationalNumber.trim(), "f");
@@ -41,10 +41,67 @@ class Phone extends ObjectValueObject_1.ObjectValueObject {
41
41
  * Validación estática para reutilización en factory methods y constructores.
42
42
  */
43
43
  static validatePhone(value, propertyName) {
44
- __classPrivateFieldGet(this, _a, "m", _Phone_guardAgainstInvalidType).call(this, value, propertyName);
45
- __classPrivateFieldGet(this, _a, "m", _Phone_guardAgainstInvalidCountryCode).call(this, value.countryCode);
46
- __classPrivateFieldGet(this, _a, "m", _Phone_guardAgainstInvalidNationalNumber).call(this, value.nationalNumber);
47
- __classPrivateFieldGet(this, _a, "m", _Phone_guardAgainstInvalidFullInternationalNumber).call(this, value.fullInternationalNumber, value.countryCode, value.nationalNumber);
44
+ this.guardAgainstInvalidType(value, propertyName);
45
+ this.guardAgainstInvalidCountryCode(value.countryCode);
46
+ this.guardAgainstInvalidNationalNumber(value.nationalNumber);
47
+ this.guardAgainstInvalidFullInternationalNumber(value.fullInternationalNumber, value.countryCode, value.nationalNumber);
48
+ }
49
+ /**
50
+ * Valida que el objeto tenga la estructura correcta.
51
+ */
52
+ static guardAgainstInvalidType(value, propertyName) {
53
+ if (!value || typeof value !== 'object') {
54
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'Phone object', typeof value);
55
+ }
56
+ if (typeof value.countryCode !== 'string') {
57
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('countryCode', 'string', typeof value.countryCode);
58
+ }
59
+ if (typeof value.nationalNumber !== 'string') {
60
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('nationalNumber', 'string', typeof value.nationalNumber);
61
+ }
62
+ if (typeof value.fullInternationalNumber !== 'string') {
63
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('fullInternationalNumber', 'string', typeof value.fullInternationalNumber);
64
+ }
65
+ if (typeof value.phoneVerified !== 'boolean') {
66
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('phoneVerified', 'boolean', typeof value.phoneVerified);
67
+ }
68
+ }
69
+ /**
70
+ * Valida el formato del código de país según estándares internacionales.
71
+ * Debe empezar con + seguido de 1-3 dígitos, el primero no puede ser 0.
72
+ */
73
+ static guardAgainstInvalidCountryCode(code) {
74
+ const trimmedCode = code.trim();
75
+ if (trimmedCode.length === 0) {
76
+ throw InvalidCountryCodeError_1.InvalidCountryCodeError.create('empty country code');
77
+ }
78
+ if (!this.COUNTRY_CODE_PATTERN.test(trimmedCode)) {
79
+ throw InvalidCountryCodeError_1.InvalidCountryCodeError.create(trimmedCode);
80
+ }
81
+ }
82
+ /**
83
+ * Valida el formato del número nacional.
84
+ * Debe contener solo dígitos y tener entre 4 y 15 caracteres.
85
+ */
86
+ static guardAgainstInvalidNationalNumber(number) {
87
+ const trimmedNumber = number.trim();
88
+ if (trimmedNumber.length === 0) {
89
+ throw InvalidNationalNumberError_1.InvalidNationalNumberError.create('empty national number');
90
+ }
91
+ if (!this.NATIONAL_NUMBER_PATTERN.test(trimmedNumber)) {
92
+ throw InvalidNationalNumberError_1.InvalidNationalNumberError.create(trimmedNumber);
93
+ }
94
+ }
95
+ /**
96
+ * Valida que el número internacional completo sea consistente
97
+ * con el código de país y número nacional.
98
+ */
99
+ static guardAgainstInvalidFullInternationalNumber(full, code, national) {
100
+ const trimmedFull = full.trim();
101
+ const expected = `${code.trim()}${national.trim()}`;
102
+ if (trimmedFull !== expected) {
103
+ throw InvalidFullInternationalNumberError_1.InvalidFullInternationalNumberError.create(trimmedFull, expected);
104
+ }
48
105
  }
49
106
  /**
50
107
  * Código de país con formato internacional (ej: "+57", "+1", "+44").
@@ -118,7 +175,7 @@ class Phone extends ObjectValueObject_1.ObjectValueObject {
118
175
  * Dos teléfonos son iguales si tienen el mismo número internacional completo.
119
176
  */
120
177
  equals(other) {
121
- if (!(other instanceof _a)) {
178
+ if (!(other instanceof Phone)) {
122
179
  return false;
123
180
  }
124
181
  return (__classPrivateFieldGet(this, _Phone_countryCode, "f") === __classPrivateFieldGet(other, _Phone_countryCode, "f")
@@ -131,7 +188,7 @@ class Phone extends ObjectValueObject_1.ObjectValueObject {
131
188
  * independientemente del estado de verificación.
132
189
  */
133
190
  hasSameNumber(other) {
134
- if (!(other instanceof _a)) {
191
+ if (!(other instanceof Phone)) {
135
192
  return false;
136
193
  }
137
194
  return __classPrivateFieldGet(this, _Phone_fullInternationalNumber, "f") === __classPrivateFieldGet(other, _Phone_fullInternationalNumber, "f");
@@ -168,44 +225,6 @@ class Phone extends ObjectValueObject_1.ObjectValueObject {
168
225
  }
169
226
  }
170
227
  exports.Phone = Phone;
171
- _a = Phone, _Phone_countryCode = new WeakMap(), _Phone_nationalNumber = new WeakMap(), _Phone_fullInternationalNumber = new WeakMap(), _Phone_phoneVerified = new WeakMap(), _Phone_guardAgainstInvalidType = function _Phone_guardAgainstInvalidType(value, propertyName) {
172
- if (!value || typeof value !== 'object') {
173
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'Phone object', typeof value);
174
- }
175
- if (typeof value.countryCode !== 'string') {
176
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('countryCode', 'string', typeof value.countryCode);
177
- }
178
- if (typeof value.nationalNumber !== 'string') {
179
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('nationalNumber', 'string', typeof value.nationalNumber);
180
- }
181
- if (typeof value.fullInternationalNumber !== 'string') {
182
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('fullInternationalNumber', 'string', typeof value.fullInternationalNumber);
183
- }
184
- if (typeof value.phoneVerified !== 'boolean') {
185
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('phoneVerified', 'boolean', typeof value.phoneVerified);
186
- }
187
- }, _Phone_guardAgainstInvalidCountryCode = function _Phone_guardAgainstInvalidCountryCode(code) {
188
- const trimmedCode = code.trim();
189
- if (trimmedCode.length === 0) {
190
- throw InvalidCountryCodeError_1.InvalidCountryCodeError.create('empty country code');
191
- }
192
- if (!this.COUNTRY_CODE_PATTERN.test(trimmedCode)) {
193
- throw InvalidCountryCodeError_1.InvalidCountryCodeError.create(trimmedCode);
194
- }
195
- }, _Phone_guardAgainstInvalidNationalNumber = function _Phone_guardAgainstInvalidNationalNumber(number) {
196
- const trimmedNumber = number.trim();
197
- if (trimmedNumber.length === 0) {
198
- throw InvalidNationalNumberError_1.InvalidNationalNumberError.create('empty national number');
199
- }
200
- if (!this.NATIONAL_NUMBER_PATTERN.test(trimmedNumber)) {
201
- throw InvalidNationalNumberError_1.InvalidNationalNumberError.create(trimmedNumber);
202
- }
203
- }, _Phone_guardAgainstInvalidFullInternationalNumber = function _Phone_guardAgainstInvalidFullInternationalNumber(full, code, national) {
204
- const trimmedFull = full.trim();
205
- const expected = `${code.trim()}${national.trim()}`;
206
- if (trimmedFull !== expected) {
207
- throw InvalidFullInternationalNumberError_1.InvalidFullInternationalNumberError.create(trimmedFull, expected);
208
- }
209
- };
228
+ _Phone_countryCode = new WeakMap(), _Phone_nationalNumber = new WeakMap(), _Phone_fullInternationalNumber = new WeakMap(), _Phone_phoneVerified = new WeakMap();
210
229
  Phone.COUNTRY_CODE_PATTERN = /^\+[1-9]\d{0,2}$/;
211
230
  Phone.NATIONAL_NUMBER_PATTERN = /^\d{4,15}$/;