@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.
Files changed (220) 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/types/carbonbox/shared/domain/value-objects/ActivityDataSubmissionReference.d.ts +37 -1
  71. package/build/types/carbonbox/shared/domain/value-objects/ActivityDataSubmissionReference.d.ts.map +1 -1
  72. package/build/types/carbonbox/shared/domain/value-objects/Address.d.ts +22 -4
  73. package/build/types/carbonbox/shared/domain/value-objects/Address.d.ts.map +1 -1
  74. package/build/types/carbonbox/shared/domain/value-objects/AggregateId.d.ts +4 -3
  75. package/build/types/carbonbox/shared/domain/value-objects/AggregateId.d.ts.map +1 -1
  76. package/build/types/carbonbox/shared/domain/value-objects/AggregateIdList.d.ts +2 -2
  77. package/build/types/carbonbox/shared/domain/value-objects/AggregateIdList.d.ts.map +1 -1
  78. package/build/types/carbonbox/shared/domain/value-objects/Boolean.d.ts +5 -1
  79. package/build/types/carbonbox/shared/domain/value-objects/Boolean.d.ts.map +1 -1
  80. package/build/types/carbonbox/shared/domain/value-objects/CalculationProcessReference.d.ts +5 -1
  81. package/build/types/carbonbox/shared/domain/value-objects/CalculationProcessReference.d.ts.map +1 -1
  82. package/build/types/carbonbox/shared/domain/value-objects/CalculationVariableReferences.d.ts +24 -4
  83. package/build/types/carbonbox/shared/domain/value-objects/CalculationVariableReferences.d.ts.map +1 -1
  84. package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReference.d.ts +70 -2
  85. package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReference.d.ts.map +1 -1
  86. package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReferences.d.ts +39 -2
  87. package/build/types/carbonbox/shared/domain/value-objects/CarbonClientReferences.d.ts.map +1 -1
  88. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.d.ts +11 -1
  89. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.d.ts.map +1 -1
  90. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.d.ts +35 -1
  91. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.d.ts.map +1 -1
  92. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.d.ts +38 -2
  93. package/build/types/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.d.ts.map +1 -1
  94. package/build/types/carbonbox/shared/domain/value-objects/Code.d.ts +1 -1
  95. package/build/types/carbonbox/shared/domain/value-objects/Code.d.ts.map +1 -1
  96. package/build/types/carbonbox/shared/domain/value-objects/CodeList.d.ts +18 -2
  97. package/build/types/carbonbox/shared/domain/value-objects/CodeList.d.ts.map +1 -1
  98. package/build/types/carbonbox/shared/domain/value-objects/CollectionFieldReference.d.ts +26 -1
  99. package/build/types/carbonbox/shared/domain/value-objects/CollectionFieldReference.d.ts.map +1 -1
  100. package/build/types/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.d.ts +64 -2
  101. package/build/types/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.d.ts.map +1 -1
  102. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.d.ts +30 -2
  103. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
  104. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts +30 -2
  105. package/build/types/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  106. package/build/types/carbonbox/shared/domain/value-objects/Currency.d.ts +3 -2
  107. package/build/types/carbonbox/shared/domain/value-objects/Currency.d.ts.map +1 -1
  108. package/build/types/carbonbox/shared/domain/value-objects/DateString.d.ts +5 -3
  109. package/build/types/carbonbox/shared/domain/value-objects/DateString.d.ts.map +1 -1
  110. package/build/types/carbonbox/shared/domain/value-objects/DateTimeString.d.ts +5 -3
  111. package/build/types/carbonbox/shared/domain/value-objects/DateTimeString.d.ts.map +1 -1
  112. package/build/types/carbonbox/shared/domain/value-objects/Email.d.ts +3 -2
  113. package/build/types/carbonbox/shared/domain/value-objects/Email.d.ts.map +1 -1
  114. package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationFormulaReference.d.ts +16 -1
  115. package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationFormulaReference.d.ts.map +1 -1
  116. package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationReference.d.ts +26 -1
  117. package/build/types/carbonbox/shared/domain/value-objects/EmissionCalculationReference.d.ts.map +1 -1
  118. package/build/types/carbonbox/shared/domain/value-objects/EmissionFactorReference.d.ts +17 -1
  119. package/build/types/carbonbox/shared/domain/value-objects/EmissionFactorReference.d.ts.map +1 -1
  120. package/build/types/carbonbox/shared/domain/value-objects/EmissionSource.d.ts +1 -1
  121. package/build/types/carbonbox/shared/domain/value-objects/EmissionSource.d.ts.map +1 -1
  122. package/build/types/carbonbox/shared/domain/value-objects/EmissionSources.d.ts +3 -3
  123. package/build/types/carbonbox/shared/domain/value-objects/EmissionSources.d.ts.map +1 -1
  124. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +22 -2
  125. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  126. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.d.ts +38 -2
  127. package/build/types/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.d.ts.map +1 -1
  128. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.d.ts +64 -2
  129. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.d.ts.map +1 -1
  130. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.d.ts +14 -1
  131. package/build/types/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.d.ts.map +1 -1
  132. package/build/types/carbonbox/shared/domain/value-objects/EventEditionReference.d.ts +17 -1
  133. package/build/types/carbonbox/shared/domain/value-objects/EventEditionReference.d.ts.map +1 -1
  134. package/build/types/carbonbox/shared/domain/value-objects/EventEditionReferences.d.ts +20 -4
  135. package/build/types/carbonbox/shared/domain/value-objects/EventEditionReferences.d.ts.map +1 -1
  136. package/build/types/carbonbox/shared/domain/value-objects/EventReference.d.ts +11 -1
  137. package/build/types/carbonbox/shared/domain/value-objects/EventReference.d.ts.map +1 -1
  138. package/build/types/carbonbox/shared/domain/value-objects/ExecutionPeriod.d.ts +16 -1
  139. package/build/types/carbonbox/shared/domain/value-objects/ExecutionPeriod.d.ts.map +1 -1
  140. package/build/types/carbonbox/shared/domain/value-objects/FacilityReference.d.ts +11 -1
  141. package/build/types/carbonbox/shared/domain/value-objects/FacilityReference.d.ts.map +1 -1
  142. package/build/types/carbonbox/shared/domain/value-objects/Gender.d.ts +4 -3
  143. package/build/types/carbonbox/shared/domain/value-objects/Gender.d.ts.map +1 -1
  144. package/build/types/carbonbox/shared/domain/value-objects/GlobalWarmingPotentialReference.d.ts +21 -2
  145. package/build/types/carbonbox/shared/domain/value-objects/GlobalWarmingPotentialReference.d.ts.map +1 -1
  146. package/build/types/carbonbox/shared/domain/value-objects/Image.d.ts +12 -0
  147. package/build/types/carbonbox/shared/domain/value-objects/Image.d.ts.map +1 -1
  148. package/build/types/carbonbox/shared/domain/value-objects/Integer.d.ts +4 -2
  149. package/build/types/carbonbox/shared/domain/value-objects/Integer.d.ts.map +1 -1
  150. package/build/types/carbonbox/shared/domain/value-objects/NullableCode.d.ts +4 -2
  151. package/build/types/carbonbox/shared/domain/value-objects/NullableCode.d.ts.map +1 -1
  152. package/build/types/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.d.ts +19 -1
  153. package/build/types/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  154. package/build/types/carbonbox/shared/domain/value-objects/NullableDate.d.ts +6 -1
  155. package/build/types/carbonbox/shared/domain/value-objects/NullableDate.d.ts.map +1 -1
  156. package/build/types/carbonbox/shared/domain/value-objects/NullableDateTimeString.d.ts +5 -1
  157. package/build/types/carbonbox/shared/domain/value-objects/NullableDateTimeString.d.ts.map +1 -1
  158. package/build/types/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts +19 -1
  159. package/build/types/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  160. package/build/types/carbonbox/shared/domain/value-objects/NullableNumeric.d.ts +6 -2
  161. package/build/types/carbonbox/shared/domain/value-objects/NullableNumeric.d.ts.map +1 -1
  162. package/build/types/carbonbox/shared/domain/value-objects/NullablePositiveInteger.d.ts +3 -2
  163. package/build/types/carbonbox/shared/domain/value-objects/NullablePositiveInteger.d.ts.map +1 -1
  164. package/build/types/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.d.ts +19 -1
  165. package/build/types/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  166. package/build/types/carbonbox/shared/domain/value-objects/NullableStakeholderReference.d.ts +2 -1
  167. package/build/types/carbonbox/shared/domain/value-objects/NullableStakeholderReference.d.ts.map +1 -1
  168. package/build/types/carbonbox/shared/domain/value-objects/NullableString.d.ts +5 -1
  169. package/build/types/carbonbox/shared/domain/value-objects/NullableString.d.ts.map +1 -1
  170. package/build/types/carbonbox/shared/domain/value-objects/NullableTaxIdentificationNumber.d.ts +20 -5
  171. package/build/types/carbonbox/shared/domain/value-objects/NullableTaxIdentificationNumber.d.ts.map +1 -1
  172. package/build/types/carbonbox/shared/domain/value-objects/Numeric.d.ts +11 -2
  173. package/build/types/carbonbox/shared/domain/value-objects/Numeric.d.ts.map +1 -1
  174. package/build/types/carbonbox/shared/domain/value-objects/Phone.d.ts +21 -2
  175. package/build/types/carbonbox/shared/domain/value-objects/Phone.d.ts.map +1 -1
  176. package/build/types/carbonbox/shared/domain/value-objects/PositiveInteger.d.ts +2 -1
  177. package/build/types/carbonbox/shared/domain/value-objects/PositiveInteger.d.ts.map +1 -1
  178. package/build/types/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.d.ts +60 -2
  179. package/build/types/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.d.ts.map +1 -1
  180. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.d.ts +45 -4
  181. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.d.ts.map +1 -1
  182. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts +45 -4
  183. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.d.ts.map +1 -1
  184. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationSystemBoundaryReference.d.ts +21 -1
  185. package/build/types/carbonbox/shared/domain/value-objects/ProductConfigurationSystemBoundaryReference.d.ts.map +1 -1
  186. package/build/types/carbonbox/shared/domain/value-objects/ProductReference.d.ts +16 -1
  187. package/build/types/carbonbox/shared/domain/value-objects/ProductReference.d.ts.map +1 -1
  188. package/build/types/carbonbox/shared/domain/value-objects/ServiceCatalogReference.d.ts +21 -1
  189. package/build/types/carbonbox/shared/domain/value-objects/ServiceCatalogReference.d.ts.map +1 -1
  190. package/build/types/carbonbox/shared/domain/value-objects/StakeholderReference.d.ts +51 -2
  191. package/build/types/carbonbox/shared/domain/value-objects/StakeholderReference.d.ts.map +1 -1
  192. package/build/types/carbonbox/shared/domain/value-objects/StakeholderReferences.d.ts +46 -2
  193. package/build/types/carbonbox/shared/domain/value-objects/StakeholderReferences.d.ts.map +1 -1
  194. package/build/types/carbonbox/shared/domain/value-objects/String.d.ts +3 -1
  195. package/build/types/carbonbox/shared/domain/value-objects/String.d.ts.map +1 -1
  196. package/build/types/carbonbox/shared/domain/value-objects/StringList.d.ts +7 -1
  197. package/build/types/carbonbox/shared/domain/value-objects/StringList.d.ts.map +1 -1
  198. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentification.d.ts +41 -3
  199. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentification.d.ts.map +1 -1
  200. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumber.d.ts +4 -4
  201. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumber.d.ts.map +1 -1
  202. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumberList.d.ts +16 -4
  203. package/build/types/carbonbox/shared/domain/value-objects/TaxIdentificationNumberList.d.ts.map +1 -1
  204. package/build/types/carbonbox/shared/domain/value-objects/Url.d.ts +2 -1
  205. package/build/types/carbonbox/shared/domain/value-objects/Url.d.ts.map +1 -1
  206. package/build/types/carbonbox/shared/domain/value-objects/UrlList.d.ts +18 -2
  207. package/build/types/carbonbox/shared/domain/value-objects/UrlList.d.ts.map +1 -1
  208. package/build/types/carbonbox/shared/domain/value-objects/UserBusinessStatus.d.ts +4 -2
  209. package/build/types/carbonbox/shared/domain/value-objects/UserBusinessStatus.d.ts.map +1 -1
  210. package/build/types/carbonbox/shared/domain/value-objects/UserEmail.d.ts +10 -1
  211. package/build/types/carbonbox/shared/domain/value-objects/UserEmail.d.ts.map +1 -1
  212. package/build/types/carbonbox/shared/domain/value-objects/UserPassword.d.ts +7 -3
  213. package/build/types/carbonbox/shared/domain/value-objects/UserPassword.d.ts.map +1 -1
  214. package/build/types/carbonbox/shared/domain/value-objects/UserPermissions.d.ts +11 -3
  215. package/build/types/carbonbox/shared/domain/value-objects/UserPermissions.d.ts.map +1 -1
  216. package/build/types/carbonbox/shared/domain/value-objects/UserType.d.ts +4 -2
  217. package/build/types/carbonbox/shared/domain/value-objects/UserType.d.ts.map +1 -1
  218. package/build/types/carbonbox/shared/domain/value-objects/ValueObject.d.ts +2 -0
  219. package/build/types/carbonbox/shared/domain/value-objects/ValueObject.d.ts.map +1 -1
  220. package/package.json +1 -1
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _StakeholderReference_instances, _a, _StakeholderReference_id, _StakeholderReference_displayName, _StakeholderReference_taxIdentification, _StakeholderReference_roleType, _StakeholderReference_guardAgainstInvalidType, _StakeholderReference_guardAgainstInvalidId, _StakeholderReference_valueIsInvalid, _StakeholderReference_taxIdentificationIsInvalid, _StakeholderReference_guardAgainstInvalidDisplayName, _StakeholderReference_guardAgainstInvalidTaxIdentification, _StakeholderReference_taxIdentificationIsNull, _StakeholderReference_guardAgainstInvalidRoleType, _StakeholderReference_roleTypeIsEmpty, _StakeholderReference_roleTypeIsNotValid, _StakeholderReference_parseDate, _StakeholderReference_otherIsNotStakeholderReference, _StakeholderReference_hasSameIdentifier;
13
+ var _StakeholderReference_id, _StakeholderReference_displayName, _StakeholderReference_taxIdentification, _StakeholderReference_roleType;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.StakeholderReference = void 0;
16
16
  const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
@@ -26,15 +26,14 @@ class StakeholderReference extends ObjectValueObject_1.ObjectValueObject {
26
26
  * Constructor protegido para que solo clases hijas puedan instanciar.
27
27
  * Aplica todas las validaciones de dominio al momento de construcción.
28
28
  */
29
- constructor(value, skipDomainValidation, propertyName = _a.DEFAULT_PROPERTY_NAME) {
29
+ constructor(value, skipDomainValidation, propertyName = StakeholderReference.DEFAULT_PROPERTY_NAME) {
30
30
  super(value, skipDomainValidation, propertyName, 'The provided value must be of type StakeholderReference from the domain layer', { allowNull: false, allowUndefined: false });
31
- _StakeholderReference_instances.add(this);
32
31
  _StakeholderReference_id.set(this, void 0);
33
32
  _StakeholderReference_displayName.set(this, void 0);
34
33
  _StakeholderReference_taxIdentification.set(this, void 0);
35
34
  _StakeholderReference_roleType.set(this, void 0);
36
35
  if (skipDomainValidation === false) {
37
- _a.validateStakeholderReference(value, propertyName);
36
+ StakeholderReference.validateStakeholderReference(value, propertyName);
38
37
  }
39
38
  __classPrivateFieldSet(this, _StakeholderReference_id, value.id.trim(), "f");
40
39
  __classPrivateFieldSet(this, _StakeholderReference_displayName, value.displayName.trim(), "f");
@@ -45,11 +44,99 @@ class StakeholderReference extends ObjectValueObject_1.ObjectValueObject {
45
44
  * Validación estática para reutilización en factory methods y constructores.
46
45
  */
47
46
  static validateStakeholderReference(value, propertyName) {
48
- __classPrivateFieldGet(this, _a, "m", _StakeholderReference_guardAgainstInvalidType).call(this, value, propertyName);
49
- __classPrivateFieldGet(this, _a, "m", _StakeholderReference_guardAgainstInvalidId).call(this, value.id);
50
- __classPrivateFieldGet(this, _a, "m", _StakeholderReference_guardAgainstInvalidDisplayName).call(this, value.displayName);
51
- __classPrivateFieldGet(this, _a, "m", _StakeholderReference_guardAgainstInvalidTaxIdentification).call(this, value.taxIdentification);
52
- __classPrivateFieldGet(this, _a, "m", _StakeholderReference_guardAgainstInvalidRoleType).call(this, value.roleType);
47
+ this.guardAgainstInvalidType(value, propertyName);
48
+ this.guardAgainstInvalidId(value.id);
49
+ this.guardAgainstInvalidDisplayName(value.displayName);
50
+ this.guardAgainstInvalidTaxIdentification(value.taxIdentification);
51
+ this.guardAgainstInvalidRoleType(value.roleType);
52
+ }
53
+ /**
54
+ * Valida que el objeto tenga la estructura correcta.
55
+ */
56
+ static guardAgainstInvalidType(value, propertyName) {
57
+ if (this.valueIsInvalid(value)) {
58
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'StakeholderReference object', typeof value);
59
+ }
60
+ if (typeof value.id !== 'string') {
61
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
62
+ }
63
+ if (typeof value.displayName !== 'string') {
64
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('displayName', 'string', typeof value.displayName);
65
+ }
66
+ if (this.taxIdentificationIsInvalid(value.taxIdentification)) {
67
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('taxIdentification', 'TaxIdentification object', typeof value.taxIdentification);
68
+ }
69
+ if (typeof value.roleType !== 'string') {
70
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('roleType', 'string', typeof value.roleType);
71
+ }
72
+ }
73
+ static guardAgainstInvalidId(id) {
74
+ String_1.String.guardAgainstEmptyValue(id, 'id');
75
+ AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
76
+ }
77
+ /**
78
+ * Valida si el valor principal es inválido.
79
+ */
80
+ static valueIsInvalid(value) {
81
+ return value === null || value === undefined || typeof value !== 'object';
82
+ }
83
+ /**
84
+ * Valida si la identificación tributaria es inválida.
85
+ */
86
+ static taxIdentificationIsInvalid(taxIdentification) {
87
+ return taxIdentification === null || taxIdentification === undefined || typeof taxIdentification !== 'object';
88
+ }
89
+ /**
90
+ * Valida el nombre para mostrar.
91
+ */
92
+ static guardAgainstInvalidDisplayName(displayName) {
93
+ String_1.String.guardAgainstEmptyValue(displayName, 'displayName');
94
+ if (displayName.trim().length === 0) {
95
+ throw EmptyDisplayNameError_1.EmptyDisplayNameError.create('displayName');
96
+ }
97
+ if (displayName.trim().length > 255) {
98
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('displayName', 'string with maximum 255 characters', `string with ${displayName.trim().length} characters`);
99
+ }
100
+ }
101
+ /**
102
+ * Valida la identificación tributaria usando las validaciones del VO TaxIdentification.
103
+ */
104
+ static guardAgainstInvalidTaxIdentification(taxIdentification) {
105
+ if (this.taxIdentificationIsNull(taxIdentification)) {
106
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('taxIdentification', 'TaxIdentification object', 'null or undefined');
107
+ }
108
+ // Usar las validaciones completas del VO TaxIdentification
109
+ TaxIdentification_1.TaxIdentification.validateCompletely(taxIdentification, 'taxIdentification');
110
+ }
111
+ /**
112
+ * Verifica si la identificación tributaria es null o undefined.
113
+ */
114
+ static taxIdentificationIsNull(taxIdentification) {
115
+ return taxIdentification === null || taxIdentification === undefined;
116
+ }
117
+ /**
118
+ * Valida el tipo de rol del stakeholder.
119
+ */
120
+ static guardAgainstInvalidRoleType(roleType) {
121
+ if (this.roleTypeIsEmpty(roleType)) {
122
+ throw InvalidStakeholderRoleTypeError_1.InvalidStakeholderRoleTypeError.create('empty role type', this.VALID_ROLE_TYPES);
123
+ }
124
+ const trimmedRoleType = roleType.trim().toUpperCase();
125
+ if (this.roleTypeIsNotValid(trimmedRoleType)) {
126
+ throw InvalidStakeholderRoleTypeError_1.InvalidStakeholderRoleTypeError.create(trimmedRoleType, this.VALID_ROLE_TYPES);
127
+ }
128
+ }
129
+ /**
130
+ * Verifica si el tipo de rol está vacío.
131
+ */
132
+ static roleTypeIsEmpty(roleType) {
133
+ return roleType === null || roleType === undefined || roleType.trim().length === 0;
134
+ }
135
+ /**
136
+ * Verifica si el tipo de rol no es válido.
137
+ */
138
+ static roleTypeIsNotValid(trimmedRoleType) {
139
+ return this.VALID_ROLE_TYPES.includes(trimmedRoleType) === false;
53
140
  }
54
141
  get id() {
55
142
  return __classPrivateFieldGet(this, _StakeholderReference_id, "f");
@@ -130,19 +217,26 @@ class StakeholderReference extends ObjectValueObject_1.ObjectValueObject {
130
217
  const now = new Date();
131
218
  const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
132
219
  if (__classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").validFrom) {
133
- const fromDate = __classPrivateFieldGet(this, _StakeholderReference_instances, "m", _StakeholderReference_parseDate).call(this, __classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").validFrom);
220
+ const fromDate = this.parseDate(__classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").validFrom);
134
221
  if (today < fromDate) {
135
222
  return false;
136
223
  }
137
224
  }
138
225
  if (__classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").validUntil) {
139
- const untilDate = __classPrivateFieldGet(this, _StakeholderReference_instances, "m", _StakeholderReference_parseDate).call(this, __classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").validUntil);
226
+ const untilDate = this.parseDate(__classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").validUntil);
140
227
  if (today > untilDate) {
141
228
  return false;
142
229
  }
143
230
  }
144
231
  return true;
145
232
  }
233
+ /**
234
+ * Método auxiliar para parsear fechas en formato DD/MM/YYYY.
235
+ */
236
+ parseDate(dateString) {
237
+ const [day, month, year] = dateString.split('/').map(Number);
238
+ return new Date(year, month - 1, day);
239
+ }
146
240
  /**
147
241
  * Verifica si pertenece a un país específico.
148
242
  */
@@ -165,21 +259,35 @@ class StakeholderReference extends ObjectValueObject_1.ObjectValueObject {
165
259
  const role = __classPrivateFieldGet(this, _StakeholderReference_roleType, "f").replace('CARBON_', '').toLowerCase();
166
260
  return `${__classPrivateFieldGet(this, _StakeholderReference_displayName, "f")} - ${role} from ${country} (${taxType})`;
167
261
  }
262
+ /**
263
+ * Verifica si el otro objeto no es una instancia de StakeholderReference.
264
+ */
265
+ otherIsNotStakeholderReference(other) {
266
+ return (other instanceof StakeholderReference) === false;
267
+ }
168
268
  /**
169
269
  * Compara si dos stakeholders representan la misma entidad
170
270
  * independientemente del rol o nombre.
171
271
  */
172
272
  hasSameIdentity(other) {
173
- if (__classPrivateFieldGet(this, _StakeholderReference_instances, "m", _StakeholderReference_otherIsNotStakeholderReference).call(this, other)) {
273
+ if (this.otherIsNotStakeholderReference(other)) {
174
274
  return false;
175
275
  }
176
- return __classPrivateFieldGet(this, _StakeholderReference_instances, "m", _StakeholderReference_hasSameIdentifier).call(this, __classPrivateFieldGet(other, _StakeholderReference_taxIdentification, "f"));
276
+ return this.hasSameIdentifier(__classPrivateFieldGet(other, _StakeholderReference_taxIdentification, "f"));
277
+ }
278
+ /**
279
+ * Compara si dos identificaciones tributarias representan el mismo identificador.
280
+ */
281
+ hasSameIdentifier(other) {
282
+ return (__classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").type === other.type
283
+ && __classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").number === other.number
284
+ && __classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").country === other.country);
177
285
  }
178
286
  /**
179
287
  * Compara si dos stakeholders tienen el mismo rol.
180
288
  */
181
289
  hasSameRole(other) {
182
- if (__classPrivateFieldGet(this, _StakeholderReference_instances, "m", _StakeholderReference_otherIsNotStakeholderReference).call(this, other)) {
290
+ if (this.otherIsNotStakeholderReference(other)) {
183
291
  return false;
184
292
  }
185
293
  return __classPrivateFieldGet(this, _StakeholderReference_roleType, "f") === __classPrivateFieldGet(other, _StakeholderReference_roleType, "f");
@@ -222,67 +330,7 @@ class StakeholderReference extends ObjectValueObject_1.ObjectValueObject {
222
330
  }
223
331
  }
224
332
  exports.StakeholderReference = StakeholderReference;
225
- _a = StakeholderReference, _StakeholderReference_id = new WeakMap(), _StakeholderReference_displayName = new WeakMap(), _StakeholderReference_taxIdentification = new WeakMap(), _StakeholderReference_roleType = new WeakMap(), _StakeholderReference_instances = new WeakSet(), _StakeholderReference_guardAgainstInvalidType = function _StakeholderReference_guardAgainstInvalidType(value, propertyName) {
226
- if (__classPrivateFieldGet(this, _a, "m", _StakeholderReference_valueIsInvalid).call(this, value)) {
227
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'StakeholderReference object', typeof value);
228
- }
229
- if (typeof value.id !== 'string') {
230
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
231
- }
232
- if (typeof value.displayName !== 'string') {
233
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('displayName', 'string', typeof value.displayName);
234
- }
235
- if (__classPrivateFieldGet(this, _a, "m", _StakeholderReference_taxIdentificationIsInvalid).call(this, value.taxIdentification)) {
236
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('taxIdentification', 'TaxIdentification object', typeof value.taxIdentification);
237
- }
238
- if (typeof value.roleType !== 'string') {
239
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('roleType', 'string', typeof value.roleType);
240
- }
241
- }, _StakeholderReference_guardAgainstInvalidId = function _StakeholderReference_guardAgainstInvalidId(id) {
242
- String_1.String.guardAgainstEmptyValue(id, 'id');
243
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
244
- }, _StakeholderReference_valueIsInvalid = function _StakeholderReference_valueIsInvalid(value) {
245
- return value === null || value === undefined || typeof value !== 'object';
246
- }, _StakeholderReference_taxIdentificationIsInvalid = function _StakeholderReference_taxIdentificationIsInvalid(taxIdentification) {
247
- return taxIdentification === null || taxIdentification === undefined || typeof taxIdentification !== 'object';
248
- }, _StakeholderReference_guardAgainstInvalidDisplayName = function _StakeholderReference_guardAgainstInvalidDisplayName(displayName) {
249
- String_1.String.guardAgainstEmptyValue(displayName, 'displayName');
250
- if (displayName.trim().length === 0) {
251
- throw EmptyDisplayNameError_1.EmptyDisplayNameError.create('displayName');
252
- }
253
- if (displayName.trim().length > 255) {
254
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('displayName', 'string with maximum 255 characters', `string with ${displayName.trim().length} characters`);
255
- }
256
- }, _StakeholderReference_guardAgainstInvalidTaxIdentification = function _StakeholderReference_guardAgainstInvalidTaxIdentification(taxIdentification) {
257
- if (__classPrivateFieldGet(this, _a, "m", _StakeholderReference_taxIdentificationIsNull).call(this, taxIdentification)) {
258
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('taxIdentification', 'TaxIdentification object', 'null or undefined');
259
- }
260
- // Usar las validaciones completas del VO TaxIdentification
261
- TaxIdentification_1.TaxIdentification.validateCompletely(taxIdentification, 'taxIdentification');
262
- }, _StakeholderReference_taxIdentificationIsNull = function _StakeholderReference_taxIdentificationIsNull(taxIdentification) {
263
- return taxIdentification === null || taxIdentification === undefined;
264
- }, _StakeholderReference_guardAgainstInvalidRoleType = function _StakeholderReference_guardAgainstInvalidRoleType(roleType) {
265
- if (__classPrivateFieldGet(this, _a, "m", _StakeholderReference_roleTypeIsEmpty).call(this, roleType)) {
266
- throw InvalidStakeholderRoleTypeError_1.InvalidStakeholderRoleTypeError.create('empty role type', this.VALID_ROLE_TYPES);
267
- }
268
- const trimmedRoleType = roleType.trim().toUpperCase();
269
- if (__classPrivateFieldGet(this, _a, "m", _StakeholderReference_roleTypeIsNotValid).call(this, trimmedRoleType)) {
270
- throw InvalidStakeholderRoleTypeError_1.InvalidStakeholderRoleTypeError.create(trimmedRoleType, this.VALID_ROLE_TYPES);
271
- }
272
- }, _StakeholderReference_roleTypeIsEmpty = function _StakeholderReference_roleTypeIsEmpty(roleType) {
273
- return roleType === null || roleType === undefined || roleType.trim().length === 0;
274
- }, _StakeholderReference_roleTypeIsNotValid = function _StakeholderReference_roleTypeIsNotValid(trimmedRoleType) {
275
- return this.VALID_ROLE_TYPES.includes(trimmedRoleType) === false;
276
- }, _StakeholderReference_parseDate = function _StakeholderReference_parseDate(dateString) {
277
- const [day, month, year] = dateString.split('/').map(Number);
278
- return new Date(year, month - 1, day);
279
- }, _StakeholderReference_otherIsNotStakeholderReference = function _StakeholderReference_otherIsNotStakeholderReference(other) {
280
- return (other instanceof _a) === false;
281
- }, _StakeholderReference_hasSameIdentifier = function _StakeholderReference_hasSameIdentifier(other) {
282
- return (__classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").type === other.type
283
- && __classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").number === other.number
284
- && __classPrivateFieldGet(this, _StakeholderReference_taxIdentification, "f").country === other.country);
285
- };
333
+ _StakeholderReference_id = new WeakMap(), _StakeholderReference_displayName = new WeakMap(), _StakeholderReference_taxIdentification = new WeakMap(), _StakeholderReference_roleType = new WeakMap();
286
334
  StakeholderReference.DEFAULT_PROPERTY_NAME = 'stakeholderReference';
287
335
  // Roles válidos desde el enum
288
336
  StakeholderReference.VALID_ROLE_TYPES = Object.values(StakeholderRole_1.StakeholderRole);
@@ -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 _StakeholderReferences_instances, _a, _StakeholderReferences_stakeholderReferences, _StakeholderReferences_options, _StakeholderReferences_guardAgainstInvalidArrayType, _StakeholderReferences_guardAgainstInvalidEmptyArray, _StakeholderReferences_guardAgainstDuplicateStakeholderIds, _StakeholderReferences_guardAgainstDuplicateStakeholderTaxIdentifications, _StakeholderReferences_guardAgainstInvalidStakeholderReference, _StakeholderReferences_guardAgainstInvalidStakeholderStructure, _StakeholderReferences_guardAgainstInvalidId, _StakeholderReferences_guardAgainstInvalidDisplayName, _StakeholderReferences_guardAgainstInvalidRoleType, _StakeholderReferences_stakeholderReferencesAreEqual, _StakeholderReferences_taxIdentificationsAreEqual;
13
+ var _StakeholderReferences_stakeholderReferences, _StakeholderReferences_options;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.StakeholderReferences = void 0;
16
16
  const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
@@ -25,14 +25,13 @@ class StakeholderReferences extends ValueObject_1.ValueObject {
25
25
  * Constructor protegido para que solo clases hijas puedan instanciar.
26
26
  * Aplica todas las validaciones de dominio al momento de construcción.
27
27
  */
28
- constructor(value, skipDomainValidation, propertyName = _a.DEFAULT_PROPERTY_NAME, options = _a.DEFAULT_OPTIONS) {
28
+ constructor(value, skipDomainValidation, propertyName = StakeholderReferences.DEFAULT_PROPERTY_NAME, options = StakeholderReferences.DEFAULT_OPTIONS) {
29
29
  super(value, skipDomainValidation, propertyName, 'The provided value must be of type StakeholderReference[] from the domain layer', { allowNull: false, allowUndefined: false });
30
- _StakeholderReferences_instances.add(this);
31
30
  _StakeholderReferences_stakeholderReferences.set(this, void 0);
32
31
  _StakeholderReferences_options.set(this, void 0);
33
- const finalOptions = { ..._a.DEFAULT_OPTIONS, ...options };
32
+ const finalOptions = { ...StakeholderReferences.DEFAULT_OPTIONS, ...options };
34
33
  if (skipDomainValidation === false) {
35
- _a.validateStakeholderReferences(value, finalOptions, propertyName);
34
+ StakeholderReferences.validateStakeholderReferences(value, finalOptions, propertyName);
36
35
  }
37
36
  __classPrivateFieldSet(this, _StakeholderReferences_stakeholderReferences, [...value], "f"); // Create defensive copy
38
37
  __classPrivateFieldSet(this, _StakeholderReferences_options, finalOptions, "f");
@@ -41,14 +40,104 @@ class StakeholderReferences extends ValueObject_1.ValueObject {
41
40
  * Validación estática para reutilización en factory methods y constructores.
42
41
  */
43
42
  static validateStakeholderReferences(value, options, propertyName) {
44
- __classPrivateFieldGet(this, _a, "m", _StakeholderReferences_guardAgainstInvalidArrayType).call(this, value, propertyName);
45
- __classPrivateFieldGet(this, _a, "m", _StakeholderReferences_guardAgainstInvalidEmptyArray).call(this, value, options, propertyName);
46
- __classPrivateFieldGet(this, _a, "m", _StakeholderReferences_guardAgainstDuplicateStakeholderIds).call(this, value, propertyName);
47
- __classPrivateFieldGet(this, _a, "m", _StakeholderReferences_guardAgainstDuplicateStakeholderTaxIdentifications).call(this, value, propertyName);
43
+ this.guardAgainstInvalidArrayType(value, propertyName);
44
+ this.guardAgainstInvalidEmptyArray(value, options, propertyName);
45
+ this.guardAgainstDuplicateStakeholderIds(value, propertyName);
46
+ this.guardAgainstDuplicateStakeholderTaxIdentifications(value, propertyName);
48
47
  value.forEach((stakeholderReference, index) => {
49
- __classPrivateFieldGet(this, _a, "m", _StakeholderReferences_guardAgainstInvalidStakeholderReference).call(this, stakeholderReference, index, propertyName);
48
+ this.guardAgainstInvalidStakeholderReference(stakeholderReference, index, propertyName);
50
49
  });
51
50
  }
51
+ /**
52
+ * Valida que el valor sea un array.
53
+ */
54
+ static guardAgainstInvalidArrayType(value, propertyName) {
55
+ if (!Array.isArray(value)) {
56
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array', typeof value);
57
+ }
58
+ }
59
+ /**
60
+ * Valida que el array no esté vacío si no se permite.
61
+ */
62
+ static guardAgainstInvalidEmptyArray(value, options, propertyName) {
63
+ if (!options.allowEmpty && value.length === 0) {
64
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty array', 'empty array');
65
+ }
66
+ }
67
+ /**
68
+ * Valida que no haya IDs duplicados.
69
+ */
70
+ static guardAgainstDuplicateStakeholderIds(value, propertyName) {
71
+ const ids = value.map((stakeholder) => stakeholder.id.trim());
72
+ const uniqueIds = new Set(ids);
73
+ if (ids.length !== uniqueIds.size) {
74
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.id`, 'unique stakeholder IDs', 'array with duplicated IDs');
75
+ }
76
+ }
77
+ /**
78
+ * Valida que no haya identificaciones tributarias duplicadas.
79
+ */
80
+ static guardAgainstDuplicateStakeholderTaxIdentifications(value, propertyName) {
81
+ const taxIdentifications = value.map((stakeholder) => `${stakeholder.taxIdentification.type}-${stakeholder.taxIdentification.number}-${stakeholder.taxIdentification.country}`);
82
+ const uniqueIds = new Set(taxIdentifications);
83
+ if (taxIdentifications.length !== uniqueIds.size) {
84
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.taxIdentification`, 'unique tax identifications', 'duplicate tax identifications found');
85
+ }
86
+ }
87
+ /**
88
+ * Valida una referencia de stakeholder individual.
89
+ */
90
+ static guardAgainstInvalidStakeholderReference(stakeholderReference, index, basePropertyName) {
91
+ const propertyName = `${basePropertyName}[${index}]`;
92
+ this.guardAgainstInvalidStakeholderStructure(stakeholderReference, propertyName);
93
+ this.guardAgainstInvalidId(stakeholderReference.id, `${propertyName}.id`);
94
+ this.guardAgainstInvalidDisplayName(stakeholderReference.displayName, `${propertyName}.displayName`);
95
+ this.guardAgainstInvalidRoleType(stakeholderReference.roleType, `${propertyName}.roleType`);
96
+ // Validar usando el VO StakeholderReference para aprovechar sus validaciones
97
+ StakeholderReference_1.StakeholderReference.validateCompletely(stakeholderReference, propertyName);
98
+ }
99
+ /**
100
+ * Valida que el objeto de referencia de stakeholder tenga la estructura correcta.
101
+ */
102
+ static guardAgainstInvalidStakeholderStructure(stakeholderReference, propertyName) {
103
+ if (!stakeholderReference || typeof stakeholderReference !== 'object') {
104
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'StakeholderReference object', typeof stakeholderReference);
105
+ }
106
+ if (typeof stakeholderReference.id !== 'string') {
107
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof stakeholderReference.id);
108
+ }
109
+ if (typeof stakeholderReference.displayName !== 'string') {
110
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.displayName`, 'string', typeof stakeholderReference.displayName);
111
+ }
112
+ if (!stakeholderReference.taxIdentification || typeof stakeholderReference.taxIdentification !== 'object') {
113
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.taxIdentification`, 'TaxIdentification object', typeof stakeholderReference.taxIdentification);
114
+ }
115
+ if (typeof stakeholderReference.roleType !== 'string') {
116
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.roleType`, 'string', typeof stakeholderReference.roleType);
117
+ }
118
+ }
119
+ /**
120
+ * Valida el ID del stakeholder.
121
+ */
122
+ static guardAgainstInvalidId(id, propertyName) {
123
+ String_1.String.guardAgainstEmptyValue(id, propertyName);
124
+ AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
125
+ }
126
+ /**
127
+ * Valida el nombre para mostrar.
128
+ */
129
+ static guardAgainstInvalidDisplayName(displayName, propertyName) {
130
+ String_1.String.guardAgainstEmptyValue(displayName, propertyName);
131
+ }
132
+ /**
133
+ * Valida que el rol sea uno de los roles válidos de stakeholder.
134
+ */
135
+ static guardAgainstInvalidRoleType(roleType, propertyName) {
136
+ const validRoles = Object.values(StakeholderRole_1.StakeholderRole);
137
+ if (!validRoles.includes(roleType)) {
138
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, `one of: ${validRoles.join(', ')}`, roleType);
139
+ }
140
+ }
52
141
  /**
53
142
  * Referencias de stakeholders (inmutable).
54
143
  */
@@ -319,7 +408,7 @@ class StakeholderReferences extends ValueObject_1.ValueObject {
319
408
  * Compara la igualdad semántica con otra colección de referencias de stakeholder.
320
409
  */
321
410
  equals(other) {
322
- if (!(other instanceof _a)) {
411
+ if (!(other instanceof StakeholderReferences)) {
323
412
  return false;
324
413
  }
325
414
  if (__classPrivateFieldGet(this, _StakeholderReferences_options, "f").allowEmpty !== __classPrivateFieldGet(other, _StakeholderReferences_options, "f").allowEmpty) {
@@ -330,9 +419,28 @@ class StakeholderReferences extends ValueObject_1.ValueObject {
330
419
  }
331
420
  return __classPrivateFieldGet(this, _StakeholderReferences_stakeholderReferences, "f").every((stakeholder, index) => {
332
421
  const otherStakeholder = __classPrivateFieldGet(other, _StakeholderReferences_stakeholderReferences, "f")[index];
333
- return __classPrivateFieldGet(this, _StakeholderReferences_instances, "m", _StakeholderReferences_stakeholderReferencesAreEqual).call(this, stakeholder, otherStakeholder);
422
+ return this.stakeholderReferencesAreEqual(stakeholder, otherStakeholder);
334
423
  });
335
424
  }
425
+ /**
426
+ * Compara si dos referencias de stakeholder son iguales.
427
+ */
428
+ stakeholderReferencesAreEqual(stakeholder1, stakeholder2) {
429
+ return (stakeholder1.displayName === stakeholder2.displayName
430
+ && stakeholder1.roleType === stakeholder2.roleType
431
+ && this.taxIdentificationsAreEqual(stakeholder1.taxIdentification, stakeholder2.taxIdentification));
432
+ }
433
+ /**
434
+ * Compara si dos identificaciones tributarias son iguales.
435
+ */
436
+ taxIdentificationsAreEqual(tax1, tax2) {
437
+ return (tax1.type === tax2.type
438
+ && tax1.number === tax2.number
439
+ && tax1.country === tax2.country
440
+ && tax1.issuedBy === tax2.issuedBy
441
+ && tax1.validFrom === tax2.validFrom
442
+ && tax1.validUntil === tax2.validUntil);
443
+ }
336
444
  /**
337
445
  * Genera un hash code para usar en colecciones.
338
446
  */
@@ -370,10 +478,10 @@ class StakeholderReferences extends ValueObject_1.ValueObject {
370
478
  /**
371
479
  * Método estático para validar si un array es válido.
372
480
  */
373
- static isValidStakeholderReferences(value, options = _a.DEFAULT_OPTIONS) {
481
+ static isValidStakeholderReferences(value, options = StakeholderReferences.DEFAULT_OPTIONS) {
374
482
  try {
375
- const finalOptions = { ..._a.DEFAULT_OPTIONS, ...options };
376
- _a.validateStakeholderReferences(value, finalOptions, 'test');
483
+ const finalOptions = { ...StakeholderReferences.DEFAULT_OPTIONS, ...options };
484
+ StakeholderReferences.validateStakeholderReferences(value, finalOptions, 'test');
377
485
  return true;
378
486
  }
379
487
  catch {
@@ -382,72 +490,7 @@ class StakeholderReferences extends ValueObject_1.ValueObject {
382
490
  }
383
491
  }
384
492
  exports.StakeholderReferences = StakeholderReferences;
385
- _a = StakeholderReferences, _StakeholderReferences_stakeholderReferences = new WeakMap(), _StakeholderReferences_options = new WeakMap(), _StakeholderReferences_instances = new WeakSet(), _StakeholderReferences_guardAgainstInvalidArrayType = function _StakeholderReferences_guardAgainstInvalidArrayType(value, propertyName) {
386
- if (!Array.isArray(value)) {
387
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array', typeof value);
388
- }
389
- }, _StakeholderReferences_guardAgainstInvalidEmptyArray = function _StakeholderReferences_guardAgainstInvalidEmptyArray(value, options, propertyName) {
390
- if (!options.allowEmpty && value.length === 0) {
391
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty array', 'empty array');
392
- }
393
- }, _StakeholderReferences_guardAgainstDuplicateStakeholderIds = function _StakeholderReferences_guardAgainstDuplicateStakeholderIds(value, propertyName) {
394
- const ids = value.map((stakeholder) => stakeholder.id.trim());
395
- const uniqueIds = new Set(ids);
396
- if (ids.length !== uniqueIds.size) {
397
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.id`, 'unique stakeholder IDs', 'array with duplicated IDs');
398
- }
399
- }, _StakeholderReferences_guardAgainstDuplicateStakeholderTaxIdentifications = function _StakeholderReferences_guardAgainstDuplicateStakeholderTaxIdentifications(value, propertyName) {
400
- const taxIdentifications = value.map((stakeholder) => `${stakeholder.taxIdentification.type}-${stakeholder.taxIdentification.number}-${stakeholder.taxIdentification.country}`);
401
- const uniqueIds = new Set(taxIdentifications);
402
- if (taxIdentifications.length !== uniqueIds.size) {
403
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.taxIdentification`, 'unique tax identifications', 'duplicate tax identifications found');
404
- }
405
- }, _StakeholderReferences_guardAgainstInvalidStakeholderReference = function _StakeholderReferences_guardAgainstInvalidStakeholderReference(stakeholderReference, index, basePropertyName) {
406
- const propertyName = `${basePropertyName}[${index}]`;
407
- __classPrivateFieldGet(this, _a, "m", _StakeholderReferences_guardAgainstInvalidStakeholderStructure).call(this, stakeholderReference, propertyName);
408
- __classPrivateFieldGet(this, _a, "m", _StakeholderReferences_guardAgainstInvalidId).call(this, stakeholderReference.id, `${propertyName}.id`);
409
- __classPrivateFieldGet(this, _a, "m", _StakeholderReferences_guardAgainstInvalidDisplayName).call(this, stakeholderReference.displayName, `${propertyName}.displayName`);
410
- __classPrivateFieldGet(this, _a, "m", _StakeholderReferences_guardAgainstInvalidRoleType).call(this, stakeholderReference.roleType, `${propertyName}.roleType`);
411
- // Validar usando el VO StakeholderReference para aprovechar sus validaciones
412
- StakeholderReference_1.StakeholderReference.validateCompletely(stakeholderReference, propertyName);
413
- }, _StakeholderReferences_guardAgainstInvalidStakeholderStructure = function _StakeholderReferences_guardAgainstInvalidStakeholderStructure(stakeholderReference, propertyName) {
414
- if (!stakeholderReference || typeof stakeholderReference !== 'object') {
415
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'StakeholderReference object', typeof stakeholderReference);
416
- }
417
- if (typeof stakeholderReference.id !== 'string') {
418
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof stakeholderReference.id);
419
- }
420
- if (typeof stakeholderReference.displayName !== 'string') {
421
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.displayName`, 'string', typeof stakeholderReference.displayName);
422
- }
423
- if (!stakeholderReference.taxIdentification || typeof stakeholderReference.taxIdentification !== 'object') {
424
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.taxIdentification`, 'TaxIdentification object', typeof stakeholderReference.taxIdentification);
425
- }
426
- if (typeof stakeholderReference.roleType !== 'string') {
427
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.roleType`, 'string', typeof stakeholderReference.roleType);
428
- }
429
- }, _StakeholderReferences_guardAgainstInvalidId = function _StakeholderReferences_guardAgainstInvalidId(id, propertyName) {
430
- String_1.String.guardAgainstEmptyValue(id, propertyName);
431
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
432
- }, _StakeholderReferences_guardAgainstInvalidDisplayName = function _StakeholderReferences_guardAgainstInvalidDisplayName(displayName, propertyName) {
433
- String_1.String.guardAgainstEmptyValue(displayName, propertyName);
434
- }, _StakeholderReferences_guardAgainstInvalidRoleType = function _StakeholderReferences_guardAgainstInvalidRoleType(roleType, propertyName) {
435
- const validRoles = Object.values(StakeholderRole_1.StakeholderRole);
436
- if (!validRoles.includes(roleType)) {
437
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, `one of: ${validRoles.join(', ')}`, roleType);
438
- }
439
- }, _StakeholderReferences_stakeholderReferencesAreEqual = function _StakeholderReferences_stakeholderReferencesAreEqual(stakeholder1, stakeholder2) {
440
- return (stakeholder1.displayName === stakeholder2.displayName
441
- && stakeholder1.roleType === stakeholder2.roleType
442
- && __classPrivateFieldGet(this, _StakeholderReferences_instances, "m", _StakeholderReferences_taxIdentificationsAreEqual).call(this, stakeholder1.taxIdentification, stakeholder2.taxIdentification));
443
- }, _StakeholderReferences_taxIdentificationsAreEqual = function _StakeholderReferences_taxIdentificationsAreEqual(tax1, tax2) {
444
- return (tax1.type === tax2.type
445
- && tax1.number === tax2.number
446
- && tax1.country === tax2.country
447
- && tax1.issuedBy === tax2.issuedBy
448
- && tax1.validFrom === tax2.validFrom
449
- && tax1.validUntil === tax2.validUntil);
450
- };
493
+ _StakeholderReferences_stakeholderReferences = new WeakMap(), _StakeholderReferences_options = new WeakMap();
451
494
  StakeholderReferences.DEFAULT_PROPERTY_NAME = 'stakeholderReferences';
452
495
  StakeholderReferences.DEFAULT_OPTIONS = {
453
496
  allowEmpty: true,
@@ -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, _String_typeIsInvalid, _String_typeIsValid, _String_valueIsEmpty;
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.String = void 0;
10
4
  const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
@@ -13,26 +7,28 @@ class String extends PrimitiveValueObject_1.PrimitiveValueObject {
13
7
  constructor(value, skipDomainValidation, propertyName) {
14
8
  super(value, skipDomainValidation, propertyName, 'The provided value must be of type string from the domain layer');
15
9
  if (skipDomainValidation === false) {
16
- _a.guardAgainstInvalidType(value, propertyName);
10
+ String.guardAgainstInvalidType(value, propertyName);
17
11
  }
18
12
  }
19
13
  static guardAgainstInvalidType(value, propertyName) {
20
- if (__classPrivateFieldGet(this, _a, "m", _String_typeIsInvalid).call(this, value)) {
14
+ if (this.typeIsInvalid(value)) {
21
15
  throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'string', typeof value);
22
16
  }
23
17
  }
24
18
  static guardAgainstEmptyValue(value, propertyName) {
25
- _a.guardAgainstInvalidType(value, propertyName);
26
- if (__classPrivateFieldGet(this, _a, "m", _String_valueIsEmpty).call(this, value)) {
19
+ String.guardAgainstInvalidType(value, propertyName);
20
+ if (this.valueIsEmpty(value)) {
27
21
  throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'non-empty string', 'empty string');
28
22
  }
29
23
  }
24
+ static typeIsInvalid(value) {
25
+ return this.typeIsValid(value) === false;
26
+ }
27
+ static typeIsValid(value) {
28
+ return typeof value === 'string';
29
+ }
30
+ static valueIsEmpty(value) {
31
+ return value.trim().length === 0;
32
+ }
30
33
  }
31
34
  exports.String = String;
32
- _a = String, _String_typeIsInvalid = function _String_typeIsInvalid(value) {
33
- return __classPrivateFieldGet(this, _a, "m", _String_typeIsValid).call(this, value) === false;
34
- }, _String_typeIsValid = function _String_typeIsValid(value) {
35
- return typeof value === 'string';
36
- }, _String_valueIsEmpty = function _String_valueIsEmpty(value) {
37
- return value.trim().length === 0;
38
- };