@carbonbox/domain 0.8.1 → 0.8.2
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,14 +7,15 @@ const InvalidAggregateIdFormatError_1 = require("../exceptions/InvalidAggregateI
|
|
|
7
7
|
/**
|
|
8
8
|
* Pure AggregateId Value Object with structured ID format
|
|
9
9
|
*
|
|
10
|
-
* Format: {PREFIX}_{
|
|
11
|
-
*
|
|
10
|
+
* Format: {PREFIX}_{ID} where PREFIX can be BC or BC-SUB1-SUB2-...SUBn
|
|
11
|
+
* and {ID} is either a UUID v4 (legacy) or a ULID (current standard).
|
|
12
|
+
* Each prefix component can have 1+ uppercase letters (validated by specific Value Objects).
|
|
12
13
|
*
|
|
13
14
|
* Examples:
|
|
14
|
-
* - STC_550e8400-e29b-41d4-a716-446655440000
|
|
15
|
-
* - PMS-SC_550e8400-e29b-41d4-a716-446655440000
|
|
16
|
-
* -
|
|
17
|
-
* -
|
|
15
|
+
* - STC_550e8400-e29b-41d4-a716-446655440000 (UUID v4 — legacy)
|
|
16
|
+
* - PMS-SC_550e8400-e29b-41d4-a716-446655440000 (UUID v4 — legacy)
|
|
17
|
+
* - ECP-PRC_01ARZ3NDEKTSV4RRFFQ69G5FAV (ULID — current standard)
|
|
18
|
+
* - ECP-JOB_01KQD1C12GGEAV6J63DK02VD5G (ULID — current standard)
|
|
18
19
|
*
|
|
19
20
|
* This is a PURE Value Object - no external dependencies or business logic.
|
|
20
21
|
*
|
|
@@ -127,9 +128,10 @@ class AggregateId extends String_1.String {
|
|
|
127
128
|
}
|
|
128
129
|
exports.AggregateId = AggregateId;
|
|
129
130
|
AggregateId.DEFAULT_PROPERTY_NAME = 'id';
|
|
130
|
-
//
|
|
131
|
-
|
|
131
|
+
// Raw ID regex: accepts UUID v4 (legacy) or ULID (current).
|
|
132
|
+
// ULID = 26 chars, Crockford's Base32 alphabet (case-insensitive).
|
|
133
|
+
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}|[0-9A-HJKMNP-TV-Z]{26})$/i;
|
|
132
134
|
// Aggregate ID format: BC_ID or BC-SUB1-SUB2-...SUBn_ID (flexible N-level subdomain support)
|
|
133
135
|
// Pattern: [A-Z]+(-[A-Z]+)*_[ID] - BC alone OR BC with unlimited SUBn levels (1+ letters per component)
|
|
134
136
|
// 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;
|
|
137
|
+
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}|[0-9A-HJKMNP-TV-Z]{26})$/i;
|
|
@@ -2,14 +2,15 @@ import { String } from './String';
|
|
|
2
2
|
/**
|
|
3
3
|
* Pure AggregateId Value Object with structured ID format
|
|
4
4
|
*
|
|
5
|
-
* Format: {PREFIX}_{
|
|
6
|
-
*
|
|
5
|
+
* Format: {PREFIX}_{ID} where PREFIX can be BC or BC-SUB1-SUB2-...SUBn
|
|
6
|
+
* and {ID} is either a UUID v4 (legacy) or a ULID (current standard).
|
|
7
|
+
* Each prefix component can have 1+ uppercase letters (validated by specific Value Objects).
|
|
7
8
|
*
|
|
8
9
|
* Examples:
|
|
9
|
-
* - STC_550e8400-e29b-41d4-a716-446655440000
|
|
10
|
-
* - PMS-SC_550e8400-e29b-41d4-a716-446655440000
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
10
|
+
* - STC_550e8400-e29b-41d4-a716-446655440000 (UUID v4 — legacy)
|
|
11
|
+
* - PMS-SC_550e8400-e29b-41d4-a716-446655440000 (UUID v4 — legacy)
|
|
12
|
+
* - ECP-PRC_01ARZ3NDEKTSV4RRFFQ69G5FAV (ULID — current standard)
|
|
13
|
+
* - ECP-JOB_01KQD1C12GGEAV6J63DK02VD5G (ULID — current standard)
|
|
13
14
|
*
|
|
14
15
|
* This is a PURE Value Object - no external dependencies or business logic.
|
|
15
16
|
*
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,WAAY,SAAQ,MAAM;IACrC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,QAAQ;IAIvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAqG;IAKrI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAsH;IAEhK,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;;OAEG;WACW,qBAAqB,CACj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