@mikro-orm/core 7.0.0-dev.1 → 7.0.0-dev.100

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 (281) hide show
  1. package/EntityManager.d.ts +96 -58
  2. package/EntityManager.js +465 -395
  3. package/MikroORM.d.ts +45 -35
  4. package/MikroORM.js +109 -160
  5. package/README.md +3 -2
  6. package/cache/CacheAdapter.js +1 -2
  7. package/cache/FileCacheAdapter.d.ts +2 -2
  8. package/cache/FileCacheAdapter.js +20 -27
  9. package/cache/GeneratedCacheAdapter.d.ts +2 -3
  10. package/cache/GeneratedCacheAdapter.js +1 -7
  11. package/cache/MemoryCacheAdapter.d.ts +1 -1
  12. package/cache/MemoryCacheAdapter.js +1 -5
  13. package/cache/NullCacheAdapter.d.ts +1 -1
  14. package/cache/NullCacheAdapter.js +1 -5
  15. package/cache/index.d.ts +4 -5
  16. package/cache/index.js +4 -21
  17. package/connections/Connection.d.ts +22 -14
  18. package/connections/Connection.js +27 -23
  19. package/connections/index.d.ts +1 -1
  20. package/connections/index.js +1 -17
  21. package/drivers/DatabaseDriver.d.ts +25 -15
  22. package/drivers/DatabaseDriver.js +77 -64
  23. package/drivers/IDatabaseDriver.d.ts +40 -16
  24. package/drivers/IDatabaseDriver.js +1 -4
  25. package/drivers/index.d.ts +2 -2
  26. package/drivers/index.js +2 -18
  27. package/entity/BaseEntity.d.ts +6 -7
  28. package/entity/BaseEntity.js +16 -23
  29. package/entity/Collection.d.ts +98 -34
  30. package/entity/Collection.js +466 -131
  31. package/entity/EntityAssigner.d.ts +3 -3
  32. package/entity/EntityAssigner.js +67 -64
  33. package/entity/EntityFactory.d.ts +10 -3
  34. package/entity/EntityFactory.js +112 -91
  35. package/entity/EntityHelper.d.ts +2 -2
  36. package/entity/EntityHelper.js +66 -53
  37. package/entity/EntityIdentifier.d.ts +1 -1
  38. package/entity/EntityIdentifier.js +1 -5
  39. package/entity/EntityLoader.d.ts +8 -7
  40. package/entity/EntityLoader.js +161 -128
  41. package/entity/EntityRepository.d.ts +8 -8
  42. package/entity/EntityRepository.js +7 -11
  43. package/entity/Reference.d.ts +10 -13
  44. package/entity/Reference.js +64 -46
  45. package/entity/WrappedEntity.d.ts +12 -17
  46. package/entity/WrappedEntity.js +22 -31
  47. package/entity/defineEntity.d.ts +568 -0
  48. package/entity/defineEntity.js +529 -0
  49. package/entity/index.d.ts +14 -13
  50. package/entity/index.js +14 -29
  51. package/entity/utils.d.ts +8 -1
  52. package/entity/utils.js +22 -13
  53. package/entity/validators.d.ts +11 -0
  54. package/entity/validators.js +65 -0
  55. package/entity/wrap.d.ts +1 -1
  56. package/entity/wrap.js +2 -6
  57. package/enums.d.ts +24 -9
  58. package/enums.js +50 -41
  59. package/errors.d.ts +11 -3
  60. package/errors.js +42 -32
  61. package/events/EventManager.d.ts +5 -4
  62. package/events/EventManager.js +26 -22
  63. package/events/EventSubscriber.d.ts +8 -5
  64. package/events/EventSubscriber.js +1 -2
  65. package/events/TransactionEventBroadcaster.d.ts +3 -3
  66. package/events/TransactionEventBroadcaster.js +1 -5
  67. package/events/index.d.ts +3 -3
  68. package/events/index.js +3 -19
  69. package/exceptions.js +18 -39
  70. package/hydration/Hydrator.d.ts +5 -5
  71. package/hydration/Hydrator.js +2 -6
  72. package/hydration/ObjectHydrator.d.ts +7 -7
  73. package/hydration/ObjectHydrator.js +58 -50
  74. package/hydration/index.d.ts +2 -2
  75. package/hydration/index.js +2 -18
  76. package/index.d.ts +21 -21
  77. package/index.js +20 -46
  78. package/logging/DefaultLogger.d.ts +2 -2
  79. package/logging/DefaultLogger.js +10 -13
  80. package/logging/Logger.d.ts +1 -1
  81. package/logging/Logger.js +1 -2
  82. package/logging/SimpleLogger.d.ts +3 -3
  83. package/logging/SimpleLogger.js +2 -6
  84. package/logging/colors.js +1 -5
  85. package/logging/index.d.ts +5 -4
  86. package/logging/index.js +5 -20
  87. package/logging/inspect.d.ts +2 -0
  88. package/logging/inspect.js +16 -0
  89. package/metadata/EntitySchema.d.ts +14 -10
  90. package/metadata/EntitySchema.js +78 -64
  91. package/metadata/MetadataDiscovery.d.ts +11 -14
  92. package/metadata/MetadataDiscovery.js +278 -317
  93. package/metadata/MetadataProvider.d.ts +13 -4
  94. package/metadata/MetadataProvider.js +47 -8
  95. package/metadata/MetadataStorage.d.ts +2 -7
  96. package/metadata/MetadataStorage.js +19 -35
  97. package/metadata/MetadataValidator.d.ts +3 -10
  98. package/metadata/MetadataValidator.js +51 -64
  99. package/metadata/discover-entities.d.ts +5 -0
  100. package/metadata/discover-entities.js +40 -0
  101. package/metadata/index.d.ts +6 -6
  102. package/metadata/index.js +6 -22
  103. package/metadata/types.d.ts +480 -0
  104. package/metadata/types.js +1 -0
  105. package/naming-strategy/AbstractNamingStrategy.d.ts +7 -3
  106. package/naming-strategy/AbstractNamingStrategy.js +11 -9
  107. package/naming-strategy/EntityCaseNamingStrategy.d.ts +1 -1
  108. package/naming-strategy/EntityCaseNamingStrategy.js +2 -6
  109. package/naming-strategy/MongoNamingStrategy.d.ts +1 -1
  110. package/naming-strategy/MongoNamingStrategy.js +2 -6
  111. package/naming-strategy/NamingStrategy.d.ts +12 -2
  112. package/naming-strategy/NamingStrategy.js +1 -2
  113. package/naming-strategy/UnderscoreNamingStrategy.d.ts +1 -1
  114. package/naming-strategy/UnderscoreNamingStrategy.js +2 -6
  115. package/naming-strategy/index.d.ts +5 -5
  116. package/naming-strategy/index.js +5 -21
  117. package/not-supported.d.ts +2 -0
  118. package/not-supported.js +4 -0
  119. package/package.json +19 -20
  120. package/platforms/ExceptionConverter.d.ts +2 -2
  121. package/platforms/ExceptionConverter.js +4 -8
  122. package/platforms/Platform.d.ts +15 -22
  123. package/platforms/Platform.js +58 -88
  124. package/platforms/index.d.ts +2 -2
  125. package/platforms/index.js +2 -18
  126. package/serialization/EntitySerializer.d.ts +4 -2
  127. package/serialization/EntitySerializer.js +64 -51
  128. package/serialization/EntityTransformer.d.ts +1 -1
  129. package/serialization/EntityTransformer.js +48 -42
  130. package/serialization/SerializationContext.d.ts +2 -2
  131. package/serialization/SerializationContext.js +24 -25
  132. package/serialization/index.d.ts +3 -3
  133. package/serialization/index.js +3 -19
  134. package/types/ArrayType.d.ts +3 -3
  135. package/types/ArrayType.js +6 -11
  136. package/types/BigIntType.d.ts +12 -9
  137. package/types/BigIntType.js +6 -6
  138. package/types/BlobType.d.ts +3 -4
  139. package/types/BlobType.js +2 -11
  140. package/types/BooleanType.d.ts +5 -4
  141. package/types/BooleanType.js +5 -6
  142. package/types/CharacterType.d.ts +3 -3
  143. package/types/CharacterType.js +2 -6
  144. package/types/DateTimeType.d.ts +3 -3
  145. package/types/DateTimeType.js +2 -6
  146. package/types/DateType.d.ts +3 -3
  147. package/types/DateType.js +2 -6
  148. package/types/DecimalType.d.ts +9 -7
  149. package/types/DecimalType.js +5 -8
  150. package/types/DoubleType.d.ts +3 -3
  151. package/types/DoubleType.js +4 -7
  152. package/types/EnumArrayType.d.ts +4 -4
  153. package/types/EnumArrayType.js +4 -10
  154. package/types/EnumType.d.ts +3 -3
  155. package/types/EnumType.js +2 -6
  156. package/types/FloatType.d.ts +3 -3
  157. package/types/FloatType.js +2 -6
  158. package/types/IntegerType.d.ts +3 -3
  159. package/types/IntegerType.js +2 -6
  160. package/types/IntervalType.d.ts +3 -3
  161. package/types/IntervalType.js +2 -6
  162. package/types/JsonType.d.ts +4 -4
  163. package/types/JsonType.js +9 -8
  164. package/types/MediumIntType.d.ts +3 -3
  165. package/types/MediumIntType.js +2 -6
  166. package/types/SmallIntType.d.ts +3 -3
  167. package/types/SmallIntType.js +2 -6
  168. package/types/StringType.d.ts +3 -3
  169. package/types/StringType.js +2 -6
  170. package/types/TextType.d.ts +3 -3
  171. package/types/TextType.js +2 -6
  172. package/types/TimeType.d.ts +3 -3
  173. package/types/TimeType.js +4 -8
  174. package/types/TinyIntType.d.ts +3 -3
  175. package/types/TinyIntType.js +3 -6
  176. package/types/Type.d.ts +4 -6
  177. package/types/Type.js +6 -10
  178. package/types/Uint8ArrayType.d.ts +3 -4
  179. package/types/Uint8ArrayType.js +3 -12
  180. package/types/UnknownType.d.ts +3 -3
  181. package/types/UnknownType.js +2 -6
  182. package/types/UuidType.d.ts +3 -3
  183. package/types/UuidType.js +2 -6
  184. package/types/index.d.ts +25 -25
  185. package/types/index.js +52 -79
  186. package/typings.d.ts +134 -93
  187. package/typings.js +67 -65
  188. package/unit-of-work/ChangeSet.d.ts +1 -4
  189. package/unit-of-work/ChangeSet.js +13 -17
  190. package/unit-of-work/ChangeSetComputer.d.ts +8 -9
  191. package/unit-of-work/ChangeSetComputer.js +36 -38
  192. package/unit-of-work/ChangeSetPersister.d.ts +11 -9
  193. package/unit-of-work/ChangeSetPersister.js +100 -65
  194. package/unit-of-work/CommitOrderCalculator.d.ts +1 -1
  195. package/unit-of-work/CommitOrderCalculator.js +6 -10
  196. package/unit-of-work/IdentityMap.d.ts +1 -1
  197. package/unit-of-work/IdentityMap.js +1 -5
  198. package/unit-of-work/UnitOfWork.d.ts +16 -8
  199. package/unit-of-work/UnitOfWork.js +266 -209
  200. package/unit-of-work/index.d.ts +6 -6
  201. package/unit-of-work/index.js +6 -22
  202. package/utils/AbstractSchemaGenerator.d.ts +11 -11
  203. package/utils/AbstractSchemaGenerator.js +21 -20
  204. package/utils/Configuration.d.ts +774 -224
  205. package/utils/Configuration.js +166 -216
  206. package/utils/ConfigurationLoader.d.ts +1 -53
  207. package/utils/ConfigurationLoader.js +1 -367
  208. package/utils/Cursor.d.ts +6 -9
  209. package/utils/Cursor.js +25 -25
  210. package/utils/DataloaderUtils.d.ts +18 -8
  211. package/utils/DataloaderUtils.js +63 -21
  212. package/utils/EntityComparator.d.ts +9 -5
  213. package/utils/EntityComparator.js +155 -108
  214. package/utils/NullHighlighter.d.ts +1 -1
  215. package/utils/NullHighlighter.js +1 -5
  216. package/utils/QueryHelper.d.ts +12 -4
  217. package/utils/QueryHelper.js +110 -53
  218. package/utils/RawQueryFragment.d.ts +37 -14
  219. package/utils/RawQueryFragment.js +50 -33
  220. package/utils/RequestContext.d.ts +2 -2
  221. package/utils/RequestContext.js +3 -7
  222. package/utils/TransactionContext.d.ts +1 -1
  223. package/utils/TransactionContext.js +4 -8
  224. package/utils/TransactionManager.d.ts +65 -0
  225. package/utils/TransactionManager.js +223 -0
  226. package/utils/Utils.d.ts +16 -100
  227. package/utils/Utils.js +114 -332
  228. package/utils/clone.js +7 -11
  229. package/utils/env-vars.d.ts +3 -0
  230. package/utils/env-vars.js +87 -0
  231. package/utils/fs-utils.d.ts +12 -0
  232. package/utils/fs-utils.js +97 -0
  233. package/utils/index.d.ts +14 -13
  234. package/utils/index.js +14 -29
  235. package/utils/upsert-utils.d.ts +8 -3
  236. package/utils/upsert-utils.js +57 -10
  237. package/decorators/Check.d.ts +0 -3
  238. package/decorators/Check.js +0 -16
  239. package/decorators/CreateRequestContext.d.ts +0 -3
  240. package/decorators/CreateRequestContext.js +0 -33
  241. package/decorators/Embeddable.d.ts +0 -8
  242. package/decorators/Embeddable.js +0 -14
  243. package/decorators/Embedded.d.ts +0 -18
  244. package/decorators/Embedded.js +0 -20
  245. package/decorators/Entity.d.ts +0 -18
  246. package/decorators/Entity.js +0 -16
  247. package/decorators/Enum.d.ts +0 -9
  248. package/decorators/Enum.js +0 -19
  249. package/decorators/Filter.d.ts +0 -2
  250. package/decorators/Filter.js +0 -11
  251. package/decorators/Formula.d.ts +0 -5
  252. package/decorators/Formula.js +0 -18
  253. package/decorators/Indexed.d.ts +0 -17
  254. package/decorators/Indexed.js +0 -24
  255. package/decorators/ManyToMany.d.ts +0 -40
  256. package/decorators/ManyToMany.js +0 -16
  257. package/decorators/ManyToOne.d.ts +0 -30
  258. package/decorators/ManyToOne.js +0 -16
  259. package/decorators/OneToMany.d.ts +0 -28
  260. package/decorators/OneToMany.js +0 -20
  261. package/decorators/OneToOne.d.ts +0 -24
  262. package/decorators/OneToOne.js +0 -10
  263. package/decorators/PrimaryKey.d.ts +0 -9
  264. package/decorators/PrimaryKey.js +0 -23
  265. package/decorators/Property.d.ts +0 -250
  266. package/decorators/Property.js +0 -34
  267. package/decorators/Transactional.d.ts +0 -13
  268. package/decorators/Transactional.js +0 -31
  269. package/decorators/hooks.d.ts +0 -16
  270. package/decorators/hooks.js +0 -59
  271. package/decorators/index.d.ts +0 -17
  272. package/decorators/index.js +0 -36
  273. package/entity/ArrayCollection.d.ts +0 -116
  274. package/entity/ArrayCollection.js +0 -399
  275. package/entity/EntityValidator.d.ts +0 -19
  276. package/entity/EntityValidator.js +0 -154
  277. package/index.mjs +0 -199
  278. package/metadata/ReflectMetadataProvider.d.ts +0 -8
  279. package/metadata/ReflectMetadataProvider.js +0 -48
  280. package/utils/resolveContextProvider.d.ts +0 -10
  281. package/utils/resolveContextProvider.js +0 -31
@@ -1,6 +1,6 @@
1
- import { Type } from './Type';
2
- import type { Platform } from '../platforms';
3
- import type { EntityProperty } from '../typings';
1
+ import { Type } from './Type.js';
2
+ import type { Platform } from '../platforms/Platform.js';
3
+ import type { EntityProperty } from '../typings.js';
4
4
  export declare class StringType extends Type<string | null | undefined, string | null | undefined> {
5
5
  getColumnType(prop: EntityProperty, platform: Platform): string;
6
6
  compareAsType(): string;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StringType = void 0;
4
- const Type_1 = require("./Type");
5
- class StringType extends Type_1.Type {
1
+ import { Type } from './Type.js';
2
+ export class StringType extends Type {
6
3
  getColumnType(prop, platform) {
7
4
  return platform.getVarcharTypeDeclarationSQL(prop);
8
5
  }
@@ -16,4 +13,3 @@ class StringType extends Type_1.Type {
16
13
  return platform.getDefaultVarcharLength();
17
14
  }
18
15
  }
19
- exports.StringType = StringType;
@@ -1,6 +1,6 @@
1
- import { Type } from './Type';
2
- import type { Platform } from '../platforms';
3
- import type { EntityProperty } from '../typings';
1
+ import { Type } from './Type.js';
2
+ import type { Platform } from '../platforms/Platform.js';
3
+ import type { EntityProperty } from '../typings.js';
4
4
  export declare class TextType extends Type<string | null | undefined, string | null | undefined> {
5
5
  getColumnType(prop: EntityProperty, platform: Platform): string;
6
6
  compareAsType(): string;
package/types/TextType.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextType = void 0;
4
- const Type_1 = require("./Type");
5
- class TextType extends Type_1.Type {
1
+ import { Type } from './Type.js';
2
+ export class TextType extends Type {
6
3
  getColumnType(prop, platform) {
7
4
  return platform.getTextTypeDeclarationSQL(prop);
8
5
  }
@@ -13,4 +10,3 @@ class TextType extends Type_1.Type {
13
10
  return false;
14
11
  }
15
12
  }
16
- exports.TextType = TextType;
@@ -1,6 +1,6 @@
1
- import { Type } from './Type';
2
- import type { Platform } from '../platforms';
3
- import type { EntityProperty } from '../typings';
1
+ import { Type } from './Type.js';
2
+ import type { Platform } from '../platforms/Platform.js';
3
+ import type { EntityProperty } from '../typings.js';
4
4
  export declare class TimeType extends Type {
5
5
  convertToDatabaseValue(value: any, platform: Platform): string;
6
6
  compareAsType(): string;
package/types/TimeType.js CHANGED
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimeType = void 0;
4
- const Type_1 = require("./Type");
5
- const errors_1 = require("../errors");
6
- class TimeType extends Type_1.Type {
1
+ import { Type } from './Type.js';
2
+ import { ValidationError } from '../errors.js';
3
+ export class TimeType extends Type {
7
4
  convertToDatabaseValue(value, platform) {
8
5
  if (value && !value.toString().match(/^\d{2,}:(?:[0-5]\d):(?:[0-5]\d)$/)) {
9
- throw errors_1.ValidationError.invalidType(TimeType, value, 'JS');
6
+ throw ValidationError.invalidType(TimeType, value, 'JS');
10
7
  }
11
8
  return super.convertToDatabaseValue(value, platform);
12
9
  }
@@ -23,4 +20,3 @@ class TimeType extends Type_1.Type {
23
20
  return platform.getDefaultDateTimeLength();
24
21
  }
25
22
  }
26
- exports.TimeType = TimeType;
@@ -1,6 +1,6 @@
1
- import { Type } from './Type';
2
- import type { Platform } from '../platforms';
3
- import type { EntityProperty } from '../typings';
1
+ import { Type } from './Type.js';
2
+ import type { Platform } from '../platforms/Platform.js';
3
+ import type { EntityProperty } from '../typings.js';
4
4
  export declare class TinyIntType extends Type<number | null | undefined, number | null | undefined> {
5
5
  getColumnType(prop: EntityProperty, platform: Platform): string;
6
6
  compareAsType(): string;
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TinyIntType = void 0;
4
- const Type_1 = require("./Type");
5
- class TinyIntType extends Type_1.Type {
1
+ import { Type } from './Type.js';
2
+ export class TinyIntType extends Type {
6
3
  getColumnType(prop, platform) {
7
4
  return platform.getTinyIntTypeDeclarationSQL(prop);
8
5
  }
9
6
  compareAsType() {
10
7
  return 'number';
11
8
  }
9
+ /* v8 ignore next */
12
10
  ensureComparable() {
13
11
  return false;
14
12
  }
15
13
  }
16
- exports.TinyIntType = TinyIntType;
package/types/Type.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { inspect } from 'node:util';
2
- import type { Platform } from '../platforms';
3
- import type { Constructor, EntityMetadata, EntityProperty } from '../typings';
1
+ import type { Platform } from '../platforms/Platform.js';
2
+ import type { Constructor, EntityMetadata, EntityProperty } from '../typings.js';
4
3
  export interface TransformContext {
5
4
  fromQuery?: boolean;
5
+ force?: boolean;
6
6
  key?: string;
7
7
  mode?: 'hydration' | 'query' | 'query-data' | 'discovery' | 'serialization';
8
8
  }
@@ -23,7 +23,7 @@ export declare abstract class Type<JSType = string, DBType = JSType> {
23
23
  /**
24
24
  * Converts a value from its database representation to its JS representation of this type.
25
25
  */
26
- convertToJSValue(value: DBType, platform: Platform): JSType;
26
+ convertToJSValue(value: DBType, platform: Platform, context?: TransformContext): JSType;
27
27
  /**
28
28
  * Converts a value from its JS representation to its database representation of this type.
29
29
  */
@@ -78,6 +78,4 @@ export declare abstract class Type<JSType = string, DBType = JSType> {
78
78
  * Checks whether the argument is instance of `Type`.
79
79
  */
80
80
  static isMappedType(data: any): data is Type<any>;
81
- /** @ignore */
82
- [inspect.custom](depth?: number): string;
83
81
  }
package/types/Type.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Type = void 0;
4
- const node_util_1 = require("node:util");
5
- class Type {
1
+ import { inspect } from '../logging/inspect.js';
2
+ export class Type {
6
3
  static types = new Map();
7
4
  platform;
8
5
  meta;
@@ -16,7 +13,7 @@ class Type {
16
13
  /**
17
14
  * Converts a value from its database representation to its JS representation of this type.
18
15
  */
19
- convertToJSValue(value, platform) {
16
+ convertToJSValue(value, platform, context) {
20
17
  return value;
21
18
  }
22
19
  /**
@@ -68,17 +65,16 @@ class Type {
68
65
  return !!data?.__mappedType;
69
66
  }
70
67
  /** @ignore */
71
- [node_util_1.inspect.custom](depth = 2) {
68
+ [Symbol.for('nodejs.util.inspect.custom')](depth = 2) {
72
69
  const object = { ...this };
73
70
  const hidden = ['prop', 'platform', 'meta'];
74
71
  hidden.forEach(k => delete object[k]);
75
- const ret = (0, node_util_1.inspect)(object, { depth });
72
+ const ret = inspect(object, { depth });
76
73
  const name = this.constructor.name;
77
- /* istanbul ignore next */
74
+ /* v8 ignore next */
78
75
  return ret === '[Object]' ? `[${name}]` : name + ' ' + ret;
79
76
  }
80
77
  }
81
- exports.Type = Type;
82
78
  Object.defineProperties(Type.prototype, {
83
79
  __mappedType: { value: true, enumerable: false, writable: false },
84
80
  });
@@ -1,10 +1,9 @@
1
- import { Type } from './Type';
2
- import type { Platform } from '../platforms';
3
- import type { EntityProperty } from '../typings';
1
+ import { Type } from './Type.js';
2
+ import type { Platform } from '../platforms/Platform.js';
3
+ import type { EntityProperty } from '../typings.js';
4
4
  export declare class Uint8ArrayType extends Type<Uint8Array | null> {
5
5
  convertToDatabaseValue(value: Uint8Array): Buffer;
6
6
  convertToJSValue(value: Buffer): Uint8Array | null;
7
7
  compareAsType(): string;
8
- ensureComparable(): boolean;
9
8
  getColumnType(prop: EntityProperty, platform: Platform): string;
10
9
  }
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Uint8ArrayType = void 0;
4
- const Type_1 = require("./Type");
5
- class Uint8ArrayType extends Type_1.Type {
1
+ import { Type } from './Type.js';
2
+ export class Uint8ArrayType extends Type {
6
3
  convertToDatabaseValue(value) {
7
4
  if (!value) {
8
5
  return value;
@@ -10,28 +7,22 @@ class Uint8ArrayType extends Type_1.Type {
10
7
  return Buffer.from(value);
11
8
  }
12
9
  convertToJSValue(value) {
10
+ /* v8 ignore next */
13
11
  if (!value) {
14
12
  return value;
15
13
  }
16
- /* istanbul ignore else */
17
14
  if (value instanceof Buffer) {
18
15
  return new Uint8Array(value);
19
16
  }
20
- /* istanbul ignore else */
21
17
  if (value.buffer instanceof Buffer) {
22
18
  return new Uint8Array(value.buffer);
23
19
  }
24
- /* istanbul ignore next */
25
20
  return new Uint8Array(Buffer.from(value));
26
21
  }
27
22
  compareAsType() {
28
23
  return 'Buffer';
29
24
  }
30
- ensureComparable() {
31
- return false;
32
- }
33
25
  getColumnType(prop, platform) {
34
26
  return platform.getBlobDeclarationSQL();
35
27
  }
36
28
  }
37
- exports.Uint8ArrayType = Uint8ArrayType;
@@ -1,6 +1,6 @@
1
- import type { EntityProperty } from '../typings';
2
- import type { Platform } from '../platforms/Platform';
3
- import { Type } from './Type';
1
+ import type { EntityProperty } from '../typings.js';
2
+ import type { Platform } from '../platforms/Platform.js';
3
+ import { Type } from './Type.js';
4
4
  export declare class UnknownType extends Type<unknown | null | undefined, unknown | null | undefined> {
5
5
  getColumnType(prop: EntityProperty, platform: Platform): string;
6
6
  get runtimeType(): string;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnknownType = void 0;
4
- const Type_1 = require("./Type");
5
- class UnknownType extends Type_1.Type {
1
+ import { Type } from './Type.js';
2
+ export class UnknownType extends Type {
6
3
  getColumnType(prop, platform) {
7
4
  return prop.columnTypes?.[0] ?? platform.getVarcharTypeDeclarationSQL(prop);
8
5
  }
@@ -16,4 +13,3 @@ class UnknownType extends Type_1.Type {
16
13
  return false;
17
14
  }
18
15
  }
19
- exports.UnknownType = UnknownType;
@@ -1,6 +1,6 @@
1
- import { Type } from './Type';
2
- import type { Platform } from '../platforms';
3
- import type { EntityProperty } from '../typings';
1
+ import { Type } from './Type.js';
2
+ import type { Platform } from '../platforms/Platform.js';
3
+ import type { EntityProperty } from '../typings.js';
4
4
  export declare class UuidType extends Type<string | null | undefined> {
5
5
  getColumnType(prop: EntityProperty, platform: Platform): string;
6
6
  compareAsType(): string;
package/types/UuidType.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UuidType = void 0;
4
- const Type_1 = require("./Type");
5
- class UuidType extends Type_1.Type {
1
+ import { Type } from './Type.js';
2
+ export class UuidType extends Type {
6
3
  getColumnType(prop, platform) {
7
4
  return platform.getUuidTypeDeclarationSQL(prop);
8
5
  }
@@ -13,4 +10,3 @@ class UuidType extends Type_1.Type {
13
10
  return false;
14
11
  }
15
12
  }
16
- exports.UuidType = UuidType;
package/types/index.d.ts CHANGED
@@ -1,28 +1,28 @@
1
- import { ArrayType } from './ArrayType';
2
- import { BigIntType } from './BigIntType';
3
- import { BlobType } from './BlobType';
4
- import { BooleanType } from './BooleanType';
5
- import { DateTimeType } from './DateTimeType';
6
- import { DateType } from './DateType';
7
- import { DecimalType } from './DecimalType';
8
- import { DoubleType } from './DoubleType';
9
- import { EnumArrayType } from './EnumArrayType';
10
- import { EnumType } from './EnumType';
11
- import { CharacterType } from './CharacterType';
12
- import { FloatType } from './FloatType';
13
- import { IntegerType } from './IntegerType';
14
- import { IntervalType } from './IntervalType';
15
- import { JsonType } from './JsonType';
16
- import { MediumIntType } from './MediumIntType';
17
- import { SmallIntType } from './SmallIntType';
18
- import { StringType } from './StringType';
19
- import { TextType } from './TextType';
20
- import { TimeType } from './TimeType';
21
- import { TinyIntType } from './TinyIntType';
22
- import { IType, TransformContext, Type } from './Type';
23
- import { Uint8ArrayType } from './Uint8ArrayType';
24
- import { UnknownType } from './UnknownType';
25
- import { UuidType } from './UuidType';
1
+ import { ArrayType } from './ArrayType.js';
2
+ import { BigIntType } from './BigIntType.js';
3
+ import { BlobType } from './BlobType.js';
4
+ import { BooleanType } from './BooleanType.js';
5
+ import { DateTimeType } from './DateTimeType.js';
6
+ import { DateType } from './DateType.js';
7
+ import { DecimalType } from './DecimalType.js';
8
+ import { DoubleType } from './DoubleType.js';
9
+ import { EnumArrayType } from './EnumArrayType.js';
10
+ import { EnumType } from './EnumType.js';
11
+ import { CharacterType } from './CharacterType.js';
12
+ import { FloatType } from './FloatType.js';
13
+ import { IntegerType } from './IntegerType.js';
14
+ import { IntervalType } from './IntervalType.js';
15
+ import { JsonType } from './JsonType.js';
16
+ import { MediumIntType } from './MediumIntType.js';
17
+ import { SmallIntType } from './SmallIntType.js';
18
+ import { StringType } from './StringType.js';
19
+ import { TextType } from './TextType.js';
20
+ import { TimeType } from './TimeType.js';
21
+ import { TinyIntType } from './TinyIntType.js';
22
+ import { type IType, type TransformContext, Type } from './Type.js';
23
+ import { Uint8ArrayType } from './Uint8ArrayType.js';
24
+ import { UnknownType } from './UnknownType.js';
25
+ import { UuidType } from './UuidType.js';
26
26
  export { Type, DateType, TimeType, DateTimeType, BigIntType, BlobType, Uint8ArrayType, ArrayType, EnumArrayType, EnumType, JsonType, IntegerType, SmallIntType, TinyIntType, MediumIntType, FloatType, DoubleType, BooleanType, DecimalType, StringType, UuidType, TextType, UnknownType, TransformContext, IntervalType, IType, CharacterType, };
27
27
  export declare const types: {
28
28
  readonly date: typeof DateType;
package/types/index.js CHANGED
@@ -1,80 +1,53 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.t = exports.types = exports.CharacterType = exports.IntervalType = exports.UnknownType = exports.TextType = exports.UuidType = exports.StringType = exports.DecimalType = exports.BooleanType = exports.DoubleType = exports.FloatType = exports.MediumIntType = exports.TinyIntType = exports.SmallIntType = exports.IntegerType = exports.JsonType = exports.EnumType = exports.EnumArrayType = exports.ArrayType = exports.Uint8ArrayType = exports.BlobType = exports.BigIntType = exports.DateTimeType = exports.TimeType = exports.DateType = exports.Type = void 0;
4
- const ArrayType_1 = require("./ArrayType");
5
- Object.defineProperty(exports, "ArrayType", { enumerable: true, get: function () { return ArrayType_1.ArrayType; } });
6
- const BigIntType_1 = require("./BigIntType");
7
- Object.defineProperty(exports, "BigIntType", { enumerable: true, get: function () { return BigIntType_1.BigIntType; } });
8
- const BlobType_1 = require("./BlobType");
9
- Object.defineProperty(exports, "BlobType", { enumerable: true, get: function () { return BlobType_1.BlobType; } });
10
- const BooleanType_1 = require("./BooleanType");
11
- Object.defineProperty(exports, "BooleanType", { enumerable: true, get: function () { return BooleanType_1.BooleanType; } });
12
- const DateTimeType_1 = require("./DateTimeType");
13
- Object.defineProperty(exports, "DateTimeType", { enumerable: true, get: function () { return DateTimeType_1.DateTimeType; } });
14
- const DateType_1 = require("./DateType");
15
- Object.defineProperty(exports, "DateType", { enumerable: true, get: function () { return DateType_1.DateType; } });
16
- const DecimalType_1 = require("./DecimalType");
17
- Object.defineProperty(exports, "DecimalType", { enumerable: true, get: function () { return DecimalType_1.DecimalType; } });
18
- const DoubleType_1 = require("./DoubleType");
19
- Object.defineProperty(exports, "DoubleType", { enumerable: true, get: function () { return DoubleType_1.DoubleType; } });
20
- const EnumArrayType_1 = require("./EnumArrayType");
21
- Object.defineProperty(exports, "EnumArrayType", { enumerable: true, get: function () { return EnumArrayType_1.EnumArrayType; } });
22
- const EnumType_1 = require("./EnumType");
23
- Object.defineProperty(exports, "EnumType", { enumerable: true, get: function () { return EnumType_1.EnumType; } });
24
- const CharacterType_1 = require("./CharacterType");
25
- Object.defineProperty(exports, "CharacterType", { enumerable: true, get: function () { return CharacterType_1.CharacterType; } });
26
- const FloatType_1 = require("./FloatType");
27
- Object.defineProperty(exports, "FloatType", { enumerable: true, get: function () { return FloatType_1.FloatType; } });
28
- const IntegerType_1 = require("./IntegerType");
29
- Object.defineProperty(exports, "IntegerType", { enumerable: true, get: function () { return IntegerType_1.IntegerType; } });
30
- const IntervalType_1 = require("./IntervalType");
31
- Object.defineProperty(exports, "IntervalType", { enumerable: true, get: function () { return IntervalType_1.IntervalType; } });
32
- const JsonType_1 = require("./JsonType");
33
- Object.defineProperty(exports, "JsonType", { enumerable: true, get: function () { return JsonType_1.JsonType; } });
34
- const MediumIntType_1 = require("./MediumIntType");
35
- Object.defineProperty(exports, "MediumIntType", { enumerable: true, get: function () { return MediumIntType_1.MediumIntType; } });
36
- const SmallIntType_1 = require("./SmallIntType");
37
- Object.defineProperty(exports, "SmallIntType", { enumerable: true, get: function () { return SmallIntType_1.SmallIntType; } });
38
- const StringType_1 = require("./StringType");
39
- Object.defineProperty(exports, "StringType", { enumerable: true, get: function () { return StringType_1.StringType; } });
40
- const TextType_1 = require("./TextType");
41
- Object.defineProperty(exports, "TextType", { enumerable: true, get: function () { return TextType_1.TextType; } });
42
- const TimeType_1 = require("./TimeType");
43
- Object.defineProperty(exports, "TimeType", { enumerable: true, get: function () { return TimeType_1.TimeType; } });
44
- const TinyIntType_1 = require("./TinyIntType");
45
- Object.defineProperty(exports, "TinyIntType", { enumerable: true, get: function () { return TinyIntType_1.TinyIntType; } });
46
- const Type_1 = require("./Type");
47
- Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return Type_1.Type; } });
48
- const Uint8ArrayType_1 = require("./Uint8ArrayType");
49
- Object.defineProperty(exports, "Uint8ArrayType", { enumerable: true, get: function () { return Uint8ArrayType_1.Uint8ArrayType; } });
50
- const UnknownType_1 = require("./UnknownType");
51
- Object.defineProperty(exports, "UnknownType", { enumerable: true, get: function () { return UnknownType_1.UnknownType; } });
52
- const UuidType_1 = require("./UuidType");
53
- Object.defineProperty(exports, "UuidType", { enumerable: true, get: function () { return UuidType_1.UuidType; } });
54
- exports.types = {
55
- date: DateType_1.DateType,
56
- time: TimeType_1.TimeType,
57
- datetime: DateTimeType_1.DateTimeType,
58
- bigint: BigIntType_1.BigIntType,
59
- blob: BlobType_1.BlobType,
60
- uint8array: Uint8ArrayType_1.Uint8ArrayType,
61
- array: ArrayType_1.ArrayType,
62
- enumArray: EnumArrayType_1.EnumArrayType,
63
- enum: EnumType_1.EnumType,
64
- json: JsonType_1.JsonType,
65
- integer: IntegerType_1.IntegerType,
66
- smallint: SmallIntType_1.SmallIntType,
67
- tinyint: TinyIntType_1.TinyIntType,
68
- mediumint: MediumIntType_1.MediumIntType,
69
- float: FloatType_1.FloatType,
70
- double: DoubleType_1.DoubleType,
71
- boolean: BooleanType_1.BooleanType,
72
- decimal: DecimalType_1.DecimalType,
73
- character: CharacterType_1.CharacterType,
74
- string: StringType_1.StringType,
75
- uuid: UuidType_1.UuidType,
76
- text: TextType_1.TextType,
77
- interval: IntervalType_1.IntervalType,
78
- unknown: UnknownType_1.UnknownType,
1
+ import { ArrayType } from './ArrayType.js';
2
+ import { BigIntType } from './BigIntType.js';
3
+ import { BlobType } from './BlobType.js';
4
+ import { BooleanType } from './BooleanType.js';
5
+ import { DateTimeType } from './DateTimeType.js';
6
+ import { DateType } from './DateType.js';
7
+ import { DecimalType } from './DecimalType.js';
8
+ import { DoubleType } from './DoubleType.js';
9
+ import { EnumArrayType } from './EnumArrayType.js';
10
+ import { EnumType } from './EnumType.js';
11
+ import { CharacterType } from './CharacterType.js';
12
+ import { FloatType } from './FloatType.js';
13
+ import { IntegerType } from './IntegerType.js';
14
+ import { IntervalType } from './IntervalType.js';
15
+ import { JsonType } from './JsonType.js';
16
+ import { MediumIntType } from './MediumIntType.js';
17
+ import { SmallIntType } from './SmallIntType.js';
18
+ import { StringType } from './StringType.js';
19
+ import { TextType } from './TextType.js';
20
+ import { TimeType } from './TimeType.js';
21
+ import { TinyIntType } from './TinyIntType.js';
22
+ import { Type } from './Type.js';
23
+ import { Uint8ArrayType } from './Uint8ArrayType.js';
24
+ import { UnknownType } from './UnknownType.js';
25
+ import { UuidType } from './UuidType.js';
26
+ export { Type, DateType, TimeType, DateTimeType, BigIntType, BlobType, Uint8ArrayType, ArrayType, EnumArrayType, EnumType, JsonType, IntegerType, SmallIntType, TinyIntType, MediumIntType, FloatType, DoubleType, BooleanType, DecimalType, StringType, UuidType, TextType, UnknownType, IntervalType, CharacterType, };
27
+ export const types = {
28
+ date: DateType,
29
+ time: TimeType,
30
+ datetime: DateTimeType,
31
+ bigint: BigIntType,
32
+ blob: BlobType,
33
+ uint8array: Uint8ArrayType,
34
+ array: ArrayType,
35
+ enumArray: EnumArrayType,
36
+ enum: EnumType,
37
+ json: JsonType,
38
+ integer: IntegerType,
39
+ smallint: SmallIntType,
40
+ tinyint: TinyIntType,
41
+ mediumint: MediumIntType,
42
+ float: FloatType,
43
+ double: DoubleType,
44
+ boolean: BooleanType,
45
+ decimal: DecimalType,
46
+ character: CharacterType,
47
+ string: StringType,
48
+ uuid: UuidType,
49
+ text: TextType,
50
+ interval: IntervalType,
51
+ unknown: UnknownType,
79
52
  };
80
- exports.t = exports.types;
53
+ export const t = types;