@rineex/ddd 0.0.0
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/LICENSE +201 -0
- package/dist/index.d.mts +351 -0
- package/dist/index.d.ts +351 -0
- package/dist/index.js +447 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +404 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +59 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __export = (target, all) => {
|
|
22
|
+
for (var name in all)
|
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
+
};
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
+
for (let key of __getOwnPropNames(from))
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
30
|
+
}
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
34
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
35
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
36
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
37
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
38
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
39
|
+
mod
|
|
40
|
+
));
|
|
41
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
|
+
|
|
43
|
+
// src/index.ts
|
|
44
|
+
var index_exports = {};
|
|
45
|
+
__export(index_exports, {
|
|
46
|
+
AggregateId: () => AggregateId,
|
|
47
|
+
ApplicationError: () => ApplicationError,
|
|
48
|
+
DomainError: () => DomainError,
|
|
49
|
+
EntityValidationError: () => EntityValidationError,
|
|
50
|
+
HttpStatus: () => HttpStatus,
|
|
51
|
+
HttpStatusMessage: () => HttpStatusMessage,
|
|
52
|
+
InvalidValueObjectError: () => InvalidValueObjectError,
|
|
53
|
+
ValueObject: () => ValueObject,
|
|
54
|
+
deepFreeze: () => deepFreeze,
|
|
55
|
+
ensureObject: () => ensureObject,
|
|
56
|
+
unwrapValueObject: () => unwrapValueObject
|
|
57
|
+
});
|
|
58
|
+
module.exports = __toCommonJS(index_exports);
|
|
59
|
+
|
|
60
|
+
// src/domain/base/domain.error.ts
|
|
61
|
+
var getCauseInfo = (cause) => {
|
|
62
|
+
if (cause instanceof Error) {
|
|
63
|
+
return {
|
|
64
|
+
cause: {
|
|
65
|
+
message: cause.message,
|
|
66
|
+
stack: cause.stack,
|
|
67
|
+
name: cause.name
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (cause) {
|
|
72
|
+
return { cause };
|
|
73
|
+
}
|
|
74
|
+
return {};
|
|
75
|
+
};
|
|
76
|
+
var DomainError = class extends Error {
|
|
77
|
+
/**
|
|
78
|
+
* @param message - Human-readable error message
|
|
79
|
+
* @param code - Stable error code
|
|
80
|
+
* @param metadata - Domain-specific structured data; optional `cause` can be included
|
|
81
|
+
*/
|
|
82
|
+
constructor(message, code, metadata = {}) {
|
|
83
|
+
super(message, __spreadValues({}, getCauseInfo(metadata.cause)));
|
|
84
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
85
|
+
this.name = new.target.name;
|
|
86
|
+
this.code = code;
|
|
87
|
+
this.metadata = Object.freeze(__spreadValues({}, metadata));
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// src/domain/base/vo.ts
|
|
92
|
+
var import_es6 = __toESM(require("fast-deep-equal/es6"));
|
|
93
|
+
|
|
94
|
+
// src/utils/deep-freeze.util.ts
|
|
95
|
+
function deepFreeze(obj, seen = /* @__PURE__ */ new WeakSet()) {
|
|
96
|
+
if (obj == null || typeof obj !== "object" && !Array.isArray(obj)) {
|
|
97
|
+
return obj;
|
|
98
|
+
}
|
|
99
|
+
if (Object.isFrozen(obj)) {
|
|
100
|
+
return obj;
|
|
101
|
+
}
|
|
102
|
+
if (seen.has(obj)) {
|
|
103
|
+
return obj;
|
|
104
|
+
}
|
|
105
|
+
seen.add(obj);
|
|
106
|
+
if (Array.isArray(obj)) {
|
|
107
|
+
obj.forEach((item) => deepFreeze(item, seen));
|
|
108
|
+
} else {
|
|
109
|
+
for (const key in obj) {
|
|
110
|
+
if (Object.hasOwn(obj, key)) {
|
|
111
|
+
deepFreeze(obj[key], seen);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return Object.freeze(obj);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/domain/base/vo.ts
|
|
119
|
+
var ValueObject = class _ValueObject {
|
|
120
|
+
get value() {
|
|
121
|
+
return this.props;
|
|
122
|
+
}
|
|
123
|
+
constructor(props) {
|
|
124
|
+
this.validate(props);
|
|
125
|
+
this.props = deepFreeze(props);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Type guard to check if an unknown object is an instance of ValueObject.
|
|
129
|
+
* This is useful for runtime type checking.
|
|
130
|
+
*
|
|
131
|
+
* @param vo The object to check.
|
|
132
|
+
* @returns True if the object is a ValueObject instance, false otherwise.
|
|
133
|
+
*/
|
|
134
|
+
static is(vo) {
|
|
135
|
+
return vo instanceof _ValueObject;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Deep equality comparison of ValueObjects
|
|
139
|
+
*/
|
|
140
|
+
equals(other) {
|
|
141
|
+
if (!other || !(other instanceof this.constructor)) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
return (0, import_es6.default)(this.props, other.props);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// src/domain/errors/entity-validation.error.ts
|
|
149
|
+
var EntityValidationError = class extends DomainError {
|
|
150
|
+
constructor(message, cause) {
|
|
151
|
+
super(message, "ENTITY_VALIDATION_ERROR", { cause });
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// src/domain/errors/invalid-vo.error.ts
|
|
156
|
+
var InvalidValueObjectError = class extends DomainError {
|
|
157
|
+
constructor(message) {
|
|
158
|
+
super(message, "INVALID_VALUE_OBJECT");
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// src/domain/value-objects/aggregate-id.vo.ts
|
|
163
|
+
var import_uuid = require("uuid");
|
|
164
|
+
var import_zod = __toESM(require("zod"));
|
|
165
|
+
var _AggregateId = class _AggregateId extends ValueObject {
|
|
166
|
+
/**
|
|
167
|
+
* Get the UUID of the AggregateId
|
|
168
|
+
* @returns The UUID of the AggregateId
|
|
169
|
+
*/
|
|
170
|
+
get uuid() {
|
|
171
|
+
return this.value;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Create a new AggregateId
|
|
175
|
+
* @param value The value to create the AggregateId from
|
|
176
|
+
* @returns The new AggregateId
|
|
177
|
+
*/
|
|
178
|
+
static create(value) {
|
|
179
|
+
return new _AggregateId(value);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Create a new AggregateId with a random UUID v4
|
|
183
|
+
*/
|
|
184
|
+
static generate() {
|
|
185
|
+
return new _AggregateId((0, import_uuid.v4)());
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Check if the AggregateId is empty
|
|
189
|
+
* @returns True if the AggregateId is empty, false otherwise
|
|
190
|
+
*/
|
|
191
|
+
isEmpty() {
|
|
192
|
+
return !this.value;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Convert the AggregateId to a string
|
|
196
|
+
* @returns The string representation of the AggregateId
|
|
197
|
+
*/
|
|
198
|
+
toString() {
|
|
199
|
+
return this.value;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Validate the AggregateId
|
|
203
|
+
* @param value The value to validate
|
|
204
|
+
* @throws InvalidValueObjectException if the value is invalid
|
|
205
|
+
*/
|
|
206
|
+
validate(value) {
|
|
207
|
+
const result = _AggregateId.schema.safeParse(value);
|
|
208
|
+
if (!result.success) {
|
|
209
|
+
throw new InvalidValueObjectError(
|
|
210
|
+
`Invalid AggregateId: ${result.error.message}`
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* The schema for the AggregateId
|
|
217
|
+
*/
|
|
218
|
+
_AggregateId.schema = import_zod.default.uuid();
|
|
219
|
+
var AggregateId = _AggregateId;
|
|
220
|
+
|
|
221
|
+
// src/gateway/constants/http-code.ts
|
|
222
|
+
var HttpStatus = Object.freeze({
|
|
223
|
+
REQUEST_HEADER_FIELDS_TOO_LARGE: 431,
|
|
224
|
+
NETWORK_AUTHENTICATION_REQUIRED: 511,
|
|
225
|
+
NON_AUTHORITATIVE_INFORMATION: 203,
|
|
226
|
+
PROXY_AUTHENTICATION_REQUIRED: 407,
|
|
227
|
+
UNAVAILABLE_FOR_LEGAL_REASONS: 451,
|
|
228
|
+
HTTP_VERSION_NOT_SUPPORTED: 505,
|
|
229
|
+
BANDWIDTH_LIMIT_EXCEEDED: 509,
|
|
230
|
+
VARIANT_ALSO_NEGOTIATES: 506,
|
|
231
|
+
UNSUPPORTED_MEDIA_TYPE: 415,
|
|
232
|
+
RANGE_NOT_SATISFIABLE: 416,
|
|
233
|
+
PRECONDITION_REQUIRED: 428,
|
|
234
|
+
INTERNAL_SERVER_ERROR: 500,
|
|
235
|
+
UNPROCESSABLE_ENTITY: 422,
|
|
236
|
+
INSUFFICIENT_STORAGE: 507,
|
|
237
|
+
SWITCHING_PROTOCOLS: 101,
|
|
238
|
+
PRECONDITION_FAILED: 412,
|
|
239
|
+
MISDIRECTED_REQUEST: 421,
|
|
240
|
+
SERVICE_UNAVAILABLE: 503,
|
|
241
|
+
TEMPORARY_REDIRECT: 307,
|
|
242
|
+
PERMANENT_REDIRECT: 308,
|
|
243
|
+
METHOD_NOT_ALLOWED: 405,
|
|
244
|
+
EXPECTATION_FAILED: 417,
|
|
245
|
+
MOVED_PERMANENTLY: 301,
|
|
246
|
+
PAYLOAD_TOO_LARGE: 413,
|
|
247
|
+
FAILED_DEPENDENCY: 424,
|
|
248
|
+
TOO_MANY_REQUESTS: 429,
|
|
249
|
+
ALREADY_REPORTED: 208,
|
|
250
|
+
MULTIPLE_CHOICES: 300,
|
|
251
|
+
PAYMENT_REQUIRED: 402,
|
|
252
|
+
UPGRADE_REQUIRED: 426,
|
|
253
|
+
PARTIAL_CONTENT: 206,
|
|
254
|
+
REQUEST_TIMEOUT: 408,
|
|
255
|
+
LENGTH_REQUIRED: 411,
|
|
256
|
+
NOT_IMPLEMENTED: 501,
|
|
257
|
+
GATEWAY_TIMEOUT: 504,
|
|
258
|
+
NOT_ACCEPTABLE: 406,
|
|
259
|
+
RESET_CONTENT: 205,
|
|
260
|
+
LOOP_DETECTED: 508,
|
|
261
|
+
MULTI_STATUS: 207,
|
|
262
|
+
NOT_MODIFIED: 304,
|
|
263
|
+
UNAUTHORIZED: 401,
|
|
264
|
+
URI_TOO_LONG: 414,
|
|
265
|
+
NOT_EXTENDED: 510,
|
|
266
|
+
EARLY_HINTS: 103,
|
|
267
|
+
BAD_REQUEST: 400,
|
|
268
|
+
IM_A_TEAPOT: 418,
|
|
269
|
+
BAD_GATEWAY: 502,
|
|
270
|
+
PROCESSING: 102,
|
|
271
|
+
NO_CONTENT: 204,
|
|
272
|
+
SEE_OTHER: 303,
|
|
273
|
+
USE_PROXY: 305,
|
|
274
|
+
FORBIDDEN: 403,
|
|
275
|
+
NOT_FOUND: 404,
|
|
276
|
+
TOO_EARLY: 425,
|
|
277
|
+
CONTINUE: 100,
|
|
278
|
+
ACCEPTED: 202,
|
|
279
|
+
CONFLICT: 409,
|
|
280
|
+
CREATED: 201,
|
|
281
|
+
IM_USED: 226,
|
|
282
|
+
LOCKED: 423,
|
|
283
|
+
FOUND: 302,
|
|
284
|
+
GONE: 410,
|
|
285
|
+
OK: 200
|
|
286
|
+
});
|
|
287
|
+
var HttpStatusMessage = {
|
|
288
|
+
431: "Request Header Fields Too Large",
|
|
289
|
+
511: "Network Authentication Required",
|
|
290
|
+
203: "Non-Authoritative Information",
|
|
291
|
+
407: "Proxy Authentication Required",
|
|
292
|
+
451: "Unavailable For Legal Reasons",
|
|
293
|
+
505: "HTTP Version Not Supported",
|
|
294
|
+
509: "Bandwidth Limit Exceeded",
|
|
295
|
+
506: "Variant Also Negotiates",
|
|
296
|
+
415: "Unsupported Media Type",
|
|
297
|
+
416: "Range Not Satisfiable",
|
|
298
|
+
428: "Precondition Required",
|
|
299
|
+
500: "Internal Server Error",
|
|
300
|
+
422: "Unprocessable Entity",
|
|
301
|
+
507: "Insufficient Storage",
|
|
302
|
+
101: "Switching Protocols",
|
|
303
|
+
412: "Precondition Failed",
|
|
304
|
+
421: "Misdirected Request",
|
|
305
|
+
503: "Service Unavailable",
|
|
306
|
+
307: "Temporary Redirect",
|
|
307
|
+
308: "Permanent Redirect",
|
|
308
|
+
405: "Method Not Allowed",
|
|
309
|
+
417: "Expectation Failed",
|
|
310
|
+
301: "Moved Permanently",
|
|
311
|
+
413: "Payload Too Large",
|
|
312
|
+
424: "Failed Dependency",
|
|
313
|
+
429: "Too Many Requests",
|
|
314
|
+
208: "Already Reported",
|
|
315
|
+
300: "Multiple Choices",
|
|
316
|
+
402: "Payment Required",
|
|
317
|
+
426: "Upgrade Required",
|
|
318
|
+
206: "Partial Content",
|
|
319
|
+
408: "Request Timeout",
|
|
320
|
+
411: "Length Required",
|
|
321
|
+
501: "Not Implemented",
|
|
322
|
+
504: "Gateway Timeout",
|
|
323
|
+
406: "Not Acceptable",
|
|
324
|
+
205: "Reset Content",
|
|
325
|
+
508: "Loop Detected",
|
|
326
|
+
207: "Multi-Status",
|
|
327
|
+
304: "Not Modified",
|
|
328
|
+
401: "Unauthorized",
|
|
329
|
+
414: "URI Too Long",
|
|
330
|
+
418: "I'm a Teapot",
|
|
331
|
+
510: "Not Extended",
|
|
332
|
+
103: "Early Hints",
|
|
333
|
+
400: "Bad Request",
|
|
334
|
+
502: "Bad Gateway",
|
|
335
|
+
102: "Processing",
|
|
336
|
+
204: "No Content",
|
|
337
|
+
303: "See Other",
|
|
338
|
+
305: "Use Proxy",
|
|
339
|
+
403: "Forbidden",
|
|
340
|
+
404: "Not Found",
|
|
341
|
+
425: "Too Early",
|
|
342
|
+
100: "Continue",
|
|
343
|
+
202: "Accepted",
|
|
344
|
+
226: "I'm Used",
|
|
345
|
+
409: "Conflict",
|
|
346
|
+
201: "Created",
|
|
347
|
+
423: "Locked",
|
|
348
|
+
302: "Found",
|
|
349
|
+
410: "Gone",
|
|
350
|
+
200: "OK"
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// src/utils/errors/application.error.ts
|
|
354
|
+
var ApplicationError = class extends Error {
|
|
355
|
+
constructor({
|
|
356
|
+
code = HttpStatusMessage["500"],
|
|
357
|
+
isOperational = false,
|
|
358
|
+
status = 500,
|
|
359
|
+
metadata,
|
|
360
|
+
message,
|
|
361
|
+
cause
|
|
362
|
+
}) {
|
|
363
|
+
super(message);
|
|
364
|
+
this.name = new.target.name;
|
|
365
|
+
this.code = code;
|
|
366
|
+
this.status = status;
|
|
367
|
+
this.isOperational = isOperational;
|
|
368
|
+
this.metadata = metadata;
|
|
369
|
+
this.cause = cause;
|
|
370
|
+
Error.captureStackTrace(this, new.target);
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
// src/utils/unwrap-vo.util.ts
|
|
375
|
+
function unwrapValueObject(input, seen = /* @__PURE__ */ new WeakSet()) {
|
|
376
|
+
if (input === null || input === void 0) {
|
|
377
|
+
return input;
|
|
378
|
+
}
|
|
379
|
+
if (typeof input !== "object") {
|
|
380
|
+
return input;
|
|
381
|
+
}
|
|
382
|
+
if (seen.has(input)) {
|
|
383
|
+
throw new Error("Circular reference detected in ValueObject unwrap");
|
|
384
|
+
}
|
|
385
|
+
seen.add(input);
|
|
386
|
+
if (Array.isArray(input)) {
|
|
387
|
+
const result2 = input.map((item) => unwrapValueObject(item, seen));
|
|
388
|
+
seen.delete(input);
|
|
389
|
+
return result2;
|
|
390
|
+
}
|
|
391
|
+
if (input instanceof ValueObject) {
|
|
392
|
+
const result2 = unwrapValueObject(input.value, seen);
|
|
393
|
+
seen.delete(input);
|
|
394
|
+
return result2;
|
|
395
|
+
}
|
|
396
|
+
if (input instanceof Date) {
|
|
397
|
+
seen.delete(input);
|
|
398
|
+
return input.toISOString();
|
|
399
|
+
}
|
|
400
|
+
if (input instanceof Map) {
|
|
401
|
+
const result2 = /* @__PURE__ */ new Map();
|
|
402
|
+
input.forEach((value, key) => {
|
|
403
|
+
result2.set(key, unwrapValueObject(value, seen));
|
|
404
|
+
});
|
|
405
|
+
seen.delete(input);
|
|
406
|
+
return result2;
|
|
407
|
+
}
|
|
408
|
+
if (input instanceof Set) {
|
|
409
|
+
const result2 = new Set(
|
|
410
|
+
Array.from(input.values()).map((v) => unwrapValueObject(v, seen))
|
|
411
|
+
);
|
|
412
|
+
seen.delete(input);
|
|
413
|
+
return result2;
|
|
414
|
+
}
|
|
415
|
+
const result = {};
|
|
416
|
+
for (const key in input) {
|
|
417
|
+
if (Object.hasOwn(input, key)) {
|
|
418
|
+
result[key] = unwrapValueObject(input[key], seen);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
seen.delete(input);
|
|
422
|
+
return result;
|
|
423
|
+
}
|
|
424
|
+
function ensureObject(input) {
|
|
425
|
+
if (input === null || input === void 0) {
|
|
426
|
+
return {};
|
|
427
|
+
}
|
|
428
|
+
if (typeof input === "object") {
|
|
429
|
+
return input;
|
|
430
|
+
}
|
|
431
|
+
return { value: input };
|
|
432
|
+
}
|
|
433
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
434
|
+
0 && (module.exports = {
|
|
435
|
+
AggregateId,
|
|
436
|
+
ApplicationError,
|
|
437
|
+
DomainError,
|
|
438
|
+
EntityValidationError,
|
|
439
|
+
HttpStatus,
|
|
440
|
+
HttpStatusMessage,
|
|
441
|
+
InvalidValueObjectError,
|
|
442
|
+
ValueObject,
|
|
443
|
+
deepFreeze,
|
|
444
|
+
ensureObject,
|
|
445
|
+
unwrapValueObject
|
|
446
|
+
});
|
|
447
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/domain/base/domain.error.ts","../src/domain/base/vo.ts","../src/utils/deep-freeze.util.ts","../src/domain/errors/entity-validation.error.ts","../src/domain/errors/invalid-vo.error.ts","../src/domain/value-objects/aggregate-id.vo.ts","../src/gateway/constants/http-code.ts","../src/utils/errors/application.error.ts","../src/utils/unwrap-vo.util.ts"],"sourcesContent":["export * from './application';\nexport * from './domain/base/domain.error';\nexport * from './domain/base/vo';\nexport * from './domain/errors/entity-validation.error';\nexport * from './domain/errors/invalid-vo.error';\nexport * from './domain/value-objects/aggregate-id.vo';\nexport * from './gateway/constants/http-code';\nexport * from './utils';\n","export interface DomainErrorMetadata {\n cause?: { name: string; message: string; stack?: string };\n [key: string]: unknown;\n}\n\nconst getCauseInfo = (cause: Error | undefined) => {\n // 1. Handle Error objects specifically\n if (cause instanceof Error) {\n return {\n cause: {\n message: cause.message,\n stack: cause.stack,\n name: cause.name,\n },\n };\n }\n\n // 2. Handle other existing values\n if (cause) {\n return { cause };\n }\n\n // 3. Default to empty\n return {};\n};\n\n/**\n * Base class for all Domain Errors in the application.\n *\n * This class ensures:\n * 1. Serializable and structured for logs or API responses.\n * 2. Identifiable via stable error codes (not just class names).\n * 3. Contextual with optional structured metadata.\n * 4. Supports error chaining (cause) and stack trace preservation.\n *\n * @example\n * export class InsufficientFundsError extends DomainError {\n * constructor(accountId: string, currentBalance: number) {\n * super(\n * `Account ${accountId} has insufficient funds.`,\n * 'INSUFFICIENT_FUNDS',\n * { accountId, currentBalance }\n * );\n * }\n * }\n */\nexport abstract class DomainError extends Error {\n /** Stable, machine-readable error code */\n public readonly code: string;\n /** Structured, immutable domain metadata */\n public readonly metadata: Readonly<DomainErrorMetadata>;\n\n /**\n * @param message - Human-readable error message\n * @param code - Stable error code\n * @param metadata - Domain-specific structured data; optional `cause` can be included\n */\n protected constructor(\n message: string,\n code: string,\n metadata: DomainErrorMetadata = {},\n ) {\n super(message, { ...getCauseInfo(metadata.cause) });\n\n // Restore prototype chain for proper `instanceof` checks\n Object.setPrototypeOf(this, new.target.prototype);\n\n this.name = new.target.name;\n this.code = code;\n this.metadata = Object.freeze({ ...metadata });\n }\n}\n","import deepEqual from 'fast-deep-equal/es6';\n\nimport { deepFreeze } from '@/utils/deep-freeze.util';\n\nexport abstract class ValueObject<T> {\n get value(): T {\n return this.props;\n }\n\n protected readonly props: Readonly<T>;\n\n protected constructor(props: T) {\n this.validate(props);\n this.props = deepFreeze(props);\n }\n\n /**\n * Type guard to check if an unknown object is an instance of ValueObject.\n * This is useful for runtime type checking.\n *\n * @param vo The object to check.\n * @returns True if the object is a ValueObject instance, false otherwise.\n */\n public static is(vo: unknown): vo is ValueObject<unknown> {\n return vo instanceof ValueObject;\n }\n\n /**\n * Deep equality comparison of ValueObjects\n */\n public equals(other?: ValueObject<T>): boolean {\n if (\n !other ||\n !(other instanceof (this.constructor as typeof ValueObject))\n ) {\n return false;\n }\n\n return deepEqual(this.props, other.props);\n }\n\n /**\n * Validates the value object props\n * @throws InvalidValueObjectError if validation fails\n */\n protected abstract validate(props: T): void;\n}\n","/**\n * Utility to deeply freeze objects to ensure immutability\n */\nexport function deepFreeze<T>(\n obj: T,\n seen = new WeakSet<object>(),\n): Readonly<T> {\n // Handle null, undefined, or non-object types\n if (obj == null || (typeof obj !== 'object' && !Array.isArray(obj))) {\n return obj;\n }\n\n // Skip if already frozen\n if (Object.isFrozen(obj)) {\n return obj as Readonly<T>;\n }\n\n // Handle circular references\n if (seen.has(obj as object)) {\n return obj as Readonly<T>;\n }\n\n seen.add(obj as object);\n\n // Handle arrays explicitly\n if (Array.isArray(obj)) {\n obj.forEach(item => deepFreeze(item, seen));\n } else {\n // Handle plain objects\n for (const key in obj) {\n if (Object.hasOwn(obj, key)) {\n deepFreeze((obj as any)[key], seen); // Use 'any' here as T[key] might not be assignable to T for deepFreeze's input\n }\n }\n }\n\n return Object.freeze(obj) as Readonly<T>;\n}\n","import { DomainError } from '../base/domain.error';\n\n/**\n * Custom error class for entity validation failures.\n */\nexport class EntityValidationError extends DomainError {\n constructor(message: string, cause?: Error) {\n super(message, 'ENTITY_VALIDATION_ERROR', { cause });\n }\n}\n","import { DomainError } from '../base/domain.error';\n\nexport class InvalidValueObjectError extends DomainError {\n constructor(message: string) {\n super(message, 'INVALID_VALUE_OBJECT');\n }\n}\n","import { v4 } from 'uuid';\nimport z from 'zod';\n\nimport { InvalidValueObjectError } from '../errors/invalid-vo.error';\nimport { ValueObject } from '../base/vo';\n\n/**\n * AggregateId is a ValueObject that represents a unique identifier for an aggregate.\n */\nexport class AggregateId extends ValueObject<string> {\n /**\n * The schema for the AggregateId\n */\n private static readonly schema = z.uuid();\n\n /**\n * Get the UUID of the AggregateId\n * @returns The UUID of the AggregateId\n */\n public get uuid(): string {\n return this.value;\n }\n\n /**\n * Create a new AggregateId\n * @param value The value to create the AggregateId from\n * @returns The new AggregateId\n */\n public static create(value: string): AggregateId {\n return new AggregateId(value);\n }\n\n /**\n * Create a new AggregateId with a random UUID v4\n */\n public static generate(): AggregateId {\n return new AggregateId(v4());\n }\n\n /**\n * Check if the AggregateId is empty\n * @returns True if the AggregateId is empty, false otherwise\n */\n public isEmpty(): boolean {\n return !this.value;\n }\n\n /**\n * Convert the AggregateId to a string\n * @returns The string representation of the AggregateId\n */\n public toString(): string {\n return this.value;\n }\n\n /**\n * Validate the AggregateId\n * @param value The value to validate\n * @throws InvalidValueObjectException if the value is invalid\n */\n protected validate(value: string): void {\n const result = AggregateId.schema.safeParse(value);\n\n if (!result.success) {\n throw new InvalidValueObjectError(\n `Invalid AggregateId: ${result.error.message}`,\n );\n }\n }\n}\n","/**\n * HTTP status code catalog.\n *\n * This object provides a typed, immutable map of standard HTTP status names\n * to their numeric codes. Designed for server-side frameworks such as Fastify.\n *\n * - All identifiers use clear, canonical semantic names.\n * - Values are numeric status codes.\n * - Frozen to prevent runtime mutation.\n * - Exporting `HttpStatus` ensures type-safe usage across the codebase.\n */\nexport const HttpStatus = Object.freeze({\n REQUEST_HEADER_FIELDS_TOO_LARGE: 431,\n NETWORK_AUTHENTICATION_REQUIRED: 511,\n NON_AUTHORITATIVE_INFORMATION: 203,\n PROXY_AUTHENTICATION_REQUIRED: 407,\n\n UNAVAILABLE_FOR_LEGAL_REASONS: 451,\n HTTP_VERSION_NOT_SUPPORTED: 505,\n BANDWIDTH_LIMIT_EXCEEDED: 509,\n VARIANT_ALSO_NEGOTIATES: 506,\n UNSUPPORTED_MEDIA_TYPE: 415,\n RANGE_NOT_SATISFIABLE: 416,\n PRECONDITION_REQUIRED: 428,\n INTERNAL_SERVER_ERROR: 500,\n UNPROCESSABLE_ENTITY: 422,\n INSUFFICIENT_STORAGE: 507,\n\n SWITCHING_PROTOCOLS: 101,\n PRECONDITION_FAILED: 412,\n MISDIRECTED_REQUEST: 421,\n SERVICE_UNAVAILABLE: 503,\n TEMPORARY_REDIRECT: 307,\n PERMANENT_REDIRECT: 308,\n METHOD_NOT_ALLOWED: 405,\n EXPECTATION_FAILED: 417,\n\n MOVED_PERMANENTLY: 301,\n PAYLOAD_TOO_LARGE: 413,\n FAILED_DEPENDENCY: 424,\n TOO_MANY_REQUESTS: 429,\n ALREADY_REPORTED: 208,\n MULTIPLE_CHOICES: 300,\n PAYMENT_REQUIRED: 402,\n UPGRADE_REQUIRED: 426,\n PARTIAL_CONTENT: 206,\n REQUEST_TIMEOUT: 408,\n LENGTH_REQUIRED: 411,\n NOT_IMPLEMENTED: 501,\n GATEWAY_TIMEOUT: 504,\n NOT_ACCEPTABLE: 406,\n RESET_CONTENT: 205,\n LOOP_DETECTED: 508,\n MULTI_STATUS: 207,\n NOT_MODIFIED: 304,\n UNAUTHORIZED: 401,\n URI_TOO_LONG: 414,\n NOT_EXTENDED: 510,\n EARLY_HINTS: 103,\n BAD_REQUEST: 400,\n IM_A_TEAPOT: 418,\n BAD_GATEWAY: 502,\n PROCESSING: 102,\n NO_CONTENT: 204,\n SEE_OTHER: 303,\n USE_PROXY: 305,\n\n FORBIDDEN: 403,\n NOT_FOUND: 404,\n TOO_EARLY: 425,\n CONTINUE: 100,\n ACCEPTED: 202,\n CONFLICT: 409,\n CREATED: 201,\n IM_USED: 226,\n LOCKED: 423,\n FOUND: 302,\n GONE: 410,\n OK: 200,\n} as const);\n\n/**\n * HTTP status messages mapped by numeric code.\n * Use for sending descriptive text in responses or logging.\n */\nexport const HttpStatusMessage = {\n 431: 'Request Header Fields Too Large',\n 511: 'Network Authentication Required',\n 203: 'Non-Authoritative Information',\n 407: 'Proxy Authentication Required',\n 451: 'Unavailable For Legal Reasons',\n 505: 'HTTP Version Not Supported',\n 509: 'Bandwidth Limit Exceeded',\n 506: 'Variant Also Negotiates',\n 415: 'Unsupported Media Type',\n 416: 'Range Not Satisfiable',\n 428: 'Precondition Required',\n 500: 'Internal Server Error',\n 422: 'Unprocessable Entity',\n 507: 'Insufficient Storage',\n 101: 'Switching Protocols',\n 412: 'Precondition Failed',\n 421: 'Misdirected Request',\n 503: 'Service Unavailable',\n 307: 'Temporary Redirect',\n 308: 'Permanent Redirect',\n 405: 'Method Not Allowed',\n 417: 'Expectation Failed',\n 301: 'Moved Permanently',\n 413: 'Payload Too Large',\n 424: 'Failed Dependency',\n 429: 'Too Many Requests',\n 208: 'Already Reported',\n 300: 'Multiple Choices',\n 402: 'Payment Required',\n 426: 'Upgrade Required',\n 206: 'Partial Content',\n 408: 'Request Timeout',\n 411: 'Length Required',\n 501: 'Not Implemented',\n 504: 'Gateway Timeout',\n 406: 'Not Acceptable',\n 205: 'Reset Content',\n 508: 'Loop Detected',\n 207: 'Multi-Status',\n 304: 'Not Modified',\n 401: 'Unauthorized',\n 414: 'URI Too Long',\n 418: \"I'm a Teapot\",\n 510: 'Not Extended',\n 103: 'Early Hints',\n 400: 'Bad Request',\n 502: 'Bad Gateway',\n 102: 'Processing',\n 204: 'No Content',\n 303: 'See Other',\n 305: 'Use Proxy',\n 403: 'Forbidden',\n 404: 'Not Found',\n 425: 'Too Early',\n 100: 'Continue',\n 202: 'Accepted',\n 226: \"I'm Used\",\n 409: 'Conflict',\n 201: 'Created',\n 423: 'Locked',\n 302: 'Found',\n 410: 'Gone',\n 200: 'OK',\n} as const;\n\nexport type HttpStatusCode = keyof typeof HttpStatusMessage;\n\nexport type HttpStatusMessage =\n (typeof HttpStatusMessage)[keyof typeof HttpStatusMessage];\n","import {\n HttpStatusCode,\n HttpStatusMessage,\n} from '@/gateway/constants/http-code';\n\ninterface ErrorParams {\n message: string;\n code: HttpStatusMessage;\n status?: HttpStatusCode;\n metadata?: Record<string, unknown> | undefined;\n isOperational?: boolean;\n cause?: Error | undefined;\n}\n\n/**\n * Abstract base class for application-level errors with structured error handling.\n *\n * Extends the native Error class to provide machine-readable error codes, HTTP status codes,\n * operational error classification, and optional metadata for better error tracking and client communication.\n *\n * @abstract\n * @extends {Error}\n *\n * @example\n * ```typescript\n * class UserNotFoundError extends ApplicationError {\n * constructor(userId: string) {\n * super({\n * code: HttpStatusMessage['404'],\n * status: 404,\n * isOperational: true,\n * message: `User with id ${userId} not found`,\n * metadata: { userId }\n * });\n * }\n * }\n * ```\n */\nexport abstract class ApplicationError extends Error {\n /** Optional cause (linked error) */\n public readonly cause?: Error | undefined;\n /** Machine-readable error code (e.g. `OTP_LOCKED`, `USER_NOT_FOUND`) */\n public readonly code: HttpStatusMessage;\n /** Operational vs programmer error flag */\n public readonly isOperational: boolean;\n /** Optional structured metadata for debugging or clients */\n public readonly metadata?: Record<string, unknown> | undefined;\n /** HTTP status code intended for response layer */\n public readonly status: HttpStatusCode;\n\n constructor({\n code = HttpStatusMessage['500'],\n isOperational = false,\n status = 500,\n metadata,\n message,\n cause,\n }: ErrorParams) {\n super(message);\n\n this.name = new.target.name;\n this.code = code;\n this.status = status;\n this.isOperational = isOperational;\n this.metadata = metadata;\n this.cause = cause;\n\n Error.captureStackTrace(this, new.target);\n }\n}\n","import { ValueObject } from '@/domain/base/vo';\n\nexport type UnwrapValueObject<T> =\n T extends ValueObject<infer V>\n ? UnwrapValueObject<V>\n : T extends (infer U)[]\n ? UnwrapValueObject<U>[]\n : T extends Map<infer K, infer V>\n ? Map<K, UnwrapValueObject<V>>\n : T extends Set<infer V>\n ? Set<UnwrapValueObject<V>>\n : T extends Date\n ? string\n : T extends object\n ? { [K in keyof T]: UnwrapValueObject<T[K]> }\n : T;\n\nexport function unwrapValueObject<T>(\n input: T,\n seen = new WeakSet(),\n): UnwrapValueObject<T> {\n if (input === null || input === undefined) {\n return input as UnwrapValueObject<T>;\n }\n\n if (typeof input !== 'object') {\n return input as UnwrapValueObject<T>;\n }\n\n if (seen.has(input)) {\n // Prevent circular reference infinite recursion, just return input or throw\n throw new Error('Circular reference detected in ValueObject unwrap');\n }\n\n seen.add(input);\n\n if (Array.isArray(input)) {\n const result = input.map(item => unwrapValueObject(item, seen));\n seen.delete(input);\n return result as UnwrapValueObject<T>;\n }\n\n if (input instanceof ValueObject) {\n const result = unwrapValueObject(input.value, seen);\n seen.delete(input);\n return result as UnwrapValueObject<T>;\n }\n\n if (input instanceof Date) {\n seen.delete(input);\n return input.toISOString() as UnwrapValueObject<T>;\n }\n\n if (input instanceof Map) {\n const result = new Map();\n input.forEach((value, key) => {\n result.set(key, unwrapValueObject(value, seen));\n });\n seen.delete(input);\n return result as UnwrapValueObject<T>;\n }\n\n if (input instanceof Set) {\n const result = new Set(\n Array.from(input.values()).map(v => unwrapValueObject(v, seen)),\n );\n seen.delete(input);\n return result as UnwrapValueObject<T>;\n }\n\n // generic object\n const result: Record<string, unknown> = {};\n\n for (const key in input) {\n if (Object.hasOwn(input, key)) {\n result[key] = unwrapValueObject((input as any)[key], seen);\n }\n }\n\n seen.delete(input);\n return result as UnwrapValueObject<T>;\n}\n\nexport function ensureObject<T>(input: UnwrapValueObject<T>): object {\n if (input === null || input === undefined) {\n return {};\n }\n if (typeof input === 'object') {\n return input;\n }\n\n // for primitives, wrap inside object with default key (or throw)\n return { value: input };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,eAAe,CAAC,UAA6B;AAEjD,MAAI,iBAA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