@yandjin-mikro-orm/core 6.1.4-rc-sti-changes-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/EntityManager.d.ts +553 -0
  2. package/EntityManager.js +1736 -0
  3. package/LICENSE +21 -0
  4. package/MikroORM.d.ts +102 -0
  5. package/MikroORM.js +258 -0
  6. package/README.md +383 -0
  7. package/cache/CacheAdapter.d.ts +40 -0
  8. package/cache/CacheAdapter.js +2 -0
  9. package/cache/FileCacheAdapter.d.ts +31 -0
  10. package/cache/FileCacheAdapter.js +90 -0
  11. package/cache/GeneratedCacheAdapter.d.ts +25 -0
  12. package/cache/GeneratedCacheAdapter.js +38 -0
  13. package/cache/MemoryCacheAdapter.d.ts +24 -0
  14. package/cache/MemoryCacheAdapter.js +44 -0
  15. package/cache/NullCacheAdapter.d.ts +19 -0
  16. package/cache/NullCacheAdapter.js +30 -0
  17. package/cache/index.d.ts +5 -0
  18. package/cache/index.js +21 -0
  19. package/connections/Connection.d.ts +85 -0
  20. package/connections/Connection.js +128 -0
  21. package/connections/index.d.ts +1 -0
  22. package/connections/index.js +17 -0
  23. package/decorators/Check.d.ts +3 -0
  24. package/decorators/Check.js +17 -0
  25. package/decorators/CreateRequestContext.d.ts +2 -0
  26. package/decorators/CreateRequestContext.js +31 -0
  27. package/decorators/Embeddable.d.ts +8 -0
  28. package/decorators/Embeddable.js +15 -0
  29. package/decorators/Embedded.d.ts +13 -0
  30. package/decorators/Embedded.js +21 -0
  31. package/decorators/EnsureRequestContext.d.ts +2 -0
  32. package/decorators/EnsureRequestContext.js +26 -0
  33. package/decorators/Entity.d.ts +18 -0
  34. package/decorators/Entity.js +17 -0
  35. package/decorators/Enum.d.ts +9 -0
  36. package/decorators/Enum.js +20 -0
  37. package/decorators/Filter.d.ts +2 -0
  38. package/decorators/Filter.js +12 -0
  39. package/decorators/Formula.d.ts +5 -0
  40. package/decorators/Formula.js +19 -0
  41. package/decorators/Indexed.d.ts +12 -0
  42. package/decorators/Indexed.js +25 -0
  43. package/decorators/ManyToMany.d.ts +21 -0
  44. package/decorators/ManyToMany.js +17 -0
  45. package/decorators/ManyToOne.d.ts +15 -0
  46. package/decorators/ManyToOne.js +17 -0
  47. package/decorators/OneToMany.d.ts +18 -0
  48. package/decorators/OneToMany.js +21 -0
  49. package/decorators/OneToOne.d.ts +12 -0
  50. package/decorators/OneToOne.js +11 -0
  51. package/decorators/PrimaryKey.d.ts +8 -0
  52. package/decorators/PrimaryKey.js +24 -0
  53. package/decorators/Property.d.ts +218 -0
  54. package/decorators/Property.js +35 -0
  55. package/decorators/Subscriber.d.ts +1 -0
  56. package/decorators/Subscriber.js +2 -0
  57. package/decorators/hooks.d.ts +16 -0
  58. package/decorators/hooks.js +60 -0
  59. package/decorators/index.d.ts +17 -0
  60. package/decorators/index.js +36 -0
  61. package/drivers/DatabaseDriver.d.ts +72 -0
  62. package/drivers/DatabaseDriver.js +358 -0
  63. package/drivers/IDatabaseDriver.d.ts +193 -0
  64. package/drivers/IDatabaseDriver.js +4 -0
  65. package/drivers/index.d.ts +2 -0
  66. package/drivers/index.js +18 -0
  67. package/entity/ArrayCollection.d.ts +113 -0
  68. package/entity/ArrayCollection.js +386 -0
  69. package/entity/BaseEntity.d.ts +22 -0
  70. package/entity/BaseEntity.js +47 -0
  71. package/entity/Collection.d.ts +104 -0
  72. package/entity/Collection.js +373 -0
  73. package/entity/EntityAssigner.d.ts +28 -0
  74. package/entity/EntityAssigner.js +226 -0
  75. package/entity/EntityFactory.d.ts +41 -0
  76. package/entity/EntityFactory.js +302 -0
  77. package/entity/EntityHelper.d.ts +29 -0
  78. package/entity/EntityHelper.js +250 -0
  79. package/entity/EntityIdentifier.d.ts +10 -0
  80. package/entity/EntityIdentifier.js +19 -0
  81. package/entity/EntityLoader.d.ts +65 -0
  82. package/entity/EntityLoader.js +579 -0
  83. package/entity/EntityRepository.d.ts +161 -0
  84. package/entity/EntityRepository.js +207 -0
  85. package/entity/EntityValidator.d.ts +19 -0
  86. package/entity/EntityValidator.js +152 -0
  87. package/entity/Reference.d.ts +89 -0
  88. package/entity/Reference.js +242 -0
  89. package/entity/WrappedEntity.d.ts +67 -0
  90. package/entity/WrappedEntity.js +146 -0
  91. package/entity/index.d.ts +13 -0
  92. package/entity/index.js +29 -0
  93. package/entity/wrap.d.ts +15 -0
  94. package/entity/wrap.js +26 -0
  95. package/enums.d.ts +160 -0
  96. package/enums.js +169 -0
  97. package/errors.d.ts +65 -0
  98. package/errors.js +222 -0
  99. package/events/EventManager.d.ts +17 -0
  100. package/events/EventManager.js +77 -0
  101. package/events/EventSubscriber.d.ts +39 -0
  102. package/events/EventSubscriber.js +2 -0
  103. package/events/TransactionEventBroadcaster.d.ts +11 -0
  104. package/events/TransactionEventBroadcaster.js +17 -0
  105. package/events/index.d.ts +3 -0
  106. package/events/index.js +19 -0
  107. package/exceptions.d.ts +104 -0
  108. package/exceptions.js +130 -0
  109. package/hydration/Hydrator.d.ts +23 -0
  110. package/hydration/Hydrator.js +51 -0
  111. package/hydration/ObjectHydrator.d.ts +24 -0
  112. package/hydration/ObjectHydrator.js +332 -0
  113. package/hydration/index.d.ts +2 -0
  114. package/hydration/index.js +18 -0
  115. package/index.d.ts +25 -0
  116. package/index.js +50 -0
  117. package/index.mjs +192 -0
  118. package/logging/DefaultLogger.d.ts +32 -0
  119. package/logging/DefaultLogger.js +90 -0
  120. package/logging/Logger.d.ts +56 -0
  121. package/logging/Logger.js +2 -0
  122. package/logging/SimpleLogger.d.ts +17 -0
  123. package/logging/SimpleLogger.js +31 -0
  124. package/logging/colors.d.ts +9 -0
  125. package/logging/colors.js +20 -0
  126. package/logging/index.d.ts +4 -0
  127. package/logging/index.js +20 -0
  128. package/metadata/EntitySchema.d.ts +74 -0
  129. package/metadata/EntitySchema.js +293 -0
  130. package/metadata/MetadataDiscovery.d.ts +71 -0
  131. package/metadata/MetadataDiscovery.js +1244 -0
  132. package/metadata/MetadataProvider.d.ts +11 -0
  133. package/metadata/MetadataProvider.js +23 -0
  134. package/metadata/MetadataStorage.d.ts +22 -0
  135. package/metadata/MetadataStorage.js +87 -0
  136. package/metadata/MetadataValidator.d.ts +24 -0
  137. package/metadata/MetadataValidator.js +213 -0
  138. package/metadata/ReflectMetadataProvider.d.ts +8 -0
  139. package/metadata/ReflectMetadataProvider.js +48 -0
  140. package/metadata/index.d.ts +6 -0
  141. package/metadata/index.js +22 -0
  142. package/naming-strategy/AbstractNamingStrategy.d.ts +18 -0
  143. package/naming-strategy/AbstractNamingStrategy.js +48 -0
  144. package/naming-strategy/EntityCaseNamingStrategy.d.ts +12 -0
  145. package/naming-strategy/EntityCaseNamingStrategy.js +32 -0
  146. package/naming-strategy/MongoNamingStrategy.d.ts +9 -0
  147. package/naming-strategy/MongoNamingStrategy.js +25 -0
  148. package/naming-strategy/NamingStrategy.d.ts +52 -0
  149. package/naming-strategy/NamingStrategy.js +2 -0
  150. package/naming-strategy/UnderscoreNamingStrategy.d.ts +10 -0
  151. package/naming-strategy/UnderscoreNamingStrategy.js +28 -0
  152. package/naming-strategy/index.d.ts +5 -0
  153. package/naming-strategy/index.js +21 -0
  154. package/package.json +70 -0
  155. package/platforms/ExceptionConverter.d.ts +5 -0
  156. package/platforms/ExceptionConverter.js +11 -0
  157. package/platforms/Platform.d.ts +201 -0
  158. package/platforms/Platform.js +452 -0
  159. package/platforms/index.d.ts +2 -0
  160. package/platforms/index.js +18 -0
  161. package/serialization/EntitySerializer.d.ts +34 -0
  162. package/serialization/EntitySerializer.js +206 -0
  163. package/serialization/EntityTransformer.d.ts +8 -0
  164. package/serialization/EntityTransformer.js +192 -0
  165. package/serialization/SerializationContext.d.ts +30 -0
  166. package/serialization/SerializationContext.js +111 -0
  167. package/serialization/index.d.ts +3 -0
  168. package/serialization/index.js +19 -0
  169. package/types/ArrayType.d.ts +13 -0
  170. package/types/ArrayType.js +47 -0
  171. package/types/BigIntType.d.ts +16 -0
  172. package/types/BigIntType.js +45 -0
  173. package/types/BlobType.d.ts +10 -0
  174. package/types/BlobType.js +27 -0
  175. package/types/BooleanType.d.ts +8 -0
  176. package/types/BooleanType.js +16 -0
  177. package/types/DateTimeType.d.ts +8 -0
  178. package/types/DateTimeType.js +16 -0
  179. package/types/DateType.d.ts +8 -0
  180. package/types/DateType.js +16 -0
  181. package/types/DecimalType.d.ts +11 -0
  182. package/types/DecimalType.js +22 -0
  183. package/types/DoubleType.d.ts +11 -0
  184. package/types/DoubleType.js +22 -0
  185. package/types/EnumArrayType.d.ts +9 -0
  186. package/types/EnumArrayType.js +32 -0
  187. package/types/EnumType.d.ts +8 -0
  188. package/types/EnumType.js +16 -0
  189. package/types/FloatType.d.ts +8 -0
  190. package/types/FloatType.js +16 -0
  191. package/types/IntegerType.d.ts +8 -0
  192. package/types/IntegerType.js +16 -0
  193. package/types/IntervalType.d.ts +8 -0
  194. package/types/IntervalType.js +16 -0
  195. package/types/JsonType.d.ts +13 -0
  196. package/types/JsonType.js +34 -0
  197. package/types/MediumIntType.d.ts +6 -0
  198. package/types/MediumIntType.js +10 -0
  199. package/types/SmallIntType.d.ts +8 -0
  200. package/types/SmallIntType.js +16 -0
  201. package/types/StringType.d.ts +8 -0
  202. package/types/StringType.js +16 -0
  203. package/types/TextType.d.ts +8 -0
  204. package/types/TextType.js +16 -0
  205. package/types/TimeType.d.ts +9 -0
  206. package/types/TimeType.js +23 -0
  207. package/types/TinyIntType.d.ts +8 -0
  208. package/types/TinyIntType.js +16 -0
  209. package/types/Type.d.ts +64 -0
  210. package/types/Type.js +84 -0
  211. package/types/Uint8ArrayType.d.ts +11 -0
  212. package/types/Uint8ArrayType.js +37 -0
  213. package/types/UnknownType.d.ts +7 -0
  214. package/types/UnknownType.js +13 -0
  215. package/types/UuidType.d.ts +7 -0
  216. package/types/UuidType.js +13 -0
  217. package/types/index.d.ts +75 -0
  218. package/types/index.js +77 -0
  219. package/typings.d.ts +767 -0
  220. package/typings.js +198 -0
  221. package/unit-of-work/ChangeSet.d.ts +34 -0
  222. package/unit-of-work/ChangeSet.js +62 -0
  223. package/unit-of-work/ChangeSetComputer.d.ts +26 -0
  224. package/unit-of-work/ChangeSetComputer.js +153 -0
  225. package/unit-of-work/ChangeSetPersister.d.ts +50 -0
  226. package/unit-of-work/ChangeSetPersister.js +361 -0
  227. package/unit-of-work/CommitOrderCalculator.d.ts +62 -0
  228. package/unit-of-work/CommitOrderCalculator.js +113 -0
  229. package/unit-of-work/IdentityMap.d.ts +17 -0
  230. package/unit-of-work/IdentityMap.js +84 -0
  231. package/unit-of-work/UnitOfWork.d.ts +124 -0
  232. package/unit-of-work/UnitOfWork.js +1013 -0
  233. package/unit-of-work/index.d.ts +6 -0
  234. package/unit-of-work/index.js +22 -0
  235. package/utils/AbstractSchemaGenerator.d.ts +38 -0
  236. package/utils/AbstractSchemaGenerator.js +101 -0
  237. package/utils/Configuration.d.ts +390 -0
  238. package/utils/Configuration.js +357 -0
  239. package/utils/ConfigurationLoader.d.ts +29 -0
  240. package/utils/ConfigurationLoader.js +282 -0
  241. package/utils/Cursor.d.ts +77 -0
  242. package/utils/Cursor.js +169 -0
  243. package/utils/DataloaderUtils.d.ts +43 -0
  244. package/utils/DataloaderUtils.js +194 -0
  245. package/utils/EntityComparator.d.ts +73 -0
  246. package/utils/EntityComparator.js +568 -0
  247. package/utils/NullHighlighter.d.ts +4 -0
  248. package/utils/NullHighlighter.js +9 -0
  249. package/utils/QueryHelper.d.ts +28 -0
  250. package/utils/QueryHelper.js +228 -0
  251. package/utils/RawQueryFragment.d.ts +96 -0
  252. package/utils/RawQueryFragment.js +188 -0
  253. package/utils/RequestContext.d.ts +34 -0
  254. package/utils/RequestContext.js +54 -0
  255. package/utils/TransactionContext.d.ts +19 -0
  256. package/utils/TransactionContext.js +34 -0
  257. package/utils/Utils.d.ts +274 -0
  258. package/utils/Utils.js +1073 -0
  259. package/utils/clone.d.ts +6 -0
  260. package/utils/clone.js +127 -0
  261. package/utils/index.d.ts +13 -0
  262. package/utils/index.js +29 -0
  263. package/utils/upsert-utils.d.ts +6 -0
  264. package/utils/upsert-utils.js +33 -0
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BigIntType = void 0;
4
+ const Type_1 = require("./Type");
5
+ /**
6
+ * This type will automatically convert string values returned from the database to native JS bigints (default)
7
+ * or numbers (safe only for values up to `Number.MAX_SAFE_INTEGER`), or strings, depending on the `mode`.
8
+ */
9
+ class BigIntType extends Type_1.Type {
10
+ mode;
11
+ constructor(mode) {
12
+ super();
13
+ this.mode = mode;
14
+ }
15
+ convertToDatabaseValue(value) {
16
+ if (value == null) {
17
+ return value;
18
+ }
19
+ return '' + value;
20
+ }
21
+ convertToJSValue(value) {
22
+ if (value == null) {
23
+ return value;
24
+ }
25
+ switch (this.mode) {
26
+ case 'number':
27
+ return Number(value);
28
+ case 'string':
29
+ return String(value);
30
+ case 'bigint':
31
+ default:
32
+ return BigInt(value);
33
+ }
34
+ }
35
+ toJSON(value) {
36
+ return this.convertToDatabaseValue(value);
37
+ }
38
+ getColumnType(prop, platform) {
39
+ return platform.getBigIntTypeDeclarationSQL(prop);
40
+ }
41
+ compareAsType() {
42
+ return this.mode ?? 'bigint';
43
+ }
44
+ }
45
+ exports.BigIntType = BigIntType;
@@ -0,0 +1,10 @@
1
+ /// <reference types="node" />
2
+ import { Uint8ArrayType } from './Uint8ArrayType';
3
+ import type { Platform } from '../platforms';
4
+ import type { EntityProperty } from '../typings';
5
+ export declare class BlobType extends Uint8ArrayType {
6
+ convertToJSValue(value: Buffer): Buffer | null;
7
+ compareAsType(): string;
8
+ ensureComparable(): boolean;
9
+ getColumnType(prop: EntityProperty, platform: Platform): string;
10
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BlobType = void 0;
4
+ const Uint8ArrayType_1 = require("./Uint8ArrayType");
5
+ class BlobType extends Uint8ArrayType_1.Uint8ArrayType {
6
+ convertToJSValue(value) {
7
+ if (value instanceof Buffer || !value) {
8
+ return value;
9
+ }
10
+ /* istanbul ignore else */
11
+ if (value.buffer instanceof Buffer) {
12
+ return value.buffer;
13
+ }
14
+ /* istanbul ignore next */
15
+ return Buffer.from(value);
16
+ }
17
+ compareAsType() {
18
+ return 'Buffer';
19
+ }
20
+ ensureComparable() {
21
+ return false;
22
+ }
23
+ getColumnType(prop, platform) {
24
+ return platform.getBlobDeclarationSQL();
25
+ }
26
+ }
27
+ exports.BlobType = BlobType;
@@ -0,0 +1,8 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class BooleanType extends Type<number | null | undefined, number | null | undefined> {
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ compareAsType(): string;
7
+ ensureComparable(): boolean;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BooleanType = void 0;
4
+ const Type_1 = require("./Type");
5
+ class BooleanType extends Type_1.Type {
6
+ getColumnType(prop, platform) {
7
+ return platform.getBooleanTypeDeclarationSQL();
8
+ }
9
+ compareAsType() {
10
+ return 'boolean';
11
+ }
12
+ ensureComparable() {
13
+ return false;
14
+ }
15
+ }
16
+ exports.BooleanType = BooleanType;
@@ -0,0 +1,8 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class DateTimeType extends Type<Date, string> {
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ compareAsType(): string;
7
+ ensureComparable(): boolean;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateTimeType = void 0;
4
+ const Type_1 = require("./Type");
5
+ class DateTimeType extends Type_1.Type {
6
+ getColumnType(prop, platform) {
7
+ return platform.getDateTimeTypeDeclarationSQL({ length: prop.length });
8
+ }
9
+ compareAsType() {
10
+ return 'Date';
11
+ }
12
+ ensureComparable() {
13
+ return false;
14
+ }
15
+ }
16
+ exports.DateTimeType = DateTimeType;
@@ -0,0 +1,8 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class DateType extends Type<string | null | undefined, string | null | undefined> {
5
+ compareAsType(): string;
6
+ ensureComparable(): boolean;
7
+ getColumnType(prop: EntityProperty, platform: Platform): string;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateType = void 0;
4
+ const Type_1 = require("./Type");
5
+ class DateType extends Type_1.Type {
6
+ compareAsType() {
7
+ return 'string';
8
+ }
9
+ ensureComparable() {
10
+ return false;
11
+ }
12
+ getColumnType(prop, platform) {
13
+ return platform.getDateTypeDeclarationSQL(prop.length);
14
+ }
15
+ }
16
+ exports.DateType = DateType;
@@ -0,0 +1,11 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ /**
5
+ * Type that maps an SQL DECIMAL to a JS string or number.
6
+ */
7
+ export declare class DecimalType extends Type<string | number, string> {
8
+ convertToJSValue(value: string): number | string;
9
+ getColumnType(prop: EntityProperty, platform: Platform): string;
10
+ compareAsType(): string;
11
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DecimalType = void 0;
4
+ const Type_1 = require("./Type");
5
+ /**
6
+ * Type that maps an SQL DECIMAL to a JS string or number.
7
+ */
8
+ class DecimalType extends Type_1.Type {
9
+ convertToJSValue(value) {
10
+ if (this.prop?.runtimeType === 'number') {
11
+ return +value;
12
+ }
13
+ return value;
14
+ }
15
+ getColumnType(prop, platform) {
16
+ return platform.getDecimalTypeDeclarationSQL(prop);
17
+ }
18
+ compareAsType() {
19
+ return this.prop?.runtimeType ?? 'string';
20
+ }
21
+ }
22
+ exports.DecimalType = DecimalType;
@@ -0,0 +1,11 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ /**
5
+ * Type that maps an SQL DOUBLE to a JS string or number.
6
+ */
7
+ export declare class DoubleType extends Type<number | string, string> {
8
+ convertToJSValue(value: string): number | string;
9
+ getColumnType(prop: EntityProperty, platform: Platform): string;
10
+ compareAsType(): string;
11
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DoubleType = void 0;
4
+ const Type_1 = require("./Type");
5
+ /**
6
+ * Type that maps an SQL DOUBLE to a JS string or number.
7
+ */
8
+ class DoubleType extends Type_1.Type {
9
+ convertToJSValue(value) {
10
+ if (this.prop?.runtimeType === 'number') {
11
+ return +value;
12
+ }
13
+ return value;
14
+ }
15
+ getColumnType(prop, platform) {
16
+ return platform.getDoubleDeclarationSQL();
17
+ }
18
+ compareAsType() {
19
+ return this.prop?.runtimeType ?? 'number';
20
+ }
21
+ }
22
+ exports.DoubleType = DoubleType;
@@ -0,0 +1,9 @@
1
+ import { ArrayType } from './ArrayType';
2
+ import type { Platform } from '../platforms';
3
+ import type { TransformContext } from './Type';
4
+ export declare class EnumArrayType<T extends string | number = string> extends ArrayType<T> {
5
+ private readonly owner;
6
+ private readonly items?;
7
+ constructor(owner: string, items?: T[] | undefined, hydrate?: (i: string) => T);
8
+ convertToDatabaseValue(value: T[] | null, platform: Platform, context?: TransformContext): string | null;
9
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnumArrayType = void 0;
4
+ const util_1 = require("util");
5
+ const ArrayType_1 = require("./ArrayType");
6
+ const errors_1 = require("../errors");
7
+ function mapHydrator(items, hydrate) {
8
+ if (items && items.length > 0 && typeof items[0] === 'number') {
9
+ return (i) => +i;
10
+ }
11
+ return hydrate;
12
+ }
13
+ class EnumArrayType extends ArrayType_1.ArrayType {
14
+ owner;
15
+ items;
16
+ constructor(owner, items, hydrate = i => i) {
17
+ super(mapHydrator(items, hydrate));
18
+ this.owner = owner;
19
+ this.items = items;
20
+ }
21
+ convertToDatabaseValue(value, platform, context) {
22
+ /* istanbul ignore else */
23
+ if (Array.isArray(value) && Array.isArray(this.items)) {
24
+ const invalid = value.filter(v => !this.items.includes(v));
25
+ if (invalid.length > 0) {
26
+ throw new errors_1.ValidationError(`Invalid enum array items provided in ${this.owner}: ${(0, util_1.inspect)(invalid)}`);
27
+ }
28
+ }
29
+ return super.convertToDatabaseValue(value, platform, context);
30
+ }
31
+ }
32
+ exports.EnumArrayType = EnumArrayType;
@@ -0,0 +1,8 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class EnumType extends Type<string | null | undefined> {
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ compareAsType(): string;
7
+ ensureComparable(): boolean;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnumType = void 0;
4
+ const Type_1 = require("./Type");
5
+ class EnumType extends Type_1.Type {
6
+ getColumnType(prop, platform) {
7
+ return prop.columnTypes?.[0] ?? platform.getEnumTypeDeclarationSQL(prop);
8
+ }
9
+ compareAsType() {
10
+ return 'string';
11
+ }
12
+ ensureComparable() {
13
+ return false;
14
+ }
15
+ }
16
+ exports.EnumType = EnumType;
@@ -0,0 +1,8 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class FloatType extends Type<number | null | undefined, number | null | undefined> {
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ compareAsType(): string;
7
+ ensureComparable(): boolean;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FloatType = void 0;
4
+ const Type_1 = require("./Type");
5
+ class FloatType extends Type_1.Type {
6
+ getColumnType(prop, platform) {
7
+ return platform.getFloatDeclarationSQL();
8
+ }
9
+ compareAsType() {
10
+ return 'number';
11
+ }
12
+ ensureComparable() {
13
+ return false;
14
+ }
15
+ }
16
+ exports.FloatType = FloatType;
@@ -0,0 +1,8 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class IntegerType extends Type<number | null | undefined, number | null | undefined> {
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ compareAsType(): string;
7
+ ensureComparable(): boolean;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntegerType = void 0;
4
+ const Type_1 = require("./Type");
5
+ class IntegerType extends Type_1.Type {
6
+ getColumnType(prop, platform) {
7
+ return platform.getIntegerTypeDeclarationSQL(prop);
8
+ }
9
+ compareAsType() {
10
+ return 'number';
11
+ }
12
+ ensureComparable() {
13
+ return false;
14
+ }
15
+ }
16
+ exports.IntegerType = IntegerType;
@@ -0,0 +1,8 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class IntervalType extends Type<string | null | undefined, string | null | undefined> {
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ convertToJSValue(value: string | null | undefined, platform: Platform): string | null | undefined;
7
+ convertToDatabaseValue(value: string | null | undefined, platform: Platform): string | null | undefined;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntervalType = void 0;
4
+ const Type_1 = require("./Type");
5
+ class IntervalType extends Type_1.Type {
6
+ getColumnType(prop, platform) {
7
+ return platform.getIntervalTypeDeclarationSQL(prop);
8
+ }
9
+ convertToJSValue(value, platform) {
10
+ return platform.convertIntervalToJSValue(value);
11
+ }
12
+ convertToDatabaseValue(value, platform) {
13
+ return platform.convertIntervalToDatabaseValue(value);
14
+ }
15
+ }
16
+ exports.IntervalType = IntervalType;
@@ -0,0 +1,13 @@
1
+ import { Type, type TransformContext } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityMetadata, EntityProperty } from '../typings';
4
+ export declare class JsonType extends Type<unknown, string | null> {
5
+ convertToDatabaseValue(value: unknown, platform: Platform, context?: TransformContext): string | null;
6
+ convertToJSValueSQL(key: string, platform: Platform): string;
7
+ convertToDatabaseValueSQL(key: string, platform: Platform): string;
8
+ convertToJSValue(value: string | unknown, platform: Platform): unknown;
9
+ getColumnType(prop: EntityProperty, platform: Platform): string;
10
+ ensureComparable<T extends object>(meta: EntityMetadata<T>, prop: EntityProperty<T>): boolean;
11
+ compareAsType(): string;
12
+ get runtimeType(): string;
13
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonType = void 0;
4
+ const Type_1 = require("./Type");
5
+ class JsonType extends Type_1.Type {
6
+ convertToDatabaseValue(value, platform, context) {
7
+ if (value == null) {
8
+ return value;
9
+ }
10
+ return platform.convertJsonToDatabaseValue(value, context);
11
+ }
12
+ convertToJSValueSQL(key, platform) {
13
+ return key + platform.castJsonValue(this.prop);
14
+ }
15
+ convertToDatabaseValueSQL(key, platform) {
16
+ return key + platform.castColumn(this.prop);
17
+ }
18
+ convertToJSValue(value, platform) {
19
+ return platform.convertJsonToJSValue(value);
20
+ }
21
+ getColumnType(prop, platform) {
22
+ return platform.getJsonDeclarationSQL();
23
+ }
24
+ ensureComparable(meta, prop) {
25
+ return !prop.embedded || !meta.properties[prop.embedded[0]].object;
26
+ }
27
+ compareAsType() {
28
+ return 'any';
29
+ }
30
+ get runtimeType() {
31
+ return 'object';
32
+ }
33
+ }
34
+ exports.JsonType = JsonType;
@@ -0,0 +1,6 @@
1
+ import type { Platform } from '../platforms';
2
+ import type { EntityProperty } from '../typings';
3
+ import { IntegerType } from './IntegerType';
4
+ export declare class MediumIntType extends IntegerType {
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MediumIntType = void 0;
4
+ const IntegerType_1 = require("./IntegerType");
5
+ class MediumIntType extends IntegerType_1.IntegerType {
6
+ getColumnType(prop, platform) {
7
+ return platform.getMediumIntTypeDeclarationSQL(prop);
8
+ }
9
+ }
10
+ exports.MediumIntType = MediumIntType;
@@ -0,0 +1,8 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class SmallIntType extends Type<number | null | undefined, number | null | undefined> {
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ compareAsType(): string;
7
+ ensureComparable(): boolean;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmallIntType = void 0;
4
+ const Type_1 = require("./Type");
5
+ class SmallIntType extends Type_1.Type {
6
+ getColumnType(prop, platform) {
7
+ return platform.getSmallIntTypeDeclarationSQL(prop);
8
+ }
9
+ compareAsType() {
10
+ return 'number';
11
+ }
12
+ ensureComparable() {
13
+ return false;
14
+ }
15
+ }
16
+ exports.SmallIntType = SmallIntType;
@@ -0,0 +1,8 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class StringType extends Type<string | null | undefined, string | null | undefined> {
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ compareAsType(): string;
7
+ ensureComparable(): boolean;
8
+ }
@@ -0,0 +1,16 @@
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 {
6
+ getColumnType(prop, platform) {
7
+ return platform.getVarcharTypeDeclarationSQL(prop);
8
+ }
9
+ compareAsType() {
10
+ return 'string';
11
+ }
12
+ ensureComparable() {
13
+ return false;
14
+ }
15
+ }
16
+ exports.StringType = StringType;
@@ -0,0 +1,8 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class TextType extends Type<string | null | undefined, string | null | undefined> {
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ compareAsType(): string;
7
+ ensureComparable(): boolean;
8
+ }
@@ -0,0 +1,16 @@
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 {
6
+ getColumnType(prop, platform) {
7
+ return platform.getTextTypeDeclarationSQL(prop);
8
+ }
9
+ compareAsType() {
10
+ return 'string';
11
+ }
12
+ ensureComparable() {
13
+ return false;
14
+ }
15
+ }
16
+ exports.TextType = TextType;
@@ -0,0 +1,9 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class TimeType extends Type {
5
+ convertToDatabaseValue(value: any, platform: Platform): string;
6
+ compareAsType(): string;
7
+ ensureComparable(): boolean;
8
+ getColumnType(prop: EntityProperty, platform: Platform): string;
9
+ }
@@ -0,0 +1,23 @@
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 {
7
+ convertToDatabaseValue(value, platform) {
8
+ if (value && !value.toString().match(/^\d{2,}:(?:[0-5]\d):(?:[0-5]\d)$/)) {
9
+ throw errors_1.ValidationError.invalidType(TimeType, value, 'JS');
10
+ }
11
+ return super.convertToDatabaseValue(value, platform);
12
+ }
13
+ compareAsType() {
14
+ return 'string';
15
+ }
16
+ ensureComparable() {
17
+ return false;
18
+ }
19
+ getColumnType(prop, platform) {
20
+ return platform.getTimeTypeDeclarationSQL(prop.length);
21
+ }
22
+ }
23
+ exports.TimeType = TimeType;
@@ -0,0 +1,8 @@
1
+ import { Type } from './Type';
2
+ import type { Platform } from '../platforms';
3
+ import type { EntityProperty } from '../typings';
4
+ export declare class TinyIntType extends Type<number | null | undefined, number | null | undefined> {
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ compareAsType(): string;
7
+ ensureComparable(): boolean;
8
+ }
@@ -0,0 +1,16 @@
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 {
6
+ getColumnType(prop, platform) {
7
+ return platform.getTinyIntTypeDeclarationSQL(prop);
8
+ }
9
+ compareAsType() {
10
+ return 'number';
11
+ }
12
+ ensureComparable() {
13
+ return false;
14
+ }
15
+ }
16
+ exports.TinyIntType = TinyIntType;