@carbonbox/domain 0.4.10 → 0.4.12

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 (158) hide show
  1. package/build/carbonbox/activity-data-collection/activity-data-submissions/domain/value-objects/ActivityDataSubmissionId.js +1 -1
  2. package/build/carbonbox/activity-data-collection/collection-fields/domain/value-objects/CollectionFieldId.js +1 -1
  3. package/build/carbonbox/activity-data-collection/conditional-logic/domain/value-objects/ConditionalFieldRuleId.js +1 -1
  4. package/build/carbonbox/activity-data-collection/contextual-labels/domain/value-objects/ContextualLabelId.js +1 -1
  5. package/build/carbonbox/activity-data-collection/dynamic-forms/domain/value-objects/DynamicFormId.js +1 -1
  6. package/build/carbonbox/activity-data-collection/stakeholder-adaptations/domain/value-objects/StakeholderAdaptationId.js +1 -1
  7. package/build/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationId.js +1 -1
  8. package/build/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/segments/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentId.js +1 -1
  9. package/build/carbonbox/carbon-footprint-configurations/corporate-configurations/corporate-segment-configurations/segments/subsegments/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentId.js +1 -1
  10. package/build/carbonbox/carbon-footprint-configurations/corporate-configurations/domain/value-objects/CorporateCarbonFootprintConfigurationId.js +1 -1
  11. package/build/carbonbox/carbon-footprint-configurations/event-configurations/domain/value-objects/EventCarbonFootprintConfigurationId.js +1 -1
  12. package/build/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/domain/value-objects/EventEditionLifecycleStageConfigurationId.js +1 -1
  13. package/build/carbonbox/carbon-footprint-configurations/event-configurations/event-edition-lifecycle-stage-configurations/event-edition-lifecycle-stages/domain/value-objects/EventEditionLifecycleStageId.js +1 -1
  14. package/build/carbonbox/carbon-footprint-configurations/product-configurations/domain/value-objects/ProductCarbonFootprintConfigurationId.js +1 -1
  15. package/build/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/domain/value-objects/ProductCarbonFootprintSegmentConfigurationId.js +1 -1
  16. package/build/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/segments/domain/value-objects/ProductConfigurationCarbonFootprintSegmentId.js +1 -1
  17. package/build/carbonbox/carbon-footprint-configurations/product-configurations/product-segment-configurations/segments/subsegments/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentId.js +1 -1
  18. package/build/carbonbox/carbon-footprint-configurations/product-configurations/system-boundaries/domain/value-objects/ProductConfigurationSystemBoundaryId.js +1 -1
  19. package/build/carbonbox/carbon-footprint-configurations/shared/domain/value-objects/CarbonFootprintConfigurationId.js +1 -1
  20. package/build/carbonbox/carbon-footprint-configurations/shared/domain/value-objects/CarbonFootprintConfigurationIntensityIndicatorConfigurations.js +1 -1
  21. package/build/carbonbox/carbon-footprint-configurations/shared/domain/value-objects/CarbonFootprintIntensityIndicatorId.js +1 -1
  22. package/build/carbonbox/carbon-footprint-configurations/shared/domain/value-objects/CarbonFootprintSegmentId.js +1 -1
  23. package/build/carbonbox/carbon-footprint-configurations/shared/domain/value-objects/CarbonFootprintSubsegmentId.js +1 -1
  24. package/build/carbonbox/company-resources/events/domain/value-objects/EventId.js +1 -1
  25. package/build/carbonbox/company-resources/events/editions/domain/value-objects/EventEditionId.js +1 -1
  26. package/build/carbonbox/company-resources/facilities/domain/value-objects/FacilityId.js +1 -1
  27. package/build/carbonbox/company-resources/products/domain/value-objects/ProductId.js +1 -1
  28. package/build/carbonbox/emission-calculation-formulas/calculation-variables/domain/value-objects/CalculationVariableActivityDataConditions.js +1 -1
  29. package/build/carbonbox/emission-calculation-formulas/calculation-variables/domain/value-objects/CalculationVariableId.js +1 -1
  30. package/build/carbonbox/emission-calculation-formulas/domain/value-objects/EmissionCalculationFormulaId.js +1 -1
  31. package/build/carbonbox/emission-calculation-formulas/emission-factors/domain/value-objects/EmissionFactorId.js +1 -1
  32. package/build/carbonbox/emission-calculation-formulas/global-warming-potentials/domain/value-objects/GlobalWarmingPotentialId.js +1 -1
  33. package/build/carbonbox/emission-calculation-process/calculation-jobs/domain/value-objects/CalculationJobId.js +1 -1
  34. package/build/carbonbox/emission-calculation-process/calculation-processes/domain/value-objects/CalculationProcessId.js +1 -1
  35. package/build/carbonbox/emission-calculation-process/calculation-workflows/domain/value-objects/CalculationWorkflowId.js +1 -1
  36. package/build/carbonbox/emission-calculation-process/calculation-workflows/domain/value-objects/CalculationWorkflowParallelJobs.js +1 -1
  37. package/build/carbonbox/emission-calculation-results/emission-aggregations/domain/value-objects/EmissionAggregationId.js +1 -1
  38. package/build/carbonbox/emission-calculation-results/emission-calculations/domain/value-objects/EmissionCalculationId.js +1 -1
  39. package/build/carbonbox/emission-calculation-results/ghg-emission-results/domain/value-objects/GHGEmissionResultId.js +1 -1
  40. package/build/carbonbox/purchase-management-system/purchase-contracts/domain/value-objects/PurchaseContractCarbonClientId.js +1 -1
  41. package/build/carbonbox/purchase-management-system/purchase-contracts/domain/value-objects/PurchaseContractContractAmendments.js +1 -1
  42. package/build/carbonbox/purchase-management-system/purchase-contracts/domain/value-objects/PurchaseContractId.js +1 -1
  43. package/build/carbonbox/purchase-management-system/purchase-orders/domain/value-objects/PurchaseOrderCarbonClientId.js +1 -1
  44. package/build/carbonbox/purchase-management-system/purchase-orders/domain/value-objects/PurchaseOrderId.js +1 -1
  45. package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceCatalogId.js +1 -1
  46. package/build/carbonbox/purchase-management-system/service-pricing/domain/value-objects/ServicePricingId.js +1 -1
  47. package/build/carbonbox/shared/domain/authorization/value-objects/SecurityContext.js +1 -1
  48. package/build/carbonbox/shared/domain/enums/SemanticUuidPrefix.js +65 -0
  49. package/build/carbonbox/shared/domain/exceptions/InvalidSemanticUuidError.js +19 -0
  50. package/build/carbonbox/shared/domain/exceptions/InvalidSemanticUuidFormatError.js +19 -0
  51. package/build/carbonbox/shared/domain/exceptions/InvalidUserIdFormatError.js +19 -0
  52. package/build/carbonbox/shared/domain/exceptions/InvalidUserPrefixError.js +19 -0
  53. package/build/carbonbox/shared/domain/exceptions/InvalidUuidFormatError.js +19 -0
  54. package/build/carbonbox/shared/domain/exceptions/UnknownBoundedContextCodeError.js +19 -0
  55. package/build/carbonbox/shared/domain/services/contracts/ISemanticUuidDomainService.js +2 -0
  56. package/build/carbonbox/shared/domain/services/implementations/SemanticUuidDomainService.js +235 -0
  57. package/build/carbonbox/shared/domain/types/UserEmailProps.js +2 -0
  58. package/build/carbonbox/shared/domain/types/UserPropsWithHashedPassword.js +2 -0
  59. package/build/carbonbox/shared/domain/value-objects/ActivityDataSubmissionReference.js +1 -1
  60. package/build/carbonbox/shared/domain/value-objects/AggregateId.js +105 -10
  61. package/build/carbonbox/shared/domain/value-objects/AggregateIdList.js +1 -1
  62. package/build/carbonbox/shared/domain/value-objects/CalculationProcessReference.js +3 -3
  63. package/build/carbonbox/shared/domain/value-objects/CalculationVariableReferences.js +1 -1
  64. package/build/carbonbox/shared/domain/value-objects/CarbonClientReference.js +1 -1
  65. package/build/carbonbox/shared/domain/value-objects/CarbonFootprintConfigurationReference.js +1 -1
  66. package/build/carbonbox/shared/domain/value-objects/CarbonFootprintIntensityIndicatorReference.js +1 -1
  67. package/build/carbonbox/shared/domain/value-objects/CarbonFootprintSegmentReferences.js +1 -1
  68. package/build/carbonbox/shared/domain/value-objects/CollectionFieldReference.js +1 -1
  69. package/build/carbonbox/shared/domain/value-objects/CorporateCarbonFootprintSegmentConfigurationReferences.js +2 -2
  70. package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSegmentReference.js +1 -1
  71. package/build/carbonbox/shared/domain/value-objects/CorporateConfigurationCarbonFootprintSubsegmentReference.js +1 -1
  72. package/build/carbonbox/shared/domain/value-objects/EmissionCalculationFormulaReference.js +1 -1
  73. package/build/carbonbox/shared/domain/value-objects/EmissionCalculationReference.js +1 -1
  74. package/build/carbonbox/shared/domain/value-objects/EmissionFactorReference.js +1 -1
  75. package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReference.js +1 -1
  76. package/build/carbonbox/shared/domain/value-objects/EventEditionConfigurationCarbonFootprintSubsegmentReferences.js +1 -1
  77. package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageConfigurationReferences.js +2 -2
  78. package/build/carbonbox/shared/domain/value-objects/EventEditionLifecycleStageReference.js +1 -1
  79. package/build/carbonbox/shared/domain/value-objects/EventEditionReference.js +1 -1
  80. package/build/carbonbox/shared/domain/value-objects/EventEditionReferences.js +1 -1
  81. package/build/carbonbox/shared/domain/value-objects/EventReference.js +1 -1
  82. package/build/carbonbox/shared/domain/value-objects/FacilityReference.js +1 -1
  83. package/build/carbonbox/shared/domain/value-objects/GlobalWarmingPotentialReference.js +1 -1
  84. package/build/carbonbox/shared/domain/value-objects/NullableCorporateConfigurationCarbonFootprintSubsegmentReference.js +1 -1
  85. package/build/carbonbox/shared/domain/value-objects/NullableEventEditionConfigurationCarbonFootprintSubsegmentReference.js +1 -1
  86. package/build/carbonbox/shared/domain/value-objects/NullableProductConfigurationCarbonFootprintSubsegmentReference.js +1 -1
  87. package/build/carbonbox/shared/domain/value-objects/ProductCarbonFootprintSegmentConfigurationReferences.js +2 -2
  88. package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSegmentReference.js +1 -1
  89. package/build/carbonbox/shared/domain/value-objects/ProductConfigurationCarbonFootprintSubsegmentReference.js +1 -1
  90. package/build/carbonbox/shared/domain/value-objects/ProductConfigurationSystemBoundaryReference.js +1 -1
  91. package/build/carbonbox/shared/domain/value-objects/ProductReference.js +1 -1
  92. package/build/carbonbox/shared/domain/value-objects/ServiceCatalogReference.js +1 -1
  93. package/build/carbonbox/shared/domain/value-objects/StakeholderReference.js +1 -1
  94. package/build/carbonbox/shared/domain/value-objects/StakeholderReferences.js +1 -1
  95. package/build/carbonbox/shared/domain/value-objects/UserId.js +129 -1
  96. package/build/carbonbox/stakeholders/carbon-clients/domain/entity/CarbonClient.js +50 -2
  97. package/build/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPropsWithHashedPassword.js +2 -0
  98. package/build/carbonbox/stakeholders/carbon-clients/domain/value-objects/CarbonClientId.js +1 -1
  99. package/build/carbonbox/stakeholders/carbon-coordinators/domain/entity/CarbonCoordinator.js +40 -0
  100. package/build/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPropsWithHashedPassword.js +2 -0
  101. package/build/carbonbox/stakeholders/carbon-coordinators/domain/value-objects/CarbonCoordinatorId.js +1 -1
  102. package/build/carbonbox/stakeholders/carbon-host/domain/entity/CarbonHost.js +32 -4
  103. package/build/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPropsWithHashedPassword.js +2 -0
  104. package/build/carbonbox/stakeholders/carbon-host/domain/value-objects/CarbonHostId.js +1 -1
  105. package/build/carbonbox/stakeholders/carbon-managers/domain/entity/CarbonManager.js +32 -2
  106. package/build/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPropsWithHashedPassword.js +2 -0
  107. package/build/carbonbox/stakeholders/carbon-managers/domain/value-objects/CarbonManagerId.js +1 -1
  108. package/build/carbonbox/stakeholders/shared/domain/types/StakeholderPropsWithHashedPassword.js +2 -0
  109. package/build/carbonbox/stakeholders/shared/domain/value-objects/StakeholderId.js +1 -1
  110. package/build/main/index.js +22 -6
  111. package/build/types/carbonbox/shared/domain/enums/SemanticUuidPrefix.d.ts +48 -0
  112. package/build/types/carbonbox/shared/domain/enums/SemanticUuidPrefix.d.ts.map +1 -0
  113. package/build/types/carbonbox/shared/domain/exceptions/InvalidSemanticUuidError.d.ts +8 -0
  114. package/build/types/carbonbox/shared/domain/exceptions/InvalidSemanticUuidError.d.ts.map +1 -0
  115. package/build/types/carbonbox/shared/domain/exceptions/InvalidSemanticUuidFormatError.d.ts +8 -0
  116. package/build/types/carbonbox/shared/domain/exceptions/InvalidSemanticUuidFormatError.d.ts.map +1 -0
  117. package/build/types/carbonbox/shared/domain/exceptions/InvalidUserIdFormatError.d.ts +8 -0
  118. package/build/types/carbonbox/shared/domain/exceptions/InvalidUserIdFormatError.d.ts.map +1 -0
  119. package/build/types/carbonbox/shared/domain/exceptions/InvalidUserPrefixError.d.ts +8 -0
  120. package/build/types/carbonbox/shared/domain/exceptions/InvalidUserPrefixError.d.ts.map +1 -0
  121. package/build/types/carbonbox/shared/domain/exceptions/InvalidUuidFormatError.d.ts +8 -0
  122. package/build/types/carbonbox/shared/domain/exceptions/InvalidUuidFormatError.d.ts.map +1 -0
  123. package/build/types/carbonbox/shared/domain/exceptions/UnknownBoundedContextCodeError.d.ts +8 -0
  124. package/build/types/carbonbox/shared/domain/exceptions/UnknownBoundedContextCodeError.d.ts.map +1 -0
  125. package/build/types/carbonbox/shared/domain/services/contracts/ISemanticUuidDomainService.d.ts +85 -0
  126. package/build/types/carbonbox/shared/domain/services/contracts/ISemanticUuidDomainService.d.ts.map +1 -0
  127. package/build/types/carbonbox/shared/domain/services/implementations/DateTimeFormattingDomainService.d.ts.map +1 -1
  128. package/build/types/carbonbox/shared/domain/services/implementations/SemanticUuidDomainService.d.ts +67 -0
  129. package/build/types/carbonbox/shared/domain/services/implementations/SemanticUuidDomainService.d.ts.map +1 -0
  130. package/build/types/carbonbox/shared/domain/types/UserEmailProps.d.ts +5 -0
  131. package/build/types/carbonbox/shared/domain/types/UserEmailProps.d.ts.map +1 -0
  132. package/build/types/carbonbox/shared/domain/types/UserPropsWithHashedPassword.d.ts +18 -0
  133. package/build/types/carbonbox/shared/domain/types/UserPropsWithHashedPassword.d.ts.map +1 -0
  134. package/build/types/carbonbox/shared/domain/value-objects/AggregateId.d.ts +57 -4
  135. package/build/types/carbonbox/shared/domain/value-objects/AggregateId.d.ts.map +1 -1
  136. package/build/types/carbonbox/shared/domain/value-objects/UserId.d.ts +29 -0
  137. package/build/types/carbonbox/shared/domain/value-objects/UserId.d.ts.map +1 -1
  138. package/build/types/carbonbox/stakeholders/carbon-clients/domain/entity/CarbonClient.d.ts +2 -0
  139. package/build/types/carbonbox/stakeholders/carbon-clients/domain/entity/CarbonClient.d.ts.map +1 -1
  140. package/build/types/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPropsWithHashedPassword.d.ts +20 -0
  141. package/build/types/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPropsWithHashedPassword.d.ts.map +1 -0
  142. package/build/types/carbonbox/stakeholders/carbon-coordinators/domain/entity/CarbonCoordinator.d.ts +2 -0
  143. package/build/types/carbonbox/stakeholders/carbon-coordinators/domain/entity/CarbonCoordinator.d.ts.map +1 -1
  144. package/build/types/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPropsWithHashedPassword.d.ts +15 -0
  145. package/build/types/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPropsWithHashedPassword.d.ts.map +1 -0
  146. package/build/types/carbonbox/stakeholders/carbon-host/domain/entity/CarbonHost.d.ts +2 -0
  147. package/build/types/carbonbox/stakeholders/carbon-host/domain/entity/CarbonHost.d.ts.map +1 -1
  148. package/build/types/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPropsWithHashedPassword.d.ts +3 -0
  149. package/build/types/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPropsWithHashedPassword.d.ts.map +1 -0
  150. package/build/types/carbonbox/stakeholders/carbon-managers/domain/entity/CarbonManager.d.ts +2 -0
  151. package/build/types/carbonbox/stakeholders/carbon-managers/domain/entity/CarbonManager.d.ts.map +1 -1
  152. package/build/types/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPropsWithHashedPassword.d.ts +6 -0
  153. package/build/types/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPropsWithHashedPassword.d.ts.map +1 -0
  154. package/build/types/carbonbox/stakeholders/shared/domain/types/StakeholderPropsWithHashedPassword.d.ts +8 -0
  155. package/build/types/carbonbox/stakeholders/shared/domain/types/StakeholderPropsWithHashedPassword.d.ts.map +1 -0
  156. package/build/types/main/index.d.ts +9 -0
  157. package/build/types/main/index.d.ts.map +1 -1
  158. package/package.json +1 -1
@@ -105,7 +105,7 @@ class EventEditionConfigurationCarbonFootprintSubsegmentReferences extends Value
105
105
  */
106
106
  static guardAgainstInvalidSubsegmentId(id, propertyName) {
107
107
  String_1.String.guardAgainstEmptyValue(id, propertyName);
108
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
108
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, propertyName);
109
109
  }
110
110
  /**
111
111
  * Valida el código de subsegmento usando las validaciones de Code.
@@ -110,7 +110,7 @@ class EventEditionLifecycleStageConfigurationReferences extends ValueObject_1.Va
110
110
  */
111
111
  static guardAgainstInvalidConfigurationId(id, propertyName) {
112
112
  String_1.String.guardAgainstEmptyValue(id, propertyName);
113
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
113
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, propertyName);
114
114
  }
115
115
  /**
116
116
  * Valida la referencia de etapa de edición de evento.
@@ -162,7 +162,7 @@ class EventEditionLifecycleStageConfigurationReferences extends ValueObject_1.Va
162
162
  throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof reference.name);
163
163
  }
164
164
  String_1.String.guardAgainstEmptyValue(reference.id, `${propertyName}.id`);
165
- AggregateId_1.AggregateId.guardAgainstInvalidId(reference.id, `${propertyName}.id`);
165
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(reference.id, `${propertyName}.id`);
166
166
  String_1.String.guardAgainstEmptyValue(reference.code, `${propertyName}.code`);
167
167
  Code_1.Code.guardAgainstInvalidCode(reference.code);
168
168
  String_1.String.guardAgainstEmptyValue(reference.name, `${propertyName}.name`);
@@ -67,7 +67,7 @@ class EventEditionLifecycleStageReference extends ObjectValueObject_1.ObjectValu
67
67
  */
68
68
  static guardAgainstInvalidId(id) {
69
69
  String_1.String.guardAgainstEmptyValue(id, 'id');
70
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
70
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
71
71
  }
72
72
  /**
73
73
  * Valida el código de edición del evento usando las validaciones de Code.
@@ -66,7 +66,7 @@ class EventEditionReference extends ObjectValueObject_1.ObjectValueObject {
66
66
  */
67
67
  static guardAgainstInvalidId(id) {
68
68
  String_1.String.guardAgainstEmptyValue(id, 'id');
69
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
69
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
70
70
  }
71
71
  /**
72
72
  * Valida el código de edición del evento usando las validaciones de Code.
@@ -96,7 +96,7 @@ class EventEditionReferences extends ValueObject_1.ValueObject {
96
96
  }
97
97
  // Validar usando las reglas de dominio
98
98
  String_1.String.guardAgainstEmptyValue(reference.id, `${propertyName}.id`);
99
- AggregateId_1.AggregateId.guardAgainstInvalidId(reference.id, `${propertyName}.id`);
99
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(reference.id, `${propertyName}.id`);
100
100
  String_1.String.guardAgainstEmptyValue(reference.code, `${propertyName}.code`);
101
101
  Code_1.Code.guardAgainstInvalidCode(reference.code);
102
102
  String_1.String.guardAgainstEmptyValue(reference.name, `${propertyName}.name`);
@@ -66,7 +66,7 @@ class EventReference extends ObjectValueObject_1.ObjectValueObject {
66
66
  */
67
67
  static guardAgainstInvalidId(id) {
68
68
  String_1.String.guardAgainstEmptyValue(id, 'id');
69
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
69
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
70
70
  }
71
71
  static guardAgainstInvalidCode(code) {
72
72
  String_1.String.guardAgainstEmptyValue(code, 'code');
@@ -56,7 +56,7 @@ class FacilityReference extends ObjectValueObject_1.ObjectValueObject {
56
56
  }
57
57
  static guardAgainstInvalidId(id) {
58
58
  String_1.String.guardAgainstEmptyValue(id, 'id');
59
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
59
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
60
60
  }
61
61
  /**
62
62
  * Valida el nombre comercial de la sucursal.
@@ -70,7 +70,7 @@ class GlobalWarmingPotentialReference extends ObjectValueObject_1.ObjectValueObj
70
70
  }
71
71
  static guardAgainstInvalidId(id) {
72
72
  String_1.String.guardAgainstEmptyValue(id, 'id');
73
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
73
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
74
74
  }
75
75
  /**
76
76
  * Valida el nombre de referencia.
@@ -78,7 +78,7 @@ class NullableCorporateConfigurationCarbonFootprintSubsegmentReference extends V
78
78
  */
79
79
  static guardAgainstInvalidId(id) {
80
80
  String_1.String.guardAgainstEmptyValue(id, 'id');
81
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
81
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
82
82
  }
83
83
  /**
84
84
  * Valida el código de subsegmento corporativo usando las validaciones de Code.
@@ -78,7 +78,7 @@ class NullableEventEditionConfigurationCarbonFootprintSubsegmentReference extend
78
78
  */
79
79
  static guardAgainstInvalidId(id) {
80
80
  String_1.String.guardAgainstEmptyValue(id, 'id');
81
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
81
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
82
82
  }
83
83
  /**
84
84
  * Valida el código de subsegmento de etapa usando las validaciones de Code.
@@ -78,7 +78,7 @@ class NullableProductConfigurationCarbonFootprintSubsegmentReference extends Val
78
78
  */
79
79
  static guardAgainstInvalidId(id) {
80
80
  String_1.String.guardAgainstEmptyValue(id, 'id');
81
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
81
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
82
82
  }
83
83
  /**
84
84
  * Valida el código de subsegmento de producto usando las validaciones de Code.
@@ -111,7 +111,7 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
111
111
  */
112
112
  static guardAgainstInvalidId(id, propertyName) {
113
113
  String_1.String.guardAgainstEmptyValue(id, propertyName);
114
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
114
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, propertyName);
115
115
  }
116
116
  /**
117
117
  * Valida la referencia de segmento.
@@ -144,7 +144,7 @@ class ProductCarbonFootprintSegmentConfigurationReferences extends ValueObject_1
144
144
  throw InvalidPropertyTypeError_1.InvalidPropertyTypeError.create(`${propertyName}.name`, 'string', typeof reference.name);
145
145
  }
146
146
  String_1.String.guardAgainstEmptyValue(reference.id, `${propertyName}.id`);
147
- AggregateId_1.AggregateId.guardAgainstInvalidId(reference.id, `${propertyName}.id`);
147
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(reference.id, `${propertyName}.id`);
148
148
  String_1.String.guardAgainstEmptyValue(reference.code, `${propertyName}.code`);
149
149
  Code_1.Code.guardAgainstInvalidCode(reference.code);
150
150
  String_1.String.guardAgainstEmptyValue(reference.name, `${propertyName}.name`);
@@ -70,7 +70,7 @@ class ProductConfigurationCarbonFootprintSegmentReference extends ObjectValueObj
70
70
  }
71
71
  static guardAgainstInvalidId(id) {
72
72
  String_1.String.guardAgainstEmptyValue(id, 'id');
73
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
73
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
74
74
  }
75
75
  /**
76
76
  * Valida el código del segmento de producto.
@@ -70,7 +70,7 @@ class ProductConfigurationCarbonFootprintSubsegmentReference extends ObjectValue
70
70
  }
71
71
  static guardAgainstInvalidId(id) {
72
72
  String_1.String.guardAgainstEmptyValue(id, 'id');
73
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
73
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
74
74
  }
75
75
  /**
76
76
  * Valida el código del segmento de producto.
@@ -71,7 +71,7 @@ class ProductConfigurationSystemBoundaryReference extends ObjectValueObject_1.Ob
71
71
  }
72
72
  static guardAgainstInvalidId(id) {
73
73
  String_1.String.guardAgainstEmptyValue(id, 'id');
74
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
74
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
75
75
  }
76
76
  /**
77
77
  * Valida el código de límite del sistema usando las validaciones de Code.
@@ -63,7 +63,7 @@ class ProductReference extends ObjectValueObject_1.ObjectValueObject {
63
63
  }
64
64
  static guardAgainstInvalidId(id) {
65
65
  String_1.String.guardAgainstEmptyValue(id, 'id');
66
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
66
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
67
67
  }
68
68
  /**
69
69
  * Valida el código de producto usando las validaciones de Code.
@@ -70,7 +70,7 @@ class ServiceCatalogReference extends ObjectValueObject_1.ObjectValueObject {
70
70
  }
71
71
  static guardAgainstInvalidId(id) {
72
72
  String_1.String.guardAgainstEmptyValue(id, 'id');
73
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
73
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
74
74
  }
75
75
  /**
76
76
  * Valida el código de servicio usando las validaciones de Code.
@@ -72,7 +72,7 @@ class StakeholderReference extends ObjectValueObject_1.ObjectValueObject {
72
72
  }
73
73
  static guardAgainstInvalidId(id) {
74
74
  String_1.String.guardAgainstEmptyValue(id, 'id');
75
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, 'id');
75
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, 'id');
76
76
  }
77
77
  /**
78
78
  * Valida si el valor principal es inválido.
@@ -121,7 +121,7 @@ class StakeholderReferences extends ValueObject_1.ValueObject {
121
121
  */
122
122
  static guardAgainstInvalidId(id, propertyName) {
123
123
  String_1.String.guardAgainstEmptyValue(id, propertyName);
124
- AggregateId_1.AggregateId.guardAgainstInvalidId(id, propertyName);
124
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(id, propertyName);
125
125
  }
126
126
  /**
127
127
  * Valida el nombre para mostrar.
@@ -2,6 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UserId = void 0;
4
4
  const AggregateId_1 = require("./AggregateId");
5
+ const SemanticUuidPrefix_1 = require("../enums/SemanticUuidPrefix");
6
+ const StakeholderRole_1 = require("../enums/StakeholderRole");
7
+ const InvalidUserPrefixError_1 = require("../exceptions/InvalidUserPrefixError");
8
+ const InvalidUserIdFormatError_1 = require("../exceptions/InvalidUserIdFormatError");
5
9
  class UserId extends AggregateId_1.AggregateId {
6
10
  /**
7
11
  * Constructor protegido para que solo clases hijas puedan instanciar.
@@ -13,16 +17,140 @@ class UserId extends AggregateId_1.AggregateId {
13
17
  static create(value) {
14
18
  AggregateId_1.AggregateId.guardAgainstEmptyValue(value, UserId.PROPERTY_NAME);
15
19
  AggregateId_1.AggregateId.guardAgainstInvalidType(value, UserId.PROPERTY_NAME);
16
- AggregateId_1.AggregateId.guardAgainstInvalidId(value);
20
+ AggregateId_1.AggregateId.guardAgainstInvalidSemanticId(value, UserId.PROPERTY_NAME);
21
+ // Validate that the prefix is a valid user prefix
22
+ UserId.guardAgainstInvalidUserPrefix(value);
17
23
  return new UserId(value, false);
18
24
  }
19
25
  static fromPrimitives(primitive) {
20
26
  const value = primitive;
21
27
  return new UserId(value, true);
22
28
  }
29
+ /**
30
+ * Validates that the UUID has a valid user prefix
31
+ */
32
+ static guardAgainstInvalidUserPrefix(value) {
33
+ try {
34
+ const tempInstance = new UserId(value, true); // Skip validation for extraction
35
+ const prefix = tempInstance.extractPrefix();
36
+ if (UserId.VALID_USER_PREFIXES.includes(prefix) === false) {
37
+ throw InvalidUserPrefixError_1.InvalidUserPrefixError.create(value, prefix, UserId.VALID_USER_PREFIXES);
38
+ }
39
+ }
40
+ catch (error) {
41
+ if (error instanceof InvalidUserPrefixError_1.InvalidUserPrefixError) {
42
+ throw error;
43
+ }
44
+ if (error instanceof Error) {
45
+ throw InvalidUserIdFormatError_1.InvalidUserIdFormatError.create(value, error.message);
46
+ }
47
+ throw error;
48
+ }
49
+ }
50
+ /**
51
+ * Checks if the current UserId has a valid user prefix
52
+ */
53
+ hasValidUserPrefix() {
54
+ try {
55
+ const prefix = this.extractPrefix();
56
+ return UserId.VALID_USER_PREFIXES.includes(prefix);
57
+ }
58
+ catch {
59
+ return false;
60
+ }
61
+ }
62
+ /**
63
+ * Checks if this is a general user (not a stakeholder)
64
+ */
65
+ isGeneralUser() {
66
+ try {
67
+ return this.extractPrefix() === SemanticUuidPrefix_1.SemanticUuidPrefix.USR;
68
+ }
69
+ catch {
70
+ return false;
71
+ }
72
+ }
73
+ /**
74
+ * Checks if this is a stakeholder user
75
+ */
76
+ isStakeholder() {
77
+ try {
78
+ const prefix = this.extractPrefix();
79
+ return [
80
+ SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_CLIENT,
81
+ SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_COORDINATOR,
82
+ SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_HOST,
83
+ SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_MANAGER,
84
+ ].includes(prefix);
85
+ }
86
+ catch {
87
+ return false;
88
+ }
89
+ }
90
+ /**
91
+ * Stakeholder identification methods - checks if user is a specific stakeholder type
92
+ */
93
+ isStakeholderCarbonClient() {
94
+ try {
95
+ return this.extractPrefix() === SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_CLIENT;
96
+ }
97
+ catch {
98
+ return false;
99
+ }
100
+ }
101
+ isStakeholderCarbonCoordinator() {
102
+ try {
103
+ return this.extractPrefix() === SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_COORDINATOR;
104
+ }
105
+ catch {
106
+ return false;
107
+ }
108
+ }
109
+ isStakeholderCarbonManager() {
110
+ try {
111
+ return this.extractPrefix() === SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_MANAGER;
112
+ }
113
+ catch {
114
+ return false;
115
+ }
116
+ }
117
+ isStakeholderCarbonHost() {
118
+ try {
119
+ return this.extractPrefix() === SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_HOST;
120
+ }
121
+ catch {
122
+ return false;
123
+ }
124
+ }
125
+ /**
126
+ * Gets the stakeholder role type from the semantic UUID prefix
127
+ */
128
+ getStakeholderRole() {
129
+ try {
130
+ const prefix = this.extractPrefix();
131
+ const roleMap = {
132
+ [SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_CLIENT]: StakeholderRole_1.StakeholderRole.CARBON_CLIENT,
133
+ [SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_COORDINATOR]: StakeholderRole_1.StakeholderRole.CARBON_COORDINATOR,
134
+ [SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_MANAGER]: StakeholderRole_1.StakeholderRole.CARBON_MANAGER,
135
+ [SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_HOST]: StakeholderRole_1.StakeholderRole.CARBON_HOST,
136
+ };
137
+ return roleMap[prefix] || 'UNKNOWN';
138
+ }
139
+ catch {
140
+ return 'UNKNOWN';
141
+ }
142
+ }
23
143
  toPrimitives() {
24
144
  return this.value;
25
145
  }
26
146
  }
27
147
  exports.UserId = UserId;
28
148
  UserId.PROPERTY_NAME = 'id';
149
+ // Valid prefixes for User IDs (general users and stakeholders)
150
+ UserId.VALID_USER_PREFIXES = [
151
+ SemanticUuidPrefix_1.SemanticUuidPrefix.USR, // General user (BC-level)
152
+ SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_CLIENT,
153
+ SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_COORDINATOR,
154
+ SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_HOST,
155
+ SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_MANAGER,
156
+ ];
@@ -41,8 +41,8 @@ class CarbonClient extends Stakeholder_1.Stakeholder {
41
41
  ? CarbonClientId_1.CarbonClientId.fromPrimitives(props.id).toPrimitives()
42
42
  : CarbonClientId_1.CarbonClientId.create(props.id).toPrimitives();
43
43
  const avatar = skipDomainValidation
44
- ? CarbonClientAvatar_1.CarbonClientAvatar.fromPrimitives(props.avatar).value
45
- : CarbonClientAvatar_1.CarbonClientAvatar.create(props.avatar).value;
44
+ ? CarbonClientAvatar_1.CarbonClientAvatar.fromPrimitives(props.avatar).toPrimitives()
45
+ : CarbonClientAvatar_1.CarbonClientAvatar.create(props.avatar).toPrimitives();
46
46
  const email = skipDomainValidation
47
47
  ? CarbonClientEmail_1.CarbonClientEmail.fromPrimitives(props.email).toPrimitives()
48
48
  : CarbonClientEmail_1.CarbonClientEmail.create(props.email).toPrimitives();
@@ -149,6 +149,54 @@ class CarbonClient extends Stakeholder_1.Stakeholder {
149
149
  };
150
150
  return new CarbonClient(props, true);
151
151
  }
152
+ static createWithHashedPassword(props) {
153
+ CarbonClientPassword_1.CarbonClientPassword.create(props.password);
154
+ const hashedPassword = CarbonClientPassword_1.CarbonClientPassword.fromPrimitives(props.hashedPassword).toPrimitives();
155
+ const id = CarbonClientId_1.CarbonClientId.create(props.id).toPrimitives();
156
+ const avatar = CarbonClientAvatar_1.CarbonClientAvatar.create(props.avatar).toPrimitives();
157
+ const email = CarbonClientEmail_1.CarbonClientEmail.create(props.email).toPrimitives();
158
+ const displayName = CarbonClientDisplayName_1.CarbonClientDisplayName.create(props.displayName).toPrimitives();
159
+ const lastAccessAt = CarbonClientLastAccessAt_1.CarbonClientLastAccessAt.create(props.lastAccessAt).toPrimitives();
160
+ const taxIdentification = CarbonClientTaxIdentification_1.CarbonClientTaxIdentification.create(props.taxIdentification).toPrimitives();
161
+ const roleType = CarbonClientRoleType_1.CarbonClientRoleType.create(props.roleType).toEnum();
162
+ const businessStatus = CarbonClientBusinessStatus_1.CarbonClientBusinessStatus.create(props.businessStatus).toEnum();
163
+ const userType = CarbonClientUserType_1.CarbonClientUserType.create(props.userType).toEnum();
164
+ const permissions = CarbonClientPermissions_1.CarbonClientPermissions.create(props.permissions).toEnums();
165
+ const legalBusinessName = CarbonClientLegalBusinessName_1.CarbonClientLegalBusinessName.create(props.legalBusinessName).toPrimitives();
166
+ const industryType = CarbonClientIndustryType_1.CarbonClientIndustryType.create(props.industryType).toPrimitives();
167
+ const organizationSize = CarbonClientOrganizationSize_1.CarbonClientOrganizationSize.create(props.organizationSize).toEnum();
168
+ const physicalAddress = CarbonClientPhysicalAddress_1.CarbonClientPhysicalAddress.create(props.physicalAddress).toPrimitives();
169
+ const primaryContactEmail = CarbonClientPrimaryContactEmail_1.CarbonClientPrimaryContactEmail.create(props.primaryContactEmail).toPrimitives();
170
+ const primaryContactPhone = CarbonClientPrimaryContactPhone_1.CarbonClientPrimaryContactPhone.create(props.primaryContactPhone).toPrimitives();
171
+ const websiteUrl = CarbonClientWebsiteUrl_1.CarbonClientWebsiteUrl.create(props.websiteUrl).toPrimitives();
172
+ const logo = CarbonClientLogo_1.CarbonClientLogo.create(props.logo).toPrimitives();
173
+ const accountType = CarbonClientAccountType_1.CarbonClientAccountType.create(props.accountType).toEnum();
174
+ const supervisedByStakeholder = CarbonClientSupervisedByStakeholder_1.CarbonClientSupervisedByStakeholder.create(props.supervisedByStakeholder).toPrimitives();
175
+ const carbonClientPrimitives = {
176
+ id,
177
+ avatar,
178
+ email,
179
+ password: hashedPassword,
180
+ displayName,
181
+ lastAccessAt,
182
+ taxIdentification,
183
+ roleType,
184
+ businessStatus,
185
+ userType,
186
+ legalBusinessName,
187
+ industryType,
188
+ organizationSize,
189
+ physicalAddress,
190
+ primaryContactEmail,
191
+ primaryContactPhone,
192
+ websiteUrl,
193
+ logo,
194
+ accountType,
195
+ supervisedByStakeholder,
196
+ permissions,
197
+ };
198
+ return CarbonClient.fromPrimitives(carbonClientPrimitives);
199
+ }
152
200
  get toPrimitives() {
153
201
  return {
154
202
  id: this.id.toPrimitives(),
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -9,7 +9,7 @@ class CarbonClientId extends StakeholderId_1.StakeholderId {
9
9
  static create(value) {
10
10
  StakeholderId_1.StakeholderId.guardAgainstEmptyValue(value, CarbonClientId.PROPERTY_NAME);
11
11
  StakeholderId_1.StakeholderId.guardAgainstInvalidType(value, CarbonClientId.PROPERTY_NAME);
12
- StakeholderId_1.StakeholderId.guardAgainstInvalidId(value);
12
+ StakeholderId_1.StakeholderId.guardAgainstInvalidSemanticId(value);
13
13
  return new CarbonClientId(value, false);
14
14
  }
15
15
  static fromPrimitives(primitive) {
@@ -129,6 +129,46 @@ class CarbonCoordinator extends Stakeholder_1.Stakeholder {
129
129
  };
130
130
  return new CarbonCoordinator(props, true);
131
131
  }
132
+ static createWithHashedPassword(props) {
133
+ CarbonCoordinatorPassword_1.CarbonCoordinatorPassword.create(props.password);
134
+ const hashedPassword = CarbonCoordinatorPassword_1.CarbonCoordinatorPassword.fromPrimitives(props.hashedPassword).toPrimitives();
135
+ const id = CarbonCoordinatorId_1.CarbonCoordinatorId.create(props.id).toPrimitives();
136
+ const avatar = CarbonCoordinatorAvatar_1.CarbonCoordinatorAvatar.create(props.avatar).toPrimitives();
137
+ const email = CarbonCoordinatorEmail_1.CarbonCoordinatorEmail.create(props.email).toPrimitives();
138
+ const displayName = CarbonCoordinatorDisplayName_1.CarbonCoordinatorDisplayName.create(props.displayName).toPrimitives();
139
+ const lastAccessAt = CarbonCoordinatorLastAccessAt_1.CarbonCoordinatorLastAccessAt.create(props.lastAccessAt).toPrimitives();
140
+ const taxIdentification = CarbonCoordinatorTaxIdentification_1.CarbonCoordinatorTaxIdentification.create(props.taxIdentification).toPrimitives();
141
+ const roleType = CarbonCoordinatorRoleType_1.CarbonCoordinatorRoleType.create(props.roleType).toEnum();
142
+ const businessStatus = CarbonCoordinatorBusinessStatus_1.CarbonCoordinatorBusinessStatus.create(props.businessStatus).toEnum();
143
+ const userType = CarbonCoordinatorUserType_1.CarbonCoordinatorUserType.create(props.userType).toEnum();
144
+ const permissions = CarbonCoordinatorPermissions_1.CarbonCoordinatorPermissions.create(props.permissions).toEnums();
145
+ const availabilityStatus = CarbonCoordinatorAvailabilityStatus_1.CarbonCoordinatorAvailabilityStatus.create(props.availabilityStatus).toEnum();
146
+ const weeklyWorkingSchedule = CarbonCoordinatorWeeklyWorkingSchedule_1.CarbonCoordinatorWeeklyWorkingSchedule.create(props.weeklyWorkingSchedule).toPrimitives();
147
+ const gender = CarbonCoordinatorGender_1.CarbonCoordinatorGender.create(props.gender).toEnum();
148
+ const assignedByStakeholder = CarbonCoordinatorAssignedByStakeholder_1.CarbonCoordinatorAssignedByStakeholder.create(props.assignedByStakeholder).toPrimitives();
149
+ const managedCarbonClients = CarbonCoordinatorManagedCarbonClients_1.CarbonCoordinatorManagedCarbonClients.create(props.managedCarbonClients).toPrimitives();
150
+ const reportsToStakeholder = CarbonCoordinatorReportsToStakeholder_1.CarbonCoordinatorReportsToStakeholder.create(props.reportsToStakeholder).toPrimitives();
151
+ const carbonCoordinatorPrimitives = {
152
+ id,
153
+ avatar,
154
+ email,
155
+ password: hashedPassword,
156
+ displayName,
157
+ lastAccessAt,
158
+ taxIdentification,
159
+ roleType,
160
+ businessStatus,
161
+ userType,
162
+ permissions,
163
+ availabilityStatus,
164
+ weeklyWorkingSchedule,
165
+ gender,
166
+ assignedByStakeholder,
167
+ managedCarbonClients,
168
+ reportsToStakeholder,
169
+ };
170
+ return CarbonCoordinator.fromPrimitives(carbonCoordinatorPrimitives);
171
+ }
132
172
  get toPrimitives() {
133
173
  return {
134
174
  id: this.id.toPrimitives(),
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -9,7 +9,7 @@ class CarbonCoordinatorId extends StakeholderId_1.StakeholderId {
9
9
  static create(value) {
10
10
  StakeholderId_1.StakeholderId.guardAgainstEmptyValue(value, CarbonCoordinatorId.PROPERTY_NAME);
11
11
  StakeholderId_1.StakeholderId.guardAgainstInvalidType(value, CarbonCoordinatorId.PROPERTY_NAME);
12
- StakeholderId_1.StakeholderId.guardAgainstInvalidId(value);
12
+ StakeholderId_1.StakeholderId.guardAgainstInvalidSemanticId(value);
13
13
  return new CarbonCoordinatorId(value, false);
14
14
  }
15
15
  static fromPrimitives(primitive) {
@@ -19,8 +19,8 @@ class CarbonHost extends Stakeholder_1.Stakeholder {
19
19
  ? CarbonHostId_1.CarbonHostId.fromPrimitives(props.id).toPrimitives()
20
20
  : CarbonHostId_1.CarbonHostId.create(props.id).toPrimitives();
21
21
  const avatar = skipDomainValidation
22
- ? CarbonHostAvatar_1.CarbonHostAvatar.fromPrimitives(props.avatar).value
23
- : CarbonHostAvatar_1.CarbonHostAvatar.create(props.avatar).value;
22
+ ? CarbonHostAvatar_1.CarbonHostAvatar.fromPrimitives(props.avatar).toPrimitives()
23
+ : CarbonHostAvatar_1.CarbonHostAvatar.create(props.avatar).toPrimitives();
24
24
  const email = skipDomainValidation
25
25
  ? CarbonHostEmail_1.CarbonHostEmail.fromPrimitives(props.email).toPrimitives()
26
26
  : CarbonHostEmail_1.CarbonHostEmail.create(props.email).toPrimitives();
@@ -34,8 +34,8 @@ class CarbonHost extends Stakeholder_1.Stakeholder {
34
34
  ? CarbonHostLastAccessAt_1.CarbonHostLastAccessAt.fromPrimitives(props.lastAccessAt).toPrimitives()
35
35
  : CarbonHostLastAccessAt_1.CarbonHostLastAccessAt.create(props.lastAccessAt).toPrimitives();
36
36
  const taxIdentification = skipDomainValidation
37
- ? CarbonHostTaxIdentification_1.CarbonHostTaxIdentification.fromPrimitives(props.taxIdentification).value
38
- : CarbonHostTaxIdentification_1.CarbonHostTaxIdentification.create(props.taxIdentification).value;
37
+ ? CarbonHostTaxIdentification_1.CarbonHostTaxIdentification.fromPrimitives(props.taxIdentification).toPrimitives()
38
+ : CarbonHostTaxIdentification_1.CarbonHostTaxIdentification.create(props.taxIdentification).toPrimitives();
39
39
  const roleType = skipDomainValidation
40
40
  ? CarbonHostRoleType_1.CarbonHostRoleType.fromPrimitives(props.roleType).toEnum()
41
41
  : CarbonHostRoleType_1.CarbonHostRoleType.create(props.roleType).toEnum();
@@ -81,6 +81,34 @@ class CarbonHost extends Stakeholder_1.Stakeholder {
81
81
  };
82
82
  return new CarbonHost(props, true);
83
83
  }
84
+ static createWithHashedPassword(props) {
85
+ CarbonHostPassword_1.CarbonHostPassword.create(props.password);
86
+ const hashedPassword = CarbonHostPassword_1.CarbonHostPassword.fromPrimitives(props.hashedPassword).toPrimitives();
87
+ const id = CarbonHostId_1.CarbonHostId.create(props.id).toPrimitives();
88
+ const avatar = CarbonHostAvatar_1.CarbonHostAvatar.create(props.avatar).toPrimitives();
89
+ const email = CarbonHostEmail_1.CarbonHostEmail.create(props.email).toPrimitives();
90
+ const displayName = CarbonHostDisplayName_1.CarbonHostDisplayName.create(props.displayName).toPrimitives();
91
+ const lastAccessAt = CarbonHostLastAccessAt_1.CarbonHostLastAccessAt.create(props.lastAccessAt).toPrimitives();
92
+ const taxIdentification = CarbonHostTaxIdentification_1.CarbonHostTaxIdentification.create(props.taxIdentification).toPrimitives();
93
+ const roleType = CarbonHostRoleType_1.CarbonHostRoleType.create(props.roleType).toEnum();
94
+ const businessStatus = CarbonHostBusinessStatus_1.CarbonHostBusinessStatus.create(props.businessStatus).toEnum();
95
+ const userType = CarbonHostUserType_1.CarbonHostUserType.create(props.userType).toEnum();
96
+ const permissions = CarbonHostPermissions_1.CarbonHostPermissions.create(props.permissions).toEnums();
97
+ const carbonHostPrimitives = {
98
+ id,
99
+ avatar,
100
+ email,
101
+ password: hashedPassword,
102
+ displayName,
103
+ lastAccessAt,
104
+ taxIdentification,
105
+ roleType,
106
+ businessStatus,
107
+ userType,
108
+ permissions,
109
+ };
110
+ return CarbonHost.fromPrimitives(carbonHostPrimitives);
111
+ }
84
112
  get toPrimitives() {
85
113
  return {
86
114
  id: this.id.toPrimitives(),
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -9,7 +9,7 @@ class CarbonHostId extends StakeholderId_1.StakeholderId {
9
9
  static create(value) {
10
10
  StakeholderId_1.StakeholderId.guardAgainstEmptyValue(value, CarbonHostId.PROPERTY_NAME);
11
11
  StakeholderId_1.StakeholderId.guardAgainstInvalidType(value, CarbonHostId.PROPERTY_NAME);
12
- StakeholderId_1.StakeholderId.guardAgainstInvalidId(value);
12
+ StakeholderId_1.StakeholderId.guardAgainstInvalidSemanticId(value);
13
13
  return new CarbonHostId(value, false);
14
14
  }
15
15
  static fromPrimitives(primitive) {
@@ -32,8 +32,8 @@ class CarbonManager extends Stakeholder_1.Stakeholder {
32
32
  ? CarbonManagerId_1.CarbonManagerId.fromPrimitives(props.id).toPrimitives()
33
33
  : CarbonManagerId_1.CarbonManagerId.create(props.id).toPrimitives();
34
34
  const avatar = skipDomainValidation
35
- ? CarbonManagerAvatar_1.CarbonManagerAvatar.fromPrimitives(props.avatar).value
36
- : CarbonManagerAvatar_1.CarbonManagerAvatar.create(props.avatar).value;
35
+ ? CarbonManagerAvatar_1.CarbonManagerAvatar.fromPrimitives(props.avatar).toPrimitives()
36
+ : CarbonManagerAvatar_1.CarbonManagerAvatar.create(props.avatar).toPrimitives();
37
37
  const email = skipDomainValidation
38
38
  ? CarbonManagerEmail_1.CarbonManagerEmail.fromPrimitives(props.email).toPrimitives()
39
39
  : CarbonManagerEmail_1.CarbonManagerEmail.create(props.email).toPrimitives();
@@ -104,6 +104,36 @@ class CarbonManager extends Stakeholder_1.Stakeholder {
104
104
  };
105
105
  return new CarbonManager(props, true);
106
106
  }
107
+ static createWithHashedPassword(props) {
108
+ CarbonManagerPassword_1.CarbonManagerPassword.create(props.password);
109
+ const hashedPassword = CarbonManagerPassword_1.CarbonManagerPassword.fromPrimitives(props.hashedPassword).toPrimitives();
110
+ const id = CarbonManagerId_1.CarbonManagerId.create(props.id).toPrimitives();
111
+ const avatar = CarbonManagerAvatar_1.CarbonManagerAvatar.create(props.avatar).toPrimitives();
112
+ const email = CarbonManagerEmail_1.CarbonManagerEmail.create(props.email).toPrimitives();
113
+ const displayName = CarbonManagerDisplayName_1.CarbonManagerDisplayName.create(props.displayName).toPrimitives();
114
+ const lastAccessAt = CarbonManagerLastAccessAt_1.CarbonManagerLastAccessAt.create(props.lastAccessAt).toPrimitives();
115
+ const taxIdentification = CarbonManagerTaxIdentification_1.CarbonManagerTaxIdentification.create(props.taxIdentification).toPrimitives();
116
+ const roleType = CarbonManagerRoleType_1.CarbonManagerRoleType.create(props.roleType).toEnum();
117
+ const businessStatus = CarbonManagerBusinessStatus_1.CarbonManagerBusinessStatus.create(props.businessStatus).toEnum();
118
+ const userType = CarbonManagerUserType_1.CarbonManagerUserType.create(props.userType).toEnum();
119
+ const permissions = CarbonManagerPermissions_1.CarbonManagerPermissions.create(props.permissions).toEnums();
120
+ const managedStakeholders = CarbonManagerManagedStakeholders_1.CarbonManagerManagedStakeholders.create(props.managedStakeholders).toPrimitives();
121
+ const carbonManagerPrimitives = {
122
+ id,
123
+ avatar,
124
+ email,
125
+ password: hashedPassword,
126
+ displayName,
127
+ lastAccessAt,
128
+ taxIdentification,
129
+ roleType,
130
+ businessStatus,
131
+ userType,
132
+ permissions,
133
+ managedStakeholders,
134
+ };
135
+ return CarbonManager.fromPrimitives(carbonManagerPrimitives);
136
+ }
107
137
  get toPrimitives() {
108
138
  return {
109
139
  id: this.id.toPrimitives(),
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });