@carbonbox/domain 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/carbonbox/shared/domain/exceptions/InvalidAggregateIdFormatError.js +1 -1
- package/build/types/carbonbox/shared/domain/exceptions/InvalidAggregateIdFormatError.d.ts.map +1 -1
- package/package.json +1 -1
- package/build/carbonbox/purchase-management-system/service-catalog/domain/entity/IService.js +0 -2
- package/build/carbonbox/purchase-management-system/service-catalog/domain/entity/Service.js +0 -263
- package/build/carbonbox/purchase-management-system/service-catalog/domain/enums/ServiceCategory.js +0 -20
- package/build/carbonbox/purchase-management-system/service-catalog/domain/enums/ServiceStatus.js +0 -9
- package/build/carbonbox/purchase-management-system/service-catalog/domain/enums/ServiceType.js +0 -10
- package/build/carbonbox/purchase-management-system/service-catalog/domain/exceptions/InvalidServiceCategoryError.js +0 -19
- package/build/carbonbox/purchase-management-system/service-catalog/domain/exceptions/InvalidServiceStatusError.js +0 -19
- package/build/carbonbox/purchase-management-system/service-catalog/domain/exceptions/InvalidServiceTypeError.js +0 -19
- package/build/carbonbox/purchase-management-system/service-catalog/domain/repository/IServiceRepository.js +0 -2
- package/build/carbonbox/purchase-management-system/service-catalog/domain/types/ServicePrimitives.js +0 -2
- package/build/carbonbox/purchase-management-system/service-catalog/domain/types/ServiceProps.js +0 -2
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceAdditionalUserRoles.js +0 -131
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceAllowsDocumentReading.js +0 -22
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceAllowsSectoralComparison.js +0 -22
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceBasePricePercentage.js +0 -140
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceCategory.js +0 -243
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceCode.js +0 -24
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceCreatedByStakeholder.js +0 -26
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceDependsOnServiceCode.js +0 -21
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceDescription.js +0 -23
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceExpertDedicationLevel.js +0 -212
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceFixedPriceAmount.js +0 -193
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceHasBasePrice.js +0 -22
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceHasFixedPrice.js +0 -22
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceId.js +0 -24
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIncludesCarbonBoxAcademy.js +0 -22
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIncludesESGIndicators.js +0 -22
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsAvailableForCorporate.js +0 -22
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsAvailableForEvent.js +0 -22
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsAvailableForProduct.js +0 -22
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsRequiredService.js +0 -22
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceMaxUsers.js +0 -246
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceName.js +0 -23
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceReportTypes.js +0 -246
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceStatus.js +0 -221
- package/build/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceType.js +0 -235
- package/build/carbonbox/shared/domain/exceptions/InvalidSemanticUuidError.js +0 -19
- package/build/carbonbox/shared/domain/services/DateTimeFormattingDomainService.js +0 -172
- package/build/carbonbox/shared/domain/services/contracts/ISemanticUuidDomainService.js +0 -2
- package/build/carbonbox/shared/domain/services/implementations/SemanticUuidDomainService.js +0 -235
- package/build/carbonbox/shared/domain/types/AllPermissions.js +0 -2
- package/build/carbonbox/shared/domain/types/AllPermissionsPrimitives.js +0 -2
- package/build/carbonbox/shared/domain/types/ServiceReference.js +0 -2
- package/build/carbonbox/shared/domain/types/ServiceReferencePrimitives.js +0 -2
- package/build/carbonbox/shared/domain/types/UserEmailProps.js +0 -2
- package/build/carbonbox/shared/domain/value-objects/ServiceReference.js +0 -301
- package/build/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPermissions.js +0 -2
- package/build/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPermissionsPrimitives.js +0 -2
- package/build/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPermissionsValue.js +0 -2
- package/build/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPermissions.js +0 -2
- package/build/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPermissionsPrimitives.js +0 -2
- package/build/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPermissionsValue.js +0 -2
- package/build/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPermissions.js +0 -2
- package/build/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPermissionsPrimitives.js +0 -2
- package/build/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPermissionsValue.js +0 -2
- package/build/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPermissions.js +0 -2
- package/build/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPermissionsPrimitives.js +0 -2
- package/build/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPermissionsValue.js +0 -2
- package/build/carbonbox/stakeholders/shared/domain/enums/StakeholderBusinessStatus.js +0 -10
- package/build/carbonbox/stakeholders/shared/domain/exceptions/InvalidStakeholderBusinessStatusError.js +0 -18
- package/build/carbonbox/stakeholders/shared/domain/types/StakeholderPermissions.js +0 -2
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/entity/IService.d.ts +0 -52
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/entity/IService.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/entity/Service.d.ts +0 -60
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/entity/Service.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/enums/ServiceCategory.d.ts +0 -17
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/enums/ServiceCategory.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/enums/ServiceStatus.d.ts +0 -6
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/enums/ServiceStatus.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/enums/ServiceType.d.ts +0 -7
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/enums/ServiceType.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/exceptions/InvalidServiceCategoryError.d.ts +0 -8
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/exceptions/InvalidServiceCategoryError.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/exceptions/InvalidServiceStatusError.d.ts +0 -8
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/exceptions/InvalidServiceStatusError.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/exceptions/InvalidServiceTypeError.d.ts +0 -8
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/exceptions/InvalidServiceTypeError.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/repository/IServiceRepository.d.ts +0 -22
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/repository/IServiceRepository.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/types/ServicePrimitives.d.ts +0 -35
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/types/ServicePrimitives.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/types/ServiceProps.d.ts +0 -35
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/types/ServiceProps.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceAdditionalUserRoles.d.ts +0 -71
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceAdditionalUserRoles.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceAllowsDocumentReading.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceAllowsDocumentReading.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceAllowsSectoralComparison.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceAllowsSectoralComparison.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceBasePricePercentage.d.ts +0 -54
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceBasePricePercentage.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceCategory.d.ts +0 -123
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceCategory.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceCode.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceCode.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceCreatedByStakeholder.d.ts +0 -11
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceCreatedByStakeholder.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceDependsOnServiceCode.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceDependsOnServiceCode.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceDescription.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceDescription.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceExpertDedicationLevel.d.ts +0 -92
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceExpertDedicationLevel.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceFixedPriceAmount.d.ts +0 -83
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceFixedPriceAmount.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceHasBasePrice.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceHasBasePrice.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceHasFixedPrice.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceHasFixedPrice.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceId.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceId.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIncludesCarbonBoxAcademy.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIncludesCarbonBoxAcademy.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIncludesESGIndicators.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIncludesESGIndicators.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsAvailableForCorporate.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsAvailableForCorporate.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsAvailableForEvent.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsAvailableForEvent.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsAvailableForProduct.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsAvailableForProduct.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsRequiredService.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceIsRequiredService.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceMaxUsers.d.ts +0 -99
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceMaxUsers.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceName.d.ts +0 -9
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceName.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceReportTypes.d.ts +0 -119
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceReportTypes.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceStatus.d.ts +0 -110
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceStatus.d.ts.map +0 -1
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceType.d.ts +0 -111
- package/build/types/carbonbox/purchase-management-system/service-catalog/domain/value-objects/ServiceType.d.ts.map +0 -1
- package/build/types/carbonbox/shared/domain/exceptions/InvalidSemanticUuidError.d.ts +0 -8
- package/build/types/carbonbox/shared/domain/exceptions/InvalidSemanticUuidError.d.ts.map +0 -1
- package/build/types/carbonbox/shared/domain/services/DateTimeFormattingDomainService.d.ts +0 -95
- package/build/types/carbonbox/shared/domain/services/DateTimeFormattingDomainService.d.ts.map +0 -1
- package/build/types/carbonbox/shared/domain/services/contracts/ISemanticUuidDomainService.d.ts +0 -85
- package/build/types/carbonbox/shared/domain/services/contracts/ISemanticUuidDomainService.d.ts.map +0 -1
- package/build/types/carbonbox/shared/domain/services/implementations/SemanticUuidDomainService.d.ts +0 -67
- package/build/types/carbonbox/shared/domain/services/implementations/SemanticUuidDomainService.d.ts.map +0 -1
- package/build/types/carbonbox/shared/domain/types/AllPermissions.d.ts +0 -12
- package/build/types/carbonbox/shared/domain/types/AllPermissions.d.ts.map +0 -1
- package/build/types/carbonbox/shared/domain/types/AllPermissionsPrimitives.d.ts +0 -12
- package/build/types/carbonbox/shared/domain/types/AllPermissionsPrimitives.d.ts.map +0 -1
- package/build/types/carbonbox/shared/domain/types/ServiceReference.d.ts +0 -8
- package/build/types/carbonbox/shared/domain/types/ServiceReference.d.ts.map +0 -1
- package/build/types/carbonbox/shared/domain/types/ServiceReferencePrimitives.d.ts +0 -8
- package/build/types/carbonbox/shared/domain/types/ServiceReferencePrimitives.d.ts.map +0 -1
- package/build/types/carbonbox/shared/domain/types/UserEmailProps.d.ts +0 -5
- package/build/types/carbonbox/shared/domain/types/UserEmailProps.d.ts.map +0 -1
- package/build/types/carbonbox/shared/domain/value-objects/ServiceReference.d.ts +0 -134
- package/build/types/carbonbox/shared/domain/value-objects/ServiceReference.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPermissions.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPermissions.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPermissionsPrimitives.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPermissionsPrimitives.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPermissionsValue.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-clients/domain/types/CarbonClientPermissionsValue.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPermissions.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPermissions.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPermissionsPrimitives.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPermissionsPrimitives.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPermissionsValue.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-coordinators/domain/types/CarbonCoordinatorPermissionsValue.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPermissions.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPermissions.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPermissionsPrimitives.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPermissionsPrimitives.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPermissionsValue.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-host/domain/types/CarbonHostPermissionsValue.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPermissions.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPermissions.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPermissionsPrimitives.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPermissionsPrimitives.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPermissionsValue.d.ts +0 -3
- package/build/types/carbonbox/stakeholders/carbon-managers/domain/types/CarbonManagerPermissionsValue.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/shared/domain/enums/StakeholderBusinessStatus.d.ts +0 -7
- package/build/types/carbonbox/stakeholders/shared/domain/enums/StakeholderBusinessStatus.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/shared/domain/exceptions/InvalidStakeholderBusinessStatusError.d.ts +0 -7
- package/build/types/carbonbox/stakeholders/shared/domain/exceptions/InvalidStakeholderBusinessStatusError.d.ts.map +0 -1
- package/build/types/carbonbox/stakeholders/shared/domain/types/StakeholderPermissions.d.ts +0 -10
- package/build/types/carbonbox/stakeholders/shared/domain/types/StakeholderPermissions.d.ts.map +0 -1
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidSemanticUuidError = void 0;
|
|
4
|
-
const RootError_1 = require("./RootError");
|
|
5
|
-
class InvalidSemanticUuidError extends RootError_1.RootError {
|
|
6
|
-
constructor(semanticUuid, propertyName) {
|
|
7
|
-
const message = `The semantic UUID "${semanticUuid}" violates the domain policy - ${InvalidSemanticUuidError.INVALID_SEMANTIC_UUID_ERROR_MESSAGE}. Property: ${propertyName}`;
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = 'InvalidSemanticUuidError';
|
|
10
|
-
}
|
|
11
|
-
static create(semanticUuid, propertyName) {
|
|
12
|
-
return new InvalidSemanticUuidError(semanticUuid, propertyName);
|
|
13
|
-
}
|
|
14
|
-
logError() {
|
|
15
|
-
return `${this.name}: ${this.message}`;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.InvalidSemanticUuidError = InvalidSemanticUuidError;
|
|
19
|
-
InvalidSemanticUuidError.INVALID_SEMANTIC_UUID_ERROR_MESSAGE = 'Invalid semantic UUID format. Expected: PREFIX_EntityType_UUID (e.g., ADC-SUB_ActivityDataSubmission_550e8400-e29b-41d4-a716-446655440000)';
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DateTimeFormattingDomainService = void 0;
|
|
4
|
-
const InvalidDateFormatError_1 = require("../exceptions/InvalidDateFormatError");
|
|
5
|
-
const DateString_1 = require("../value-objects/DateString");
|
|
6
|
-
const DateTimeString_1 = require("../value-objects/DateTimeString");
|
|
7
|
-
/**
|
|
8
|
-
* Domain Service for date and datetime formatting and validation operations.
|
|
9
|
-
* Provides centralized business logic for date/datetime handling across the domain.
|
|
10
|
-
*/
|
|
11
|
-
class DateTimeFormattingDomainService {
|
|
12
|
-
/**
|
|
13
|
-
* Validates if a date string has the correct format (DD/MM/YYYY)
|
|
14
|
-
* @param dateValue The date string to validate
|
|
15
|
-
* @returns true if the format is valid, false otherwise
|
|
16
|
-
*/
|
|
17
|
-
static isValidDateFormat(dateValue) {
|
|
18
|
-
return this.DATE_REGEX.test(dateValue);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Validates if a datetime string has the correct format (DD/MM/YYYY HH:mm:ss)
|
|
22
|
-
* @param dateTimeValue The datetime string to validate
|
|
23
|
-
* @returns true if the format is valid, false otherwise
|
|
24
|
-
*/
|
|
25
|
-
static isValidDateTimeFormat(dateTimeValue) {
|
|
26
|
-
return this.DATETIME_REGEX.test(dateTimeValue);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Formats a Date object to a date string (DD/MM/YYYY)
|
|
30
|
-
* @param date The Date object to format
|
|
31
|
-
* @returns The formatted date string
|
|
32
|
-
*/
|
|
33
|
-
static formatDateToString(date) {
|
|
34
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
35
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
36
|
-
const year = date.getFullYear();
|
|
37
|
-
return `${day}/${month}/${year}`;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Formats a Date object to a datetime string (DD/MM/YYYY HH:mm:ss)
|
|
41
|
-
* @param date The Date object to format
|
|
42
|
-
* @returns The formatted datetime string
|
|
43
|
-
*/
|
|
44
|
-
static formatDateTimeToString(date) {
|
|
45
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
46
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
47
|
-
const year = date.getFullYear();
|
|
48
|
-
const hours = String(date.getHours()).padStart(2, '0');
|
|
49
|
-
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
50
|
-
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
51
|
-
return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Gets the current date formatted as a string (DD/MM/YYYY)
|
|
55
|
-
* @returns The current date as a formatted string
|
|
56
|
-
*/
|
|
57
|
-
static getCurrentDateString() {
|
|
58
|
-
return this.formatDateToString(new Date());
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Gets the current datetime formatted as a string (DD/MM/YYYY HH:mm:ss)
|
|
62
|
-
* @returns The current datetime as a formatted string
|
|
63
|
-
*/
|
|
64
|
-
static getCurrentDateTimeString() {
|
|
65
|
-
return this.formatDateTimeToString(new Date());
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Parses a date string (DD/MM/YYYY) to a Date object
|
|
69
|
-
* @param dateString The date string to parse
|
|
70
|
-
* @returns The parsed Date object
|
|
71
|
-
* @throws InvalidDateFormatError if the format is invalid
|
|
72
|
-
*/
|
|
73
|
-
static parseDateString(dateString) {
|
|
74
|
-
if (!this.isValidDateFormat(dateString)) {
|
|
75
|
-
throw InvalidDateFormatError_1.InvalidDateFormatError.create(dateString, DateString_1.DateString.getDateFormat());
|
|
76
|
-
}
|
|
77
|
-
const [day, month, year] = dateString.split('/').map(Number);
|
|
78
|
-
return new Date(year, month - 1, day);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Parses a datetime string (DD/MM/YYYY HH:mm:ss) to a Date object
|
|
82
|
-
* @param dateTimeString The datetime string to parse
|
|
83
|
-
* @returns The parsed Date object
|
|
84
|
-
* @throws InvalidDateFormatError if the format is invalid
|
|
85
|
-
*/
|
|
86
|
-
static parseDateTimeString(dateTimeString) {
|
|
87
|
-
if (!this.isValidDateTimeFormat(dateTimeString)) {
|
|
88
|
-
throw InvalidDateFormatError_1.InvalidDateFormatError.create(dateTimeString, DateTimeString_1.DateTimeString.getDateTimeFormat());
|
|
89
|
-
}
|
|
90
|
-
const [datePart, timePart] = dateTimeString.split(' ');
|
|
91
|
-
const [day, month, year] = datePart.split('/').map(Number);
|
|
92
|
-
const [hours, minutes, seconds] = timePart.split(':').map(Number);
|
|
93
|
-
return new Date(year, month - 1, day, hours, minutes, seconds);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Validates if a date string represents a valid calendar date
|
|
97
|
-
* @param dateString The date string to validate
|
|
98
|
-
* @returns true if the date is valid, false otherwise
|
|
99
|
-
*/
|
|
100
|
-
static isValidDate(dateString) {
|
|
101
|
-
if (!this.isValidDateFormat(dateString)) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
try {
|
|
105
|
-
const date = this.parseDateString(dateString);
|
|
106
|
-
const reformattedDate = this.formatDateToString(date);
|
|
107
|
-
return reformattedDate === dateString;
|
|
108
|
-
}
|
|
109
|
-
catch {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Validates if a datetime string represents a valid calendar datetime
|
|
115
|
-
* @param dateTimeString The datetime string to validate
|
|
116
|
-
* @returns true if the datetime is valid, false otherwise
|
|
117
|
-
*/
|
|
118
|
-
static isValidDateTime(dateTimeString) {
|
|
119
|
-
if (!this.isValidDateTimeFormat(dateTimeString)) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
const date = this.parseDateTimeString(dateTimeString);
|
|
124
|
-
const reformattedDateTime = this.formatDateTimeToString(date);
|
|
125
|
-
return reformattedDateTime === dateTimeString;
|
|
126
|
-
}
|
|
127
|
-
catch {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Compares two date strings
|
|
133
|
-
* @param dateString1 First date string
|
|
134
|
-
* @param dateString2 Second date string
|
|
135
|
-
* @returns negative if first is earlier, positive if later, 0 if equal
|
|
136
|
-
* @throws InvalidDateFormatError if any format is invalid
|
|
137
|
-
*/
|
|
138
|
-
static compareDates(dateString1, dateString2) {
|
|
139
|
-
const date1 = this.parseDateString(dateString1);
|
|
140
|
-
const date2 = this.parseDateString(dateString2);
|
|
141
|
-
return date1.getTime() - date2.getTime();
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Compares two datetime strings
|
|
145
|
-
* @param dateTimeString1 First datetime string
|
|
146
|
-
* @param dateTimeString2 Second datetime string
|
|
147
|
-
* @returns negative if first is earlier, positive if later, 0 if equal
|
|
148
|
-
* @throws InvalidDateFormatError if any format is invalid
|
|
149
|
-
*/
|
|
150
|
-
static compareDateTimes(dateTimeString1, dateTimeString2) {
|
|
151
|
-
const date1 = this.parseDateTimeString(dateTimeString1);
|
|
152
|
-
const date2 = this.parseDateTimeString(dateTimeString2);
|
|
153
|
-
return date1.getTime() - date2.getTime();
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Gets the supported date format string
|
|
157
|
-
* @returns The date format string
|
|
158
|
-
*/
|
|
159
|
-
static getDateFormat() {
|
|
160
|
-
return DateString_1.DateString.getDateFormat();
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Gets the supported datetime format string
|
|
164
|
-
* @returns The datetime format string
|
|
165
|
-
*/
|
|
166
|
-
static getDateTimeFormat() {
|
|
167
|
-
return DateTimeString_1.DateTimeString.getDateTimeFormat();
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
exports.DateTimeFormattingDomainService = DateTimeFormattingDomainService;
|
|
171
|
-
DateTimeFormattingDomainService.DATE_REGEX = /^([0-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/\d{4}$/;
|
|
172
|
-
DateTimeFormattingDomainService.DATETIME_REGEX = /^([0-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/\d{4} ([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/;
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SemanticUuidDomainService = void 0;
|
|
4
|
-
const either_1 = require("../../../either");
|
|
5
|
-
const SemanticUuidPrefix_1 = require("../../enums/SemanticUuidPrefix");
|
|
6
|
-
const InvalidSemanticUuidError_1 = require("../../exceptions/InvalidSemanticUuidError");
|
|
7
|
-
const UnknownBoundedContextCodeError_1 = require("../../exceptions/UnknownBoundedContextCodeError");
|
|
8
|
-
const InvalidSemanticUuidFormatError_1 = require("../../exceptions/InvalidSemanticUuidFormatError");
|
|
9
|
-
const InvalidUuidFormatError_1 = require("../../exceptions/InvalidUuidFormatError");
|
|
10
|
-
/**
|
|
11
|
-
* Domain Service for semantic UUID parsing, validation and business logic operations.
|
|
12
|
-
* Provides centralized business logic for semantic UUID handling across the domain.
|
|
13
|
-
* Refactored to support dependency injection and Either pattern for error handling.
|
|
14
|
-
*
|
|
15
|
-
* This service maintains Value Object purity by being used in factories,
|
|
16
|
-
* application services, and other appropriate contexts.
|
|
17
|
-
*/
|
|
18
|
-
class SemanticUuidDomainService {
|
|
19
|
-
constructor() {
|
|
20
|
-
// Semantic UUID format: BC_UUID or BC-SUB1-SUB2-...SUBn_UUID
|
|
21
|
-
this.SEMANTIC_UUID_REGEX = /^[A-Z]{3}(-[A-Z]{3})*_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
22
|
-
// Standard UUID v4 regex
|
|
23
|
-
this.UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
24
|
-
// Private constructor to enforce factory pattern
|
|
25
|
-
}
|
|
26
|
-
static create() {
|
|
27
|
-
return new SemanticUuidDomainService();
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Validates if a string is a valid semantic UUID prefix
|
|
31
|
-
*/
|
|
32
|
-
isValidPrefix(prefix) {
|
|
33
|
-
return either_1.EitherFactory.fromTryCatch(() => {
|
|
34
|
-
if (typeof prefix !== 'string') {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
return Object.values(SemanticUuidPrefix_1.SemanticUuidPrefix).includes(prefix);
|
|
38
|
-
}, (error) => {
|
|
39
|
-
if (error instanceof InvalidSemanticUuidError_1.InvalidSemanticUuidError) {
|
|
40
|
-
return error;
|
|
41
|
-
}
|
|
42
|
-
return InvalidSemanticUuidError_1.InvalidSemanticUuidError.create(prefix, 'Failed to validate prefix');
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Gets the bounded context name from a semantic UUID prefix
|
|
47
|
-
*/
|
|
48
|
-
getBoundedContext(prefix) {
|
|
49
|
-
return either_1.EitherFactory.fromTryCatch(() => {
|
|
50
|
-
const contextCode = prefix.split('-')[0];
|
|
51
|
-
const contextMap = {
|
|
52
|
-
ADC: 'ActivityDataCollection',
|
|
53
|
-
CFC: 'CarbonFootprintConfigurations',
|
|
54
|
-
CPR: 'CompanyResources',
|
|
55
|
-
ECF: 'EmissionCalculationFormulas',
|
|
56
|
-
ECP: 'EmissionCalculationProcess',
|
|
57
|
-
ECR: 'EmissionCalculationResults',
|
|
58
|
-
USR: 'Users',
|
|
59
|
-
SHR: 'Shared',
|
|
60
|
-
STC: 'SystemTechnicalConfiguration',
|
|
61
|
-
};
|
|
62
|
-
const result = contextMap[contextCode];
|
|
63
|
-
if (!result) {
|
|
64
|
-
throw UnknownBoundedContextCodeError_1.UnknownBoundedContextCodeError.create(contextCode, prefix);
|
|
65
|
-
}
|
|
66
|
-
return result;
|
|
67
|
-
}, (error) => InvalidSemanticUuidError_1.InvalidSemanticUuidError.create(prefix, `Failed to get bounded context: ${error}`));
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Gets the subdomain from a semantic UUID prefix
|
|
71
|
-
*/
|
|
72
|
-
getSubdomain(prefix) {
|
|
73
|
-
return either_1.EitherFactory.fromTryCatch(() => {
|
|
74
|
-
const parts = prefix.split('-');
|
|
75
|
-
if (parts.length === 1) {
|
|
76
|
-
return ''; // BC-level entity has no subdomain
|
|
77
|
-
}
|
|
78
|
-
return parts.slice(1).join('-'); // Join all subdomain parts
|
|
79
|
-
}, (error) => InvalidSemanticUuidError_1.InvalidSemanticUuidError.create(prefix, `Failed to get subdomain: ${error}`));
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Gets all available prefixes as an array
|
|
83
|
-
*/
|
|
84
|
-
getAllPrefixes() {
|
|
85
|
-
return either_1.EitherFactory.fromTryCatch(() => Object.values(SemanticUuidPrefix_1.SemanticUuidPrefix).sort(), (error) => InvalidSemanticUuidError_1.InvalidSemanticUuidError.create('', `Failed to get all prefixes: ${error}`));
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Gets prefixes by bounded context
|
|
89
|
-
*/
|
|
90
|
-
getPrefixesByBoundedContext(boundedContext) {
|
|
91
|
-
return either_1.EitherFactory.fromTryCatch(() => {
|
|
92
|
-
const contextMap = {
|
|
93
|
-
ActivityDataCollection: [
|
|
94
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_SUBMISSIONS,
|
|
95
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_FIELDS,
|
|
96
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_LOGIC,
|
|
97
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_LABELS,
|
|
98
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_FORMS,
|
|
99
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ADC_ADAPTATIONS,
|
|
100
|
-
],
|
|
101
|
-
CarbonFootprintConfigurations: [
|
|
102
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.CFC_CORPORATE,
|
|
103
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.CFC_EVENT,
|
|
104
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.CFC_PRODUCT,
|
|
105
|
-
],
|
|
106
|
-
CompanyResources: [
|
|
107
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.CPR_EVENTS,
|
|
108
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.CPR_FACILITIES,
|
|
109
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.CPR_PRODUCTS,
|
|
110
|
-
],
|
|
111
|
-
EmissionCalculationFormulas: [
|
|
112
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ECF_VARIABLES,
|
|
113
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ECF_FACTORS,
|
|
114
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ECF_GWP,
|
|
115
|
-
],
|
|
116
|
-
EmissionCalculationProcess: [
|
|
117
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ECP_JOBS,
|
|
118
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ECP_PROCESSES,
|
|
119
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ECP_WORKFLOWS,
|
|
120
|
-
],
|
|
121
|
-
EmissionCalculationResults: [
|
|
122
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ECR_AGGREGATIONS,
|
|
123
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ECR_CALCULATIONS,
|
|
124
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.ECR_GHG_RESULTS,
|
|
125
|
-
],
|
|
126
|
-
Users: [
|
|
127
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.USR,
|
|
128
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_CLIENT,
|
|
129
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_COORDINATOR,
|
|
130
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_HOST,
|
|
131
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.USR_STH_MANAGER,
|
|
132
|
-
],
|
|
133
|
-
Shared: [
|
|
134
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.SHR_DOMAIN,
|
|
135
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.SHR_EITHER,
|
|
136
|
-
],
|
|
137
|
-
SystemTechnicalConfiguration: [
|
|
138
|
-
SemanticUuidPrefix_1.SemanticUuidPrefix.STC,
|
|
139
|
-
],
|
|
140
|
-
};
|
|
141
|
-
return contextMap[boundedContext] || [];
|
|
142
|
-
}, (error) => InvalidSemanticUuidError_1.InvalidSemanticUuidError.create(boundedContext, `Failed to get prefixes for bounded context: ${error}`));
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Validates a complete semantic UUID format
|
|
146
|
-
*/
|
|
147
|
-
validateSemanticUuidFormat(semanticUuid) {
|
|
148
|
-
return either_1.EitherFactory.fromTryCatch(() => {
|
|
149
|
-
if (typeof semanticUuid !== 'string') {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
return this.SEMANTIC_UUID_REGEX.test(semanticUuid);
|
|
153
|
-
}, (error) => InvalidSemanticUuidError_1.InvalidSemanticUuidError.create(semanticUuid, `Failed to validate semantic UUID format: ${error}`));
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Extracts and validates the prefix from a semantic UUID
|
|
157
|
-
*/
|
|
158
|
-
extractPrefix(semanticUuid) {
|
|
159
|
-
return either_1.EitherFactory.fromTryCatch(() => {
|
|
160
|
-
const parts = semanticUuid.split('_');
|
|
161
|
-
if (parts.length !== 2) {
|
|
162
|
-
throw InvalidSemanticUuidFormatError_1.InvalidSemanticUuidFormatError.create(semanticUuid, 'must contain exactly one underscore');
|
|
163
|
-
}
|
|
164
|
-
return parts[0];
|
|
165
|
-
}, (error) => InvalidSemanticUuidError_1.InvalidSemanticUuidError.create(semanticUuid, `Failed to extract prefix: ${error}`));
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Extracts and validates the UUID from a semantic UUID
|
|
169
|
-
*/
|
|
170
|
-
extractUuid(semanticUuid) {
|
|
171
|
-
return either_1.EitherFactory.fromTryCatch(() => {
|
|
172
|
-
const parts = semanticUuid.split('_');
|
|
173
|
-
if (parts.length !== 2) {
|
|
174
|
-
throw InvalidSemanticUuidFormatError_1.InvalidSemanticUuidFormatError.create(semanticUuid, 'must contain exactly one underscore');
|
|
175
|
-
}
|
|
176
|
-
const uuid = parts[1];
|
|
177
|
-
if (!this.UUID_REGEX.test(uuid)) {
|
|
178
|
-
throw InvalidUuidFormatError_1.InvalidUuidFormatError.create(uuid, semanticUuid);
|
|
179
|
-
}
|
|
180
|
-
return uuid;
|
|
181
|
-
}, (error) => InvalidSemanticUuidError_1.InvalidSemanticUuidError.create(semanticUuid, `Failed to extract UUID: ${error}`));
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Extracts the bounded context code (first 3 letters) from a semantic UUID
|
|
185
|
-
*/
|
|
186
|
-
extractBoundedContextCode(semanticUuid) {
|
|
187
|
-
return either_1.EitherFactory.fromTryCatch(() => {
|
|
188
|
-
const prefixResult = this.extractPrefix(semanticUuid);
|
|
189
|
-
const prefix = prefixResult.fold((error) => { throw error; }, (p) => p);
|
|
190
|
-
return prefix.substring(0, 3);
|
|
191
|
-
}, (error) => InvalidSemanticUuidError_1.InvalidSemanticUuidError.create(semanticUuid, `Failed to extract bounded context code: ${error}`));
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Extracts all subdomain parts from a semantic UUID
|
|
195
|
-
*/
|
|
196
|
-
extractSubdomains(semanticUuid) {
|
|
197
|
-
return either_1.EitherFactory.fromTryCatch(() => {
|
|
198
|
-
const prefixResult = this.extractPrefix(semanticUuid);
|
|
199
|
-
const prefix = prefixResult.fold((error) => { throw error; }, (p) => p);
|
|
200
|
-
const parts = prefix.split('-');
|
|
201
|
-
// Remove the first part (BC) and return the rest (SUB1, SUB2, ...)
|
|
202
|
-
return parts.slice(1);
|
|
203
|
-
}, (error) => InvalidSemanticUuidError_1.InvalidSemanticUuidError.create(semanticUuid, `Failed to extract subdomains: ${error}`));
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Checks if a semantic UUID has subdomains or is BC-level only
|
|
207
|
-
*/
|
|
208
|
-
hasSubdomains(semanticUuid) {
|
|
209
|
-
return either_1.EitherFactory.fromTryCatch(() => {
|
|
210
|
-
const subdomainsResult = this.extractSubdomains(semanticUuid);
|
|
211
|
-
const subdomains = subdomainsResult.fold((error) => { throw error; }, (subs) => subs);
|
|
212
|
-
return subdomains.length > 0;
|
|
213
|
-
}, (error) => InvalidSemanticUuidError_1.InvalidSemanticUuidError.create(semanticUuid, `Failed to check subdomains: ${error}`));
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Creates a human-readable log representation of a semantic UUID
|
|
217
|
-
*/
|
|
218
|
-
toLogString(semanticUuid) {
|
|
219
|
-
return either_1.EitherFactory.fromTryCatch(() => {
|
|
220
|
-
const uuidResult = this.extractUuid(semanticUuid);
|
|
221
|
-
const uuid = uuidResult.fold((error) => { throw error; }, (u) => u);
|
|
222
|
-
const boundedContextResult = this.extractBoundedContextCode(semanticUuid);
|
|
223
|
-
const boundedContextCode = boundedContextResult.fold((error) => { throw error; }, (bc) => bc);
|
|
224
|
-
const subdomainsResult = this.extractSubdomains(semanticUuid);
|
|
225
|
-
const subdomains = subdomainsResult.fold((error) => { throw error; }, (subs) => subs);
|
|
226
|
-
if (subdomains.length === 0) {
|
|
227
|
-
// BC-level entity (e.g., STC_uuid)
|
|
228
|
-
return `[${boundedContextCode}] (${uuid.substring(0, 8)}...)`;
|
|
229
|
-
}
|
|
230
|
-
// Subdomain entity (e.g., USR-STH-CHO_uuid)
|
|
231
|
-
return `[${boundedContextCode}:${subdomains.join(':')}] (${uuid.substring(0, 8)}...)`;
|
|
232
|
-
}, (error) => InvalidSemanticUuidError_1.InvalidSemanticUuidError.create(semanticUuid, `Failed to create log string: ${error}`));
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
exports.SemanticUuidDomainService = SemanticUuidDomainService;
|