@mikro-orm/core 7.0.2-dev.9 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/EntityManager.d.ts +883 -579
  2. package/EntityManager.js +1897 -1865
  3. package/MikroORM.d.ts +103 -72
  4. package/MikroORM.js +178 -177
  5. package/README.md +128 -294
  6. package/cache/CacheAdapter.d.ts +38 -36
  7. package/cache/FileCacheAdapter.d.ts +30 -24
  8. package/cache/FileCacheAdapter.js +80 -78
  9. package/cache/GeneratedCacheAdapter.d.ts +19 -20
  10. package/cache/GeneratedCacheAdapter.js +31 -30
  11. package/cache/MemoryCacheAdapter.d.ts +19 -20
  12. package/cache/MemoryCacheAdapter.js +36 -36
  13. package/cache/NullCacheAdapter.d.ts +17 -16
  14. package/cache/NullCacheAdapter.js +25 -24
  15. package/connections/Connection.d.ts +99 -75
  16. package/connections/Connection.js +166 -160
  17. package/drivers/DatabaseDriver.d.ts +187 -69
  18. package/drivers/DatabaseDriver.js +451 -432
  19. package/drivers/IDatabaseDriver.d.ts +464 -281
  20. package/drivers/IDatabaseDriver.js +1 -0
  21. package/entity/BaseEntity.d.ts +121 -73
  22. package/entity/BaseEntity.js +44 -33
  23. package/entity/Collection.d.ts +216 -157
  24. package/entity/Collection.js +728 -707
  25. package/entity/EntityAssigner.d.ts +90 -76
  26. package/entity/EntityAssigner.js +232 -229
  27. package/entity/EntityFactory.d.ts +68 -40
  28. package/entity/EntityFactory.js +427 -366
  29. package/entity/EntityHelper.d.ts +34 -22
  30. package/entity/EntityHelper.js +280 -267
  31. package/entity/EntityIdentifier.d.ts +4 -4
  32. package/entity/EntityIdentifier.js +10 -10
  33. package/entity/EntityLoader.d.ts +105 -56
  34. package/entity/EntityLoader.js +754 -722
  35. package/entity/EntityRepository.d.ts +317 -200
  36. package/entity/EntityRepository.js +214 -212
  37. package/entity/PolymorphicRef.d.ts +5 -5
  38. package/entity/PolymorphicRef.js +10 -10
  39. package/entity/Reference.d.ts +130 -66
  40. package/entity/Reference.js +280 -260
  41. package/entity/WrappedEntity.d.ts +116 -53
  42. package/entity/WrappedEntity.js +169 -147
  43. package/entity/defineEntity.d.ts +1290 -614
  44. package/entity/defineEntity.js +521 -511
  45. package/entity/utils.d.ts +13 -3
  46. package/entity/utils.js +71 -73
  47. package/entity/validators.js +43 -43
  48. package/entity/wrap.js +8 -8
  49. package/enums.d.ts +275 -138
  50. package/enums.js +268 -137
  51. package/errors.d.ts +120 -72
  52. package/errors.js +356 -253
  53. package/events/EventManager.d.ts +27 -10
  54. package/events/EventManager.js +80 -73
  55. package/events/EventSubscriber.d.ts +33 -29
  56. package/events/TransactionEventBroadcaster.d.ts +16 -7
  57. package/events/TransactionEventBroadcaster.js +15 -13
  58. package/exceptions.d.ts +23 -40
  59. package/exceptions.js +35 -52
  60. package/hydration/Hydrator.d.ts +43 -16
  61. package/hydration/Hydrator.js +44 -42
  62. package/hydration/ObjectHydrator.d.ts +51 -17
  63. package/hydration/ObjectHydrator.js +480 -416
  64. package/index.d.ts +116 -2
  65. package/index.js +10 -1
  66. package/logging/DefaultLogger.d.ts +35 -30
  67. package/logging/DefaultLogger.js +87 -84
  68. package/logging/Logger.d.ts +45 -40
  69. package/logging/SimpleLogger.d.ts +13 -11
  70. package/logging/SimpleLogger.js +22 -22
  71. package/logging/colors.d.ts +6 -6
  72. package/logging/colors.js +11 -10
  73. package/logging/inspect.js +7 -7
  74. package/metadata/EntitySchema.d.ts +214 -108
  75. package/metadata/EntitySchema.js +398 -379
  76. package/metadata/MetadataDiscovery.d.ts +115 -111
  77. package/metadata/MetadataDiscovery.js +1948 -1857
  78. package/metadata/MetadataProvider.d.ts +25 -14
  79. package/metadata/MetadataProvider.js +83 -77
  80. package/metadata/MetadataStorage.d.ts +39 -19
  81. package/metadata/MetadataStorage.js +119 -106
  82. package/metadata/MetadataValidator.d.ts +39 -39
  83. package/metadata/MetadataValidator.js +381 -338
  84. package/metadata/discover-entities.d.ts +5 -2
  85. package/metadata/discover-entities.js +27 -27
  86. package/metadata/types.d.ts +615 -531
  87. package/naming-strategy/AbstractNamingStrategy.d.ts +55 -39
  88. package/naming-strategy/AbstractNamingStrategy.js +91 -85
  89. package/naming-strategy/EntityCaseNamingStrategy.d.ts +6 -6
  90. package/naming-strategy/EntityCaseNamingStrategy.js +22 -22
  91. package/naming-strategy/MongoNamingStrategy.d.ts +7 -6
  92. package/naming-strategy/MongoNamingStrategy.js +19 -18
  93. package/naming-strategy/NamingStrategy.d.ts +109 -99
  94. package/naming-strategy/UnderscoreNamingStrategy.d.ts +8 -7
  95. package/naming-strategy/UnderscoreNamingStrategy.js +22 -21
  96. package/not-supported.js +7 -4
  97. package/package.json +1 -1
  98. package/platforms/ExceptionConverter.d.ts +2 -1
  99. package/platforms/ExceptionConverter.js +5 -4
  100. package/platforms/Platform.d.ts +310 -236
  101. package/platforms/Platform.js +661 -573
  102. package/serialization/EntitySerializer.d.ts +49 -25
  103. package/serialization/EntitySerializer.js +224 -216
  104. package/serialization/EntityTransformer.d.ts +11 -5
  105. package/serialization/EntityTransformer.js +220 -216
  106. package/serialization/SerializationContext.d.ts +27 -18
  107. package/serialization/SerializationContext.js +105 -100
  108. package/types/ArrayType.d.ts +9 -8
  109. package/types/ArrayType.js +34 -33
  110. package/types/BigIntType.d.ts +17 -10
  111. package/types/BigIntType.js +37 -37
  112. package/types/BlobType.d.ts +4 -3
  113. package/types/BlobType.js +14 -13
  114. package/types/BooleanType.d.ts +5 -4
  115. package/types/BooleanType.js +13 -12
  116. package/types/CharacterType.d.ts +3 -2
  117. package/types/CharacterType.js +7 -6
  118. package/types/DateTimeType.d.ts +6 -5
  119. package/types/DateTimeType.js +16 -15
  120. package/types/DateType.d.ts +6 -5
  121. package/types/DateType.js +16 -15
  122. package/types/DecimalType.d.ts +7 -7
  123. package/types/DecimalType.js +26 -26
  124. package/types/DoubleType.d.ts +3 -3
  125. package/types/DoubleType.js +12 -12
  126. package/types/EnumArrayType.d.ts +6 -5
  127. package/types/EnumArrayType.js +25 -24
  128. package/types/EnumType.d.ts +4 -3
  129. package/types/EnumType.js +12 -11
  130. package/types/FloatType.d.ts +4 -3
  131. package/types/FloatType.js +10 -9
  132. package/types/IntegerType.d.ts +4 -3
  133. package/types/IntegerType.js +10 -9
  134. package/types/IntervalType.d.ts +5 -4
  135. package/types/IntervalType.js +13 -12
  136. package/types/JsonType.d.ts +9 -8
  137. package/types/JsonType.js +33 -32
  138. package/types/MediumIntType.d.ts +2 -1
  139. package/types/MediumIntType.js +4 -3
  140. package/types/SmallIntType.d.ts +4 -3
  141. package/types/SmallIntType.js +10 -9
  142. package/types/StringType.d.ts +5 -4
  143. package/types/StringType.js +13 -12
  144. package/types/TextType.d.ts +4 -3
  145. package/types/TextType.js +10 -9
  146. package/types/TimeType.d.ts +6 -5
  147. package/types/TimeType.js +18 -17
  148. package/types/TinyIntType.d.ts +4 -3
  149. package/types/TinyIntType.js +11 -10
  150. package/types/Type.d.ts +88 -73
  151. package/types/Type.js +85 -74
  152. package/types/Uint8ArrayType.d.ts +5 -4
  153. package/types/Uint8ArrayType.js +22 -21
  154. package/types/UnknownType.d.ts +5 -4
  155. package/types/UnknownType.js +13 -12
  156. package/types/UuidType.d.ts +6 -5
  157. package/types/UuidType.js +20 -19
  158. package/types/index.d.ts +77 -49
  159. package/types/index.js +64 -26
  160. package/typings.d.ts +1388 -729
  161. package/typings.js +255 -231
  162. package/unit-of-work/ChangeSet.d.ts +28 -24
  163. package/unit-of-work/ChangeSet.js +58 -54
  164. package/unit-of-work/ChangeSetComputer.d.ts +13 -11
  165. package/unit-of-work/ChangeSetComputer.js +180 -159
  166. package/unit-of-work/ChangeSetPersister.d.ts +64 -41
  167. package/unit-of-work/ChangeSetPersister.js +443 -418
  168. package/unit-of-work/CommitOrderCalculator.d.ts +40 -40
  169. package/unit-of-work/CommitOrderCalculator.js +89 -88
  170. package/unit-of-work/IdentityMap.d.ts +32 -25
  171. package/unit-of-work/IdentityMap.js +106 -99
  172. package/unit-of-work/UnitOfWork.d.ts +182 -127
  173. package/unit-of-work/UnitOfWork.js +1201 -1169
  174. package/utils/AbstractMigrator.d.ts +111 -91
  175. package/utils/AbstractMigrator.js +275 -275
  176. package/utils/AbstractSchemaGenerator.d.ts +43 -34
  177. package/utils/AbstractSchemaGenerator.js +121 -122
  178. package/utils/AsyncContext.d.ts +3 -3
  179. package/utils/AsyncContext.js +34 -35
  180. package/utils/Configuration.d.ts +853 -801
  181. package/utils/Configuration.js +360 -337
  182. package/utils/Cursor.d.ts +40 -22
  183. package/utils/Cursor.js +135 -127
  184. package/utils/DataloaderUtils.d.ts +58 -43
  185. package/utils/DataloaderUtils.js +203 -198
  186. package/utils/EntityComparator.d.ts +99 -80
  187. package/utils/EntityComparator.js +825 -727
  188. package/utils/NullHighlighter.d.ts +2 -1
  189. package/utils/NullHighlighter.js +4 -3
  190. package/utils/QueryHelper.d.ts +79 -51
  191. package/utils/QueryHelper.js +372 -361
  192. package/utils/RawQueryFragment.d.ts +54 -28
  193. package/utils/RawQueryFragment.js +110 -99
  194. package/utils/RequestContext.d.ts +33 -32
  195. package/utils/RequestContext.js +52 -53
  196. package/utils/TransactionContext.d.ts +17 -16
  197. package/utils/TransactionContext.js +28 -27
  198. package/utils/TransactionManager.d.ts +58 -58
  199. package/utils/TransactionManager.js +199 -197
  200. package/utils/Utils.d.ts +210 -145
  201. package/utils/Utils.js +820 -813
  202. package/utils/clone.js +104 -113
  203. package/utils/env-vars.js +90 -88
  204. package/utils/fs-utils.d.ts +15 -15
  205. package/utils/fs-utils.js +180 -181
  206. package/utils/upsert-utils.d.ts +20 -5
  207. package/utils/upsert-utils.js +114 -116
@@ -1,6 +1,18 @@
1
1
  import { EntityRepository } from '../entity/EntityRepository.js';
2
2
  import { type NamingStrategy } from '../naming-strategy/NamingStrategy.js';
3
- import type { Constructor, EntityMetadata, EntityProperty, IPrimaryKey, ISchemaGenerator, PopulateOptions, Primary, SimpleColumnMeta, FilterQuery, EntityValue, EntityKey } from '../typings.js';
3
+ import type {
4
+ Constructor,
5
+ EntityMetadata,
6
+ EntityProperty,
7
+ IPrimaryKey,
8
+ ISchemaGenerator,
9
+ PopulateOptions,
10
+ Primary,
11
+ SimpleColumnMeta,
12
+ FilterQuery,
13
+ EntityValue,
14
+ EntityKey,
15
+ } from '../typings.js';
4
16
  import { ExceptionConverter } from './ExceptionConverter.js';
5
17
  import type { EntityManager } from '../EntityManager.js';
6
18
  import type { Configuration } from '../utils/Configuration.js';
@@ -9,242 +21,304 @@ import { Type } from '../types/index.js';
9
21
  import type { MikroORM } from '../MikroORM.js';
10
22
  import type { TransformContext } from '../types/Type.js';
11
23
  import { Raw } from '../utils/RawQueryFragment.js';
24
+ /** Symbol used to tag cloned embeddable data for JSON serialization handling. */
12
25
  export declare const JsonProperty: unique symbol;
26
+ /** Abstract base class providing database-specific behavior and SQL dialect differences. */
13
27
  export declare abstract class Platform {
14
- protected readonly exceptionConverter: ExceptionConverter;
15
- protected config: Configuration;
16
- protected namingStrategy: NamingStrategy;
17
- protected timezone?: string;
18
- usesPivotTable(): boolean;
19
- supportsTransactions(): boolean;
20
- usesImplicitTransactions(): boolean;
21
- getNamingStrategy(): {
22
- new (): NamingStrategy;
23
- };
24
- usesReturningStatement(): boolean;
25
- usesOutputStatement(): boolean;
26
- usesCascadeStatement(): boolean;
27
- /** for postgres native enums */
28
- supportsNativeEnums(): boolean;
29
- /** for postgres text enums (default) */
30
- usesEnumCheckConstraints(): boolean;
31
- supportsMaterializedViews(): boolean;
32
- getSchemaHelper(): unknown;
33
- indexForeignKeys(): boolean;
34
- /**
35
- * Whether or not the driver supports retuning list of created PKs back when multi-inserting
36
- */
37
- usesBatchInserts(): boolean;
38
- /**
39
- * Whether or not the driver supports updating many records at once
40
- */
41
- usesBatchUpdates(): boolean;
42
- usesDefaultKeyword(): boolean;
43
- /**
44
- * Normalizes primary key wrapper to scalar value (e.g. mongodb's ObjectId to string)
45
- */
46
- normalizePrimaryKey<T extends number | string = number | string>(data: Primary<T> | IPrimaryKey): T;
47
- /**
48
- * Converts scalar primary key representation to native driver wrapper (e.g. string to mongodb's ObjectId)
49
- */
50
- denormalizePrimaryKey(data: IPrimaryKey): IPrimaryKey;
51
- /**
52
- * Returns the SQL specific for the platform to get the current timestamp
53
- */
54
- getCurrentTimestampSQL(length?: number): string;
55
- getDateTimeTypeDeclarationSQL(column: {
56
- length?: number;
57
- }): string;
58
- getDefaultDateTimeLength(): number;
59
- getDefaultVarcharLength(): number;
60
- getDefaultCharLength(): number;
61
- getDateTypeDeclarationSQL(length?: number): string;
62
- getTimeTypeDeclarationSQL(length?: number): string;
63
- getRegExpOperator(val?: unknown, flags?: string): string;
64
- mapRegExpCondition(mappedKey: string, value: {
65
- $re: string;
66
- $flags?: string;
67
- }): {
68
- sql: string;
69
- params: unknown[];
70
- };
71
- getRegExpValue(val: RegExp): {
72
- $re: string;
73
- $flags?: string;
74
- };
75
- isAllowedTopLevelOperator(operator: string): boolean;
76
- convertVersionValue(value: Date | number, prop: EntityProperty): Date | string | number | {
28
+ protected readonly exceptionConverter: ExceptionConverter;
29
+ protected config: Configuration;
30
+ protected namingStrategy: NamingStrategy;
31
+ protected timezone?: string;
32
+ /** Whether this driver uses pivot tables for M:N relations (SQL drivers do, MongoDB does not). */
33
+ usesPivotTable(): boolean;
34
+ /** Whether this driver supports database transactions. */
35
+ supportsTransactions(): boolean;
36
+ /** Whether the driver wraps operations in implicit transactions by default. */
37
+ usesImplicitTransactions(): boolean;
38
+ /** Returns the default naming strategy constructor for this platform. */
39
+ getNamingStrategy(): {
40
+ new (): NamingStrategy;
41
+ };
42
+ /** Whether the driver supports RETURNING clause (e.g. PostgreSQL). */
43
+ usesReturningStatement(): boolean;
44
+ /** Whether the driver supports OUTPUT clause (e.g. MSSQL). */
45
+ usesOutputStatement(): boolean;
46
+ /** Whether DELETE statements require explicit CASCADE keyword. */
47
+ usesCascadeStatement(): boolean;
48
+ /** for postgres native enums */
49
+ supportsNativeEnums(): boolean;
50
+ /** for postgres text enums (default) */
51
+ usesEnumCheckConstraints(): boolean;
52
+ /** Whether this platform supports materialized views. */
53
+ supportsMaterializedViews(): boolean;
54
+ /** Returns the schema helper instance for this platform, or undefined if not supported. */
55
+ getSchemaHelper(): unknown;
56
+ /** Whether the platform automatically creates indexes on foreign key columns. */
57
+ indexForeignKeys(): boolean;
58
+ /**
59
+ * Whether or not the driver supports retuning list of created PKs back when multi-inserting
60
+ */
61
+ usesBatchInserts(): boolean;
62
+ /**
63
+ * Whether or not the driver supports updating many records at once
64
+ */
65
+ usesBatchUpdates(): boolean;
66
+ /** Whether the platform supports the DEFAULT keyword in INSERT statements. */
67
+ usesDefaultKeyword(): boolean;
68
+ /**
69
+ * Normalizes primary key wrapper to scalar value (e.g. mongodb's ObjectId to string)
70
+ */
71
+ normalizePrimaryKey<T extends number | string = number | string>(data: Primary<T> | IPrimaryKey): T;
72
+ /**
73
+ * Converts scalar primary key representation to native driver wrapper (e.g. string to mongodb's ObjectId)
74
+ */
75
+ denormalizePrimaryKey(data: IPrimaryKey): IPrimaryKey;
76
+ /**
77
+ * Returns the SQL specific for the platform to get the current timestamp
78
+ */
79
+ getCurrentTimestampSQL(length?: number): string;
80
+ /** Returns the SQL type declaration for datetime columns. */
81
+ getDateTimeTypeDeclarationSQL(column: { length?: number }): string;
82
+ /** Returns the default fractional seconds precision for datetime columns. */
83
+ getDefaultDateTimeLength(): number;
84
+ /** Returns the default length for varchar columns. */
85
+ getDefaultVarcharLength(): number;
86
+ /** Returns the default length for char columns. */
87
+ getDefaultCharLength(): number;
88
+ /** Returns the SQL type declaration for date columns. */
89
+ getDateTypeDeclarationSQL(length?: number): string;
90
+ /** Returns the SQL type declaration for time columns. */
91
+ getTimeTypeDeclarationSQL(length?: number): string;
92
+ /** Returns the SQL operator used for regular expression matching. */
93
+ getRegExpOperator(val?: unknown, flags?: string): string;
94
+ /** Builds the SQL clause and parameters for a regular expression condition. */
95
+ mapRegExpCondition(
96
+ mappedKey: string,
97
+ value: {
98
+ $re: string;
99
+ $flags?: string;
100
+ },
101
+ ): {
102
+ sql: string;
103
+ params: unknown[];
104
+ };
105
+ /** Converts a JavaScript RegExp into a platform-specific regex representation. */
106
+ getRegExpValue(val: RegExp): {
107
+ $re: string;
108
+ $flags?: string;
109
+ };
110
+ /** Whether the given operator is allowed at the top level of a query condition. */
111
+ isAllowedTopLevelOperator(operator: string): boolean;
112
+ /** Converts a version field value for comparison in optimistic locking queries. */
113
+ convertVersionValue(
114
+ value: Date | number,
115
+ prop: EntityProperty,
116
+ ):
117
+ | Date
118
+ | string
119
+ | number
120
+ | {
77
121
  $in: (string | number)[];
78
- };
79
- getDefaultVersionLength(): number;
80
- allowsComparingTuples(): boolean;
81
- isBigIntProperty(prop: EntityProperty): boolean;
82
- getDefaultSchemaName(): string | undefined;
83
- getBooleanTypeDeclarationSQL(): string;
84
- getIntegerTypeDeclarationSQL(column: {
85
- length?: number;
86
- unsigned?: boolean;
87
- autoincrement?: boolean;
88
- }): string;
89
- getSmallIntTypeDeclarationSQL(column: {
90
- length?: number;
91
- unsigned?: boolean;
92
- autoincrement?: boolean;
93
- }): string;
94
- getMediumIntTypeDeclarationSQL(column: {
95
- length?: number;
96
- unsigned?: boolean;
97
- autoincrement?: boolean;
98
- }): string;
99
- getTinyIntTypeDeclarationSQL(column: {
100
- length?: number;
101
- unsigned?: boolean;
102
- autoincrement?: boolean;
103
- }): string;
104
- getBigIntTypeDeclarationSQL(column: {
105
- length?: number;
106
- unsigned?: boolean;
107
- autoincrement?: boolean;
108
- }): string;
109
- getCharTypeDeclarationSQL(column: {
110
- length?: number;
111
- }): string;
112
- getVarcharTypeDeclarationSQL(column: {
113
- length?: number;
114
- }): string;
115
- getIntervalTypeDeclarationSQL(column: {
116
- length?: number;
117
- }): string;
118
- getTextTypeDeclarationSQL(_column: {
119
- length?: number;
120
- }): string;
121
- getEnumTypeDeclarationSQL(column: {
122
- items?: unknown[];
123
- fieldNames: string[];
124
- length?: number;
125
- unsigned?: boolean;
126
- autoincrement?: boolean;
127
- }): string;
128
- getFloatDeclarationSQL(): string;
129
- getDoubleDeclarationSQL(): string;
130
- getDecimalTypeDeclarationSQL(column: {
131
- precision?: number;
132
- scale?: number;
133
- }): string;
134
- getUuidTypeDeclarationSQL(column: {
135
- length?: number;
136
- }): string;
137
- extractSimpleType(type: string): string;
138
- /**
139
- * This should be used only to compare types, it can strip some information like the length.
140
- */
141
- normalizeColumnType(type: string, options: {
142
- length?: number;
143
- precision?: number;
144
- scale?: number;
145
- }): string;
146
- getMappedType(type: string): Type<unknown>;
147
- getDefaultMappedType(type: string): Type<unknown>;
148
- supportsMultipleCascadePaths(): boolean;
149
- /**
150
- * Returns true if the platform supports ON UPDATE foreign key rules.
151
- * Oracle doesn't support ON UPDATE rules.
152
- */
153
- supportsOnUpdate(): boolean;
154
- supportsMultipleStatements(): boolean;
155
- supportsUnionWhere(): boolean;
156
- getArrayDeclarationSQL(): string;
157
- marshallArray(values: string[]): string;
158
- unmarshallArray(value: string): string[];
159
- getBlobDeclarationSQL(): string;
160
- getJsonDeclarationSQL(): string;
161
- getSearchJsonPropertySQL(path: string, type: string, aliased: boolean): string | Raw;
162
- getSearchJsonPropertyKey(path: string[], type: string, aliased: boolean, value?: unknown): string | Raw;
163
- processJsonCondition<T extends object>(o: FilterQuery<T>, value: EntityValue<T>, path: EntityKey<T>[], alias: boolean): FilterQuery<T>;
164
- protected getJsonValueType(value: unknown): string;
165
- getJsonIndexDefinition(index: {
166
- columnNames: string[];
167
- }): string[];
168
- getFullTextWhereClause(prop: EntityProperty): string;
169
- supportsCreatingFullTextIndex(): boolean;
170
- getFullTextIndexExpression(indexName: string, schemaName: string | undefined, tableName: string, columns: SimpleColumnMeta[]): string;
171
- convertsJsonAutomatically(): boolean;
172
- convertJsonToDatabaseValue(value: unknown, context?: TransformContext): unknown;
173
- convertJsonToJSValue(value: unknown, context?: TransformContext): unknown;
174
- convertDateToJSValue(value: string | Date): string;
175
- convertIntervalToJSValue(value: string): unknown;
176
- convertIntervalToDatabaseValue(value: unknown): unknown;
177
- usesAsKeyword(): boolean;
178
- /**
179
- * Determines how UUID values are compared in the change set tracking.
180
- * Return `'string'` for inline string comparison (fast), or `'any'` for deep comparison via type methods.
181
- */
182
- compareUuids(): string;
183
- convertUuidToJSValue(value: unknown): unknown;
184
- convertUuidToDatabaseValue(value: unknown): unknown;
185
- parseDate(value: string | number): Date;
186
- getRepositoryClass<T extends object>(): Constructor<EntityRepository<T>>;
187
- getDefaultCharset(): string;
188
- getExceptionConverter(): ExceptionConverter;
189
- /**
190
- * Allows registering extensions of the driver automatically (e.g. `SchemaGenerator` extension in SQL drivers).
191
- */
192
- lookupExtensions(orm: MikroORM): void;
193
- /** @internal */
194
- init(orm: MikroORM): void;
195
- getExtension<T>(extensionName: string, extensionKey: string, moduleName: string, em: EntityManager): T;
196
- getSchemaGenerator(driver: IDatabaseDriver, em?: EntityManager): ISchemaGenerator;
197
- processDateProperty(value: unknown): string | number | Date;
198
- quoteIdentifier(id: string | {
199
- toString: () => string;
200
- }, quote?: string): string;
201
- quoteValue(value: any): string;
202
- escape(value: any): string;
203
- formatQuery(sql: string, params: readonly any[]): string;
204
- cloneEmbeddable<T>(data: T): T;
205
- setConfig(config: Configuration): void;
206
- getConfig(): Configuration;
207
- getTimezone(): string | undefined;
208
- isNumericProperty(prop: EntityProperty, ignoreCustomType?: boolean): boolean;
209
- isNumericColumn(mappedType: Type<unknown>): boolean;
210
- supportsUnsigned(): boolean;
211
- /**
212
- * Returns the default name of index for the given columns
213
- */
214
- getIndexName(tableName: string, columns: string[], type: 'index' | 'unique' | 'foreign' | 'primary' | 'sequence'): string;
215
- getDefaultPrimaryName(tableName: string, columns: string[]): string;
216
- supportsCustomPrimaryKeyNames(): boolean;
217
- isPopulated<T>(key: string, populate: readonly PopulateOptions<T>[] | boolean): boolean;
218
- shouldHaveColumn<T>(prop: EntityProperty<T>, populate: readonly PopulateOptions<T>[] | boolean, exclude?: string[], includeFormulas?: boolean, ignoreInlineEmbeddables?: boolean): boolean;
219
- /**
220
- * Currently not supported due to how knex does complex sqlite diffing (always based on current schema)
221
- */
222
- supportsDownMigrations(): boolean;
223
- supportsDeferredUniqueConstraints(): boolean;
224
- validateMetadata(meta: EntityMetadata): void;
225
- /**
226
- * Generates a custom order by statement given a set of in order values, eg.
227
- * ORDER BY (CASE WHEN priority = 'low' THEN 1 WHEN priority = 'medium' THEN 2 ELSE NULL END)
228
- */
229
- generateCustomOrder(escapedColumn: string, values: unknown[]): void;
230
- /**
231
- * Returns default client url for given driver (e.g. mongodb://127.0.0.1:27017 for mongodb)
232
- */
233
- getDefaultClientUrl(): string;
234
- /**
235
- * @internal
236
- */
237
- castColumn(prop?: {
238
- columnTypes?: string[];
239
- }): string;
240
- /**
241
- * @internal
242
- */
243
- castJsonValue(prop?: {
244
- columnTypes?: string[];
245
- }): string;
246
- /**
247
- * @internal
248
- */
249
- clone(): this;
122
+ };
123
+ /** Returns the default fractional seconds precision for version timestamp columns. */
124
+ getDefaultVersionLength(): number;
125
+ /** Whether the platform supports tuple comparison in WHERE clauses. */
126
+ allowsComparingTuples(): boolean;
127
+ /** Whether the given property maps to a bigint database column. */
128
+ isBigIntProperty(prop: EntityProperty): boolean;
129
+ /** Returns the default schema name for this platform (e.g. "public" for PostgreSQL). */
130
+ getDefaultSchemaName(): string | undefined;
131
+ /** Returns the SQL type declaration for boolean columns. */
132
+ getBooleanTypeDeclarationSQL(): string;
133
+ /** Returns the SQL type declaration for integer columns. */
134
+ getIntegerTypeDeclarationSQL(column: { length?: number; unsigned?: boolean; autoincrement?: boolean }): string;
135
+ getSmallIntTypeDeclarationSQL(column: { length?: number; unsigned?: boolean; autoincrement?: boolean }): string;
136
+ getMediumIntTypeDeclarationSQL(column: { length?: number; unsigned?: boolean; autoincrement?: boolean }): string;
137
+ getTinyIntTypeDeclarationSQL(column: { length?: number; unsigned?: boolean; autoincrement?: boolean }): string;
138
+ getBigIntTypeDeclarationSQL(column: { length?: number; unsigned?: boolean; autoincrement?: boolean }): string;
139
+ getCharTypeDeclarationSQL(column: { length?: number }): string;
140
+ getVarcharTypeDeclarationSQL(column: { length?: number }): string;
141
+ getIntervalTypeDeclarationSQL(column: { length?: number }): string;
142
+ getTextTypeDeclarationSQL(_column: { length?: number }): string;
143
+ getEnumTypeDeclarationSQL(column: {
144
+ items?: unknown[];
145
+ fieldNames: string[];
146
+ length?: number;
147
+ unsigned?: boolean;
148
+ autoincrement?: boolean;
149
+ }): string;
150
+ getFloatDeclarationSQL(): string;
151
+ getDoubleDeclarationSQL(): string;
152
+ getDecimalTypeDeclarationSQL(column: { precision?: number; scale?: number }): string;
153
+ getUuidTypeDeclarationSQL(column: { length?: number }): string;
154
+ /** Extracts the base type name from a full SQL type declaration (e.g. "varchar(255)" -> "varchar"). */
155
+ extractSimpleType(type: string): string;
156
+ /**
157
+ * This should be used only to compare types, it can strip some information like the length.
158
+ */
159
+ normalizeColumnType(
160
+ type: string,
161
+ options: {
162
+ length?: number;
163
+ precision?: number;
164
+ scale?: number;
165
+ },
166
+ ): string;
167
+ /** Returns the mapped Type instance for a given SQL/runtime type string. */
168
+ getMappedType(type: string): Type<unknown>;
169
+ /** Returns the default mapped Type for a given type string when no custom mapping is configured. */
170
+ getDefaultMappedType(type: string): Type<unknown>;
171
+ /** Whether the platform supports multiple cascade paths to the same table. */
172
+ supportsMultipleCascadePaths(): boolean;
173
+ /**
174
+ * Returns true if the platform supports ON UPDATE foreign key rules.
175
+ * Oracle doesn't support ON UPDATE rules.
176
+ */
177
+ supportsOnUpdate(): boolean;
178
+ /** Whether the connection supports executing multiple SQL statements in a single call. */
179
+ supportsMultipleStatements(): boolean;
180
+ /** Whether the platform supports the UNION WHERE optimization for multi-branch queries. */
181
+ supportsUnionWhere(): boolean;
182
+ /** Returns the SQL type declaration used for array storage. */
183
+ getArrayDeclarationSQL(): string;
184
+ /** Serializes a string array into its database storage format. */
185
+ marshallArray(values: string[]): string;
186
+ /** Deserializes a database-stored array string back into a string array. */
187
+ unmarshallArray(value: string): string[];
188
+ getBlobDeclarationSQL(): string;
189
+ getJsonDeclarationSQL(): string;
190
+ getSearchJsonPropertySQL(path: string, type: string, aliased: boolean): string | Raw;
191
+ getSearchJsonPropertyKey(path: string[], type: string, aliased: boolean, value?: unknown): string | Raw;
192
+ processJsonCondition<T extends object>(
193
+ o: FilterQuery<T>,
194
+ value: EntityValue<T>,
195
+ path: EntityKey<T>[],
196
+ alias: boolean,
197
+ ): FilterQuery<T>;
198
+ protected getJsonValueType(value: unknown): string;
199
+ getJsonIndexDefinition(index: { columnNames: string[] }): string[];
200
+ getFullTextWhereClause(prop: EntityProperty): string;
201
+ supportsCreatingFullTextIndex(): boolean;
202
+ getFullTextIndexExpression(
203
+ indexName: string,
204
+ schemaName: string | undefined,
205
+ tableName: string,
206
+ columns: SimpleColumnMeta[],
207
+ ): string;
208
+ /** Whether the driver automatically parses JSON columns into JS objects. */
209
+ convertsJsonAutomatically(): boolean;
210
+ /** Converts a JS value to its JSON database representation (typically JSON.stringify). */
211
+ convertJsonToDatabaseValue(value: unknown, context?: TransformContext): unknown;
212
+ /** Converts a database JSON value to its JS representation. */
213
+ convertJsonToJSValue(value: unknown, context?: TransformContext): unknown;
214
+ convertDateToJSValue(value: string | Date): string;
215
+ convertIntervalToJSValue(value: string): unknown;
216
+ convertIntervalToDatabaseValue(value: unknown): unknown;
217
+ usesAsKeyword(): boolean;
218
+ /**
219
+ * Determines how UUID values are compared in the change set tracking.
220
+ * Return `'string'` for inline string comparison (fast), or `'any'` for deep comparison via type methods.
221
+ */
222
+ compareUuids(): string;
223
+ convertUuidToJSValue(value: unknown): unknown;
224
+ convertUuidToDatabaseValue(value: unknown): unknown;
225
+ /** Parses a string or numeric value into a Date object. */
226
+ parseDate(value: string | number): Date;
227
+ /** Returns the default EntityRepository class used by this platform. */
228
+ getRepositoryClass<T extends object>(): Constructor<EntityRepository<T>>;
229
+ /** Returns the default character set for this platform. */
230
+ getDefaultCharset(): string;
231
+ /** Returns the exception converter for translating native errors to driver exceptions. */
232
+ getExceptionConverter(): ExceptionConverter;
233
+ /**
234
+ * Allows registering extensions of the driver automatically (e.g. `SchemaGenerator` extension in SQL drivers).
235
+ */
236
+ lookupExtensions(orm: MikroORM): void;
237
+ /** @internal */
238
+ init(orm: MikroORM): void;
239
+ /** Retrieves a registered extension (e.g. SchemaGenerator, Migrator), throwing if not found. */
240
+ getExtension<T>(extensionName: string, extensionKey: string, moduleName: string, em: EntityManager): T;
241
+ getSchemaGenerator(driver: IDatabaseDriver, em?: EntityManager): ISchemaGenerator;
242
+ /** Processes a date value before persisting, applying timezone or format conversions. */
243
+ processDateProperty(value: unknown): string | number | Date;
244
+ /** Wraps a table or column identifier with the platform-specific quote character. */
245
+ quoteIdentifier(
246
+ id:
247
+ | string
248
+ | {
249
+ toString: () => string;
250
+ },
251
+ quote?: string,
252
+ ): string;
253
+ /** Quotes a literal value for safe embedding in SQL. */
254
+ quoteValue(value: any): string;
255
+ escape(value: any): string;
256
+ /** Replaces `?` placeholders in SQL with quoted parameter values. */
257
+ formatQuery(sql: string, params: readonly any[]): string;
258
+ /** Deep-clones embeddable data and tags it for JSON serialization. */
259
+ cloneEmbeddable<T>(data: T): T;
260
+ /** Initializes the platform with the ORM configuration. */
261
+ setConfig(config: Configuration): void;
262
+ /** Returns the current ORM configuration. */
263
+ getConfig(): Configuration;
264
+ /** Returns the configured timezone, or undefined if not set. */
265
+ getTimezone(): string | undefined;
266
+ /** Whether the given property represents a numeric database column. */
267
+ isNumericProperty(prop: EntityProperty, ignoreCustomType?: boolean): boolean;
268
+ /** Whether the given mapped type represents a numeric column. */
269
+ isNumericColumn(mappedType: Type<unknown>): boolean;
270
+ /** Whether the platform supports unsigned integer columns. */
271
+ supportsUnsigned(): boolean;
272
+ /**
273
+ * Returns the default name of index for the given columns
274
+ */
275
+ getIndexName(
276
+ tableName: string,
277
+ columns: string[],
278
+ type: 'index' | 'unique' | 'foreign' | 'primary' | 'sequence',
279
+ ): string;
280
+ /** Returns the default primary key constraint name. */
281
+ getDefaultPrimaryName(tableName: string, columns: string[]): string;
282
+ /** Whether the platform supports custom names for primary key constraints. */
283
+ supportsCustomPrimaryKeyNames(): boolean;
284
+ /** Whether the given property key is included in the populate hint. */
285
+ isPopulated<T>(key: string, populate: readonly PopulateOptions<T>[] | boolean): boolean;
286
+ /** Whether the given property should be included as a column in the SELECT query. */
287
+ shouldHaveColumn<T>(
288
+ prop: EntityProperty<T>,
289
+ populate: readonly PopulateOptions<T>[] | boolean,
290
+ exclude?: string[],
291
+ includeFormulas?: boolean,
292
+ ignoreInlineEmbeddables?: boolean,
293
+ ): boolean;
294
+ /**
295
+ * Currently not supported due to how knex does complex sqlite diffing (always based on current schema)
296
+ */
297
+ /** Whether the platform supports generating down migrations. */
298
+ supportsDownMigrations(): boolean;
299
+ /** Whether the platform supports deferred unique constraints. */
300
+ supportsDeferredUniqueConstraints(): boolean;
301
+ /** Platform-specific validation of entity metadata. */
302
+ validateMetadata(meta: EntityMetadata): void;
303
+ /**
304
+ * Generates a custom order by statement given a set of in order values, eg.
305
+ * ORDER BY (CASE WHEN priority = 'low' THEN 1 WHEN priority = 'medium' THEN 2 ELSE NULL END)
306
+ */
307
+ generateCustomOrder(escapedColumn: string, values: unknown[]): void;
308
+ /**
309
+ * Returns default client url for given driver (e.g. mongodb://127.0.0.1:27017 for mongodb)
310
+ */
311
+ getDefaultClientUrl(): string;
312
+ /**
313
+ * @internal
314
+ */
315
+ castColumn(prop?: { columnTypes?: string[] }): string;
316
+ /**
317
+ * @internal
318
+ */
319
+ castJsonValue(prop?: { columnTypes?: string[] }): string;
320
+ /**
321
+ * @internal
322
+ */
323
+ clone(): this;
250
324
  }