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

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 +884 -583
  2. package/EntityManager.js +1922 -1895
  3. package/MikroORM.d.ts +103 -74
  4. package/MikroORM.js +178 -179
  5. package/README.md +1 -1
  6. package/cache/CacheAdapter.d.ts +36 -36
  7. package/cache/FileCacheAdapter.d.ts +30 -24
  8. package/cache/FileCacheAdapter.js +80 -78
  9. package/cache/GeneratedCacheAdapter.d.ts +18 -20
  10. package/cache/GeneratedCacheAdapter.js +30 -30
  11. package/cache/MemoryCacheAdapter.d.ts +18 -20
  12. package/cache/MemoryCacheAdapter.js +35 -36
  13. package/cache/NullCacheAdapter.d.ts +16 -16
  14. package/cache/NullCacheAdapter.js +24 -24
  15. package/connections/Connection.d.ts +95 -84
  16. package/connections/Connection.js +165 -168
  17. package/drivers/DatabaseDriver.d.ts +186 -80
  18. package/drivers/DatabaseDriver.js +450 -443
  19. package/drivers/IDatabaseDriver.d.ts +440 -301
  20. package/entity/BaseEntity.d.ts +120 -83
  21. package/entity/BaseEntity.js +43 -43
  22. package/entity/Collection.d.ts +212 -179
  23. package/entity/Collection.js +727 -721
  24. package/entity/EntityAssigner.d.ts +88 -77
  25. package/entity/EntityAssigner.js +231 -230
  26. package/entity/EntityFactory.d.ts +66 -54
  27. package/entity/EntityFactory.js +425 -383
  28. package/entity/EntityHelper.d.ts +34 -22
  29. package/entity/EntityHelper.js +280 -267
  30. package/entity/EntityIdentifier.d.ts +4 -4
  31. package/entity/EntityIdentifier.js +10 -10
  32. package/entity/EntityLoader.d.ts +98 -72
  33. package/entity/EntityLoader.js +753 -723
  34. package/entity/EntityRepository.d.ts +316 -201
  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 +126 -82
  39. package/entity/Reference.js +278 -274
  40. package/entity/WrappedEntity.d.ts +115 -72
  41. package/entity/WrappedEntity.js +168 -166
  42. package/entity/defineEntity.d.ts +1315 -636
  43. package/entity/defineEntity.js +527 -518
  44. package/entity/utils.d.ts +13 -3
  45. package/entity/utils.js +71 -73
  46. package/entity/validators.js +43 -43
  47. package/entity/wrap.js +8 -8
  48. package/enums.d.ts +258 -253
  49. package/enums.js +251 -252
  50. package/errors.d.ts +114 -72
  51. package/errors.js +350 -253
  52. package/events/EventManager.d.ts +26 -14
  53. package/events/EventManager.js +79 -77
  54. package/events/EventSubscriber.d.ts +29 -29
  55. package/events/TransactionEventBroadcaster.d.ts +15 -8
  56. package/events/TransactionEventBroadcaster.js +14 -14
  57. package/exceptions.d.ts +23 -40
  58. package/exceptions.js +35 -52
  59. package/hydration/Hydrator.d.ts +42 -17
  60. package/hydration/Hydrator.js +43 -43
  61. package/hydration/ObjectHydrator.d.ts +50 -17
  62. package/hydration/ObjectHydrator.js +481 -416
  63. package/index.d.ts +116 -2
  64. package/index.js +10 -1
  65. package/logging/DefaultLogger.d.ts +34 -32
  66. package/logging/DefaultLogger.js +86 -86
  67. package/logging/Logger.d.ts +41 -41
  68. package/logging/SimpleLogger.d.ts +13 -11
  69. package/logging/SimpleLogger.js +22 -22
  70. package/logging/colors.d.ts +6 -6
  71. package/logging/colors.js +11 -10
  72. package/logging/inspect.js +7 -7
  73. package/metadata/EntitySchema.d.ts +211 -127
  74. package/metadata/EntitySchema.js +397 -398
  75. package/metadata/MetadataDiscovery.d.ts +114 -114
  76. package/metadata/MetadataDiscovery.js +1951 -1863
  77. package/metadata/MetadataProvider.d.ts +24 -21
  78. package/metadata/MetadataProvider.js +82 -84
  79. package/metadata/MetadataStorage.d.ts +38 -32
  80. package/metadata/MetadataStorage.js +118 -118
  81. package/metadata/MetadataValidator.d.ts +39 -39
  82. package/metadata/MetadataValidator.js +381 -338
  83. package/metadata/discover-entities.d.ts +5 -2
  84. package/metadata/discover-entities.js +35 -27
  85. package/metadata/types.d.ts +615 -531
  86. package/naming-strategy/AbstractNamingStrategy.d.ts +54 -39
  87. package/naming-strategy/AbstractNamingStrategy.js +90 -85
  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 +109 -99
  93. package/naming-strategy/UnderscoreNamingStrategy.d.ts +7 -7
  94. package/naming-strategy/UnderscoreNamingStrategy.js +21 -21
  95. package/not-supported.js +7 -4
  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 +310 -299
  100. package/platforms/Platform.js +663 -636
  101. package/serialization/EntitySerializer.d.ts +49 -26
  102. package/serialization/EntitySerializer.js +224 -218
  103. package/serialization/EntityTransformer.d.ts +10 -6
  104. package/serialization/EntityTransformer.js +219 -217
  105. package/serialization/SerializationContext.d.ts +27 -23
  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 +17 -10
  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 +83 -79
  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 +75 -49
  158. package/types/index.js +52 -26
  159. package/typings.d.ts +1250 -737
  160. package/typings.js +244 -231
  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 +178 -170
  165. package/unit-of-work/ChangeSetPersister.d.ts +63 -44
  166. package/unit-of-work/ChangeSetPersister.js +442 -421
  167. package/unit-of-work/CommitOrderCalculator.d.ts +40 -40
  168. package/unit-of-work/CommitOrderCalculator.js +89 -88
  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 +181 -141
  172. package/unit-of-work/UnitOfWork.js +1200 -1183
  173. package/utils/AbstractMigrator.d.ts +111 -91
  174. package/utils/AbstractMigrator.js +275 -275
  175. package/utils/AbstractSchemaGenerator.d.ts +43 -34
  176. package/utils/AbstractSchemaGenerator.js +121 -122
  177. package/utils/AsyncContext.d.ts +3 -3
  178. package/utils/AsyncContext.js +34 -35
  179. package/utils/Configuration.d.ts +852 -808
  180. package/utils/Configuration.js +359 -344
  181. package/utils/Cursor.d.ts +40 -22
  182. package/utils/Cursor.js +135 -127
  183. package/utils/DataloaderUtils.d.ts +58 -43
  184. package/utils/DataloaderUtils.js +203 -198
  185. package/utils/EntityComparator.d.ts +98 -81
  186. package/utils/EntityComparator.js +828 -728
  187. package/utils/NullHighlighter.d.ts +1 -1
  188. package/utils/NullHighlighter.js +3 -3
  189. package/utils/QueryHelper.d.ts +79 -51
  190. package/utils/QueryHelper.js +372 -361
  191. package/utils/RawQueryFragment.d.ts +50 -34
  192. package/utils/RawQueryFragment.js +107 -105
  193. package/utils/RequestContext.d.ts +32 -32
  194. package/utils/RequestContext.js +52 -53
  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 +199 -197
  199. package/utils/Utils.d.ts +204 -145
  200. package/utils/Utils.js +812 -810
  201. package/utils/clone.js +104 -113
  202. package/utils/env-vars.js +90 -88
  203. package/utils/fs-utils.d.ts +15 -15
  204. package/utils/fs-utils.js +180 -181
  205. package/utils/upsert-utils.d.ts +20 -5
  206. 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';
@@ -13,303 +25,302 @@ import { Raw } from '../utils/RawQueryFragment.js';
13
25
  export declare const JsonProperty: unique symbol;
14
26
  /** Abstract base class providing database-specific behavior and SQL dialect differences. */
15
27
  export declare abstract class Platform {
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 | {
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
+ | {
101
123
  $in: (string | number)[];
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;
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;
315
326
  }