@rtpaulino/entity 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
@@ -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,iBAAiB,CAAC,EAAE,MAAM,CAAC,GAAG;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GACA,eAAe,CAAC,MA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C,EAAE,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,GAAG;IACpE,qBAAqB,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
  /**
@@ -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, 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","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","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;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,MA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,MAAMF,UAA2B;oBAC/B6B,MAAM,IAAMC;oBACZiD,0BAA0B;oBAC1BC,qBAAqBJ;gBACvB;gBAEA7E,SAASC,SAASC,QAAQC;YAC5B;QACF;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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEC,GACD,OAAO,SAAS6E,oBAGdC,iBAAsD;IACtD,OAAO,CAAC7E,QAAgBC;QACtB,IAAI,OAAOA,gBAAgB,UAAU;YACnC;QACF;QAEA,0CAA0C;QAC1CE,QAAQI,cAAc,CACpBrB,mCACAe,aACAD,OAAO,WAAW;QAGpB,kCAAkC;QAClCJ,oBAAoBkF,wBAAwB,CAC1C9E,OAAO,WAAW,EAClBC;QAGF,iEAAiE;QACjE,MAAMkB,kBAA+ChB,QAAQC,cAAc,CACzEnB,+BACAe,QACAC;QAGF,IAAIkB,iBAAiB;YACnB,mDAAmD;YACnD,MAAM4D,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"}
@@ -337,6 +337,18 @@ export declare class EntityWithCustomSerialization {
337
337
  position: CustomValue;
338
338
  });
339
339
  }
340
+ /**
341
+ * Entity to verify serialize/deserialize context is passed correctly
342
+ * Features: Context-aware serialization using propertyName and sibling values
343
+ */
344
+ export declare class EntityWithContextSerialization {
345
+ id: string;
346
+ label: string;
347
+ constructor(data: {
348
+ id: string;
349
+ label: string;
350
+ });
351
+ }
340
352
  /**
341
353
  * Custom class with equals method
342
354
  */
@@ -471,4 +483,16 @@ export declare class ComplexEntity {
471
483
  validateProducts(): Problem[];
472
484
  }
473
485
  export declare function resetFactoryCallCount(): void;
486
+ /**
487
+ * Entity with NumberProperty and IntProperty configured with parseBigInt: true
488
+ * Features: coercion from bigint / integer string to number
489
+ */
490
+ export declare class EntityWithParseBigInt {
491
+ amount: number;
492
+ count: number;
493
+ constructor(data: {
494
+ amount: number;
495
+ count: number;
496
+ });
497
+ }
474
498
  //# 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,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE;CAKjE;AAED;;;GAGG;AACH,qBACa,WAAW;IACJ,EAAE,EAAG,MAAM,CAAC;IACZ,IAAI,EAAG,MAAM,CAAC;IACd,KAAK,EAAG,MAAM,CAAC;IAClB,QAAQ,EAAG,MAAM,CAAC;IACjB,SAAS,EAAG,IAAI,CAAC;gBAErB,IAAI,EAAE;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,IAAI,CAAC;KACjB;CAOF;AAMD;;;GAGG;AACH,qBACa,sBAAsB;IACjB,SAAS,EAAG,IAAI,CAAC;IACf,WAAW,EAAG,M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C,EAAE,MAAM,CAAC;IAGf,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,CAAC,EAAE,IAAI,CAAC;IAGjB,MAAM,EAAG,OAAO,CAAC;IAGjB,QAAQ,EAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEvB,IAAI,EAAE;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,QAAQ,CAAC;QACf,MAAM,EAAE,UAAU,CAAC;QACnB,OAAO,EAAE,WAAW,CAAC;QACrB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,QAAQ,EAAE,WAAW,EAAE,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,IAAI,CAAC;QACjB,SAAS,CAAC,EAAE,IAAI,CAAC;QACjB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC;IAgBD,gBAAgB,IAAI,OAAO,EAAE;CAW9B;AAMD,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAMD;;;GAGG;AACH,qBACa,qBAAqB;IACO,MAAM,EAAG,MAAM,CAAC;IACnB,KAAK,EAAG,MAAM,CAAC;gBAEvC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;CAIpD"}
@@ -685,6 +685,31 @@ EntityWithCustomSerialization = _ts_decorate([
685
685
  Object
686
686
  ])
687
687
  ], EntityWithCustomSerialization);
688
+ export class EntityWithContextSerialization {
689
+ constructor(data){
690
+ this.id = data.id;
691
+ this.label = data.label;
692
+ }
693
+ }
694
+ _ts_decorate([
695
+ StringProperty(),
696
+ _ts_metadata("design:type", String)
697
+ ], EntityWithContextSerialization.prototype, "id", void 0);
698
+ _ts_decorate([
699
+ Property({
700
+ type: ()=>String,
701
+ serialize: (v, context)=>`${context.propertyName}:${v}:${context.entity['id']}`,
702
+ deserialize: (raw, context)=>`${raw}-from-${context.rawObject['id']}`
703
+ }),
704
+ _ts_metadata("design:type", String)
705
+ ], EntityWithContextSerialization.prototype, "label", void 0);
706
+ EntityWithContextSerialization = _ts_decorate([
707
+ Entity(),
708
+ _ts_metadata("design:type", Function),
709
+ _ts_metadata("design:paramtypes", [
710
+ Object
711
+ ])
712
+ ], EntityWithContextSerialization);
688
713
  /**
689
714
  * Custom class with equals method
690
715
  */ export class CustomPoint {
@@ -983,5 +1008,30 @@ ComplexEntity = _ts_decorate([
983
1008
  export function resetFactoryCallCount() {
984
1009
  factoryCallCount = 0;
985
1010
  }
1011
+ export class EntityWithParseBigInt {
1012
+ constructor(data){
1013
+ this.amount = data.amount;
1014
+ this.count = data.count;
1015
+ }
1016
+ }
1017
+ _ts_decorate([
1018
+ NumberProperty({
1019
+ parseBigInt: true
1020
+ }),
1021
+ _ts_metadata("design:type", Number)
1022
+ ], EntityWithParseBigInt.prototype, "amount", void 0);
1023
+ _ts_decorate([
1024
+ IntProperty({
1025
+ parseBigInt: true
1026
+ }),
1027
+ _ts_metadata("design:type", Number)
1028
+ ], EntityWithParseBigInt.prototype, "count", void 0);
1029
+ EntityWithParseBigInt = _ts_decorate([
1030
+ Entity(),
1031
+ _ts_metadata("design:type", Function),
1032
+ _ts_metadata("design:paramtypes", [
1033
+ Object
1034
+ ])
1035
+ ], EntityWithParseBigInt);
986
1036
 
987
1037
  //# sourceMappingURL=test-entities.js.map