@carbonbox/domain 0.14.0 → 0.16.1
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/purchase-management-system/purchase-contracts/domain/events/PurchaseContractActivatedDomainEvent.js +38 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractCancelledDomainEvent.js +38 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractExpiredDomainEvent.js +38 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractRenewedDomainEvent.js +38 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractServiceAddedDomainEvent.js +38 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractServiceRemovedDomainEvent.js +38 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractSuspendedDomainEvent.js +38 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractActivatedPayload.js +2 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractCancelledPayload.js +2 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractExpiredPayload.js +2 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractRenewedPayload.js +2 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractServiceAddedPayload.js +2 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractServiceRemovedPayload.js +2 -0
- package/build/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractSuspendedPayload.js +2 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/entity/CompanyServiceEntitlement.js +171 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/entity/ICompanyServiceEntitlement.js +2 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/policies/ServiceCapabilityPolicy.js +208 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/repository/ICompanyServiceEntitlementRepository.js +2 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/types/CompanyServiceEntitlementPrimitives.js +2 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/types/CompanyServiceEntitlementProjection.js +2 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/types/CompanyServiceEntitlementProps.js +2 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/types/EntitlementInputContract.js +2 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/types/EntitlementInputServiceCatalog.js +2 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementActiveServiceCodes.js +25 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementAdditionalUserRoles.js +22 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementAllowsDocumentReading.js +22 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementAllowsSectoralComparison.js +22 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementCarbonClientId.js +24 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementId.js +48 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIncludesCarbonBoxAcademy.js +22 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIncludesEsgIndicators.js +22 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIsAvailableForCorporate.js +22 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIsAvailableForEvent.js +22 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIsAvailableForProduct.js +22 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementMaxUsers.js +29 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementSourceContractIds.js +22 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementValidFrom.js +24 -0
- package/build/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementValidTo.js +21 -0
- package/build/carbonbox/shared/domain/enums/SemanticUuidPrefix.js +1 -0
- package/build/carbonbox/shared/domain/exceptions/RootError.js +1 -3
- package/build/carbonbox/shared/domain/value-objects/PositiveInteger.js +2 -8
- package/build/carbonbox/shared/domain/value-objects/ValueObject.js +2 -8
- package/build/main/index.js +51 -1
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractActivatedDomainEvent.d.ts +15 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractActivatedDomainEvent.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractCancelledDomainEvent.d.ts +15 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractCancelledDomainEvent.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractExpiredDomainEvent.d.ts +15 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractExpiredDomainEvent.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractRenewedDomainEvent.d.ts +15 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractRenewedDomainEvent.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractServiceAddedDomainEvent.d.ts +15 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractServiceAddedDomainEvent.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractServiceRemovedDomainEvent.d.ts +15 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractServiceRemovedDomainEvent.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractSuspendedDomainEvent.d.ts +15 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/events/PurchaseContractSuspendedDomainEvent.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractActivatedPayload.d.ts +23 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractActivatedPayload.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractCancelledPayload.d.ts +16 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractCancelledPayload.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractExpiredPayload.d.ts +17 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractExpiredPayload.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractRenewedPayload.d.ts +18 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractRenewedPayload.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractServiceAddedPayload.d.ts +17 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractServiceAddedPayload.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractServiceRemovedPayload.d.ts +18 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractServiceRemovedPayload.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractSuspendedPayload.d.ts +18 -0
- package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/types/PurchaseContractSuspendedPayload.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/entity/CompanyServiceEntitlement.d.ts +40 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/entity/CompanyServiceEntitlement.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/entity/ICompanyServiceEntitlement.d.ts +32 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/entity/ICompanyServiceEntitlement.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/policies/ServiceCapabilityPolicy.d.ts +77 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/policies/ServiceCapabilityPolicy.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/repository/ICompanyServiceEntitlementRepository.d.ts +12 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/repository/ICompanyServiceEntitlementRepository.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/types/CompanyServiceEntitlementPrimitives.d.ts +18 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/types/CompanyServiceEntitlementPrimitives.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/types/CompanyServiceEntitlementProjection.d.ts +30 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/types/CompanyServiceEntitlementProjection.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/types/CompanyServiceEntitlementProps.d.ts +18 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/types/CompanyServiceEntitlementProps.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/types/EntitlementInputContract.d.ts +30 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/types/EntitlementInputContract.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/types/EntitlementInputServiceCatalog.d.ts +32 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/types/EntitlementInputServiceCatalog.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementActiveServiceCodes.d.ts +10 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementActiveServiceCodes.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementAdditionalUserRoles.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementAdditionalUserRoles.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementAllowsDocumentReading.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementAllowsDocumentReading.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementAllowsSectoralComparison.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementAllowsSectoralComparison.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementCarbonClientId.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementCarbonClientId.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementId.d.ts +11 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementId.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIncludesCarbonBoxAcademy.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIncludesCarbonBoxAcademy.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIncludesEsgIndicators.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIncludesEsgIndicators.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIsAvailableForCorporate.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIsAvailableForCorporate.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIsAvailableForEvent.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIsAvailableForEvent.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIsAvailableForProduct.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementIsAvailableForProduct.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementMaxUsers.d.ts +10 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementMaxUsers.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementSourceContractIds.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementSourceContractIds.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementValidFrom.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementValidFrom.d.ts.map +1 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementValidTo.d.ts +9 -0
- package/build/types/carbonbox/purchase-management-system/service-entitlements/domain/value-objects/CompanyServiceEntitlementValidTo.d.ts.map +1 -0
- package/build/types/carbonbox/shared/domain/enums/SemanticUuidPrefix.d.ts +1 -0
- package/build/types/carbonbox/shared/domain/enums/SemanticUuidPrefix.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/exceptions/RootError.d.ts +1 -1
- package/build/types/carbonbox/shared/domain/exceptions/RootError.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/PositiveInteger.d.ts +2 -2
- package/build/types/carbonbox/shared/domain/value-objects/PositiveInteger.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/value-objects/ValueObject.d.ts +2 -2
- package/build/types/carbonbox/shared/domain/value-objects/ValueObject.d.ts.map +1 -1
- package/build/types/main/index.d.ts +38 -0
- package/build/types/main/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceCapabilityPolicy = void 0;
|
|
4
|
+
const ContractStatus_1 = require("../../../purchase-contracts/domain/enums/ContractStatus");
|
|
5
|
+
const ServiceCatalogType_1 = require("../../../service-catalog/domain/enums/ServiceCatalogType");
|
|
6
|
+
/**
|
|
7
|
+
* Pure domain service that decides what a `CarbonClient` is entitled
|
|
8
|
+
* to USE today, given its purchase contracts and the catalogs they
|
|
9
|
+
* reference.
|
|
10
|
+
*
|
|
11
|
+
* Why this exists: the truth of "what services has this client
|
|
12
|
+
* bought" is spread across `PurchaseContract` + `ServiceCatalog`. The
|
|
13
|
+
* functional modules (carbon footprint configurations,
|
|
14
|
+
* activity-data-collection, ...) need a single decoded answer they
|
|
15
|
+
* can gate on. This policy collapses N contracts × M services into
|
|
16
|
+
* a single `CompanyServiceEntitlementProjection` ready to persist as
|
|
17
|
+
* the `CompanyServiceEntitlement` read model.
|
|
18
|
+
*
|
|
19
|
+
* Rules enforced (matches DT-62 plan §Pieza 1 / §Política de mapeo):
|
|
20
|
+
* - Only contracts in `ACTIVE` status grant entitlements. Other
|
|
21
|
+
* statuses (`DRAFT`, `PENDING_SIGNATURE`, `FULLY_SIGNED`,
|
|
22
|
+
* `SUSPENDED`, `COMPLETED`, `CANCELLED`, `EXPIRED`) contribute
|
|
23
|
+
* nothing — even `FULLY_SIGNED` does not grant until activation.
|
|
24
|
+
* - A `DEPENDENT_SERVICE` only grants entitlement if its parent
|
|
25
|
+
* (`dependsOnServiceCode`) is granted by some other contract
|
|
26
|
+
* service in the same active set.
|
|
27
|
+
* - Capability flags are OR-merged across contracts: a single
|
|
28
|
+
* contract granting the capability is enough.
|
|
29
|
+
* - `maxUsers` is the MAX across catalogs that define it (the more
|
|
30
|
+
* generous contract wins). `null` everywhere → `null`.
|
|
31
|
+
* - `additionalUserRoles` is the de-duplicated union across catalogs.
|
|
32
|
+
* - `validFrom` is the EARLIEST `startDate` and `validTo` the LATEST
|
|
33
|
+
* `endDate` across entitling contracts, lifted from the contract's
|
|
34
|
+
* date-only granularity (`DD/MM/YYYY`) to the projection's datetime
|
|
35
|
+
* granularity (`DD/MM/YYYY HH:mm:ss`) at start-of-day / end-of-day.
|
|
36
|
+
* If any entitling contract has no end date the projection's
|
|
37
|
+
* `validTo` is `null`.
|
|
38
|
+
*
|
|
39
|
+
* The policy is intentionally a pure function — it does not load
|
|
40
|
+
* data, throw, or mutate. Errors of shape (e.g. inconsistent input)
|
|
41
|
+
* are surfaced by callers, not by this class.
|
|
42
|
+
*/
|
|
43
|
+
class ServiceCapabilityPolicy {
|
|
44
|
+
constructor() {
|
|
45
|
+
// Static-only — not instantiable.
|
|
46
|
+
}
|
|
47
|
+
static computeEntitlement(carbonClientId, contracts, catalogsByCode) {
|
|
48
|
+
const entitlingContracts = contracts.filter((contract) => ServiceCapabilityPolicy.ENTITLING_STATUSES.includes(contract.status));
|
|
49
|
+
if (entitlingContracts.length === 0) {
|
|
50
|
+
return ServiceCapabilityPolicy.emptyProjection(carbonClientId);
|
|
51
|
+
}
|
|
52
|
+
const grantedCatalogCodes = ServiceCapabilityPolicy.resolveGrantedCatalogCodes(entitlingContracts, catalogsByCode);
|
|
53
|
+
const grantedCatalogs = ServiceCapabilityPolicy.collectCatalogs(grantedCatalogCodes, catalogsByCode);
|
|
54
|
+
return {
|
|
55
|
+
carbonClientId,
|
|
56
|
+
activeServiceCodes: Array.from(grantedCatalogCodes).sort(),
|
|
57
|
+
sourceContractIds: ServiceCapabilityPolicy.collectSourceContractIds(entitlingContracts),
|
|
58
|
+
allowsDocumentReading: grantedCatalogs.some((catalog) => catalog.allowsDocumentReading),
|
|
59
|
+
allowsSectoralComparison: grantedCatalogs.some((catalog) => catalog.allowsSectoralComparison),
|
|
60
|
+
includesCarbonBoxAcademy: grantedCatalogs.some((catalog) => catalog.includesCarbonBoxAcademy),
|
|
61
|
+
includesEsgIndicators: grantedCatalogs.some((catalog) => catalog.includesEsgIndicators),
|
|
62
|
+
isAvailableForCorporate: grantedCatalogs.some((catalog) => catalog.isAvailableForCorporate),
|
|
63
|
+
isAvailableForProduct: grantedCatalogs.some((catalog) => catalog.isAvailableForProduct),
|
|
64
|
+
isAvailableForEvent: grantedCatalogs.some((catalog) => catalog.isAvailableForEvent),
|
|
65
|
+
maxUsers: ServiceCapabilityPolicy.computeMaxUsers(grantedCatalogs),
|
|
66
|
+
additionalUserRoles: ServiceCapabilityPolicy.computeAdditionalUserRoles(grantedCatalogs),
|
|
67
|
+
validFrom: ServiceCapabilityPolicy.computeValidFrom(entitlingContracts),
|
|
68
|
+
validTo: ServiceCapabilityPolicy.computeValidTo(entitlingContracts),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
static isCatalogTypeDependent(catalogType) {
|
|
72
|
+
return catalogType === ServiceCatalogType_1.ServiceCatalogType.DEPENDENT_SERVICE;
|
|
73
|
+
}
|
|
74
|
+
static resolveGrantedCatalogCodes(entitlingContracts, catalogsByCode) {
|
|
75
|
+
const candidateCodes = new Set();
|
|
76
|
+
for (const contract of entitlingContracts) {
|
|
77
|
+
for (const service of contract.services) {
|
|
78
|
+
candidateCodes.add(service.serviceCode);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const grantedCodes = new Set();
|
|
82
|
+
for (const code of candidateCodes) {
|
|
83
|
+
const catalog = catalogsByCode.get(code);
|
|
84
|
+
if (catalog !== undefined && ServiceCapabilityPolicy.isCatalogGranted(catalog, candidateCodes)) {
|
|
85
|
+
grantedCodes.add(code);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return grantedCodes;
|
|
89
|
+
}
|
|
90
|
+
static isCatalogGranted(catalog, candidateCodes) {
|
|
91
|
+
if (!ServiceCapabilityPolicy.isCatalogTypeDependent(catalog.type)) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
if (catalog.dependsOnServiceCode === null) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return candidateCodes.has(catalog.dependsOnServiceCode);
|
|
98
|
+
}
|
|
99
|
+
static collectCatalogs(grantedCatalogCodes, catalogsByCode) {
|
|
100
|
+
const collected = [];
|
|
101
|
+
for (const code of grantedCatalogCodes) {
|
|
102
|
+
const catalog = catalogsByCode.get(code);
|
|
103
|
+
if (catalog !== undefined) {
|
|
104
|
+
collected.push(catalog);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return collected;
|
|
108
|
+
}
|
|
109
|
+
static collectSourceContractIds(entitlingContracts) {
|
|
110
|
+
const ids = entitlingContracts.map((contract) => contract.contractId);
|
|
111
|
+
return Array.from(new Set(ids)).sort();
|
|
112
|
+
}
|
|
113
|
+
static computeMaxUsers(grantedCatalogs) {
|
|
114
|
+
let max = null;
|
|
115
|
+
for (const catalog of grantedCatalogs) {
|
|
116
|
+
if (catalog.maxUsers !== null && (max === null || catalog.maxUsers > max)) {
|
|
117
|
+
max = catalog.maxUsers;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return max;
|
|
121
|
+
}
|
|
122
|
+
static computeAdditionalUserRoles(grantedCatalogs) {
|
|
123
|
+
const roles = new Set();
|
|
124
|
+
for (const catalog of grantedCatalogs) {
|
|
125
|
+
for (const role of catalog.additionalUserRoles) {
|
|
126
|
+
roles.add(role);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return Array.from(roles).sort();
|
|
130
|
+
}
|
|
131
|
+
static computeValidFrom(entitlingContracts) {
|
|
132
|
+
const earliestStartDate = entitlingContracts
|
|
133
|
+
.map((contract) => contract.startDate)
|
|
134
|
+
.sort(ServiceCapabilityPolicy.compareCalendarDatesAscending)[0];
|
|
135
|
+
return ServiceCapabilityPolicy.toStartOfDayDateTime(earliestStartDate);
|
|
136
|
+
}
|
|
137
|
+
static computeValidTo(entitlingContracts) {
|
|
138
|
+
const endDates = entitlingContracts.map((contract) => contract.endDate);
|
|
139
|
+
if (endDates.some((endDate) => endDate === null || endDate === undefined || endDate === '')) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
const latestEndDate = [...endDates]
|
|
143
|
+
.sort(ServiceCapabilityPolicy.compareCalendarDatesAscending)[endDates.length - 1];
|
|
144
|
+
return ServiceCapabilityPolicy.toEndOfDayDateTime(latestEndDate);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Contract boundaries are date-only calendar dates (`DD/MM/YYYY`),
|
|
148
|
+
* but the projection's `validFrom`/`validTo` are datetime
|
|
149
|
+
* (`DD/MM/YYYY HH:mm:ss` — see `CompanyServiceEntitlementValidFrom` /
|
|
150
|
+
* `...ValidTo` value objects and the `epochStartDate()` fallback). An
|
|
151
|
+
* entitlement derived from contracts spanning whole calendar days is
|
|
152
|
+
* valid from the start of the first day through the end of the last
|
|
153
|
+
* day, so we lift the boundary accordingly. This is the single seam
|
|
154
|
+
* where date-granularity input becomes datetime-granularity output.
|
|
155
|
+
*/
|
|
156
|
+
static toStartOfDayDateTime(calendarDate) {
|
|
157
|
+
return `${calendarDate} 00:00:00`;
|
|
158
|
+
}
|
|
159
|
+
static toEndOfDayDateTime(calendarDate) {
|
|
160
|
+
return `${calendarDate} 23:59:59`;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Chronological comparator for `DD/MM/YYYY` calendar-date strings. A
|
|
164
|
+
* plain `.sort()` orders them lexicographically (day-first), which is
|
|
165
|
+
* NOT chronological (e.g. `15/01/2026` would sort after `03/02/2026`);
|
|
166
|
+
* we compare by a sortable `YYYYMMDD` key instead.
|
|
167
|
+
*/
|
|
168
|
+
static compareCalendarDatesAscending(left, right) {
|
|
169
|
+
const leftKey = ServiceCapabilityPolicy.toSortableDateKey(left);
|
|
170
|
+
const rightKey = ServiceCapabilityPolicy.toSortableDateKey(right);
|
|
171
|
+
if (leftKey < rightKey) {
|
|
172
|
+
return -1;
|
|
173
|
+
}
|
|
174
|
+
if (leftKey > rightKey) {
|
|
175
|
+
return 1;
|
|
176
|
+
}
|
|
177
|
+
return 0;
|
|
178
|
+
}
|
|
179
|
+
static toSortableDateKey(calendarDate) {
|
|
180
|
+
const [day, month, year] = calendarDate.split('/');
|
|
181
|
+
return `${year}${month}${day}`;
|
|
182
|
+
}
|
|
183
|
+
static emptyProjection(carbonClientId) {
|
|
184
|
+
return {
|
|
185
|
+
carbonClientId,
|
|
186
|
+
activeServiceCodes: [],
|
|
187
|
+
sourceContractIds: [],
|
|
188
|
+
allowsDocumentReading: false,
|
|
189
|
+
allowsSectoralComparison: false,
|
|
190
|
+
includesCarbonBoxAcademy: false,
|
|
191
|
+
includesEsgIndicators: false,
|
|
192
|
+
isAvailableForCorporate: false,
|
|
193
|
+
isAvailableForProduct: false,
|
|
194
|
+
isAvailableForEvent: false,
|
|
195
|
+
maxUsers: null,
|
|
196
|
+
additionalUserRoles: [],
|
|
197
|
+
validFrom: ServiceCapabilityPolicy.epochStartDate(),
|
|
198
|
+
validTo: null,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
static epochStartDate() {
|
|
202
|
+
return '01/01/1970 00:00:00';
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.ServiceCapabilityPolicy = ServiceCapabilityPolicy;
|
|
206
|
+
ServiceCapabilityPolicy.ENTITLING_STATUSES = [
|
|
207
|
+
ContractStatus_1.ContractStatus.ACTIVE,
|
|
208
|
+
];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementActiveServiceCodes = void 0;
|
|
4
|
+
const StringList_1 = require("../../../../shared/domain/value-objects/StringList");
|
|
5
|
+
class CompanyServiceEntitlementActiveServiceCodes extends StringList_1.StringList {
|
|
6
|
+
constructor(values, skipDomainValidation) {
|
|
7
|
+
super(values, skipDomainValidation, CompanyServiceEntitlementActiveServiceCodes.PROPERTY_NAME, { allowEmpty: true });
|
|
8
|
+
}
|
|
9
|
+
static create(values) {
|
|
10
|
+
StringList_1.StringList.guardAgainstInvalidStringList(values, CompanyServiceEntitlementActiveServiceCodes.PROPERTY_NAME);
|
|
11
|
+
return new CompanyServiceEntitlementActiveServiceCodes(values, false);
|
|
12
|
+
}
|
|
13
|
+
static fromPrimitives(primitives) {
|
|
14
|
+
const values = primitives.map((primitive) => primitive);
|
|
15
|
+
return new CompanyServiceEntitlementActiveServiceCodes(values, true);
|
|
16
|
+
}
|
|
17
|
+
includesServiceCode(serviceCode) {
|
|
18
|
+
return this.value.includes(serviceCode);
|
|
19
|
+
}
|
|
20
|
+
toPrimitives() {
|
|
21
|
+
return this.value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.CompanyServiceEntitlementActiveServiceCodes = CompanyServiceEntitlementActiveServiceCodes;
|
|
25
|
+
CompanyServiceEntitlementActiveServiceCodes.PROPERTY_NAME = 'activeServiceCodes';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementAdditionalUserRoles = void 0;
|
|
4
|
+
const StringList_1 = require("../../../../shared/domain/value-objects/StringList");
|
|
5
|
+
class CompanyServiceEntitlementAdditionalUserRoles extends StringList_1.StringList {
|
|
6
|
+
constructor(values, skipDomainValidation) {
|
|
7
|
+
super(values, skipDomainValidation, CompanyServiceEntitlementAdditionalUserRoles.PROPERTY_NAME, { allowEmpty: true });
|
|
8
|
+
}
|
|
9
|
+
static create(values) {
|
|
10
|
+
StringList_1.StringList.guardAgainstInvalidStringList(values, CompanyServiceEntitlementAdditionalUserRoles.PROPERTY_NAME);
|
|
11
|
+
return new CompanyServiceEntitlementAdditionalUserRoles(values, false);
|
|
12
|
+
}
|
|
13
|
+
static fromPrimitives(primitives) {
|
|
14
|
+
const values = primitives.map((primitive) => primitive);
|
|
15
|
+
return new CompanyServiceEntitlementAdditionalUserRoles(values, true);
|
|
16
|
+
}
|
|
17
|
+
toPrimitives() {
|
|
18
|
+
return this.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CompanyServiceEntitlementAdditionalUserRoles = CompanyServiceEntitlementAdditionalUserRoles;
|
|
22
|
+
CompanyServiceEntitlementAdditionalUserRoles.PROPERTY_NAME = 'additionalUserRoles';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementAllowsDocumentReading = void 0;
|
|
4
|
+
const Boolean_1 = require("../../../../shared/domain/value-objects/Boolean");
|
|
5
|
+
class CompanyServiceEntitlementAllowsDocumentReading extends Boolean_1.Boolean {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementAllowsDocumentReading.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
Boolean_1.Boolean.guardAgainstInvalidType(value, CompanyServiceEntitlementAllowsDocumentReading.PROPERTY_NAME);
|
|
11
|
+
return new CompanyServiceEntitlementAllowsDocumentReading(value, false);
|
|
12
|
+
}
|
|
13
|
+
static fromPrimitives(primitive) {
|
|
14
|
+
const value = primitive;
|
|
15
|
+
return new CompanyServiceEntitlementAllowsDocumentReading(value, true);
|
|
16
|
+
}
|
|
17
|
+
toPrimitives() {
|
|
18
|
+
return this.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CompanyServiceEntitlementAllowsDocumentReading = CompanyServiceEntitlementAllowsDocumentReading;
|
|
22
|
+
CompanyServiceEntitlementAllowsDocumentReading.PROPERTY_NAME = 'allowsDocumentReading';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementAllowsSectoralComparison = void 0;
|
|
4
|
+
const Boolean_1 = require("../../../../shared/domain/value-objects/Boolean");
|
|
5
|
+
class CompanyServiceEntitlementAllowsSectoralComparison extends Boolean_1.Boolean {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementAllowsSectoralComparison.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
Boolean_1.Boolean.guardAgainstInvalidType(value, CompanyServiceEntitlementAllowsSectoralComparison.PROPERTY_NAME);
|
|
11
|
+
return new CompanyServiceEntitlementAllowsSectoralComparison(value, false);
|
|
12
|
+
}
|
|
13
|
+
static fromPrimitives(primitive) {
|
|
14
|
+
const value = primitive;
|
|
15
|
+
return new CompanyServiceEntitlementAllowsSectoralComparison(value, true);
|
|
16
|
+
}
|
|
17
|
+
toPrimitives() {
|
|
18
|
+
return this.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CompanyServiceEntitlementAllowsSectoralComparison = CompanyServiceEntitlementAllowsSectoralComparison;
|
|
22
|
+
CompanyServiceEntitlementAllowsSectoralComparison.PROPERTY_NAME = 'allowsSectoralComparison';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementCarbonClientId = void 0;
|
|
4
|
+
const AggregateId_1 = require("../../../../shared/domain/value-objects/AggregateId");
|
|
5
|
+
class CompanyServiceEntitlementCarbonClientId extends AggregateId_1.AggregateId {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementCarbonClientId.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
AggregateId_1.AggregateId.guardAgainstEmptyValue(value, CompanyServiceEntitlementCarbonClientId.PROPERTY_NAME);
|
|
11
|
+
AggregateId_1.AggregateId.guardAgainstInvalidType(value, CompanyServiceEntitlementCarbonClientId.PROPERTY_NAME);
|
|
12
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(value, CompanyServiceEntitlementCarbonClientId.PROPERTY_NAME);
|
|
13
|
+
return new CompanyServiceEntitlementCarbonClientId(value, false);
|
|
14
|
+
}
|
|
15
|
+
static fromPrimitives(primitive) {
|
|
16
|
+
const value = primitive;
|
|
17
|
+
return new CompanyServiceEntitlementCarbonClientId(value, true);
|
|
18
|
+
}
|
|
19
|
+
toPrimitives() {
|
|
20
|
+
return this.value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.CompanyServiceEntitlementCarbonClientId = CompanyServiceEntitlementCarbonClientId;
|
|
24
|
+
CompanyServiceEntitlementCarbonClientId.PROPERTY_NAME = 'carbonClientId';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementId = void 0;
|
|
4
|
+
const AggregateId_1 = require("../../../../shared/domain/value-objects/AggregateId");
|
|
5
|
+
const SemanticUuidPrefix_1 = require("../../../../shared/domain/enums/SemanticUuidPrefix");
|
|
6
|
+
const InvalidAggregatePrefixError_1 = require("../../../../shared/domain/exceptions/InvalidAggregatePrefixError");
|
|
7
|
+
class CompanyServiceEntitlementId extends AggregateId_1.AggregateId {
|
|
8
|
+
constructor(value, skipDomainValidation) {
|
|
9
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementId.PROPERTY_NAME);
|
|
10
|
+
}
|
|
11
|
+
static create(value) {
|
|
12
|
+
AggregateId_1.AggregateId.guardAgainstEmptyValue(value, CompanyServiceEntitlementId.PROPERTY_NAME);
|
|
13
|
+
AggregateId_1.AggregateId.guardAgainstInvalidType(value, CompanyServiceEntitlementId.PROPERTY_NAME);
|
|
14
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(value, CompanyServiceEntitlementId.PROPERTY_NAME);
|
|
15
|
+
CompanyServiceEntitlementId.guardAgainstInvalidPrefix(value);
|
|
16
|
+
return new CompanyServiceEntitlementId(value, false);
|
|
17
|
+
}
|
|
18
|
+
static guardAgainstInvalidPrefix(value) {
|
|
19
|
+
try {
|
|
20
|
+
const tempInstance = new CompanyServiceEntitlementId(value, true);
|
|
21
|
+
const prefix = tempInstance.extractPrefix();
|
|
22
|
+
if (CompanyServiceEntitlementId.VALID_PREFIXES.includes(prefix) === false) {
|
|
23
|
+
throw InvalidAggregatePrefixError_1.InvalidAggregatePrefixError.create(value, 'CompanyServiceEntitlement', prefix, CompanyServiceEntitlementId.VALID_PREFIXES, CompanyServiceEntitlementId.PROPERTY_NAME);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
if (error instanceof InvalidAggregatePrefixError_1.InvalidAggregatePrefixError) {
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
if (error instanceof Error) {
|
|
31
|
+
throw InvalidAggregatePrefixError_1.InvalidAggregatePrefixError.create(value, 'CompanyServiceEntitlement', 'UNKNOWN', CompanyServiceEntitlementId.VALID_PREFIXES, CompanyServiceEntitlementId.PROPERTY_NAME);
|
|
32
|
+
}
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
static fromPrimitives(primitive) {
|
|
37
|
+
const value = primitive;
|
|
38
|
+
return new CompanyServiceEntitlementId(value, true);
|
|
39
|
+
}
|
|
40
|
+
toPrimitives() {
|
|
41
|
+
return this.value;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.CompanyServiceEntitlementId = CompanyServiceEntitlementId;
|
|
45
|
+
CompanyServiceEntitlementId.PROPERTY_NAME = 'id';
|
|
46
|
+
CompanyServiceEntitlementId.VALID_PREFIXES = [
|
|
47
|
+
SemanticUuidPrefix_1.SemanticUuidPrefix.PMS_SERVICE_ENTITLEMENT,
|
|
48
|
+
];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementIncludesCarbonBoxAcademy = void 0;
|
|
4
|
+
const Boolean_1 = require("../../../../shared/domain/value-objects/Boolean");
|
|
5
|
+
class CompanyServiceEntitlementIncludesCarbonBoxAcademy extends Boolean_1.Boolean {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementIncludesCarbonBoxAcademy.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
Boolean_1.Boolean.guardAgainstInvalidType(value, CompanyServiceEntitlementIncludesCarbonBoxAcademy.PROPERTY_NAME);
|
|
11
|
+
return new CompanyServiceEntitlementIncludesCarbonBoxAcademy(value, false);
|
|
12
|
+
}
|
|
13
|
+
static fromPrimitives(primitive) {
|
|
14
|
+
const value = primitive;
|
|
15
|
+
return new CompanyServiceEntitlementIncludesCarbonBoxAcademy(value, true);
|
|
16
|
+
}
|
|
17
|
+
toPrimitives() {
|
|
18
|
+
return this.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CompanyServiceEntitlementIncludesCarbonBoxAcademy = CompanyServiceEntitlementIncludesCarbonBoxAcademy;
|
|
22
|
+
CompanyServiceEntitlementIncludesCarbonBoxAcademy.PROPERTY_NAME = 'includesCarbonBoxAcademy';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementIncludesEsgIndicators = void 0;
|
|
4
|
+
const Boolean_1 = require("../../../../shared/domain/value-objects/Boolean");
|
|
5
|
+
class CompanyServiceEntitlementIncludesEsgIndicators extends Boolean_1.Boolean {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementIncludesEsgIndicators.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
Boolean_1.Boolean.guardAgainstInvalidType(value, CompanyServiceEntitlementIncludesEsgIndicators.PROPERTY_NAME);
|
|
11
|
+
return new CompanyServiceEntitlementIncludesEsgIndicators(value, false);
|
|
12
|
+
}
|
|
13
|
+
static fromPrimitives(primitive) {
|
|
14
|
+
const value = primitive;
|
|
15
|
+
return new CompanyServiceEntitlementIncludesEsgIndicators(value, true);
|
|
16
|
+
}
|
|
17
|
+
toPrimitives() {
|
|
18
|
+
return this.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CompanyServiceEntitlementIncludesEsgIndicators = CompanyServiceEntitlementIncludesEsgIndicators;
|
|
22
|
+
CompanyServiceEntitlementIncludesEsgIndicators.PROPERTY_NAME = 'includesEsgIndicators';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementIsAvailableForCorporate = void 0;
|
|
4
|
+
const Boolean_1 = require("../../../../shared/domain/value-objects/Boolean");
|
|
5
|
+
class CompanyServiceEntitlementIsAvailableForCorporate extends Boolean_1.Boolean {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementIsAvailableForCorporate.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
Boolean_1.Boolean.guardAgainstInvalidType(value, CompanyServiceEntitlementIsAvailableForCorporate.PROPERTY_NAME);
|
|
11
|
+
return new CompanyServiceEntitlementIsAvailableForCorporate(value, false);
|
|
12
|
+
}
|
|
13
|
+
static fromPrimitives(primitive) {
|
|
14
|
+
const value = primitive;
|
|
15
|
+
return new CompanyServiceEntitlementIsAvailableForCorporate(value, true);
|
|
16
|
+
}
|
|
17
|
+
toPrimitives() {
|
|
18
|
+
return this.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CompanyServiceEntitlementIsAvailableForCorporate = CompanyServiceEntitlementIsAvailableForCorporate;
|
|
22
|
+
CompanyServiceEntitlementIsAvailableForCorporate.PROPERTY_NAME = 'isAvailableForCorporate';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementIsAvailableForEvent = void 0;
|
|
4
|
+
const Boolean_1 = require("../../../../shared/domain/value-objects/Boolean");
|
|
5
|
+
class CompanyServiceEntitlementIsAvailableForEvent extends Boolean_1.Boolean {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementIsAvailableForEvent.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
Boolean_1.Boolean.guardAgainstInvalidType(value, CompanyServiceEntitlementIsAvailableForEvent.PROPERTY_NAME);
|
|
11
|
+
return new CompanyServiceEntitlementIsAvailableForEvent(value, false);
|
|
12
|
+
}
|
|
13
|
+
static fromPrimitives(primitive) {
|
|
14
|
+
const value = primitive;
|
|
15
|
+
return new CompanyServiceEntitlementIsAvailableForEvent(value, true);
|
|
16
|
+
}
|
|
17
|
+
toPrimitives() {
|
|
18
|
+
return this.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CompanyServiceEntitlementIsAvailableForEvent = CompanyServiceEntitlementIsAvailableForEvent;
|
|
22
|
+
CompanyServiceEntitlementIsAvailableForEvent.PROPERTY_NAME = 'isAvailableForEvent';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementIsAvailableForProduct = void 0;
|
|
4
|
+
const Boolean_1 = require("../../../../shared/domain/value-objects/Boolean");
|
|
5
|
+
class CompanyServiceEntitlementIsAvailableForProduct extends Boolean_1.Boolean {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementIsAvailableForProduct.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
Boolean_1.Boolean.guardAgainstInvalidType(value, CompanyServiceEntitlementIsAvailableForProduct.PROPERTY_NAME);
|
|
11
|
+
return new CompanyServiceEntitlementIsAvailableForProduct(value, false);
|
|
12
|
+
}
|
|
13
|
+
static fromPrimitives(primitive) {
|
|
14
|
+
const value = primitive;
|
|
15
|
+
return new CompanyServiceEntitlementIsAvailableForProduct(value, true);
|
|
16
|
+
}
|
|
17
|
+
toPrimitives() {
|
|
18
|
+
return this.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CompanyServiceEntitlementIsAvailableForProduct = CompanyServiceEntitlementIsAvailableForProduct;
|
|
22
|
+
CompanyServiceEntitlementIsAvailableForProduct.PROPERTY_NAME = 'isAvailableForProduct';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementMaxUsers = void 0;
|
|
4
|
+
const NullableNumeric_1 = require("../../../../shared/domain/value-objects/NullableNumeric");
|
|
5
|
+
class CompanyServiceEntitlementMaxUsers extends NullableNumeric_1.NullableNumeric {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementMaxUsers.PROPERTY_NAME, CompanyServiceEntitlementMaxUsers.MAX_USERS_OPTIONS);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
return new CompanyServiceEntitlementMaxUsers(value, false);
|
|
11
|
+
}
|
|
12
|
+
static fromPrimitives(primitive) {
|
|
13
|
+
const value = primitive;
|
|
14
|
+
return new CompanyServiceEntitlementMaxUsers(value, true);
|
|
15
|
+
}
|
|
16
|
+
toPrimitives() {
|
|
17
|
+
return this.value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.CompanyServiceEntitlementMaxUsers = CompanyServiceEntitlementMaxUsers;
|
|
21
|
+
CompanyServiceEntitlementMaxUsers.PROPERTY_NAME = 'maxUsers';
|
|
22
|
+
CompanyServiceEntitlementMaxUsers.MAX_USERS_OPTIONS = {
|
|
23
|
+
allowNegative: false,
|
|
24
|
+
allowZero: true,
|
|
25
|
+
allowDecimals: false,
|
|
26
|
+
maxDecimalPlaces: 0,
|
|
27
|
+
minValue: 0,
|
|
28
|
+
maxValue: 1000000,
|
|
29
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementSourceContractIds = void 0;
|
|
4
|
+
const StringList_1 = require("../../../../shared/domain/value-objects/StringList");
|
|
5
|
+
class CompanyServiceEntitlementSourceContractIds extends StringList_1.StringList {
|
|
6
|
+
constructor(values, skipDomainValidation) {
|
|
7
|
+
super(values, skipDomainValidation, CompanyServiceEntitlementSourceContractIds.PROPERTY_NAME, { allowEmpty: true });
|
|
8
|
+
}
|
|
9
|
+
static create(values) {
|
|
10
|
+
StringList_1.StringList.guardAgainstInvalidStringList(values, CompanyServiceEntitlementSourceContractIds.PROPERTY_NAME);
|
|
11
|
+
return new CompanyServiceEntitlementSourceContractIds(values, false);
|
|
12
|
+
}
|
|
13
|
+
static fromPrimitives(primitives) {
|
|
14
|
+
const values = primitives.map((primitive) => primitive);
|
|
15
|
+
return new CompanyServiceEntitlementSourceContractIds(values, true);
|
|
16
|
+
}
|
|
17
|
+
toPrimitives() {
|
|
18
|
+
return this.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CompanyServiceEntitlementSourceContractIds = CompanyServiceEntitlementSourceContractIds;
|
|
22
|
+
CompanyServiceEntitlementSourceContractIds.PROPERTY_NAME = 'sourceContractIds';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementValidFrom = void 0;
|
|
4
|
+
const DateTimeString_1 = require("../../../../shared/domain/value-objects/DateTimeString");
|
|
5
|
+
class CompanyServiceEntitlementValidFrom extends DateTimeString_1.DateTimeString {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementValidFrom.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
DateTimeString_1.DateTimeString.guardAgainstEmptyValue(value, CompanyServiceEntitlementValidFrom.PROPERTY_NAME);
|
|
11
|
+
DateTimeString_1.DateTimeString.guardAgainstInvalidType(value, CompanyServiceEntitlementValidFrom.PROPERTY_NAME);
|
|
12
|
+
DateTimeString_1.DateTimeString.guardAgainstInvalidDateTimeFormat(value);
|
|
13
|
+
return new CompanyServiceEntitlementValidFrom(value, false);
|
|
14
|
+
}
|
|
15
|
+
static fromPrimitives(primitive) {
|
|
16
|
+
const value = primitive;
|
|
17
|
+
return new CompanyServiceEntitlementValidFrom(value, true);
|
|
18
|
+
}
|
|
19
|
+
toPrimitives() {
|
|
20
|
+
return this.value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.CompanyServiceEntitlementValidFrom = CompanyServiceEntitlementValidFrom;
|
|
24
|
+
CompanyServiceEntitlementValidFrom.PROPERTY_NAME = 'validFrom';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyServiceEntitlementValidTo = void 0;
|
|
4
|
+
const NullableDateTimeString_1 = require("../../../../shared/domain/value-objects/NullableDateTimeString");
|
|
5
|
+
class CompanyServiceEntitlementValidTo extends NullableDateTimeString_1.NullableDateTimeString {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, CompanyServiceEntitlementValidTo.PROPERTY_NAME);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
return new CompanyServiceEntitlementValidTo(value, false);
|
|
11
|
+
}
|
|
12
|
+
static fromPrimitives(primitive) {
|
|
13
|
+
const value = primitive;
|
|
14
|
+
return new CompanyServiceEntitlementValidTo(value, true);
|
|
15
|
+
}
|
|
16
|
+
toPrimitives() {
|
|
17
|
+
return this.value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.CompanyServiceEntitlementValidTo = CompanyServiceEntitlementValidTo;
|
|
21
|
+
CompanyServiceEntitlementValidTo.PROPERTY_NAME = 'validTo';
|
|
@@ -72,6 +72,7 @@ var SemanticUuidPrefix;
|
|
|
72
72
|
SemanticUuidPrefix["PMS_SERVICE_PRICING"] = "PMS-SP";
|
|
73
73
|
SemanticUuidPrefix["PMS_PURCHASE_CONTRACT"] = "PMS-PC";
|
|
74
74
|
SemanticUuidPrefix["PMS_PURCHASE_ORDER"] = "PMS-PO";
|
|
75
|
+
SemanticUuidPrefix["PMS_SERVICE_ENTITLEMENT"] = "PMS-SE";
|
|
75
76
|
// Shared Domain
|
|
76
77
|
SemanticUuidPrefix["SHR_DOMAIN"] = "SHR-DOM";
|
|
77
78
|
SemanticUuidPrefix["SHR_EITHER"] = "SHR-ETH";
|