@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
@@ -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 _ProductCarbonFootprintSegmentConfigurationReferences_instances, _a, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, _ProductCarbonFootprintSegmentConfigurationReferences_options, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidArrayType, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmptyArray, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstDuplicateConfigurations, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfiguration, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfigurationStructure, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidId, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegment, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSubsegment, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegmentReference, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmissionSources, _ProductCarbonFootprintSegmentConfigurationReferences_configurationsAreEqual, _ProductCarbonFootprintSegmentConfigurationReferences_segmentReferencesAreEqual, _ProductCarbonFootprintSegmentConfigurationReferences_subsegmentReferencesAreEqual, _ProductCarbonFootprintSegmentConfigurationReferences_emissionSourcesAreEqual;
13
+ var _ProductCarbonFootprintSegmentConfigurationReferences_configurations, _ProductCarbonFootprintSegmentConfigurationReferences_options;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ProductCarbonFootprintSegmentConfigurationReferences = void 0;
16
16
  const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
@@ -25,14 +25,13 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
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 = ProductCarbonFootprintSegmentConfigurationReferences.DEFAULT_PROPERTY_NAME, options = ProductCarbonFootprintSegmentConfigurationReferences.DEFAULT_OPTIONS) {
29
29
  super(value, skipDomainValidation, propertyName, 'The provided value must be of type ProductCarbonFootprintSegmentConfigurationReference[] from the domain layer', { allowNull: false, allowUndefined: false });
30
- _ProductCarbonFootprintSegmentConfigurationReferences_instances.add(this);
31
30
  _ProductCarbonFootprintSegmentConfigurationReferences_configurations.set(this, void 0);
32
31
  _ProductCarbonFootprintSegmentConfigurationReferences_options.set(this, void 0);
33
- const finalOptions = { ..._a.DEFAULT_OPTIONS, ...options };
32
+ const finalOptions = { ...ProductCarbonFootprintSegmentConfigurationReferences.DEFAULT_OPTIONS, ...options };
34
33
  if (skipDomainValidation === false) {
35
- _a
34
+ ProductCarbonFootprintSegmentConfigurationReferences
36
35
  .validateConfigurations(value, propertyName, finalOptions);
37
36
  }
38
37
  __classPrivateFieldSet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, [...value], "f"); // Create defensive copy
@@ -42,13 +41,138 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
42
41
  * Validación estática para reutilización en factory methods y constructores.
43
42
  */
44
43
  static validateConfigurations(value, propertyName, options) {
45
- __classPrivateFieldGet(this, _a, "m", _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidArrayType).call(this, value, propertyName);
46
- __classPrivateFieldGet(this, _a, "m", _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmptyArray).call(this, value, options, propertyName);
47
- __classPrivateFieldGet(this, _a, "m", _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstDuplicateConfigurations).call(this, value, propertyName);
44
+ this.guardAgainstInvalidArrayType(value, propertyName);
45
+ this.guardAgainstInvalidEmptyArray(value, options, propertyName);
46
+ this.guardAgainstDuplicateConfigurations(value, propertyName);
48
47
  value.forEach((configuration, index) => {
49
- __classPrivateFieldGet(this, _a, "m", _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfiguration).call(this, configuration, index, propertyName);
48
+ this.guardAgainstInvalidConfiguration(configuration, 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 combinaciones duplicadas de segmento y subsegmento.
69
+ */
70
+ static guardAgainstDuplicateConfigurations(value, propertyName) {
71
+ const ids = value.map((config) => config.id.trim());
72
+ const uniqueIds = new Set(ids);
73
+ if (ids.length !== uniqueIds.size) {
74
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.ids`, 'unique configuration IDs', 'array with duplicated IDs');
75
+ }
76
+ }
77
+ /**
78
+ * Valida una configuración individual.
79
+ */
80
+ static guardAgainstInvalidConfiguration(configuration, index, basePropertyName) {
81
+ const propertyName = `${basePropertyName}[${index}]`;
82
+ this.guardAgainstInvalidConfigurationStructure(configuration, propertyName);
83
+ this.guardAgainstInvalidId(configuration.id, `${propertyName}.id`);
84
+ this.guardAgainstInvalidSegment(configuration.segment, `${propertyName}.segment`);
85
+ this.guardAgainstInvalidSubsegment(configuration.subsegment, `${propertyName}.subsegment`);
86
+ this.guardAgainstInvalidEmissionSources(configuration.emissionSources, `${propertyName}.emissionSources`);
87
+ }
88
+ /**
89
+ * Valida que el objeto de configuración tenga la estructura correcta.
90
+ */
91
+ static guardAgainstInvalidConfigurationStructure(configuration, propertyName) {
92
+ if (!configuration || typeof configuration !== 'object') {
93
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'ProductCarbonFootprintSegmentConfigurationReference object', typeof configuration);
94
+ }
95
+ if (typeof configuration.id !== 'string') {
96
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof configuration.id);
97
+ }
98
+ if (!configuration.segment || typeof configuration.segment !== 'object') {
99
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.segment`, 'ProductConfigurationCarbonFootprintSegmentReference object', typeof configuration.segment);
100
+ }
101
+ // subsegment puede ser null
102
+ if (configuration.subsegment !== null && (typeof configuration.subsegment !== 'object')) {
103
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.subsegment`, 'ProductConfigurationCarbonFootprintSubsegmentReference object or null', typeof configuration.subsegment);
104
+ }
105
+ if (!Array.isArray(configuration.emissionSources)) {
106
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.emissionSources`, 'array of EmissionSource enum values', typeof configuration.emissionSources);
107
+ }
108
+ }
109
+ /**
110
+ * Valida el ID de la configuración.
111
+ */
112
+ static guardAgainstInvalidId(id, propertyName) {
113
+ String_1.String.guardAgainstEmptyValue(id, propertyName);
114
+ AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
115
+ }
116
+ /**
117
+ * Valida la referencia de segmento.
118
+ */
119
+ static guardAgainstInvalidSegment(segment, propertyName) {
120
+ this.guardAgainstInvalidSegmentReference(segment, propertyName, 'ProductConfigurationCarbonFootprintSegmentReference');
121
+ }
122
+ /**
123
+ * Valida la referencia de subsegmento (puede ser null).
124
+ */
125
+ static guardAgainstInvalidSubsegment(subsegment, propertyName) {
126
+ if (subsegment !== null) {
127
+ this.guardAgainstInvalidSegmentReference(subsegment, propertyName, 'ProductConfigurationCarbonFootprintSubsegmentReference');
128
+ }
129
+ }
130
+ /**
131
+ * Valida una referencia de segmento genérica.
132
+ */
133
+ static guardAgainstInvalidSegmentReference(reference, propertyName, typeName) {
134
+ if (!reference || typeof reference !== 'object') {
135
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, `${typeName} object`, typeof reference);
136
+ }
137
+ if (typeof reference.id !== 'string') {
138
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof reference.id);
139
+ }
140
+ if (typeof reference.code !== 'string') {
141
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.code`, 'string', typeof reference.code);
142
+ }
143
+ if (typeof reference.name !== 'string') {
144
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof reference.name);
145
+ }
146
+ String_1.String.guardAgainstEmptyValue(reference.id, `${propertyName}.id`);
147
+ AggregateId_1.AggregateId.guardAgainstInvalidId(reference.id, `${propertyName}.id`);
148
+ String_1.String.guardAgainstEmptyValue(reference.code, `${propertyName}.code`);
149
+ Code_1.Code.guardAgainstInvalidCode(reference.code);
150
+ String_1.String.guardAgainstEmptyValue(reference.name, `${propertyName}.name`);
151
+ }
152
+ /**
153
+ * Valida el array de fuentes de emisión.
154
+ */
155
+ static guardAgainstInvalidEmissionSources(emissionSources, propertyName) {
156
+ if (!Array.isArray(emissionSources)) {
157
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array of EmissionSource enum values', typeof emissionSources);
158
+ }
159
+ if (emissionSources.length === 0) {
160
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty array of emission sources', 'empty array');
161
+ }
162
+ emissionSources.forEach((source, index) => {
163
+ if (typeof source !== 'string') {
164
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}[${index}]`, 'EmissionSource enum value', typeof source);
165
+ }
166
+ if (!Object.values(EmissionSource_1.EmissionSource).includes(source)) {
167
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}[${index}]`, `valid EmissionSource enum value (${Object.values(EmissionSource_1.EmissionSource).join(', ')})`, source);
168
+ }
169
+ });
170
+ // Verificar que no haya duplicados
171
+ const uniqueSources = new Set(emissionSources);
172
+ if (emissionSources.length !== uniqueSources.size) {
173
+ throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'array with unique emission sources', 'array with duplicated sources');
174
+ }
175
+ }
52
176
  /**
53
177
  * Configuraciones de segmento de producto (inmutable).
54
178
  */
@@ -282,7 +406,7 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
282
406
  * Compara la igualdad semántica con otra colección de configuraciones.
283
407
  */
284
408
  equals(other) {
285
- if (!(other instanceof _a)) {
409
+ if (!(other instanceof ProductCarbonFootprintSegmentConfigurationReferences)) {
286
410
  return false;
287
411
  }
288
412
  if (__classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_options, "f").allowEmpty !== __classPrivateFieldGet(other, _ProductCarbonFootprintSegmentConfigurationReferences_options, "f").allowEmpty) {
@@ -293,9 +417,46 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
293
417
  }
294
418
  return __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f").every((config, index) => {
295
419
  const otherConfig = __classPrivateFieldGet(other, _ProductCarbonFootprintSegmentConfigurationReferences_configurations, "f")[index];
296
- return __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_instances, "m", _ProductCarbonFootprintSegmentConfigurationReferences_configurationsAreEqual).call(this, config, otherConfig);
420
+ return this.configurationsAreEqual(config, otherConfig);
297
421
  });
298
422
  }
423
+ /**
424
+ * Compara si dos configuraciones son iguales.
425
+ */
426
+ configurationsAreEqual(config1, config2) {
427
+ return (this.segmentReferencesAreEqual(config1.segment, config2.segment)
428
+ && this.subsegmentReferencesAreEqual(config1.subsegment, config2.subsegment)
429
+ && this.emissionSourcesAreEqual(config1.emissionSources, config2.emissionSources));
430
+ }
431
+ /**
432
+ * Compara referencias de segmento.
433
+ */
434
+ segmentReferencesAreEqual(segment1, segment2) {
435
+ return segment1.code === segment2.code && segment1.name === segment2.name;
436
+ }
437
+ /**
438
+ * Compara referencias de subsegmento (pueden ser null).
439
+ */
440
+ subsegmentReferencesAreEqual(subseg1, subseg2) {
441
+ if (subseg1 === null && subseg2 === null) {
442
+ return true;
443
+ }
444
+ if (subseg1 === null || subseg2 === null) {
445
+ return false;
446
+ }
447
+ return subseg1.code === subseg2.code && subseg1.name === subseg2.name;
448
+ }
449
+ /**
450
+ * Compara arrays de fuentes de emisión.
451
+ */
452
+ emissionSourcesAreEqual(sources1, sources2) {
453
+ if (sources1.length !== sources2.length) {
454
+ return false;
455
+ }
456
+ const sorted1 = [...sources1].sort();
457
+ const sorted2 = [...sources2].sort();
458
+ return sorted1.every((source, index) => source === sorted2[index]);
459
+ }
299
460
  /**
300
461
  * Genera un hash code para usar en colecciones.
301
462
  */
@@ -345,10 +506,10 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
345
506
  /**
346
507
  * Método estático para validar si un array es válido.
347
508
  */
348
- static isValidConfigurations(value, options = _a.DEFAULT_OPTIONS) {
509
+ static isValidConfigurations(value, options = ProductCarbonFootprintSegmentConfigurationReferences.DEFAULT_OPTIONS) {
349
510
  try {
350
- const finalOptions = { ..._a.DEFAULT_OPTIONS, ...options };
351
- _a.validateConfigurations(value, 'test', finalOptions);
511
+ const finalOptions = { ...ProductCarbonFootprintSegmentConfigurationReferences.DEFAULT_OPTIONS, ...options };
512
+ ProductCarbonFootprintSegmentConfigurationReferences.validateConfigurations(value, 'test', finalOptions);
352
513
  return true;
353
514
  }
354
515
  catch {
@@ -357,113 +518,7 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
357
518
  }
358
519
  }
359
520
  exports.ProductCarbonFootprintSegmentConfigurationReferences = ProductCarbonFootprintSegmentConfigurationReferences;
360
- _a = ProductCarbonFootprintSegmentConfigurationReferences, _ProductCarbonFootprintSegmentConfigurationReferences_configurations = new WeakMap(), _ProductCarbonFootprintSegmentConfigurationReferences_options = new WeakMap(), _ProductCarbonFootprintSegmentConfigurationReferences_instances = new WeakSet(), _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidArrayType = function _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidArrayType(value, propertyName) {
361
- if (!Array.isArray(value)) {
362
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array', typeof value);
363
- }
364
- }, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmptyArray = function _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmptyArray(value, options, propertyName) {
365
- if (!options.allowEmpty && value.length === 0) {
366
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty array', 'empty array');
367
- }
368
- }, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstDuplicateConfigurations = function _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstDuplicateConfigurations(value, propertyName) {
369
- const ids = value.map((config) => config.id.trim());
370
- const uniqueIds = new Set(ids);
371
- if (ids.length !== uniqueIds.size) {
372
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}.ids`, 'unique configuration IDs', 'array with duplicated IDs');
373
- }
374
- }, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfiguration = function _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfiguration(configuration, index, basePropertyName) {
375
- const propertyName = `${basePropertyName}[${index}]`;
376
- __classPrivateFieldGet(this, _a, "m", _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfigurationStructure).call(this, configuration, propertyName);
377
- __classPrivateFieldGet(this, _a, "m", _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidId).call(this, configuration.id, `${propertyName}.id`);
378
- __classPrivateFieldGet(this, _a, "m", _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegment).call(this, configuration.segment, `${propertyName}.segment`);
379
- __classPrivateFieldGet(this, _a, "m", _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSubsegment).call(this, configuration.subsegment, `${propertyName}.subsegment`);
380
- __classPrivateFieldGet(this, _a, "m", _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmissionSources).call(this, configuration.emissionSources, `${propertyName}.emissionSources`);
381
- }, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfigurationStructure = function _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidConfigurationStructure(configuration, propertyName) {
382
- if (!configuration || typeof configuration !== 'object') {
383
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'ProductCarbonFootprintSegmentConfigurationReference object', typeof configuration);
384
- }
385
- if (typeof configuration.id !== 'string') {
386
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof configuration.id);
387
- }
388
- if (!configuration.segment || typeof configuration.segment !== 'object') {
389
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.segment`, 'ProductConfigurationCarbonFootprintSegmentReference object', typeof configuration.segment);
390
- }
391
- // subsegment puede ser null
392
- if (configuration.subsegment !== null && (typeof configuration.subsegment !== 'object')) {
393
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.subsegment`, 'ProductConfigurationCarbonFootprintSubsegmentReference object or null', typeof configuration.subsegment);
394
- }
395
- if (!Array.isArray(configuration.emissionSources)) {
396
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.emissionSources`, 'array of EmissionSource enum values', typeof configuration.emissionSources);
397
- }
398
- }, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidId = function _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidId(id, propertyName) {
399
- String_1.String.guardAgainstEmptyValue(id, propertyName);
400
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
401
- }, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegment = function _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegment(segment, propertyName) {
402
- __classPrivateFieldGet(this, _a, "m", _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegmentReference).call(this, segment, propertyName, 'ProductConfigurationCarbonFootprintSegmentReference');
403
- }, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSubsegment = function _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSubsegment(subsegment, propertyName) {
404
- if (subsegment !== null) {
405
- __classPrivateFieldGet(this, _a, "m", _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegmentReference).call(this, subsegment, propertyName, 'ProductConfigurationCarbonFootprintSubsegmentReference');
406
- }
407
- }, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegmentReference = function _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidSegmentReference(reference, propertyName, typeName) {
408
- if (!reference || typeof reference !== 'object') {
409
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, `${typeName} object`, typeof reference);
410
- }
411
- if (typeof reference.id !== 'string') {
412
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.id`, 'string', typeof reference.id);
413
- }
414
- if (typeof reference.code !== 'string') {
415
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.code`, 'string', typeof reference.code);
416
- }
417
- if (typeof reference.name !== 'string') {
418
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof reference.name);
419
- }
420
- String_1.String.guardAgainstEmptyValue(reference.id, `${propertyName}.id`);
421
- AggregateId_1.AggregateId.guardAgainstInvalidId(reference.id, `${propertyName}.id`);
422
- String_1.String.guardAgainstEmptyValue(reference.code, `${propertyName}.code`);
423
- Code_1.Code.guardAgainstInvalidCode(reference.code);
424
- String_1.String.guardAgainstEmptyValue(reference.name, `${propertyName}.name`);
425
- }, _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmissionSources = function _ProductCarbonFootprintSegmentConfigurationReferences_guardAgainstInvalidEmissionSources(emissionSources, propertyName) {
426
- if (!Array.isArray(emissionSources)) {
427
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'array of EmissionSource enum values', typeof emissionSources);
428
- }
429
- if (emissionSources.length === 0) {
430
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'non-empty array of emission sources', 'empty array');
431
- }
432
- emissionSources.forEach((source, index) => {
433
- if (typeof source !== 'string') {
434
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}[${index}]`, 'EmissionSource enum value', typeof source);
435
- }
436
- if (!Object.values(EmissionSource_1.EmissionSource).includes(source)) {
437
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(`${propertyName}[${index}]`, `valid EmissionSource enum value (${Object.values(EmissionSource_1.EmissionSource).join(', ')})`, source);
438
- }
439
- });
440
- // Verificar que no haya duplicados
441
- const uniqueSources = new Set(emissionSources);
442
- if (emissionSources.length !== uniqueSources.size) {
443
- throw InvalidPropertyValueError_1.InvalidPropertyValueError.create(propertyName, 'array with unique emission sources', 'array with duplicated sources');
444
- }
445
- }, _ProductCarbonFootprintSegmentConfigurationReferences_configurationsAreEqual = function _ProductCarbonFootprintSegmentConfigurationReferences_configurationsAreEqual(config1, config2) {
446
- return (__classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_instances, "m", _ProductCarbonFootprintSegmentConfigurationReferences_segmentReferencesAreEqual).call(this, config1.segment, config2.segment)
447
- && __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_instances, "m", _ProductCarbonFootprintSegmentConfigurationReferences_subsegmentReferencesAreEqual).call(this, config1.subsegment, config2.subsegment)
448
- && __classPrivateFieldGet(this, _ProductCarbonFootprintSegmentConfigurationReferences_instances, "m", _ProductCarbonFootprintSegmentConfigurationReferences_emissionSourcesAreEqual).call(this, config1.emissionSources, config2.emissionSources));
449
- }, _ProductCarbonFootprintSegmentConfigurationReferences_segmentReferencesAreEqual = function _ProductCarbonFootprintSegmentConfigurationReferences_segmentReferencesAreEqual(segment1, segment2) {
450
- return segment1.code === segment2.code && segment1.name === segment2.name;
451
- }, _ProductCarbonFootprintSegmentConfigurationReferences_subsegmentReferencesAreEqual = function _ProductCarbonFootprintSegmentConfigurationReferences_subsegmentReferencesAreEqual(subseg1, subseg2) {
452
- if (subseg1 === null && subseg2 === null) {
453
- return true;
454
- }
455
- if (subseg1 === null || subseg2 === null) {
456
- return false;
457
- }
458
- return subseg1.code === subseg2.code && subseg1.name === subseg2.name;
459
- }, _ProductCarbonFootprintSegmentConfigurationReferences_emissionSourcesAreEqual = function _ProductCarbonFootprintSegmentConfigurationReferences_emissionSourcesAreEqual(sources1, sources2) {
460
- if (sources1.length !== sources2.length) {
461
- return false;
462
- }
463
- const sorted1 = [...sources1].sort();
464
- const sorted2 = [...sources2].sort();
465
- return sorted1.every((source, index) => source === sorted2[index]);
466
- };
521
+ _ProductCarbonFootprintSegmentConfigurationReferences_configurations = new WeakMap(), _ProductCarbonFootprintSegmentConfigurationReferences_options = new WeakMap();
467
522
  ProductCarbonFootprintSegmentConfigurationReferences.DEFAULT_PROPERTY_NAME = 'productSegmentConfigurationReferences';
468
523
  ProductCarbonFootprintSegmentConfigurationReferences.DEFAULT_OPTIONS = {
469
524
  allowEmpty: false, // Por defecto no permite estar vacío
@@ -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 _ProductConfigurationCarbonFootprintSegmentReference_instances, _a, _ProductConfigurationCarbonFootprintSegmentReference_id, _ProductConfigurationCarbonFootprintSegmentReference_code, _ProductConfigurationCarbonFootprintSegmentReference_name, _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidType, _ProductConfigurationCarbonFootprintSegmentReference_valueIsInvalid, _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidId, _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidSegmentCode, _ProductConfigurationCarbonFootprintSegmentReference_codeIsEmpty, _ProductConfigurationCarbonFootprintSegmentReference_codeLengthIsInvalid, _ProductConfigurationCarbonFootprintSegmentReference_codeFormatIsInvalid, _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidSegmentName, _ProductConfigurationCarbonFootprintSegmentReference_nameIsEmpty, _ProductConfigurationCarbonFootprintSegmentReference_nameLengthIsInvalid, _ProductConfigurationCarbonFootprintSegmentReference_otherIsNotProductConfigurationCarbonFootprintSegmentReference;
13
+ var _ProductConfigurationCarbonFootprintSegmentReference_id, _ProductConfigurationCarbonFootprintSegmentReference_code, _ProductConfigurationCarbonFootprintSegmentReference_name;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ProductConfigurationCarbonFootprintSegmentReference = void 0;
16
16
  const InvalidPropertyTypeError_1 = require("../exceptions/InvalidPropertyTypeError");
@@ -23,14 +23,13 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
23
23
  * Constructor protegido para que solo clases hijas puedan instanciar.
24
24
  * Aplica todas las validaciones de dominio al momento de construcción.
25
25
  */
26
- constructor(value, skipDomainValidation, propertyName = _a.DEFAULT_PROPERTY_NAME) {
26
+ constructor(value, skipDomainValidation, propertyName = ProductConfigurationCarbonFootprintSegmentReference.DEFAULT_PROPERTY_NAME) {
27
27
  super(value, skipDomainValidation, propertyName, 'The provided value must be of type ProductConfigurationCarbonFootprintSegmentReference from the domain layer', { allowNull: false, allowUndefined: false });
28
- _ProductConfigurationCarbonFootprintSegmentReference_instances.add(this);
29
28
  _ProductConfigurationCarbonFootprintSegmentReference_id.set(this, void 0);
30
29
  _ProductConfigurationCarbonFootprintSegmentReference_code.set(this, void 0);
31
30
  _ProductConfigurationCarbonFootprintSegmentReference_name.set(this, void 0);
32
31
  if (skipDomainValidation === false) {
33
- _a
32
+ ProductConfigurationCarbonFootprintSegmentReference
34
33
  .validateProductConfigurationCarbonFootprintSegmentReference(value, propertyName);
35
34
  }
36
35
  __classPrivateFieldSet(this, _ProductConfigurationCarbonFootprintSegmentReference_id, value.id.trim(), "f");
@@ -41,10 +40,94 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
41
40
  * Validación estática para reutilización en factory methods y constructores.
42
41
  */
43
42
  static validateProductConfigurationCarbonFootprintSegmentReference(value, propertyName) {
44
- __classPrivateFieldGet(this, _a, "m", _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidType).call(this, value, propertyName);
45
- __classPrivateFieldGet(this, _a, "m", _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidId).call(this, value.id);
46
- __classPrivateFieldGet(this, _a, "m", _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidSegmentCode).call(this, value.code);
47
- __classPrivateFieldGet(this, _a, "m", _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidSegmentName).call(this, value.name);
43
+ this.guardAgainstInvalidType(value, propertyName);
44
+ this.guardAgainstInvalidId(value.id);
45
+ this.guardAgainstInvalidSegmentCode(value.code);
46
+ this.guardAgainstInvalidSegmentName(value.name);
47
+ }
48
+ /**
49
+ * Valida que el objeto tenga la estructura correcta.
50
+ */
51
+ static guardAgainstInvalidType(value, propertyName) {
52
+ if (this.valueIsInvalid(value)) {
53
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'ProductConfigurationCarbonFootprintSegmentReference object', typeof value);
54
+ }
55
+ if (typeof value.id !== 'string') {
56
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
57
+ }
58
+ if (typeof value.code !== 'string') {
59
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'string', typeof value.code);
60
+ }
61
+ if (typeof value.name !== 'string') {
62
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'string', typeof value.name);
63
+ }
64
+ }
65
+ /**
66
+ * Valida si el valor principal es inválido.
67
+ */
68
+ static valueIsInvalid(value) {
69
+ return value === null || value === undefined || typeof value !== 'object';
70
+ }
71
+ static guardAgainstInvalidId(id) {
72
+ String_1.String.guardAgainstEmptyValue(id, 'id');
73
+ AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
74
+ }
75
+ /**
76
+ * Valida el código del segmento de producto.
77
+ */
78
+ static guardAgainstInvalidSegmentCode(code) {
79
+ String_1.String.guardAgainstEmptyValue(code, 'code');
80
+ Code_1.Code.guardAgainstInvalidCode(code);
81
+ if (this.codeIsEmpty(code)) {
82
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'non-empty string', 'empty string');
83
+ }
84
+ const trimmedCode = code.trim().toUpperCase();
85
+ if (this.codeLengthIsInvalid(trimmedCode)) {
86
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', `string with length between ${this.MIN_CODE_LENGTH} and ${this.MAX_CODE_LENGTH} characters`, `string with ${trimmedCode.length} characters`);
87
+ }
88
+ this.codeFormatIsInvalid(trimmedCode, 'code');
89
+ }
90
+ /**
91
+ * Verifica si el código de segmento está vacío.
92
+ */
93
+ static codeIsEmpty(code) {
94
+ return code.trim().length === 0;
95
+ }
96
+ /**
97
+ * Verifica si la longitud del código de segmento es inválida.
98
+ */
99
+ static codeLengthIsInvalid(trimmedCode) {
100
+ return trimmedCode.length < this.MIN_CODE_LENGTH || trimmedCode.length > this.MAX_CODE_LENGTH;
101
+ }
102
+ /**
103
+ * Verifica si el formato del código de segmento es inválido.
104
+ */
105
+ static codeFormatIsInvalid(trimmedCode, propertyName) {
106
+ Code_1.Code.guardAgainstInvalidCode(trimmedCode, propertyName);
107
+ }
108
+ /**
109
+ * Valida el nombre del segmento de producto.
110
+ */
111
+ static guardAgainstInvalidSegmentName(name) {
112
+ String_1.String.guardAgainstEmptyValue(name, 'name');
113
+ if (this.nameIsEmpty(name)) {
114
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'non-empty string', 'empty string');
115
+ }
116
+ if (this.nameLengthIsInvalid(name)) {
117
+ throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', `string with maximum ${this.MAX_NAME_LENGTH} characters`, `string with ${name.trim().length} characters`);
118
+ }
119
+ }
120
+ /**
121
+ * Verifica si el nombre de segmento está vacío.
122
+ */
123
+ static nameIsEmpty(name) {
124
+ return name.trim().length === 0;
125
+ }
126
+ /**
127
+ * Verifica si la longitud del nombre de segmento es inválida.
128
+ */
129
+ static nameLengthIsInvalid(name) {
130
+ return name.trim().length > this.MAX_NAME_LENGTH;
48
131
  }
49
132
  get id() {
50
133
  return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_id, "f");
@@ -126,18 +209,24 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
126
209
  * Compara la igualdad semántica con otro objeto ProductConfigurationCarbonFootprintSegmentReference.
127
210
  */
128
211
  equals(other) {
129
- if (__classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_instances, "m", _ProductConfigurationCarbonFootprintSegmentReference_otherIsNotProductConfigurationCarbonFootprintSegmentReference).call(this, other)) {
212
+ if (this.otherIsNotProductConfigurationCarbonFootprintSegmentReference(other)) {
130
213
  return false;
131
214
  }
132
215
  return (__classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_id, "f") === __classPrivateFieldGet(other, _ProductConfigurationCarbonFootprintSegmentReference_id, "f")
133
216
  && __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_code, "f") === __classPrivateFieldGet(other, _ProductConfigurationCarbonFootprintSegmentReference_code, "f")
134
217
  && __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f") === __classPrivateFieldGet(other, _ProductConfigurationCarbonFootprintSegmentReference_name, "f"));
135
218
  }
219
+ /**
220
+ * Verifica si el otro objeto no es una instancia de ProductConfigurationCarbonFootprintSegmentReference.
221
+ */
222
+ otherIsNotProductConfigurationCarbonFootprintSegmentReference(other) {
223
+ return (other instanceof ProductConfigurationCarbonFootprintSegmentReference) === false;
224
+ }
136
225
  /**
137
226
  * Compara si dos segmentos tienen el mismo código.
138
227
  */
139
228
  hasSameCode(other) {
140
- if (__classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_instances, "m", _ProductConfigurationCarbonFootprintSegmentReference_otherIsNotProductConfigurationCarbonFootprintSegmentReference).call(this, other)) {
229
+ if (this.otherIsNotProductConfigurationCarbonFootprintSegmentReference(other)) {
141
230
  return false;
142
231
  }
143
232
  return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_code, "f") === __classPrivateFieldGet(other, _ProductConfigurationCarbonFootprintSegmentReference_code, "f");
@@ -146,7 +235,7 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
146
235
  * Compara si dos segmentos tienen el mismo nombre.
147
236
  */
148
237
  hasSameName(other) {
149
- if (__classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_instances, "m", _ProductConfigurationCarbonFootprintSegmentReference_otherIsNotProductConfigurationCarbonFootprintSegmentReference).call(this, other)) {
238
+ if (this.otherIsNotProductConfigurationCarbonFootprintSegmentReference(other)) {
150
239
  return false;
151
240
  }
152
241
  return __classPrivateFieldGet(this, _ProductConfigurationCarbonFootprintSegmentReference_name, "f") === __classPrivateFieldGet(other, _ProductConfigurationCarbonFootprintSegmentReference_name, "f");
@@ -187,56 +276,7 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
187
276
  }
188
277
  }
189
278
  exports.ProductConfigurationCarbonFootprintSegmentReference = ProductConfigurationCarbonFootprintSegmentReference;
190
- _a = ProductConfigurationCarbonFootprintSegmentReference, _ProductConfigurationCarbonFootprintSegmentReference_id = new WeakMap(), _ProductConfigurationCarbonFootprintSegmentReference_code = new WeakMap(), _ProductConfigurationCarbonFootprintSegmentReference_name = new WeakMap(), _ProductConfigurationCarbonFootprintSegmentReference_instances = new WeakSet(), _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidType = function _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidType(value, propertyName) {
191
- if (__classPrivateFieldGet(this, _a, "m", _ProductConfigurationCarbonFootprintSegmentReference_valueIsInvalid).call(this, value)) {
192
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(propertyName, 'ProductConfigurationCarbonFootprintSegmentReference object', typeof value);
193
- }
194
- if (typeof value.id !== 'string') {
195
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('id', 'string', typeof value.id);
196
- }
197
- if (typeof value.code !== 'string') {
198
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'string', typeof value.code);
199
- }
200
- if (typeof value.name !== 'string') {
201
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'string', typeof value.name);
202
- }
203
- }, _ProductConfigurationCarbonFootprintSegmentReference_valueIsInvalid = function _ProductConfigurationCarbonFootprintSegmentReference_valueIsInvalid(value) {
204
- return value === null || value === undefined || typeof value !== 'object';
205
- }, _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidId = function _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidId(id) {
206
- String_1.String.guardAgainstEmptyValue(id, 'id');
207
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
208
- }, _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidSegmentCode = function _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidSegmentCode(code) {
209
- String_1.String.guardAgainstEmptyValue(code, 'code');
210
- Code_1.Code.guardAgainstInvalidCode(code);
211
- if (__classPrivateFieldGet(this, _a, "m", _ProductConfigurationCarbonFootprintSegmentReference_codeIsEmpty).call(this, code)) {
212
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', 'non-empty string', 'empty string');
213
- }
214
- const trimmedCode = code.trim().toUpperCase();
215
- if (__classPrivateFieldGet(this, _a, "m", _ProductConfigurationCarbonFootprintSegmentReference_codeLengthIsInvalid).call(this, trimmedCode)) {
216
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('code', `string with length between ${this.MIN_CODE_LENGTH} and ${this.MAX_CODE_LENGTH} characters`, `string with ${trimmedCode.length} characters`);
217
- }
218
- __classPrivateFieldGet(this, _a, "m", _ProductConfigurationCarbonFootprintSegmentReference_codeFormatIsInvalid).call(this, trimmedCode, 'code');
219
- }, _ProductConfigurationCarbonFootprintSegmentReference_codeIsEmpty = function _ProductConfigurationCarbonFootprintSegmentReference_codeIsEmpty(code) {
220
- return code.trim().length === 0;
221
- }, _ProductConfigurationCarbonFootprintSegmentReference_codeLengthIsInvalid = function _ProductConfigurationCarbonFootprintSegmentReference_codeLengthIsInvalid(trimmedCode) {
222
- return trimmedCode.length < this.MIN_CODE_LENGTH || trimmedCode.length > this.MAX_CODE_LENGTH;
223
- }, _ProductConfigurationCarbonFootprintSegmentReference_codeFormatIsInvalid = function _ProductConfigurationCarbonFootprintSegmentReference_codeFormatIsInvalid(trimmedCode, propertyName) {
224
- Code_1.Code.guardAgainstInvalidCode(trimmedCode, propertyName);
225
- }, _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidSegmentName = function _ProductConfigurationCarbonFootprintSegmentReference_guardAgainstInvalidSegmentName(name) {
226
- String_1.String.guardAgainstEmptyValue(name, 'name');
227
- if (__classPrivateFieldGet(this, _a, "m", _ProductConfigurationCarbonFootprintSegmentReference_nameIsEmpty).call(this, name)) {
228
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', 'non-empty string', 'empty string');
229
- }
230
- if (__classPrivateFieldGet(this, _a, "m", _ProductConfigurationCarbonFootprintSegmentReference_nameLengthIsInvalid).call(this, name)) {
231
- throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create('name', `string with maximum ${this.MAX_NAME_LENGTH} characters`, `string with ${name.trim().length} characters`);
232
- }
233
- }, _ProductConfigurationCarbonFootprintSegmentReference_nameIsEmpty = function _ProductConfigurationCarbonFootprintSegmentReference_nameIsEmpty(name) {
234
- return name.trim().length === 0;
235
- }, _ProductConfigurationCarbonFootprintSegmentReference_nameLengthIsInvalid = function _ProductConfigurationCarbonFootprintSegmentReference_nameLengthIsInvalid(name) {
236
- return name.trim().length > this.MAX_NAME_LENGTH;
237
- }, _ProductConfigurationCarbonFootprintSegmentReference_otherIsNotProductConfigurationCarbonFootprintSegmentReference = function _ProductConfigurationCarbonFootprintSegmentReference_otherIsNotProductConfigurationCarbonFootprintSegmentReference(other) {
238
- return (other instanceof _a) === false;
239
- };
279
+ _ProductConfigurationCarbonFootprintSegmentReference_id = new WeakMap(), _ProductConfigurationCarbonFootprintSegmentReference_code = new WeakMap(), _ProductConfigurationCarbonFootprintSegmentReference_name = new WeakMap();
240
280
  ProductConfigurationCarbonFootprintSegmentReference.DEFAULT_PROPERTY_NAME = 'productSegmentReference';
241
281
  // Longitud mínima y máxima para el código de segmento
242
282
  ProductConfigurationCarbonFootprintSegmentReference.MIN_CODE_LENGTH = 2;