@mikro-orm/core 7.0.9 → 7.0.10-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/EntityManager.d.ts +583 -884
- package/EntityManager.js +1899 -1926
- package/MikroORM.d.ts +74 -103
- package/MikroORM.js +178 -177
- package/README.md +1 -1
- package/cache/CacheAdapter.d.ts +36 -36
- package/cache/FileCacheAdapter.d.ts +24 -30
- package/cache/FileCacheAdapter.js +78 -80
- package/cache/GeneratedCacheAdapter.d.ts +20 -18
- package/cache/GeneratedCacheAdapter.js +30 -30
- package/cache/MemoryCacheAdapter.d.ts +20 -18
- package/cache/MemoryCacheAdapter.js +36 -35
- package/cache/NullCacheAdapter.d.ts +16 -16
- package/cache/NullCacheAdapter.js +24 -24
- package/connections/Connection.d.ts +84 -95
- package/connections/Connection.js +168 -165
- package/drivers/DatabaseDriver.d.ts +80 -186
- package/drivers/DatabaseDriver.js +443 -450
- package/drivers/IDatabaseDriver.d.ts +301 -440
- package/entity/BaseEntity.d.ts +83 -120
- package/entity/BaseEntity.js +43 -43
- package/entity/Collection.d.ts +181 -215
- package/entity/Collection.js +724 -730
- package/entity/EntityAssigner.d.ts +77 -88
- package/entity/EntityAssigner.js +230 -231
- package/entity/EntityFactory.d.ts +55 -67
- package/entity/EntityFactory.js +416 -457
- package/entity/EntityHelper.d.ts +23 -35
- package/entity/EntityHelper.js +279 -291
- package/entity/EntityIdentifier.d.ts +4 -4
- package/entity/EntityIdentifier.js +10 -10
- package/entity/EntityLoader.d.ts +72 -98
- package/entity/EntityLoader.js +761 -792
- package/entity/EntityRepository.d.ts +201 -316
- package/entity/EntityRepository.js +213 -213
- package/entity/PolymorphicRef.d.ts +5 -5
- package/entity/PolymorphicRef.js +10 -10
- package/entity/Reference.d.ts +83 -127
- package/entity/Reference.js +277 -281
- package/entity/WrappedEntity.d.ts +72 -115
- package/entity/WrappedEntity.js +166 -168
- package/entity/defineEntity.d.ts +654 -1359
- package/entity/defineEntity.js +518 -527
- package/entity/utils.d.ts +3 -13
- package/entity/utils.js +73 -71
- package/entity/validators.js +43 -43
- package/entity/wrap.js +8 -8
- package/enums.d.ts +253 -258
- package/enums.js +252 -251
- package/errors.d.ts +72 -114
- package/errors.js +253 -350
- package/events/EventManager.d.ts +14 -26
- package/events/EventManager.js +77 -79
- package/events/EventSubscriber.d.ts +29 -29
- package/events/TransactionEventBroadcaster.d.ts +8 -15
- package/events/TransactionEventBroadcaster.js +14 -14
- package/exceptions.d.ts +40 -23
- package/exceptions.js +52 -35
- package/hydration/Hydrator.d.ts +17 -42
- package/hydration/Hydrator.js +43 -43
- package/hydration/ObjectHydrator.d.ts +17 -50
- package/hydration/ObjectHydrator.js +418 -483
- package/index.d.ts +2 -116
- package/index.js +1 -10
- package/logging/DefaultLogger.d.ts +32 -34
- package/logging/DefaultLogger.js +86 -86
- package/logging/Logger.d.ts +41 -41
- package/logging/SimpleLogger.d.ts +11 -13
- package/logging/SimpleLogger.js +22 -22
- package/logging/colors.d.ts +6 -6
- package/logging/colors.js +10 -11
- package/logging/inspect.js +7 -7
- package/metadata/EntitySchema.d.ts +130 -214
- package/metadata/EntitySchema.js +412 -411
- package/metadata/MetadataDiscovery.d.ts +114 -114
- package/metadata/MetadataDiscovery.js +1879 -1957
- package/metadata/MetadataProvider.d.ts +26 -29
- package/metadata/MetadataProvider.js +97 -95
- package/metadata/MetadataStorage.d.ts +32 -38
- package/metadata/MetadataStorage.js +118 -118
- package/metadata/MetadataValidator.d.ts +39 -39
- package/metadata/MetadataValidator.js +338 -381
- package/metadata/discover-entities.d.ts +2 -5
- package/metadata/discover-entities.js +37 -35
- package/metadata/types.d.ts +531 -615
- package/naming-strategy/AbstractNamingStrategy.d.ts +39 -54
- package/naming-strategy/AbstractNamingStrategy.js +85 -90
- package/naming-strategy/EntityCaseNamingStrategy.d.ts +6 -6
- package/naming-strategy/EntityCaseNamingStrategy.js +22 -22
- package/naming-strategy/MongoNamingStrategy.d.ts +6 -6
- package/naming-strategy/MongoNamingStrategy.js +18 -18
- package/naming-strategy/NamingStrategy.d.ts +99 -109
- package/naming-strategy/UnderscoreNamingStrategy.d.ts +7 -7
- package/naming-strategy/UnderscoreNamingStrategy.js +21 -21
- package/not-supported.js +4 -7
- package/package.json +1 -1
- package/platforms/ExceptionConverter.d.ts +1 -1
- package/platforms/ExceptionConverter.js +4 -4
- package/platforms/Platform.d.ts +303 -312
- package/platforms/Platform.js +675 -695
- package/serialization/EntitySerializer.d.ts +26 -49
- package/serialization/EntitySerializer.js +218 -224
- package/serialization/EntityTransformer.d.ts +6 -10
- package/serialization/EntityTransformer.js +217 -219
- package/serialization/SerializationContext.d.ts +23 -27
- package/serialization/SerializationContext.js +105 -105
- package/types/ArrayType.d.ts +8 -8
- package/types/ArrayType.js +33 -33
- package/types/BigIntType.d.ts +10 -17
- package/types/BigIntType.js +37 -37
- package/types/BlobType.d.ts +3 -3
- package/types/BlobType.js +13 -13
- package/types/BooleanType.d.ts +4 -4
- package/types/BooleanType.js +12 -12
- package/types/CharacterType.d.ts +2 -2
- package/types/CharacterType.js +6 -6
- package/types/DateTimeType.d.ts +5 -5
- package/types/DateTimeType.js +15 -15
- package/types/DateType.d.ts +5 -5
- package/types/DateType.js +15 -15
- package/types/DecimalType.d.ts +7 -7
- package/types/DecimalType.js +26 -26
- package/types/DoubleType.d.ts +3 -3
- package/types/DoubleType.js +12 -12
- package/types/EnumArrayType.d.ts +5 -5
- package/types/EnumArrayType.js +24 -24
- package/types/EnumType.d.ts +3 -3
- package/types/EnumType.js +11 -11
- package/types/FloatType.d.ts +3 -3
- package/types/FloatType.js +9 -9
- package/types/IntegerType.d.ts +3 -3
- package/types/IntegerType.js +9 -9
- package/types/IntervalType.d.ts +4 -4
- package/types/IntervalType.js +12 -12
- package/types/JsonType.d.ts +8 -8
- package/types/JsonType.js +32 -32
- package/types/MediumIntType.d.ts +1 -1
- package/types/MediumIntType.js +3 -3
- package/types/SmallIntType.d.ts +3 -3
- package/types/SmallIntType.js +9 -9
- package/types/StringType.d.ts +4 -4
- package/types/StringType.js +12 -12
- package/types/TextType.d.ts +3 -3
- package/types/TextType.js +9 -9
- package/types/TimeType.d.ts +5 -5
- package/types/TimeType.js +17 -17
- package/types/TinyIntType.d.ts +3 -3
- package/types/TinyIntType.js +10 -10
- package/types/Type.d.ts +79 -83
- package/types/Type.js +82 -82
- package/types/Uint8ArrayType.d.ts +4 -4
- package/types/Uint8ArrayType.js +21 -21
- package/types/UnknownType.d.ts +4 -4
- package/types/UnknownType.js +12 -12
- package/types/UuidType.d.ts +5 -5
- package/types/UuidType.js +19 -19
- package/types/index.d.ts +49 -75
- package/types/index.js +26 -52
- package/typings.d.ts +741 -1254
- package/typings.js +233 -244
- package/unit-of-work/ChangeSet.d.ts +26 -26
- package/unit-of-work/ChangeSet.js +56 -56
- package/unit-of-work/ChangeSetComputer.d.ts +12 -12
- package/unit-of-work/ChangeSetComputer.js +179 -187
- package/unit-of-work/ChangeSetPersister.d.ts +50 -69
- package/unit-of-work/ChangeSetPersister.js +442 -465
- package/unit-of-work/CommitOrderCalculator.d.ts +40 -40
- package/unit-of-work/CommitOrderCalculator.js +88 -89
- package/unit-of-work/IdentityMap.d.ts +31 -31
- package/unit-of-work/IdentityMap.js +105 -105
- package/unit-of-work/UnitOfWork.d.ts +141 -181
- package/unit-of-work/UnitOfWork.js +1222 -1236
- package/utils/AbstractMigrator.d.ts +91 -111
- package/utils/AbstractMigrator.js +275 -275
- package/utils/AbstractSchemaGenerator.d.ts +34 -43
- package/utils/AbstractSchemaGenerator.js +122 -121
- package/utils/AsyncContext.d.ts +3 -3
- package/utils/AsyncContext.js +35 -34
- package/utils/Configuration.d.ts +808 -852
- package/utils/Configuration.js +344 -359
- package/utils/Cursor.d.ts +22 -40
- package/utils/Cursor.js +127 -135
- package/utils/DataloaderUtils.d.ts +43 -58
- package/utils/DataloaderUtils.js +198 -203
- package/utils/EntityComparator.d.ts +82 -99
- package/utils/EntityComparator.js +737 -829
- package/utils/NullHighlighter.d.ts +1 -1
- package/utils/NullHighlighter.js +3 -3
- package/utils/QueryHelper.d.ts +51 -79
- package/utils/QueryHelper.js +361 -372
- package/utils/RawQueryFragment.d.ts +34 -50
- package/utils/RawQueryFragment.js +105 -107
- package/utils/RequestContext.d.ts +32 -32
- package/utils/RequestContext.js +53 -52
- package/utils/TransactionContext.d.ts +16 -16
- package/utils/TransactionContext.js +27 -27
- package/utils/TransactionManager.d.ts +58 -58
- package/utils/TransactionManager.js +197 -199
- package/utils/Utils.d.ts +145 -204
- package/utils/Utils.js +815 -815
- package/utils/clone.js +114 -105
- package/utils/env-vars.js +88 -90
- package/utils/fs-utils.d.ts +15 -15
- package/utils/fs-utils.js +181 -180
- package/utils/upsert-utils.d.ts +5 -20
- package/utils/upsert-utils.js +116 -114
package/entity/defineEntity.d.ts
CHANGED
|
@@ -1,70 +1,17 @@
|
|
|
1
1
|
import type { EntityManager } from '../EntityManager.js';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
PropertyOptions,
|
|
5
|
-
ReferenceOptions,
|
|
6
|
-
EnumOptions,
|
|
7
|
-
EmbeddedOptions,
|
|
8
|
-
ManyToOneOptions,
|
|
9
|
-
OneToManyOptions,
|
|
10
|
-
OneToOneOptions,
|
|
11
|
-
ManyToManyOptions,
|
|
12
|
-
IndexColumnOptions,
|
|
13
|
-
} from '../metadata/types.js';
|
|
14
|
-
import type {
|
|
15
|
-
AnyString,
|
|
16
|
-
GeneratedColumnCallback,
|
|
17
|
-
Constructor,
|
|
18
|
-
CheckCallback,
|
|
19
|
-
FilterQuery,
|
|
20
|
-
EntityName,
|
|
21
|
-
Dictionary,
|
|
22
|
-
EntityMetadata,
|
|
23
|
-
PrimaryKeyProp,
|
|
24
|
-
EntityRepositoryType,
|
|
25
|
-
Hidden,
|
|
26
|
-
Opt,
|
|
27
|
-
Primary,
|
|
28
|
-
EntityClass,
|
|
29
|
-
EntitySchemaWithMeta,
|
|
30
|
-
InferEntity,
|
|
31
|
-
MaybeReturnType,
|
|
32
|
-
Ref,
|
|
33
|
-
IndexCallback,
|
|
34
|
-
FormulaCallback,
|
|
35
|
-
EntityCtor,
|
|
36
|
-
IsNever,
|
|
37
|
-
IWrappedEntity,
|
|
38
|
-
DefineConfig,
|
|
39
|
-
Config,
|
|
40
|
-
MaybePromise,
|
|
41
|
-
} from '../typings.js';
|
|
2
|
+
import type { ColumnType, PropertyOptions, ReferenceOptions, EnumOptions, EmbeddedOptions, ManyToOneOptions, OneToManyOptions, OneToOneOptions, ManyToManyOptions, IndexColumnOptions } 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, MaybePromise } from '../typings.js';
|
|
42
4
|
import type { Raw } from '../utils/RawQueryFragment.js';
|
|
43
5
|
import type { ScalarReference } from './Reference.js';
|
|
44
6
|
import type { SerializeOptions } from '../serialization/EntitySerializer.js';
|
|
45
|
-
import type {
|
|
46
|
-
Cascade,
|
|
47
|
-
DeferMode,
|
|
48
|
-
EmbeddedPrefixMode,
|
|
49
|
-
LoadStrategy,
|
|
50
|
-
QueryOrderKeysFlat,
|
|
51
|
-
QueryOrderMap,
|
|
52
|
-
} from '../enums.js';
|
|
7
|
+
import type { Cascade, DeferMode, EmbeddedPrefixMode, LoadStrategy, QueryOrderKeysFlat, QueryOrderMap } from '../enums.js';
|
|
53
8
|
import type { EventSubscriber } from '../events/EventSubscriber.js';
|
|
54
9
|
import type { IType, Type } from '../types/Type.js';
|
|
55
10
|
import { types } from '../types/index.js';
|
|
56
11
|
import type { Collection } from './Collection.js';
|
|
57
12
|
import type { FilterOptions, FindOptions, FindOneOptions } from '../drivers/IDatabaseDriver.js';
|
|
58
13
|
/** Union of all option keys supported across all property definition types (scalar, enum, embedded, relations). */
|
|
59
|
-
export type UniversalPropertyKeys =
|
|
60
|
-
| keyof PropertyOptions<any>
|
|
61
|
-
| keyof EnumOptions<any>
|
|
62
|
-
| keyof EmbeddedOptions<any, any>
|
|
63
|
-
| keyof ReferenceOptions<any, any>
|
|
64
|
-
| keyof ManyToOneOptions<any, any>
|
|
65
|
-
| keyof OneToManyOptions<any, any>
|
|
66
|
-
| keyof OneToOneOptions<any, any>
|
|
67
|
-
| keyof ManyToManyOptions<any, any>;
|
|
14
|
+
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>;
|
|
68
15
|
type BuilderExtraKeys = '~options' | '~type' | '$type' | 'strictNullable';
|
|
69
16
|
type ExcludeKeys = 'entity' | 'items';
|
|
70
17
|
type BuilderKeys = Exclude<UniversalPropertyKeys, ExcludeKeys> | BuilderExtraKeys;
|
|
@@ -72,1385 +19,733 @@ type IncludeKeysForProperty = Exclude<keyof PropertyOptions<any>, ExcludeKeys> |
|
|
|
72
19
|
type IncludeKeysForEnumOptions = Exclude<keyof EnumOptions<any>, ExcludeKeys> | BuilderExtraKeys;
|
|
73
20
|
type IncludeKeysForOneToManyOptions = Exclude<keyof OneToManyOptions<any, any>, ExcludeKeys> | BuilderExtraKeys;
|
|
74
21
|
type HasKind<Options, K extends string> = Options extends {
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
? X extends K
|
|
78
|
-
? true
|
|
79
|
-
: false
|
|
80
|
-
: false;
|
|
22
|
+
kind: infer X extends string;
|
|
23
|
+
} ? X extends K ? true : false : false;
|
|
81
24
|
/** Lightweight chain result type for property builders - reduces type instantiation cost by avoiding full class resolution. */
|
|
82
25
|
export interface PropertyChain<Value, Options> {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
Value,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
Value,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
Value,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
Value,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
Value,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Value,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
Value,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
Value,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
Value,
|
|
169
|
-
Options
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
Value,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
Value,
|
|
181
|
-
Options
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
Value,
|
|
187
|
-
Omit<Options, '
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
serializedPrimaryKey(serializedPrimaryKey?: boolean): PropertyChain<Value, Options>;
|
|
210
|
-
serializer(serializer: (value: Value, options?: SerializeOptions<any>) => any): PropertyChain<Value, Options>;
|
|
211
|
-
serializedName(serializedName: string): PropertyChain<Value, Options>;
|
|
212
|
-
groups(...groups: string[]): PropertyChain<Value, Options>;
|
|
213
|
-
customOrder(...customOrder: string[] | number[] | boolean[]): PropertyChain<Value, Options>;
|
|
214
|
-
extra(extra: string): PropertyChain<Value, Options>;
|
|
215
|
-
ignoreSchemaChanges(...ignoreSchemaChanges: ('type' | 'extra' | 'default')[]): PropertyChain<Value, Options>;
|
|
216
|
-
index(index?: boolean | string): PropertyChain<Value, Options>;
|
|
217
|
-
unique(unique?: boolean | string): PropertyChain<Value, Options>;
|
|
218
|
-
comment(comment: string): PropertyChain<Value, Options>;
|
|
219
|
-
accessor(accessor?: string | boolean): PropertyChain<Value, Options>;
|
|
220
|
-
eager(
|
|
221
|
-
eager?: boolean,
|
|
222
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
223
|
-
cascade(
|
|
224
|
-
...cascade: Cascade[]
|
|
225
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
226
|
-
strategy(
|
|
227
|
-
strategy: LoadStrategy | `${LoadStrategy}`,
|
|
228
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
229
|
-
filters(
|
|
230
|
-
filters: FilterOptions,
|
|
231
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
232
|
-
mappedBy(
|
|
233
|
-
mappedBy: (keyof Value & string) | ((e: Value) => any),
|
|
234
|
-
): HasKind<Options, '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
235
|
-
inversedBy(
|
|
236
|
-
inversedBy: (keyof Value & string) | ((e: Value) => any),
|
|
237
|
-
): HasKind<Options, 'm:1' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
238
|
-
owner(): HasKind<Options, '1:1' | 'm:n'> extends true
|
|
239
|
-
? PropertyChain<
|
|
240
|
-
Value,
|
|
241
|
-
Omit<Options, 'owner'> & {
|
|
242
|
-
owner: true;
|
|
243
|
-
}
|
|
244
|
-
>
|
|
245
|
-
: never;
|
|
246
|
-
mapToPk(): HasKind<Options, 'm:1' | '1:1'> extends true
|
|
247
|
-
? PropertyChain<
|
|
248
|
-
Value,
|
|
249
|
-
Omit<Options, 'mapToPk'> & {
|
|
250
|
-
mapToPk: true;
|
|
251
|
-
}
|
|
252
|
-
>
|
|
253
|
-
: never;
|
|
254
|
-
orphanRemoval(
|
|
255
|
-
orphanRemoval?: boolean,
|
|
256
|
-
): HasKind<Options, '1:m' | '1:1'> extends true ? PropertyChain<Value, Options> : never;
|
|
257
|
-
discriminator(
|
|
258
|
-
discriminator: string,
|
|
259
|
-
): HasKind<Options, 'm:1' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
260
|
-
discriminatorMap(
|
|
261
|
-
discriminatorMap: Dictionary<string>,
|
|
262
|
-
): HasKind<Options, 'm:1' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
263
|
-
pivotTable(pivotTable: string): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
264
|
-
pivotEntity(
|
|
265
|
-
pivotEntity: () => EntityName,
|
|
266
|
-
): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
267
|
-
fixedOrder(fixedOrder?: boolean): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
268
|
-
fixedOrderColumn(
|
|
269
|
-
fixedOrderColumn: string,
|
|
270
|
-
): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
271
|
-
array(): HasKind<Options, 'embedded' | 'enum'> extends true
|
|
272
|
-
? PropertyChain<
|
|
273
|
-
Value,
|
|
274
|
-
Omit<Options, 'array'> & {
|
|
275
|
-
array: true;
|
|
276
|
-
}
|
|
277
|
-
>
|
|
278
|
-
: never;
|
|
279
|
-
prefix(prefix: string | boolean): HasKind<Options, 'embedded'> extends true ? PropertyChain<Value, Options> : never;
|
|
280
|
-
prefixMode(
|
|
281
|
-
prefixMode: EmbeddedPrefixMode,
|
|
282
|
-
): HasKind<Options, 'embedded'> extends true ? PropertyChain<Value, Options> : never;
|
|
283
|
-
object(object?: boolean): HasKind<Options, 'embedded'> extends true ? PropertyChain<Value, Options> : never;
|
|
284
|
-
nativeEnumName(nativeEnumName: string): HasKind<Options, 'enum'> extends true ? PropertyChain<Value, Options> : never;
|
|
285
|
-
orderBy(
|
|
286
|
-
...orderBy: QueryOrderMap<object>[]
|
|
287
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
288
|
-
where(
|
|
289
|
-
...where: FilterQuery<object>[]
|
|
290
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
291
|
-
joinColumn(
|
|
292
|
-
joinColumn: string,
|
|
293
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
294
|
-
joinColumns(
|
|
295
|
-
...joinColumns: string[]
|
|
296
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
297
|
-
inverseJoinColumn(
|
|
298
|
-
inverseJoinColumn: string,
|
|
299
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
300
|
-
inverseJoinColumns(
|
|
301
|
-
...inverseJoinColumns: string[]
|
|
302
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
303
|
-
referenceColumnName(
|
|
304
|
-
referenceColumnName: string,
|
|
305
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
306
|
-
referencedColumnNames(
|
|
307
|
-
...referencedColumnNames: string[]
|
|
308
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
309
|
-
ownColumns(
|
|
310
|
-
...ownColumns: string[]
|
|
311
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
312
|
-
targetKey(
|
|
313
|
-
targetKey: keyof Value & string,
|
|
314
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
315
|
-
deleteRule(
|
|
316
|
-
deleteRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString,
|
|
317
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
318
|
-
updateRule(
|
|
319
|
-
updateRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString,
|
|
320
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
321
|
-
deferMode(
|
|
322
|
-
deferMode: DeferMode | `${DeferMode}`,
|
|
323
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
324
|
-
createForeignKeyConstraint(
|
|
325
|
-
createForeignKeyConstraint?: boolean,
|
|
326
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
327
|
-
foreignKeyName(
|
|
328
|
-
foreignKeyName: string,
|
|
329
|
-
): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
26
|
+
'~type'?: {
|
|
27
|
+
value: Value;
|
|
28
|
+
};
|
|
29
|
+
'~options': Options;
|
|
30
|
+
$type<T>(): PropertyChain<T, Options>;
|
|
31
|
+
$type<Runtime, Raw, Serialized = Raw>(): PropertyChain<IType<Runtime, Raw, Serialized>, Options>;
|
|
32
|
+
nullable(): PropertyChain<Value, Omit<Options, 'nullable'> & {
|
|
33
|
+
nullable: true;
|
|
34
|
+
}>;
|
|
35
|
+
strictNullable(): PropertyChain<Value, Omit<Options, 'nullable' | 'strictNullable'> & {
|
|
36
|
+
nullable: true;
|
|
37
|
+
strictNullable: true;
|
|
38
|
+
}>;
|
|
39
|
+
ref(): PropertyChain<Value, Omit<Options, 'ref'> & {
|
|
40
|
+
ref: true;
|
|
41
|
+
}>;
|
|
42
|
+
primary(): PropertyChain<Value, Omit<Options, 'primary'> & {
|
|
43
|
+
primary: true;
|
|
44
|
+
}>;
|
|
45
|
+
hidden(): PropertyChain<Value, Omit<Options, 'hidden'> & {
|
|
46
|
+
hidden: true;
|
|
47
|
+
}>;
|
|
48
|
+
autoincrement(): PropertyChain<Value, Omit<Options, 'autoincrement'> & {
|
|
49
|
+
autoincrement: true;
|
|
50
|
+
}>;
|
|
51
|
+
autoincrement(autoincrement: false): PropertyChain<Value, Omit<Options, 'autoincrement'> & {
|
|
52
|
+
autoincrement: false;
|
|
53
|
+
}>;
|
|
54
|
+
persist(): PropertyChain<Value, Omit<Options, 'persist'> & {
|
|
55
|
+
persist: true;
|
|
56
|
+
}>;
|
|
57
|
+
persist(persist: false): PropertyChain<Value, Omit<Options, 'persist'> & {
|
|
58
|
+
persist: false;
|
|
59
|
+
}>;
|
|
60
|
+
version(): PropertyChain<Value, Omit<Options, 'version'> & {
|
|
61
|
+
version: true;
|
|
62
|
+
}>;
|
|
63
|
+
lazy(): PropertyChain<Value, Options>;
|
|
64
|
+
name<T extends string>(name: T): PropertyChain<Value, Omit<Options, 'fieldName'> & {
|
|
65
|
+
fieldName: T;
|
|
66
|
+
}>;
|
|
67
|
+
fieldName<T extends string>(fieldName: T): PropertyChain<Value, Omit<Options, 'fieldName'> & {
|
|
68
|
+
fieldName: T;
|
|
69
|
+
}>;
|
|
70
|
+
onCreate(onCreate: (entity: any, em: EntityManager) => Value): PropertyChain<Value, Options & {
|
|
71
|
+
onCreate: (...args: any[]) => any;
|
|
72
|
+
}>;
|
|
73
|
+
default(defaultValue: string | string[] | number | number[] | boolean | null | Date | Raw): PropertyChain<Value, Omit<Options, 'default'> & {
|
|
74
|
+
default: any;
|
|
75
|
+
}>;
|
|
76
|
+
defaultRaw(defaultRaw: string): PropertyChain<Value, Options & {
|
|
77
|
+
defaultRaw: string;
|
|
78
|
+
}>;
|
|
79
|
+
formula(formula: string | FormulaCallback<any>): PropertyChain<Value, Omit<Options, 'formula'> & {
|
|
80
|
+
formula: any;
|
|
81
|
+
}>;
|
|
82
|
+
onUpdate(onUpdate: (entity: any, em: EntityManager) => Value): PropertyChain<Value, Options>;
|
|
83
|
+
fieldNames(...fieldNames: string[]): PropertyChain<Value, Options>;
|
|
84
|
+
type(type: PropertyValueType): PropertyChain<Value, Options>;
|
|
85
|
+
runtimeType(runtimeType: string): PropertyChain<Value, Options>;
|
|
86
|
+
columnType(columnType: ColumnType | AnyString): PropertyChain<Value, Options>;
|
|
87
|
+
columnTypes(...columnTypes: (ColumnType | AnyString)[]): PropertyChain<Value, Options>;
|
|
88
|
+
length(length: number): PropertyChain<Value, Options>;
|
|
89
|
+
precision(precision: number): PropertyChain<Value, Options>;
|
|
90
|
+
scale(scale: number): PropertyChain<Value, Options>;
|
|
91
|
+
returning(returning?: boolean): PropertyChain<Value, Options>;
|
|
92
|
+
unsigned(unsigned?: boolean): PropertyChain<Value, Options>;
|
|
93
|
+
hydrate(hydrate?: boolean): PropertyChain<Value, Options>;
|
|
94
|
+
concurrencyCheck(concurrencyCheck?: boolean): PropertyChain<Value, Options>;
|
|
95
|
+
generated(generated: string | GeneratedColumnCallback<any>): PropertyChain<Value, Options>;
|
|
96
|
+
check(check: string | CheckCallback<any>): PropertyChain<Value, Options>;
|
|
97
|
+
setter(setter?: boolean): PropertyChain<Value, Options>;
|
|
98
|
+
getter(getter?: boolean): PropertyChain<Value, Options>;
|
|
99
|
+
getterName(getterName: string): PropertyChain<Value, Options>;
|
|
100
|
+
serializedPrimaryKey(serializedPrimaryKey?: boolean): PropertyChain<Value, Options>;
|
|
101
|
+
serializer(serializer: (value: Value, options?: SerializeOptions<any>) => any): PropertyChain<Value, Options>;
|
|
102
|
+
serializedName(serializedName: string): PropertyChain<Value, Options>;
|
|
103
|
+
groups(...groups: string[]): PropertyChain<Value, Options>;
|
|
104
|
+
customOrder(...customOrder: string[] | number[] | boolean[]): PropertyChain<Value, Options>;
|
|
105
|
+
extra(extra: string): PropertyChain<Value, Options>;
|
|
106
|
+
ignoreSchemaChanges(...ignoreSchemaChanges: ('type' | 'extra' | 'default')[]): PropertyChain<Value, Options>;
|
|
107
|
+
index(index?: boolean | string): PropertyChain<Value, Options>;
|
|
108
|
+
unique(unique?: boolean | string): PropertyChain<Value, Options>;
|
|
109
|
+
comment(comment: string): PropertyChain<Value, Options>;
|
|
110
|
+
accessor(accessor?: string | boolean): PropertyChain<Value, Options>;
|
|
111
|
+
eager(eager?: boolean): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
112
|
+
cascade(...cascade: Cascade[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
113
|
+
strategy(strategy: LoadStrategy | `${LoadStrategy}`): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
114
|
+
filters(filters: FilterOptions): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
115
|
+
mappedBy(mappedBy: (keyof Value & string) | ((e: Value) => any)): HasKind<Options, '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
116
|
+
inversedBy(inversedBy: (keyof Value & string) | ((e: Value) => any)): HasKind<Options, 'm:1' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
117
|
+
owner(): HasKind<Options, '1:1' | 'm:n'> extends true ? PropertyChain<Value, Omit<Options, 'owner'> & {
|
|
118
|
+
owner: true;
|
|
119
|
+
}> : never;
|
|
120
|
+
mapToPk(): HasKind<Options, 'm:1' | '1:1'> extends true ? PropertyChain<Value, Omit<Options, 'mapToPk'> & {
|
|
121
|
+
mapToPk: true;
|
|
122
|
+
}> : never;
|
|
123
|
+
orphanRemoval(orphanRemoval?: boolean): HasKind<Options, '1:m' | '1:1'> extends true ? PropertyChain<Value, Options> : never;
|
|
124
|
+
discriminator(discriminator: string): HasKind<Options, 'm:1' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
125
|
+
discriminatorMap(discriminatorMap: Dictionary<string>): HasKind<Options, 'm:1' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
126
|
+
pivotTable(pivotTable: string): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
127
|
+
pivotEntity(pivotEntity: () => EntityName): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
128
|
+
fixedOrder(fixedOrder?: boolean): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
129
|
+
fixedOrderColumn(fixedOrderColumn: string): HasKind<Options, 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
130
|
+
array(): HasKind<Options, 'embedded' | 'enum'> extends true ? PropertyChain<Value, Omit<Options, 'array'> & {
|
|
131
|
+
array: true;
|
|
132
|
+
}> : never;
|
|
133
|
+
prefix(prefix: string | boolean): HasKind<Options, 'embedded'> extends true ? PropertyChain<Value, Options> : never;
|
|
134
|
+
prefixMode(prefixMode: EmbeddedPrefixMode): HasKind<Options, 'embedded'> extends true ? PropertyChain<Value, Options> : never;
|
|
135
|
+
object(object?: boolean): HasKind<Options, 'embedded'> extends true ? PropertyChain<Value, Options> : never;
|
|
136
|
+
nativeEnumName(nativeEnumName: string): HasKind<Options, 'enum'> extends true ? PropertyChain<Value, Options> : never;
|
|
137
|
+
orderBy(...orderBy: QueryOrderMap<object>[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
138
|
+
where(...where: FilterQuery<object>[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
139
|
+
joinColumn(joinColumn: string): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
140
|
+
joinColumns(...joinColumns: string[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
141
|
+
inverseJoinColumn(inverseJoinColumn: string): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
142
|
+
inverseJoinColumns(...inverseJoinColumns: string[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
143
|
+
referenceColumnName(referenceColumnName: string): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
144
|
+
referencedColumnNames(...referencedColumnNames: string[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
145
|
+
ownColumns(...ownColumns: string[]): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
146
|
+
targetKey(targetKey: keyof Value & string): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
147
|
+
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;
|
|
148
|
+
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;
|
|
149
|
+
deferMode(deferMode: DeferMode | `${DeferMode}`): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
150
|
+
createForeignKeyConstraint(createForeignKeyConstraint?: boolean): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
151
|
+
foreignKeyName(foreignKeyName: string): HasKind<Options, 'm:1' | '1:m' | '1:1' | 'm:n'> extends true ? PropertyChain<Value, Options> : never;
|
|
330
152
|
}
|
|
331
153
|
/** @internal */
|
|
332
|
-
export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys extends BuilderKeys> implements Record<
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
Options,
|
|
359
|
-
IncludeKeys
|
|
360
|
-
>;
|
|
361
|
-
/**
|
|
362
|
-
* Alias for `fieldName`.
|
|
363
|
-
*/
|
|
364
|
-
name<T extends string>(
|
|
365
|
-
name: T,
|
|
366
|
-
): Pick<
|
|
367
|
-
UniversalPropertyOptionsBuilder<
|
|
368
|
-
Value,
|
|
369
|
-
Omit<Options, 'fieldName'> & {
|
|
154
|
+
export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys extends BuilderKeys> implements Record<Exclude<UniversalPropertyKeys, ExcludeKeys>, any> {
|
|
155
|
+
'~options': Options;
|
|
156
|
+
'~type'?: {
|
|
157
|
+
value: Value;
|
|
158
|
+
};
|
|
159
|
+
constructor(options: any);
|
|
160
|
+
protected assignOptions(options: EmptyOptions): any;
|
|
161
|
+
/**
|
|
162
|
+
* Set the TypeScript type of the property.
|
|
163
|
+
*/
|
|
164
|
+
$type<T>(): UniversalPropertyOptionsBuilder<T, Options, IncludeKeys>;
|
|
165
|
+
/**
|
|
166
|
+
* Set the TypeScript type for custom types that map to objects.
|
|
167
|
+
* This method provides type safety for custom types by specifying the runtime type,
|
|
168
|
+
* raw database value type, and optional serialized type.
|
|
169
|
+
*
|
|
170
|
+
* @template Runtime - The runtime type that the property will have in JavaScript
|
|
171
|
+
* @template Raw - The raw value type as stored in the database
|
|
172
|
+
* @template Serialized - The type when serialized (defaults to Raw)
|
|
173
|
+
* @returns PropertyOptionsBuilder with IType wrapper for type safety
|
|
174
|
+
*/
|
|
175
|
+
$type<Runtime, Raw, Serialized = Raw>(): UniversalPropertyOptionsBuilder<IType<Runtime, Raw, Serialized>, Options, IncludeKeys>;
|
|
176
|
+
/**
|
|
177
|
+
* Alias for `fieldName`.
|
|
178
|
+
*/
|
|
179
|
+
name<T extends string>(name: T): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'fieldName'> & {
|
|
370
180
|
fieldName: T;
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
*
|
|
379
|
-
* @see https://mikro-orm.io/docs/naming-strategy
|
|
380
|
-
*/
|
|
381
|
-
fieldName<T extends string>(
|
|
382
|
-
fieldName: T,
|
|
383
|
-
): Pick<
|
|
384
|
-
UniversalPropertyOptionsBuilder<
|
|
385
|
-
Value,
|
|
386
|
-
Omit<Options, 'fieldName'> & {
|
|
181
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
182
|
+
/**
|
|
183
|
+
* Specify database column name for this property.
|
|
184
|
+
*
|
|
185
|
+
* @see https://mikro-orm.io/docs/naming-strategy
|
|
186
|
+
*/
|
|
187
|
+
fieldName<T extends string>(fieldName: T): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'fieldName'> & {
|
|
387
188
|
fieldName: T;
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
*/
|
|
433
|
-
precision(precision: number): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
434
|
-
/**
|
|
435
|
-
* Set scale of database column to represents the number of digits after the decimal point. (SQL only)
|
|
436
|
-
*/
|
|
437
|
-
scale(scale: number): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
438
|
-
/**
|
|
439
|
-
* Explicitly specify the auto increment of the primary key.
|
|
440
|
-
*/
|
|
441
|
-
autoincrement(): Pick<
|
|
442
|
-
UniversalPropertyOptionsBuilder<
|
|
443
|
-
Value,
|
|
444
|
-
Omit<Options, 'autoincrement'> & {
|
|
189
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
190
|
+
/**
|
|
191
|
+
* Specify database column names for this property.
|
|
192
|
+
* Same as `fieldName` but for composite FKs.
|
|
193
|
+
*
|
|
194
|
+
* @see https://mikro-orm.io/docs/naming-strategy
|
|
195
|
+
*/
|
|
196
|
+
fieldNames(...fieldNames: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
197
|
+
/**
|
|
198
|
+
* 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)
|
|
199
|
+
*/
|
|
200
|
+
columnType(columnType: ColumnType | AnyString): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
201
|
+
/**
|
|
202
|
+
* 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)
|
|
203
|
+
*/
|
|
204
|
+
columnTypes(...columnTypes: (ColumnType | AnyString)[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
205
|
+
/**
|
|
206
|
+
* Explicitly specify the runtime type.
|
|
207
|
+
*
|
|
208
|
+
* @see https://mikro-orm.io/docs/metadata-providers
|
|
209
|
+
* @see https://mikro-orm.io/docs/custom-types
|
|
210
|
+
*/
|
|
211
|
+
type<TType extends PropertyValueType>(type: TType): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
212
|
+
/**
|
|
213
|
+
* 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`.
|
|
214
|
+
* 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`.
|
|
215
|
+
*/
|
|
216
|
+
runtimeType(runtimeType: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
217
|
+
/**
|
|
218
|
+
* 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)
|
|
219
|
+
*/
|
|
220
|
+
length(length: number): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
221
|
+
/**
|
|
222
|
+
* Set precision of database column to represent the number of significant digits. (SQL only)
|
|
223
|
+
*/
|
|
224
|
+
precision(precision: number): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
225
|
+
/**
|
|
226
|
+
* Set scale of database column to represents the number of digits after the decimal point. (SQL only)
|
|
227
|
+
*/
|
|
228
|
+
scale(scale: number): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
229
|
+
/**
|
|
230
|
+
* Explicitly specify the auto increment of the primary key.
|
|
231
|
+
*/
|
|
232
|
+
autoincrement(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'autoincrement'> & {
|
|
445
233
|
autoincrement: true;
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
>,
|
|
449
|
-
IncludeKeys
|
|
450
|
-
>;
|
|
451
|
-
autoincrement(autoincrement: false): Pick<
|
|
452
|
-
UniversalPropertyOptionsBuilder<
|
|
453
|
-
Value,
|
|
454
|
-
Omit<Options, 'autoincrement'> & {
|
|
234
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
235
|
+
autoincrement(autoincrement: false): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'autoincrement'> & {
|
|
455
236
|
autoincrement: false;
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Automatically set the property value when entity gets created, executed during flush operation.
|
|
467
|
-
*/
|
|
468
|
-
onCreate(onCreate: (entity: any, em: EntityManager) => Value): Pick<
|
|
469
|
-
UniversalPropertyOptionsBuilder<
|
|
470
|
-
Value,
|
|
471
|
-
Options & {
|
|
237
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
238
|
+
/**
|
|
239
|
+
* Add the property to the `returning` statement.
|
|
240
|
+
*/
|
|
241
|
+
returning(returning?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
242
|
+
/**
|
|
243
|
+
* Automatically set the property value when entity gets created, executed during flush operation.
|
|
244
|
+
*/
|
|
245
|
+
onCreate(onCreate: (entity: any, em: EntityManager) => Value): Pick<UniversalPropertyOptionsBuilder<Value, Options & {
|
|
472
246
|
onCreate: (...args: any[]) => any;
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
484
|
-
/**
|
|
485
|
-
* Specify default column value for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}.
|
|
486
|
-
* This is a runtime value, assignable to the entity property. (SQL only)
|
|
487
|
-
*/
|
|
488
|
-
default<T extends string | string[] | number | number[] | boolean | null | Date | Raw>(
|
|
489
|
-
defaultValue: T,
|
|
490
|
-
): Pick<
|
|
491
|
-
UniversalPropertyOptionsBuilder<
|
|
492
|
-
Value,
|
|
493
|
-
Omit<Options, 'default'> & {
|
|
247
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
248
|
+
/**
|
|
249
|
+
* Automatically update the property value every time entity gets updated, executed during flush operation.
|
|
250
|
+
*/
|
|
251
|
+
onUpdate(onUpdate: (entity: any, em: EntityManager) => Value): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
252
|
+
/**
|
|
253
|
+
* Specify default column value for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}.
|
|
254
|
+
* This is a runtime value, assignable to the entity property. (SQL only)
|
|
255
|
+
*/
|
|
256
|
+
default<T extends string | string[] | number | number[] | boolean | null | Date | Raw>(defaultValue: T): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'default'> & {
|
|
494
257
|
default: T;
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
* Specify SQL functions for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
502
|
-
* Since v4 you should use defaultRaw for SQL functions. e.g. now()
|
|
503
|
-
*/
|
|
504
|
-
defaultRaw(defaultRaw: string): Pick<
|
|
505
|
-
UniversalPropertyOptionsBuilder<
|
|
506
|
-
Value,
|
|
507
|
-
Options & {
|
|
258
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
259
|
+
/**
|
|
260
|
+
* Specify SQL functions for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
261
|
+
* Since v4 you should use defaultRaw for SQL functions. e.g. now()
|
|
262
|
+
*/
|
|
263
|
+
defaultRaw(defaultRaw: string): Pick<UniversalPropertyOptionsBuilder<Value, Options & {
|
|
508
264
|
defaultRaw: string;
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
*
|
|
521
|
-
* @see https://mikro-orm.io/docs/defining-entities#formulas Formulas
|
|
522
|
-
*/
|
|
523
|
-
formula<T extends string | FormulaCallback<any>>(
|
|
524
|
-
formula: T,
|
|
525
|
-
): Pick<
|
|
526
|
-
UniversalPropertyOptionsBuilder<
|
|
527
|
-
Value,
|
|
528
|
-
Omit<Options, 'formula'> & {
|
|
265
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
266
|
+
/**
|
|
267
|
+
* Allow controlling `filters` option. This will be overridden with `em.fork` or `FindOptions` if provided.
|
|
268
|
+
*/
|
|
269
|
+
filters(filters: FilterOptions): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
270
|
+
/**
|
|
271
|
+
* Set to map some SQL snippet for the entity.
|
|
272
|
+
*
|
|
273
|
+
* @see https://mikro-orm.io/docs/defining-entities#formulas Formulas
|
|
274
|
+
*/
|
|
275
|
+
formula<T extends string | FormulaCallback<any>>(formula: T): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'formula'> & {
|
|
529
276
|
formula: T;
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
generated: string | GeneratedColumnCallback<any>,
|
|
540
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
541
|
-
/**
|
|
542
|
-
* Set column as nullable for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}.
|
|
543
|
-
*/
|
|
544
|
-
nullable(): Pick<
|
|
545
|
-
UniversalPropertyOptionsBuilder<
|
|
546
|
-
Value,
|
|
547
|
-
Omit<Options, 'nullable'> & {
|
|
277
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
278
|
+
/**
|
|
279
|
+
* For generated columns. This will be appended to the column type after the `generated always` clause.
|
|
280
|
+
*/
|
|
281
|
+
generated(generated: string | GeneratedColumnCallback<any>): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
282
|
+
/**
|
|
283
|
+
* Set column as nullable for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}.
|
|
284
|
+
*/
|
|
285
|
+
nullable(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'nullable'> & {
|
|
548
286
|
nullable: true;
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
* Set column as nullable without adding `| undefined` to the type.
|
|
556
|
-
* Use this when the property is always explicitly set (e.g. in constructor) but can be `null`.
|
|
557
|
-
*/
|
|
558
|
-
strictNullable(): Pick<
|
|
559
|
-
UniversalPropertyOptionsBuilder<
|
|
560
|
-
Value,
|
|
561
|
-
Omit<Options, 'nullable' | 'strictNullable'> & {
|
|
287
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
288
|
+
/**
|
|
289
|
+
* Set column as nullable without adding `| undefined` to the type.
|
|
290
|
+
* Use this when the property is always explicitly set (e.g. in constructor) but can be `null`.
|
|
291
|
+
*/
|
|
292
|
+
strictNullable(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'nullable' | 'strictNullable'> & {
|
|
562
293
|
nullable: true;
|
|
563
294
|
strictNullable: true;
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* Set false to define {@link https://mikro-orm.io/docs/serializing#shadow-properties Shadow Property}.
|
|
575
|
-
*/
|
|
576
|
-
persist(): Pick<
|
|
577
|
-
UniversalPropertyOptionsBuilder<
|
|
578
|
-
Value,
|
|
579
|
-
Omit<Options, 'persist'> & {
|
|
295
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
296
|
+
/**
|
|
297
|
+
* Set column as unsigned for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
298
|
+
*/
|
|
299
|
+
unsigned(unsigned?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
300
|
+
/**
|
|
301
|
+
* Set false to define {@link https://mikro-orm.io/docs/serializing#shadow-properties Shadow Property}.
|
|
302
|
+
*/
|
|
303
|
+
persist(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'persist'> & {
|
|
580
304
|
persist: true;
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
>,
|
|
584
|
-
IncludeKeys
|
|
585
|
-
>;
|
|
586
|
-
persist(persist: false): Pick<
|
|
587
|
-
UniversalPropertyOptionsBuilder<
|
|
588
|
-
Value,
|
|
589
|
-
Omit<Options, 'persist'> & {
|
|
305
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
306
|
+
persist(persist: false): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'persist'> & {
|
|
590
307
|
persist: false;
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
Omit<Options, '
|
|
606
|
-
ref: true;
|
|
607
|
-
},
|
|
608
|
-
IncludeKeys
|
|
609
|
-
>;
|
|
610
|
-
/**
|
|
611
|
-
* Set to true to omit the property when {@link https://mikro-orm.io/docs/serializing Serializing}.
|
|
612
|
-
*/
|
|
613
|
-
hidden(): Pick<
|
|
614
|
-
UniversalPropertyOptionsBuilder<
|
|
615
|
-
Value,
|
|
616
|
-
Omit<Options, 'hidden'> & {
|
|
308
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
309
|
+
/**
|
|
310
|
+
* Set false to disable hydration of this property. Useful for persisted getters.
|
|
311
|
+
*/
|
|
312
|
+
hydrate(hydrate?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
313
|
+
/**
|
|
314
|
+
* 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.
|
|
315
|
+
*/
|
|
316
|
+
ref(): UniversalPropertyOptionsBuilder<Value, Omit<Options, 'ref'> & {
|
|
317
|
+
ref: true;
|
|
318
|
+
}, IncludeKeys>;
|
|
319
|
+
/**
|
|
320
|
+
* Set to true to omit the property when {@link https://mikro-orm.io/docs/serializing Serializing}.
|
|
321
|
+
*/
|
|
322
|
+
hidden(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'hidden'> & {
|
|
617
323
|
hidden: true;
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Set to true to enable {@link https://mikro-orm.io/docs/transactions#optimistic-locking Optimistic Locking} via version field. (SQL only)
|
|
625
|
-
*/
|
|
626
|
-
version(): Pick<
|
|
627
|
-
UniversalPropertyOptionsBuilder<
|
|
628
|
-
Value,
|
|
629
|
-
Omit<Options, 'version'> & {
|
|
324
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
325
|
+
/**
|
|
326
|
+
* Set to true to enable {@link https://mikro-orm.io/docs/transactions#optimistic-locking Optimistic Locking} via version field. (SQL only)
|
|
327
|
+
*/
|
|
328
|
+
version(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'version'> & {
|
|
630
329
|
version: true;
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
*/
|
|
663
|
-
lazy(): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
664
|
-
/**
|
|
665
|
-
* Set true to define entity's unique primary key identifier.
|
|
666
|
-
*
|
|
667
|
-
* @see https://mikro-orm.io/docs/decorators#primarykey
|
|
668
|
-
*/
|
|
669
|
-
primary(): Pick<
|
|
670
|
-
UniversalPropertyOptionsBuilder<
|
|
671
|
-
Value,
|
|
672
|
-
Omit<Options, 'primary'> & {
|
|
330
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
331
|
+
/**
|
|
332
|
+
* Set to true to enable {@link https://mikro-orm.io/docs/transactions#optimistic-locking Optimistic Locking} via concurrency fields.
|
|
333
|
+
*/
|
|
334
|
+
concurrencyCheck(concurrencyCheck?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
335
|
+
/**
|
|
336
|
+
* Explicitly specify index on a property.
|
|
337
|
+
*/
|
|
338
|
+
index(index?: boolean | string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
339
|
+
/**
|
|
340
|
+
* Set column as unique for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
341
|
+
*/
|
|
342
|
+
unique(unique?: boolean | string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
343
|
+
/**
|
|
344
|
+
* Specify column with check constraints. (Postgres driver only)
|
|
345
|
+
*
|
|
346
|
+
* @see https://mikro-orm.io/docs/defining-entities#check-constraints
|
|
347
|
+
*/
|
|
348
|
+
check(check: string | CheckCallback<any>): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
349
|
+
/**
|
|
350
|
+
* Set to omit the property from the select clause for lazy loading.
|
|
351
|
+
*
|
|
352
|
+
* @see https://mikro-orm.io/docs/defining-entities#lazy-scalar-properties
|
|
353
|
+
*/
|
|
354
|
+
lazy(): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
355
|
+
/**
|
|
356
|
+
* Set true to define entity's unique primary key identifier.
|
|
357
|
+
*
|
|
358
|
+
* @see https://mikro-orm.io/docs/decorators#primarykey
|
|
359
|
+
*/
|
|
360
|
+
primary(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'primary'> & {
|
|
673
361
|
primary: true;
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
* Specify comment of column for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
752
|
-
*/
|
|
753
|
-
comment(comment: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
754
|
-
/** mysql only */
|
|
755
|
-
extra(extra: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
756
|
-
/**
|
|
757
|
-
* Set to avoid a perpetual diff from the {@link https://mikro-orm.io/docs/schema-generator Schema Generator} when columns are generated.
|
|
758
|
-
*
|
|
759
|
-
* @see https://mikro-orm.io/docs/defining-entities#sql-generated-columns
|
|
760
|
-
*/
|
|
761
|
-
ignoreSchemaChanges(
|
|
762
|
-
...ignoreSchemaChanges: ('type' | 'extra' | 'default')[]
|
|
763
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
764
|
-
array(): Pick<
|
|
765
|
-
UniversalPropertyOptionsBuilder<
|
|
766
|
-
Value,
|
|
767
|
-
Omit<Options, 'array'> & {
|
|
362
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
363
|
+
/**
|
|
364
|
+
* Set true to define the properties as setter. (virtual)
|
|
365
|
+
*
|
|
366
|
+
* @example
|
|
367
|
+
* ```
|
|
368
|
+
* @Property({ setter: true })
|
|
369
|
+
* set address(value: string) {
|
|
370
|
+
* this._address = value.toLocaleLowerCase();
|
|
371
|
+
* }
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
setter(setter?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
375
|
+
/**
|
|
376
|
+
* Set true to define the properties as getter. (virtual)
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```
|
|
380
|
+
* @Property({ getter: true })
|
|
381
|
+
* get fullName() {
|
|
382
|
+
* return this.firstName + this.lastName;
|
|
383
|
+
* }
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
getter(getter?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
387
|
+
/**
|
|
388
|
+
* When defining a property over a method (not a getter, a regular function), you can use this option to point
|
|
389
|
+
* to the method name.
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```
|
|
393
|
+
* @Property({ getter: true })
|
|
394
|
+
* getFullName() {
|
|
395
|
+
* return this.firstName + this.lastName;
|
|
396
|
+
* }
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
getterName(getterName: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
400
|
+
/**
|
|
401
|
+
* Set to define serialized primary key for MongoDB. (virtual)
|
|
402
|
+
* Alias for `@SerializedPrimaryKey()` decorator.
|
|
403
|
+
*
|
|
404
|
+
* @see https://mikro-orm.io/docs/decorators#serializedprimarykey
|
|
405
|
+
*/
|
|
406
|
+
serializedPrimaryKey(serializedPrimaryKey?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
407
|
+
/**
|
|
408
|
+
* Set to use serialize property. Allow to specify a callback that will be used when serializing a property.
|
|
409
|
+
*
|
|
410
|
+
* @see https://mikro-orm.io/docs/serializing#property-serializers
|
|
411
|
+
*/
|
|
412
|
+
serializer(serializer: (value: Value, options?: SerializeOptions<any>) => any): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
413
|
+
/**
|
|
414
|
+
* Specify name of key for the serialized value.
|
|
415
|
+
*/
|
|
416
|
+
serializedName(serializedName: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
417
|
+
/**
|
|
418
|
+
* Specify serialization groups for `serialize()` calls. If a property does not specify any group, it will be included,
|
|
419
|
+
* otherwise only properties with a matching group are included.
|
|
420
|
+
*/
|
|
421
|
+
groups(...groups: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
422
|
+
/**
|
|
423
|
+
* Specify a custom order based on the values. (SQL only)
|
|
424
|
+
*/
|
|
425
|
+
customOrder(...customOrder: string[] | number[] | boolean[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
426
|
+
/**
|
|
427
|
+
* Specify comment of column for {@link https://mikro-orm.io/docs/schema-generator Schema Generator}. (SQL only)
|
|
428
|
+
*/
|
|
429
|
+
comment(comment: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
430
|
+
/** mysql only */
|
|
431
|
+
extra(extra: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
432
|
+
/**
|
|
433
|
+
* Set to avoid a perpetual diff from the {@link https://mikro-orm.io/docs/schema-generator Schema Generator} when columns are generated.
|
|
434
|
+
*
|
|
435
|
+
* @see https://mikro-orm.io/docs/defining-entities#sql-generated-columns
|
|
436
|
+
*/
|
|
437
|
+
ignoreSchemaChanges(...ignoreSchemaChanges: ('type' | 'extra' | 'default')[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
438
|
+
array(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'array'> & {
|
|
768
439
|
array: true;
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
>,
|
|
772
|
-
IncludeKeys
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
/** Set what actions on owning entity should be cascaded to the relationship. Defaults to [Cascade.PERSIST, Cascade.MERGE] (see {@doclink cascading}). */
|
|
784
|
-
cascade(...cascade: Cascade[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
785
|
-
/** Always load the relationship. Discouraged for use with to-many relations for performance reasons. */
|
|
786
|
-
eager(eager?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
787
|
-
/** Override the default loading strategy for this property. This option has precedence over the global `loadStrategy`, but can be overridden by `FindOptions.strategy`. */
|
|
788
|
-
strategy(
|
|
789
|
-
strategy: LoadStrategy | `${LoadStrategy}`,
|
|
790
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
791
|
-
/** 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. */
|
|
792
|
-
owner(): Pick<
|
|
793
|
-
UniversalPropertyOptionsBuilder<
|
|
794
|
-
Value,
|
|
795
|
-
Omit<Options, 'owner'> & {
|
|
440
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
441
|
+
/** for postgres, by default it uses text column with check constraint */
|
|
442
|
+
nativeEnumName(nativeEnumName: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
443
|
+
prefix(prefix: string | boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
444
|
+
prefixMode(prefixMode: EmbeddedPrefixMode): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
445
|
+
object(object?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
446
|
+
/** Set what actions on owning entity should be cascaded to the relationship. Defaults to [Cascade.PERSIST, Cascade.MERGE] (see {@doclink cascading}). */
|
|
447
|
+
cascade(...cascade: Cascade[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
448
|
+
/** Always load the relationship. Discouraged for use with to-many relations for performance reasons. */
|
|
449
|
+
eager(eager?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
450
|
+
/** Override the default loading strategy for this property. This option has precedence over the global `loadStrategy`, but can be overridden by `FindOptions.strategy`. */
|
|
451
|
+
strategy(strategy: LoadStrategy | `${LoadStrategy}`): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
452
|
+
/** 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. */
|
|
453
|
+
owner(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'owner'> & {
|
|
796
454
|
owner: true;
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
>,
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
/** 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. */
|
|
839
|
-
joinColumns(
|
|
840
|
-
...joinColumns: string[]
|
|
841
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
842
|
-
/** 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. */
|
|
843
|
-
inverseJoinColumn(
|
|
844
|
-
inverseJoinColumn: string,
|
|
845
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
846
|
-
/** 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. */
|
|
847
|
-
inverseJoinColumns(
|
|
848
|
-
...inverseJoinColumns: string[]
|
|
849
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
850
|
-
/** 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. */
|
|
851
|
-
referenceColumnName(
|
|
852
|
-
referenceColumnName: string,
|
|
853
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
854
|
-
/** 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. */
|
|
855
|
-
referencedColumnNames(
|
|
856
|
-
...referencedColumnNames: string[]
|
|
857
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
858
|
-
/** Specify the property name on the target entity that this FK references instead of the primary key. */
|
|
859
|
-
targetKey(targetKey: keyof Value): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
860
|
-
/** What to do when the target entity gets deleted. */
|
|
861
|
-
deleteRule(
|
|
862
|
-
deleteRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString,
|
|
863
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
864
|
-
/** What to do when the reference to the target entity gets updated. */
|
|
865
|
-
updateRule(
|
|
866
|
-
updateRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString,
|
|
867
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
868
|
-
/** Map this relation to the primary key value instead of an entity. */
|
|
869
|
-
mapToPk(): Pick<
|
|
870
|
-
UniversalPropertyOptionsBuilder<
|
|
871
|
-
Value,
|
|
872
|
-
Omit<Options, 'mapToPk'> & {
|
|
455
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
456
|
+
/** For polymorphic relations. Specifies the property name that stores the entity type discriminator. Defaults to the property name. */
|
|
457
|
+
discriminator(discriminator: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
458
|
+
/** For polymorphic relations. Custom mapping of discriminator values to entity class names. */
|
|
459
|
+
discriminatorMap(discriminatorMap: Dictionary<string>): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
460
|
+
/** Point to the inverse side property name. */
|
|
461
|
+
inversedBy(inversedBy: keyof Value | ((e: Value) => any)): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
462
|
+
/** Point to the owning side property name. */
|
|
463
|
+
mappedBy(mappedBy: keyof Value | ((e: Value) => any)): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
464
|
+
/** Condition for {@doclink collections#declarative-partial-loading | Declarative partial loading}. */
|
|
465
|
+
where(...where: FilterQuery<object>[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
466
|
+
/** Set default ordering. */
|
|
467
|
+
orderBy(...orderBy: QueryOrderMap<object>[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
468
|
+
/** Force stable insertion order of items in the collection (see {@doclink collections | Collections}). */
|
|
469
|
+
fixedOrder(fixedOrder?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
470
|
+
/** Override default order column name (`id`) for fixed ordering. */
|
|
471
|
+
fixedOrderColumn(fixedOrderColumn: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
472
|
+
/** Override default name for pivot table (see {@doclink naming-strategy | Naming Strategy}). */
|
|
473
|
+
pivotTable(pivotTable: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
474
|
+
/** Set pivot entity for this relation (see {@doclink collections#custom-pivot-table-entity | Custom pivot table entity}). */
|
|
475
|
+
pivotEntity(pivotEntity: () => EntityName): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
476
|
+
/** 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. */
|
|
477
|
+
joinColumn(joinColumn: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
478
|
+
/** 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. */
|
|
479
|
+
joinColumns(...joinColumns: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
480
|
+
/** 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. */
|
|
481
|
+
inverseJoinColumn(inverseJoinColumn: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
482
|
+
/** 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. */
|
|
483
|
+
inverseJoinColumns(...inverseJoinColumns: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
484
|
+
/** 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. */
|
|
485
|
+
referenceColumnName(referenceColumnName: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
486
|
+
/** 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. */
|
|
487
|
+
referencedColumnNames(...referencedColumnNames: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
488
|
+
/** Specify the property name on the target entity that this FK references instead of the primary key. */
|
|
489
|
+
targetKey(targetKey: keyof Value): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
490
|
+
/** What to do when the target entity gets deleted. */
|
|
491
|
+
deleteRule(deleteRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
492
|
+
/** What to do when the reference to the target entity gets updated. */
|
|
493
|
+
updateRule(updateRule: 'cascade' | 'no action' | 'set null' | 'set default' | AnyString): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
494
|
+
/** Map this relation to the primary key value instead of an entity. */
|
|
495
|
+
mapToPk(): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'mapToPk'> & {
|
|
873
496
|
mapToPk: true;
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
>,
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
createForeignKeyConstraint(
|
|
887
|
-
createForeignKeyConstraint?: boolean,
|
|
888
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
889
|
-
/** Set a custom foreign key constraint name, overriding NamingStrategy.indexName(). */
|
|
890
|
-
foreignKeyName(
|
|
891
|
-
foreignKeyName: string,
|
|
892
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
893
|
-
/** Remove the entity when it gets disconnected from the relationship (see {@doclink cascading | Cascading}). */
|
|
894
|
-
orphanRemoval(
|
|
895
|
-
orphanRemoval?: boolean,
|
|
896
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
897
|
-
accessor(
|
|
898
|
-
accessor?: string | boolean,
|
|
899
|
-
): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
497
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
498
|
+
/** 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. */
|
|
499
|
+
deferMode(deferMode: DeferMode | `${DeferMode}`): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
500
|
+
/** 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. */
|
|
501
|
+
ownColumns(...ownColumns: string[]): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
502
|
+
/** Enable/disable foreign key constraint creation on this relation */
|
|
503
|
+
createForeignKeyConstraint(createForeignKeyConstraint?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
504
|
+
/** Set a custom foreign key constraint name, overriding NamingStrategy.indexName(). */
|
|
505
|
+
foreignKeyName(foreignKeyName: string): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
506
|
+
/** Remove the entity when it gets disconnected from the relationship (see {@doclink cascading | Cascading}). */
|
|
507
|
+
orphanRemoval(orphanRemoval?: boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
508
|
+
accessor(accessor?: string | boolean): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
900
509
|
}
|
|
901
510
|
/** Empty options object used as the initial state for property builders. */
|
|
902
|
-
export interface EmptyOptions extends Partial<Record<UniversalPropertyKeys, unknown>> {
|
|
511
|
+
export interface EmptyOptions extends Partial<Record<UniversalPropertyKeys, unknown>> {
|
|
512
|
+
}
|
|
903
513
|
/** @internal */
|
|
904
|
-
export declare class OneToManyOptionsBuilderOnlyMappedBy<Value extends object> extends UniversalPropertyOptionsBuilder<
|
|
905
|
-
Value,
|
|
906
|
-
EmptyOptions & {
|
|
514
|
+
export declare class OneToManyOptionsBuilderOnlyMappedBy<Value extends object> extends UniversalPropertyOptionsBuilder<Value, EmptyOptions & {
|
|
907
515
|
kind: '1:m';
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
/** Point to the owning side property name. */
|
|
912
|
-
mappedBy(mappedBy: keyof Value | ((e: Value) => any)): Pick<
|
|
913
|
-
UniversalPropertyOptionsBuilder<
|
|
914
|
-
Value,
|
|
915
|
-
EmptyOptions & {
|
|
516
|
+
}, IncludeKeysForOneToManyOptions> {
|
|
517
|
+
/** Point to the owning side property name. */
|
|
518
|
+
mappedBy(mappedBy: keyof Value | ((e: Value) => any)): Pick<UniversalPropertyOptionsBuilder<Value, EmptyOptions & {
|
|
916
519
|
kind: '1:m';
|
|
917
|
-
|
|
918
|
-
IncludeKeysForOneToManyOptions
|
|
919
|
-
>,
|
|
920
|
-
IncludeKeysForOneToManyOptions
|
|
921
|
-
>;
|
|
520
|
+
}, IncludeKeysForOneToManyOptions>, IncludeKeysForOneToManyOptions>;
|
|
922
521
|
}
|
|
923
|
-
type EntityTarget =
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
}
|
|
927
|
-
| EntityClass;
|
|
522
|
+
type EntityTarget = {
|
|
523
|
+
'~entity': any;
|
|
524
|
+
} | EntityClass;
|
|
928
525
|
declare const propertyBuilders: PropertyBuilders;
|
|
929
526
|
type PropertyBuildersOverrideKeys = 'bigint' | 'array' | 'decimal' | 'json' | 'datetime' | 'time' | 'enum';
|
|
930
527
|
/** Map of factory functions for creating type-safe property builders (scalars, enums, embeddables, and relations). */
|
|
931
528
|
export type PropertyBuilders = {
|
|
932
|
-
|
|
933
|
-
InferPropertyValueType<(typeof types)[K]>,
|
|
934
|
-
EmptyOptions,
|
|
935
|
-
IncludeKeysForProperty
|
|
936
|
-
>;
|
|
529
|
+
[K in Exclude<keyof typeof types, PropertyBuildersOverrideKeys>]: () => UniversalPropertyOptionsBuilder<InferPropertyValueType<(typeof types)[K]>, EmptyOptions, IncludeKeysForProperty>;
|
|
937
530
|
} & {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
EmptyOptions,
|
|
943
|
-
IncludeKeysForProperty
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
EmptyOptions
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
formula: string | FormulaCallback<any>,
|
|
963
|
-
) => UniversalPropertyOptionsBuilder<T, EmptyOptions, IncludeKeysForProperty>;
|
|
964
|
-
datetime: (
|
|
965
|
-
length?: number,
|
|
966
|
-
) => UniversalPropertyOptionsBuilder<
|
|
967
|
-
InferPropertyValueType<typeof types.datetime>,
|
|
968
|
-
EmptyOptions,
|
|
969
|
-
IncludeKeysForProperty
|
|
970
|
-
>;
|
|
971
|
-
time: (
|
|
972
|
-
length?: number,
|
|
973
|
-
) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.time>, EmptyOptions, IncludeKeysForProperty>;
|
|
974
|
-
type: <T extends PropertyValueType>(
|
|
975
|
-
type: T,
|
|
976
|
-
) => UniversalPropertyOptionsBuilder<InferPropertyValueType<T>, EmptyOptions, IncludeKeysForProperty>;
|
|
977
|
-
enum: <const T extends readonly (number | string)[] | (() => Dictionary)>(
|
|
978
|
-
items?: T,
|
|
979
|
-
) => UniversalPropertyOptionsBuilder<
|
|
980
|
-
T extends () => Dictionary ? ValueOf<ReturnType<T>> : T extends readonly (infer Value)[] ? Value : T,
|
|
981
|
-
EmptyOptions,
|
|
982
|
-
IncludeKeysForEnumOptions
|
|
983
|
-
>;
|
|
984
|
-
embedded: <Target extends EntityTarget | EntityTarget[]>(
|
|
985
|
-
target: Target,
|
|
986
|
-
) => PropertyChain<
|
|
987
|
-
InferEntity<Target extends (infer T)[] ? T : Target>,
|
|
988
|
-
EmptyOptions & {
|
|
989
|
-
kind: 'embedded';
|
|
990
|
-
}
|
|
991
|
-
>;
|
|
992
|
-
manyToMany: <Target extends EntityTarget>(
|
|
993
|
-
target: Target,
|
|
994
|
-
) => PropertyChain<
|
|
995
|
-
InferEntity<Target>,
|
|
996
|
-
EmptyOptions & {
|
|
997
|
-
kind: 'm:n';
|
|
998
|
-
}
|
|
999
|
-
>;
|
|
1000
|
-
manyToOne: <Target extends EntityTarget | EntityTarget[]>(
|
|
1001
|
-
target: Target,
|
|
1002
|
-
) => PropertyChain<
|
|
1003
|
-
InferEntity<Target extends (infer T)[] ? T : Target>,
|
|
1004
|
-
EmptyOptions & {
|
|
1005
|
-
kind: 'm:1';
|
|
1006
|
-
}
|
|
1007
|
-
>;
|
|
1008
|
-
oneToMany: <Target extends EntityTarget>(
|
|
1009
|
-
target: Target,
|
|
1010
|
-
) => PropertyChain<
|
|
1011
|
-
InferEntity<Target>,
|
|
1012
|
-
EmptyOptions & {
|
|
1013
|
-
kind: '1:m';
|
|
1014
|
-
}
|
|
1015
|
-
>;
|
|
1016
|
-
oneToOne: <Target extends EntityTarget | EntityTarget[]>(
|
|
1017
|
-
target: Target,
|
|
1018
|
-
) => PropertyChain<
|
|
1019
|
-
InferEntity<Target extends (infer T)[] ? T : Target>,
|
|
1020
|
-
EmptyOptions & {
|
|
1021
|
-
kind: '1:1';
|
|
1022
|
-
}
|
|
1023
|
-
>;
|
|
531
|
+
bigint: <Mode extends 'bigint' | 'number' | 'string' = 'bigint'>(mode?: Mode) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.bigint<Mode>>, EmptyOptions, IncludeKeysForProperty>;
|
|
532
|
+
array: <T = string>(toJsValue?: (i: string) => T, toDbValue?: (i: T) => string) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.array<T>>, EmptyOptions, IncludeKeysForProperty>;
|
|
533
|
+
decimal: <Mode extends 'number' | 'string' = 'string'>(mode?: Mode) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.decimal<Mode>>, EmptyOptions, IncludeKeysForProperty>;
|
|
534
|
+
json: <T>() => UniversalPropertyOptionsBuilder<T, EmptyOptions, IncludeKeysForProperty>;
|
|
535
|
+
formula: <T>(formula: string | FormulaCallback<any>) => UniversalPropertyOptionsBuilder<T, EmptyOptions, IncludeKeysForProperty>;
|
|
536
|
+
datetime: (length?: number) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.datetime>, EmptyOptions, IncludeKeysForProperty>;
|
|
537
|
+
time: (length?: number) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.time>, EmptyOptions, IncludeKeysForProperty>;
|
|
538
|
+
type: <T extends PropertyValueType>(type: T) => UniversalPropertyOptionsBuilder<InferPropertyValueType<T>, EmptyOptions, IncludeKeysForProperty>;
|
|
539
|
+
enum: <const T extends readonly (number | string)[] | (() => Dictionary)>(items?: T) => UniversalPropertyOptionsBuilder<T extends () => Dictionary ? ValueOf<ReturnType<T>> : T extends readonly (infer Value)[] ? Value : T, EmptyOptions, IncludeKeysForEnumOptions>;
|
|
540
|
+
embedded: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
541
|
+
kind: 'embedded';
|
|
542
|
+
}>;
|
|
543
|
+
manyToMany: <Target extends EntityTarget>(target: Target) => PropertyChain<InferEntity<Target>, EmptyOptions & {
|
|
544
|
+
kind: 'm:n';
|
|
545
|
+
}>;
|
|
546
|
+
manyToOne: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
547
|
+
kind: 'm:1';
|
|
548
|
+
}>;
|
|
549
|
+
oneToMany: <Target extends EntityTarget>(target: Target) => PropertyChain<InferEntity<Target>, EmptyOptions & {
|
|
550
|
+
kind: '1:m';
|
|
551
|
+
}>;
|
|
552
|
+
oneToOne: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
553
|
+
kind: '1:1';
|
|
554
|
+
}>;
|
|
1024
555
|
};
|
|
1025
556
|
/** Own keys + base entity keys (when TBase is not `never`). Guards against `keyof never = string | number | symbol`. */
|
|
1026
557
|
type AllKeys<TProperties, TBase> = keyof TProperties | (IsNever<TBase> extends true ? never : keyof TBase);
|
|
1027
558
|
/** Metadata descriptor for `defineEntity()`, combining entity options with property definitions. */
|
|
1028
|
-
export interface EntityMetadataWithProperties<
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
TPK extends (keyof TProperties)[] | undefined = undefined,
|
|
1033
|
-
TBase = never,
|
|
1034
|
-
TRepository = never,
|
|
1035
|
-
TForceObject extends boolean = false,
|
|
1036
|
-
> extends Omit<
|
|
1037
|
-
Partial<EntityMetadata<InferEntityFromProperties<TProperties, TPK, TBase, TRepository>>>,
|
|
1038
|
-
| 'properties'
|
|
1039
|
-
| 'extends'
|
|
1040
|
-
| 'primaryKeys'
|
|
1041
|
-
| 'hooks'
|
|
1042
|
-
| 'discriminatorColumn'
|
|
1043
|
-
| 'versionProperty'
|
|
1044
|
-
| 'concurrencyCheckKeys'
|
|
1045
|
-
| 'serializedPrimaryKey'
|
|
1046
|
-
| 'indexes'
|
|
1047
|
-
| 'uniques'
|
|
1048
|
-
| 'repository'
|
|
1049
|
-
| 'filters'
|
|
1050
|
-
| 'orderBy'
|
|
1051
|
-
> {
|
|
1052
|
-
name: TName;
|
|
1053
|
-
tableName?: TTableName;
|
|
1054
|
-
extends?:
|
|
1055
|
-
| {
|
|
559
|
+
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' | 'filters' | 'orderBy'> {
|
|
560
|
+
name: TName;
|
|
561
|
+
tableName?: TTableName;
|
|
562
|
+
extends?: {
|
|
1056
563
|
'~entity': TBase;
|
|
1057
|
-
|
|
1058
|
-
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
) => MaybePromise<FilterQuery<any>>);
|
|
1074
|
-
default?: boolean;
|
|
1075
|
-
entity?: EntityName<any> | EntityName<any>[];
|
|
1076
|
-
args?: boolean;
|
|
1077
|
-
strict?: boolean;
|
|
1078
|
-
}>;
|
|
1079
|
-
forceObject?: TForceObject;
|
|
1080
|
-
inheritance?: 'tpt';
|
|
1081
|
-
orderBy?:
|
|
1082
|
-
| {
|
|
564
|
+
} | EntityCtor<TBase>;
|
|
565
|
+
properties: TProperties | ((properties: PropertyBuilders) => TProperties);
|
|
566
|
+
primaryKeys?: TPK & InferPrimaryKeyConstraint<TProperties>[];
|
|
567
|
+
hooks?: DefineEntityHooks;
|
|
568
|
+
repository?: () => TRepository;
|
|
569
|
+
filters?: Dictionary<{
|
|
570
|
+
name: string;
|
|
571
|
+
cond: Dictionary | ((args: Dictionary, type: 'read' | 'update' | 'delete', em: any, options?: FindOptions<any, any, any, any> | FindOneOptions<any, any, any, any>, entityName?: string) => MaybePromise<FilterQuery<any>>);
|
|
572
|
+
default?: boolean;
|
|
573
|
+
entity?: EntityName<any> | EntityName<any>[];
|
|
574
|
+
args?: boolean;
|
|
575
|
+
strict?: boolean;
|
|
576
|
+
}>;
|
|
577
|
+
forceObject?: TForceObject;
|
|
578
|
+
inheritance?: 'tpt';
|
|
579
|
+
orderBy?: {
|
|
1083
580
|
[K in Extract<AllKeys<TProperties, TBase>, string>]?: QueryOrderKeysFlat;
|
|
1084
|
-
|
|
1085
|
-
| {
|
|
581
|
+
} | {
|
|
1086
582
|
[K in Extract<AllKeys<TProperties, TBase>, string>]?: QueryOrderKeysFlat;
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
583
|
+
}[];
|
|
584
|
+
discriminatorColumn?: string;
|
|
585
|
+
versionProperty?: AllKeys<TProperties, TBase>;
|
|
586
|
+
concurrencyCheckKeys?: Set<AllKeys<TProperties, TBase>>;
|
|
587
|
+
serializedPrimaryKey?: AllKeys<TProperties, TBase>;
|
|
588
|
+
indexes?: {
|
|
589
|
+
properties?: NoInfer<AllKeys<TProperties, TBase>> | NoInfer<AllKeys<TProperties, TBase>>[];
|
|
590
|
+
name?: string;
|
|
591
|
+
type?: string;
|
|
592
|
+
options?: Dictionary;
|
|
593
|
+
expression?: string | IndexCallback<InferEntityFromProperties<TProperties, TPK, TBase>>;
|
|
594
|
+
columns?: IndexColumnOptions[];
|
|
595
|
+
include?: NoInfer<AllKeys<TProperties, TBase>> | NoInfer<AllKeys<TProperties, TBase>>[];
|
|
596
|
+
fillFactor?: number;
|
|
597
|
+
invisible?: boolean;
|
|
598
|
+
disabled?: boolean;
|
|
599
|
+
clustered?: boolean;
|
|
600
|
+
}[];
|
|
601
|
+
uniques?: {
|
|
602
|
+
properties?: NoInfer<AllKeys<TProperties, TBase>> | NoInfer<AllKeys<TProperties, TBase>>[];
|
|
603
|
+
name?: string;
|
|
604
|
+
options?: Dictionary;
|
|
605
|
+
expression?: string | IndexCallback<InferEntityFromProperties<TProperties, TPK, TBase>>;
|
|
606
|
+
deferMode?: DeferMode | `${DeferMode}`;
|
|
607
|
+
columns?: IndexColumnOptions[];
|
|
608
|
+
include?: NoInfer<AllKeys<TProperties, TBase>> | NoInfer<AllKeys<TProperties, TBase>>[];
|
|
609
|
+
fillFactor?: number;
|
|
610
|
+
disabled?: boolean;
|
|
611
|
+
}[];
|
|
1116
612
|
}
|
|
1117
613
|
/** Defines an entity schema using property builders, with full type inference from the property definitions. */
|
|
1118
|
-
export declare function defineEntity<
|
|
1119
|
-
const TName extends string,
|
|
1120
|
-
const TTableName extends string,
|
|
1121
|
-
const TProperties extends Record<string, any>,
|
|
1122
|
-
const TPK extends (keyof TProperties)[] | undefined = undefined,
|
|
1123
|
-
const TBase = never,
|
|
1124
|
-
const TRepository = never,
|
|
1125
|
-
const TForceObject extends boolean = false,
|
|
1126
|
-
>(
|
|
1127
|
-
meta: EntityMetadataWithProperties<TName, TTableName, TProperties, TPK, TBase, TRepository, TForceObject>,
|
|
1128
|
-
): EntitySchemaWithMeta<
|
|
1129
|
-
TName,
|
|
1130
|
-
TTableName,
|
|
1131
|
-
InferEntityFromProperties<TProperties, TPK, TBase, TRepository, TForceObject>,
|
|
1132
|
-
TBase,
|
|
1133
|
-
TProperties
|
|
1134
|
-
>;
|
|
614
|
+
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>;
|
|
1135
615
|
/** Defines an entity schema for an existing class, combining the class with property builders. */
|
|
1136
|
-
export declare function defineEntity<
|
|
1137
|
-
const TEntity = any,
|
|
1138
|
-
const TProperties extends Record<string, any> = Record<string, any>,
|
|
1139
|
-
const TClassName extends string = string,
|
|
1140
|
-
const TTableName extends string = string,
|
|
1141
|
-
const TBase = never,
|
|
1142
|
-
const TClass extends EntityCtor = EntityCtor<TEntity>,
|
|
1143
|
-
>(
|
|
1144
|
-
meta: Omit<Partial<EntityMetadata<TEntity>>, 'properties' | 'extends' | 'className' | 'tableName' | 'hooks'> & {
|
|
616
|
+
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'> & {
|
|
1145
617
|
class: TClass;
|
|
1146
618
|
className?: TClassName;
|
|
1147
619
|
tableName?: TTableName;
|
|
1148
620
|
extends?: TBase;
|
|
1149
621
|
properties: TProperties | ((properties: PropertyBuilders) => TProperties);
|
|
1150
622
|
hooks?: DefineEntityHooks<TEntity>;
|
|
1151
|
-
|
|
1152
|
-
): EntitySchemaWithMeta<TClassName, TTableName, TEntity, TBase, TProperties, TClass>;
|
|
623
|
+
}): EntitySchemaWithMeta<TClassName, TTableName, TEntity, TBase, TProperties, TClass>;
|
|
1153
624
|
export declare namespace defineEntity {
|
|
1154
|
-
|
|
625
|
+
var properties: PropertyBuilders;
|
|
1155
626
|
}
|
|
1156
627
|
/** Shorthand alias for `defineEntity.properties` - the property builders for use in `defineEntity()`. */
|
|
1157
628
|
export { propertyBuilders as p };
|
|
1158
629
|
type EntityHookValue<T, K extends keyof EventSubscriber<T>> = (keyof T | NonNullable<EventSubscriber<T>[K]>)[];
|
|
1159
630
|
/** Lifecycle hook definitions for entities created via `defineEntity()`. */
|
|
1160
631
|
export interface DefineEntityHooks<T = any> {
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
632
|
+
onInit?: EntityHookValue<T, 'onInit'>;
|
|
633
|
+
onLoad?: EntityHookValue<T, 'onLoad'>;
|
|
634
|
+
beforeCreate?: EntityHookValue<T, 'beforeCreate'>;
|
|
635
|
+
afterCreate?: EntityHookValue<T, 'afterCreate'>;
|
|
636
|
+
beforeUpdate?: EntityHookValue<T, 'beforeUpdate'>;
|
|
637
|
+
afterUpdate?: EntityHookValue<T, 'afterUpdate'>;
|
|
638
|
+
beforeUpsert?: EntityHookValue<T, 'beforeUpsert'>;
|
|
639
|
+
afterUpsert?: EntityHookValue<T, 'afterUpsert'>;
|
|
640
|
+
beforeDelete?: EntityHookValue<T, 'beforeDelete'>;
|
|
641
|
+
afterDelete?: EntityHookValue<T, 'afterDelete'>;
|
|
1171
642
|
}
|
|
1172
643
|
type PropertyValueType = PropertyOptions<any>['type'];
|
|
1173
|
-
type InferPropertyValueType<T extends PropertyValueType> = T extends string
|
|
1174
|
-
|
|
1175
|
-
: T extends NumberConstructor
|
|
1176
|
-
? number
|
|
1177
|
-
: T extends StringConstructor
|
|
1178
|
-
? string
|
|
1179
|
-
: T extends BooleanConstructor
|
|
1180
|
-
? boolean
|
|
1181
|
-
: T extends DateConstructor
|
|
1182
|
-
? Date
|
|
1183
|
-
: T extends ArrayConstructor
|
|
1184
|
-
? string[]
|
|
1185
|
-
: T extends Constructor<infer TType>
|
|
1186
|
-
? TType extends Type<infer TValue, any>
|
|
1187
|
-
? NonNullable<TValue>
|
|
1188
|
-
: TType
|
|
1189
|
-
: T extends Type<infer TValue, any>
|
|
1190
|
-
? NonNullable<TValue>
|
|
1191
|
-
: any;
|
|
1192
|
-
type InferTypeByString<T extends string> = T extends keyof typeof types
|
|
1193
|
-
? InferJSType<(typeof types)[T]>
|
|
1194
|
-
: InferColumnType<T>;
|
|
644
|
+
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;
|
|
645
|
+
type InferTypeByString<T extends string> = T extends keyof typeof types ? InferJSType<(typeof types)[T]> : InferColumnType<T>;
|
|
1195
646
|
type InferJSType<T> = T extends typeof Type<infer TValue, any> ? NonNullable<TValue> : never;
|
|
1196
|
-
type InferColumnType<T extends string> = T extends
|
|
1197
|
-
| 'int'
|
|
1198
|
-
| 'int4'
|
|
1199
|
-
| 'integer'
|
|
1200
|
-
| 'bigint'
|
|
1201
|
-
| 'int8'
|
|
1202
|
-
| 'int2'
|
|
1203
|
-
| 'tinyint'
|
|
1204
|
-
| 'smallint'
|
|
1205
|
-
| 'mediumint'
|
|
1206
|
-
? number
|
|
1207
|
-
: T extends 'double' | 'double precision' | 'real' | 'float8' | 'decimal' | 'numeric' | 'float' | 'float4'
|
|
1208
|
-
? number
|
|
1209
|
-
: T extends
|
|
1210
|
-
| 'datetime'
|
|
1211
|
-
| 'time'
|
|
1212
|
-
| 'time with time zone'
|
|
1213
|
-
| 'timestamp'
|
|
1214
|
-
| 'timestamp with time zone'
|
|
1215
|
-
| 'timetz'
|
|
1216
|
-
| 'timestamptz'
|
|
1217
|
-
| 'date'
|
|
1218
|
-
| 'interval'
|
|
1219
|
-
? Date
|
|
1220
|
-
: T extends
|
|
1221
|
-
| 'ObjectId'
|
|
1222
|
-
| 'objectId'
|
|
1223
|
-
| 'character varying'
|
|
1224
|
-
| 'varchar'
|
|
1225
|
-
| 'char'
|
|
1226
|
-
| 'character'
|
|
1227
|
-
| 'uuid'
|
|
1228
|
-
| 'text'
|
|
1229
|
-
| 'tinytext'
|
|
1230
|
-
| 'mediumtext'
|
|
1231
|
-
| 'longtext'
|
|
1232
|
-
| 'enum'
|
|
1233
|
-
? string
|
|
1234
|
-
: T extends 'boolean' | 'bool' | 'bit'
|
|
1235
|
-
? boolean
|
|
1236
|
-
: T extends 'blob' | 'tinyblob' | 'mediumblob' | 'longblob' | 'bytea'
|
|
1237
|
-
? Buffer
|
|
1238
|
-
: T extends 'point' | 'line' | 'lseg' | 'box' | 'circle' | 'path' | 'polygon' | 'geometry'
|
|
1239
|
-
? number[]
|
|
1240
|
-
: T extends 'tsvector' | 'tsquery'
|
|
1241
|
-
? string[]
|
|
1242
|
-
: T extends 'json' | 'jsonb'
|
|
1243
|
-
? any
|
|
1244
|
-
: any;
|
|
647
|
+
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;
|
|
1245
648
|
type BaseEntityMethodKeys = 'toObject' | 'toPOJO' | 'serialize' | 'assign' | 'populate' | 'init' | 'toReference';
|
|
1246
649
|
/** Infers the entity type from a `defineEntity()` properties map, resolving builders, base classes, and primary keys. */
|
|
1247
|
-
export type InferEntityFromProperties<
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
}
|
|
1258
|
-
? Pick<
|
|
1259
|
-
IWrappedEntity<
|
|
1260
|
-
{
|
|
1261
|
-
-readonly [K in keyof Properties]: InferBuilderValue<MaybeReturnType<Properties[K]>>;
|
|
1262
|
-
} & {
|
|
1263
|
-
[PrimaryKeyProp]?: InferCombinedPrimaryKey<Properties, PK, Base>;
|
|
1264
|
-
} & (IsNever<Repository> extends true
|
|
1265
|
-
? {}
|
|
1266
|
-
: {
|
|
1267
|
-
[EntityRepositoryType]?: Repository extends Constructor<infer R> ? R : Repository;
|
|
1268
|
-
}) &
|
|
1269
|
-
Omit<Base, typeof PrimaryKeyProp>
|
|
1270
|
-
>,
|
|
1271
|
-
BaseEntityMethodKeys
|
|
1272
|
-
>
|
|
1273
|
-
: {}) & {
|
|
1274
|
-
-readonly [K in keyof Properties]: InferBuilderValue<MaybeReturnType<Properties[K]>>;
|
|
650
|
+
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 {
|
|
651
|
+
toObject(...args: any[]): any;
|
|
652
|
+
} ? Pick<IWrappedEntity<{
|
|
653
|
+
-readonly [K in keyof Properties]: InferBuilderValue<MaybeReturnType<Properties[K]>>;
|
|
654
|
+
} & {
|
|
655
|
+
[PrimaryKeyProp]?: InferCombinedPrimaryKey<Properties, PK, Base>;
|
|
656
|
+
} & (IsNever<Repository> extends true ? {} : {
|
|
657
|
+
[EntityRepositoryType]?: Repository extends Constructor<infer R> ? R : Repository;
|
|
658
|
+
}) & Omit<Base, typeof PrimaryKeyProp>>, BaseEntityMethodKeys> : {}) & {
|
|
659
|
+
-readonly [K in keyof Properties]: InferBuilderValue<MaybeReturnType<Properties[K]>>;
|
|
1275
660
|
} & {
|
|
1276
|
-
|
|
1277
|
-
} & (IsNever<Repository> extends true
|
|
1278
|
-
?
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
[Config]?: DefineConfig<{
|
|
1286
|
-
forceObject: true;
|
|
1287
|
-
}>;
|
|
1288
|
-
}
|
|
1289
|
-
: {});
|
|
1290
|
-
type InferCombinedPrimaryKey<Properties extends Record<string, any>, PK, Base> = PK extends undefined
|
|
1291
|
-
? CombinePrimaryKeys<InferPrimaryKey<Properties>, ExtractBasePrimaryKey<Base>>
|
|
1292
|
-
: PK;
|
|
661
|
+
[PrimaryKeyProp]?: InferCombinedPrimaryKey<Properties, PK, Base>;
|
|
662
|
+
} & (IsNever<Repository> extends true ? {} : {
|
|
663
|
+
[EntityRepositoryType]?: Repository extends Constructor<infer R> ? R : Repository;
|
|
664
|
+
}) & (IsNever<Base> extends true ? {} : Omit<Base, typeof PrimaryKeyProp>) & (ForceObject extends true ? {
|
|
665
|
+
[Config]?: DefineConfig<{
|
|
666
|
+
forceObject: true;
|
|
667
|
+
}>;
|
|
668
|
+
} : {});
|
|
669
|
+
type InferCombinedPrimaryKey<Properties extends Record<string, any>, PK, Base> = PK extends undefined ? CombinePrimaryKeys<InferPrimaryKey<Properties>, ExtractBasePrimaryKey<Base>> : PK;
|
|
1293
670
|
type ExtractBasePrimaryKey<Base> = Base extends {
|
|
1294
|
-
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
: never;
|
|
1298
|
-
type CombinePrimaryKeys<ChildPK, BasePK> = [ChildPK] extends [never]
|
|
1299
|
-
? BasePK
|
|
1300
|
-
: [BasePK] extends [never]
|
|
1301
|
-
? IsUnion<ChildPK> extends true
|
|
1302
|
-
? ChildPK[]
|
|
1303
|
-
: ChildPK
|
|
1304
|
-
: ChildPK | BasePK;
|
|
671
|
+
[PrimaryKeyProp]?: infer BasePK;
|
|
672
|
+
} ? BasePK : never;
|
|
673
|
+
type CombinePrimaryKeys<ChildPK, BasePK> = [ChildPK] extends [never] ? BasePK : [BasePK] extends [never] ? IsUnion<ChildPK> extends true ? ChildPK[] : ChildPK : ChildPK | BasePK;
|
|
1305
674
|
/** Extracts the primary key property names from a properties map by finding builders with `primary: true`. */
|
|
1306
675
|
export type InferPrimaryKey<Properties extends Record<string, any>> = {
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
? K
|
|
1313
|
-
: never;
|
|
676
|
+
[K in keyof Properties]: MaybeReturnType<Properties[K]> extends {
|
|
677
|
+
'~options': {
|
|
678
|
+
primary: true;
|
|
679
|
+
};
|
|
680
|
+
} ? K : never;
|
|
1314
681
|
}[keyof Properties];
|
|
1315
682
|
/** Like InferPrimaryKey, but skips evaluating function return types to prevent circular inference (GH #7445). */
|
|
1316
683
|
export type InferPrimaryKeyConstraint<Properties extends Record<string, any>> = {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
: Properties[K] extends {
|
|
1320
|
-
'~options': {
|
|
684
|
+
[K in keyof Properties]: Properties[K] extends (...args: any) => any ? K : Properties[K] extends {
|
|
685
|
+
'~options': {
|
|
1321
686
|
primary: true;
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
? K
|
|
1325
|
-
: never;
|
|
687
|
+
};
|
|
688
|
+
} ? K : never;
|
|
1326
689
|
}[keyof Properties];
|
|
1327
690
|
type InferBuilderValue<Builder> = Builder extends {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
}
|
|
1333
|
-
? MaybeHidden<
|
|
1334
|
-
MaybeOpt<
|
|
1335
|
-
MaybeScalarRef<
|
|
1336
|
-
MaybeNullable<MaybeRelationRef<MaybeMapToPk<MaybeArray<Value, Options>, Options>, Options>, Options>,
|
|
1337
|
-
Options
|
|
1338
|
-
>,
|
|
1339
|
-
Options
|
|
1340
|
-
>,
|
|
1341
|
-
Options
|
|
1342
|
-
>
|
|
1343
|
-
: never;
|
|
691
|
+
'~type'?: {
|
|
692
|
+
value: infer Value;
|
|
693
|
+
};
|
|
694
|
+
'~options'?: infer Options;
|
|
695
|
+
} ? MaybeHidden<MaybeOpt<MaybeScalarRef<MaybeNullable<MaybeRelationRef<MaybeMapToPk<MaybeArray<Value, Options>, Options>, Options>, Options>, Options>, Options>, Options> : never;
|
|
1344
696
|
type MaybeArray<Value, Options> = Options extends {
|
|
1345
|
-
|
|
1346
|
-
}
|
|
1347
|
-
? Value[]
|
|
1348
|
-
: Value;
|
|
697
|
+
array: true;
|
|
698
|
+
} ? Value[] : Value;
|
|
1349
699
|
type MaybeMapToPk<Value, Options> = Options extends {
|
|
1350
|
-
|
|
1351
|
-
}
|
|
1352
|
-
? Primary<Value>
|
|
1353
|
-
: Value;
|
|
700
|
+
mapToPk: true;
|
|
701
|
+
} ? Primary<Value> : Value;
|
|
1354
702
|
type MaybeNullable<Value, Options> = Options extends {
|
|
1355
|
-
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
}
|
|
1360
|
-
? Value | null
|
|
1361
|
-
: Value | null | undefined
|
|
1362
|
-
: Value;
|
|
703
|
+
nullable: true;
|
|
704
|
+
} ? Options extends {
|
|
705
|
+
strictNullable: true;
|
|
706
|
+
} ? Value | null : Value | null | undefined : Value;
|
|
1363
707
|
type MaybeRelationRef<Value, Options> = Options extends {
|
|
1364
|
-
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
:
|
|
1375
|
-
|
|
1376
|
-
kind: 'm:1';
|
|
1377
|
-
}
|
|
1378
|
-
? Value extends object
|
|
1379
|
-
? Ref<Value>
|
|
1380
|
-
: never
|
|
1381
|
-
: Options extends {
|
|
1382
|
-
kind: '1:m';
|
|
1383
|
-
}
|
|
1384
|
-
? Value extends object
|
|
1385
|
-
? Collection<Value>
|
|
1386
|
-
: never
|
|
1387
|
-
: Options extends {
|
|
1388
|
-
kind: 'm:n';
|
|
1389
|
-
}
|
|
1390
|
-
? Value extends object
|
|
1391
|
-
? Collection<Value>
|
|
1392
|
-
: never
|
|
1393
|
-
: Value;
|
|
708
|
+
mapToPk: true;
|
|
709
|
+
} ? Value : Options extends {
|
|
710
|
+
ref: true;
|
|
711
|
+
kind: '1:1';
|
|
712
|
+
} ? Value extends object ? Ref<Value> : never : Options extends {
|
|
713
|
+
ref: true;
|
|
714
|
+
kind: 'm:1';
|
|
715
|
+
} ? Value extends object ? Ref<Value> : never : Options extends {
|
|
716
|
+
kind: '1:m';
|
|
717
|
+
} ? Value extends object ? Collection<Value> : never : Options extends {
|
|
718
|
+
kind: 'm:n';
|
|
719
|
+
} ? Value extends object ? Collection<Value> : never : Value;
|
|
1394
720
|
type MaybeScalarRef<Value, Options> = Options extends {
|
|
1395
|
-
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
: Value;
|
|
1403
|
-
type IsAllPropsOpt<T> = [Exclude<keyof T, symbol>] extends [never]
|
|
1404
|
-
? false
|
|
1405
|
-
: {
|
|
1406
|
-
[K in Exclude<keyof T, symbol>]-?: T[K] extends Opt ? never : K;
|
|
1407
|
-
}[Exclude<keyof T, symbol>] extends never
|
|
1408
|
-
? true
|
|
1409
|
-
: false;
|
|
721
|
+
kind: '1:1' | 'm:1' | '1:m' | 'm:n';
|
|
722
|
+
} ? Value : Options extends {
|
|
723
|
+
ref: true;
|
|
724
|
+
} ? ScalarReference<Value> : Value;
|
|
725
|
+
type IsAllPropsOpt<T> = [Exclude<keyof T, symbol>] extends [never] ? false : {
|
|
726
|
+
[K in Exclude<keyof T, symbol>]-?: T[K] extends Opt ? never : K;
|
|
727
|
+
}[Exclude<keyof T, symbol>] extends never ? true : false;
|
|
1410
728
|
type MaybeOpt<Value, Options> = Options extends {
|
|
1411
|
-
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
:
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
| {
|
|
1430
|
-
persist: false;
|
|
1431
|
-
}
|
|
1432
|
-
| {
|
|
1433
|
-
version: true;
|
|
1434
|
-
}
|
|
1435
|
-
| {
|
|
1436
|
-
formula: string | ((...args: any[]) => any);
|
|
1437
|
-
}
|
|
1438
|
-
? Opt<NonNullable<Value>> | Extract<Value, null | undefined>
|
|
1439
|
-
: Options extends {
|
|
1440
|
-
kind: 'embedded';
|
|
1441
|
-
}
|
|
1442
|
-
? IsAllPropsOpt<Value> extends true
|
|
1443
|
-
? Opt<NonNullable<Value>> | Extract<Value, null | undefined>
|
|
1444
|
-
: Value
|
|
1445
|
-
: Value;
|
|
729
|
+
mapToPk: true;
|
|
730
|
+
} ? Value extends Opt<infer OriginalValue> ? OriginalValue : Value : Options extends {
|
|
731
|
+
autoincrement: true;
|
|
732
|
+
} | {
|
|
733
|
+
onCreate: Function;
|
|
734
|
+
} | {
|
|
735
|
+
default: string | string[] | number | number[] | boolean | null | Date | Raw;
|
|
736
|
+
} | {
|
|
737
|
+
defaultRaw: string;
|
|
738
|
+
} | {
|
|
739
|
+
persist: false;
|
|
740
|
+
} | {
|
|
741
|
+
version: true;
|
|
742
|
+
} | {
|
|
743
|
+
formula: string | ((...args: any[]) => any);
|
|
744
|
+
} ? Opt<NonNullable<Value>> | Extract<Value, null | undefined> : Options extends {
|
|
745
|
+
kind: 'embedded';
|
|
746
|
+
} ? IsAllPropsOpt<Value> extends true ? Opt<NonNullable<Value>> | Extract<Value, null | undefined> : Value : Value;
|
|
1446
747
|
type MaybeHidden<Value, Options> = Options extends {
|
|
1447
|
-
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
: Value;
|
|
1451
|
-
type ValueOf<T extends Dictionary> = T[keyof T] extends infer V
|
|
1452
|
-
? V extends (...args: any[]) => any
|
|
1453
|
-
? never
|
|
1454
|
-
: V
|
|
1455
|
-
: never;
|
|
748
|
+
hidden: true;
|
|
749
|
+
} ? Hidden<NonNullable<Value>> | Extract<Value, null | undefined> : Value;
|
|
750
|
+
type ValueOf<T extends Dictionary> = T[keyof T] extends infer V ? V extends (...args: any[]) => any ? never : V : never;
|
|
1456
751
|
type IsUnion<T, U = T> = T extends U ? ([U] extends [T] ? false : true) : false;
|