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