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