@mikro-orm/core 7.0.4 → 7.0.5-dev.0

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