@rtpaulino/entity 0.25.0 → 0.26.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.
@@ -3,6 +3,23 @@ import type { PrimitiveConstructor } from './types.js';
3
3
  * Checks if a constructor is a supported primitive type constructor
4
4
  */
5
5
  export declare function isPrimitiveConstructor(constructor: any): constructor is PrimitiveConstructor;
6
+ /**
7
+ * Deserializes a number value
8
+ */
9
+ export declare function deserializeNumber(value: unknown): number;
10
+ /**
11
+ * Deserializes a number from a `bigint` or an integer-formatted string.
12
+ *
13
+ * Accepts:
14
+ * - `number` — returned as-is (delegates to `deserializeNumber`)
15
+ * - `bigint` — converted via `Number(value)`
16
+ * - `string` — must consist solely of an optional leading `-` followed by digits;
17
+ * parsed as a bigint first and then converted to a number
18
+ *
19
+ * @warning Information may be lost if the `BigInt` value exceeds the safe integer
20
+ * range for `number` (`Number.MAX_SAFE_INTEGER` / `Number.MIN_SAFE_INTEGER`).
21
+ */
22
+ export declare function deserializeNumberFromBigInt(value: unknown): number;
6
23
  /**
7
24
  * Deserializes a primitive value based on its type constructor
8
25
  *
@@ -1 +1 @@
1
- {"version":3,"file":"primitive-deserializers.d.ts","sourceRoot":"","sources":["../../src/lib/primitive-deserializers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,GAAG,GACf,WAAW,IAAI,oBAAoB,CAQrC;AA4ED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,oBAAoB,GACpC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAkB3C"}
1
+ {"version":3,"file":"primitive-deserializers.d.ts","sourceRoot":"","sources":["../../src/lib/primitive-deserializers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,GAAG,GACf,WAAW,IAAI,oBAAoB,CAQrC;AAcD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOxD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAalE;AAoDD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,oBAAoB,GACpC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAkB3C"}
@@ -14,12 +14,35 @@
14
14
  }
15
15
  /**
16
16
  * Deserializes a number value
17
- */ function deserializeNumber(value) {
17
+ */ export function deserializeNumber(value) {
18
18
  if (typeof value !== 'number') {
19
19
  throw createValidationError(`Expects a number but received ${typeof value}`);
20
20
  }
21
21
  return value;
22
22
  }
23
+ /**
24
+ * Deserializes a number from a `bigint` or an integer-formatted string.
25
+ *
26
+ * Accepts:
27
+ * - `number` — returned as-is (delegates to `deserializeNumber`)
28
+ * - `bigint` — converted via `Number(value)`
29
+ * - `string` — must consist solely of an optional leading `-` followed by digits;
30
+ * parsed as a bigint first and then converted to a number
31
+ *
32
+ * @warning Information may be lost if the `BigInt` value exceeds the safe integer
33
+ * range for `number` (`Number.MAX_SAFE_INTEGER` / `Number.MIN_SAFE_INTEGER`).
34
+ */ export function deserializeNumberFromBigInt(value) {
35
+ if (typeof value === 'number') {
36
+ return deserializeNumber(value);
37
+ }
38
+ if (typeof value === 'bigint') {
39
+ return Number(value);
40
+ }
41
+ if (typeof value === 'string' && /^-?\d+$/.test(value)) {
42
+ return Number(BigInt(value));
43
+ }
44
+ throw createValidationError(`Expects a number, bigint, or integer string but received ${typeof value === 'string' ? `string '${value}'` : typeof value}`);
45
+ }
23
46
  /**
24
47
  * Deserializes a boolean value
25
48
  */ function deserializeBoolean(value) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/primitive-deserializers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { PrimitiveConstructor } from './types.js';\nimport { createValidationError } from './validation-utils.js';\n\n/**\n * Checks if a constructor is a supported primitive type constructor\n */\nexport function isPrimitiveConstructor(\n constructor: any,\n): constructor is PrimitiveConstructor {\n return (\n constructor === String ||\n constructor === Number ||\n constructor === Boolean ||\n constructor === BigInt ||\n constructor === Date\n );\n}\n\n/**\n * Deserializes a string value\n */\nfunction deserializeString(value: unknown): string {\n if (typeof value !== 'string') {\n throw createValidationError(\n `Expects a string but received ${typeof value}`,\n );\n }\n return value;\n}\n\n/**\n * Deserializes a number value\n */\nfunction deserializeNumber(value: unknown): number {\n if (typeof value !== 'number') {\n throw createValidationError(\n `Expects a number but received ${typeof value}`,\n );\n }\n return value;\n}\n\n/**\n * Deserializes a boolean value\n */\nfunction deserializeBoolean(value: unknown): boolean {\n if (typeof value !== 'boolean') {\n throw createValidationError(\n `Expects a boolean but received ${typeof value}`,\n );\n }\n return value;\n}\n\n/**\n * Deserializes a BigInt value (accepts bigint or string)\n */\nfunction deserializeBigInt(value: unknown): bigint {\n if (typeof value === 'bigint') {\n return value;\n }\n if (typeof value === 'string') {\n try {\n return BigInt(value);\n } catch {\n throw createValidationError(`Cannot parse '${value}' as BigInt`);\n }\n }\n throw createValidationError(\n `Expects a bigint or string but received ${typeof value}`,\n );\n}\n\n/**\n * Deserializes a Date value (accepts Date instance or ISO string)\n */\nfunction deserializeDate(value: unknown): Date {\n if (value instanceof Date) {\n return value;\n }\n if (typeof value === 'string') {\n const date = new Date(value);\n if (isNaN(date.getTime())) {\n throw createValidationError(`Cannot parse '${value}' as Date`);\n }\n return date;\n }\n throw createValidationError(\n `Expects a Date or ISO string but received ${typeof value}`,\n );\n}\n\n/**\n * Deserializes a primitive value based on its type constructor\n *\n * @param value - The value to deserialize\n * @param typeConstructor - The primitive type constructor (String, Number, Boolean, BigInt, Date)\n * @returns The deserialized value\n * @throws ValidationError with empty property if type mismatch or parse error\n */\nexport function deserializePrimitive(\n value: unknown,\n typeConstructor: PrimitiveConstructor,\n): string | number | boolean | bigint | Date {\n if (typeConstructor === String) {\n return deserializeString(value);\n }\n if (typeConstructor === Number) {\n return deserializeNumber(value);\n }\n if (typeConstructor === Boolean) {\n return deserializeBoolean(value);\n }\n if (typeConstructor === BigInt) {\n return deserializeBigInt(value);\n }\n if (typeConstructor === Date) {\n return deserializeDate(value);\n }\n\n throw createValidationError(`Unknown primitive type constructor`);\n}\n"],"names":["createValidationError","isPrimitiveConstructor","constructor","String","Number","Boolean","BigInt","Date","deserializeString","value","deserializeNumber","deserializeBoolean","deserializeBigInt","deserializeDate","date","isNaN","getTime","deserializePrimitive","typeConstructor"],"mappings":"AAAA,qDAAqD,GAErD,SAASA,qBAAqB,QAAQ,wBAAwB;AAE9D;;CAEC,GACD,OAAO,SAASC,uBACdC,WAAgB;IAEhB,OACEA,gBAAgBC,UAChBD,gBAAgBE,UAChBF,gBAAgBG,WAChBH,gBAAgBI,UAChBJ,gBAAgBK;AAEpB;AAEA;;CAEC,GACD,SAASC,kBAAkBC,KAAc;IACvC,IAAI,OAAOA,UAAU,UAAU;QAC7B,MAAMT,sBACJ,CAAC,8BAA8B,EAAE,OAAOS,OAAO;IAEnD;IACA,OAAOA;AACT;AAEA;;CAEC,GACD,SAASC,kBAAkBD,KAAc;IACvC,IAAI,OAAOA,UAAU,UAAU;QAC7B,MAAMT,sBACJ,CAAC,8BAA8B,EAAE,OAAOS,OAAO;IAEnD;IACA,OAAOA;AACT;AAEA;;CAEC,GACD,SAASE,mBAAmBF,KAAc;IACxC,IAAI,OAAOA,UAAU,WAAW;QAC9B,MAAMT,sBACJ,CAAC,+BAA+B,EAAE,OAAOS,OAAO;IAEpD;IACA,OAAOA;AACT;AAEA;;CAEC,GACD,SAASG,kBAAkBH,KAAc;IACvC,IAAI,OAAOA,UAAU,UAAU;QAC7B,OAAOA;IACT;IACA,IAAI,OAAOA,UAAU,UAAU;QAC7B,IAAI;YACF,OAAOH,OAAOG;QAChB,EAAE,OAAM;YACN,MAAMT,sBAAsB,CAAC,cAAc,EAAES,MAAM,WAAW,CAAC;QACjE;IACF;IACA,MAAMT,sBACJ,CAAC,wCAAwC,EAAE,OAAOS,OAAO;AAE7D;AAEA;;CAEC,GACD,SAASI,gBAAgBJ,KAAc;IACrC,IAAIA,iBAAiBF,MAAM;QACzB,OAAOE;IACT;IACA,IAAI,OAAOA,UAAU,UAAU;QAC7B,MAAMK,OAAO,IAAIP,KAAKE;QACtB,IAAIM,MAAMD,KAAKE,OAAO,KAAK;YACzB,MAAMhB,sBAAsB,CAAC,cAAc,EAAES,MAAM,SAAS,CAAC;QAC/D;QACA,OAAOK;IACT;IACA,MAAMd,sBACJ,CAAC,0CAA0C,EAAE,OAAOS,OAAO;AAE/D;AAEA;;;;;;;CAOC,GACD,OAAO,SAASQ,qBACdR,KAAc,EACdS,eAAqC;IAErC,IAAIA,oBAAoBf,QAAQ;QAC9B,OAAOK,kBAAkBC;IAC3B;IACA,IAAIS,oBAAoBd,QAAQ;QAC9B,OAAOM,kBAAkBD;IAC3B;IACA,IAAIS,oBAAoBb,SAAS;QAC/B,OAAOM,mBAAmBF;IAC5B;IACA,IAAIS,oBAAoBZ,QAAQ;QAC9B,OAAOM,kBAAkBH;IAC3B;IACA,IAAIS,oBAAoBX,MAAM;QAC5B,OAAOM,gBAAgBJ;IACzB;IAEA,MAAMT,sBAAsB,CAAC,kCAAkC,CAAC;AAClE"}
1
+ {"version":3,"sources":["../../src/lib/primitive-deserializers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { PrimitiveConstructor } from './types.js';\nimport { createValidationError } from './validation-utils.js';\n\n/**\n * Checks if a constructor is a supported primitive type constructor\n */\nexport function isPrimitiveConstructor(\n constructor: any,\n): constructor is PrimitiveConstructor {\n return (\n constructor === String ||\n constructor === Number ||\n constructor === Boolean ||\n constructor === BigInt ||\n constructor === Date\n );\n}\n\n/**\n * Deserializes a string value\n */\nfunction deserializeString(value: unknown): string {\n if (typeof value !== 'string') {\n throw createValidationError(\n `Expects a string but received ${typeof value}`,\n );\n }\n return value;\n}\n\n/**\n * Deserializes a number value\n */\nexport function deserializeNumber(value: unknown): number {\n if (typeof value !== 'number') {\n throw createValidationError(\n `Expects a number but received ${typeof value}`,\n );\n }\n return value;\n}\n\n/**\n * Deserializes a number from a `bigint` or an integer-formatted string.\n *\n * Accepts:\n * - `number` — returned as-is (delegates to `deserializeNumber`)\n * - `bigint` — converted via `Number(value)`\n * - `string` — must consist solely of an optional leading `-` followed by digits;\n * parsed as a bigint first and then converted to a number\n *\n * @warning Information may be lost if the `BigInt` value exceeds the safe integer\n * range for `number` (`Number.MAX_SAFE_INTEGER` / `Number.MIN_SAFE_INTEGER`).\n */\nexport function deserializeNumberFromBigInt(value: unknown): number {\n if (typeof value === 'number') {\n return deserializeNumber(value);\n }\n if (typeof value === 'bigint') {\n return Number(value);\n }\n if (typeof value === 'string' && /^-?\\d+$/.test(value)) {\n return Number(BigInt(value));\n }\n throw createValidationError(\n `Expects a number, bigint, or integer string but received ${typeof value === 'string' ? `string '${value}'` : typeof value}`,\n );\n}\n\n/**\n * Deserializes a boolean value\n */\nfunction deserializeBoolean(value: unknown): boolean {\n if (typeof value !== 'boolean') {\n throw createValidationError(\n `Expects a boolean but received ${typeof value}`,\n );\n }\n return value;\n}\n\n/**\n * Deserializes a BigInt value (accepts bigint or string)\n */\nfunction deserializeBigInt(value: unknown): bigint {\n if (typeof value === 'bigint') {\n return value;\n }\n if (typeof value === 'string') {\n try {\n return BigInt(value);\n } catch {\n throw createValidationError(`Cannot parse '${value}' as BigInt`);\n }\n }\n throw createValidationError(\n `Expects a bigint or string but received ${typeof value}`,\n );\n}\n\n/**\n * Deserializes a Date value (accepts Date instance or ISO string)\n */\nfunction deserializeDate(value: unknown): Date {\n if (value instanceof Date) {\n return value;\n }\n if (typeof value === 'string') {\n const date = new Date(value);\n if (isNaN(date.getTime())) {\n throw createValidationError(`Cannot parse '${value}' as Date`);\n }\n return date;\n }\n throw createValidationError(\n `Expects a Date or ISO string but received ${typeof value}`,\n );\n}\n\n/**\n * Deserializes a primitive value based on its type constructor\n *\n * @param value - The value to deserialize\n * @param typeConstructor - The primitive type constructor (String, Number, Boolean, BigInt, Date)\n * @returns The deserialized value\n * @throws ValidationError with empty property if type mismatch or parse error\n */\nexport function deserializePrimitive(\n value: unknown,\n typeConstructor: PrimitiveConstructor,\n): string | number | boolean | bigint | Date {\n if (typeConstructor === String) {\n return deserializeString(value);\n }\n if (typeConstructor === Number) {\n return deserializeNumber(value);\n }\n if (typeConstructor === Boolean) {\n return deserializeBoolean(value);\n }\n if (typeConstructor === BigInt) {\n return deserializeBigInt(value);\n }\n if (typeConstructor === Date) {\n return deserializeDate(value);\n }\n\n throw createValidationError(`Unknown primitive type constructor`);\n}\n"],"names":["createValidationError","isPrimitiveConstructor","constructor","String","Number","Boolean","BigInt","Date","deserializeString","value","deserializeNumber","deserializeNumberFromBigInt","test","deserializeBoolean","deserializeBigInt","deserializeDate","date","isNaN","getTime","deserializePrimitive","typeConstructor"],"mappings":"AAAA,qDAAqD,GAErD,SAASA,qBAAqB,QAAQ,wBAAwB;AAE9D;;CAEC,GACD,OAAO,SAASC,uBACdC,WAAgB;IAEhB,OACEA,gBAAgBC,UAChBD,gBAAgBE,UAChBF,gBAAgBG,WAChBH,gBAAgBI,UAChBJ,gBAAgBK;AAEpB;AAEA;;CAEC,GACD,SAASC,kBAAkBC,KAAc;IACvC,IAAI,OAAOA,UAAU,UAAU;QAC7B,MAAMT,sBACJ,CAAC,8BAA8B,EAAE,OAAOS,OAAO;IAEnD;IACA,OAAOA;AACT;AAEA;;CAEC,GACD,OAAO,SAASC,kBAAkBD,KAAc;IAC9C,IAAI,OAAOA,UAAU,UAAU;QAC7B,MAAMT,sBACJ,CAAC,8BAA8B,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;;CAOC,GACD,OAAO,SAASU,qBACdV,KAAc,EACdW,eAAqC;IAErC,IAAIA,oBAAoBjB,QAAQ;QAC9B,OAAOK,kBAAkBC;IAC3B;IACA,IAAIW,oBAAoBhB,QAAQ;QAC9B,OAAOM,kBAAkBD;IAC3B;IACA,IAAIW,oBAAoBf,SAAS;QAC/B,OAAOQ,mBAAmBJ;IAC5B;IACA,IAAIW,oBAAoBd,QAAQ;QAC9B,OAAOQ,kBAAkBL;IAC3B;IACA,IAAIW,oBAAoBb,MAAM;QAC5B,OAAOQ,gBAAgBN;IACzB;IAEA,MAAMT,sBAAsB,CAAC,kCAAkC,CAAC;AAClE"}
@@ -100,6 +100,14 @@ export declare function EnumProperty<T extends Record<string, string>>(enumType:
100
100
  export declare function numberPropertyOptions(options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {
101
101
  min?: number;
102
102
  max?: number;
103
+ /**
104
+ * When `true`, `bigint` values and integer-formatted strings (e.g. `"-42"`) will
105
+ * be coerced to `number` during deserialization.
106
+ *
107
+ * @warning Information may be lost if the `BigInt` value exceeds the safe integer
108
+ * range for `number` (`Number.MAX_SAFE_INTEGER` / `Number.MIN_SAFE_INTEGER`).
109
+ */
110
+ parseBigInt?: boolean;
103
111
  }): PropertyOptions<number, NumberConstructor>;
104
112
  /**
105
113
  * Helper decorator for number properties
@@ -118,6 +126,14 @@ export declare function numberPropertyOptions(options?: Omit<PropertyOptions<num
118
126
  export declare function NumberProperty(options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {
119
127
  min?: number;
120
128
  max?: number;
129
+ /**
130
+ * When `true`, `bigint` values and integer-formatted strings (e.g. `"-42"`) will
131
+ * be coerced to `number` during deserialization.
132
+ *
133
+ * @warning Information may be lost if the `BigInt` value exceeds the safe integer
134
+ * range for `number` (`Number.MAX_SAFE_INTEGER` / `Number.MIN_SAFE_INTEGER`).
135
+ */
136
+ parseBigInt?: boolean;
121
137
  }): PropertyDecorator;
122
138
  /**
123
139
  * Creates property options for an integer property
@@ -126,6 +142,14 @@ export declare function NumberProperty(options?: Omit<PropertyOptions<number, Nu
126
142
  export declare function intPropertyOptions(options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {
127
143
  min?: number;
128
144
  max?: number;
145
+ /**
146
+ * When `true`, `bigint` values and integer-formatted strings (e.g. `"-42"`) will
147
+ * be coerced to `number` during deserialization.
148
+ *
149
+ * @warning Information may be lost if the `BigInt` value exceeds the safe integer
150
+ * range for `number` (`Number.MAX_SAFE_INTEGER` / `Number.MIN_SAFE_INTEGER`).
151
+ */
152
+ parseBigInt?: boolean;
129
153
  }): PropertyOptions<number, NumberConstructor>;
130
154
  /**
131
155
  * Helper decorator for integer properties
@@ -145,6 +169,14 @@ export declare function intPropertyOptions(options?: Omit<PropertyOptions<number
145
169
  export declare function IntProperty(options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {
146
170
  min?: number;
147
171
  max?: number;
172
+ /**
173
+ * When `true`, `bigint` values and integer-formatted strings (e.g. `"-42"`) will
174
+ * be coerced to `number` during deserialization.
175
+ *
176
+ * @warning Information may be lost if the `BigInt` value exceeds the safe integer
177
+ * range for `number` (`Number.MAX_SAFE_INTEGER` / `Number.MIN_SAFE_INTEGER`).
178
+ */
179
+ parseBigInt?: boolean;
148
180
  }): PropertyDecorator;
149
181
  /**
150
182
  * Creates property options for a boolean property
@@ -356,10 +388,11 @@ export declare function DiscriminatedEntityProperty(options?: Omit<PropertyOptio
356
388
  * This decorator can be used standalone (it will treat the property as a string) or combined
357
389
  * with another type decorator for more specific typing.
358
390
  *
359
- * @param enumType - Optional enum or union type for the discriminator (used for validation and schema generation)
391
+ * @param enumType - Optional enum, union type, or stringifiable type for the discriminator (used for validation and schema generation)
360
392
  *
361
393
  * @example
362
394
  * ```typescript
395
+ * // With regular enum
363
396
  * enum SchemaPropertyType {
364
397
  * STRING = 'string',
365
398
  * NUMBER = 'number',
@@ -383,11 +416,36 @@ export declare function DiscriminatedEntityProperty(options?: Omit<PropertyOptio
383
416
  * minLength?: number;
384
417
  * }
385
418
  *
419
+ * // With stringifiable type
420
+ * class Status {
421
+ * static ACTIVE = new Status('active');
422
+ * static INACTIVE = new Status('inactive');
423
+ *
424
+ * constructor(private value: string) {}
425
+ * toString() { return this.value; }
426
+ * static parse(value: string) {
427
+ * if (value === 'active') return Status.ACTIVE;
428
+ * if (value === 'inactive') return Status.INACTIVE;
429
+ * throw new Error('Invalid status');
430
+ * }
431
+ * }
432
+ *
433
+ * @Entity()
434
+ * abstract class Record {
435
+ * @PolymorphicProperty(() => Status)
436
+ * status!: Status;
437
+ * }
438
+ *
386
439
  * // Parsing automatically instantiates the correct subclass
387
440
  * const data = { name: 'age', type: 'string', minLength: 5 };
388
441
  * const prop = await EntityUtils.parse(SchemaProperty, data);
389
442
  * // prop is StringSchemaProperty instance
390
443
  * ```
391
444
  */
392
- export declare function PolymorphicProperty(enumType?: any): PropertyDecorator;
445
+ export declare function PolymorphicProperty<T extends {
446
+ equals?(other: T): boolean;
447
+ toString(): string;
448
+ }, C extends CtorLike<T> & {
449
+ parse(value: string): T;
450
+ }>(enumTypeOrFactory?: Record<string, string> | (() => C)): PropertyDecorator;
393
451
  //# sourceMappingURL=property.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../src/lib/property.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,OAAO,EACP,KAAK,QAAQ,EAKb,eAAe,EAChB,MAAM,YAAY,CAAC;AAcpB;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAC/C,OAAO,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAC7B,iBAAiB,CA2EnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,i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,CAAC,EAAE,MAAM,CAAC;CAChC,GACA,iBAAiB,CAEnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,wBAAgB,mBAAmB,CACjC,CAAC,SAAS;IAAE,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;IAAC,QAAQ,IAAI,MAAM,CAAA;CAAE,EAC5D,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,GAAG;IAAE,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAA;CAAE,EACnD,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,iBAAiB,CAoE3E"}
@@ -2,6 +2,7 @@
2
2
  import { PROPERTY_METADATA_KEY, PROPERTY_OPTIONS_METADATA_KEY, POLYMORPHIC_PROPERTY_METADATA_KEY } from './types.js';
3
3
  import { enumValidator, intValidator, minLengthValidator, maxLengthValidator, patternValidator, minValidator, maxValidator, arrayMinLengthValidator, arrayMaxLengthValidator } from './validators.js';
4
4
  import { PolymorphicRegistry } from './polymorphic-registry.js';
5
+ import { deserializeNumberFromBigInt } from './primitive-deserializers.js';
5
6
  /**
6
7
  * Property decorator that marks class properties with metadata.
7
8
  * This decorator can be used to identify and track properties within classes.
@@ -170,11 +171,16 @@ import { PolymorphicRegistry } from './polymorphic-registry.js';
170
171
  validators.unshift(maxValidator(options.max));
171
172
  }
172
173
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
173
- const { min, max, ...restOptions } = options || {};
174
+ const { min, max, parseBigInt, ...restOptions } = options || {};
175
+ const deserialize = parseBigInt ? deserializeNumberFromBigInt : undefined;
174
176
  return {
175
177
  ...restOptions,
176
178
  type: ()=>Number,
177
- validators: validators.length > 0 ? validators : undefined
179
+ validators: validators.length > 0 ? validators : undefined,
180
+ ...deserialize ? {
181
+ serialize: (v)=>v,
182
+ deserialize
183
+ } : {}
178
184
  };
179
185
  }
180
186
  /**
@@ -208,11 +214,16 @@ import { PolymorphicRegistry } from './polymorphic-registry.js';
208
214
  }
209
215
  validators.unshift(intValidator());
210
216
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
211
- const { min, max, ...restOptions } = options || {};
217
+ const { min, max, parseBigInt, ...restOptions } = options || {};
218
+ const deserialize = parseBigInt ? deserializeNumberFromBigInt : undefined;
212
219
  return {
213
220
  ...restOptions,
214
221
  type: ()=>Number,
215
- validators: validators.length > 0 ? validators : undefined
222
+ validators: validators.length > 0 ? validators : undefined,
223
+ ...deserialize ? {
224
+ serialize: (v)=>v,
225
+ deserialize
226
+ } : {}
216
227
  };
217
228
  }
218
229
  /**
@@ -500,10 +511,11 @@ export function DiscriminatedEntityProperty(options) {
500
511
  * This decorator can be used standalone (it will treat the property as a string) or combined
501
512
  * with another type decorator for more specific typing.
502
513
  *
503
- * @param enumType - Optional enum or union type for the discriminator (used for validation and schema generation)
514
+ * @param enumType - Optional enum, union type, or stringifiable type for the discriminator (used for validation and schema generation)
504
515
  *
505
516
  * @example
506
517
  * ```typescript
518
+ * // With regular enum
507
519
  * enum SchemaPropertyType {
508
520
  * STRING = 'string',
509
521
  * NUMBER = 'number',
@@ -527,12 +539,32 @@ export function DiscriminatedEntityProperty(options) {
527
539
  * minLength?: number;
528
540
  * }
529
541
  *
542
+ * // With stringifiable type
543
+ * class Status {
544
+ * static ACTIVE = new Status('active');
545
+ * static INACTIVE = new Status('inactive');
546
+ *
547
+ * constructor(private value: string) {}
548
+ * toString() { return this.value; }
549
+ * static parse(value: string) {
550
+ * if (value === 'active') return Status.ACTIVE;
551
+ * if (value === 'inactive') return Status.INACTIVE;
552
+ * throw new Error('Invalid status');
553
+ * }
554
+ * }
555
+ *
556
+ * @Entity()
557
+ * abstract class Record {
558
+ * @PolymorphicProperty(() => Status)
559
+ * status!: Status;
560
+ * }
561
+ *
530
562
  * // Parsing automatically instantiates the correct subclass
531
563
  * const data = { name: 'age', type: 'string', minLength: 5 };
532
564
  * const prop = await EntityUtils.parse(SchemaProperty, data);
533
565
  * // prop is StringSchemaProperty instance
534
566
  * ```
535
- */ export function PolymorphicProperty(enumType) {
567
+ */ export function PolymorphicProperty(enumTypeOrFactory) {
536
568
  return (target, propertyKey)=>{
537
569
  if (typeof propertyKey !== 'string') {
538
570
  return;
@@ -548,18 +580,30 @@ export function DiscriminatedEntityProperty(options) {
548
580
  const updatedOptions = {
549
581
  ...existingOptions,
550
582
  polymorphicDiscriminator: true,
551
- polymorphicEnumType: enumType
583
+ polymorphicEnumType: enumTypeOrFactory
552
584
  };
553
585
  Reflect.defineMetadata(PROPERTY_OPTIONS_METADATA_KEY, updatedOptions, target, propertyKey);
554
586
  } else {
555
- // No existing decorator - apply Property decorator with string type
556
- // (enum discriminators are typically strings)
557
- const options = {
558
- type: ()=>String,
559
- polymorphicDiscriminator: true,
560
- polymorphicEnumType: enumType
561
- };
562
- Property(options)(target, propertyKey);
587
+ // No existing decorator - check if it's a stringifiable type or enum
588
+ const isStringifiable = typeof enumTypeOrFactory === 'function';
589
+ if (isStringifiable) {
590
+ // Apply StringifiableProperty decorator with polymorphic flags
591
+ const stringifiableOpts = stringifiablePropertyOptions(enumTypeOrFactory);
592
+ const options = {
593
+ ...stringifiableOpts,
594
+ polymorphicDiscriminator: true,
595
+ polymorphicEnumType: enumTypeOrFactory
596
+ };
597
+ Property(options)(target, propertyKey);
598
+ } else {
599
+ // Apply Property decorator with string type (for enum discriminators)
600
+ const options = {
601
+ type: ()=>String,
602
+ polymorphicDiscriminator: true,
603
+ polymorphicEnumType: enumTypeOrFactory
604
+ };
605
+ Property(options)(target, propertyKey);
606
+ }
563
607
  }
564
608
  };
565
609
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/property.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-wrapper-object-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { isEqual } from 'lodash-es';\nimport {\n AnyCtor,\n type CtorLike,\n type InstanceOfCtorLike,\n PROPERTY_METADATA_KEY,\n PROPERTY_OPTIONS_METADATA_KEY,\n POLYMORPHIC_PROPERTY_METADATA_KEY,\n PropertyOptions,\n} from './types.js';\nimport {\n enumValidator,\n intValidator,\n minLengthValidator,\n maxLengthValidator,\n patternValidator,\n minValidator,\n maxValidator,\n arrayMinLengthValidator,\n arrayMaxLengthValidator,\n} from './validators.js';\nimport { PolymorphicRegistry } from './polymorphic-registry.js';\n\n/**\n * Property decorator that marks class properties with metadata.\n * This decorator can be used to identify and track properties within classes.\n *\n * @param options - Configuration for the property (type is required)\n *\n * @example\n * class User {\n * @Property({ type: () => String })\n * name: string;\n *\n * @Property({ type: () => String, equals: (a, b) => a.toLowerCase() === b.toLowerCase() })\n * email: string;\n *\n * @Property({ type: () => Number })\n * age: number;\n * }\n */\nexport function Property<T, C extends CtorLike<T>>(\n options: PropertyOptions<T, C>,\n): PropertyDecorator {\n return (target: object, propertyKey: string | symbol): void => {\n if (typeof propertyKey !== 'string') {\n return;\n }\n\n const existingProperties: string[] =\n Reflect.getOwnMetadata(PROPERTY_METADATA_KEY, target) || [];\n\n if (!existingProperties.includes(propertyKey)) {\n existingProperties.push(propertyKey);\n }\n\n Reflect.defineMetadata(PROPERTY_METADATA_KEY, existingProperties, target);\n\n if (options.passthrough === true) {\n if (options.array === true) {\n throw new Error(\n `Property '${propertyKey}' has passthrough: true and array: true. Passthrough cannot be combined with array.`,\n );\n }\n if (options.optional === true) {\n throw new Error(\n `Property '${propertyKey}' has passthrough: true and optional: true. Passthrough cannot be combined with optional.`,\n );\n }\n if (options.sparse === true) {\n throw new Error(\n `Property '${propertyKey}' has passthrough: true and sparse: true. Passthrough cannot be combined with sparse.`,\n );\n }\n if (\n options.serialize !== undefined ||\n options.deserialize !== undefined\n ) {\n throw new Error(\n `Property '${propertyKey}' has passthrough: true and custom serialize/deserialize functions. Passthrough cannot be combined with serialize or deserialize.`,\n );\n }\n }\n\n if (options.sparse === true && options.array !== true) {\n throw new Error(\n `Property '${propertyKey}' has sparse: true but array is not true. The sparse option only applies to arrays.`,\n );\n }\n\n if (options.arrayValidators && options.array !== true) {\n throw new Error(\n `Property '${propertyKey}' has arrayValidators defined but array is not true. The arrayValidators option only applies to arrays.`,\n );\n }\n\n // Validate serialize/deserialize pairing\n const hasSerialize = options.serialize !== undefined;\n const hasDeserialize = options.deserialize !== undefined;\n if (hasSerialize !== hasDeserialize) {\n throw new Error(\n `Property '${propertyKey}' must define both serialize and deserialize functions, or neither. Found only ${hasSerialize ? 'serialize' : 'deserialize'}.`,\n );\n }\n\n const existingOptions: Record<\n string,\n PropertyOptions<any, any>\n > = Reflect.getOwnMetadata(PROPERTY_OPTIONS_METADATA_KEY, target) || {};\n\n existingOptions[propertyKey] = options;\n\n Reflect.defineMetadata(\n PROPERTY_OPTIONS_METADATA_KEY,\n existingOptions,\n target,\n );\n };\n}\n\n/**\n * Helper decorator for string properties\n * @example\n * class User {\n * @StringProperty()\n * name!: string;\n *\n * @StringProperty({ optional: true })\n * nickname?: string;\n *\n * @StringProperty({ minLength: 3, maxLength: 50 })\n * username!: string;\n *\n * @StringProperty({ pattern: /^[a-z]+$/ })\n * slug!: string;\n * }\n */\n/**\n * Creates property options for a string property with optional validation\n * Used internally by StringProperty decorator and Props.String helper\n */\nexport function stringPropertyOptions(\n options?: Omit<PropertyOptions<string, StringConstructor>, 'type'> & {\n minLength?: number;\n maxLength?: number;\n pattern?: RegExp;\n patternMessage?: string;\n },\n): PropertyOptions<string, StringConstructor> {\n const validators = [...(options?.validators || [])];\n\n if (options?.minLength !== undefined) {\n validators.unshift(minLengthValidator(options.minLength));\n }\n if (options?.maxLength !== undefined) {\n validators.unshift(maxLengthValidator(options.maxLength));\n }\n if (options?.pattern !== undefined) {\n validators.unshift(\n patternValidator(options.pattern, options.patternMessage),\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { minLength, maxLength, pattern, patternMessage, ...restOptions } =\n options || {};\n\n return {\n ...restOptions,\n type: () => String,\n validators: validators.length > 0 ? validators : undefined,\n };\n}\n\n/**\n * Helper decorator for string properties\n * @example\n * class User {\n * @StringProperty()\n * name!: string;\n *\n * @StringProperty({ optional: true })\n * nickname?: string;\n *\n * @StringProperty({ minLength: 2, maxLength: 50 })\n * username!: string;\n *\n * @StringProperty({ pattern: /^[a-z]+$/, patternMessage: 'Must be lowercase letters only' })\n * slug!: string;\n * }\n */\nexport function StringProperty(\n options?: Omit<PropertyOptions<string, StringConstructor>, 'type'> & {\n minLength?: number;\n maxLength?: number;\n pattern?: RegExp;\n patternMessage?: string;\n },\n): PropertyDecorator {\n return Property(stringPropertyOptions(options));\n}\n\n/**\n * Creates property options for an enum property\n * Used internally by EnumProperty decorator and Props.Enum helper\n */\nexport function enumPropertyOptions<T extends Record<string, string>>(\n enumType: T,\n options?: Omit<PropertyOptions<string, StringConstructor>, 'type'>,\n): PropertyOptions<string, StringConstructor> {\n const validators = options?.validators\n ? [enumValidator(enumType), ...options.validators]\n : [enumValidator(enumType)];\n\n return { ...options, type: () => String, validators };\n}\n\n/**\n * Helper decorator for enum properties (string enums)\n * Validates that the string value matches one of the enum values\n * @param enumType - The enum object (e.g., MyEnum)\n * @param options - Additional property options\n * @example\n * enum Status {\n * Active = 'active',\n * Inactive = 'inactive'\n * }\n *\n * class User {\n * @EnumProperty(Status)\n * status!: Status;\n *\n * @EnumProperty(Status, { optional: true })\n * previousStatus?: Status;\n * }\n */\nexport function EnumProperty<T extends Record<string, string>>(\n enumType: T,\n options?: Omit<PropertyOptions<string, StringConstructor>, 'type'>,\n): PropertyDecorator {\n return Property(enumPropertyOptions(enumType, options));\n}\n\n/**\n * Creates property options for a number property\n * Used internally by NumberProperty decorator and Props.Number helper\n */\nexport function numberPropertyOptions(\n options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {\n min?: number;\n max?: number;\n },\n): PropertyOptions<number, NumberConstructor> {\n const validators = [...(options?.validators || [])];\n\n if (options?.min !== undefined) {\n validators.unshift(minValidator(options.min));\n }\n if (options?.max !== undefined) {\n validators.unshift(maxValidator(options.max));\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { min, max, ...restOptions } = options || {};\n\n return {\n ...restOptions,\n type: () => Number,\n validators: validators.length > 0 ? validators : undefined,\n };\n}\n\n/**\n * Helper decorator for number properties\n * @example\n * class User {\n * @NumberProperty()\n * age!: number;\n *\n * @NumberProperty({ optional: true })\n * score?: number;\n *\n * @NumberProperty({ min: 0, max: 100 })\n * percentage!: number;\n * }\n */\nexport function NumberProperty(\n options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {\n min?: number;\n max?: number;\n },\n): PropertyDecorator {\n return Property(numberPropertyOptions(options));\n}\n\n/**\n * Creates property options for an integer property\n * Used internally by IntProperty decorator and Props.Int helper\n */\nexport function intPropertyOptions(\n options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {\n min?: number;\n max?: number;\n },\n): PropertyOptions<number, NumberConstructor> {\n const validators = [...(options?.validators || [])];\n\n if (options?.min !== undefined) {\n validators.unshift(minValidator(options.min));\n }\n if (options?.max !== undefined) {\n validators.unshift(maxValidator(options.max));\n }\n\n validators.unshift(intValidator());\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { min, max, ...restOptions } = options || {};\n\n return {\n ...restOptions,\n type: () => Number,\n validators: validators.length > 0 ? validators : undefined,\n };\n}\n\n/**\n * Helper decorator for integer properties\n * Validates that the number is an integer (no decimal places)\n * @example\n * class User {\n * @IntProperty()\n * age!: number;\n *\n * @IntProperty({ optional: true })\n * count?: number;\n *\n * @IntProperty({ min: 0, max: 100 })\n * percentage!: number;\n * }\n */\nexport function IntProperty(\n options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {\n min?: number;\n max?: number;\n },\n): PropertyDecorator {\n return Property(intPropertyOptions(options));\n}\n\n/**\n * Creates property options for a boolean property\n * Used internally by BooleanProperty decorator and Props.Boolean helper\n */\nexport function booleanPropertyOptions(\n options?: Omit<PropertyOptions<boolean, BooleanConstructor>, 'type'>,\n): PropertyOptions<boolean, BooleanConstructor> {\n return { ...options, type: () => Boolean };\n}\n\n/**\n * Helper decorator for boolean properties\n * @example\n * class User {\n * @BooleanProperty()\n * active!: boolean;\n *\n * @BooleanProperty({ optional: true })\n * verified?: boolean;\n * }\n */\nexport function BooleanProperty(\n options?: Omit<PropertyOptions<boolean, BooleanConstructor>, 'type'>,\n): PropertyDecorator {\n return Property(booleanPropertyOptions(options));\n}\n\n/**\n * Creates property options for a Date property\n * Used internally by DateProperty decorator and Props.Date helper\n */\nexport function datePropertyOptions(\n options?: Omit<PropertyOptions<Date, DateConstructor>, 'type'>,\n): PropertyOptions<Date, DateConstructor> {\n return { ...options, type: () => Date };\n}\n\n/**\n * Helper decorator for Date properties\n * @example\n * class User {\n * @DateProperty()\n * createdAt!: Date;\n *\n * @DateProperty({ optional: true })\n * deletedAt?: Date;\n * }\n */\nexport function DateProperty(\n options?: Omit<PropertyOptions<Date, DateConstructor>, 'type'>,\n): PropertyDecorator {\n return Property(datePropertyOptions(options));\n}\n\n/**\n * Creates property options for a BigInt property\n * Used internally by BigIntProperty decorator and Props.BigInt helper\n */\nexport function bigIntPropertyOptions(\n options?: Omit<PropertyOptions<bigint, BigIntConstructor>, 'type'>,\n): PropertyOptions<bigint, BigIntConstructor> {\n return { ...options, type: () => BigInt };\n}\n\n/**\n * Helper decorator for BigInt properties\n * @example\n * class User {\n * @BigIntProperty()\n * id!: bigint;\n *\n * @BigIntProperty({ optional: true })\n * balance?: bigint;\n * }\n */\nexport function BigIntProperty(\n options?: Omit<PropertyOptions<bigint, BigIntConstructor>, 'type'>,\n): PropertyDecorator {\n return Property(bigIntPropertyOptions(options));\n}\n\n/**\n * Creates property options for an entity property\n * Used internally by EntityProperty decorator and Props.Entity helper\n */\nexport function entityPropertyOptions<\n T,\n C extends AnyCtor<T> & { new (data: any): T },\n>(\n type: () => C,\n options?: Omit<PropertyOptions<T, C>, 'type'>,\n): PropertyOptions<T, C> {\n return { ...options, type };\n}\n\n/**\n * Helper decorator for entity properties\n * @example\n * class User {\n * @EntityProperty(() => Address)\n * address!: Address;\n *\n * @EntityProperty(() => Profile, { optional: true })\n * profile?: Profile;\n * }\n */\nexport function EntityProperty<\n T,\n C extends AnyCtor<T> & { new (data: any): T },\n>(\n type: () => C,\n options?: Omit<PropertyOptions<T, C>, 'type'>,\n): PropertyDecorator {\n return Property<T, C>(entityPropertyOptions(type, options));\n}\n\n/**\n * Creates property options for an array property\n * Used internally by ArrayProperty decorator and Props.Array helper\n */\nexport function arrayPropertyOptions<T, C extends CtorLike<T>>(\n type: () => C,\n options?: Omit<PropertyOptions<T, C>, 'type' | 'array'> & {\n minLength?: number;\n maxLength?: number;\n },\n): PropertyOptions<T, C> {\n const validators = [...(options?.arrayValidators || [])];\n\n if (options?.minLength !== undefined) {\n validators.unshift(arrayMinLengthValidator(options.minLength));\n }\n if (options?.maxLength !== undefined) {\n validators.unshift(arrayMaxLengthValidator(options.maxLength));\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { minLength, maxLength, ...restOptions } = options || {};\n\n return {\n ...restOptions,\n type,\n array: true,\n arrayValidators: validators.length > 0 ? validators : undefined,\n };\n}\n\n/**\n * Helper decorator for array properties\n * @example\n * class User {\n * @ArrayProperty(() => String)\n * tags!: string[];\n *\n * @ArrayProperty(() => Phone)\n * phones!: Phone[];\n *\n * @ArrayProperty(() => Number, { optional: true })\n * scores?: number[];\n *\n * @ArrayProperty(() => String, { sparse: true })\n * sparseList!: (string | null)[];\n *\n * @ArrayProperty(() => String, { minLength: 1, maxLength: 10 })\n * limitedList!: string[];\n * }\n */\nexport function ArrayProperty<T, C extends CtorLike<T>>(\n type: () => C,\n options?: Omit<PropertyOptions<T, C>, 'type' | 'array'> & {\n minLength?: number;\n maxLength?: number;\n },\n): PropertyDecorator {\n const arrayValidators = [...(options?.arrayValidators || [])];\n\n if (options?.minLength !== undefined) {\n arrayValidators.unshift(arrayMinLengthValidator(options.minLength));\n }\n if (options?.maxLength !== undefined) {\n arrayValidators.unshift(arrayMaxLengthValidator(options.maxLength));\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { minLength, maxLength, ...restOptions } = options || {};\n\n return Property({\n ...restOptions,\n type,\n array: true,\n arrayValidators: arrayValidators.length > 0 ? arrayValidators : undefined,\n });\n}\n\n/**\n * Creates property options for a passthrough property\n * Used internally by PassthroughProperty decorator and Props.Passthrough helper\n */\nexport function passthroughPropertyOptions(\n options?: Omit<PropertyOptions, 'type' | 'passthrough'>,\n): PropertyOptions {\n return { ...options, type: () => Object, passthrough: true };\n}\n\n/**\n * Helper decorator for passthrough properties that bypass type validation.\n * Use this for generic types like Record<string, unknown>, any, or custom objects.\n * @example\n * class Config {\n * @PassthroughProperty()\n * metadata!: Record<string, unknown>;\n *\n * @PassthroughProperty()\n * customData!: any;\n * }\n */\nexport function PassthroughProperty(): PropertyDecorator {\n return Property(passthroughPropertyOptions());\n}\n\n/**\n * Property options for stringifiable types (types with toString() and static parse())\n * Used internally by StringifiableProperty decorator and EntityProps.Stringifiable helper\n */\nexport function stringifiablePropertyOptions<\n T extends { equals?(other: T): boolean; toString(): string },\n C extends CtorLike<T> & { parse(value: string): T },\n>(\n type: () => C,\n options?: Omit<\n PropertyOptions<T, C>,\n 'serialize' | 'deserialize' | 'passthrough' | 'type' | 'equals'\n >,\n): PropertyOptions<T, C> {\n return {\n ...options,\n type,\n equals: (a, b) => (a.equals ? a.equals(b) : a.toString() === b.toString()),\n serialize: (value) => value.toString(),\n deserialize: (value) => {\n if (typeof value === 'string') {\n return type().parse(value) as InstanceOfCtorLike<C>;\n }\n throw new Error(`Invalid value ${type().name}: ${String(value)}`);\n },\n };\n}\n\nexport const StringifiableProperty = <\n T extends { equals?(other: T): boolean; toString(): string },\n C extends CtorLike<T> & { parse(value: string): T },\n>(\n type: () => C,\n data: Omit<\n PropertyOptions<T, C>,\n 'serialize' | 'deserialize' | 'passthrough' | 'type' | 'equals'\n > = {},\n): PropertyDecorator =>\n Property<T, C>(stringifiablePropertyOptions(type, data));\n\nexport const SerializableProperty = <\n T extends { equals?(other: T): boolean; toJSON(): unknown },\n C extends CtorLike<T> & { parse(value: unknown): T },\n>(\n type: () => C,\n data: Omit<\n PropertyOptions<T, C>,\n 'serialize' | 'deserialize' | 'passthrough' | 'type' | 'equals'\n > = {},\n) =>\n Property({\n ...data,\n type,\n equals: (a: T, b: T) =>\n a.equals ? a.equals(b) : isEqual(a.toJSON(), b.toJSON()),\n serialize: (value: T) => value.toJSON(),\n deserialize: (value: unknown) => {\n return type().parse(value) as InstanceOfCtorLike<C>;\n },\n });\n\n/**\n * Helper decorator for discriminated entity properties.\n * The entity type is determined at runtime using a discriminator property.\n * Unlike EntityProperty, this does not require the type parameter upfront.\n *\n * @param options - Configuration for the discriminated property\n *\n * @example\n * ```typescript\n * // Define entity types\n * @Entity({ name: 'Circle' })\n * class Circle {\n * @StringProperty() readonly type = 'Circle';\n * @NumberProperty() radius!: number;\n * constructor(data: Partial<Circle>) { Object.assign(this, data); }\n * }\n *\n * @Entity({ name: 'Rectangle' })\n * class Rectangle {\n * @StringProperty() readonly type = 'Rectangle';\n * @NumberProperty() width!: number;\n * @NumberProperty() height!: number;\n * constructor(data: Partial<Rectangle>) { Object.assign(this, data); }\n * }\n *\n * // Use discriminated property\n * @Entity()\n * class Drawing {\n * @DiscriminatedEntityProperty()\n * shape!: Circle | Rectangle;\n *\n * @DiscriminatedEntityProperty({ discriminatorProperty: 'entityType' })\n * item!: BaseItem;\n * }\n *\n * // When serialized, the discriminator is included inline:\n * // { shape: { __type: 'Circle', radius: 5 } }\n *\n * // When deserialized, the discriminator is used to determine the type:\n * const drawing = await EntityUtils.parse(Drawing, {\n * shape: { __type: 'Circle', radius: 5 }\n * });\n * // drawing.shape is a Circle instance\n * ```\n */\n/**\n * Creates property options for a discriminated entity property\n * Used internally by DiscriminatedEntityProperty decorator and EntityProps.DiscriminatedEntity helper\n */\nexport function discriminatedEntityPropertyOptions(\n options?: Omit<PropertyOptions<any, any>, 'type' | 'discriminated'> & {\n discriminatorProperty?: string;\n },\n): PropertyOptions<any, any> {\n const discriminatorProperty = options?.discriminatorProperty ?? '__type';\n\n return {\n ...options,\n discriminated: true,\n discriminatorProperty,\n };\n}\n\nexport function DiscriminatedEntityProperty(\n options?: Omit<PropertyOptions<any, any>, 'type' | 'discriminated'> & {\n discriminatorProperty?: string;\n },\n): PropertyDecorator {\n return Property(discriminatedEntityPropertyOptions(options));\n}\n\n/**\n * Decorator that marks a property as a polymorphic discriminator.\n *\n * Used for class hierarchies where an abstract base class has multiple concrete implementations,\n * and the discriminator property value determines which subclass to instantiate.\n *\n * The discriminator is a regular class property (not injected during serialization like @DiscriminatedEntityProperty).\n *\n * This decorator can be used standalone (it will treat the property as a string) or combined\n * with another type decorator for more specific typing.\n *\n * @param enumType - Optional enum or union type for the discriminator (used for validation and schema generation)\n *\n * @example\n * ```typescript\n * enum SchemaPropertyType {\n * STRING = 'string',\n * NUMBER = 'number',\n * }\n *\n * @Entity()\n * abstract class SchemaProperty {\n * @StringProperty({ minLength: 1 })\n * name!: string;\n *\n * @PolymorphicProperty(SchemaPropertyType)\n * type!: SchemaPropertyType;\n * }\n *\n * @Entity()\n * @PolymorphicVariant(SchemaProperty, SchemaPropertyType.STRING)\n * class StringSchemaProperty extends SchemaProperty {\n * type = SchemaPropertyType.STRING;\n *\n * @IntProperty({ optional: true })\n * minLength?: number;\n * }\n *\n * // Parsing automatically instantiates the correct subclass\n * const data = { name: 'age', type: 'string', minLength: 5 };\n * const prop = await EntityUtils.parse(SchemaProperty, data);\n * // prop is StringSchemaProperty instance\n * ```\n */\nexport function PolymorphicProperty(enumType?: any): PropertyDecorator {\n return (target: object, propertyKey: string | symbol): void => {\n if (typeof propertyKey !== 'string') {\n return;\n }\n\n // Store the polymorphic property metadata\n Reflect.defineMetadata(\n POLYMORPHIC_PROPERTY_METADATA_KEY,\n propertyKey,\n target.constructor,\n );\n\n // Register in PolymorphicRegistry\n PolymorphicRegistry.setDiscriminatorProperty(\n target.constructor,\n propertyKey,\n );\n\n // Check if property already has options (from another decorator)\n const existingOptions: PropertyOptions | undefined = Reflect.getOwnMetadata(\n PROPERTY_OPTIONS_METADATA_KEY,\n target,\n propertyKey,\n );\n\n if (existingOptions) {\n // Update existing options to add polymorphic flags\n const updatedOptions: PropertyOptions = {\n ...existingOptions,\n polymorphicDiscriminator: true,\n polymorphicEnumType: enumType,\n };\n\n Reflect.defineMetadata(\n PROPERTY_OPTIONS_METADATA_KEY,\n updatedOptions,\n target,\n propertyKey,\n );\n } else {\n // No existing decorator - apply Property decorator with string type\n // (enum discriminators are typically strings)\n const options: PropertyOptions = {\n type: () => String,\n polymorphicDiscriminator: true,\n polymorphicEnumType: enumType,\n };\n\n Property(options)(target, propertyKey);\n }\n };\n}\n"],"names":["isEqual","PROPERTY_METADATA_KEY","PROPERTY_OPTIONS_METADATA_KEY","POLYMORPHIC_PROPERTY_METADATA_KEY","enumValidator","intValidator","minLengthValidator","maxLengthValidator","patternValidator","minValidator","maxValidator","arrayMinLengthValidator","arrayMaxLengthValidator","PolymorphicRegistry","Property","options","target","propertyKey","existingProperties","Reflect","getOwnMetadata","includes","push","defineMetadata","passthrough","array","Error","optional","sparse","serialize","undefined","deserialize","arrayValidators","hasSerialize","hasDeserialize","existingOptions","stringPropertyOptions","validators","minLength","unshift","maxLength","pattern","patternMessage","restOptions","type","String","length","StringProperty","enumPropertyOptions","enumType","EnumProperty","numberPropertyOptions","min","max","Number","NumberProperty","intPropertyOptions","IntProperty","booleanPropertyOptions","Boolean","BooleanProperty","datePropertyOptions","Date","DateProperty","bigIntPropertyOptions","BigInt","BigIntProperty","entityPropertyOptions","EntityProperty","arrayPropertyOptions","ArrayProperty","passthroughPropertyOptions","Object","PassthroughProperty","stringifiablePropertyOptions","equals","a","b","toString","value","parse","name","StringifiableProperty","data","SerializableProperty","toJSON","discriminatedEntityPropertyOptions","discriminatorProperty","discriminated","DiscriminatedEntityProperty","PolymorphicProperty","setDiscriminatorProperty","updatedOptions","polymorphicDiscriminator","polymorphicEnumType"],"mappings":"AAAA,6DAA6D,GAC7D,qDAAqD,GACrD,SAASA,OAAO,QAAQ,YAAY;AACpC,SAIEC,qBAAqB,EACrBC,6BAA6B,EAC7BC,iCAAiC,QAE5B,aAAa;AACpB,SACEC,aAAa,EACbC,YAAY,EACZC,kBAAkB,EAClBC,kBAAkB,EAClBC,gBAAgB,EAChBC,YAAY,EACZC,YAAY,EACZC,uBAAuB,EACvBC,uBAAuB,QAClB,kBAAkB;AACzB,SAASC,mBAAmB,QAAQ,4BAA4B;AAEhE;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,SAASC,SACdC,OAA8B;IAE9B,OAAO,CAACC,QAAgBC;QACtB,IAAI,OAAOA,gBAAgB,UAAU;YACnC;QACF;QAEA,MAAMC,qBACJC,QAAQC,cAAc,CAACnB,uBAAuBe,WAAW,EAAE;QAE7D,IAAI,CAACE,mBAAmBG,QAAQ,CAACJ,cAAc;YAC7CC,mBAAmBI,IAAI,CAACL;QAC1B;QAEAE,QAAQI,cAAc,CAACtB,uBAAuBiB,oBAAoBF;QAElE,IAAID,QAAQS,WAAW,KAAK,MAAM;YAChC,IAAIT,QAAQU,KAAK,KAAK,MAAM;gBAC1B,MAAM,IAAIC,MACR,CAAC,UAAU,EAAET,YAAY,mFAAmF,CAAC;YAEjH;YACA,IAAIF,QAAQY,QAAQ,KAAK,MAAM;gBAC7B,MAAM,IAAID,MACR,CAAC,UAAU,EAAET,YAAY,yFAAyF,CAAC;YAEvH;YACA,IAAIF,QAAQa,MAAM,KAAK,MAAM;gBAC3B,MAAM,IAAIF,MACR,CAAC,UAAU,EAAET,YAAY,qFAAqF,CAAC;YAEnH;YACA,IACEF,QAAQc,SAAS,KAAKC,aACtBf,QAAQgB,WAAW,KAAKD,WACxB;gBACA,MAAM,IAAIJ,MACR,CAAC,UAAU,EAAET,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OAEC;IAED,MAAMwE,wBAAwBxE,SAASwE,yBAAyB;IAEhE,OAAO;QACL,GAAGxE,OAAO;QACVyE,eAAe;QACfD;IACF;AACF;AAEA,OAAO,SAASE,4BACd1E,OAEC;IAED,OAAOD,SAASwE,mCAAmCvE;AACrD;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GACD,OAAO,SAAS2E,oBAAoBzC,QAAc;IAChD,OAAO,CAACjC,QAAgBC;QACtB,IAAI,OAAOA,gBAAgB,UAAU;YACnC;QACF;QAEA,0CAA0C;QAC1CE,QAAQI,cAAc,CACpBpB,mCACAc,aACAD,OAAO,WAAW;QAGpB,kCAAkC;QAClCH,oBAAoB8E,wBAAwB,CAC1C3E,OAAO,WAAW,EAClBC;QAGF,iEAAiE;QACjE,MAAMkB,kBAA+ChB,QAAQC,cAAc,CACzElB,+BACAc,QACAC;QAGF,IAAIkB,iBAAiB;YACnB,mDAAmD;YACnD,MAAMyD,iBAAkC;gBACtC,GAAGzD,eAAe;gBAClB0D,0BAA0B;gBAC1BC,qBAAqB7C;YACvB;YAEA9B,QAAQI,cAAc,CACpBrB,+BACA0F,gBACA5E,QACAC;QAEJ,OAAO;YACL,oEAAoE;YACpE,8CAA8C;YAC9C,MAAMF,UAA2B;gBAC/B6B,MAAM,IAAMC;gBACZgD,0BAA0B;gBAC1BC,qBAAqB7C;YACvB;YAEAnC,SAASC,SAASC,QAAQC;QAC5B;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/lib/property.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-wrapper-object-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { isEqual } from 'lodash-es';\nimport {\n AnyCtor,\n type CtorLike,\n type InstanceOfCtorLike,\n PROPERTY_METADATA_KEY,\n PROPERTY_OPTIONS_METADATA_KEY,\n POLYMORPHIC_PROPERTY_METADATA_KEY,\n PropertyOptions,\n} from './types.js';\nimport {\n enumValidator,\n intValidator,\n minLengthValidator,\n maxLengthValidator,\n patternValidator,\n minValidator,\n maxValidator,\n arrayMinLengthValidator,\n arrayMaxLengthValidator,\n} from './validators.js';\nimport { PolymorphicRegistry } from './polymorphic-registry.js';\nimport { deserializeNumberFromBigInt } from './primitive-deserializers.js';\n\n/**\n * Property decorator that marks class properties with metadata.\n * This decorator can be used to identify and track properties within classes.\n *\n * @param options - Configuration for the property (type is required)\n *\n * @example\n * class User {\n * @Property({ type: () => String })\n * name: string;\n *\n * @Property({ type: () => String, equals: (a, b) => a.toLowerCase() === b.toLowerCase() })\n * email: string;\n *\n * @Property({ type: () => Number })\n * age: number;\n * }\n */\nexport function Property<T, C extends CtorLike<T>>(\n options: PropertyOptions<T, C>,\n): PropertyDecorator {\n return (target: object, propertyKey: string | symbol): void => {\n if (typeof propertyKey !== 'string') {\n return;\n }\n\n const existingProperties: string[] =\n Reflect.getOwnMetadata(PROPERTY_METADATA_KEY, target) || [];\n\n if (!existingProperties.includes(propertyKey)) {\n existingProperties.push(propertyKey);\n }\n\n Reflect.defineMetadata(PROPERTY_METADATA_KEY, existingProperties, target);\n\n if (options.passthrough === true) {\n if (options.array === true) {\n throw new Error(\n `Property '${propertyKey}' has passthrough: true and array: true. Passthrough cannot be combined with array.`,\n );\n }\n if (options.optional === true) {\n throw new Error(\n `Property '${propertyKey}' has passthrough: true and optional: true. Passthrough cannot be combined with optional.`,\n );\n }\n if (options.sparse === true) {\n throw new Error(\n `Property '${propertyKey}' has passthrough: true and sparse: true. Passthrough cannot be combined with sparse.`,\n );\n }\n if (\n options.serialize !== undefined ||\n options.deserialize !== undefined\n ) {\n throw new Error(\n `Property '${propertyKey}' has passthrough: true and custom serialize/deserialize functions. Passthrough cannot be combined with serialize or deserialize.`,\n );\n }\n }\n\n if (options.sparse === true && options.array !== true) {\n throw new Error(\n `Property '${propertyKey}' has sparse: true but array is not true. The sparse option only applies to arrays.`,\n );\n }\n\n if (options.arrayValidators && options.array !== true) {\n throw new Error(\n `Property '${propertyKey}' has arrayValidators defined but array is not true. The arrayValidators option only applies to arrays.`,\n );\n }\n\n // Validate serialize/deserialize pairing\n const hasSerialize = options.serialize !== undefined;\n const hasDeserialize = options.deserialize !== undefined;\n if (hasSerialize !== hasDeserialize) {\n throw new Error(\n `Property '${propertyKey}' must define both serialize and deserialize functions, or neither. Found only ${hasSerialize ? 'serialize' : 'deserialize'}.`,\n );\n }\n\n const existingOptions: Record<\n string,\n PropertyOptions<any, any>\n > = Reflect.getOwnMetadata(PROPERTY_OPTIONS_METADATA_KEY, target) || {};\n\n existingOptions[propertyKey] = options;\n\n Reflect.defineMetadata(\n PROPERTY_OPTIONS_METADATA_KEY,\n existingOptions,\n target,\n );\n };\n}\n\n/**\n * Helper decorator for string properties\n * @example\n * class User {\n * @StringProperty()\n * name!: string;\n *\n * @StringProperty({ optional: true })\n * nickname?: string;\n *\n * @StringProperty({ minLength: 3, maxLength: 50 })\n * username!: string;\n *\n * @StringProperty({ pattern: /^[a-z]+$/ })\n * slug!: string;\n * }\n */\n/**\n * Creates property options for a string property with optional validation\n * Used internally by StringProperty decorator and Props.String helper\n */\nexport function stringPropertyOptions(\n options?: Omit<PropertyOptions<string, StringConstructor>, 'type'> & {\n minLength?: number;\n maxLength?: number;\n pattern?: RegExp;\n patternMessage?: string;\n },\n): PropertyOptions<string, StringConstructor> {\n const validators = [...(options?.validators || [])];\n\n if (options?.minLength !== undefined) {\n validators.unshift(minLengthValidator(options.minLength));\n }\n if (options?.maxLength !== undefined) {\n validators.unshift(maxLengthValidator(options.maxLength));\n }\n if (options?.pattern !== undefined) {\n validators.unshift(\n patternValidator(options.pattern, options.patternMessage),\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { minLength, maxLength, pattern, patternMessage, ...restOptions } =\n options || {};\n\n return {\n ...restOptions,\n type: () => String,\n validators: validators.length > 0 ? validators : undefined,\n };\n}\n\n/**\n * Helper decorator for string properties\n * @example\n * class User {\n * @StringProperty()\n * name!: string;\n *\n * @StringProperty({ optional: true })\n * nickname?: string;\n *\n * @StringProperty({ minLength: 2, maxLength: 50 })\n * username!: string;\n *\n * @StringProperty({ pattern: /^[a-z]+$/, patternMessage: 'Must be lowercase letters only' })\n * slug!: string;\n * }\n */\nexport function StringProperty(\n options?: Omit<PropertyOptions<string, StringConstructor>, 'type'> & {\n minLength?: number;\n maxLength?: number;\n pattern?: RegExp;\n patternMessage?: string;\n },\n): PropertyDecorator {\n return Property(stringPropertyOptions(options));\n}\n\n/**\n * Creates property options for an enum property\n * Used internally by EnumProperty decorator and Props.Enum helper\n */\nexport function enumPropertyOptions<T extends Record<string, string>>(\n enumType: T,\n options?: Omit<PropertyOptions<string, StringConstructor>, 'type'>,\n): PropertyOptions<string, StringConstructor> {\n const validators = options?.validators\n ? [enumValidator(enumType), ...options.validators]\n : [enumValidator(enumType)];\n\n return { ...options, type: () => String, validators };\n}\n\n/**\n * Helper decorator for enum properties (string enums)\n * Validates that the string value matches one of the enum values\n * @param enumType - The enum object (e.g., MyEnum)\n * @param options - Additional property options\n * @example\n * enum Status {\n * Active = 'active',\n * Inactive = 'inactive'\n * }\n *\n * class User {\n * @EnumProperty(Status)\n * status!: Status;\n *\n * @EnumProperty(Status, { optional: true })\n * previousStatus?: Status;\n * }\n */\nexport function EnumProperty<T extends Record<string, string>>(\n enumType: T,\n options?: Omit<PropertyOptions<string, StringConstructor>, 'type'>,\n): PropertyDecorator {\n return Property(enumPropertyOptions(enumType, options));\n}\n\n/**\n * Creates property options for a number property\n * Used internally by NumberProperty decorator and Props.Number helper\n */\nexport function numberPropertyOptions(\n options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {\n min?: number;\n max?: number;\n\n /**\n * When `true`, `bigint` values and integer-formatted strings (e.g. `\"-42\"`) will\n * be coerced to `number` during deserialization.\n *\n * @warning Information may be lost if the `BigInt` value exceeds the safe integer\n * range for `number` (`Number.MAX_SAFE_INTEGER` / `Number.MIN_SAFE_INTEGER`).\n */\n parseBigInt?: boolean;\n },\n): PropertyOptions<number, NumberConstructor> {\n const validators = [...(options?.validators || [])];\n\n if (options?.min !== undefined) {\n validators.unshift(minValidator(options.min));\n }\n if (options?.max !== undefined) {\n validators.unshift(maxValidator(options.max));\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { min, max, parseBigInt, ...restOptions } = options || {};\n\n const deserialize = parseBigInt ? deserializeNumberFromBigInt : undefined;\n\n return {\n ...restOptions,\n type: () => Number,\n validators: validators.length > 0 ? validators : undefined,\n ...(deserialize ? { serialize: (v: number) => v, deserialize } : {}),\n };\n}\n\n/**\n * Helper decorator for number properties\n * @example\n * class User {\n * @NumberProperty()\n * age!: number;\n *\n * @NumberProperty({ optional: true })\n * score?: number;\n *\n * @NumberProperty({ min: 0, max: 100 })\n * percentage!: number;\n * }\n */\nexport function NumberProperty(\n options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {\n min?: number;\n max?: number;\n /**\n * When `true`, `bigint` values and integer-formatted strings (e.g. `\"-42\"`) will\n * be coerced to `number` during deserialization.\n *\n * @warning Information may be lost if the `BigInt` value exceeds the safe integer\n * range for `number` (`Number.MAX_SAFE_INTEGER` / `Number.MIN_SAFE_INTEGER`).\n */\n parseBigInt?: boolean;\n },\n): PropertyDecorator {\n return Property(numberPropertyOptions(options));\n}\n\n/**\n * Creates property options for an integer property\n * Used internally by IntProperty decorator and Props.Int helper\n */\nexport function intPropertyOptions(\n options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {\n min?: number;\n max?: number;\n /**\n * When `true`, `bigint` values and integer-formatted strings (e.g. `\"-42\"`) will\n * be coerced to `number` during deserialization.\n *\n * @warning Information may be lost if the `BigInt` value exceeds the safe integer\n * range for `number` (`Number.MAX_SAFE_INTEGER` / `Number.MIN_SAFE_INTEGER`).\n */\n parseBigInt?: boolean;\n },\n): PropertyOptions<number, NumberConstructor> {\n const validators = [...(options?.validators || [])];\n\n if (options?.min !== undefined) {\n validators.unshift(minValidator(options.min));\n }\n if (options?.max !== undefined) {\n validators.unshift(maxValidator(options.max));\n }\n\n validators.unshift(intValidator());\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { min, max, parseBigInt, ...restOptions } = options || {};\n\n const deserialize = parseBigInt ? deserializeNumberFromBigInt : undefined;\n\n return {\n ...restOptions,\n type: () => Number,\n validators: validators.length > 0 ? validators : undefined,\n ...(deserialize ? { serialize: (v: number) => v, deserialize } : {}),\n };\n}\n\n/**\n * Helper decorator for integer properties\n * Validates that the number is an integer (no decimal places)\n * @example\n * class User {\n * @IntProperty()\n * age!: number;\n *\n * @IntProperty({ optional: true })\n * count?: number;\n *\n * @IntProperty({ min: 0, max: 100 })\n * percentage!: number;\n * }\n */\nexport function IntProperty(\n options?: Omit<PropertyOptions<number, NumberConstructor>, 'type'> & {\n min?: number;\n max?: number;\n /**\n * When `true`, `bigint` values and integer-formatted strings (e.g. `\"-42\"`) will\n * be coerced to `number` during deserialization.\n *\n * @warning Information may be lost if the `BigInt` value exceeds the safe integer\n * range for `number` (`Number.MAX_SAFE_INTEGER` / `Number.MIN_SAFE_INTEGER`).\n */\n parseBigInt?: boolean;\n },\n): PropertyDecorator {\n return Property(intPropertyOptions(options));\n}\n\n/**\n * Creates property options for a boolean property\n * Used internally by BooleanProperty decorator and Props.Boolean helper\n */\nexport function booleanPropertyOptions(\n options?: Omit<PropertyOptions<boolean, BooleanConstructor>, 'type'>,\n): PropertyOptions<boolean, BooleanConstructor> {\n return { ...options, type: () => Boolean };\n}\n\n/**\n * Helper decorator for boolean properties\n * @example\n * class User {\n * @BooleanProperty()\n * active!: boolean;\n *\n * @BooleanProperty({ optional: true })\n * verified?: boolean;\n * }\n */\nexport function BooleanProperty(\n options?: Omit<PropertyOptions<boolean, BooleanConstructor>, 'type'>,\n): PropertyDecorator {\n return Property(booleanPropertyOptions(options));\n}\n\n/**\n * Creates property options for a Date property\n * Used internally by DateProperty decorator and Props.Date helper\n */\nexport function datePropertyOptions(\n options?: Omit<PropertyOptions<Date, DateConstructor>, 'type'>,\n): PropertyOptions<Date, DateConstructor> {\n return { ...options, type: () => Date };\n}\n\n/**\n * Helper decorator for Date properties\n * @example\n * class User {\n * @DateProperty()\n * createdAt!: Date;\n *\n * @DateProperty({ optional: true })\n * deletedAt?: Date;\n * }\n */\nexport function DateProperty(\n options?: Omit<PropertyOptions<Date, DateConstructor>, 'type'>,\n): PropertyDecorator {\n return Property(datePropertyOptions(options));\n}\n\n/**\n * Creates property options for a BigInt property\n * Used internally by BigIntProperty decorator and Props.BigInt helper\n */\nexport function bigIntPropertyOptions(\n options?: Omit<PropertyOptions<bigint, BigIntConstructor>, 'type'>,\n): PropertyOptions<bigint, BigIntConstructor> {\n return { ...options, type: () => BigInt };\n}\n\n/**\n * Helper decorator for BigInt properties\n * @example\n * class User {\n * @BigIntProperty()\n * id!: bigint;\n *\n * @BigIntProperty({ optional: true })\n * balance?: bigint;\n * }\n */\nexport function BigIntProperty(\n options?: Omit<PropertyOptions<bigint, BigIntConstructor>, 'type'>,\n): PropertyDecorator {\n return Property(bigIntPropertyOptions(options));\n}\n\n/**\n * Creates property options for an entity property\n * Used internally by EntityProperty decorator and Props.Entity helper\n */\nexport function entityPropertyOptions<\n T,\n C extends AnyCtor<T> & { new (data: any): T },\n>(\n type: () => C,\n options?: Omit<PropertyOptions<T, C>, 'type'>,\n): PropertyOptions<T, C> {\n return { ...options, type };\n}\n\n/**\n * Helper decorator for entity properties\n * @example\n * class User {\n * @EntityProperty(() => Address)\n * address!: Address;\n *\n * @EntityProperty(() => Profile, { optional: true })\n * profile?: Profile;\n * }\n */\nexport function EntityProperty<\n T,\n C extends AnyCtor<T> & { new (data: any): T },\n>(\n type: () => C,\n options?: Omit<PropertyOptions<T, C>, 'type'>,\n): PropertyDecorator {\n return Property<T, C>(entityPropertyOptions(type, options));\n}\n\n/**\n * Creates property options for an array property\n * Used internally by ArrayProperty decorator and Props.Array helper\n */\nexport function arrayPropertyOptions<T, C extends CtorLike<T>>(\n type: () => C,\n options?: Omit<PropertyOptions<T, C>, 'type' | 'array'> & {\n minLength?: number;\n maxLength?: number;\n },\n): PropertyOptions<T, C> {\n const validators = [...(options?.arrayValidators || [])];\n\n if (options?.minLength !== undefined) {\n validators.unshift(arrayMinLengthValidator(options.minLength));\n }\n if (options?.maxLength !== undefined) {\n validators.unshift(arrayMaxLengthValidator(options.maxLength));\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { minLength, maxLength, ...restOptions } = options || {};\n\n return {\n ...restOptions,\n type,\n array: true,\n arrayValidators: validators.length > 0 ? validators : undefined,\n };\n}\n\n/**\n * Helper decorator for array properties\n * @example\n * class User {\n * @ArrayProperty(() => String)\n * tags!: string[];\n *\n * @ArrayProperty(() => Phone)\n * phones!: Phone[];\n *\n * @ArrayProperty(() => Number, { optional: true })\n * scores?: number[];\n *\n * @ArrayProperty(() => String, { sparse: true })\n * sparseList!: (string | null)[];\n *\n * @ArrayProperty(() => String, { minLength: 1, maxLength: 10 })\n * limitedList!: string[];\n * }\n */\nexport function ArrayProperty<T, C extends CtorLike<T>>(\n type: () => C,\n options?: Omit<PropertyOptions<T, C>, 'type' | 'array'> & {\n minLength?: number;\n maxLength?: number;\n },\n): PropertyDecorator {\n const arrayValidators = [...(options?.arrayValidators || [])];\n\n if (options?.minLength !== undefined) {\n arrayValidators.unshift(arrayMinLengthValidator(options.minLength));\n }\n if (options?.maxLength !== undefined) {\n arrayValidators.unshift(arrayMaxLengthValidator(options.maxLength));\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { minLength, maxLength, ...restOptions } = options || {};\n\n return Property({\n ...restOptions,\n type,\n array: true,\n arrayValidators: arrayValidators.length > 0 ? arrayValidators : undefined,\n });\n}\n\n/**\n * Creates property options for a passthrough property\n * Used internally by PassthroughProperty decorator and Props.Passthrough helper\n */\nexport function passthroughPropertyOptions(\n options?: Omit<PropertyOptions, 'type' | 'passthrough'>,\n): PropertyOptions {\n return { ...options, type: () => Object, passthrough: true };\n}\n\n/**\n * Helper decorator for passthrough properties that bypass type validation.\n * Use this for generic types like Record<string, unknown>, any, or custom objects.\n * @example\n * class Config {\n * @PassthroughProperty()\n * metadata!: Record<string, unknown>;\n *\n * @PassthroughProperty()\n * customData!: any;\n * }\n */\nexport function PassthroughProperty(): PropertyDecorator {\n return Property(passthroughPropertyOptions());\n}\n\n/**\n * Property options for stringifiable types (types with toString() and static parse())\n * Used internally by StringifiableProperty decorator and EntityProps.Stringifiable helper\n */\nexport function stringifiablePropertyOptions<\n T extends { equals?(other: T): boolean; toString(): string },\n C extends CtorLike<T> & { parse(value: string): T },\n>(\n type: () => C,\n options?: Omit<\n PropertyOptions<T, C>,\n 'serialize' | 'deserialize' | 'passthrough' | 'type' | 'equals'\n >,\n): PropertyOptions<T, C> {\n return {\n ...options,\n type,\n equals: (a, b) => (a.equals ? a.equals(b) : a.toString() === b.toString()),\n serialize: (value) => value.toString(),\n deserialize: (value) => {\n if (typeof value === 'string') {\n return type().parse(value) as InstanceOfCtorLike<C>;\n }\n throw new Error(`Invalid value ${type().name}: ${String(value)}`);\n },\n };\n}\n\nexport const StringifiableProperty = <\n T extends { equals?(other: T): boolean; toString(): string },\n C extends CtorLike<T> & { parse(value: string): T },\n>(\n type: () => C,\n data: Omit<\n PropertyOptions<T, C>,\n 'serialize' | 'deserialize' | 'passthrough' | 'type' | 'equals'\n > = {},\n): PropertyDecorator =>\n Property<T, C>(stringifiablePropertyOptions(type, data));\n\nexport const SerializableProperty = <\n T extends { equals?(other: T): boolean; toJSON(): unknown },\n C extends CtorLike<T> & { parse(value: unknown): T },\n>(\n type: () => C,\n data: Omit<\n PropertyOptions<T, C>,\n 'serialize' | 'deserialize' | 'passthrough' | 'type' | 'equals'\n > = {},\n) =>\n Property({\n ...data,\n type,\n equals: (a: T, b: T) =>\n a.equals ? a.equals(b) : isEqual(a.toJSON(), b.toJSON()),\n serialize: (value: T) => value.toJSON(),\n deserialize: (value: unknown) => {\n return type().parse(value) as InstanceOfCtorLike<C>;\n },\n });\n\n/**\n * Helper decorator for discriminated entity properties.\n * The entity type is determined at runtime using a discriminator property.\n * Unlike EntityProperty, this does not require the type parameter upfront.\n *\n * @param options - Configuration for the discriminated property\n *\n * @example\n * ```typescript\n * // Define entity types\n * @Entity({ name: 'Circle' })\n * class Circle {\n * @StringProperty() readonly type = 'Circle';\n * @NumberProperty() radius!: number;\n * constructor(data: Partial<Circle>) { Object.assign(this, data); }\n * }\n *\n * @Entity({ name: 'Rectangle' })\n * class Rectangle {\n * @StringProperty() readonly type = 'Rectangle';\n * @NumberProperty() width!: number;\n * @NumberProperty() height!: number;\n * constructor(data: Partial<Rectangle>) { Object.assign(this, data); }\n * }\n *\n * // Use discriminated property\n * @Entity()\n * class Drawing {\n * @DiscriminatedEntityProperty()\n * shape!: Circle | Rectangle;\n *\n * @DiscriminatedEntityProperty({ discriminatorProperty: 'entityType' })\n * item!: BaseItem;\n * }\n *\n * // When serialized, the discriminator is included inline:\n * // { shape: { __type: 'Circle', radius: 5 } }\n *\n * // When deserialized, the discriminator is used to determine the type:\n * const drawing = await EntityUtils.parse(Drawing, {\n * shape: { __type: 'Circle', radius: 5 }\n * });\n * // drawing.shape is a Circle instance\n * ```\n */\n/**\n * Creates property options for a discriminated entity property\n * Used internally by DiscriminatedEntityProperty decorator and EntityProps.DiscriminatedEntity helper\n */\nexport function discriminatedEntityPropertyOptions(\n options?: Omit<PropertyOptions<any, any>, 'type' | 'discriminated'> & {\n discriminatorProperty?: string;\n },\n): PropertyOptions<any, any> {\n const discriminatorProperty = options?.discriminatorProperty ?? '__type';\n\n return {\n ...options,\n discriminated: true,\n discriminatorProperty,\n };\n}\n\nexport function DiscriminatedEntityProperty(\n options?: Omit<PropertyOptions<any, any>, 'type' | 'discriminated'> & {\n discriminatorProperty?: string;\n },\n): PropertyDecorator {\n return Property(discriminatedEntityPropertyOptions(options));\n}\n\n/**\n * Decorator that marks a property as a polymorphic discriminator.\n *\n * Used for class hierarchies where an abstract base class has multiple concrete implementations,\n * and the discriminator property value determines which subclass to instantiate.\n *\n * The discriminator is a regular class property (not injected during serialization like @DiscriminatedEntityProperty).\n *\n * This decorator can be used standalone (it will treat the property as a string) or combined\n * with another type decorator for more specific typing.\n *\n * @param enumType - Optional enum, union type, or stringifiable type for the discriminator (used for validation and schema generation)\n *\n * @example\n * ```typescript\n * // With regular enum\n * enum SchemaPropertyType {\n * STRING = 'string',\n * NUMBER = 'number',\n * }\n *\n * @Entity()\n * abstract class SchemaProperty {\n * @StringProperty({ minLength: 1 })\n * name!: string;\n *\n * @PolymorphicProperty(SchemaPropertyType)\n * type!: SchemaPropertyType;\n * }\n *\n * @Entity()\n * @PolymorphicVariant(SchemaProperty, SchemaPropertyType.STRING)\n * class StringSchemaProperty extends SchemaProperty {\n * type = SchemaPropertyType.STRING;\n *\n * @IntProperty({ optional: true })\n * minLength?: number;\n * }\n *\n * // With stringifiable type\n * class Status {\n * static ACTIVE = new Status('active');\n * static INACTIVE = new Status('inactive');\n *\n * constructor(private value: string) {}\n * toString() { return this.value; }\n * static parse(value: string) {\n * if (value === 'active') return Status.ACTIVE;\n * if (value === 'inactive') return Status.INACTIVE;\n * throw new Error('Invalid status');\n * }\n * }\n *\n * @Entity()\n * abstract class Record {\n * @PolymorphicProperty(() => Status)\n * status!: Status;\n * }\n *\n * // Parsing automatically instantiates the correct subclass\n * const data = { name: 'age', type: 'string', minLength: 5 };\n * const prop = await EntityUtils.parse(SchemaProperty, data);\n * // prop is StringSchemaProperty instance\n * ```\n */\nexport function PolymorphicProperty<\n T extends { equals?(other: T): boolean; toString(): string },\n C extends CtorLike<T> & { parse(value: string): T },\n>(enumTypeOrFactory?: Record<string, string> | (() => C)): PropertyDecorator {\n return (target: object, propertyKey: string | symbol): void => {\n if (typeof propertyKey !== 'string') {\n return;\n }\n\n // Store the polymorphic property metadata\n Reflect.defineMetadata(\n POLYMORPHIC_PROPERTY_METADATA_KEY,\n propertyKey,\n target.constructor,\n );\n\n // Register in PolymorphicRegistry\n PolymorphicRegistry.setDiscriminatorProperty(\n target.constructor,\n propertyKey,\n );\n\n // Check if property already has options (from another decorator)\n const existingOptions: PropertyOptions | undefined = Reflect.getOwnMetadata(\n PROPERTY_OPTIONS_METADATA_KEY,\n target,\n propertyKey,\n );\n\n if (existingOptions) {\n // Update existing options to add polymorphic flags\n const updatedOptions: PropertyOptions = {\n ...existingOptions,\n polymorphicDiscriminator: true,\n polymorphicEnumType: enumTypeOrFactory,\n };\n\n Reflect.defineMetadata(\n PROPERTY_OPTIONS_METADATA_KEY,\n updatedOptions,\n target,\n propertyKey,\n );\n } else {\n // No existing decorator - check if it's a stringifiable type or enum\n const isStringifiable = typeof enumTypeOrFactory === 'function';\n\n if (isStringifiable) {\n // Apply StringifiableProperty decorator with polymorphic flags\n const stringifiableOpts = stringifiablePropertyOptions(\n enumTypeOrFactory as () => C,\n );\n const options: PropertyOptions = {\n ...stringifiableOpts,\n polymorphicDiscriminator: true,\n polymorphicEnumType: enumTypeOrFactory,\n };\n\n Property(options)(target, propertyKey);\n } else {\n // Apply Property decorator with string type (for enum discriminators)\n const options: PropertyOptions = {\n type: () => String,\n polymorphicDiscriminator: true,\n polymorphicEnumType: enumTypeOrFactory,\n };\n\n Property(options)(target, propertyKey);\n }\n }\n };\n}\n"],"names":["isEqual","PROPERTY_METADATA_KEY","PROPERTY_OPTIONS_METADATA_KEY","POLYMORPHIC_PROPERTY_METADATA_KEY","enumValidator","intValidator","minLengthValidator","maxLengthValidator","patternValidator","minValidator","maxValidator","arrayMinLengthValidator","arrayMaxLengthValidator","PolymorphicRegistry","deserializeNumberFromBigInt","Property","options","target","propertyKey","existingProperties","Reflect","getOwnMetadata","includes","push","defineMetadata","passthrough","array","Error","optional","sparse","serialize","undefined","deserialize","arrayValidators","hasSerialize","hasDeserialize","existingOptions","stringPropertyOptions","validators","minLength","unshift","maxLength","pattern","patternMessage","restOptions","type","String","length","StringProperty","enumPropertyOptions","enumType","EnumProperty","numberPropertyOptions","min","max","parseBigInt","Number","v","NumberProperty","intPropertyOptions","IntProperty","booleanPropertyOptions","Boolean","BooleanProperty","datePropertyOptions","Date","DateProperty","bigIntPropertyOptions","BigInt","BigIntProperty","entityPropertyOptions","EntityProperty","arrayPropertyOptions","ArrayProperty","passthroughPropertyOptions","Object","PassthroughProperty","stringifiablePropertyOptions","equals","a","b","toString","value","parse","name","StringifiableProperty","data","SerializableProperty","toJSON","discriminatedEntityPropertyOptions","discriminatorProperty","discriminated","DiscriminatedEntityProperty","PolymorphicProperty","enumTypeOrFactory","setDiscriminatorProperty","updatedOptions","polymorphicDiscriminator","polymorphicEnumType","isStringifiable","stringifiableOpts"],"mappings":"AAAA,6DAA6D,GAC7D,qDAAqD,GACrD,SAASA,OAAO,QAAQ,YAAY;AACpC,SAIEC,qBAAqB,EACrBC,6BAA6B,EAC7BC,iCAAiC,QAE5B,aAAa;AACpB,SACEC,aAAa,EACbC,YAAY,EACZC,kBAAkB,EAClBC,kBAAkB,EAClBC,gBAAgB,EAChBC,YAAY,EACZC,YAAY,EACZC,uBAAuB,EACvBC,uBAAuB,QAClB,kBAAkB;AACzB,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,2BAA2B,QAAQ,+BAA+B;AAE3E;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,SAASC,SACdC,OAA8B;IAE9B,OAAO,CAACC,QAAgBC;QACtB,IAAI,OAAOA,gBAAgB,UAAU;YACnC;QACF;QAEA,MAAMC,qBACJC,QAAQC,cAAc,CAACpB,uBAAuBgB,WAAW,EAAE;QAE7D,IAAI,CAACE,mBAAmBG,QAAQ,CAACJ,cAAc;YAC7CC,mBAAmBI,IAAI,CAACL;QAC1B;QAEAE,QAAQI,cAAc,CAACvB,uBAAuBkB,oBAAoBF;QAElE,IAAID,QAAQS,WAAW,KAAK,MAAM;YAChC,IAAIT,QAAQU,KAAK,KAAK,MAAM;gBAC1B,MAAM,IAAIC,MACR,CAAC,UAAU,EAAET,YAAY,mFAAmF,CAAC;YAEjH;YACA,IAAIF,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4D,iBAAkC;gBACtC,GAAG5D,eAAe;gBAClB6D,0BAA0B;gBAC1BC,qBAAqBJ;YACvB;YAEA1E,QAAQI,cAAc,CACpBtB,+BACA8F,gBACA/E,QACAC;QAEJ,OAAO;YACL,qEAAqE;YACrE,MAAMiF,kBAAkB,OAAOL,sBAAsB;YAErD,IAAIK,iBAAiB;gBACnB,+DAA+D;gBAC/D,MAAMC,oBAAoBvB,6BACxBiB;gBAEF,MAAM9E,UAA2B;oBAC/B,GAAGoF,iBAAiB;oBACpBH,0BAA0B;oBAC1BC,qBAAqBJ;gBACvB;gBAEA/E,SAASC,SAASC,QAAQC;YAC5B,OAAO;gBACL,sEAAsE;gBACtE,MAAMF,UAA2B;oBAC/B6B,MAAM,IAAMC;oBACZmD,0BAA0B;oBAC1BC,qBAAqBJ;gBACvB;gBAEA/E,SAASC,SAASC,QAAQC;YAC5B;QACF;IACF;AACF"}
@@ -471,4 +471,16 @@ export declare class ComplexEntity {
471
471
  validateProducts(): Problem[];
472
472
  }
473
473
  export declare function resetFactoryCallCount(): void;
474
+ /**
475
+ * Entity with NumberProperty and IntProperty configured with parseBigInt: true
476
+ * Features: coercion from bigint / integer string to number
477
+ */
478
+ export declare class EntityWithParseBigInt {
479
+ amount: number;
480
+ count: number;
481
+ constructor(data: {
482
+ amount: number;
483
+ count: number;
484
+ });
485
+ }
474
486
  //# sourceMappingURL=test-entities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-entities.d.ts","sourceRoot":"","sources":["../../src/lib/test-entities.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAyB1B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAMvC;;;GAGG;AACH,qBACa,QAAQ;IACD,IAAI,EAAG,MAAM,CAAC;IACd,GAAG,EAAG,MAAM,CAAC;IACZ,MAAM,EAAG,OAAO,CAAC;gBAExB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM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plexEntity = _ts_decorate([
983
983
  export function resetFactoryCallCount() {
984
984
  factoryCallCount = 0;
985
985
  }
986
+ export class EntityWithParseBigInt {
987
+ constructor(data){
988
+ this.amount = data.amount;
989
+ this.count = data.count;
990
+ }
991
+ }
992
+ _ts_decorate([
993
+ NumberProperty({
994
+ parseBigInt: true
995
+ }),
996
+ _ts_metadata("design:type", Number)
997
+ ], EntityWithParseBigInt.prototype, "amount", void 0);
998
+ _ts_decorate([
999
+ IntProperty({
1000
+ parseBigInt: true
1001
+ }),
1002
+ _ts_metadata("design:type", Number)
1003
+ ], EntityWithParseBigInt.prototype, "count", void 0);
1004
+ EntityWithParseBigInt = _ts_decorate([
1005
+ Entity(),
1006
+ _ts_metadata("design:type", Function),
1007
+ _ts_metadata("design:paramtypes", [
1008
+ Object
1009
+ ])
1010
+ ], EntityWithParseBigInt);
986
1011
 
987
1012
  //# sourceMappingURL=test-entities.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/test-entities.ts"],"sourcesContent":["import 'reflect-metadata';\nimport { z } from 'zod';\nimport {\n Entity,\n CollectionEntity,\n Stringifiable,\n EntityValidator,\n} from './entity.js';\nimport {\n Property,\n StringProperty,\n NumberProperty,\n IntProperty,\n BooleanProperty,\n DateProperty,\n BigIntProperty,\n EnumProperty,\n EntityProperty,\n ArrayProperty,\n PassthroughProperty,\n SerializableProperty,\n StringifiableProperty,\n} from './property.js';\nimport { InjectedProperty } from './injected-property.js';\nimport { ZodProperty } from './zod-property.js';\nimport { Problem } from './problem.js';\n\n// ============================================================================\n// SIMPLE ENTITIES WITH PRIMITIVES\n// ============================================================================\n\n/**\n * Basic entity with common primitive types\n * Features: String, Number, Boolean properties\n */\n@Entity()\nexport class TestUser {\n @StringProperty() name!: string;\n @NumberProperty() age!: number;\n @BooleanProperty() active!: boolean;\n\n constructor(data: { name: string; age: number; active: boolean }) {\n this.name = data.name;\n this.age = data.age;\n this.active = data.active;\n }\n}\n\n/**\n * Entity with different primitive combinations\n * Features: String, Number, Int, Date properties\n */\n@Entity()\nexport class TestProduct {\n @StringProperty() id!: string;\n @StringProperty() name!: string;\n @NumberProperty() price!: number;\n @IntProperty() quantity!: number;\n @DateProperty() createdAt!: Date;\n\n constructor(data: {\n id: string;\n name: string;\n price: number;\n quantity: number;\n createdAt: Date;\n }) {\n this.id = data.id;\n this.name = data.name;\n this.price = data.price;\n this.quantity = data.quantity;\n this.createdAt = data.createdAt;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH SPECIAL TYPES\n// ============================================================================\n\n/**\n * Entity with Date and BigInt types\n * Features: DateProperty, BigIntProperty\n */\n@Entity()\nexport class EntityWithSpecialTypes {\n @DateProperty() timestamp!: Date;\n @BigIntProperty() largeNumber!: bigint;\n @StringProperty() label!: string;\n\n constructor(data: { timestamp: Date; largeNumber: bigint; label: string }) {\n this.timestamp = data.timestamp;\n this.largeNumber = data.largeNumber;\n this.label = data.label;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH VALIDATION\n// ============================================================================\n\n/**\n * Entity with property-level validators\n * Features: String validators (minLength, maxLength, pattern)\n */\n@Entity()\nexport class ValidatedEntity {\n @StringProperty({\n minLength: 3,\n maxLength: 20,\n })\n username!: string;\n\n @StringProperty({\n pattern: /^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$/i,\n })\n email!: string;\n\n @NumberProperty({ min: 0, max: 150 })\n age!: number;\n\n constructor(data: { username: string; email: string; age: number }) {\n this.username = data.username;\n this.email = data.email;\n this.age = data.age;\n }\n}\n\n/**\n * Entity with cross-property validation\n * Features: @EntityValidator decorator\n */\n@Entity()\nexport class CrossValidatedEntity {\n @StringProperty() password!: string;\n @StringProperty() confirmPassword!: string;\n @DateProperty() startDate!: Date;\n @DateProperty() endDate!: Date;\n\n constructor(data: {\n password: string;\n confirmPassword: string;\n startDate: Date;\n endDate: Date;\n }) {\n this.password = data.password;\n this.confirmPassword = data.confirmPassword;\n this.startDate = data.startDate;\n this.endDate = data.endDate;\n }\n\n @EntityValidator()\n validatePasswords(): Problem[] {\n if (this.password !== this.confirmPassword) {\n return [\n new Problem({\n property: 'confirmPassword',\n message: 'Passwords do not match',\n }),\n ];\n }\n return [];\n }\n\n @EntityValidator()\n validateDates(): Problem[] {\n if (this.startDate >= this.endDate) {\n return [\n new Problem({\n property: 'endDate',\n message: 'End date must be after start date',\n }),\n ];\n }\n return [];\n }\n}\n\n// ============================================================================\n// ENTITIES WITH OPTIONAL/REQUIRED FIELDS\n// ============================================================================\n\n/**\n * Entity with mix of optional and required properties\n * Features: optional flag\n */\n@Entity()\nexport class OptionalFieldsEntity {\n @StringProperty() requiredField!: string;\n @StringProperty({ optional: true }) optionalField?: string;\n @NumberProperty({ optional: true }) optionalNumber?: number;\n @BooleanProperty() requiredBoolean!: boolean;\n\n constructor(data: {\n requiredField: string;\n optionalField?: string;\n optionalNumber?: number;\n requiredBoolean: boolean;\n }) {\n this.requiredField = data.requiredField;\n this.optionalField = data.optionalField;\n this.optionalNumber = data.optionalNumber;\n this.requiredBoolean = data.requiredBoolean;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH DEFAULT VALUES\n// ============================================================================\n\nlet factoryCallCount = 0;\n\n/**\n * Entity with various default value strategies\n * Features: Static defaults, factory defaults, async factory defaults\n */\n@Entity()\nexport class EntityWithDefaults {\n @StringProperty({ default: 'default-name' })\n name!: string;\n\n @NumberProperty({ default: () => factoryCallCount++ })\n counter!: number;\n\n @DateProperty({ default: () => new Date('2025-01-01') })\n timestamp!: Date;\n\n @StringProperty({ default: async () => 'async-value' })\n asyncField!: string;\n\n @BooleanProperty({ default: true })\n enabled!: boolean;\n\n constructor(data: {\n name?: string;\n counter?: number;\n timestamp?: Date;\n asyncField?: string;\n enabled?: boolean;\n }) {\n this.name = data.name!;\n this.counter = data.counter!;\n this.timestamp = data.timestamp!;\n this.asyncField = data.asyncField!;\n this.enabled = data.enabled!;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH ARRAYS\n// ============================================================================\n\n/**\n * Entity with various array configurations\n * Features: Regular arrays, sparse arrays, array validators\n */\n@Entity()\nexport class EntityWithArrays {\n @ArrayProperty(() => String)\n tags!: string[];\n\n @ArrayProperty(() => Number, {\n minLength: 1,\n maxLength: 5,\n })\n ratings!: number[];\n\n @ArrayProperty(() => String, { sparse: true })\n sparseArray!: (string | null | undefined)[];\n\n @ArrayProperty(() => TestUser)\n users!: TestUser[];\n\n constructor(data: {\n tags: string[];\n ratings: number[];\n sparseArray: (string | null | undefined)[];\n users: TestUser[];\n }) {\n this.tags = data.tags;\n this.ratings = data.ratings;\n this.sparseArray = data.sparseArray;\n this.users = data.users;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH ENUMS\n// ============================================================================\n\nexport enum UserRole {\n ADMIN = 'admin',\n USER = 'user',\n GUEST = 'guest',\n}\n\nexport enum ProductStatus {\n DRAFT = 'draft',\n PUBLISHED = 'published',\n ARCHIVED = 'archived',\n}\n\n/**\n * Entity with enum properties\n * Features: EnumProperty decorator\n */\n@Entity()\nexport class EntityWithEnum {\n @StringProperty() name!: string;\n @EnumProperty(UserRole) role!: UserRole;\n @EnumProperty(ProductStatus) status!: ProductStatus;\n\n constructor(data: { name: string; role: UserRole; status: ProductStatus }) {\n this.name = data.name;\n this.role = data.role;\n this.status = data.status;\n }\n}\n\n// ============================================================================\n// NESTED ENTITIES (2-3 LEVELS)\n// ============================================================================\n\n/**\n * Level 1: Simple address entity\n * Features: Basic nested entity\n */\n@Entity()\nexport class TestAddress {\n @StringProperty() street!: string;\n @StringProperty() city!: string;\n @StringProperty() country!: string;\n @IntProperty() zipCode!: number;\n\n constructor(data: {\n street: string;\n city: string;\n country: string;\n zipCode: number;\n }) {\n this.street = data.street;\n this.city = data.city;\n this.country = data.country;\n this.zipCode = data.zipCode;\n }\n}\n\n/**\n * Level 2: Company with nested address\n * Features: 1-level nesting\n */\n@Entity()\nexport class TestCompany {\n @StringProperty() name!: string;\n @EntityProperty(() => TestAddress) address!: TestAddress;\n @IntProperty() employeeCount!: number;\n\n constructor(data: {\n name: string;\n address: TestAddress;\n employeeCount: number;\n }) {\n this.name = data.name;\n this.address = data.address;\n this.employeeCount = data.employeeCount;\n }\n}\n\n/**\n * Level 3: Employee with nested company (which has nested address)\n * Features: 2-level nesting\n */\n@Entity()\nexport class TestEmployee {\n @StringProperty() name!: string;\n @StringProperty() email!: string;\n @EntityProperty(() => TestCompany) company!: TestCompany;\n @NumberProperty() salary!: number;\n @DateProperty() hireDate!: Date;\n\n constructor(data: {\n name: string;\n email: string;\n company: TestCompany;\n salary: number;\n hireDate: Date;\n }) {\n this.name = data.name;\n this.email = data.email;\n this.company = data.company;\n this.salary = data.salary;\n this.hireDate = data.hireDate;\n }\n}\n\n/**\n * Entity with optional nested entities\n * Features: Optional nested entities\n */\n@Entity()\nexport class EntityWithOptionalNested {\n @StringProperty() id!: string;\n @EntityProperty(() => TestAddress, { optional: true })\n billingAddress?: TestAddress;\n @EntityProperty(() => TestAddress, { optional: true })\n shippingAddress?: TestAddress;\n\n constructor(data: {\n id: string;\n billingAddress?: TestAddress;\n shippingAddress?: TestAddress;\n }) {\n this.id = data.id;\n this.billingAddress = data.billingAddress;\n this.shippingAddress = data.shippingAddress;\n }\n}\n\n// ============================================================================\n// COLLECTION ENTITIES\n// ============================================================================\n\n/**\n * Collection entity wrapping string array\n * Features: @CollectionEntity decorator, unwraps to array\n */\n@CollectionEntity()\nexport class TestTags {\n @ArrayProperty(() => String)\n readonly collection: string[];\n\n constructor(data: { collection: string[] }) {\n this.collection = data.collection;\n }\n}\n\n/**\n * Collection entity wrapping number array\n * Features: @CollectionEntity with numbers\n */\n@CollectionEntity()\nexport class TestIdList {\n @ArrayProperty(() => Number)\n readonly collection: number[];\n\n constructor(data: { collection: number[] }) {\n this.collection = data.collection;\n }\n}\n\n/**\n * Collection entity with entity items\n * Features: @CollectionEntity with nested entities\n */\n@CollectionEntity()\nexport class TestUserCollection {\n @ArrayProperty(() => TestUser)\n readonly collection: TestUser[];\n\n constructor(data: { collection: TestUser[] }) {\n this.collection = data.collection;\n }\n}\n\n// ============================================================================\n// STRINGIFIABLE ENTITIES\n// ============================================================================\n\n/**\n * Stringifiable entity for user IDs\n * Features: @Stringifiable decorator, unwraps to string\n */\n@Stringifiable()\nexport class TestUserId {\n @StringProperty() readonly value: string;\n\n constructor(data: { value: string }) {\n this.value = data.value;\n }\n}\n\n/**\n * Stringifiable entity for emails with validation\n * Features: @Stringifiable with validation\n */\n@Stringifiable()\nexport class TestEmail {\n @StringProperty({\n pattern: /^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$/i,\n })\n readonly value: string;\n\n constructor(data: { value: string }) {\n this.value = data.value;\n }\n}\n\n/**\n * Entity using stringifiable properties\n * Features: Properties that are stringifiable entities\n */\n@Entity()\nexport class EntityWithStringifiable {\n @EntityProperty(() => TestUserId) userId!: TestUserId;\n @EntityProperty(() => TestEmail) email!: TestEmail;\n @StringProperty() name!: string;\n\n constructor(data: { userId: TestUserId; email: TestEmail; name: string }) {\n this.userId = data.userId;\n this.email = data.email;\n this.name = data.name;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH DEPENDENCY INJECTION\n// ============================================================================\n\nexport interface ILogger {\n log(message: string): void;\n}\n\nexport const LOGGER_TOKEN = Symbol('Logger');\n\n/**\n * Entity with injected properties\n * Features: @InjectedProperty decorator\n */\n@Entity()\nexport class EntityWithDI {\n @StringProperty() name!: string;\n @InjectedProperty(LOGGER_TOKEN) logger!: ILogger;\n\n constructor(data: { name: string; logger?: ILogger }) {\n this.name = data.name;\n if (data.logger) {\n this.logger = data.logger;\n }\n }\n\n logName(): void {\n this.logger.log(`Name is: ${this.name}`);\n }\n}\n\n// ============================================================================\n// ENTITIES WITH PASSTHROUGH\n// ============================================================================\n\n/**\n * Entity with passthrough properties\n * Features: @PassthroughProperty for unknown types\n */\n@Entity()\nexport class EntityWithPassthrough {\n @StringProperty() id!: string;\n @PassthroughProperty() metadata!: Record<string, unknown>;\n @PassthroughProperty() config!: unknown;\n\n constructor(data: {\n id: string;\n metadata: Record<string, unknown>;\n config: unknown;\n }) {\n this.id = data.id;\n this.metadata = data.metadata;\n this.config = data.config;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH CUSTOM SERIALIZATION\n// ============================================================================\n\n/**\n * Custom serializable class\n */\nexport class CustomValue {\n constructor(\n public x: number,\n public y: number,\n ) {}\n\n toData() {\n return { x: this.x, y: this.y };\n }\n\n static fromData(data: { x: number; y: number }): CustomValue {\n return new CustomValue(data.x, data.y);\n }\n}\n\n/**\n * Entity with custom serialize/deserialize\n * Features: Custom serialization functions\n */\n@Entity()\nexport class EntityWithCustomSerialization {\n @StringProperty() name!: string;\n\n @Property({\n type: () => CustomValue,\n serialize: (v: CustomValue) => v.toData(),\n deserialize: (d: unknown) =>\n CustomValue.fromData(d as { x: number; y: number }),\n })\n position!: CustomValue;\n\n constructor(data: { name: string; position: CustomValue }) {\n this.name = data.name;\n this.position = data.position;\n }\n}\n\n/**\n * Custom class with equals method\n */\nexport class CustomPoint {\n constructor(\n public x: number,\n public y: number,\n ) {}\n\n equals(other: CustomPoint): boolean {\n return this.x === other.x && this.y === other.y;\n }\n\n toString(): string {\n return `${this.x},${this.y}`;\n }\n\n static fromString(str: string): CustomPoint {\n const [x, y] = str.split(',').map(Number);\n return new CustomPoint(x, y);\n }\n}\n\n/**\n * Entity with custom equals function\n * Features: Custom equality comparison\n */\n@Entity()\nexport class EntityWithCustomEquals {\n @StringProperty() id!: string;\n\n @Property({\n type: () => CustomPoint,\n serialize: (v: CustomPoint) => v.toString(),\n deserialize: (d: unknown) => CustomPoint.fromString(d as string),\n equals: (a: CustomPoint, b: CustomPoint) => a.equals(b),\n })\n location!: CustomPoint;\n\n constructor(data: { id: string; location: CustomPoint }) {\n this.id = data.id;\n this.location = data.location;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH SERIALIZABLE/PARSEABLE PROPERTIES\n// ============================================================================\n\n/**\n * Custom class implementing Serializable interface\n */\nexport class SerializableValue {\n constructor(public data: string) {}\n\n toJSON(): string {\n return this.data;\n }\n\n equals(other: SerializableValue): boolean {\n return this.data === other.data;\n }\n\n static parse(json: unknown): SerializableValue {\n return new SerializableValue(json as string);\n }\n}\n\n/**\n * Entity using SerializableProperty\n * Features: @SerializableProperty decorator\n */\n@Entity()\nexport class EntityWithSerializable {\n @StringProperty() name!: string;\n @SerializableProperty(() => SerializableValue)\n value!: SerializableValue;\n\n constructor(data: { name: string; value: SerializableValue }) {\n this.name = data.name;\n this.value = data.value;\n }\n}\n\n/**\n * Custom class implementing Parseable interface\n */\nexport class ParseableValue {\n constructor(public data: number) {}\n\n toString(): string {\n return String(this.data);\n }\n\n equals(other: ParseableValue): boolean {\n return this.data === other.data;\n }\n\n static parse(str: string): ParseableValue {\n return new ParseableValue(Number(str));\n }\n}\n\n/**\n * Entity using StringifiableProperty\n * Features: @StringifiableProperty decorator\n */\n@Entity()\nexport class EntityWithParseable {\n @StringProperty() label!: string;\n @StringifiableProperty(() => ParseableValue)\n value!: ParseableValue;\n\n constructor(data: { label: string; value: ParseableValue }) {\n this.label = data.label;\n this.value = data.value;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH ZOD VALIDATION\n// ============================================================================\n\nconst emailSchema = z.string().email();\nconst positiveIntSchema = z.number().int().positive();\n\n/**\n * Entity with Zod validation\n * Features: @ZodProperty decorator\n */\n@Entity()\nexport class EntityWithZod {\n @ZodProperty(z.string().min(3).max(20))\n username!: string;\n\n @ZodProperty(emailSchema)\n email!: string;\n\n @ZodProperty(positiveIntSchema)\n count!: number;\n\n constructor(data: { username: string; email: string; count: number }) {\n this.username = data.username;\n this.email = data.email;\n this.count = data.count;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH IMMUTABLE PROPERTIES\n// ============================================================================\n\n/**\n * Entity with immutable (preventUpdates) properties\n * Features: preventUpdates flag\n */\n@Entity()\nexport class EntityWithImmutable {\n @StringProperty({ preventUpdates: true })\n readonly id: string;\n\n @StringProperty() name!: string;\n\n @DateProperty({ preventUpdates: true })\n readonly createdAt: Date;\n\n @NumberProperty() value!: number;\n\n constructor(data: {\n id: string;\n name: string;\n createdAt: Date;\n value: number;\n }) {\n this.id = data.id;\n this.name = data.name;\n this.createdAt = data.createdAt;\n this.value = data.value;\n }\n}\n\n// ============================================================================\n// COMPLEX ENTITY (COMBINING MULTIPLE FEATURES)\n// ============================================================================\n\n/**\n * Complex entity combining multiple features\n * Features: All common features in one entity\n * - Primitives, enums, nested entities, arrays\n * - Optional fields, defaults, validation\n * - Custom serialization, stringifiable properties\n */\n@Entity()\nexport class ComplexEntity {\n @StringProperty({ preventUpdates: true })\n readonly id: string;\n\n @StringProperty({ minLength: 2, maxLength: 50 })\n name!: string;\n\n @EnumProperty(UserRole)\n role!: UserRole;\n\n @EntityProperty(() => TestUserId)\n userId!: TestUserId;\n\n @EntityProperty(() => TestAddress)\n address!: TestAddress;\n\n @ArrayProperty(() => String, { minLength: 0, maxLength: 10 })\n tags!: string[];\n\n @ArrayProperty(() => TestProduct)\n products!: TestProduct[];\n\n @NumberProperty({ optional: true, min: 0 })\n score?: number;\n\n @DateProperty({ default: () => new Date() })\n createdAt!: Date;\n\n @DateProperty({ optional: true })\n updatedAt?: Date;\n\n @BooleanProperty({ default: true })\n active!: boolean;\n\n @PassthroughProperty()\n metadata!: Record<string, unknown>;\n\n constructor(data: {\n id: string;\n name: string;\n role: UserRole;\n userId: TestUserId;\n address: TestAddress;\n tags: string[];\n products: TestProduct[];\n score?: number;\n createdAt?: Date;\n updatedAt?: Date;\n active?: boolean;\n metadata: Record<string, unknown>;\n }) {\n this.id = data.id;\n this.name = data.name;\n this.role = data.role;\n this.userId = data.userId;\n this.address = data.address;\n this.tags = data.tags;\n this.products = data.products;\n this.score = data.score;\n this.createdAt = data.createdAt!;\n this.updatedAt = data.updatedAt;\n this.active = data.active!;\n this.metadata = data.metadata;\n }\n\n @EntityValidator()\n validateProducts(): Problem[] {\n if (this.products.length === 0 && this.active) {\n return [\n new Problem({\n property: 'products',\n message: 'Active entity must have at least one product',\n }),\n ];\n }\n return [];\n }\n}\n\n// ============================================================================\n// HELPER TO RESET FACTORY COUNTER (FOR TESTING)\n// ============================================================================\n\nexport function resetFactoryCallCount(): void {\n factoryCallCount = 0;\n}\n"],"names":["z","Entity","CollectionEntity","Stringifiable","EntityValidator","Property","StringProperty","NumberProperty","IntProperty","BooleanProperty","DateProperty","BigIntProperty","EnumProperty","EntityProperty","ArrayProperty","PassthroughProperty","SerializableProperty","StringifiableProperty","InjectedProperty","ZodProperty","Problem","TestUser","data","name","age","active","TestProduct","id","price","quantity","createdAt","EntityWithSpecialTypes","timestamp","largeNumber","label","ValidatedEntity","username","email","minLength","maxLength","pattern","min","max","CrossValidatedEntity","password","confirmPassword","startDate","endDate","validatePasswords","property","message","validateDates","OptionalFieldsEntity","requiredField","optionalField","optionalNumber","requiredBoolean","optional","factoryCallCount","EntityWithDefaults","counter","asyncField","enabled","default","Date","EntityWithArrays","tags","ratings","sparseArray","users","String","Number","sparse","UserRole","ProductStatus","EntityWithEnum","role","status","TestAddress","street","city","country","zipCode","TestCompany","address","employeeCount","TestEmployee","company","salary","hireDate","EntityWithOptionalNested","billingAddress","shippingAddress","TestTags","collection","TestIdList","TestUserCollection","TestUserId","value","TestEmail","EntityWithStringifiable","userId","LOGGER_TOKEN","Symbol","EntityWithDI","logger","logName","log","EntityWithPassthrough","metadata","config","CustomValue","x","y","toData","fromData","EntityWithCustomSerialization","position","type","serialize","v","deserialize","d","CustomPoint","equals","other","toString","fromString","str","split","map","EntityWithCustomEquals","location","a","b","SerializableValue","toJSON","parse","json","EntityWithSerializable","ParseableValue","EntityWithParseable","emailSchema","string","positiveIntSchema","number","int","positive","EntityWithZod","count","EntityWithImmutable","preventUpdates","ComplexEntity","products","score","updatedAt","validateProducts","length","resetFactoryCallCount"],"mappings":";;AAAA,OAAO,mBAAmB;AAC1B,SAASA,CAAC,QAAQ,MAAM;AACxB,SACEC,MAAM,EACNC,gBAAgB,EAChBC,a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GrI,KAAKqI,SAAS;QAC/B,IAAI,CAAClI,MAAM,GAAGH,KAAKG,MAAM;QACzB,IAAI,CAACoF,QAAQ,GAAGvF,KAAKuF,QAAQ;IAC/B;IAGA+C,mBAA8B;QAC5B,IAAI,IAAI,CAACH,QAAQ,CAACI,MAAM,KAAK,KAAK,IAAI,CAACpI,MAAM,EAAE;YAC7C,OAAO;gBACL,IAAIL,QAAQ;oBACV6B,UAAU;oBACVC,SAAS;gBACX;aACD;QACH;QACA,OAAO,EAAE;IACX;AACF;;;QA5EoBqG,gBAAgB;;;;;;QAGhBjH,WAAW;QAAGC,WAAW;;;;;;;;;uBAMrB0D;;;;uBAGAnB;;;;sBAGDR;QAAUhC,WAAW;QAAGC,WAAW;;;;;sBAGnCb;;;;;QAGH+B,UAAU;QAAMhB,KAAK;;;;;;QAGvBsB,SAAS,IAAM,IAAIC;;;;;;QAGnBP,UAAU;;;;;;QAGPM,SAAS;;;;;;;;;;;;;;;;;;;;;AAgD9B,+EAA+E;AAC/E,gDAAgD;AAChD,+EAA+E;AAE/E,OAAO,SAAS+F;IACdpG,mBAAmB;AACrB"}
1
+ {"version":3,"sources":["../../src/lib/test-entities.ts"],"sourcesContent":["import 'reflect-metadata';\nimport { z } from 'zod';\nimport {\n Entity,\n CollectionEntity,\n Stringifiable,\n EntityValidator,\n} from './entity.js';\nimport {\n Property,\n StringProperty,\n NumberProperty,\n IntProperty,\n BooleanProperty,\n DateProperty,\n BigIntProperty,\n EnumProperty,\n EntityProperty,\n ArrayProperty,\n PassthroughProperty,\n SerializableProperty,\n StringifiableProperty,\n} from './property.js';\nimport { InjectedProperty } from './injected-property.js';\nimport { ZodProperty } from './zod-property.js';\nimport { Problem } from './problem.js';\n\n// ============================================================================\n// SIMPLE ENTITIES WITH PRIMITIVES\n// ============================================================================\n\n/**\n * Basic entity with common primitive types\n * Features: String, Number, Boolean properties\n */\n@Entity()\nexport class TestUser {\n @StringProperty() name!: string;\n @NumberProperty() age!: number;\n @BooleanProperty() active!: boolean;\n\n constructor(data: { name: string; age: number; active: boolean }) {\n this.name = data.name;\n this.age = data.age;\n this.active = data.active;\n }\n}\n\n/**\n * Entity with different primitive combinations\n * Features: String, Number, Int, Date properties\n */\n@Entity()\nexport class TestProduct {\n @StringProperty() id!: string;\n @StringProperty() name!: string;\n @NumberProperty() price!: number;\n @IntProperty() quantity!: number;\n @DateProperty() createdAt!: Date;\n\n constructor(data: {\n id: string;\n name: string;\n price: number;\n quantity: number;\n createdAt: Date;\n }) {\n this.id = data.id;\n this.name = data.name;\n this.price = data.price;\n this.quantity = data.quantity;\n this.createdAt = data.createdAt;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH SPECIAL TYPES\n// ============================================================================\n\n/**\n * Entity with Date and BigInt types\n * Features: DateProperty, BigIntProperty\n */\n@Entity()\nexport class EntityWithSpecialTypes {\n @DateProperty() timestamp!: Date;\n @BigIntProperty() largeNumber!: bigint;\n @StringProperty() label!: string;\n\n constructor(data: { timestamp: Date; largeNumber: bigint; label: string }) {\n this.timestamp = data.timestamp;\n this.largeNumber = data.largeNumber;\n this.label = data.label;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH VALIDATION\n// ============================================================================\n\n/**\n * Entity with property-level validators\n * Features: String validators (minLength, maxLength, pattern)\n */\n@Entity()\nexport class ValidatedEntity {\n @StringProperty({\n minLength: 3,\n maxLength: 20,\n })\n username!: string;\n\n @StringProperty({\n pattern: /^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$/i,\n })\n email!: string;\n\n @NumberProperty({ min: 0, max: 150 })\n age!: number;\n\n constructor(data: { username: string; email: string; age: number }) {\n this.username = data.username;\n this.email = data.email;\n this.age = data.age;\n }\n}\n\n/**\n * Entity with cross-property validation\n * Features: @EntityValidator decorator\n */\n@Entity()\nexport class CrossValidatedEntity {\n @StringProperty() password!: string;\n @StringProperty() confirmPassword!: string;\n @DateProperty() startDate!: Date;\n @DateProperty() endDate!: Date;\n\n constructor(data: {\n password: string;\n confirmPassword: string;\n startDate: Date;\n endDate: Date;\n }) {\n this.password = data.password;\n this.confirmPassword = data.confirmPassword;\n this.startDate = data.startDate;\n this.endDate = data.endDate;\n }\n\n @EntityValidator()\n validatePasswords(): Problem[] {\n if (this.password !== this.confirmPassword) {\n return [\n new Problem({\n property: 'confirmPassword',\n message: 'Passwords do not match',\n }),\n ];\n }\n return [];\n }\n\n @EntityValidator()\n validateDates(): Problem[] {\n if (this.startDate >= this.endDate) {\n return [\n new Problem({\n property: 'endDate',\n message: 'End date must be after start date',\n }),\n ];\n }\n return [];\n }\n}\n\n// ============================================================================\n// ENTITIES WITH OPTIONAL/REQUIRED FIELDS\n// ============================================================================\n\n/**\n * Entity with mix of optional and required properties\n * Features: optional flag\n */\n@Entity()\nexport class OptionalFieldsEntity {\n @StringProperty() requiredField!: string;\n @StringProperty({ optional: true }) optionalField?: string;\n @NumberProperty({ optional: true }) optionalNumber?: number;\n @BooleanProperty() requiredBoolean!: boolean;\n\n constructor(data: {\n requiredField: string;\n optionalField?: string;\n optionalNumber?: number;\n requiredBoolean: boolean;\n }) {\n this.requiredField = data.requiredField;\n this.optionalField = data.optionalField;\n this.optionalNumber = data.optionalNumber;\n this.requiredBoolean = data.requiredBoolean;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH DEFAULT VALUES\n// ============================================================================\n\nlet factoryCallCount = 0;\n\n/**\n * Entity with various default value strategies\n * Features: Static defaults, factory defaults, async factory defaults\n */\n@Entity()\nexport class EntityWithDefaults {\n @StringProperty({ default: 'default-name' })\n name!: string;\n\n @NumberProperty({ default: () => factoryCallCount++ })\n counter!: number;\n\n @DateProperty({ default: () => new Date('2025-01-01') })\n timestamp!: Date;\n\n @StringProperty({ default: async () => 'async-value' })\n asyncField!: string;\n\n @BooleanProperty({ default: true })\n enabled!: boolean;\n\n constructor(data: {\n name?: string;\n counter?: number;\n timestamp?: Date;\n asyncField?: string;\n enabled?: boolean;\n }) {\n this.name = data.name!;\n this.counter = data.counter!;\n this.timestamp = data.timestamp!;\n this.asyncField = data.asyncField!;\n this.enabled = data.enabled!;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH ARRAYS\n// ============================================================================\n\n/**\n * Entity with various array configurations\n * Features: Regular arrays, sparse arrays, array validators\n */\n@Entity()\nexport class EntityWithArrays {\n @ArrayProperty(() => String)\n tags!: string[];\n\n @ArrayProperty(() => Number, {\n minLength: 1,\n maxLength: 5,\n })\n ratings!: number[];\n\n @ArrayProperty(() => String, { sparse: true })\n sparseArray!: (string | null | undefined)[];\n\n @ArrayProperty(() => TestUser)\n users!: TestUser[];\n\n constructor(data: {\n tags: string[];\n ratings: number[];\n sparseArray: (string | null | undefined)[];\n users: TestUser[];\n }) {\n this.tags = data.tags;\n this.ratings = data.ratings;\n this.sparseArray = data.sparseArray;\n this.users = data.users;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH ENUMS\n// ============================================================================\n\nexport enum UserRole {\n ADMIN = 'admin',\n USER = 'user',\n GUEST = 'guest',\n}\n\nexport enum ProductStatus {\n DRAFT = 'draft',\n PUBLISHED = 'published',\n ARCHIVED = 'archived',\n}\n\n/**\n * Entity with enum properties\n * Features: EnumProperty decorator\n */\n@Entity()\nexport class EntityWithEnum {\n @StringProperty() name!: string;\n @EnumProperty(UserRole) role!: UserRole;\n @EnumProperty(ProductStatus) status!: ProductStatus;\n\n constructor(data: { name: string; role: UserRole; status: ProductStatus }) {\n this.name = data.name;\n this.role = data.role;\n this.status = data.status;\n }\n}\n\n// ============================================================================\n// NESTED ENTITIES (2-3 LEVELS)\n// ============================================================================\n\n/**\n * Level 1: Simple address entity\n * Features: Basic nested entity\n */\n@Entity()\nexport class TestAddress {\n @StringProperty() street!: string;\n @StringProperty() city!: string;\n @StringProperty() country!: string;\n @IntProperty() zipCode!: number;\n\n constructor(data: {\n street: string;\n city: string;\n country: string;\n zipCode: number;\n }) {\n this.street = data.street;\n this.city = data.city;\n this.country = data.country;\n this.zipCode = data.zipCode;\n }\n}\n\n/**\n * Level 2: Company with nested address\n * Features: 1-level nesting\n */\n@Entity()\nexport class TestCompany {\n @StringProperty() name!: string;\n @EntityProperty(() => TestAddress) address!: TestAddress;\n @IntProperty() employeeCount!: number;\n\n constructor(data: {\n name: string;\n address: TestAddress;\n employeeCount: number;\n }) {\n this.name = data.name;\n this.address = data.address;\n this.employeeCount = data.employeeCount;\n }\n}\n\n/**\n * Level 3: Employee with nested company (which has nested address)\n * Features: 2-level nesting\n */\n@Entity()\nexport class TestEmployee {\n @StringProperty() name!: string;\n @StringProperty() email!: string;\n @EntityProperty(() => TestCompany) company!: TestCompany;\n @NumberProperty() salary!: number;\n @DateProperty() hireDate!: Date;\n\n constructor(data: {\n name: string;\n email: string;\n company: TestCompany;\n salary: number;\n hireDate: Date;\n }) {\n this.name = data.name;\n this.email = data.email;\n this.company = data.company;\n this.salary = data.salary;\n this.hireDate = data.hireDate;\n }\n}\n\n/**\n * Entity with optional nested entities\n * Features: Optional nested entities\n */\n@Entity()\nexport class EntityWithOptionalNested {\n @StringProperty() id!: string;\n @EntityProperty(() => TestAddress, { optional: true })\n billingAddress?: TestAddress;\n @EntityProperty(() => TestAddress, { optional: true })\n shippingAddress?: TestAddress;\n\n constructor(data: {\n id: string;\n billingAddress?: TestAddress;\n shippingAddress?: TestAddress;\n }) {\n this.id = data.id;\n this.billingAddress = data.billingAddress;\n this.shippingAddress = data.shippingAddress;\n }\n}\n\n// ============================================================================\n// COLLECTION ENTITIES\n// ============================================================================\n\n/**\n * Collection entity wrapping string array\n * Features: @CollectionEntity decorator, unwraps to array\n */\n@CollectionEntity()\nexport class TestTags {\n @ArrayProperty(() => String)\n readonly collection: string[];\n\n constructor(data: { collection: string[] }) {\n this.collection = data.collection;\n }\n}\n\n/**\n * Collection entity wrapping number array\n * Features: @CollectionEntity with numbers\n */\n@CollectionEntity()\nexport class TestIdList {\n @ArrayProperty(() => Number)\n readonly collection: number[];\n\n constructor(data: { collection: number[] }) {\n this.collection = data.collection;\n }\n}\n\n/**\n * Collection entity with entity items\n * Features: @CollectionEntity with nested entities\n */\n@CollectionEntity()\nexport class TestUserCollection {\n @ArrayProperty(() => TestUser)\n readonly collection: TestUser[];\n\n constructor(data: { collection: TestUser[] }) {\n this.collection = data.collection;\n }\n}\n\n// ============================================================================\n// STRINGIFIABLE ENTITIES\n// ============================================================================\n\n/**\n * Stringifiable entity for user IDs\n * Features: @Stringifiable decorator, unwraps to string\n */\n@Stringifiable()\nexport class TestUserId {\n @StringProperty() readonly value: string;\n\n constructor(data: { value: string }) {\n this.value = data.value;\n }\n}\n\n/**\n * Stringifiable entity for emails with validation\n * Features: @Stringifiable with validation\n */\n@Stringifiable()\nexport class TestEmail {\n @StringProperty({\n pattern: /^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$/i,\n })\n readonly value: string;\n\n constructor(data: { value: string }) {\n this.value = data.value;\n }\n}\n\n/**\n * Entity using stringifiable properties\n * Features: Properties that are stringifiable entities\n */\n@Entity()\nexport class EntityWithStringifiable {\n @EntityProperty(() => TestUserId) userId!: TestUserId;\n @EntityProperty(() => TestEmail) email!: TestEmail;\n @StringProperty() name!: string;\n\n constructor(data: { userId: TestUserId; email: TestEmail; name: string }) {\n this.userId = data.userId;\n this.email = data.email;\n this.name = data.name;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH DEPENDENCY INJECTION\n// ============================================================================\n\nexport interface ILogger {\n log(message: string): void;\n}\n\nexport const LOGGER_TOKEN = Symbol('Logger');\n\n/**\n * Entity with injected properties\n * Features: @InjectedProperty decorator\n */\n@Entity()\nexport class EntityWithDI {\n @StringProperty() name!: string;\n @InjectedProperty(LOGGER_TOKEN) logger!: ILogger;\n\n constructor(data: { name: string; logger?: ILogger }) {\n this.name = data.name;\n if (data.logger) {\n this.logger = data.logger;\n }\n }\n\n logName(): void {\n this.logger.log(`Name is: ${this.name}`);\n }\n}\n\n// ============================================================================\n// ENTITIES WITH PASSTHROUGH\n// ============================================================================\n\n/**\n * Entity with passthrough properties\n * Features: @PassthroughProperty for unknown types\n */\n@Entity()\nexport class EntityWithPassthrough {\n @StringProperty() id!: string;\n @PassthroughProperty() metadata!: Record<string, unknown>;\n @PassthroughProperty() config!: unknown;\n\n constructor(data: {\n id: string;\n metadata: Record<string, unknown>;\n config: unknown;\n }) {\n this.id = data.id;\n this.metadata = data.metadata;\n this.config = data.config;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH CUSTOM SERIALIZATION\n// ============================================================================\n\n/**\n * Custom serializable class\n */\nexport class CustomValue {\n constructor(\n public x: number,\n public y: number,\n ) {}\n\n toData() {\n return { x: this.x, y: this.y };\n }\n\n static fromData(data: { x: number; y: number }): CustomValue {\n return new CustomValue(data.x, data.y);\n }\n}\n\n/**\n * Entity with custom serialize/deserialize\n * Features: Custom serialization functions\n */\n@Entity()\nexport class EntityWithCustomSerialization {\n @StringProperty() name!: string;\n\n @Property({\n type: () => CustomValue,\n serialize: (v: CustomValue) => v.toData(),\n deserialize: (d: unknown) =>\n CustomValue.fromData(d as { x: number; y: number }),\n })\n position!: CustomValue;\n\n constructor(data: { name: string; position: CustomValue }) {\n this.name = data.name;\n this.position = data.position;\n }\n}\n\n/**\n * Custom class with equals method\n */\nexport class CustomPoint {\n constructor(\n public x: number,\n public y: number,\n ) {}\n\n equals(other: CustomPoint): boolean {\n return this.x === other.x && this.y === other.y;\n }\n\n toString(): string {\n return `${this.x},${this.y}`;\n }\n\n static fromString(str: string): CustomPoint {\n const [x, y] = str.split(',').map(Number);\n return new CustomPoint(x, y);\n }\n}\n\n/**\n * Entity with custom equals function\n * Features: Custom equality comparison\n */\n@Entity()\nexport class EntityWithCustomEquals {\n @StringProperty() id!: string;\n\n @Property({\n type: () => CustomPoint,\n serialize: (v: CustomPoint) => v.toString(),\n deserialize: (d: unknown) => CustomPoint.fromString(d as string),\n equals: (a: CustomPoint, b: CustomPoint) => a.equals(b),\n })\n location!: CustomPoint;\n\n constructor(data: { id: string; location: CustomPoint }) {\n this.id = data.id;\n this.location = data.location;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH SERIALIZABLE/PARSEABLE PROPERTIES\n// ============================================================================\n\n/**\n * Custom class implementing Serializable interface\n */\nexport class SerializableValue {\n constructor(public data: string) {}\n\n toJSON(): string {\n return this.data;\n }\n\n equals(other: SerializableValue): boolean {\n return this.data === other.data;\n }\n\n static parse(json: unknown): SerializableValue {\n return new SerializableValue(json as string);\n }\n}\n\n/**\n * Entity using SerializableProperty\n * Features: @SerializableProperty decorator\n */\n@Entity()\nexport class EntityWithSerializable {\n @StringProperty() name!: string;\n @SerializableProperty(() => SerializableValue)\n value!: SerializableValue;\n\n constructor(data: { name: string; value: SerializableValue }) {\n this.name = data.name;\n this.value = data.value;\n }\n}\n\n/**\n * Custom class implementing Parseable interface\n */\nexport class ParseableValue {\n constructor(public data: number) {}\n\n toString(): string {\n return String(this.data);\n }\n\n equals(other: ParseableValue): boolean {\n return this.data === other.data;\n }\n\n static parse(str: string): ParseableValue {\n return new ParseableValue(Number(str));\n }\n}\n\n/**\n * Entity using StringifiableProperty\n * Features: @StringifiableProperty decorator\n */\n@Entity()\nexport class EntityWithParseable {\n @StringProperty() label!: string;\n @StringifiableProperty(() => ParseableValue)\n value!: ParseableValue;\n\n constructor(data: { label: string; value: ParseableValue }) {\n this.label = data.label;\n this.value = data.value;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH ZOD VALIDATION\n// ============================================================================\n\nconst emailSchema = z.string().email();\nconst positiveIntSchema = z.number().int().positive();\n\n/**\n * Entity with Zod validation\n * Features: @ZodProperty decorator\n */\n@Entity()\nexport class EntityWithZod {\n @ZodProperty(z.string().min(3).max(20))\n username!: string;\n\n @ZodProperty(emailSchema)\n email!: string;\n\n @ZodProperty(positiveIntSchema)\n count!: number;\n\n constructor(data: { username: string; email: string; count: number }) {\n this.username = data.username;\n this.email = data.email;\n this.count = data.count;\n }\n}\n\n// ============================================================================\n// ENTITIES WITH IMMUTABLE PROPERTIES\n// ============================================================================\n\n/**\n * Entity with immutable (preventUpdates) properties\n * Features: preventUpdates flag\n */\n@Entity()\nexport class EntityWithImmutable {\n @StringProperty({ preventUpdates: true })\n readonly id: string;\n\n @StringProperty() name!: string;\n\n @DateProperty({ preventUpdates: true })\n readonly createdAt: Date;\n\n @NumberProperty() value!: number;\n\n constructor(data: {\n id: string;\n name: string;\n createdAt: Date;\n value: number;\n }) {\n this.id = data.id;\n this.name = data.name;\n this.createdAt = data.createdAt;\n this.value = data.value;\n }\n}\n\n// ============================================================================\n// COMPLEX ENTITY (COMBINING MULTIPLE FEATURES)\n// ============================================================================\n\n/**\n * Complex entity combining multiple features\n * Features: All common features in one entity\n * - Primitives, enums, nested entities, arrays\n * - Optional fields, defaults, validation\n * - Custom serialization, stringifiable properties\n */\n@Entity()\nexport class ComplexEntity {\n @StringProperty({ preventUpdates: true })\n readonly id: string;\n\n @StringProperty({ minLength: 2, maxLength: 50 })\n name!: string;\n\n @EnumProperty(UserRole)\n role!: UserRole;\n\n @EntityProperty(() => TestUserId)\n userId!: TestUserId;\n\n @EntityProperty(() => TestAddress)\n address!: TestAddress;\n\n @ArrayProperty(() => String, { minLength: 0, maxLength: 10 })\n tags!: string[];\n\n @ArrayProperty(() => TestProduct)\n products!: TestProduct[];\n\n @NumberProperty({ optional: true, min: 0 })\n score?: number;\n\n @DateProperty({ default: () => new Date() })\n createdAt!: Date;\n\n @DateProperty({ optional: true })\n updatedAt?: Date;\n\n @BooleanProperty({ default: true })\n active!: boolean;\n\n @PassthroughProperty()\n metadata!: Record<string, unknown>;\n\n constructor(data: {\n id: string;\n name: string;\n role: UserRole;\n userId: TestUserId;\n address: TestAddress;\n tags: string[];\n products: TestProduct[];\n score?: number;\n createdAt?: Date;\n updatedAt?: Date;\n active?: boolean;\n metadata: Record<string, unknown>;\n }) {\n this.id = data.id;\n this.name = data.name;\n this.role = data.role;\n this.userId = data.userId;\n this.address = data.address;\n this.tags = data.tags;\n this.products = data.products;\n this.score = data.score;\n this.createdAt = data.createdAt!;\n this.updatedAt = data.updatedAt;\n this.active = data.active!;\n this.metadata = data.metadata;\n }\n\n @EntityValidator()\n validateProducts(): Problem[] {\n if (this.products.length === 0 && this.active) {\n return [\n new Problem({\n property: 'products',\n message: 'Active entity must have at least one product',\n }),\n ];\n }\n return [];\n }\n}\n\n// ============================================================================\n// HELPER TO RESET FACTORY COUNTER (FOR TESTING)\n// ============================================================================\n\nexport function resetFactoryCallCount(): void {\n factoryCallCount = 0;\n}\n\n// ============================================================================\n// ENTITIES FOR parseBigInt TESTING\n// ============================================================================\n\n/**\n * Entity with NumberProperty and IntProperty configured with parseBigInt: true\n * Features: coercion from bigint / integer string to number\n */\n@Entity()\nexport class EntityWithParseBigInt {\n @NumberProperty({ parseBigInt: true }) amount!: number;\n @IntProperty({ parseBigInt: true }) count!: number;\n\n constructor(data: { amount: number; count: number }) {\n this.amount = data.amount;\n this.count = data.count;\n }\n}\n"],"names":["z","Entity","CollectionEntity","Stringifiable","EntityValidator","Property","StringProperty","NumberProperty","IntProperty","BooleanProperty","DateProperty","BigIntProperty","EnumProperty","EntityProperty","ArrayProperty","PassthroughProperty","SerializableProperty","StringifiableProperty","InjectedProperty","ZodProperty","Problem","TestUser","data","name","age","active","TestProduct","id","price","quantity","createdAt","EntityWithSpecialTypes","timestamp","largeNumber","label","ValidatedEntity","username","email","minLength","maxLength","pattern","min","max","CrossValidatedEntity","password","confirmPassword","startDate","endDate","validatePasswords","property","message","validateDates","OptionalFieldsEntity","requiredField","optionalField","optionalNumber","requiredBoolean","optional","factoryCallCount","EntityWithDefaults","counter","asyncField","enabled","default","Date","EntityWithArrays","tags","ratings","sparseArray","users","String","Number","sparse","UserRole","ProductStatus","EntityWithEnum","role","status","TestAddress","street","city","country","zipCode","TestCompany","address","employeeCount","TestEmployee","company","salary","hireDate","EntityWithOptionalNested","billingAddress","shippingAddress","TestTags","collection","TestIdList","TestUserCollection","TestUserId","value","TestEmail","EntityWithStringifiable","userId","LOGGER_TOKEN","Symbol","EntityWithDI","logger","logName","log","EntityWithPassthrough","metadata","config","CustomValue","x","y","toData","fromData","EntityWithCustomSerialization","position","type","serialize","v","deserialize","d","CustomPoint","equals","other","toString","fromString","str","split","map","EntityWithCustomEquals","location","a","b","SerializableValue","toJSON","parse","json","EntityWithSerializable","ParseableValue","EntityWithParseable","emailSchema","string","positiveIntSchema","number","int","positive","EntityWithZod","count","EntityWithImmutable","preventUpdates","ComplexEntity","products","score","updatedAt","validateProducts","length","resetFactoryCallCount","EntityWithParseBigInt","amount","parseBigInt"],"mappings":";;AAAA,OAAO,mBAAmB;AAC1B,SAASA,CAAC,QAAQ,MAAM;AACxB,SACEC,MAAM,EACNC,gBAAgB,EAChBC,aAAa,EACbC,eAAe,QACV,cAAc;AACrB,SACEC,QAAQ,EACRC,cAAc,EACdC,cAAc,EACdC,WAAW,EACXC,eAAe,EACfC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,cAAc,EACdC,aAAa,EACbC,mBAAmB,EACnBC,oBAAoB,EACpBC,qBAAqB,QAChB,gBAAgB;AACvB,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,OAAO,QAAQ,eAAe;AAWvC,OAAO,MAAMC;IAKX,YAAYC,IAAoD,CAAE;QAChE,IAAI,CAACC,IAAI,GAAGD,KAAKC,IAAI;QACrB,IAAI,CAACC,GAAG,GAAGF,KAAKE,GAAG;QACnB,IAAI,CAACC,MAAM,GAAGH,KAAKG,MAAM;IAC3B;AACF;;;;;;;;;;;;;;;;;;;;AAOA,OAAO,MAAMC;IAOX,YAAYJ,IAMX,CAAE;QACD,IAAI,CAACK,EAAE,GAAGL,KAAKK,EAAE;QACjB,IAAI,CAACJ,IAAI,GAAGD,KAAKC,IAAI;QACrB,IAAI,CAACK,KAAK,GAAGN,KAAKM,KAAK;QACvB,IAAI,CAACC,QAAQ,GAAGP,KAAKO,QAAQ;QAC7B,IAAI,CAACC,SAAS,GAAGR,KAAKQ,SAAS;IACjC;AACF;;;;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H,KAAK+H,KAAK;IACzB;AACF;;;QAPoBY,aAAa;;;;;;QAChBA,aAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtpaulino/entity",
3
- "version": "0.25.0",
3
+ "version": "0.26.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -47,7 +47,7 @@
47
47
  }
48
48
  },
49
49
  "dependencies": {
50
- "@rtpaulino/core": "^0.13.0",
50
+ "@rtpaulino/core": "^0.13.1",
51
51
  "@swc/helpers": "~0.5.18",
52
52
  "lodash-es": "^4.17.22"
53
53
  },