@mikro-orm/core 6.3.8-dev.0 → 6.3.8-dev.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,21 +3,38 @@ import type { EntityName, AnyEntity, FilterQuery, AnyString } from '../typings';
3
3
  import { type QueryOrderMap } from '../enums';
4
4
  export declare function ManyToMany<T extends object, O>(entity?: ManyToManyOptions<T, O> | string | (() => EntityName<T>), mappedBy?: (string & keyof T) | ((e: T) => any), options?: Partial<ManyToManyOptions<T, O>>): (target: AnyEntity, propertyName: string) => any;
5
5
  export interface ManyToManyOptions<Owner, Target> extends ReferenceOptions<Owner, Target> {
6
+ /** Set this side as owning. Owning side is where the foreign key is defined. This option is not required if you use `inversedBy` or `mappedBy` to distinguish owning and inverse side. */
6
7
  owner?: boolean;
8
+ /** Point to the inverse side property name. */
7
9
  inversedBy?: (string & keyof Target) | ((e: Target) => any);
10
+ /** Point to the owning side property name. */
8
11
  mappedBy?: (string & keyof Target) | ((e: Target) => any);
12
+ /** Condition for {@doclink collections#declarative-partial-loading | Declarative partial loading}. */
9
13
  where?: FilterQuery<Target>;
14
+ /** Set default ordering. */
10
15
  orderBy?: QueryOrderMap<Target> | QueryOrderMap<Target>[];
16
+ /** Force stable insertion order of items in the collection (see {@doclink collections | Collections}). */
11
17
  fixedOrder?: boolean;
18
+ /** Override default order column name (`id`) for fixed ordering. */
12
19
  fixedOrderColumn?: string;
20
+ /** Override default name for pivot table (see {@doclink naming-strategy | Naming Strategy}). */
13
21
  pivotTable?: string;
22
+ /** Set pivot entity for this relation (see {@doclink collections#custom-pivot-table-entity | Custom pivot table entity}). */
14
23
  pivotEntity?: string | (() => EntityName<any>);
24
+ /** Override the default database column name on the owning side (see {@doclink naming-strategy | Naming Strategy}). This option is only for simple properties represented by a single column. */
15
25
  joinColumn?: string;
26
+ /** Override the default database column name on the owning side (see {@doclink naming-strategy | Naming Strategy}). This option is suitable for composite keys, where one property is represented by multiple columns. */
16
27
  joinColumns?: string[];
28
+ /** Override the default database column name on the inverse side (see {@doclink naming-strategy | Naming Strategy}). This option is only for simple properties represented by a single column. */
17
29
  inverseJoinColumn?: string;
30
+ /** Override the default database column name on the inverse side (see {@doclink naming-strategy | Naming Strategy}). This option is suitable for composite keys, where one property is represented by multiple columns. */
18
31
  inverseJoinColumns?: string[];
32
+ /** Override the default database column name on the target entity (see {@doclink naming-strategy | Naming Strategy}). This option is only for simple properties represented by a single column. */
19
33
  referenceColumnName?: string;
34
+ /** Override the default database column name on the target entity (see {@doclink naming-strategy | Naming Strategy}). This option is suitable for composite keys, where one property is represented by multiple columns. */
20
35
  referencedColumnNames?: string[];
36
+ /** What to do when the target entity gets deleted. */
21
37
  deleteRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
38
+ /** What to do when the reference to the target entity gets updated. */
22
39
  updateRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
23
40
  }
@@ -3,15 +3,26 @@ import { type DeferMode } from '../enums';
3
3
  import type { AnyEntity, AnyString, EntityName } from '../typings';
4
4
  export declare function ManyToOne<T extends object, O>(entity?: ManyToOneOptions<T, O> | string | ((e?: any) => EntityName<T>), options?: Partial<ManyToOneOptions<T, O>>): (target: AnyEntity, propertyName: string) => any;
5
5
  export interface ManyToOneOptions<Owner, Target> extends ReferenceOptions<Owner, Target> {
6
+ /** Point to the inverse side property name. */
6
7
  inversedBy?: (string & keyof Target) | ((e: Target) => any);
8
+ /** Wrap the entity in {@apilink Reference} wrapper. */
7
9
  ref?: boolean;
10
+ /** Use this relation as a primary key. */
8
11
  primary?: boolean;
12
+ /** Map this relation to the primary key value instead of an entity. */
9
13
  mapToPk?: boolean;
14
+ /** Override the default database column name on the owning side (see {@doclink naming-strategy | Naming Strategy}). This option is only for simple properties represented by a single column. */
10
15
  joinColumn?: string;
16
+ /** Override the default database column name on the owning side (see {@doclink naming-strategy | Naming Strategy}). This option is suitable for composite keys, where one property is represented by multiple columns. */
11
17
  joinColumns?: string[];
18
+ /** Override the default database column name on the target entity (see {@doclink naming-strategy | Naming Strategy}). This option is only for simple properties represented by a single column. */
12
19
  referenceColumnName?: string;
20
+ /** Override the default database column name on the target entity (see {@doclink naming-strategy | Naming Strategy}). This option is suitable for composite keys, where one property is represented by multiple columns. */
13
21
  referencedColumnNames?: string[];
22
+ /** What to do when the target entity gets deleted. */
14
23
  deleteRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
24
+ /** What to do when the reference to the target entity gets updated. */
15
25
  updateRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
26
+ /** Set the constraint type. Immediate constraints are checked for each statement, while deferred ones are only checked at the end of the transaction. Only for postgres unique constraints. */
16
27
  deferMode?: DeferMode | `${DeferMode}`;
17
28
  }
@@ -4,15 +4,25 @@ import type { EntityName, AnyEntity, FilterQuery } from '../typings';
4
4
  export declare function createOneToDecorator<Target, Owner>(entity: OneToManyOptions<Owner, Target> | string | ((e?: any) => EntityName<Target>), mappedBy: (string & keyof Target) | ((e: Target) => any) | undefined, options: Partial<OneToManyOptions<Owner, Target>>, kind: ReferenceKind): (target: AnyEntity, propertyName: string) => any;
5
5
  export declare function OneToMany<Target, Owner>(entity: string | ((e?: any) => EntityName<Target>), mappedBy: (string & keyof Target) | ((e: Target) => any), options?: Partial<OneToManyOptions<Owner, Target>>): (target: AnyEntity, propertyName: string) => void;
6
6
  export declare function OneToMany<Target, Owner>(options: OneToManyOptions<Owner, Target>): (target: AnyEntity, propertyName: string) => void;
7
- export type OneToManyOptions<Owner, Target> = ReferenceOptions<Owner, Target> & {
8
- entity?: string | (() => EntityName<Target>);
7
+ export interface OneToManyOptions<Owner, Target> extends ReferenceOptions<Owner, Target> {
8
+ /** Remove the entity when it gets disconnected from the relationship (see {@doclink cascading | Cascading}). */
9
9
  orphanRemoval?: boolean;
10
+ /** Set default ordering. */
10
11
  orderBy?: QueryOrderMap<Target> | QueryOrderMap<Target>[];
12
+ /** Condition for {@doclink collections#declarative-partial-loading | Declarative partial loading}. */
11
13
  where?: FilterQuery<Target>;
14
+ /** Override the default database column name on the owning side (see {@doclink naming-strategy | Naming Strategy}). This option is only for simple properties represented by a single column. */
12
15
  joinColumn?: string;
16
+ /** Override the default database column name on the owning side (see {@doclink naming-strategy | Naming Strategy}). This option is suitable for composite keys, where one property is represented by multiple columns. */
13
17
  joinColumns?: string[];
18
+ /** Override the default database column name on the inverse side (see {@doclink naming-strategy | Naming Strategy}). This option is only for simple properties represented by a single column. */
14
19
  inverseJoinColumn?: string;
20
+ /** Override the default database column name on the inverse side (see {@doclink naming-strategy | Naming Strategy}). This option is suitable for composite keys, where one property is represented by multiple columns. */
15
21
  inverseJoinColumns?: string[];
22
+ /** Override the default database column name on the target entity (see {@doclink naming-strategy | Naming Strategy}). This option is only for simple properties represented by a single column. */
16
23
  referenceColumnName?: string;
24
+ /** Override the default database column name on the target entity (see {@doclink naming-strategy | Naming Strategy}). This option is suitable for composite keys, where one property is represented by multiple columns. */
25
+ referencedColumnNames?: string[];
26
+ /** Point to the owning side property name. */
17
27
  mappedBy: (string & keyof Target) | ((e: Target) => any);
18
- };
28
+ }
@@ -3,12 +3,20 @@ import { type OneToManyOptions } from './OneToMany';
3
3
  import type { AnyString, EntityName } from '../typings';
4
4
  export declare function OneToOne<Target, Owner>(entity?: OneToOneOptions<Owner, Target> | string | ((e: Owner) => EntityName<Target>), mappedByOrOptions?: (string & keyof Target) | ((e: Target) => any) | Partial<OneToOneOptions<Owner, Target>>, options?: Partial<OneToOneOptions<Owner, Target>>): (target: import("../typings").AnyEntity, propertyName: string) => any;
5
5
  export interface OneToOneOptions<Owner, Target> extends Partial<Omit<OneToManyOptions<Owner, Target>, 'orderBy'>> {
6
+ /** Set this side as owning. Owning side is where the foreign key is defined. This option is not required if you use `inversedBy` or `mappedBy` to distinguish owning and inverse side. */
6
7
  owner?: boolean;
8
+ /** Point to the inverse side property name. */
7
9
  inversedBy?: (string & keyof Target) | ((e: Target) => any);
10
+ /** Wrap the entity in {@apilink Reference} wrapper. */
8
11
  ref?: boolean;
12
+ /** Use this relation as a primary key. */
9
13
  primary?: boolean;
14
+ /** Map this relation to the primary key value instead of an entity. */
10
15
  mapToPk?: boolean;
16
+ /** What to do when the target entity gets deleted. */
11
17
  deleteRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
18
+ /** What to do when the reference to the target entity gets updated. */
12
19
  updateRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
20
+ /** Set the constraint type. Immediate constraints are checked for each statement, while deferred ones are only checked at the end of the transaction. Only for postgres unique constraints. */
13
21
  deferMode?: DeferMode | `${DeferMode}`;
14
22
  }
@@ -3,7 +3,7 @@ import type { EntityName, Constructor, CheckCallback, GeneratedColumnCallback, A
3
3
  import type { Type, types } from '../types';
4
4
  import type { EntityManager } from '../EntityManager';
5
5
  export declare function Property<T extends object>(options?: PropertyOptions<T>): (target: any, propertyName: string) => any;
6
- export type PropertyOptions<Owner> = {
6
+ export interface PropertyOptions<Owner> {
7
7
  /**
8
8
  * Alias for `fieldName`.
9
9
  */
@@ -214,12 +214,16 @@ export type PropertyOptions<Owner> = {
214
214
  * @see https://mikro-orm.io/docs/defining-entities#sql-generated-columns
215
215
  */
216
216
  ignoreSchemaChanges?: ('type' | 'extra' | 'default')[];
217
- };
217
+ }
218
218
  export interface ReferenceOptions<Owner, Target> extends PropertyOptions<Owner> {
219
+ /** Set target entity type. */
219
220
  entity?: string | (() => EntityName<Target>);
221
+ /** Set what actions on owning entity should be cascaded to the relationship. Defaults to [Cascade.PERSIST, Cascade.MERGE] (see {@doclink cascading}). */
220
222
  cascade?: Cascade[];
223
+ /** Always load the relationship. Discouraged for use with to-many relations for performance reasons. */
221
224
  eager?: boolean;
222
- strategy?: LoadStrategy;
225
+ /** Override the default loading strategy for this property. This option has precedence over the global `loadStrategy`, but can be overridden by `FindOptions.strategy`. */
226
+ strategy?: LoadStrategy | `${LoadStrategy}`;
223
227
  }
224
228
  /**
225
229
  * Inspired by https://github.com/typeorm/typeorm/blob/941b584ba135617e55d6685caef671172ec1dc03/src/driver/types/ColumnTypes.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.3.8-dev.0",
3
+ "version": "6.3.8-dev.1",
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.8-dev.0",
67
+ "mikro-orm": "6.3.8-dev.1",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }