@mikro-orm/core 7.0.0-rc.1 → 7.0.0-rc.2
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/EntityManager.d.ts +1 -1
- package/EntityManager.js +1 -1
- package/drivers/IDatabaseDriver.d.ts +6 -1
- package/entity/BaseEntity.d.ts +3 -3
- package/entity/EntityFactory.js +5 -2
- package/entity/EntityHelper.js +2 -2
- package/entity/EntityLoader.d.ts +6 -6
- package/entity/EntityRepository.d.ts +1 -1
- package/entity/WrappedEntity.d.ts +3 -3
- package/entity/defineEntity.d.ts +179 -47
- package/entity/defineEntity.js +20 -24
- package/index.d.ts +2 -2
- package/index.js +1 -1
- package/metadata/EntitySchema.d.ts +1 -1
- package/metadata/MetadataDiscovery.js +1 -1
- package/package.json +5 -2
- package/platforms/Platform.d.ts +3 -1
- package/platforms/Platform.js +1 -1
- package/serialization/EntitySerializer.d.ts +3 -3
- package/serialization/EntityTransformer.js +6 -4
- package/typings.d.ts +54 -14
- package/typings.js +2 -0
- package/unit-of-work/ChangeSetPersister.js +2 -2
- package/utils/AbstractMigrator.d.ts +101 -0
- package/utils/AbstractMigrator.js +305 -0
- package/utils/Configuration.d.ts +3 -1
- package/utils/Utils.js +1 -1
- package/utils/fs-utils.d.ts +1 -0
- package/utils/fs-utils.js +4 -0
- package/utils/index.d.ts +0 -2
- package/utils/index.js +0 -2
package/EntityManager.d.ts
CHANGED
|
@@ -456,7 +456,7 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
|
|
|
456
456
|
/**
|
|
457
457
|
* Loads specified relations in batch. This will execute one query for each relation, that will populate it on all the specified entities.
|
|
458
458
|
*/
|
|
459
|
-
populate<Entity extends object, Naked extends FromEntityType<UnboxArray<Entity>> = FromEntityType<UnboxArray<Entity>>, Hint extends string = never, Fields extends string =
|
|
459
|
+
populate<Entity extends object, Naked extends FromEntityType<UnboxArray<Entity>> = FromEntityType<UnboxArray<Entity>>, Hint extends string = never, Fields extends string = never, Excludes extends string = never>(entities: Entity, populate: readonly AutoPath<Naked, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Naked, Fields, Excludes>): Promise<Entity extends object[] ? MergeLoaded<ArrayElement<Entity>, Naked, Hint, Fields, Excludes>[] : MergeLoaded<Entity, Naked, Hint, Fields, Excludes>>;
|
|
460
460
|
/**
|
|
461
461
|
* Returns new EntityManager instance with its own identity map
|
|
462
462
|
*/
|
package/EntityManager.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getOnConflictReturningFields, getWhereCondition } from './utils/upsert-utils.js';
|
|
2
2
|
import { Utils } from './utils/Utils.js';
|
|
3
3
|
import { Cursor } from './utils/Cursor.js';
|
|
4
|
-
import { DataloaderUtils } from './utils/DataloaderUtils.js';
|
|
5
4
|
import { QueryHelper } from './utils/QueryHelper.js';
|
|
6
5
|
import { TransactionContext } from './utils/TransactionContext.js';
|
|
7
6
|
import { isRaw, Raw } from './utils/RawQueryFragment.js';
|
|
@@ -1816,6 +1815,7 @@ export class EntityManager {
|
|
|
1816
1815
|
if (em.loaders[type]) {
|
|
1817
1816
|
return em.loaders[type];
|
|
1818
1817
|
}
|
|
1818
|
+
const { DataloaderUtils } = await import('@mikro-orm/core/dataloader');
|
|
1819
1819
|
const DataLoader = await DataloaderUtils.getDataLoader();
|
|
1820
1820
|
switch (type) {
|
|
1821
1821
|
case 'ref': return (em.loaders[type] ??= new DataLoader(DataloaderUtils.getRefBatchLoadFn(em)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConnectionType, EntityData, EntityMetadata, EntityProperty, FilterQuery, Primary, Dictionary, IPrimaryKey, PopulateOptions, EntityDictionary, AutoPath, ObjectQuery, FilterObject, Populate, EntityName, PopulateHintOptions, Prefixes } from '../typings.js';
|
|
1
|
+
import type { ConnectionType, Constructor, EntityData, EntityMetadata, EntityProperty, FilterQuery, Primary, Dictionary, IPrimaryKey, PopulateOptions, EntityDictionary, AutoPath, ObjectQuery, FilterObject, Populate, EntityName, PopulateHintOptions, Prefixes } from '../typings.js';
|
|
2
2
|
import type { Connection, QueryResult, Transaction } from '../connections/Connection.js';
|
|
3
3
|
import type { FlushMode, LockMode, QueryOrderMap, QueryFlag, LoadStrategy, PopulateHint, PopulatePath } from '../enums.js';
|
|
4
4
|
import type { Platform } from '../platforms/Platform.js';
|
|
@@ -7,6 +7,7 @@ import type { Collection } from '../entity/Collection.js';
|
|
|
7
7
|
import type { EntityManager } from '../EntityManager.js';
|
|
8
8
|
import type { DriverException } from '../exceptions.js';
|
|
9
9
|
import type { Configuration } from '../utils/Configuration.js';
|
|
10
|
+
import type { MikroORM } from '../MikroORM.js';
|
|
10
11
|
import type { LoggingOptions, LogContext } from '../logging/Logger.js';
|
|
11
12
|
import type { Raw } from '../utils/RawQueryFragment.js';
|
|
12
13
|
export declare const EntityManagerType: unique symbol;
|
|
@@ -65,6 +66,10 @@ export interface IDatabaseDriver<C extends Connection = Connection> {
|
|
|
65
66
|
schema?: string;
|
|
66
67
|
parentSchema?: string;
|
|
67
68
|
}): string | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
getORMClass(): Constructor<MikroORM>;
|
|
68
73
|
}
|
|
69
74
|
export type EntityField<T, P extends string = PopulatePath.ALL> = keyof T | PopulatePath.ALL | AutoPath<T, P, `${PopulatePath.ALL}`>;
|
|
70
75
|
export type OrderDefinition<T> = (QueryOrderMap<T> & {
|
package/entity/BaseEntity.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Ref } from './Reference.js';
|
|
2
|
-
import type { AutoPath, EntityData, EntityDTO, Loaded, LoadedReference, AddEager, EntityKey, FromEntityType, IsSubset, MergeSelected } from '../typings.js';
|
|
2
|
+
import type { AutoPath, EntityData, EntityDTO, Loaded, LoadedReference, AddEager, EntityKey, FromEntityType, IsSubset, MergeSelected, SerializeDTO } from '../typings.js';
|
|
3
3
|
import { type AssignOptions } from './EntityAssigner.js';
|
|
4
4
|
import type { EntityLoaderOptions } from './EntityLoader.js';
|
|
5
5
|
import { type SerializeOptions } from '../serialization/EntitySerializer.js';
|
|
@@ -8,7 +8,7 @@ import type { PopulatePath } from '../enums.js';
|
|
|
8
8
|
export declare abstract class BaseEntity {
|
|
9
9
|
isInitialized(): boolean;
|
|
10
10
|
populated(populated?: boolean): void;
|
|
11
|
-
populate<Entity extends this = this, Hint extends string = never>(populate: AutoPath<Entity, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Entity>): Promise<Loaded<Entity, Hint>>;
|
|
11
|
+
populate<Entity extends this = this, Hint extends string = never, Fields extends string = never>(populate: AutoPath<Entity, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Entity, Fields>): Promise<Loaded<Entity, Hint>>;
|
|
12
12
|
toReference<Entity extends this = this>(): Ref<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>;
|
|
13
13
|
/**
|
|
14
14
|
* Converts the entity to a plain object representation.
|
|
@@ -73,7 +73,7 @@ export declare abstract class BaseEntity {
|
|
|
73
73
|
*/
|
|
74
74
|
toObject<Entity extends this = this, Ignored extends EntityKey<Entity> = never>(ignoreFields: Ignored[]): Omit<EntityDTO<Entity>, Ignored>;
|
|
75
75
|
toPOJO<Entity extends this = this>(): EntityDTO<Entity>;
|
|
76
|
-
serialize<Entity extends this = this, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Hint extends string = never, Exclude extends string = never>(options?: SerializeOptions<Naked, Hint, Exclude>):
|
|
76
|
+
serialize<Entity extends this = this, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Hint extends string = never, Exclude extends string = never>(options?: SerializeOptions<Naked, Hint, Exclude>): SerializeDTO<Naked, Hint, Exclude>;
|
|
77
77
|
assign<Entity extends this, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Convert extends boolean = false, Data extends EntityData<Naked, Convert> | Partial<EntityDTO<Naked>> = EntityData<Naked, Convert> | Partial<EntityDTO<Naked>>>(data: Data & IsSubset<EntityData<Naked>, Data>, options?: AssignOptions<Convert>): MergeSelected<Entity, Naked, keyof Data & string>;
|
|
78
78
|
init<Entity extends this = this, Hint extends string = never, Fields extends string = '*', Excludes extends string = never>(options?: FindOneOptions<Entity, Hint, Fields, Excludes>): Promise<Loaded<Entity, Hint, Fields, Excludes> | null>;
|
|
79
79
|
getSchema(): string | undefined;
|
package/entity/EntityFactory.js
CHANGED
|
@@ -129,7 +129,10 @@ export class EntityFactory {
|
|
|
129
129
|
.filter(key => meta.properties[key]?.formula || [ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(meta.properties[key]?.kind))
|
|
130
130
|
.forEach(key => diff2[key] = data[key]);
|
|
131
131
|
// rehydrated with the new values, skip those changed by user
|
|
132
|
-
|
|
132
|
+
// use full hydration if the entity is already initialized, even if the caller used `initialized: false`
|
|
133
|
+
// (e.g. from createReference), otherwise scalar properties in diff2 won't be applied
|
|
134
|
+
const initialized = options.initialized || helper(entity).__initialized;
|
|
135
|
+
this.hydrate(entity, meta, diff2, initialized ? { ...options, initialized } : options);
|
|
133
136
|
// we need to update the entity data only with keys that were not present before
|
|
134
137
|
const nullVal = this.config.get('forceUndefined') ? undefined : null;
|
|
135
138
|
Utils.keys(diff2).forEach(key => {
|
|
@@ -137,7 +140,7 @@ export class EntityFactory {
|
|
|
137
140
|
if ([ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(prop.kind) && Utils.isPlainObject(data[prop.name])) {
|
|
138
141
|
diff2[key] = entity[prop.name] ? helper(entity[prop.name]).getPrimaryKey(options.convertCustomTypes) : null;
|
|
139
142
|
}
|
|
140
|
-
if ([ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE, ReferenceKind.SCALAR].includes(prop.kind) && prop.customType?.ensureComparable(meta, prop) && diff2[key] != null) {
|
|
143
|
+
if (!options.convertCustomTypes && [ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE, ReferenceKind.SCALAR].includes(prop.kind) && prop.customType?.ensureComparable(meta, prop) && diff2[key] != null) {
|
|
141
144
|
const converted = prop.customType.convertToJSValue(diff2[key], this.platform, { force: true });
|
|
142
145
|
diff2[key] = prop.customType.convertToDatabaseValue(converted, this.platform, { fromQuery: true });
|
|
143
146
|
}
|
package/entity/EntityHelper.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EagerProps, EntityRepositoryType, HiddenProps, OptionalProps, PrimaryKeyProp, } from '../typings.js';
|
|
1
|
+
import { EagerProps, EntityName, EntityRepositoryType, HiddenProps, OptionalProps, PrimaryKeyProp, } from '../typings.js';
|
|
2
2
|
import { EntityTransformer } from '../serialization/EntityTransformer.js';
|
|
3
3
|
import { Reference } from './Reference.js';
|
|
4
4
|
import { Utils } from '../utils/Utils.js';
|
|
@@ -130,7 +130,7 @@ export class EntityHelper {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
// ensure we dont have internal symbols in the POJO
|
|
133
|
-
[OptionalProps, EntityRepositoryType, PrimaryKeyProp, EagerProps, HiddenProps].forEach(sym => delete object[sym]);
|
|
133
|
+
[OptionalProps, EntityRepositoryType, PrimaryKeyProp, EagerProps, HiddenProps, EntityName].forEach(sym => delete object[sym]);
|
|
134
134
|
meta.props
|
|
135
135
|
.filter(prop => object[prop.name] === undefined)
|
|
136
136
|
.forEach(prop => delete object[prop.name]);
|
package/entity/EntityLoader.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { AnyEntity, ConnectionType, EntityName, EntityProperty, FilterQuery, PopulateOptions } from '../typings.js';
|
|
1
|
+
import type { AnyEntity, AutoPath, ConnectionType, EntityName, EntityProperty, FilterQuery, PopulateOptions } from '../typings.js';
|
|
2
2
|
import type { EntityManager } from '../EntityManager.js';
|
|
3
3
|
import { LoadStrategy, type LockMode, type PopulateHint, PopulatePath, type QueryOrderMap } from '../enums.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { FilterOptions } from '../drivers/IDatabaseDriver.js';
|
|
5
5
|
import type { LoggingOptions } from '../logging/Logger.js';
|
|
6
|
-
export
|
|
6
|
+
export interface EntityLoaderOptions<Entity, Fields extends string = PopulatePath.ALL, Excludes extends string = never> {
|
|
7
|
+
fields?: readonly AutoPath<Entity, Fields, `${PopulatePath.ALL}`>[];
|
|
8
|
+
exclude?: readonly AutoPath<Entity, Excludes>[];
|
|
7
9
|
where?: FilterQuery<Entity>;
|
|
8
10
|
populateWhere?: PopulateHint | `${PopulateHint}`;
|
|
9
|
-
fields?: readonly EntityField<Entity, Fields>[];
|
|
10
|
-
exclude?: readonly EntityField<Entity, Excludes>[];
|
|
11
11
|
orderBy?: QueryOrderMap<Entity> | QueryOrderMap<Entity>[];
|
|
12
12
|
refresh?: boolean;
|
|
13
13
|
validate?: boolean;
|
|
@@ -20,7 +20,7 @@ export type EntityLoaderOptions<Entity, Fields extends string = PopulatePath.ALL
|
|
|
20
20
|
schema?: string;
|
|
21
21
|
connectionType?: ConnectionType;
|
|
22
22
|
logging?: LoggingOptions;
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
24
|
export declare class EntityLoader {
|
|
25
25
|
private readonly em;
|
|
26
26
|
private readonly metadata;
|
|
@@ -150,7 +150,7 @@ export declare class EntityRepository<Entity extends object> {
|
|
|
150
150
|
/**
|
|
151
151
|
* Loads specified relations in batch. This will execute one query for each relation, that will populate it on all the specified entities.
|
|
152
152
|
*/
|
|
153
|
-
populate<Ent extends Entity | Entity[], Hint extends string = never, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Fields extends string =
|
|
153
|
+
populate<Ent extends Entity | Entity[], Hint extends string = never, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Fields extends string = never, Excludes extends string = never>(entities: Ent, populate: AutoPath<Naked, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Naked, Fields, Excludes>): Promise<Ent extends object[] ? MergeLoaded<ArrayElement<Ent>, Naked, Hint, Fields, Excludes>[] : MergeLoaded<Ent, Naked, Hint, Fields, Excludes>>;
|
|
154
154
|
/**
|
|
155
155
|
* Creates new instance of given entity and populates it with given data.
|
|
156
156
|
* The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PopulatePath } from '../enums.js';
|
|
2
2
|
import type { EntityManager } from '../EntityManager.js';
|
|
3
|
-
import type { Dictionary, EntityData, EntityDictionary, EntityMetadata, IHydrator, EntityKey, PopulateOptions, Primary, AutoPath, Ref, AddEager, LoadedReference, EntityDTO, Loaded, FromEntityType, IsSubset, MergeSelected } from '../typings.js';
|
|
3
|
+
import type { Dictionary, EntityData, EntityDictionary, EntityMetadata, IHydrator, EntityKey, PopulateOptions, Primary, AutoPath, Ref, AddEager, LoadedReference, EntityDTO, Loaded, SerializeDTO, FromEntityType, IsSubset, MergeSelected } from '../typings.js';
|
|
4
4
|
import { Reference } from './Reference.js';
|
|
5
5
|
import { type AssignOptions } from './EntityAssigner.js';
|
|
6
6
|
import type { EntityLoaderOptions } from './EntityLoader.js';
|
|
@@ -44,12 +44,12 @@ export declare class WrappedEntity<Entity extends object> {
|
|
|
44
44
|
setSerializationContext<Hint extends string = never, Fields extends string = '*', Exclude extends string = never>(options: LoadHint<Entity, Hint, Fields, Exclude>): void;
|
|
45
45
|
toReference(): Ref<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>;
|
|
46
46
|
toObject<Ignored extends EntityKey<Entity> = never>(ignoreFields?: Ignored[]): Omit<EntityDTO<Entity>, Ignored>;
|
|
47
|
-
serialize<Hint extends string = never, Exclude extends string = never>(options?: SerializeOptions<Entity, Hint, Exclude>):
|
|
47
|
+
serialize<Hint extends string = never, Exclude extends string = never>(options?: SerializeOptions<Entity, Hint, Exclude>): SerializeDTO<Entity, Hint, Exclude>;
|
|
48
48
|
toPOJO(): EntityDTO<Entity>;
|
|
49
49
|
toJSON(...args: any[]): EntityDictionary<Entity>;
|
|
50
50
|
assign<Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Convert extends boolean = false, Data extends EntityData<Naked, Convert> | Partial<EntityDTO<Naked>> = EntityData<Naked, Convert> | Partial<EntityDTO<Naked>>>(data: Data & IsSubset<EntityData<Naked>, Data>, options?: AssignOptions<Convert>): MergeSelected<Entity, Naked, keyof Data & string>;
|
|
51
51
|
init<Hint extends string = never, Fields extends string = '*', Excludes extends string = never>(options?: FindOneOptions<Entity, Hint, Fields, Excludes>): Promise<Loaded<Entity, Hint, Fields, Excludes> | null>;
|
|
52
|
-
populate<Hint extends string = never>(populate: AutoPath<Entity, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Entity>): Promise<Loaded<Entity, Hint>>;
|
|
52
|
+
populate<Hint extends string = never, Fields extends string = never>(populate: AutoPath<Entity, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Entity, Fields>): Promise<Loaded<Entity, Hint>>;
|
|
53
53
|
hasPrimaryKey(): boolean;
|
|
54
54
|
getPrimaryKey(convertCustomTypes?: boolean): Primary<Entity> | null;
|
|
55
55
|
getPrimaryKeys(convertCustomTypes?: boolean): Primary<Entity>[] | null;
|
package/entity/defineEntity.d.ts
CHANGED
|
@@ -16,11 +16,135 @@ type ExcludeKeys = 'entity' | 'items';
|
|
|
16
16
|
type BuilderKeys = Exclude<UniversalPropertyKeys, ExcludeKeys> | BuilderExtraKeys;
|
|
17
17
|
type IncludeKeysForProperty = Exclude<keyof PropertyOptions<any>, ExcludeKeys> | BuilderExtraKeys;
|
|
18
18
|
type IncludeKeysForEnumOptions = Exclude<keyof EnumOptions<any>, ExcludeKeys> | BuilderExtraKeys;
|
|
19
|
-
type IncludeKeysForEmbeddedOptions = Exclude<keyof EmbeddedOptions<any, any>, ExcludeKeys> | BuilderExtraKeys;
|
|
20
|
-
type IncludeKeysForManyToOneOptions = Exclude<keyof ManyToOneOptions<any, any>, ExcludeKeys> | BuilderExtraKeys;
|
|
21
19
|
type IncludeKeysForOneToManyOptions = Exclude<keyof OneToManyOptions<any, any>, ExcludeKeys> | BuilderExtraKeys;
|
|
22
|
-
type
|
|
23
|
-
|
|
20
|
+
type HasKind<Options, K extends string> = Options extends {
|
|
21
|
+
kind: infer X extends string;
|
|
22
|
+
} ? X extends K ? true : false : false;
|
|
23
|
+
/** Lightweight chain result type for property builders - reduces type instantiation cost by avoiding full class resolution. */
|
|
24
|
+
export interface PropertyChain<Value, Options> {
|
|
25
|
+
'~type'?: {
|
|
26
|
+
value: Value;
|
|
27
|
+
};
|
|
28
|
+
'~options': Options;
|
|
29
|
+
$type<T>(): PropertyChain<T, Options>;
|
|
30
|
+
$type<Runtime, Raw, Serialized = Raw>(): PropertyChain<IType<Runtime, Raw, Serialized>, Options>;
|
|
31
|
+
nullable(): PropertyChain<Value, Omit<Options, 'nullable'> & {
|
|
32
|
+
nullable: true;
|
|
33
|
+
}>;
|
|
34
|
+
ref(): PropertyChain<Value, Omit<Options, 'ref'> & {
|
|
35
|
+
ref: true;
|
|
36
|
+
}>;
|
|
37
|
+
primary(): PropertyChain<Value, Omit<Options, 'primary'> & {
|
|
38
|
+
primary: true;
|
|
39
|
+
}>;
|
|
40
|
+
hidden(): PropertyChain<Value, Omit<Options, 'hidden'> & {
|
|
41
|
+
hidden: true;
|
|
42
|
+
}>;
|
|
43
|
+
autoincrement(): PropertyChain<Value, Omit<Options, 'autoincrement'> & {
|
|
44
|
+
autoincrement: true;
|
|
45
|
+
}>;
|
|
46
|
+
autoincrement(autoincrement: false): PropertyChain<Value, Omit<Options, 'autoincrement'> & {
|
|
47
|
+
autoincrement: false;
|
|
48
|
+
}>;
|
|
49
|
+
persist(): PropertyChain<Value, Omit<Options, 'persist'> & {
|
|
50
|
+
persist: true;
|
|
51
|
+
}>;
|
|
52
|
+
persist(persist: false): PropertyChain<Value, Omit<Options, 'persist'> & {
|
|
53
|
+
persist: false;
|
|
54
|
+
}>;
|
|
55
|
+
version(): PropertyChain<Value, Omit<Options, 'version'> & {
|
|
56
|
+
version: true;
|
|
57
|
+
}>;
|
|
58
|
+
lazy(): PropertyChain<Value, Options>;
|
|
59
|
+
name<T extends string>(name: T): PropertyChain<Value, Omit<Options, 'fieldName'> & {
|
|
60
|
+
fieldName: T;
|
|
61
|
+
}>;
|
|
62
|
+
fieldName<T extends string>(fieldName: T): PropertyChain<Value, Omit<Options, 'fieldName'> & {
|
|
63
|
+
fieldName: T;
|
|
64
|
+
}>;
|
|
65
|
+
onCreate(onCreate: (entity: any, em: EntityManager) => Value): PropertyChain<Value, Options & {
|
|
66
|
+
onCreate: (...args: any[]) => any;
|
|
67
|
+
}>;
|
|
68
|
+
default(defaultValue: string | string[] | number | number[] | boolean | null | Date | Raw): PropertyChain<Value, Omit<Options, 'default'> & {
|
|
69
|
+
default: any;
|
|
70
|
+
}>;
|
|
71
|
+
defaultRaw(defaultRaw: string): PropertyChain<Value, Options & {
|
|
72
|
+
defaultRaw: string;
|
|
73
|
+
}>;
|
|
74
|
+
formula(formula: string | FormulaCallback<any>): PropertyChain<Value, Omit<Options, 'formula'> & {
|
|
75
|
+
formula: any;
|
|
76
|
+
}>;
|
|
77
|
+
onUpdate(onUpdate: (entity: any, em: EntityManager) => Value): PropertyChain<Value, Options>;
|
|
78
|
+
fieldNames(...fieldNames: string[]): PropertyChain<Value, Options>;
|
|
79
|
+
type(type: PropertyValueType): PropertyChain<Value, Options>;
|
|
80
|
+
runtimeType(runtimeType: string): PropertyChain<Value, Options>;
|
|
81
|
+
columnType(columnType: ColumnType | AnyString): PropertyChain<Value, Options>;
|
|
82
|
+
columnTypes(...columnTypes: (ColumnType | AnyString)[]): PropertyChain<Value, Options>;
|
|
83
|
+
length(length: number): PropertyChain<Value, Options>;
|
|
84
|
+
precision(precision: number): PropertyChain<Value, Options>;
|
|
85
|
+
scale(scale: number): PropertyChain<Value, Options>;
|
|
86
|
+
returning(returning?: boolean): PropertyChain<Value, Options>;
|
|
87
|
+
unsigned(unsigned?: boolean): PropertyChain<Value, Options>;
|
|
88
|
+
hydrate(hydrate?: boolean): PropertyChain<Value, Options>;
|
|
89
|
+
concurrencyCheck(concurrencyCheck?: boolean): PropertyChain<Value, Options>;
|
|
90
|
+
generated(generated: string | GeneratedColumnCallback<any>): PropertyChain<Value, Options>;
|
|
91
|
+
check(check: string | CheckCallback<any>): PropertyChain<Value, Options>;
|
|
92
|
+
setter(setter?: boolean): PropertyChain<Value, Options>;
|
|
93
|
+
getter(getter?: boolean): PropertyChain<Value, Options>;
|
|
94
|
+
getterName(getterName: string): PropertyChain<Value, Options>;
|
|
95
|
+
serializedPrimaryKey(serializedPrimaryKey?: boolean): PropertyChain<Value, Options>;
|
|
96
|
+
serializer(serializer: (value: Value, options?: SerializeOptions<any>) => any): PropertyChain<Value, Options>;
|
|
97
|
+
serializedName(serializedName: string): PropertyChain<Value, Options>;
|
|
98
|
+
groups(...groups: string[]): PropertyChain<Value, Options>;
|
|
99
|
+
customOrder(...customOrder: (string[] | number[] | boolean[])): PropertyChain<Value, Options>;
|
|
100
|
+
extra(extra: string): PropertyChain<Value, Options>;
|
|
101
|
+
ignoreSchemaChanges(...ignoreSchemaChanges: ('type' | 'extra' | 'default')[]): PropertyChain<Value, Options>;
|
|
102
|
+
index(index?: boolean | string): PropertyChain<Value, Options>;
|
|
103
|
+
unique(unique?: boolean | string): PropertyChain<Value, Options>;
|
|
104
|
+
comment(comment: string): PropertyChain<Value, Options>;
|
|
105
|
+
accessor(accessor?: string | boolean): PropertyChain<Value, Options>;
|
|
106
|
+
eager(eager?: boolean): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
107
|
+
cascade(...cascade: Cascade[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
108
|
+
strategy(strategy: LoadStrategy | `${LoadStrategy}`): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
109
|
+
filters(filters: FilterOptions): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
110
|
+
mappedBy(mappedBy: (keyof Value & string) | ((e: Value) => any)): HasKind<Options, '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
111
|
+
inversedBy(inversedBy: (keyof Value & string) | ((e: Value) => any)): HasKind<Options, 'm:1' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
112
|
+
owner(): HasKind<Options, '1:1' | 'm:n'> extends true ? PropertyChain<Value, Omit<Options, 'owner'> & {
|
|
113
|
+
owner: true;
|
|
114
|
+
}> : never;
|
|
115
|
+
mapToPk(): HasKind<Options, 'm:1' | '1:1'> extends true ? PropertyChain<Value, Omit<Options, 'mapToPk'> & {
|
|
116
|
+
mapToPk: true;
|
|
117
|
+
}> : never;
|
|
118
|
+
orphanRemoval(orphanRemoval?: boolean): HasKind<Options, '1:m' | '1:1'> extends true ? PropertyChain<Value, Options> : never;
|
|
119
|
+
discriminator(discriminator: string): HasKind<Options, 'm:1' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
120
|
+
discriminatorMap(discriminatorMap: Dictionary<string>): HasKind<Options, 'm:1' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
121
|
+
pivotTable(pivotTable: string): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
122
|
+
pivotEntity(pivotEntity: () => EntityName): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
123
|
+
fixedOrder(fixedOrder?: boolean): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
124
|
+
fixedOrderColumn(fixedOrderColumn: string): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
125
|
+
array(): HasKind<Options, 'embedded' | 'enum'> extends true ? PropertyChain<Value, Omit<Options, 'array'> & {
|
|
126
|
+
array: true;
|
|
127
|
+
}> : never;
|
|
128
|
+
prefix(prefix: string | boolean): HasKind<Options, 'embedded'> extends true ? PropertyChain<Value, Options> : never;
|
|
129
|
+
prefixMode(prefixMode: EmbeddedPrefixMode): HasKind<Options, 'embedded'> extends true ? PropertyChain<Value, Options> : never;
|
|
130
|
+
object(object?: boolean): HasKind<Options, 'embedded'> extends true ? PropertyChain<Value, Options> : never;
|
|
131
|
+
nativeEnumName(nativeEnumName: string): HasKind<Options, 'enum'> extends true ? PropertyChain<Value, Options> : never;
|
|
132
|
+
orderBy(...orderBy: QueryOrderMap<object>[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
133
|
+
where(...where: FilterQuery<object>[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
134
|
+
joinColumn(joinColumn: string): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
135
|
+
joinColumns(...joinColumns: string[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
136
|
+
inverseJoinColumn(inverseJoinColumn: string): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
137
|
+
inverseJoinColumns(...inverseJoinColumns: string[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
138
|
+
referenceColumnName(referenceColumnName: string): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
139
|
+
referencedColumnNames(...referencedColumnNames: string[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
140
|
+
ownColumns(...ownColumns: string[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
141
|
+
targetKey(targetKey: keyof Value & string): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
142
|
+
deleteRule(deleteRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
143
|
+
updateRule(updateRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
144
|
+
deferMode(deferMode: DeferMode | `${DeferMode}`): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
145
|
+
createForeignKeyConstraint(createForeignKeyConstraint?: boolean): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
146
|
+
foreignKeyName(foreignKeyName: string): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
147
|
+
}
|
|
24
148
|
/** @internal */
|
|
25
149
|
export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys extends BuilderKeys> implements Record<Exclude<UniversalPropertyKeys, ExcludeKeys>, any> {
|
|
26
150
|
'~options': Options;
|
|
@@ -100,8 +224,11 @@ export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys
|
|
|
100
224
|
/**
|
|
101
225
|
* Explicitly specify the auto increment of the primary key.
|
|
102
226
|
*/
|
|
103
|
-
autoincrement
|
|
104
|
-
autoincrement:
|
|
227
|
+
autoincrement(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'autoincrement'> & {
|
|
228
|
+
autoincrement: true;
|
|
229
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
230
|
+
autoincrement(autoincrement: false): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'autoincrement'> & {
|
|
231
|
+
autoincrement: false;
|
|
105
232
|
}, IncludeKeys>, IncludeKeys>;
|
|
106
233
|
/**
|
|
107
234
|
* Add the property to the `returning` statement.
|
|
@@ -150,8 +277,8 @@ export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys
|
|
|
150
277
|
/**
|
|
151
278
|
* Set column as nullable for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}.
|
|
152
279
|
*/
|
|
153
|
-
nullable
|
|
154
|
-
nullable:
|
|
280
|
+
nullable(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'nullable'> & {
|
|
281
|
+
nullable: true;
|
|
155
282
|
}, IncludeKeys>, IncludeKeys>;
|
|
156
283
|
/**
|
|
157
284
|
* Set column as unsigned for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
@@ -160,8 +287,11 @@ export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys
|
|
|
160
287
|
/**
|
|
161
288
|
* Set false to define {@link https://mikro-orm.io/docs/serializing#shadow-properties Shadow Property}.
|
|
162
289
|
*/
|
|
163
|
-
persist
|
|
164
|
-
persist:
|
|
290
|
+
persist(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'persist'> & {
|
|
291
|
+
persist: true;
|
|
292
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
293
|
+
persist(persist: false): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'persist'> & {
|
|
294
|
+
persist: false;
|
|
165
295
|
}, IncludeKeys>, IncludeKeys>;
|
|
166
296
|
/**
|
|
167
297
|
* Set false to disable hydration of this property. Useful for persisted getters.
|
|
@@ -170,20 +300,20 @@ export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys
|
|
|
170
300
|
/**
|
|
171
301
|
* Enable `ScalarReference` wrapper for lazy values. Use this in combination with `lazy: true` to have a type-safe accessor object in place of the value.
|
|
172
302
|
*/
|
|
173
|
-
ref
|
|
174
|
-
ref:
|
|
303
|
+
ref(): UniversalPropertyOptionsBuilder<Value, Omit<Options, 'ref'> & {
|
|
304
|
+
ref: true;
|
|
175
305
|
}, IncludeKeys>;
|
|
176
306
|
/**
|
|
177
307
|
* Set to true to omit the property when {@link https://mikro-orm.io/docs/serializing Serializing}.
|
|
178
308
|
*/
|
|
179
|
-
hidden
|
|
180
|
-
hidden:
|
|
309
|
+
hidden(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'hidden'> & {
|
|
310
|
+
hidden: true;
|
|
181
311
|
}, IncludeKeys>, IncludeKeys>;
|
|
182
312
|
/**
|
|
183
313
|
* Set to true to enable {@link https://mikro-orm.io/docs/transactions#optimistic-locking Optimistic Locking} via version field. (SQL only)
|
|
184
314
|
*/
|
|
185
|
-
version
|
|
186
|
-
version:
|
|
315
|
+
version(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'version'> & {
|
|
316
|
+
version: true;
|
|
187
317
|
}, IncludeKeys>, IncludeKeys>;
|
|
188
318
|
/**
|
|
189
319
|
* Set to true to enable {@link https://mikro-orm.io/docs/transactions#optimistic-locking Optimistic Locking} via concurrency fields.
|
|
@@ -208,16 +338,14 @@ export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys
|
|
|
208
338
|
*
|
|
209
339
|
* @see https://mikro-orm.io/docs/defining-entities#lazy-scalar-properties
|
|
210
340
|
*/
|
|
211
|
-
lazy
|
|
212
|
-
ref: T;
|
|
213
|
-
}, IncludeKeys>, IncludeKeys>;
|
|
341
|
+
lazy(): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
214
342
|
/**
|
|
215
343
|
* Set true to define entity's unique primary key identifier.
|
|
216
344
|
*
|
|
217
345
|
* @see https://mikro-orm.io/docs/decorators#primarykey
|
|
218
346
|
*/
|
|
219
|
-
primary
|
|
220
|
-
primary:
|
|
347
|
+
primary(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'primary'> & {
|
|
348
|
+
primary: true;
|
|
221
349
|
}, IncludeKeys>, IncludeKeys>;
|
|
222
350
|
/**
|
|
223
351
|
* Set true to define the properties as setter. (virtual)
|
|
@@ -294,8 +422,8 @@ export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys
|
|
|
294
422
|
* @see https://mikro-orm.io/docs/defining-entities#sql-generated-columns
|
|
295
423
|
*/
|
|
296
424
|
ignoreSchemaChanges(...ignoreSchemaChanges: ('type' | 'extra' | 'default')[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
297
|
-
array
|
|
298
|
-
array:
|
|
425
|
+
array(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'array'> & {
|
|
426
|
+
array: true;
|
|
299
427
|
}, IncludeKeys>, IncludeKeys>;
|
|
300
428
|
/** for postgres, by default it uses text column with check constraint */
|
|
301
429
|
nativeEnumName(nativeEnumName: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
@@ -309,8 +437,8 @@ export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys
|
|
|
309
437
|
/** Override the default loading strategy for this property. This option has precedence over the global `loadStrategy`, but can be overridden by `FindOptions.strategy`. */
|
|
310
438
|
strategy(strategy: LoadStrategy | `${LoadStrategy}`): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
311
439
|
/** 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. */
|
|
312
|
-
owner
|
|
313
|
-
owner:
|
|
440
|
+
owner(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'owner'> & {
|
|
441
|
+
owner: true;
|
|
314
442
|
}, IncludeKeys>, IncludeKeys>;
|
|
315
443
|
/** For polymorphic relations. Specifies the property name that stores the entity type discriminator. Defaults to the property name. */
|
|
316
444
|
discriminator(discriminator: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
@@ -351,8 +479,8 @@ export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys
|
|
|
351
479
|
/** What to do when the reference to the target entity gets updated. */
|
|
352
480
|
updateRule(updateRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
353
481
|
/** Map this relation to the primary key value instead of an entity. */
|
|
354
|
-
mapToPk
|
|
355
|
-
mapToPk:
|
|
482
|
+
mapToPk(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'mapToPk'> & {
|
|
483
|
+
mapToPk: true;
|
|
356
484
|
}, IncludeKeys>, IncludeKeys>;
|
|
357
485
|
/** 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. */
|
|
358
486
|
deferMode(deferMode: DeferMode | `${DeferMode}`): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
@@ -390,17 +518,21 @@ declare const propertyBuilders: {
|
|
|
390
518
|
time: (length?: number) => UniversalPropertyOptionsBuilder<any, EmptyOptions, IncludeKeysForProperty>;
|
|
391
519
|
type: <T extends PropertyValueType>(type: T) => UniversalPropertyOptionsBuilder<InferPropertyValueType<T>, EmptyOptions, IncludeKeysForProperty>;
|
|
392
520
|
enum: <const T extends (number | string)[] | (() => Dictionary)>(items?: T) => UniversalPropertyOptionsBuilder<T extends () => Dictionary ? ValueOf<ReturnType<T>> : T extends (infer Value)[] ? Value : T, EmptyOptions, IncludeKeysForEnumOptions>;
|
|
393
|
-
embedded: <Target extends EntityTarget | EntityTarget[]>(target: Target) =>
|
|
394
|
-
|
|
521
|
+
embedded: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
522
|
+
kind: "embedded";
|
|
523
|
+
}>;
|
|
524
|
+
manyToMany: <Target extends EntityTarget>(target: Target) => PropertyChain<InferEntity<Target>, EmptyOptions & {
|
|
395
525
|
kind: "m:n";
|
|
396
|
-
}
|
|
397
|
-
manyToOne: <Target extends EntityTarget | EntityTarget[]>(target: Target) =>
|
|
526
|
+
}>;
|
|
527
|
+
manyToOne: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
398
528
|
kind: "m:1";
|
|
399
|
-
}
|
|
400
|
-
oneToMany: <Target extends EntityTarget>(target: Target) =>
|
|
401
|
-
|
|
529
|
+
}>;
|
|
530
|
+
oneToMany: <Target extends EntityTarget>(target: Target) => PropertyChain<InferEntity<Target>, EmptyOptions & {
|
|
531
|
+
kind: "1:m";
|
|
532
|
+
}>;
|
|
533
|
+
oneToOne: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
402
534
|
kind: "1:1";
|
|
403
|
-
}
|
|
535
|
+
}>;
|
|
404
536
|
date: () => UniversalPropertyOptionsBuilder<string, EmptyOptions, IncludeKeysForProperty>;
|
|
405
537
|
blob: () => UniversalPropertyOptionsBuilder<NonNullable<Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | null>, EmptyOptions, IncludeKeysForProperty>;
|
|
406
538
|
uint8array: () => UniversalPropertyOptionsBuilder<Uint8Array<ArrayBufferLike>, EmptyOptions, IncludeKeysForProperty>;
|
|
@@ -476,17 +608,21 @@ export declare namespace defineEntity {
|
|
|
476
608
|
time: (length?: number) => UniversalPropertyOptionsBuilder<any, EmptyOptions, IncludeKeysForProperty>;
|
|
477
609
|
type: <T extends PropertyValueType>(type: T) => UniversalPropertyOptionsBuilder<InferPropertyValueType<T>, EmptyOptions, IncludeKeysForProperty>;
|
|
478
610
|
enum: <const T extends (number | string)[] | (() => Dictionary)>(items?: T) => UniversalPropertyOptionsBuilder<T extends () => Dictionary ? ValueOf<ReturnType<T>> : T extends (infer Value)[] ? Value : T, EmptyOptions, IncludeKeysForEnumOptions>;
|
|
479
|
-
embedded: <Target extends EntityTarget | EntityTarget[]>(target: Target) =>
|
|
480
|
-
|
|
611
|
+
embedded: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
612
|
+
kind: "embedded";
|
|
613
|
+
}>;
|
|
614
|
+
manyToMany: <Target extends EntityTarget>(target: Target) => PropertyChain<InferEntity<Target>, EmptyOptions & {
|
|
481
615
|
kind: "m:n";
|
|
482
|
-
}
|
|
483
|
-
manyToOne: <Target extends EntityTarget | EntityTarget[]>(target: Target) =>
|
|
616
|
+
}>;
|
|
617
|
+
manyToOne: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
484
618
|
kind: "m:1";
|
|
485
|
-
}
|
|
486
|
-
oneToMany: <Target extends EntityTarget>(target: Target) =>
|
|
487
|
-
|
|
619
|
+
}>;
|
|
620
|
+
oneToMany: <Target extends EntityTarget>(target: Target) => PropertyChain<InferEntity<Target>, EmptyOptions & {
|
|
621
|
+
kind: "1:m";
|
|
622
|
+
}>;
|
|
623
|
+
oneToOne: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
488
624
|
kind: "1:1";
|
|
489
|
-
}
|
|
625
|
+
}>;
|
|
490
626
|
date: () => UniversalPropertyOptionsBuilder<string, EmptyOptions, IncludeKeysForProperty>;
|
|
491
627
|
blob: () => UniversalPropertyOptionsBuilder<NonNullable<Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | null>, EmptyOptions, IncludeKeysForProperty>;
|
|
492
628
|
uint8array: () => UniversalPropertyOptionsBuilder<Uint8Array<ArrayBufferLike>, EmptyOptions, IncludeKeysForProperty>;
|
|
@@ -563,8 +699,6 @@ type MaybeNullable<Value, Options> = Options extends {
|
|
|
563
699
|
} ? Value | null | undefined : Value;
|
|
564
700
|
type MaybeRelationRef<Value, Options> = Options extends {
|
|
565
701
|
mapToPk: true;
|
|
566
|
-
} ? Value : Options extends {
|
|
567
|
-
ref: false;
|
|
568
702
|
} ? Value : Options extends {
|
|
569
703
|
ref: true;
|
|
570
704
|
kind: '1:1';
|
|
@@ -577,8 +711,6 @@ type MaybeRelationRef<Value, Options> = Options extends {
|
|
|
577
711
|
kind: 'm:n';
|
|
578
712
|
} ? Value extends object ? Collection<Value> : never : Value;
|
|
579
713
|
type MaybeScalarRef<Value, Options> = Options extends {
|
|
580
|
-
ref: false;
|
|
581
|
-
} ? Value : Options extends {
|
|
582
714
|
kind: '1:1' | 'm:1' | '1:m' | 'm:n';
|
|
583
715
|
} ? Value : Options extends {
|
|
584
716
|
ref: true;
|