@mikro-orm/core 7.0.0-dev.63 → 7.0.0-dev.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MikroORM.js +1 -8
- package/entity/defineEntity.d.ts +2 -8
- package/enums.d.ts +2 -0
- package/index.d.ts +1 -2
- package/index.js +0 -1
- package/metadata/EntitySchema.d.ts +1 -9
- package/metadata/MetadataDiscovery.js +1 -4
- package/metadata/MetadataProvider.d.ts +2 -2
- package/metadata/MetadataProvider.js +15 -0
- package/metadata/index.d.ts +1 -1
- package/metadata/index.js +1 -1
- package/metadata/types.d.ts +480 -0
- package/metadata/types.js +1 -0
- package/package.json +2 -3
- package/typings.d.ts +2 -10
- package/utils/Configuration.d.ts +5 -11
- package/utils/Configuration.js +3 -5
- package/utils/ConfigurationLoader.d.ts +3 -30
- package/utils/ConfigurationLoader.js +25 -203
- package/utils/Utils.d.ts +0 -4
- package/utils/Utils.js +0 -8
- package/decorators/Check.d.ts +0 -3
- package/decorators/Check.js +0 -13
- package/decorators/CreateRequestContext.d.ts +0 -3
- package/decorators/CreateRequestContext.js +0 -32
- package/decorators/Embeddable.d.ts +0 -10
- package/decorators/Embeddable.js +0 -11
- package/decorators/Embedded.d.ts +0 -12
- package/decorators/Embedded.js +0 -18
- package/decorators/Entity.d.ts +0 -35
- package/decorators/Entity.js +0 -12
- package/decorators/Enum.d.ts +0 -9
- package/decorators/Enum.js +0 -16
- package/decorators/Filter.d.ts +0 -2
- package/decorators/Filter.js +0 -8
- package/decorators/Formula.d.ts +0 -4
- package/decorators/Formula.js +0 -15
- package/decorators/Indexed.d.ts +0 -19
- package/decorators/Indexed.js +0 -20
- package/decorators/ManyToMany.d.ts +0 -42
- package/decorators/ManyToMany.js +0 -14
- package/decorators/ManyToOne.d.ts +0 -34
- package/decorators/ManyToOne.js +0 -14
- package/decorators/OneToMany.d.ts +0 -28
- package/decorators/OneToMany.js +0 -17
- package/decorators/OneToOne.d.ts +0 -28
- package/decorators/OneToOne.js +0 -7
- package/decorators/PrimaryKey.d.ts +0 -8
- package/decorators/PrimaryKey.js +0 -20
- package/decorators/Property.d.ts +0 -294
- package/decorators/Property.js +0 -32
- package/decorators/Transactional.d.ts +0 -15
- package/decorators/Transactional.js +0 -31
- package/decorators/hooks.d.ts +0 -16
- package/decorators/hooks.js +0 -47
- package/decorators/index.d.ts +0 -17
- package/decorators/index.js +0 -17
- package/metadata/ReflectMetadataProvider.d.ts +0 -8
- package/metadata/ReflectMetadataProvider.js +0 -44
- package/utils/resolveContextProvider.d.ts +0 -10
- package/utils/resolveContextProvider.js +0 -28
package/decorators/Entity.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { AnyString, Constructor, Dictionary, EntityClass, ObjectQuery } from '../typings.js';
|
|
2
|
-
import type { FindOptions } from '../drivers/IDatabaseDriver.js';
|
|
3
|
-
export declare function Entity<T extends EntityClass<unknown>>(options?: EntityOptions<T>): (target: T) => void;
|
|
4
|
-
export type EntityOptions<T, E = T extends EntityClass<infer P> ? P : T> = {
|
|
5
|
-
/** Override default collection/table name. Alias for `collection`. */
|
|
6
|
-
tableName?: string;
|
|
7
|
-
/** Sets the schema name. */
|
|
8
|
-
schema?: string;
|
|
9
|
-
/** Override default collection/table name. Alias for `tableName`. */
|
|
10
|
-
collection?: string;
|
|
11
|
-
/** For {@doclink inheritance-mapping#single-table-inheritance | Single Table Inheritance}. */
|
|
12
|
-
discriminatorColumn?: (T extends EntityClass<infer P> ? keyof P : string) | AnyString;
|
|
13
|
-
/** For {@doclink inheritance-mapping#single-table-inheritance | Single Table Inheritance}. */
|
|
14
|
-
discriminatorMap?: Dictionary<string>;
|
|
15
|
-
/** For {@doclink inheritance-mapping#single-table-inheritance | Single Table Inheritance}. */
|
|
16
|
-
discriminatorValue?: number | string;
|
|
17
|
-
/** Enforce use of constructor when creating managed entity instances. */
|
|
18
|
-
forceConstructor?: boolean;
|
|
19
|
-
/** Specify constructor parameters to be used in `em.create` or when `forceConstructor` is enabled. Those should be names of declared entity properties in the same order as your constructor uses them. The ORM tries to infer those automatically, use this option in case the inference fails. */
|
|
20
|
-
constructorParams?: (T extends EntityClass<infer P> ? keyof P : string)[];
|
|
21
|
-
/** Specify comment to table. (SQL only) */
|
|
22
|
-
comment?: string;
|
|
23
|
-
/** Marks entity as abstract, such entities are inlined during discovery. */
|
|
24
|
-
abstract?: boolean;
|
|
25
|
-
/** Disables change tracking - such entities are ignored during flush. */
|
|
26
|
-
readonly?: boolean;
|
|
27
|
-
/** Marks entity as {@doclink virtual-entities | virtual}. This is set automatically when you use `expression` option. */
|
|
28
|
-
virtual?: boolean;
|
|
29
|
-
/** Used to make ORM aware of externally defined triggers. This is needed for MS SQL Server multi inserts, ignored in other dialects. */
|
|
30
|
-
hasTriggers?: boolean;
|
|
31
|
-
/** SQL query that maps to a {@doclink virtual-entities | virtual entity}. */
|
|
32
|
-
expression?: string | ((em: any, where: ObjectQuery<E>, options: FindOptions<E, any, any, any>, stream?: boolean) => object);
|
|
33
|
-
/** Set {@doclink repositories#custom-repository | custom repository class}. */
|
|
34
|
-
repository?: () => Constructor;
|
|
35
|
-
};
|
package/decorators/Entity.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
2
|
-
import { Utils } from '../utils/Utils.js';
|
|
3
|
-
export function Entity(options = {}) {
|
|
4
|
-
return function (target) {
|
|
5
|
-
const meta = MetadataStorage.getMetadataFromDecorator(target);
|
|
6
|
-
Utils.mergeConfig(meta, options);
|
|
7
|
-
meta.class = target;
|
|
8
|
-
if (!options.abstract || meta.discriminatorColumn) {
|
|
9
|
-
meta.name = target.name;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
}
|
package/decorators/Enum.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PropertyOptions } from './Property.js';
|
|
2
|
-
import type { AnyEntity, Dictionary } from '../typings.js';
|
|
3
|
-
export declare function Enum<T extends object>(options?: EnumOptions<AnyEntity> | (() => Dictionary)): (target: T, propertyName: string) => any;
|
|
4
|
-
export interface EnumOptions<T> extends PropertyOptions<T> {
|
|
5
|
-
items?: (number | string)[] | (() => Dictionary);
|
|
6
|
-
array?: boolean;
|
|
7
|
-
/** for postgres, by default it uses text column with check constraint */
|
|
8
|
-
nativeEnumName?: string;
|
|
9
|
-
}
|
package/decorators/Enum.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
2
|
-
import { ReferenceKind } from '../enums.js';
|
|
3
|
-
import { Utils } from '../utils/Utils.js';
|
|
4
|
-
export function Enum(options = {}) {
|
|
5
|
-
return function (target, propertyName) {
|
|
6
|
-
const meta = MetadataStorage.getMetadataFromDecorator(target.constructor);
|
|
7
|
-
options = options instanceof Function ? { items: options } : options;
|
|
8
|
-
meta.properties[propertyName] = {
|
|
9
|
-
name: propertyName,
|
|
10
|
-
kind: ReferenceKind.SCALAR,
|
|
11
|
-
enum: true,
|
|
12
|
-
...options,
|
|
13
|
-
};
|
|
14
|
-
return Utils.propertyDecoratorReturnValue();
|
|
15
|
-
};
|
|
16
|
-
}
|
package/decorators/Filter.d.ts
DELETED
package/decorators/Filter.js
DELETED
package/decorators/Formula.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { PropertyOptions } from './Property.js';
|
|
2
|
-
export declare function Formula<T extends object>(formula: string | ((alias: string) => string), options?: FormulaOptions<T>): (target: T, propertyName: string) => any;
|
|
3
|
-
export interface FormulaOptions<T> extends PropertyOptions<T> {
|
|
4
|
-
}
|
package/decorators/Formula.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
2
|
-
import { ReferenceKind } from '../enums.js';
|
|
3
|
-
import { Utils } from '../utils/Utils.js';
|
|
4
|
-
export function Formula(formula, options = {}) {
|
|
5
|
-
return function (target, propertyName) {
|
|
6
|
-
const meta = MetadataStorage.getMetadataFromDecorator(target.constructor);
|
|
7
|
-
meta.properties[propertyName] = {
|
|
8
|
-
name: propertyName,
|
|
9
|
-
kind: ReferenceKind.SCALAR,
|
|
10
|
-
formula,
|
|
11
|
-
...options,
|
|
12
|
-
};
|
|
13
|
-
return Utils.propertyDecoratorReturnValue();
|
|
14
|
-
};
|
|
15
|
-
}
|
package/decorators/Indexed.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { EntityClass, Dictionary, AutoPath, IndexCallback } from '../typings.js';
|
|
2
|
-
import type { DeferMode } from '../enums.js';
|
|
3
|
-
export declare function Index<T extends object, H extends string>(options?: IndexOptions<T, H>): (target: T, propertyName?: (T extends EntityClass<unknown> ? undefined : keyof T) | undefined) => any;
|
|
4
|
-
export declare function Unique<T extends object, H extends string>(options?: UniqueOptions<T, H>): (target: T, propertyName?: (T extends EntityClass<unknown> ? undefined : keyof T) | undefined) => any;
|
|
5
|
-
type MaybeArray<T> = T | T[];
|
|
6
|
-
type Properties<T, H extends string> = MaybeArray<AutoPath<T, H>>;
|
|
7
|
-
interface BaseOptions<T, H extends string> {
|
|
8
|
-
name?: string;
|
|
9
|
-
properties?: (T extends EntityClass<infer P> ? Properties<P, H> : Properties<T, H>);
|
|
10
|
-
options?: Dictionary;
|
|
11
|
-
expression?: string | (T extends EntityClass<infer P> ? IndexCallback<P> : IndexCallback<T>);
|
|
12
|
-
}
|
|
13
|
-
export interface UniqueOptions<T, H extends string = string> extends BaseOptions<T, H> {
|
|
14
|
-
deferMode?: DeferMode | `${DeferMode}`;
|
|
15
|
-
}
|
|
16
|
-
export interface IndexOptions<T, H extends string = string> extends BaseOptions<T, H> {
|
|
17
|
-
type?: string;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
package/decorators/Indexed.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
2
|
-
import { Utils } from '../utils/Utils.js';
|
|
3
|
-
function createDecorator(options, unique) {
|
|
4
|
-
return function (target, propertyName) {
|
|
5
|
-
const meta = MetadataStorage.getMetadataFromDecorator(propertyName ? target.constructor : target);
|
|
6
|
-
options.properties ??= propertyName;
|
|
7
|
-
const key = unique ? 'uniques' : 'indexes';
|
|
8
|
-
meta[key].push(options);
|
|
9
|
-
if (!propertyName) {
|
|
10
|
-
return target;
|
|
11
|
-
}
|
|
12
|
-
return Utils.propertyDecoratorReturnValue();
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export function Index(options = {}) {
|
|
16
|
-
return createDecorator(options, false);
|
|
17
|
-
}
|
|
18
|
-
export function Unique(options = {}) {
|
|
19
|
-
return createDecorator(options, true);
|
|
20
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ReferenceOptions } from './Property.js';
|
|
2
|
-
import type { EntityName, FilterQuery, AnyString } from '../typings.js';
|
|
3
|
-
import { type QueryOrderMap } from '../enums.js';
|
|
4
|
-
export declare function ManyToMany<Target extends object, Owner extends object>(entity?: ManyToManyOptions<Owner, Target> | string | (() => EntityName<Target>), mappedBy?: (string & keyof Target) | ((e: Target) => any), options?: Partial<ManyToManyOptions<Owner, Target>>): (target: Owner, propertyName: keyof Owner) => any;
|
|
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. */
|
|
7
|
-
owner?: boolean;
|
|
8
|
-
/** Point to the inverse side property name. */
|
|
9
|
-
inversedBy?: (string & keyof Target) | ((e: Target) => any);
|
|
10
|
-
/** Point to the owning side property name. */
|
|
11
|
-
mappedBy?: (string & keyof Target) | ((e: Target) => any);
|
|
12
|
-
/** Condition for {@doclink collections#declarative-partial-loading | Declarative partial loading}. */
|
|
13
|
-
where?: FilterQuery<Target>;
|
|
14
|
-
/** Set default ordering. */
|
|
15
|
-
orderBy?: QueryOrderMap<Target> | QueryOrderMap<Target>[];
|
|
16
|
-
/** Force stable insertion order of items in the collection (see {@doclink collections | Collections}). */
|
|
17
|
-
fixedOrder?: boolean;
|
|
18
|
-
/** Override default order column name (`id`) for fixed ordering. */
|
|
19
|
-
fixedOrderColumn?: string;
|
|
20
|
-
/** Override default name for pivot table (see {@doclink naming-strategy | Naming Strategy}). */
|
|
21
|
-
pivotTable?: string;
|
|
22
|
-
/** Set pivot entity for this relation (see {@doclink collections#custom-pivot-table-entity | Custom pivot table entity}). */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
35
|
-
referencedColumnNames?: string[];
|
|
36
|
-
/** What to do when the target entity gets deleted. */
|
|
37
|
-
deleteRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
|
|
38
|
-
/** What to do when the reference to the target entity gets updated. */
|
|
39
|
-
updateRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
|
|
40
|
-
/** Enable/disable foreign key constraint creation on this relation */
|
|
41
|
-
createForeignKeyConstraint?: boolean;
|
|
42
|
-
}
|
package/decorators/ManyToMany.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
2
|
-
import { MetadataValidator } from '../metadata/MetadataValidator.js';
|
|
3
|
-
import { Utils } from '../utils/Utils.js';
|
|
4
|
-
import { ReferenceKind } from '../enums.js';
|
|
5
|
-
export function ManyToMany(entity, mappedBy, options = {}) {
|
|
6
|
-
return function (target, propertyName) {
|
|
7
|
-
options = Utils.processDecoratorParameters({ entity, mappedBy, options });
|
|
8
|
-
const meta = MetadataStorage.getMetadataFromDecorator(target.constructor);
|
|
9
|
-
MetadataValidator.validateSingleDecorator(meta, propertyName, ReferenceKind.MANY_TO_MANY);
|
|
10
|
-
const property = { name: propertyName, kind: ReferenceKind.MANY_TO_MANY };
|
|
11
|
-
meta.properties[propertyName] = Object.assign(meta.properties[propertyName] ?? {}, property, options);
|
|
12
|
-
return Utils.propertyDecoratorReturnValue();
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ReferenceOptions } from './Property.js';
|
|
2
|
-
import { type DeferMode } from '../enums.js';
|
|
3
|
-
import type { AnyString, EntityName } from '../typings.js';
|
|
4
|
-
export declare function ManyToOne<Target extends object, Owner extends object>(entity?: ManyToOneOptions<Owner, Target> | string | ((e?: any) => EntityName<Target>), options?: Partial<ManyToOneOptions<Owner, Target>>): (target: Owner, propertyName: keyof Owner) => any;
|
|
5
|
-
export interface ManyToOneOptions<Owner, Target> extends ReferenceOptions<Owner, Target> {
|
|
6
|
-
/** Point to the inverse side property name. */
|
|
7
|
-
inversedBy?: (string & keyof Target) | ((e: Target) => any);
|
|
8
|
-
/** Wrap the entity in {@apilink Reference} wrapper. */
|
|
9
|
-
ref?: boolean;
|
|
10
|
-
/** Use this relation as a primary key. */
|
|
11
|
-
primary?: boolean;
|
|
12
|
-
/** Map this relation to the primary key value instead of an entity. */
|
|
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. */
|
|
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. */
|
|
17
|
-
joinColumns?: string[];
|
|
18
|
-
/** When a part of a composite column is shared in other properties, use this option to specify what columns are considered as owned by this property. This is useful when your composite property is nullable, but parts of it are not. */
|
|
19
|
-
ownColumns?: string[];
|
|
20
|
-
/** 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. */
|
|
21
|
-
referenceColumnName?: string;
|
|
22
|
-
/** 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. */
|
|
23
|
-
referencedColumnNames?: string[];
|
|
24
|
-
/** What to do when the target entity gets deleted. */
|
|
25
|
-
deleteRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
|
|
26
|
-
/** What to do when the reference to the target entity gets updated. */
|
|
27
|
-
updateRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
|
|
28
|
-
/** 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. */
|
|
29
|
-
deferMode?: DeferMode | `${DeferMode}`;
|
|
30
|
-
/** Enable/disable foreign key constraint creation on this relation */
|
|
31
|
-
createForeignKeyConstraint?: boolean;
|
|
32
|
-
/** Set a custom foreign key constraint name, overriding NamingStrategy.indexName(). */
|
|
33
|
-
foreignKeyName?: string;
|
|
34
|
-
}
|
package/decorators/ManyToOne.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
2
|
-
import { MetadataValidator } from '../metadata/MetadataValidator.js';
|
|
3
|
-
import { Utils } from '../utils/Utils.js';
|
|
4
|
-
import { ReferenceKind } from '../enums.js';
|
|
5
|
-
export function ManyToOne(entity = {}, options = {}) {
|
|
6
|
-
return function (target, propertyName) {
|
|
7
|
-
options = Utils.processDecoratorParameters({ entity, options });
|
|
8
|
-
const meta = MetadataStorage.getMetadataFromDecorator(target.constructor);
|
|
9
|
-
MetadataValidator.validateSingleDecorator(meta, propertyName, ReferenceKind.MANY_TO_ONE);
|
|
10
|
-
const property = { name: propertyName, kind: ReferenceKind.MANY_TO_ONE };
|
|
11
|
-
meta.properties[propertyName] = Object.assign(meta.properties[propertyName] ?? {}, property, options);
|
|
12
|
-
return Utils.propertyDecoratorReturnValue();
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ReferenceOptions } from './Property.js';
|
|
2
|
-
import { ReferenceKind, type QueryOrderMap } from '../enums.js';
|
|
3
|
-
import type { EntityName, FilterQuery } from '../typings.js';
|
|
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: Owner, propertyName: string) => any;
|
|
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: Owner, propertyName: string) => void;
|
|
6
|
-
export declare function OneToMany<Target, Owner>(options: OneToManyOptions<Owner, Target>): (target: Owner, propertyName: string) => void;
|
|
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
|
-
orphanRemoval?: boolean;
|
|
10
|
-
/** Set default ordering. */
|
|
11
|
-
orderBy?: QueryOrderMap<Target> | QueryOrderMap<Target>[];
|
|
12
|
-
/** Condition for {@doclink collections#declarative-partial-loading | Declarative partial loading}. */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
27
|
-
mappedBy: (string & keyof Target) | ((e: Target) => any);
|
|
28
|
-
}
|
package/decorators/OneToMany.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
2
|
-
import { MetadataValidator } from '../metadata/MetadataValidator.js';
|
|
3
|
-
import { Utils } from '../utils/Utils.js';
|
|
4
|
-
import { ReferenceKind } from '../enums.js';
|
|
5
|
-
export function createOneToDecorator(entity, mappedBy, options, kind) {
|
|
6
|
-
return function (target, propertyName) {
|
|
7
|
-
options = Utils.processDecoratorParameters({ entity, mappedBy, options });
|
|
8
|
-
const meta = MetadataStorage.getMetadataFromDecorator(target.constructor);
|
|
9
|
-
MetadataValidator.validateSingleDecorator(meta, propertyName, kind);
|
|
10
|
-
const property = { name: propertyName, kind };
|
|
11
|
-
meta.properties[propertyName] = Object.assign(meta.properties[propertyName] ?? {}, property, options);
|
|
12
|
-
return Utils.propertyDecoratorReturnValue();
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export function OneToMany(entity, mappedBy, options = {}) {
|
|
16
|
-
return createOneToDecorator(entity, mappedBy, options, ReferenceKind.ONE_TO_MANY);
|
|
17
|
-
}
|
package/decorators/OneToOne.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type DeferMode } from '../enums.js';
|
|
2
|
-
import { type OneToManyOptions } from './OneToMany.js';
|
|
3
|
-
import type { AnyString, EntityName } from '../typings.js';
|
|
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: Owner, propertyName: string) => any;
|
|
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. */
|
|
7
|
-
owner?: boolean;
|
|
8
|
-
/** Point to the inverse side property name. */
|
|
9
|
-
inversedBy?: (string & keyof Target) | ((e: Target) => any);
|
|
10
|
-
/** Wrap the entity in {@apilink Reference} wrapper. */
|
|
11
|
-
ref?: boolean;
|
|
12
|
-
/** Use this relation as a primary key. */
|
|
13
|
-
primary?: boolean;
|
|
14
|
-
/** Map this relation to the primary key value instead of an entity. */
|
|
15
|
-
mapToPk?: boolean;
|
|
16
|
-
/** When a part of a composite column is shared in other properties, use this option to specify what columns are considered as owned by this property. This is useful when your composite property is nullable, but parts of it are not. */
|
|
17
|
-
ownColumns?: string[];
|
|
18
|
-
/** What to do when the target entity gets deleted. */
|
|
19
|
-
deleteRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
|
|
20
|
-
/** What to do when the reference to the target entity gets updated. */
|
|
21
|
-
updateRule?: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString;
|
|
22
|
-
/** 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. */
|
|
23
|
-
deferMode?: DeferMode | `${DeferMode}`;
|
|
24
|
-
/** Set a custom foreign key constraint name, overriding NamingStrategy.indexName(). */
|
|
25
|
-
foreignKeyName?: string;
|
|
26
|
-
/** Enable/disable foreign key constraint creation on this relation */
|
|
27
|
-
createForeignKeyConstraint?: boolean;
|
|
28
|
-
}
|
package/decorators/OneToOne.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ReferenceKind } from '../enums.js';
|
|
2
|
-
import { createOneToDecorator } from './OneToMany.js';
|
|
3
|
-
export function OneToOne(entity, mappedByOrOptions, options = {}) {
|
|
4
|
-
const mappedBy = typeof mappedByOrOptions === 'object' ? mappedByOrOptions.mappedBy : mappedByOrOptions;
|
|
5
|
-
options = typeof mappedByOrOptions === 'object' ? { ...mappedByOrOptions, ...options } : options;
|
|
6
|
-
return createOneToDecorator(entity, mappedBy, options, ReferenceKind.ONE_TO_ONE);
|
|
7
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { PropertyOptions } from './Property.js';
|
|
2
|
-
export declare function PrimaryKey<T extends object>(options?: PrimaryKeyOptions<T>): (target: T, propertyName: string) => any;
|
|
3
|
-
export declare function SerializedPrimaryKey<T extends object>(options?: SerializedPrimaryKeyOptions<T>): (target: T, propertyName: string) => any;
|
|
4
|
-
export interface PrimaryKeyOptions<T> extends PropertyOptions<T> {
|
|
5
|
-
}
|
|
6
|
-
export interface SerializedPrimaryKeyOptions<T> extends PropertyOptions<T> {
|
|
7
|
-
type?: any;
|
|
8
|
-
}
|
package/decorators/PrimaryKey.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
2
|
-
import { MetadataValidator } from '../metadata/MetadataValidator.js';
|
|
3
|
-
import { ReferenceKind } from '../enums.js';
|
|
4
|
-
import { Utils } from '../utils/Utils.js';
|
|
5
|
-
function createDecorator(options, serialized) {
|
|
6
|
-
return function (target, propertyName) {
|
|
7
|
-
const meta = MetadataStorage.getMetadataFromDecorator(target.constructor);
|
|
8
|
-
MetadataValidator.validateSingleDecorator(meta, propertyName, ReferenceKind.SCALAR);
|
|
9
|
-
const k = serialized ? 'serializedPrimaryKey' : 'primary';
|
|
10
|
-
options[k] = true;
|
|
11
|
-
meta.properties[propertyName] = { name: propertyName, kind: ReferenceKind.SCALAR, ...options };
|
|
12
|
-
return Utils.propertyDecoratorReturnValue();
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export function PrimaryKey(options = {}) {
|
|
16
|
-
return createDecorator(options, false);
|
|
17
|
-
}
|
|
18
|
-
export function SerializedPrimaryKey(options = {}) {
|
|
19
|
-
return createDecorator(options, true);
|
|
20
|
-
}
|