@mikro-orm/core 7.0.0-dev.33 → 7.0.0-dev.331
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 +70 -75
- package/EntityManager.js +487 -402
- package/MikroORM.d.ts +45 -38
- package/MikroORM.js +123 -156
- package/README.md +7 -4
- package/cache/FileCacheAdapter.d.ts +2 -7
- package/cache/FileCacheAdapter.js +35 -30
- package/cache/GeneratedCacheAdapter.d.ts +1 -2
- package/cache/GeneratedCacheAdapter.js +6 -8
- package/cache/MemoryCacheAdapter.d.ts +1 -2
- package/cache/MemoryCacheAdapter.js +8 -8
- package/cache/index.d.ts +1 -2
- package/cache/index.js +0 -2
- package/connections/Connection.d.ts +12 -5
- package/connections/Connection.js +37 -15
- package/drivers/DatabaseDriver.d.ts +25 -18
- package/drivers/DatabaseDriver.js +144 -45
- package/drivers/IDatabaseDriver.d.ts +118 -23
- package/entity/BaseEntity.d.ts +63 -4
- package/entity/BaseEntity.js +0 -3
- package/entity/Collection.d.ts +95 -31
- package/entity/Collection.js +487 -139
- package/entity/EntityAssigner.js +37 -25
- package/entity/EntityFactory.d.ts +8 -9
- package/entity/EntityFactory.js +152 -100
- package/entity/EntityHelper.d.ts +2 -2
- package/entity/EntityHelper.js +69 -27
- package/entity/EntityLoader.d.ts +12 -13
- package/entity/EntityLoader.js +286 -125
- package/entity/EntityRepository.d.ts +28 -8
- package/entity/EntityRepository.js +8 -2
- package/entity/PolymorphicRef.d.ts +12 -0
- package/entity/PolymorphicRef.js +18 -0
- package/entity/Reference.d.ts +3 -8
- package/entity/Reference.js +62 -29
- package/entity/WrappedEntity.d.ts +7 -10
- package/entity/WrappedEntity.js +6 -7
- package/entity/defineEntity.d.ts +472 -313
- package/entity/defineEntity.js +134 -290
- package/entity/index.d.ts +2 -2
- package/entity/index.js +2 -2
- package/entity/utils.d.ts +6 -1
- package/entity/utils.js +46 -11
- package/entity/validators.d.ts +11 -0
- package/entity/validators.js +66 -0
- package/enums.d.ts +8 -6
- package/enums.js +13 -17
- package/errors.d.ts +26 -16
- package/errors.js +63 -31
- package/events/EventManager.d.ts +3 -5
- package/events/EventManager.js +37 -26
- package/events/index.d.ts +1 -1
- package/events/index.js +0 -1
- package/exceptions.js +9 -2
- package/hydration/Hydrator.js +1 -2
- package/hydration/ObjectHydrator.d.ts +5 -6
- package/hydration/ObjectHydrator.js +109 -50
- package/index.d.ts +2 -2
- package/index.js +1 -2
- package/logging/DefaultLogger.d.ts +1 -1
- package/logging/DefaultLogger.js +3 -4
- package/logging/SimpleLogger.d.ts +1 -1
- package/logging/colors.d.ts +1 -1
- package/logging/colors.js +4 -6
- package/logging/index.d.ts +2 -1
- package/logging/index.js +1 -1
- package/logging/inspect.d.ts +2 -0
- package/logging/inspect.js +11 -0
- package/metadata/EntitySchema.d.ts +47 -23
- package/metadata/EntitySchema.js +103 -34
- package/metadata/MetadataDiscovery.d.ts +65 -18
- package/metadata/MetadataDiscovery.js +940 -424
- package/metadata/MetadataProvider.d.ts +11 -2
- package/metadata/MetadataProvider.js +71 -2
- package/metadata/MetadataStorage.d.ts +11 -13
- package/metadata/MetadataStorage.js +79 -48
- package/metadata/MetadataValidator.d.ts +32 -9
- package/metadata/MetadataValidator.js +214 -44
- package/metadata/discover-entities.d.ts +5 -0
- package/metadata/discover-entities.js +40 -0
- package/metadata/index.d.ts +1 -1
- package/metadata/index.js +0 -1
- package/metadata/types.d.ts +577 -0
- package/metadata/types.js +1 -0
- package/naming-strategy/AbstractNamingStrategy.d.ts +16 -4
- package/naming-strategy/AbstractNamingStrategy.js +26 -5
- package/naming-strategy/EntityCaseNamingStrategy.d.ts +3 -3
- package/naming-strategy/EntityCaseNamingStrategy.js +7 -6
- package/naming-strategy/MongoNamingStrategy.d.ts +3 -3
- package/naming-strategy/MongoNamingStrategy.js +6 -6
- package/naming-strategy/NamingStrategy.d.ts +28 -4
- package/naming-strategy/UnderscoreNamingStrategy.d.ts +3 -3
- package/naming-strategy/UnderscoreNamingStrategy.js +6 -6
- package/naming-strategy/index.d.ts +1 -1
- package/naming-strategy/index.js +0 -1
- package/not-supported.d.ts +2 -0
- package/not-supported.js +8 -0
- package/package.json +47 -36
- package/platforms/ExceptionConverter.js +1 -1
- package/platforms/Platform.d.ts +33 -15
- package/platforms/Platform.js +125 -69
- package/serialization/EntitySerializer.d.ts +6 -3
- package/serialization/EntitySerializer.js +54 -30
- package/serialization/EntityTransformer.js +37 -22
- package/serialization/SerializationContext.d.ts +10 -14
- package/serialization/SerializationContext.js +24 -19
- package/types/ArrayType.d.ts +1 -1
- package/types/ArrayType.js +2 -3
- package/types/BigIntType.js +1 -1
- package/types/BlobType.d.ts +0 -1
- package/types/BlobType.js +0 -3
- package/types/BooleanType.d.ts +1 -0
- package/types/BooleanType.js +3 -0
- package/types/DecimalType.js +2 -2
- package/types/DoubleType.js +1 -1
- package/types/EnumArrayType.js +1 -2
- package/types/JsonType.d.ts +1 -1
- package/types/JsonType.js +7 -2
- package/types/TinyIntType.js +1 -1
- package/types/Type.d.ts +2 -4
- package/types/Type.js +3 -3
- package/types/Uint8ArrayType.d.ts +0 -1
- package/types/Uint8ArrayType.js +1 -4
- package/types/UuidType.d.ts +2 -0
- package/types/UuidType.js +14 -2
- package/types/index.d.ts +3 -2
- package/typings.d.ts +427 -170
- package/typings.js +100 -45
- package/unit-of-work/ChangeSet.d.ts +4 -6
- package/unit-of-work/ChangeSet.js +8 -9
- package/unit-of-work/ChangeSetComputer.d.ts +2 -12
- package/unit-of-work/ChangeSetComputer.js +61 -38
- package/unit-of-work/ChangeSetPersister.d.ts +10 -17
- package/unit-of-work/ChangeSetPersister.js +136 -73
- package/unit-of-work/CommitOrderCalculator.d.ts +13 -14
- package/unit-of-work/CommitOrderCalculator.js +22 -20
- package/unit-of-work/IdentityMap.d.ts +12 -3
- package/unit-of-work/IdentityMap.js +51 -13
- package/unit-of-work/UnitOfWork.d.ts +39 -23
- package/unit-of-work/UnitOfWork.js +441 -246
- package/utils/AbstractMigrator.d.ts +101 -0
- package/utils/AbstractMigrator.js +303 -0
- package/utils/AbstractSchemaGenerator.d.ts +5 -5
- package/utils/AbstractSchemaGenerator.js +30 -18
- package/utils/AsyncContext.d.ts +6 -0
- package/utils/AsyncContext.js +42 -0
- package/utils/Configuration.d.ts +647 -185
- package/utils/Configuration.js +215 -252
- package/utils/ConfigurationLoader.d.ts +1 -52
- package/utils/ConfigurationLoader.js +1 -330
- package/utils/Cursor.d.ts +3 -6
- package/utils/Cursor.js +32 -17
- package/utils/DataloaderUtils.d.ts +10 -5
- package/utils/DataloaderUtils.js +42 -22
- package/utils/EntityComparator.d.ts +21 -21
- package/utils/EntityComparator.js +224 -118
- package/utils/QueryHelper.d.ts +34 -7
- package/utils/QueryHelper.js +183 -72
- package/utils/RawQueryFragment.d.ts +28 -34
- package/utils/RawQueryFragment.js +37 -72
- package/utils/RequestContext.js +2 -2
- package/utils/TransactionContext.js +2 -2
- package/utils/TransactionManager.js +11 -8
- package/utils/Utils.d.ts +16 -127
- package/utils/Utils.js +104 -402
- package/utils/clone.js +13 -23
- package/utils/env-vars.d.ts +7 -0
- package/utils/env-vars.js +98 -0
- package/utils/fs-utils.d.ts +20 -0
- package/utils/fs-utils.js +193 -0
- package/utils/index.d.ts +1 -3
- package/utils/index.js +1 -3
- package/utils/upsert-utils.d.ts +9 -4
- package/utils/upsert-utils.js +51 -5
- 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 -8
- 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 -33
- 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 -250
- package/decorators/Property.js +0 -32
- package/decorators/Transactional.d.ts +0 -14
- package/decorators/Transactional.js +0 -28
- 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/entity/ArrayCollection.d.ts +0 -118
- package/entity/ArrayCollection.js +0 -407
- package/entity/EntityValidator.d.ts +0 -19
- package/entity/EntityValidator.js +0 -150
- 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/entity/defineEntity.d.ts
CHANGED
|
@@ -1,177 +1,352 @@
|
|
|
1
1
|
import type { EntityManager } from '../EntityManager.js';
|
|
2
|
-
import type { ColumnType, PropertyOptions, ReferenceOptions } from '../
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type { OneToManyOptions } from '../decorators/OneToMany.js';
|
|
7
|
-
import type { OneToOneOptions } from '../decorators/OneToOne.js';
|
|
8
|
-
import type { ManyToManyOptions } from '../decorators/ManyToMany.js';
|
|
9
|
-
import type { AnyString, GeneratedColumnCallback, Constructor, Opt, Hidden, CheckCallback, FilterQuery, EntityName, Dictionary, EntityMetadata } from '../typings.js';
|
|
10
|
-
import type { Reference, ScalarReference } from './Reference.js';
|
|
2
|
+
import type { ColumnType, PropertyOptions, ReferenceOptions, EnumOptions, EmbeddedOptions, ManyToOneOptions, OneToManyOptions, OneToOneOptions, ManyToManyOptions } from '../metadata/types.js';
|
|
3
|
+
import type { AnyString, GeneratedColumnCallback, Constructor, CheckCallback, FilterQuery, EntityName, Dictionary, EntityMetadata, PrimaryKeyProp, EntityRepositoryType, Hidden, Opt, Primary, EntityClass, EntitySchemaWithMeta, InferEntity, MaybeReturnType, Ref, IndexCallback, FormulaCallback, EntityCtor, IsNever, IWrappedEntity, DefineConfig, Config } from '../typings.js';
|
|
4
|
+
import type { Raw } from '../utils/RawQueryFragment.js';
|
|
5
|
+
import type { ScalarReference } from './Reference.js';
|
|
11
6
|
import type { SerializeOptions } from '../serialization/EntitySerializer.js';
|
|
12
|
-
import type { Cascade, DeferMode, LoadStrategy, QueryOrderMap } from '../enums.js';
|
|
13
|
-
import type {
|
|
7
|
+
import type { Cascade, DeferMode, EmbeddedPrefixMode, LoadStrategy, QueryOrderKeysFlat, QueryOrderMap } from '../enums.js';
|
|
8
|
+
import type { EventSubscriber } from '../events/EventSubscriber.js';
|
|
14
9
|
import type { IType, Type } from '../types/Type.js';
|
|
15
10
|
import { types } from '../types/index.js';
|
|
16
|
-
import {
|
|
11
|
+
import type { Collection } from './Collection.js';
|
|
12
|
+
import type { FilterOptions } from '../drivers/IDatabaseDriver.js';
|
|
13
|
+
export type UniversalPropertyKeys = keyof PropertyOptions<any> | keyof EnumOptions<any> | keyof EmbeddedOptions<any, any> | keyof ReferenceOptions<any, any> | keyof ManyToOneOptions<any, any> | keyof OneToManyOptions<any, any> | keyof OneToOneOptions<any, any> | keyof ManyToManyOptions<any, any>;
|
|
14
|
+
type BuilderExtraKeys = '~options' | '~type' | '$type';
|
|
15
|
+
type ExcludeKeys = 'entity' | 'items';
|
|
16
|
+
type BuilderKeys = Exclude<UniversalPropertyKeys, ExcludeKeys> | BuilderExtraKeys;
|
|
17
|
+
type IncludeKeysForProperty = Exclude<keyof PropertyOptions<any>, ExcludeKeys> | BuilderExtraKeys;
|
|
18
|
+
type IncludeKeysForEnumOptions = Exclude<keyof EnumOptions<any>, ExcludeKeys> | BuilderExtraKeys;
|
|
19
|
+
type IncludeKeysForOneToManyOptions = Exclude<keyof OneToManyOptions<any, any>, ExcludeKeys> | BuilderExtraKeys;
|
|
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
|
+
}
|
|
17
148
|
/** @internal */
|
|
18
|
-
export declare class
|
|
19
|
-
'~options':
|
|
149
|
+
export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys extends BuilderKeys> implements Record<Exclude<UniversalPropertyKeys, ExcludeKeys>, any> {
|
|
150
|
+
'~options': Options;
|
|
20
151
|
'~type'?: {
|
|
21
152
|
value: Value;
|
|
22
153
|
};
|
|
23
|
-
constructor(options:
|
|
154
|
+
constructor(options: any);
|
|
155
|
+
protected assignOptions(options: EmptyOptions): any;
|
|
156
|
+
/**
|
|
157
|
+
* Set the TypeScript type of the property.
|
|
158
|
+
*/
|
|
159
|
+
$type<T>(): UniversalPropertyOptionsBuilder<T, Options, IncludeKeys>;
|
|
160
|
+
/**
|
|
161
|
+
* Set the TypeScript type for custom types that map to objects.
|
|
162
|
+
* This method provides type safety for custom types by specifying the runtime type,
|
|
163
|
+
* raw database value type, and optional serialized type.
|
|
164
|
+
*
|
|
165
|
+
* @template Runtime - The runtime type that the property will have in JavaScript
|
|
166
|
+
* @template Raw - The raw value type as stored in the database
|
|
167
|
+
* @template Serialized - The type when serialized (defaults to Raw)
|
|
168
|
+
* @returns PropertyOptionsBuilder with IType wrapper for type safety
|
|
169
|
+
*/
|
|
170
|
+
$type<Runtime, Raw, Serialized = Raw>(): UniversalPropertyOptionsBuilder<IType<Runtime, Raw, Serialized>, Options, IncludeKeys>;
|
|
24
171
|
/**
|
|
25
172
|
* Alias for `fieldName`.
|
|
26
173
|
*/
|
|
27
|
-
name(name:
|
|
174
|
+
name<T extends string>(name: T): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'fieldName'> & {
|
|
175
|
+
fieldName: T;
|
|
176
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
28
177
|
/**
|
|
29
178
|
* Specify database column name for this property.
|
|
30
179
|
*
|
|
31
180
|
* @see https://mikro-orm.io/docs/naming-strategy
|
|
32
181
|
*/
|
|
33
|
-
fieldName(fieldName:
|
|
182
|
+
fieldName<T extends string>(fieldName: T): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'fieldName'> & {
|
|
183
|
+
fieldName: T;
|
|
184
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
34
185
|
/**
|
|
35
186
|
* Specify database column names for this property.
|
|
36
187
|
* Same as `fieldName` but for composite FKs.
|
|
37
188
|
*
|
|
38
189
|
* @see https://mikro-orm.io/docs/naming-strategy
|
|
39
190
|
*/
|
|
40
|
-
fieldNames(...fieldNames: string[]):
|
|
191
|
+
fieldNames(...fieldNames: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
41
192
|
/**
|
|
42
193
|
* Specify an exact database column type for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. This option is only for simple properties represented by a single column. (SQL only)
|
|
43
194
|
*/
|
|
44
|
-
columnType(columnType: ColumnType | AnyString):
|
|
195
|
+
columnType(columnType: ColumnType | AnyString): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
45
196
|
/**
|
|
46
197
|
* Specify an exact database column type for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. This option is suitable for composite keys, where one property is represented by multiple columns. (SQL only)
|
|
47
198
|
*/
|
|
48
|
-
columnTypes(...columnTypes: (ColumnType | AnyString)[]):
|
|
199
|
+
columnTypes(...columnTypes: (ColumnType | AnyString)[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
49
200
|
/**
|
|
50
201
|
* Explicitly specify the runtime type.
|
|
51
202
|
*
|
|
52
203
|
* @see https://mikro-orm.io/docs/metadata-providers
|
|
53
204
|
* @see https://mikro-orm.io/docs/custom-types
|
|
54
205
|
*/
|
|
55
|
-
type<TType extends PropertyValueType>(type: TType):
|
|
206
|
+
type<TType extends PropertyValueType>(type: TType): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
56
207
|
/**
|
|
57
208
|
* Runtime type of the property. This is the JS type that your property is mapped to, e.g. `string` or `number`, and is normally inferred automatically via `reflect-metadata`.
|
|
58
209
|
* In some cases, the inference won't work, and you might need to specify the `runtimeType` explicitly - the most common one is when you use a union type with null like `foo: number | null`.
|
|
59
210
|
*/
|
|
60
|
-
runtimeType(runtimeType: string):
|
|
211
|
+
runtimeType(runtimeType: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
61
212
|
/**
|
|
62
213
|
* Set length of database column, used for datetime/timestamp/varchar column types for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
63
214
|
*/
|
|
64
|
-
length(length: number):
|
|
215
|
+
length(length: number): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
65
216
|
/**
|
|
66
217
|
* Set precision of database column to represent the number of significant digits. (SQL only)
|
|
67
218
|
*/
|
|
68
|
-
precision(precision: number):
|
|
219
|
+
precision(precision: number): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
69
220
|
/**
|
|
70
221
|
* Set scale of database column to represents the number of digits after the decimal point. (SQL only)
|
|
71
222
|
*/
|
|
72
|
-
scale(scale: number):
|
|
223
|
+
scale(scale: number): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
73
224
|
/**
|
|
74
225
|
* Explicitly specify the auto increment of the primary key.
|
|
75
226
|
*/
|
|
76
|
-
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;
|
|
232
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
77
233
|
/**
|
|
78
234
|
* Add the property to the `returning` statement.
|
|
79
235
|
*/
|
|
80
|
-
returning(returning?: boolean):
|
|
236
|
+
returning(returning?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
81
237
|
/**
|
|
82
238
|
* Automatically set the property value when entity gets created, executed during flush operation.
|
|
83
|
-
* @param entity
|
|
84
239
|
*/
|
|
85
|
-
onCreate(onCreate: (entity: any, em: EntityManager) => Value):
|
|
240
|
+
onCreate(onCreate: (entity: any, em: EntityManager) => Value): Pick<UniversalPropertyOptionsBuilder<Value, Options & {
|
|
241
|
+
onCreate: (...args: any[]) => any;
|
|
242
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
86
243
|
/**
|
|
87
244
|
* Automatically update the property value every time entity gets updated, executed during flush operation.
|
|
88
|
-
* @param entity
|
|
89
245
|
*/
|
|
90
|
-
onUpdate(onUpdate: (entity: any, em: EntityManager) => Value):
|
|
246
|
+
onUpdate(onUpdate: (entity: any, em: EntityManager) => Value): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
91
247
|
/**
|
|
92
248
|
* Specify default column value for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}.
|
|
93
249
|
* This is a runtime value, assignable to the entity property. (SQL only)
|
|
94
250
|
*/
|
|
95
|
-
default
|
|
251
|
+
default<T extends string | string[] | number | number[] | boolean | null | Date | Raw>(defaultValue: T): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'default'> & {
|
|
252
|
+
default: T;
|
|
253
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
96
254
|
/**
|
|
97
255
|
* Specify SQL functions for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
98
256
|
* Since v4 you should use defaultRaw for SQL functions. e.g. now()
|
|
99
257
|
*/
|
|
100
|
-
defaultRaw(defaultRaw: string):
|
|
258
|
+
defaultRaw(defaultRaw: string): Pick<UniversalPropertyOptionsBuilder<Value, Options & {
|
|
259
|
+
defaultRaw: string;
|
|
260
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
261
|
+
/**
|
|
262
|
+
* Allow controlling `filters` option. This will be overridden with `em.fork` or `FindOptions` if provided.
|
|
263
|
+
*/
|
|
264
|
+
filters(filters: FilterOptions): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
101
265
|
/**
|
|
102
266
|
* Set to map some SQL snippet for the entity.
|
|
103
267
|
*
|
|
104
268
|
* @see https://mikro-orm.io/docs/defining-entities#formulas Formulas
|
|
105
269
|
*/
|
|
106
|
-
formula
|
|
270
|
+
formula<T extends string | FormulaCallback<any>>(formula: T): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'formula'> & {
|
|
271
|
+
formula: T;
|
|
272
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
107
273
|
/**
|
|
108
274
|
* For generated columns. This will be appended to the column type after the `generated always` clause.
|
|
109
275
|
*/
|
|
110
|
-
generated(generated: string | GeneratedColumnCallback<any>):
|
|
276
|
+
generated(generated: string | GeneratedColumnCallback<any>): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
111
277
|
/**
|
|
112
278
|
* Set column as nullable for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}.
|
|
113
279
|
*/
|
|
114
|
-
nullable
|
|
280
|
+
nullable(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'nullable'> & {
|
|
281
|
+
nullable: true;
|
|
282
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
115
283
|
/**
|
|
116
284
|
* Set column as unsigned for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
117
285
|
*/
|
|
118
|
-
unsigned(unsigned?: boolean):
|
|
286
|
+
unsigned(unsigned?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
119
287
|
/**
|
|
120
288
|
* Set false to define {@link https://mikro-orm.io/docs/serializing#shadow-properties Shadow Property}.
|
|
121
289
|
*/
|
|
122
|
-
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;
|
|
295
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
123
296
|
/**
|
|
124
297
|
* Set false to disable hydration of this property. Useful for persisted getters.
|
|
125
298
|
*/
|
|
126
|
-
hydrate(hydrate?: boolean):
|
|
299
|
+
hydrate(hydrate?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
127
300
|
/**
|
|
128
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.
|
|
129
302
|
*/
|
|
130
|
-
ref
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*
|
|
134
|
-
* @see https://mikro-orm.io/docs/unit-of-work#change-tracking-and-performance-considerations
|
|
135
|
-
*/
|
|
136
|
-
trackChanges(trackChanges?: boolean): PropertyOptionsBuilder<Value>;
|
|
303
|
+
ref(): UniversalPropertyOptionsBuilder<Value, Omit<Options, 'ref'> & {
|
|
304
|
+
ref: true;
|
|
305
|
+
}, IncludeKeys>;
|
|
137
306
|
/**
|
|
138
307
|
* Set to true to omit the property when {@link https://mikro-orm.io/docs/serializing Serializing}.
|
|
139
308
|
*/
|
|
140
|
-
hidden
|
|
309
|
+
hidden(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'hidden'> & {
|
|
310
|
+
hidden: true;
|
|
311
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
141
312
|
/**
|
|
142
313
|
* Set to true to enable {@link https://mikro-orm.io/docs/transactions#optimistic-locking Optimistic Locking} via version field. (SQL only)
|
|
143
314
|
*/
|
|
144
|
-
version(
|
|
315
|
+
version(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'version'> & {
|
|
316
|
+
version: true;
|
|
317
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
145
318
|
/**
|
|
146
319
|
* Set to true to enable {@link https://mikro-orm.io/docs/transactions#optimistic-locking Optimistic Locking} via concurrency fields.
|
|
147
320
|
*/
|
|
148
|
-
concurrencyCheck(concurrencyCheck?: boolean):
|
|
321
|
+
concurrencyCheck(concurrencyCheck?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
149
322
|
/**
|
|
150
323
|
* Explicitly specify index on a property.
|
|
151
324
|
*/
|
|
152
|
-
index(index?: boolean | string):
|
|
325
|
+
index(index?: boolean | string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
153
326
|
/**
|
|
154
327
|
* Set column as unique for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
155
328
|
*/
|
|
156
|
-
unique(unique?: boolean | string):
|
|
329
|
+
unique(unique?: boolean | string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
157
330
|
/**
|
|
158
331
|
* Specify column with check constraints. (Postgres driver only)
|
|
159
332
|
*
|
|
160
333
|
* @see https://mikro-orm.io/docs/defining-entities#check-constraints
|
|
161
334
|
*/
|
|
162
|
-
check(check: string | CheckCallback<any>):
|
|
335
|
+
check(check: string | CheckCallback<any>): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
163
336
|
/**
|
|
164
337
|
* Set to omit the property from the select clause for lazy loading.
|
|
165
338
|
*
|
|
166
339
|
* @see https://mikro-orm.io/docs/defining-entities#lazy-scalar-properties
|
|
167
340
|
*/
|
|
168
|
-
lazy
|
|
341
|
+
lazy(): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
169
342
|
/**
|
|
170
343
|
* Set true to define entity's unique primary key identifier.
|
|
171
344
|
*
|
|
172
345
|
* @see https://mikro-orm.io/docs/decorators#primarykey
|
|
173
346
|
*/
|
|
174
|
-
primary(
|
|
347
|
+
primary(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'primary'> & {
|
|
348
|
+
primary: true;
|
|
349
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
175
350
|
/**
|
|
176
351
|
* Set true to define the properties as setter. (virtual)
|
|
177
352
|
*
|
|
@@ -183,7 +358,7 @@ export declare class PropertyOptionsBuilder<Value> {
|
|
|
183
358
|
* }
|
|
184
359
|
* ```
|
|
185
360
|
*/
|
|
186
|
-
setter(setter?: boolean):
|
|
361
|
+
setter(setter?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
187
362
|
/**
|
|
188
363
|
* Set true to define the properties as getter. (virtual)
|
|
189
364
|
*
|
|
@@ -195,7 +370,7 @@ export declare class PropertyOptionsBuilder<Value> {
|
|
|
195
370
|
* }
|
|
196
371
|
* ```
|
|
197
372
|
*/
|
|
198
|
-
getter(getter?: boolean):
|
|
373
|
+
getter(getter?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
199
374
|
/**
|
|
200
375
|
* When defining a property over a method (not a getter, a regular function), you can use this option to point
|
|
201
376
|
* to the method name.
|
|
@@ -208,330 +383,314 @@ export declare class PropertyOptionsBuilder<Value> {
|
|
|
208
383
|
* }
|
|
209
384
|
* ```
|
|
210
385
|
*/
|
|
211
|
-
getterName(getterName: string):
|
|
386
|
+
getterName(getterName: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
212
387
|
/**
|
|
213
388
|
* Set to define serialized primary key for MongoDB. (virtual)
|
|
214
389
|
* Alias for `@SerializedPrimaryKey()` decorator.
|
|
215
390
|
*
|
|
216
391
|
* @see https://mikro-orm.io/docs/decorators#serializedprimarykey
|
|
217
392
|
*/
|
|
218
|
-
serializedPrimaryKey(serializedPrimaryKey?: boolean):
|
|
393
|
+
serializedPrimaryKey(serializedPrimaryKey?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
219
394
|
/**
|
|
220
395
|
* Set to use serialize property. Allow to specify a callback that will be used when serializing a property.
|
|
221
396
|
*
|
|
222
397
|
* @see https://mikro-orm.io/docs/serializing#property-serializers
|
|
223
398
|
*/
|
|
224
|
-
serializer(serializer: (value: Value, options?: SerializeOptions<any>) => any):
|
|
399
|
+
serializer(serializer: (value: Value, options?: SerializeOptions<any>) => any): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
225
400
|
/**
|
|
226
401
|
* Specify name of key for the serialized value.
|
|
227
402
|
*/
|
|
228
|
-
serializedName(serializedName: string):
|
|
403
|
+
serializedName(serializedName: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
229
404
|
/**
|
|
230
405
|
* Specify serialization groups for `serialize()` calls. If a property does not specify any group, it will be included,
|
|
231
406
|
* otherwise only properties with a matching group are included.
|
|
232
407
|
*/
|
|
233
|
-
groups(...groups: string[]):
|
|
408
|
+
groups(...groups: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
234
409
|
/**
|
|
235
410
|
* Specify a custom order based on the values. (SQL only)
|
|
236
411
|
*/
|
|
237
|
-
customOrder(...customOrder:
|
|
412
|
+
customOrder(...customOrder: string[] | number[] | boolean[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
238
413
|
/**
|
|
239
414
|
* Specify comment of column for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
240
415
|
*/
|
|
241
|
-
comment(comment: string):
|
|
416
|
+
comment(comment: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
242
417
|
/** mysql only */
|
|
243
|
-
extra(extra: string):
|
|
418
|
+
extra(extra: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
244
419
|
/**
|
|
245
420
|
* Set to avoid a perpetual diff from the {@link https://mikro-orm.io/docs/schema-generator Schema Generator} when columns are generated.
|
|
246
421
|
*
|
|
247
422
|
* @see https://mikro-orm.io/docs/defining-entities#sql-generated-columns
|
|
248
423
|
*/
|
|
249
|
-
ignoreSchemaChanges(...ignoreSchemaChanges: ('type' | 'extra' | 'default')[]):
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
$type<T>(): PropertyOptionsBuilder<T>;
|
|
254
|
-
/**
|
|
255
|
-
* Set the TypeScript type for custom types that map to objects.
|
|
256
|
-
* This method provides type safety for custom types by specifying the runtime type,
|
|
257
|
-
* raw database value type, and optional serialized type.
|
|
258
|
-
*
|
|
259
|
-
* @template Runtime - The runtime type that the property will have in JavaScript
|
|
260
|
-
* @template Raw - The raw value type as stored in the database
|
|
261
|
-
* @template Serialized - The type when serialized (defaults to Raw)
|
|
262
|
-
* @returns PropertyOptionsBuilder with IType wrapper for type safety
|
|
263
|
-
*/
|
|
264
|
-
$type<Runtime, Raw, Serialized = Raw>(): PropertyOptionsBuilder<IType<Runtime, Raw, Serialized>>;
|
|
265
|
-
}
|
|
266
|
-
/** @internal */
|
|
267
|
-
export declare class EnumOptionsBuilder<Value> extends PropertyOptionsBuilder<Value> {
|
|
268
|
-
'~options': {
|
|
269
|
-
enum: true;
|
|
270
|
-
} & EnumOptions<any>;
|
|
271
|
-
constructor(options: EnumOptionsBuilder<Value>['~options']);
|
|
272
|
-
array<T extends boolean = true>(array?: T): EnumOptionsBuilder<T extends true ? Value[] : UnwrapArray<Value>>;
|
|
424
|
+
ignoreSchemaChanges(...ignoreSchemaChanges: ('type' | 'extra' | 'default')[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
425
|
+
array(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'array'> & {
|
|
426
|
+
array: true;
|
|
427
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
273
428
|
/** for postgres, by default it uses text column with check constraint */
|
|
274
|
-
nativeEnumName(nativeEnumName: string):
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
'~options': ({
|
|
279
|
-
kind: 'embedded';
|
|
280
|
-
entity: () => EntitySchema<any, any> | EntitySchema<any, any>[];
|
|
281
|
-
} & EmbeddedOptions<any, any> & PropertyOptions<any>);
|
|
282
|
-
constructor(options: EmbeddedOptionsBuilder<Value>['~options']);
|
|
283
|
-
prefix(prefix: string): EmbeddedOptionsBuilder<Value>;
|
|
284
|
-
prefixMode(prefixMode: EmbeddedPrefixMode): EmbeddedOptionsBuilder<Value>;
|
|
285
|
-
object(object?: boolean): EmbeddedOptionsBuilder<Value>;
|
|
286
|
-
array<T extends boolean = true>(array?: T): EmbeddedOptionsBuilder<T extends true ? Value[] : UnwrapArray<Value>>;
|
|
287
|
-
}
|
|
288
|
-
/** @internal */
|
|
289
|
-
export declare class ReferenceOptionsBuilder<Value extends object> extends PropertyOptionsBuilder<Value> {
|
|
290
|
-
'~options': ReferenceOptions<any, any>;
|
|
291
|
-
constructor(options: ReferenceOptionsBuilder<Value>['~options']);
|
|
429
|
+
nativeEnumName(nativeEnumName: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
430
|
+
prefix(prefix: string | boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
431
|
+
prefixMode(prefixMode: EmbeddedPrefixMode): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
432
|
+
object(object?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
292
433
|
/** Set what actions on owning entity should be cascaded to the relationship. Defaults to [Cascade.PERSIST, Cascade.MERGE] (see {@doclink cascading}). */
|
|
293
|
-
cascade(...cascade: Cascade[]):
|
|
434
|
+
cascade(...cascade: Cascade[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
294
435
|
/** Always load the relationship. Discouraged for use with to-many relations for performance reasons. */
|
|
295
|
-
eager(eager?: boolean):
|
|
436
|
+
eager(eager?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
296
437
|
/** Override the default loading strategy for this property. This option has precedence over the global `loadStrategy`, but can be overridden by `FindOptions.strategy`. */
|
|
297
|
-
strategy(strategy: LoadStrategy | `${LoadStrategy}`):
|
|
298
|
-
/**
|
|
299
|
-
* @internal
|
|
300
|
-
* re-declare to override type inference
|
|
301
|
-
*/
|
|
302
|
-
ref(ref?: boolean): ReferenceOptionsBuilder<any>;
|
|
303
|
-
/**
|
|
304
|
-
* @internal
|
|
305
|
-
* re-declare to override type inference
|
|
306
|
-
*/
|
|
307
|
-
primary(primary?: boolean): ReferenceOptionsBuilder<any>;
|
|
308
|
-
}
|
|
309
|
-
/** @internal */
|
|
310
|
-
export declare class ManyToManyOptionsBuilder<TargetValue extends object> extends ReferenceOptionsBuilder<TargetValue> {
|
|
311
|
-
'~options': ({
|
|
312
|
-
kind: 'm:n';
|
|
313
|
-
entity: () => EntitySchema<any, any>;
|
|
314
|
-
} & ManyToManyOptions<any, UnwrapCollection<TargetValue>>);
|
|
315
|
-
constructor(options: ManyToManyOptionsBuilder<TargetValue>['~options']);
|
|
438
|
+
strategy(strategy: LoadStrategy | `${LoadStrategy}`): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
316
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. */
|
|
317
|
-
owner(
|
|
440
|
+
owner(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'owner'> & {
|
|
441
|
+
owner: true;
|
|
442
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
443
|
+
/** For polymorphic relations. Specifies the property name that stores the entity type discriminator. Defaults to the property name. */
|
|
444
|
+
discriminator(discriminator: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
445
|
+
/** For polymorphic relations. Custom mapping of discriminator values to entity class names. */
|
|
446
|
+
discriminatorMap(discriminatorMap: Dictionary<string>): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
318
447
|
/** Point to the inverse side property name. */
|
|
319
|
-
inversedBy(inversedBy:
|
|
448
|
+
inversedBy(inversedBy: keyof Value | ((e: Value) => any)): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
320
449
|
/** Point to the owning side property name. */
|
|
321
|
-
mappedBy(mappedBy:
|
|
450
|
+
mappedBy(mappedBy: keyof Value | ((e: Value) => any)): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
322
451
|
/** Condition for {@doclink collections#declarative-partial-loading | Declarative partial loading}. */
|
|
323
|
-
where(...where: FilterQuery<object>[]):
|
|
452
|
+
where(...where: FilterQuery<object>[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
324
453
|
/** Set default ordering. */
|
|
325
|
-
orderBy(...orderBy: QueryOrderMap<object>[]):
|
|
454
|
+
orderBy(...orderBy: QueryOrderMap<object>[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
326
455
|
/** Force stable insertion order of items in the collection (see {@doclink collections | Collections}). */
|
|
327
|
-
fixedOrder(fixedOrder?: boolean):
|
|
456
|
+
fixedOrder(fixedOrder?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
328
457
|
/** Override default order column name (`id`) for fixed ordering. */
|
|
329
|
-
fixedOrderColumn(fixedOrderColumn: string):
|
|
458
|
+
fixedOrderColumn(fixedOrderColumn: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
330
459
|
/** Override default name for pivot table (see {@doclink naming-strategy | Naming Strategy}). */
|
|
331
|
-
pivotTable(pivotTable: string):
|
|
460
|
+
pivotTable(pivotTable: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
332
461
|
/** Set pivot entity for this relation (see {@doclink collections#custom-pivot-table-entity | Custom pivot table entity}). */
|
|
333
|
-
pivotEntity(pivotEntity:
|
|
462
|
+
pivotEntity(pivotEntity: () => EntityName): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
334
463
|
/** 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. */
|
|
335
|
-
joinColumn(joinColumn: string):
|
|
464
|
+
joinColumn(joinColumn: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
336
465
|
/** 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. */
|
|
337
|
-
joinColumns(...joinColumns: string[]):
|
|
466
|
+
joinColumns(...joinColumns: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
338
467
|
/** 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. */
|
|
339
|
-
inverseJoinColumn(inverseJoinColumn: string):
|
|
468
|
+
inverseJoinColumn(inverseJoinColumn: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
340
469
|
/** 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. */
|
|
341
|
-
inverseJoinColumns(...inverseJoinColumns: string[]):
|
|
470
|
+
inverseJoinColumns(...inverseJoinColumns: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
342
471
|
/** 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. */
|
|
343
|
-
referenceColumnName(referenceColumnName: string):
|
|
472
|
+
referenceColumnName(referenceColumnName: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
344
473
|
/** 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. */
|
|
345
|
-
referencedColumnNames(...referencedColumnNames: string[]):
|
|
474
|
+
referencedColumnNames(...referencedColumnNames: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
475
|
+
/** Specify the property name on the target entity that this FK references instead of the primary key. */
|
|
476
|
+
targetKey(targetKey: keyof Value): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
346
477
|
/** What to do when the target entity gets deleted. */
|
|
347
|
-
deleteRule(deleteRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString):
|
|
478
|
+
deleteRule(deleteRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
348
479
|
/** What to do when the reference to the target entity gets updated. */
|
|
349
|
-
updateRule(updateRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString):
|
|
350
|
-
}
|
|
351
|
-
/** @internal */
|
|
352
|
-
export declare class ManyToOneOptionsBuilder<TargetValue extends object> extends ReferenceOptionsBuilder<TargetValue> {
|
|
353
|
-
'~options': ({
|
|
354
|
-
kind: 'm:1';
|
|
355
|
-
entity: () => EntitySchema<any, any>;
|
|
356
|
-
} & ManyToOneOptions<any, UnwrapRef<TargetValue>>);
|
|
357
|
-
constructor(options: ManyToOneOptionsBuilder<TargetValue>['~options']);
|
|
358
|
-
/** Point to the inverse side property name. */
|
|
359
|
-
inversedBy(inversedBy: (string & keyof UnwrapRef<TargetValue>) | ((e: UnwrapRef<TargetValue>) => any)): ManyToOneOptionsBuilder<TargetValue>;
|
|
360
|
-
/** Wrap the entity in {@apilink Reference} wrapper. */
|
|
361
|
-
ref<T extends boolean = true>(ref?: T): ManyToOneOptionsBuilder<T extends true ? Reference<TargetValue> : UnwrapRef<TargetValue>>;
|
|
362
|
-
/** Use this relation as a primary key. */
|
|
363
|
-
primary(primary?: boolean): ManyToOneOptionsBuilder<TargetValue>;
|
|
480
|
+
updateRule(updateRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
364
481
|
/** Map this relation to the primary key value instead of an entity. */
|
|
365
|
-
mapToPk(
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
/** 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. */
|
|
369
|
-
joinColumns(...joinColumns: string[]): ManyToOneOptionsBuilder<TargetValue>;
|
|
370
|
-
/** 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. */
|
|
371
|
-
ownColumns(...ownColumns: string[]): ManyToOneOptionsBuilder<TargetValue>;
|
|
372
|
-
/** 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. */
|
|
373
|
-
referenceColumnName(referenceColumnName: string): ManyToOneOptionsBuilder<TargetValue>;
|
|
374
|
-
/** 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. */
|
|
375
|
-
referencedColumnNames(...referencedColumnNames: string[]): ManyToOneOptionsBuilder<TargetValue>;
|
|
376
|
-
/** What to do when the target entity gets deleted. */
|
|
377
|
-
deleteRule(deleteRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString): ManyToOneOptionsBuilder<TargetValue>;
|
|
378
|
-
/** What to do when the reference to the target entity gets updated. */
|
|
379
|
-
updateRule(updateRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString): ManyToOneOptionsBuilder<TargetValue>;
|
|
482
|
+
mapToPk(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'mapToPk'> & {
|
|
483
|
+
mapToPk: true;
|
|
484
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
380
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. */
|
|
381
|
-
deferMode(deferMode: DeferMode | `${DeferMode}`):
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
} & OneToManyOptions<any, UnwrapCollection<TargetValue>>);
|
|
389
|
-
constructor(options: OneToManyOptionsBuilder<TargetValue>['~options']);
|
|
486
|
+
deferMode(deferMode: DeferMode | `${DeferMode}`): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
487
|
+
/** 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. */
|
|
488
|
+
ownColumns(...ownColumns: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
489
|
+
/** Enable/disable foreign key constraint creation on this relation */
|
|
490
|
+
createForeignKeyConstraint(createForeignKeyConstraint?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
491
|
+
/** Set a custom foreign key constraint name, overriding NamingStrategy.indexName(). */
|
|
492
|
+
foreignKeyName(foreignKeyName: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
390
493
|
/** Remove the entity when it gets disconnected from the relationship (see {@doclink cascading | Cascading}). */
|
|
391
|
-
orphanRemoval(orphanRemoval?: boolean):
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
where(where: FilterQuery<UnwrapCollection<TargetValue>>): OneToManyOptionsBuilder<TargetValue>;
|
|
396
|
-
/** 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. */
|
|
397
|
-
joinColumn(joinColumn: string): OneToManyOptionsBuilder<TargetValue>;
|
|
398
|
-
/** 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. */
|
|
399
|
-
joinColumns(...joinColumns: string[]): OneToManyOptionsBuilder<TargetValue>;
|
|
400
|
-
/** 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. */
|
|
401
|
-
inverseJoinColumn(inverseJoinColumn: string): OneToManyOptionsBuilder<TargetValue>;
|
|
402
|
-
/** 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. */
|
|
403
|
-
inverseJoinColumns(...inverseJoinColumns: string[]): OneToManyOptionsBuilder<TargetValue>;
|
|
404
|
-
/** 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. */
|
|
405
|
-
referenceColumnName(referenceColumnName: string): OneToManyOptionsBuilder<TargetValue>;
|
|
406
|
-
/** 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. */
|
|
407
|
-
referencedColumnNames(...referencedColumnNames: string[]): OneToManyOptionsBuilder<TargetValue>;
|
|
494
|
+
orphanRemoval(orphanRemoval?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
495
|
+
accessor(accessor?: string | boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
496
|
+
}
|
|
497
|
+
export interface EmptyOptions extends Partial<Record<UniversalPropertyKeys, unknown>> {
|
|
408
498
|
}
|
|
409
499
|
/** @internal */
|
|
410
|
-
export declare class OneToManyOptionsBuilderOnlyMappedBy<
|
|
411
|
-
'
|
|
412
|
-
|
|
413
|
-
entity: () => EntitySchema<TargetValue>;
|
|
414
|
-
} & Omit<OneToManyOptions<any, UnwrapCollection<TargetValue>>, 'mappedBy'>);
|
|
415
|
-
constructor(options: OneToManyOptionsBuilderOnlyMappedBy<TargetValue>['~options']);
|
|
500
|
+
export declare class OneToManyOptionsBuilderOnlyMappedBy<Value extends object> extends UniversalPropertyOptionsBuilder<Value, EmptyOptions & {
|
|
501
|
+
kind: '1:m';
|
|
502
|
+
}, IncludeKeysForOneToManyOptions> {
|
|
416
503
|
/** Point to the owning side property name. */
|
|
417
|
-
mappedBy(mappedBy:
|
|
504
|
+
mappedBy(mappedBy: keyof Value | ((e: Value) => any)): Pick<UniversalPropertyOptionsBuilder<Value, EmptyOptions & {
|
|
505
|
+
kind: '1:m';
|
|
506
|
+
}, IncludeKeysForOneToManyOptions>, IncludeKeysForOneToManyOptions>;
|
|
418
507
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
508
|
+
type EntityTarget = {
|
|
509
|
+
'~entity': any;
|
|
510
|
+
} | EntityClass;
|
|
511
|
+
declare const propertyBuilders: PropertyBuilders;
|
|
512
|
+
type PropertyBuildersOverrideKeys = 'bigint' | 'array' | 'decimal' | 'json' | 'datetime' | 'time' | 'enum';
|
|
513
|
+
export type PropertyBuilders = {
|
|
514
|
+
[K in Exclude<keyof typeof types, PropertyBuildersOverrideKeys>]: () => UniversalPropertyOptionsBuilder<InferPropertyValueType<(typeof types)[K]>, EmptyOptions, IncludeKeysForProperty>;
|
|
515
|
+
} & {
|
|
516
|
+
bigint: <Mode extends 'bigint' | 'number' | 'string' = 'bigint'>(mode?: Mode) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.bigint<Mode>>, EmptyOptions, IncludeKeysForProperty>;
|
|
517
|
+
array: <T = string>(toJsValue?: (i: string) => T, toDbValue?: (i: T) => string) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.array<T>>, EmptyOptions, IncludeKeysForProperty>;
|
|
518
|
+
decimal: <Mode extends 'number' | 'string' = 'string'>(mode?: Mode) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.decimal<Mode>>, EmptyOptions, IncludeKeysForProperty>;
|
|
519
|
+
json: <T>() => UniversalPropertyOptionsBuilder<T, EmptyOptions, IncludeKeysForProperty>;
|
|
520
|
+
formula: <T>(formula: string | FormulaCallback<any>) => UniversalPropertyOptionsBuilder<T, EmptyOptions, IncludeKeysForProperty>;
|
|
521
|
+
datetime: (length?: number) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.datetime>, EmptyOptions, IncludeKeysForProperty>;
|
|
522
|
+
time: (length?: number) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.time>, EmptyOptions, IncludeKeysForProperty>;
|
|
523
|
+
type: <T extends PropertyValueType>(type: T) => UniversalPropertyOptionsBuilder<InferPropertyValueType<T>, EmptyOptions, IncludeKeysForProperty>;
|
|
524
|
+
enum: <const T extends (number | string)[] | (() => Dictionary)>(items?: T) => UniversalPropertyOptionsBuilder<T extends () => Dictionary ? ValueOf<ReturnType<T>> : T extends (infer Value)[] ? Value : T, EmptyOptions, IncludeKeysForEnumOptions>;
|
|
525
|
+
embedded: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
526
|
+
kind: 'embedded';
|
|
527
|
+
}>;
|
|
528
|
+
manyToMany: <Target extends EntityTarget>(target: Target) => PropertyChain<InferEntity<Target>, EmptyOptions & {
|
|
529
|
+
kind: 'm:n';
|
|
530
|
+
}>;
|
|
531
|
+
manyToOne: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
532
|
+
kind: 'm:1';
|
|
533
|
+
}>;
|
|
534
|
+
oneToMany: <Target extends EntityTarget>(target: Target) => PropertyChain<InferEntity<Target>, EmptyOptions & {
|
|
535
|
+
kind: '1:m';
|
|
536
|
+
}>;
|
|
537
|
+
oneToOne: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
422
538
|
kind: '1:1';
|
|
423
|
-
|
|
424
|
-
} & OneToOneOptions<any, UnwrapRef<TargetValue>>);
|
|
425
|
-
constructor(options: OneToOneOptionsBuilder<TargetValue>['~options']);
|
|
426
|
-
/** 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. */
|
|
427
|
-
owner(owner?: boolean): OneToOneOptionsBuilder<TargetValue>;
|
|
428
|
-
/** Point to the inverse side property name. */
|
|
429
|
-
inversedBy(inversedBy: (string & keyof UnwrapRef<TargetValue>) | ((e: UnwrapRef<TargetValue>) => any)): OneToOneOptionsBuilder<TargetValue>;
|
|
430
|
-
/** Wrap the entity in {@apilink Reference} wrapper. */
|
|
431
|
-
ref<T extends boolean = true>(ref?: T): OneToOneOptionsBuilder<T extends true ? Reference<TargetValue> : UnwrapRef<TargetValue>>;
|
|
432
|
-
/** Use this relation as a primary key. */
|
|
433
|
-
primary(primary?: boolean): OneToOneOptionsBuilder<TargetValue>;
|
|
434
|
-
/** Map this relation to the primary key value instead of an entity. */
|
|
435
|
-
mapToPk(mapToPk?: boolean): OneToOneOptionsBuilder<TargetValue>;
|
|
436
|
-
/** 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. */
|
|
437
|
-
ownColumns(...ownColumns: string[]): OneToOneOptionsBuilder<TargetValue>;
|
|
438
|
-
/** What to do when the target entity gets deleted. */
|
|
439
|
-
deleteRule(deleteRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString): OneToOneOptionsBuilder<TargetValue>;
|
|
440
|
-
/** What to do when the reference to the target entity gets updated. */
|
|
441
|
-
updateRule(updateRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString): OneToOneOptionsBuilder<TargetValue>;
|
|
442
|
-
/** 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. */
|
|
443
|
-
deferMode(deferMode: DeferMode | `${DeferMode}`): OneToOneOptionsBuilder<TargetValue>;
|
|
444
|
-
}
|
|
445
|
-
declare const propertyBuilders: {
|
|
446
|
-
bigint: <Mode extends "bigint" | "number" | "string" = "bigint">(mode?: Mode) => PropertyOptionsBuilder<(Mode extends "bigint" ? bigint : Mode extends "number" ? number : string) & {}>;
|
|
447
|
-
array: <T = string>(toJsValue?: (i: string) => T, toDbValue?: (i: T) => string) => PropertyOptionsBuilder<T[]>;
|
|
448
|
-
decimal: <Mode extends "number" | "string" = "string">(mode?: Mode) => PropertyOptionsBuilder<NonNullable<Mode extends "number" ? number : string>>;
|
|
449
|
-
json: <T>() => PropertyOptionsBuilder<T>;
|
|
450
|
-
formula: <T>(formula: string | ((alias: string) => string)) => PropertyOptionsBuilder<T>;
|
|
451
|
-
type: <T extends PropertyValueType>(type: T) => PropertyOptionsBuilder<InferPropertyValueType<T>>;
|
|
452
|
-
enum: <const T extends (number | string)[] | (() => Dictionary)>(items?: T) => EnumOptionsBuilder<T extends () => Dictionary ? ValueOf<ReturnType<T>> : T extends (infer Value)[] ? Value : T>;
|
|
453
|
-
embedded: <Target extends EntitySchema<any, any> | EntitySchema<any, any>[]>(target: Target) => EmbeddedOptionsBuilder<InferEntity<Target extends (infer T)[] ? T : Target>>;
|
|
454
|
-
manyToMany: <Target extends EntitySchema<any, any>>(target: Target) => ManyToManyOptionsBuilder<Collection<InferEntity<Target>, object>>;
|
|
455
|
-
manyToOne: <Target extends EntitySchema<any, any>>(target: Target) => ManyToOneOptionsBuilder<Reference<InferEntity<Target>>>;
|
|
456
|
-
oneToMany: <Target extends EntitySchema<any, any>>(target: Target) => OneToManyOptionsBuilderOnlyMappedBy<Collection<InferEntity<Target>, object>>;
|
|
457
|
-
oneToOne: <Target extends EntitySchema<any, any>>(target: Target) => OneToOneOptionsBuilder<Reference<InferEntity<Target>>>;
|
|
458
|
-
date: () => PropertyOptionsBuilder<string>;
|
|
459
|
-
time: () => PropertyOptionsBuilder<any>;
|
|
460
|
-
datetime: () => PropertyOptionsBuilder<Date>;
|
|
461
|
-
blob: () => PropertyOptionsBuilder<NonNullable<Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike> | null>>;
|
|
462
|
-
uint8array: () => PropertyOptionsBuilder<Uint8Array<ArrayBufferLike>>;
|
|
463
|
-
enumArray: () => PropertyOptionsBuilder<(string | number)[]>;
|
|
464
|
-
integer: () => PropertyOptionsBuilder<number>;
|
|
465
|
-
smallint: () => PropertyOptionsBuilder<number>;
|
|
466
|
-
tinyint: () => PropertyOptionsBuilder<number>;
|
|
467
|
-
mediumint: () => PropertyOptionsBuilder<number>;
|
|
468
|
-
float: () => PropertyOptionsBuilder<number>;
|
|
469
|
-
double: () => PropertyOptionsBuilder<NonNullable<string | number>>;
|
|
470
|
-
boolean: () => PropertyOptionsBuilder<NonNullable<boolean | null | undefined>>;
|
|
471
|
-
character: () => PropertyOptionsBuilder<string>;
|
|
472
|
-
string: () => PropertyOptionsBuilder<string>;
|
|
473
|
-
uuid: () => PropertyOptionsBuilder<string>;
|
|
474
|
-
text: () => PropertyOptionsBuilder<string>;
|
|
475
|
-
interval: () => PropertyOptionsBuilder<string>;
|
|
476
|
-
unknown: () => PropertyOptionsBuilder<{}>;
|
|
539
|
+
}>;
|
|
477
540
|
};
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
541
|
+
/** Own keys + base entity keys (when TBase is not `never`). Guards against `keyof never = string | number | symbol`. */
|
|
542
|
+
type AllKeys<TProperties, TBase> = keyof TProperties | (IsNever<TBase> extends true ? never : keyof TBase);
|
|
543
|
+
export interface EntityMetadataWithProperties<TName extends string, TTableName extends string, TProperties extends Record<string, any>, TPK extends (keyof TProperties)[] | undefined = undefined, TBase = never, TRepository = never, TForceObject extends boolean = false> extends Omit<Partial<EntityMetadata<InferEntityFromProperties<TProperties, TPK, TBase, TRepository>>>, 'properties' | 'extends' | 'primaryKeys' | 'hooks' | 'discriminatorColumn' | 'versionProperty' | 'concurrencyCheckKeys' | 'serializedPrimaryKey' | 'indexes' | 'uniques' | 'repository' | 'orderBy'> {
|
|
544
|
+
name: TName;
|
|
545
|
+
tableName?: TTableName;
|
|
546
|
+
extends?: {
|
|
547
|
+
'~entity': TBase;
|
|
548
|
+
} | EntityCtor<TBase>;
|
|
549
|
+
properties: TProperties | ((properties: PropertyBuilders) => TProperties);
|
|
550
|
+
primaryKeys?: TPK & InferPrimaryKey<TProperties>[];
|
|
551
|
+
hooks?: DefineEntityHooks;
|
|
552
|
+
repository?: () => TRepository;
|
|
553
|
+
forceObject?: TForceObject;
|
|
554
|
+
inheritance?: 'tpt';
|
|
555
|
+
orderBy?: {
|
|
556
|
+
[K in Extract<AllKeys<TProperties, TBase>, string>]?: QueryOrderKeysFlat;
|
|
557
|
+
} | {
|
|
558
|
+
[K in Extract<AllKeys<TProperties, TBase>, string>]?: QueryOrderKeysFlat;
|
|
559
|
+
}[];
|
|
560
|
+
discriminatorColumn?: string;
|
|
561
|
+
versionProperty?: AllKeys<TProperties, TBase>;
|
|
562
|
+
concurrencyCheckKeys?: Set<AllKeys<TProperties, TBase>>;
|
|
563
|
+
serializedPrimaryKey?: AllKeys<TProperties, TBase>;
|
|
564
|
+
indexes?: {
|
|
565
|
+
properties?: keyof TProperties | (keyof TProperties)[];
|
|
566
|
+
name?: string;
|
|
567
|
+
type?: string;
|
|
568
|
+
options?: Dictionary;
|
|
569
|
+
expression?: string | IndexCallback<InferEntityFromProperties<TProperties, TPK, TBase>>;
|
|
570
|
+
}[];
|
|
571
|
+
uniques?: {
|
|
572
|
+
properties?: keyof TProperties | (keyof TProperties)[];
|
|
573
|
+
name?: string;
|
|
574
|
+
options?: Dictionary;
|
|
575
|
+
expression?: string | IndexCallback<InferEntityFromProperties<TProperties, TPK, TBase>>;
|
|
576
|
+
deferMode?: DeferMode | `${DeferMode}`;
|
|
577
|
+
}[];
|
|
578
|
+
}
|
|
579
|
+
export declare function defineEntity<const TName extends string, const TTableName extends string, const TProperties extends Record<string, any>, const TPK extends (keyof TProperties)[] | undefined = undefined, const TBase = never, const TRepository = never, const TForceObject extends boolean = false>(meta: EntityMetadataWithProperties<TName, TTableName, TProperties, TPK, TBase, TRepository, TForceObject>): EntitySchemaWithMeta<TName, TTableName, InferEntityFromProperties<TProperties, TPK, TBase, TRepository, TForceObject>, TBase, TProperties>;
|
|
580
|
+
export declare function defineEntity<const TEntity = any, const TProperties extends Record<string, any> = Record<string, any>, const TClassName extends string = string, const TTableName extends string = string, const TBase = never, const TClass extends EntityCtor = EntityCtor<TEntity>>(meta: Omit<Partial<EntityMetadata<TEntity>>, 'properties' | 'extends' | 'className' | 'tableName' | 'hooks'> & {
|
|
581
|
+
class: TClass;
|
|
582
|
+
className?: TClassName;
|
|
583
|
+
tableName?: TTableName;
|
|
584
|
+
extends?: TBase;
|
|
585
|
+
properties: TProperties | ((properties: PropertyBuilders) => TProperties);
|
|
586
|
+
hooks?: DefineEntityHooks<TEntity>;
|
|
587
|
+
}): EntitySchemaWithMeta<TClassName, TTableName, TEntity, TBase, TProperties, TClass>;
|
|
482
588
|
export declare namespace defineEntity {
|
|
483
|
-
var properties:
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
datetime: () => PropertyOptionsBuilder<Date>;
|
|
499
|
-
blob: () => PropertyOptionsBuilder<NonNullable<Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike> | null>>;
|
|
500
|
-
uint8array: () => PropertyOptionsBuilder<Uint8Array<ArrayBufferLike>>;
|
|
501
|
-
enumArray: () => PropertyOptionsBuilder<(string | number)[]>;
|
|
502
|
-
integer: () => PropertyOptionsBuilder<number>;
|
|
503
|
-
smallint: () => PropertyOptionsBuilder<number>;
|
|
504
|
-
tinyint: () => PropertyOptionsBuilder<number>;
|
|
505
|
-
mediumint: () => PropertyOptionsBuilder<number>;
|
|
506
|
-
float: () => PropertyOptionsBuilder<number>;
|
|
507
|
-
double: () => PropertyOptionsBuilder<NonNullable<string | number>>;
|
|
508
|
-
boolean: () => PropertyOptionsBuilder<NonNullable<boolean | null | undefined>>;
|
|
509
|
-
character: () => PropertyOptionsBuilder<string>;
|
|
510
|
-
string: () => PropertyOptionsBuilder<string>;
|
|
511
|
-
uuid: () => PropertyOptionsBuilder<string>;
|
|
512
|
-
text: () => PropertyOptionsBuilder<string>;
|
|
513
|
-
interval: () => PropertyOptionsBuilder<string>;
|
|
514
|
-
unknown: () => PropertyOptionsBuilder<{}>;
|
|
515
|
-
};
|
|
589
|
+
var properties: PropertyBuilders;
|
|
590
|
+
}
|
|
591
|
+
export { propertyBuilders as p };
|
|
592
|
+
type EntityHookValue<T, K extends keyof EventSubscriber<T>> = (keyof T | NonNullable<EventSubscriber<T>[K]>)[];
|
|
593
|
+
export interface DefineEntityHooks<T = any> {
|
|
594
|
+
onInit?: EntityHookValue<T, 'onInit'>;
|
|
595
|
+
onLoad?: EntityHookValue<T, 'onLoad'>;
|
|
596
|
+
beforeCreate?: EntityHookValue<T, 'beforeCreate'>;
|
|
597
|
+
afterCreate?: EntityHookValue<T, 'afterCreate'>;
|
|
598
|
+
beforeUpdate?: EntityHookValue<T, 'beforeUpdate'>;
|
|
599
|
+
afterUpdate?: EntityHookValue<T, 'afterUpdate'>;
|
|
600
|
+
beforeUpsert?: EntityHookValue<T, 'beforeUpsert'>;
|
|
601
|
+
afterUpsert?: EntityHookValue<T, 'afterUpsert'>;
|
|
602
|
+
beforeDelete?: EntityHookValue<T, 'beforeDelete'>;
|
|
603
|
+
afterDelete?: EntityHookValue<T, 'afterDelete'>;
|
|
516
604
|
}
|
|
517
605
|
type PropertyValueType = PropertyOptions<any>['type'];
|
|
518
606
|
type InferPropertyValueType<T extends PropertyValueType> = T extends string ? InferTypeByString<T> : T extends NumberConstructor ? number : T extends StringConstructor ? string : T extends BooleanConstructor ? boolean : T extends DateConstructor ? Date : T extends ArrayConstructor ? string[] : T extends Constructor<infer TType> ? TType extends Type<infer TValue, any> ? NonNullable<TValue> : TType : T extends Type<infer TValue, any> ? NonNullable<TValue> : any;
|
|
519
|
-
type InferTypeByString<T extends string> = T extends keyof typeof types ? InferJSType<typeof types[T]> : InferColumnType<T>;
|
|
607
|
+
type InferTypeByString<T extends string> = T extends keyof typeof types ? InferJSType<(typeof types)[T]> : InferColumnType<T>;
|
|
520
608
|
type InferJSType<T> = T extends typeof Type<infer TValue, any> ? NonNullable<TValue> : never;
|
|
521
609
|
type InferColumnType<T extends string> = T extends 'int' | 'int4' | 'integer' | 'bigint' | 'int8' | 'int2' | 'tinyint' | 'smallint' | 'mediumint' ? number : T extends 'double' | 'double precision' | 'real' | 'float8' | 'decimal' | 'numeric' | 'float' | 'float4' ? number : T extends 'datetime' | 'time' | 'time with time zone' | 'timestamp' | 'timestamp with time zone' | 'timetz' | 'timestamptz' | 'date' | 'interval' ? Date : T extends 'ObjectId' | 'objectId' | 'character varying' | 'varchar' | 'char' | 'character' | 'uuid' | 'text' | 'tinytext' | 'mediumtext' | 'longtext' | 'enum' ? string : T extends 'boolean' | 'bool' | 'bit' ? boolean : T extends 'blob' | 'tinyblob' | 'mediumblob' | 'longblob' | 'bytea' ? Buffer : T extends 'point' | 'line' | 'lseg' | 'box' | 'circle' | 'path' | 'polygon' | 'geometry' ? number[] : T extends 'tsvector' | 'tsquery' ? string[] : T extends 'json' | 'jsonb' ? any : any;
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
610
|
+
type BaseEntityMethodKeys = 'toObject' | 'toPOJO' | 'serialize' | 'assign' | 'populate' | 'init' | 'toReference';
|
|
611
|
+
export type InferEntityFromProperties<Properties extends Record<string, any>, PK extends (keyof Properties)[] | undefined = undefined, Base = never, Repository = never, ForceObject extends boolean = false> = (IsNever<Base> extends true ? {} : Base extends {
|
|
612
|
+
toObject(...args: any[]): any;
|
|
613
|
+
} ? Pick<IWrappedEntity<{
|
|
614
|
+
-readonly [K in keyof Properties]: InferBuilderValue<MaybeReturnType<Properties[K]>>;
|
|
615
|
+
} & {
|
|
616
|
+
[PrimaryKeyProp]?: InferCombinedPrimaryKey<Properties, PK, Base>;
|
|
617
|
+
} & (IsNever<Repository> extends true ? {} : {
|
|
618
|
+
[EntityRepositoryType]?: Repository extends Constructor<infer R> ? R : Repository;
|
|
619
|
+
}) & Omit<Base, typeof PrimaryKeyProp>>, BaseEntityMethodKeys> : {}) & {
|
|
620
|
+
-readonly [K in keyof Properties]: InferBuilderValue<MaybeReturnType<Properties[K]>>;
|
|
621
|
+
} & {
|
|
622
|
+
[PrimaryKeyProp]?: InferCombinedPrimaryKey<Properties, PK, Base>;
|
|
623
|
+
} & (IsNever<Repository> extends true ? {} : {
|
|
624
|
+
[EntityRepositoryType]?: Repository extends Constructor<infer R> ? R : Repository;
|
|
625
|
+
}) & (IsNever<Base> extends true ? {} : Omit<Base, typeof PrimaryKeyProp>) & (ForceObject extends true ? {
|
|
626
|
+
[Config]?: DefineConfig<{
|
|
627
|
+
forceObject: true;
|
|
628
|
+
}>;
|
|
629
|
+
} : {});
|
|
630
|
+
type InferCombinedPrimaryKey<Properties extends Record<string, any>, PK, Base> = PK extends undefined ? CombinePrimaryKeys<InferPrimaryKey<Properties>, ExtractBasePrimaryKey<Base>> : PK;
|
|
631
|
+
type ExtractBasePrimaryKey<Base> = Base extends {
|
|
632
|
+
[PrimaryKeyProp]?: infer BasePK;
|
|
633
|
+
} ? BasePK : never;
|
|
634
|
+
type CombinePrimaryKeys<ChildPK, BasePK> = [ChildPK] extends [never] ? BasePK : [BasePK] extends [never] ? IsUnion<ChildPK> extends true ? ChildPK[] : ChildPK : ChildPK | BasePK;
|
|
635
|
+
export type InferPrimaryKey<Properties extends Record<string, any>> = {
|
|
636
|
+
[K in keyof Properties]: MaybeReturnType<Properties[K]> extends {
|
|
637
|
+
'~options': {
|
|
638
|
+
primary: true;
|
|
639
|
+
};
|
|
640
|
+
} ? K : never;
|
|
641
|
+
}[keyof Properties];
|
|
525
642
|
type InferBuilderValue<Builder> = Builder extends {
|
|
526
643
|
'~type'?: {
|
|
527
|
-
value: infer
|
|
644
|
+
value: infer Value;
|
|
528
645
|
};
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
type
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
type
|
|
646
|
+
'~options'?: infer Options;
|
|
647
|
+
} ? MaybeHidden<MaybeOpt<MaybeScalarRef<MaybeNullable<MaybeRelationRef<MaybeMapToPk<MaybeArray<Value, Options>, Options>, Options>, Options>, Options>, Options>, Options> : never;
|
|
648
|
+
type MaybeArray<Value, Options> = Options extends {
|
|
649
|
+
array: true;
|
|
650
|
+
} ? Value[] : Value;
|
|
651
|
+
type MaybeMapToPk<Value, Options> = Options extends {
|
|
652
|
+
mapToPk: true;
|
|
653
|
+
} ? Primary<Value> : Value;
|
|
654
|
+
type MaybeNullable<Value, Options> = Options extends {
|
|
655
|
+
nullable: true;
|
|
656
|
+
} ? Value | null | undefined : Value;
|
|
657
|
+
type MaybeRelationRef<Value, Options> = Options extends {
|
|
658
|
+
mapToPk: true;
|
|
659
|
+
} ? Value : Options extends {
|
|
660
|
+
ref: true;
|
|
661
|
+
kind: '1:1';
|
|
662
|
+
} ? Value extends object ? Ref<Value> : never : Options extends {
|
|
663
|
+
ref: true;
|
|
664
|
+
kind: 'm:1';
|
|
665
|
+
} ? Value extends object ? Ref<Value> : never : Options extends {
|
|
666
|
+
kind: '1:m';
|
|
667
|
+
} ? Value extends object ? Collection<Value> : never : Options extends {
|
|
668
|
+
kind: 'm:n';
|
|
669
|
+
} ? Value extends object ? Collection<Value> : never : Value;
|
|
670
|
+
type MaybeScalarRef<Value, Options> = Options extends {
|
|
671
|
+
kind: '1:1' | 'm:1' | '1:m' | 'm:n';
|
|
672
|
+
} ? Value : Options extends {
|
|
673
|
+
ref: true;
|
|
674
|
+
} ? ScalarReference<Value> : Value;
|
|
675
|
+
type MaybeOpt<Value, Options> = Options extends {
|
|
676
|
+
mapToPk: true;
|
|
677
|
+
} ? Value extends Opt<infer OriginalValue> ? OriginalValue : Value : Options extends {
|
|
678
|
+
autoincrement: true;
|
|
679
|
+
} | {
|
|
680
|
+
onCreate: Function;
|
|
681
|
+
} | {
|
|
682
|
+
default: string | string[] | number | number[] | boolean | null | Date | Raw;
|
|
683
|
+
} | {
|
|
684
|
+
defaultRaw: string;
|
|
685
|
+
} | {
|
|
686
|
+
persist: false;
|
|
687
|
+
} | {
|
|
688
|
+
version: true;
|
|
689
|
+
} | {
|
|
690
|
+
formula: string | ((...args: any[]) => any);
|
|
691
|
+
} ? Opt<Value> : Value;
|
|
692
|
+
type MaybeHidden<Value, Options> = Options extends {
|
|
693
|
+
hidden: true;
|
|
694
|
+
} ? Hidden<Value> : Value;
|
|
535
695
|
type ValueOf<T extends Dictionary> = T[keyof T];
|
|
536
|
-
|
|
537
|
-
export {};
|
|
696
|
+
type IsUnion<T, U = T> = T extends U ? ([U] extends [T] ? false : true) : false;
|