@carbonbox/domain 0.6.3 → 0.6.4
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.
|
@@ -7,18 +7,22 @@ const InvalidAggregateIdFormatError_1 = require("../exceptions/InvalidAggregateI
|
|
|
7
7
|
/**
|
|
8
8
|
* Pure AggregateId Value Object with structured ID format
|
|
9
9
|
*
|
|
10
|
-
* Format: {
|
|
10
|
+
* Format: {PREFIX}_{UUID} where PREFIX can be BC or BC-SUB1-SUB2-...SUBn
|
|
11
|
+
* Each prefix component can have 1+ uppercase letters (validated by specific Value Objects)
|
|
12
|
+
*
|
|
11
13
|
* Examples:
|
|
12
|
-
* - STC_550e8400-e29b-41d4-a716-446655440000 (BC-level entity)
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
14
|
+
* - STC_550e8400-e29b-41d4-a716-446655440000 (BC-level entity, 3 letters)
|
|
15
|
+
* - PMS-SC_550e8400-e29b-41d4-a716-446655440000 (subdomain entity, 3-2 letters)
|
|
16
|
+
* - USR-STH-CHO_550e8400-e29b-41d4-a716-446655440000 (subdomain entity, 3-3-3 letters)
|
|
17
|
+
* - ADC-SUB-FLD_123e4567-e89b-12d3-a456-426614174000 (N-level expansion, 3-3-3 letters)
|
|
15
18
|
*
|
|
16
19
|
* This is a PURE Value Object - no external dependencies or business logic.
|
|
17
20
|
*
|
|
18
21
|
* Benefits:
|
|
19
22
|
* - Immutable and pure value object design
|
|
20
23
|
* - Basic validation and extraction methods
|
|
21
|
-
* - Flexible N-level subdomain support
|
|
24
|
+
* - Flexible N-level subdomain support with variable component lengths
|
|
25
|
+
* - Specific prefix validation delegated to concrete Value Objects
|
|
22
26
|
* - Clean separation of concerns
|
|
23
27
|
*/
|
|
24
28
|
class AggregateId extends String_1.String {
|
|
@@ -126,5 +130,6 @@ AggregateId.DEFAULT_PROPERTY_NAME = 'id';
|
|
|
126
130
|
// Standard ID regex (UUID v4 format)
|
|
127
131
|
AggregateId.ID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
128
132
|
// Aggregate ID format: BC_ID or BC-SUB1-SUB2-...SUBn_ID (flexible N-level subdomain support)
|
|
129
|
-
// Pattern: [A-Z]
|
|
130
|
-
|
|
133
|
+
// Pattern: [A-Z]+(-[A-Z]+)*_[ID] - BC alone OR BC with unlimited SUBn levels (1+ letters per component)
|
|
134
|
+
// Each specific Value Object validates its exact prefix format
|
|
135
|
+
AggregateId.AGGREGATE_ID_REGEX = /^[A-Z]+(-[A-Z]+)*_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
@@ -2,18 +2,22 @@ import { String } from './String';
|
|
|
2
2
|
/**
|
|
3
3
|
* Pure AggregateId Value Object with structured ID format
|
|
4
4
|
*
|
|
5
|
-
* Format: {
|
|
5
|
+
* Format: {PREFIX}_{UUID} where PREFIX can be BC or BC-SUB1-SUB2-...SUBn
|
|
6
|
+
* Each prefix component can have 1+ uppercase letters (validated by specific Value Objects)
|
|
7
|
+
*
|
|
6
8
|
* Examples:
|
|
7
|
-
* - STC_550e8400-e29b-41d4-a716-446655440000 (BC-level entity)
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
9
|
+
* - STC_550e8400-e29b-41d4-a716-446655440000 (BC-level entity, 3 letters)
|
|
10
|
+
* - PMS-SC_550e8400-e29b-41d4-a716-446655440000 (subdomain entity, 3-2 letters)
|
|
11
|
+
* - USR-STH-CHO_550e8400-e29b-41d4-a716-446655440000 (subdomain entity, 3-3-3 letters)
|
|
12
|
+
* - ADC-SUB-FLD_123e4567-e89b-12d3-a456-426614174000 (N-level expansion, 3-3-3 letters)
|
|
10
13
|
*
|
|
11
14
|
* This is a PURE Value Object - no external dependencies or business logic.
|
|
12
15
|
*
|
|
13
16
|
* Benefits:
|
|
14
17
|
* - Immutable and pure value object design
|
|
15
18
|
* - Basic validation and extraction methods
|
|
16
|
-
* - Flexible N-level subdomain support
|
|
19
|
+
* - Flexible N-level subdomain support with variable component lengths
|
|
20
|
+
* - Specific prefix validation delegated to concrete Value Objects
|
|
17
21
|
* - Clean separation of concerns
|
|
18
22
|
*/
|
|
19
23
|
export declare class AggregateId extends String {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AggregateId.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/value-objects/AggregateId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC
|
|
1
|
+
{"version":3,"file":"AggregateId.d.ts","sourceRoot":"","sources":["../../../../../../src/carbonbox/shared/domain/value-objects/AggregateId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,WAAY,SAAQ,MAAM;IACrC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,QAAQ;IAGvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAA4E;IAK5G,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAA6F;IAEvI,SAAS,aACP,KAAK,EAAE,MAAM,EACb,oBAAoB,EAAE,OAAO,EAC7B,YAAY,GAAE,MAA0C;WAanC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW;WAI/B,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW;IAI9D;;OAEG;IACI,SAAS,IAAI,MAAM;IAQ1B;;OAEG;IACI,aAAa,IAAI,MAAM;IAQ9B;;OAEG;IACI,qBAAqB,IAAI,MAAM;IAKtC;;;OAGG;IACI,iBAAiB,IAAI,MAAM,EAAE;IAQpC;;;OAGG;IACI,uBAAuB,IAAI,MAAM;IAKxC;;OAEG;IACI,aAAa,IAAI,OAAO;IAI/B;;OAE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