@mikro-orm/core 6.3.13-dev.10 → 6.3.13-dev.12

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.
@@ -2,6 +2,7 @@ import { type Cascade, type LoadStrategy } from '../enums';
2
2
  import type { EntityName, Constructor, CheckCallback, GeneratedColumnCallback, AnyString, AnyEntity } from '../typings';
3
3
  import type { Type, types } from '../types';
4
4
  import type { EntityManager } from '../EntityManager';
5
+ import type { SerializeOptions } from '../serialization/EntitySerializer';
5
6
  export declare function Property<T extends object>(options?: PropertyOptions<T>): (target: any, propertyName: string) => any;
6
7
  export interface PropertyOptions<Owner> {
7
8
  /**
@@ -188,7 +189,7 @@ export interface PropertyOptions<Owner> {
188
189
  *
189
190
  * @see https://mikro-orm.io/docs/serializing#property-serializers
190
191
  */
191
- serializer?: (value: any) => any;
192
+ serializer?: (value: any, options?: SerializeOptions<any>) => any;
192
193
  /**
193
194
  * Specify name of key for the serialized value.
194
195
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.3.13-dev.10",
3
+ "version": "6.3.13-dev.12",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.2.0",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.3.13-dev.10",
67
+ "mikro-orm": "6.3.13-dev.12",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
@@ -118,7 +118,7 @@ class EntitySerializer {
118
118
  if (entity[prop] instanceof Function) {
119
119
  const returnValue = entity[prop]();
120
120
  if (!options.ignoreSerializers && serializer) {
121
- return serializer(returnValue);
121
+ return serializer(returnValue, this.extractChildOptions(options, prop));
122
122
  }
123
123
  return returnValue;
124
124
  }
package/typings.d.ts CHANGED
@@ -366,7 +366,7 @@ export interface EntityProperty<Owner = any, Target = any> {
366
366
  referencedColumnNames: string[];
367
367
  referencedTableName: string;
368
368
  referencedPKs: EntityKey<Owner>[];
369
- serializer?: (value: any) => any;
369
+ serializer?: (value: any, options?: SerializeOptions<any>) => any;
370
370
  serializedName?: string;
371
371
  comment?: string;
372
372
  /** mysql only */