@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,332 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObjectHydrator = void 0;
4
+ const Hydrator_1 = require("./Hydrator");
5
+ const Collection_1 = require("../entity/Collection");
6
+ const Reference_1 = require("../entity/Reference");
7
+ const Utils_1 = require("../utils/Utils");
8
+ const enums_1 = require("../enums");
9
+ class ObjectHydrator extends Hydrator_1.Hydrator {
10
+ hydrators = {
11
+ full: new Map(),
12
+ reference: new Map(),
13
+ };
14
+ tmpIndex = 0;
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ hydrate(entity, meta, data, factory, type, newEntity = false, convertCustomTypes = false, schema) {
19
+ const hydrate = this.getEntityHydrator(meta, type);
20
+ const running = this.running;
21
+ // the running state is used to consider propagation as hydration, saving the values directly to the entity data,
22
+ // but we don't want that for new entities, their propagation should result in entity updates when flushing
23
+ this.running = !newEntity;
24
+ Utils_1.Utils.callCompiledFunction(hydrate, entity, data, factory, newEntity, convertCustomTypes, schema);
25
+ this.running = running;
26
+ }
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ hydrateReference(entity, meta, data, factory, convertCustomTypes = false, schema) {
31
+ const hydrate = this.getEntityHydrator(meta, 'reference');
32
+ const running = this.running;
33
+ this.running = true;
34
+ Utils_1.Utils.callCompiledFunction(hydrate, entity, data, factory, false, convertCustomTypes, schema);
35
+ this.running = running;
36
+ }
37
+ /**
38
+ * @internal Highly performance-sensitive method.
39
+ */
40
+ getEntityHydrator(meta, type) {
41
+ const exists = this.hydrators[type].get(meta.className);
42
+ if (exists) {
43
+ return exists;
44
+ }
45
+ const lines = [];
46
+ const context = new Map();
47
+ const props = this.getProperties(meta, type);
48
+ context.set('isPrimaryKey', Utils_1.Utils.isPrimaryKey);
49
+ context.set('Collection', Collection_1.Collection);
50
+ context.set('Reference', Reference_1.Reference);
51
+ const hydrateScalar = (prop, object, path, dataKey) => {
52
+ const entityKey = path.map(k => this.wrap(k)).join('');
53
+ const tz = this.platform.getTimezone();
54
+ const convertorKey = path.filter(k => !k.match(/\[idx_\d+]/)).map(k => this.safeKey(k)).join('_');
55
+ const ret = [];
56
+ const idx = this.tmpIndex++;
57
+ const nullVal = this.config.get('forceUndefined') ? 'undefined' : 'null';
58
+ if (prop.ref) {
59
+ context.set('ScalarReference', Reference_1.ScalarReference);
60
+ ret.push(` const oldValue_${idx} = entity${entityKey};`);
61
+ }
62
+ ret.push(` if (data${dataKey} === null) {`);
63
+ ret.push(` entity${entityKey} = ${nullVal};`);
64
+ ret.push(` } else if (typeof data${dataKey} !== 'undefined') {`);
65
+ if (prop.customType) {
66
+ context.set(`convertToJSValue_${convertorKey}`, (val) => prop.customType.convertToJSValue(val, this.platform));
67
+ context.set(`convertToDatabaseValue_${convertorKey}`, (val) => prop.customType.convertToDatabaseValue(val, this.platform, { mode: 'hydration' }));
68
+ ret.push(` if (convertCustomTypes) {`, ` const value = convertToJSValue_${convertorKey}(data${dataKey});`);
69
+ if (prop.customType.ensureComparable(meta, prop)) {
70
+ ret.push(` data${dataKey} = convertToDatabaseValue_${convertorKey}(value);`);
71
+ }
72
+ ret.push(` entity${entityKey} = value;`, ` } else {`, ` entity${entityKey} = data${dataKey};`, ` }`);
73
+ }
74
+ else if (prop.runtimeType === 'boolean') {
75
+ ret.push(` entity${entityKey} = !!data${dataKey};`);
76
+ }
77
+ else if (prop.runtimeType === 'Date') {
78
+ ret.push(` if (data${dataKey} instanceof Date) {`);
79
+ ret.push(` entity${entityKey} = data${dataKey};`);
80
+ if (!tz || tz === 'local') {
81
+ ret.push(` } else {`);
82
+ ret.push(` entity${entityKey} = new Date(data${dataKey});`);
83
+ }
84
+ else {
85
+ ret.push(` } else if (typeof data${dataKey} === 'number' || data${dataKey}.includes('+')) {`);
86
+ ret.push(` entity${entityKey} = new Date(data${dataKey});`);
87
+ ret.push(` } else {`);
88
+ ret.push(` entity${entityKey} = new Date(data${dataKey} + '${tz}');`);
89
+ }
90
+ ret.push(` }`);
91
+ }
92
+ else {
93
+ ret.push(` entity${entityKey} = data${dataKey};`);
94
+ }
95
+ if (prop.ref) {
96
+ ret.push(` const value = entity${entityKey};`);
97
+ ret.push(` entity${entityKey} = oldValue_${idx} ?? new ScalarReference(value);`);
98
+ ret.push(` entity${entityKey}.bind(entity, '${prop.name}');`);
99
+ ret.push(` entity${entityKey}.set(value);`);
100
+ }
101
+ ret.push(` }`);
102
+ if (prop.ref) {
103
+ ret.push(` if (!entity${entityKey}) {`);
104
+ ret.push(` entity${entityKey} = new ScalarReference();`);
105
+ ret.push(` entity${entityKey}.bind(entity, '${prop.name}');`);
106
+ ret.push(` }`);
107
+ }
108
+ return ret;
109
+ };
110
+ const hydrateToOne = (prop, dataKey, entityKey) => {
111
+ const ret = [];
112
+ const method = type === 'reference' ? 'createReference' : 'create';
113
+ const nullVal = this.config.get('forceUndefined') ? 'undefined' : 'null';
114
+ ret.push(` if (data${dataKey} === null) {\n entity${entityKey} = ${nullVal};`);
115
+ ret.push(` } else if (typeof data${dataKey} !== 'undefined') {`);
116
+ ret.push(` if (isPrimaryKey(data${dataKey}, true)) {`);
117
+ if (prop.ref) {
118
+ ret.push(` entity${entityKey} = Reference.create(factory.createReference('${prop.type}', data${dataKey}, { merge: true, convertCustomTypes, schema }));`);
119
+ }
120
+ else {
121
+ ret.push(` entity${entityKey} = factory.createReference('${prop.type}', data${dataKey}, { merge: true, convertCustomTypes, schema });`);
122
+ }
123
+ ret.push(` } else if (data${dataKey} && typeof data${dataKey} === 'object') {`);
124
+ if (prop.ref) {
125
+ ret.push(` entity${entityKey} = Reference.create(factory.${method}('${prop.type}', data${dataKey}, { initialized: true, merge: true, newEntity, convertCustomTypes, schema }));`);
126
+ }
127
+ else {
128
+ ret.push(` entity${entityKey} = factory.${method}('${prop.type}', data${dataKey}, { initialized: true, merge: true, newEntity, convertCustomTypes, schema });`);
129
+ }
130
+ ret.push(` }`);
131
+ ret.push(` }`);
132
+ if (prop.kind === enums_1.ReferenceKind.ONE_TO_ONE) {
133
+ const meta2 = this.metadata.get(prop.type);
134
+ const prop2 = meta2.properties[prop.inversedBy || prop.mappedBy];
135
+ if (prop2 && !prop2.mapToPk) {
136
+ ret.push(` if (data${dataKey} && entity${entityKey} && !entity${entityKey}.${this.safeKey(prop2.name)}) {`);
137
+ ret.push(` entity${entityKey}.${prop.ref ? 'unwrap().' : ''}${this.safeKey(prop2.name)} = ${prop2.ref ? 'Reference.create(entity)' : 'entity'};`);
138
+ ret.push(` }`);
139
+ }
140
+ }
141
+ if (prop.customType?.ensureComparable(meta, prop)) {
142
+ context.set(`convertToDatabaseValue_${this.safeKey(prop.name)}`, (val) => prop.customType.convertToDatabaseValue(val, this.platform, { mode: 'hydration' }));
143
+ ret.push(` if (data${dataKey} != null && convertCustomTypes) {`);
144
+ ret.push(` data${dataKey} = convertToDatabaseValue_${this.safeKey(prop.name)}(entity${entityKey}.__helper.getPrimaryKey());`);
145
+ ret.push(` }`);
146
+ }
147
+ return ret;
148
+ };
149
+ const hydrateToMany = (prop, dataKey, entityKey) => {
150
+ const ret = [];
151
+ ret.push(...this.createCollectionItemMapper(prop));
152
+ ret.push(` if (data${dataKey} && !Array.isArray(data${dataKey}) && typeof data${dataKey} === 'object') {`);
153
+ ret.push(` data${dataKey} = [data${dataKey}];`);
154
+ ret.push(` }`);
155
+ ret.push(` if (Array.isArray(data${dataKey})) {`);
156
+ ret.push(` const items = data${dataKey}.map(value => createCollectionItem_${this.safeKey(prop.name)}(value, entity));`);
157
+ ret.push(` const coll = Collection.create(entity, '${prop.name}', items, newEntity);`);
158
+ ret.push(` if (newEntity) {`);
159
+ ret.push(` coll.setDirty();`);
160
+ ret.push(` } else {`);
161
+ ret.push(` coll.takeSnapshot(true);`);
162
+ ret.push(` }`);
163
+ ret.push(` } else if (!entity${entityKey} && data${dataKey} instanceof Collection) {`);
164
+ ret.push(` entity${entityKey} = data${dataKey};`);
165
+ ret.push(` } else if (!entity${entityKey}) {`);
166
+ const items = this.platform.usesPivotTable() || !prop.owner ? 'undefined' : '[]';
167
+ ret.push(` const coll = Collection.create(entity, '${prop.name}', ${items}, !!data${dataKey} || newEntity);`);
168
+ ret.push(` coll.setDirty(false);`);
169
+ ret.push(` }`);
170
+ return ret;
171
+ };
172
+ const registerEmbeddedPrototype = (prop, path) => {
173
+ const convertorKey = path.filter(k => !k.match(/\[idx_\d+]/)).map(k => this.safeKey(k)).join('_');
174
+ if (prop.targetMeta?.polymorphs) {
175
+ prop.targetMeta.polymorphs.forEach(meta => {
176
+ context.set(`prototype_${convertorKey}_${meta.className}`, meta.prototype);
177
+ });
178
+ }
179
+ else {
180
+ context.set(`prototype_${convertorKey}`, prop.embeddable.prototype);
181
+ }
182
+ };
183
+ const parseObjectEmbeddable = (prop, dataKey, ret) => {
184
+ if (!this.platform.convertsJsonAutomatically() && (prop.object || prop.array)) {
185
+ context.set('parseJsonSafe', Utils_1.parseJsonSafe);
186
+ ret.push(` if (typeof data${dataKey} === 'string') {`, ` data${dataKey} = parseJsonSafe(data${dataKey});`, ` }`);
187
+ }
188
+ };
189
+ const createCond = (prop, dataKey, cond) => {
190
+ const conds = [];
191
+ if (prop.object) {
192
+ conds.push(`data${dataKey} ${cond ?? '!= null'}`);
193
+ }
194
+ else {
195
+ const notNull = cond ?? (prop.nullable ? '!= null' : '!== undefined');
196
+ meta.props
197
+ .filter(p => p.embedded?.[0] === prop.name)
198
+ .forEach(p => {
199
+ if (p.kind === enums_1.ReferenceKind.EMBEDDED && !p.object && !p.array) {
200
+ conds.push(...createCond(p, dataKey + this.wrap(p.embedded[1]), cond));
201
+ return;
202
+ }
203
+ conds.push(`data${this.wrap(p.name)} ${notNull}`);
204
+ });
205
+ }
206
+ return conds;
207
+ };
208
+ const hydrateEmbedded = (prop, path, dataKey) => {
209
+ const entityKey = path.map(k => this.wrap(k)).join('');
210
+ const ret = [];
211
+ registerEmbeddedPrototype(prop, path);
212
+ parseObjectEmbeddable(prop, dataKey, ret);
213
+ ret.push(` if (${createCond(prop, dataKey).join(' || ')}) {`);
214
+ if (prop.targetMeta?.polymorphs) {
215
+ prop.targetMeta.polymorphs.forEach(meta => {
216
+ const childProp = prop.embeddedProps[prop.targetMeta.discriminatorColumn];
217
+ const childDataKey = prop.object ? dataKey + this.wrap(childProp.embedded[1]) : this.wrap(childProp.name);
218
+ // weak comparison as we can have numbers that might have been converted to strings due to being object keys
219
+ ret.push(` if (data${childDataKey} == '${meta.discriminatorValue}' && entity${entityKey} == null) {`);
220
+ ret.push(` entity${entityKey} = factory.createEmbeddable('${meta.className}', data${prop.object ? dataKey : ''}, { newEntity, convertCustomTypes });`);
221
+ ret.push(` }`);
222
+ });
223
+ }
224
+ else {
225
+ ret.push(` if (entity${entityKey} == null) {`);
226
+ ret.push(` entity${entityKey} = factory.createEmbeddable('${prop.targetMeta.className}', data${prop.object ? dataKey : ''}, { newEntity, convertCustomTypes });`);
227
+ ret.push(` }`);
228
+ }
229
+ meta.props
230
+ .filter(p => p.embedded?.[0] === prop.name)
231
+ .forEach(childProp => {
232
+ const childDataKey = prop.object ? dataKey + this.wrap(childProp.embedded[1]) : this.wrap(childProp.name);
233
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
234
+ ret.push(...hydrateProperty(childProp, prop.object, [...path, childProp.embedded[1]], childDataKey).map(l => ' ' + l));
235
+ });
236
+ /* istanbul ignore next */
237
+ const nullVal = this.config.get('forceUndefined') ? 'undefined' : 'null';
238
+ if (prop.object) {
239
+ ret.push(` } else if (data${dataKey} === null) {`);
240
+ }
241
+ else {
242
+ ret.push(` } else if (${createCond(prop, dataKey, '=== null').join(' && ')}) {`);
243
+ }
244
+ ret.push(` entity${entityKey} = ${nullVal};`);
245
+ ret.push(` }`);
246
+ return ret;
247
+ };
248
+ const hydrateEmbeddedArray = (prop, path, dataKey) => {
249
+ const entityKey = path.map(k => this.wrap(k)).join('');
250
+ const ret = [];
251
+ const idx = this.tmpIndex++;
252
+ registerEmbeddedPrototype(prop, path);
253
+ parseObjectEmbeddable(prop, dataKey, ret);
254
+ ret.push(` if (Array.isArray(data${dataKey})) {`);
255
+ ret.push(` entity${entityKey} = [];`);
256
+ ret.push(` data${dataKey}.forEach((_, idx_${idx}) => {`);
257
+ ret.push(...hydrateEmbedded(prop, [...path, `[idx_${idx}]`], `${dataKey}[idx_${idx}]`).map(l => ' ' + l));
258
+ ret.push(` });`);
259
+ ret.push(` }`);
260
+ return ret;
261
+ };
262
+ const hydrateProperty = (prop, object = prop.object, path = [prop.name], dataKey) => {
263
+ const entityKey = path.map(k => this.wrap(k)).join('');
264
+ dataKey = dataKey ?? (object ? entityKey : this.wrap(prop.name));
265
+ const ret = [];
266
+ if ([enums_1.ReferenceKind.MANY_TO_ONE, enums_1.ReferenceKind.ONE_TO_ONE].includes(prop.kind) && !prop.mapToPk) {
267
+ ret.push(...hydrateToOne(prop, dataKey, entityKey));
268
+ }
269
+ else if (prop.kind === enums_1.ReferenceKind.ONE_TO_MANY || prop.kind === enums_1.ReferenceKind.MANY_TO_MANY) {
270
+ ret.push(...hydrateToMany(prop, dataKey, entityKey));
271
+ }
272
+ else if (prop.kind === enums_1.ReferenceKind.EMBEDDED) {
273
+ if (prop.array) {
274
+ ret.push(...hydrateEmbeddedArray(prop, path, dataKey));
275
+ }
276
+ else {
277
+ ret.push(...hydrateEmbedded(prop, path, dataKey));
278
+ if (!prop.object) {
279
+ ret.push(...hydrateEmbedded({ ...prop, object: true }, path, dataKey));
280
+ }
281
+ }
282
+ }
283
+ else { // ReferenceKind.SCALAR
284
+ ret.push(...hydrateScalar(prop, object, path, dataKey));
285
+ }
286
+ if (this.config.get('forceUndefined')) {
287
+ ret.push(` if (data${dataKey} === null) entity${entityKey} = undefined;`);
288
+ }
289
+ return ret;
290
+ };
291
+ for (const prop of props) {
292
+ lines.push(...hydrateProperty(prop));
293
+ }
294
+ const code = `// compiled hydrator for entity ${meta.className} (${type})\n`
295
+ + `return function(entity, data, factory, newEntity, convertCustomTypes, schema) {\n`
296
+ + `${lines.join('\n')}\n}`;
297
+ const hydrator = Utils_1.Utils.createFunction(context, code);
298
+ this.hydrators[type].set(meta.className, hydrator);
299
+ return hydrator;
300
+ }
301
+ createCollectionItemMapper(prop) {
302
+ const meta = this.metadata.get(prop.type);
303
+ const lines = [];
304
+ lines.push(` const createCollectionItem_${this.safeKey(prop.name)} = (value, entity) => {`);
305
+ const prop2 = prop.targetMeta?.properties[prop.mappedBy];
306
+ if (prop2?.primary) {
307
+ lines.push(` if (typeof value === 'object' && value?.['${prop2.name}'] == null) {`);
308
+ lines.push(` value = { ...value, ['${prop2.name}']: Reference.wrapReference(entity, { ref: ${prop2.ref} }) };`);
309
+ lines.push(` }`);
310
+ }
311
+ lines.push(` if (isPrimaryKey(value, ${meta.compositePK})) return factory.createReference('${prop.type}', value, { convertCustomTypes, schema, merge: true });`);
312
+ lines.push(` if (value && value.__entity) return value;`);
313
+ if (prop2 && !prop2.primary) {
314
+ lines.push(` if (typeof value === 'object' && value?.['${prop2.name}'] == null) {`);
315
+ lines.push(` value = { ...value, ['${prop2.name}']: Reference.wrapReference(entity, { ref: ${prop2.ref} }) };`);
316
+ lines.push(` }`);
317
+ }
318
+ lines.push(` return factory.create('${prop.type}', value, { newEntity, convertCustomTypes, schema, merge: true });`);
319
+ lines.push(` }`);
320
+ return lines;
321
+ }
322
+ wrap(key) {
323
+ if (key.match(/^\[.*]$/)) {
324
+ return key;
325
+ }
326
+ return key.match(/^\w+$/) ? `.${key}` : `['${key}']`;
327
+ }
328
+ safeKey(key) {
329
+ return key.replace(/\W/g, '_');
330
+ }
331
+ }
332
+ exports.ObjectHydrator = ObjectHydrator;
@@ -0,0 +1,2 @@
1
+ export * from './Hydrator';
2
+ export * from './ObjectHydrator';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Hydrator"), exports);
18
+ __exportStar(require("./ObjectHydrator"), exports);
package/index.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * @module core
4
+ */
5
+ export { Constructor, ConnectionType, Dictionary, PrimaryKeyProp, Primary, IPrimaryKey, ObjectQuery, FilterQuery, IWrappedEntity, EntityName, EntityData, Highlighter, AnyEntity, EntityClass, EntityProperty, EntityMetadata, QBFilterQuery, PopulateOptions, Populate, Loaded, New, LoadedReference, LoadedCollection, IMigrator, IMigrationGenerator, GetRepository, EntityRepositoryType, MigrationObject, DeepPartial, PrimaryProperty, Cast, IsUnknown, EntityDictionary, EntityDTO, MigrationDiff, GenerateOptions, FilterObject, IEntityGenerator, ISeedManager, EntityClassGroup, OptionalProps, EagerProps, HiddenProps, RequiredEntityData, CheckCallback, SimpleColumnMeta, Rel, Ref, ScalarRef, EntityRef, ISchemaGenerator, UmzugMigration, MigrateOptions, MigrationResult, MigrationRow, EntityKey, EntityValue, FilterKey, Opt, EntityType, FromEntityType, Selected, IsSubset, EntityProps, ExpandProperty, ExpandScalar, FilterItemValue, ExpandQuery, Scalar, ExpandHint, Hidden, FilterValue, MergeLoaded, MergeSelected, Config, DefineConfig, TypeConfig, ClearDatabaseOptions, CreateSchemaOptions, EnsureDatabaseOptions, UpdateSchemaOptions, DropSchemaOptions, RefreshDatabaseOptions, AutoPath, UnboxArray, MetadataProcessor, } from './typings';
6
+ export * from './enums';
7
+ export * from './errors';
8
+ export * from './exceptions';
9
+ export * from './MikroORM';
10
+ export * from './entity';
11
+ export * from './serialization';
12
+ export * from './events';
13
+ export * from './EntityManager';
14
+ export * from './unit-of-work';
15
+ export * from './utils';
16
+ export * from './logging';
17
+ export * from './hydration';
18
+ export * from './drivers';
19
+ export * from './connections';
20
+ export * from './platforms';
21
+ export * from './types';
22
+ export * from './naming-strategy';
23
+ export * from './metadata';
24
+ export * from './cache';
25
+ export * from './decorators';
package/index.js ADDED
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Config = exports.HiddenProps = exports.EagerProps = exports.OptionalProps = exports.EntityRepositoryType = exports.EntityMetadata = exports.PrimaryKeyProp = void 0;
18
+ /**
19
+ * @packageDocumentation
20
+ * @module core
21
+ */
22
+ /* istanbul ignore file */
23
+ var typings_1 = require("./typings");
24
+ Object.defineProperty(exports, "PrimaryKeyProp", { enumerable: true, get: function () { return typings_1.PrimaryKeyProp; } });
25
+ Object.defineProperty(exports, "EntityMetadata", { enumerable: true, get: function () { return typings_1.EntityMetadata; } });
26
+ Object.defineProperty(exports, "EntityRepositoryType", { enumerable: true, get: function () { return typings_1.EntityRepositoryType; } });
27
+ Object.defineProperty(exports, "OptionalProps", { enumerable: true, get: function () { return typings_1.OptionalProps; } });
28
+ Object.defineProperty(exports, "EagerProps", { enumerable: true, get: function () { return typings_1.EagerProps; } });
29
+ Object.defineProperty(exports, "HiddenProps", { enumerable: true, get: function () { return typings_1.HiddenProps; } });
30
+ Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return typings_1.Config; } });
31
+ __exportStar(require("./enums"), exports);
32
+ __exportStar(require("./errors"), exports);
33
+ __exportStar(require("./exceptions"), exports);
34
+ __exportStar(require("./MikroORM"), exports);
35
+ __exportStar(require("./entity"), exports);
36
+ __exportStar(require("./serialization"), exports);
37
+ __exportStar(require("./events"), exports);
38
+ __exportStar(require("./EntityManager"), exports);
39
+ __exportStar(require("./unit-of-work"), exports);
40
+ __exportStar(require("./utils"), exports);
41
+ __exportStar(require("./logging"), exports);
42
+ __exportStar(require("./hydration"), exports);
43
+ __exportStar(require("./drivers"), exports);
44
+ __exportStar(require("./connections"), exports);
45
+ __exportStar(require("./platforms"), exports);
46
+ __exportStar(require("./types"), exports);
47
+ __exportStar(require("./naming-strategy"), exports);
48
+ __exportStar(require("./metadata"), exports);
49
+ __exportStar(require("./cache"), exports);
50
+ __exportStar(require("./decorators"), exports);
package/index.mjs ADDED
@@ -0,0 +1,192 @@
1
+ import mod from "./index.js";
2
+
3
+ export default mod;
4
+ export const ALIAS_REPLACEMENT = mod.ALIAS_REPLACEMENT;
5
+ export const ALIAS_REPLACEMENT_RE = mod.ALIAS_REPLACEMENT_RE;
6
+ export const ARRAY_OPERATORS = mod.ARRAY_OPERATORS;
7
+ export const AbstractNamingStrategy = mod.AbstractNamingStrategy;
8
+ export const AbstractSchemaGenerator = mod.AbstractSchemaGenerator;
9
+ export const AfterCreate = mod.AfterCreate;
10
+ export const AfterDelete = mod.AfterDelete;
11
+ export const AfterUpdate = mod.AfterUpdate;
12
+ export const AfterUpsert = mod.AfterUpsert;
13
+ export const ArrayCollection = mod.ArrayCollection;
14
+ export const ArrayType = mod.ArrayType;
15
+ export const BaseEntity = mod.BaseEntity;
16
+ export const BeforeCreate = mod.BeforeCreate;
17
+ export const BeforeDelete = mod.BeforeDelete;
18
+ export const BeforeUpdate = mod.BeforeUpdate;
19
+ export const BeforeUpsert = mod.BeforeUpsert;
20
+ export const BigIntType = mod.BigIntType;
21
+ export const BlobType = mod.BlobType;
22
+ export const BooleanType = mod.BooleanType;
23
+ export const Cascade = mod.Cascade;
24
+ export const ChangeSet = mod.ChangeSet;
25
+ export const ChangeSetComputer = mod.ChangeSetComputer;
26
+ export const ChangeSetPersister = mod.ChangeSetPersister;
27
+ export const ChangeSetType = mod.ChangeSetType;
28
+ export const Check = mod.Check;
29
+ export const CheckConstraintViolationException = mod.CheckConstraintViolationException;
30
+ export const Collection = mod.Collection;
31
+ export const CommitOrderCalculator = mod.CommitOrderCalculator;
32
+ export const Config = mod.Config;
33
+ export const Configuration = mod.Configuration;
34
+ export const ConfigurationLoader = mod.ConfigurationLoader;
35
+ export const Connection = mod.Connection;
36
+ export const ConnectionException = mod.ConnectionException;
37
+ export const ConstraintViolationException = mod.ConstraintViolationException;
38
+ export const CreateRequestContext = mod.CreateRequestContext;
39
+ export const Cursor = mod.Cursor;
40
+ export const CursorError = mod.CursorError;
41
+ export const DatabaseDriver = mod.DatabaseDriver;
42
+ export const DatabaseObjectExistsException = mod.DatabaseObjectExistsException;
43
+ export const DatabaseObjectNotFoundException = mod.DatabaseObjectNotFoundException;
44
+ export const DataloaderType = mod.DataloaderType;
45
+ export const DataloaderUtils = mod.DataloaderUtils;
46
+ export const DateTimeType = mod.DateTimeType;
47
+ export const DateType = mod.DateType;
48
+ export const DeadlockException = mod.DeadlockException;
49
+ export const DecimalType = mod.DecimalType;
50
+ export const DefaultLogger = mod.DefaultLogger;
51
+ export const DoubleType = mod.DoubleType;
52
+ export const DriverException = mod.DriverException;
53
+ export const EagerProps = mod.EagerProps;
54
+ export const Embeddable = mod.Embeddable;
55
+ export const Embedded = mod.Embedded;
56
+ export const EnsureRequestContext = mod.EnsureRequestContext;
57
+ export const Entity = mod.Entity;
58
+ export const EntityAssigner = mod.EntityAssigner;
59
+ export const EntityCaseNamingStrategy = mod.EntityCaseNamingStrategy;
60
+ export const EntityComparator = mod.EntityComparator;
61
+ export const EntityFactory = mod.EntityFactory;
62
+ export const EntityHelper = mod.EntityHelper;
63
+ export const EntityIdentifier = mod.EntityIdentifier;
64
+ export const EntityLoader = mod.EntityLoader;
65
+ export const EntityManager = mod.EntityManager;
66
+ export const EntityManagerType = mod.EntityManagerType;
67
+ export const EntityMetadata = mod.EntityMetadata;
68
+ export const EntityRepository = mod.EntityRepository;
69
+ export const EntityRepositoryType = mod.EntityRepositoryType;
70
+ export const EntitySchema = mod.EntitySchema;
71
+ export const EntitySerializer = mod.EntitySerializer;
72
+ export const EntityTransformer = mod.EntityTransformer;
73
+ export const EntityValidator = mod.EntityValidator;
74
+ export const Enum = mod.Enum;
75
+ export const EnumArrayType = mod.EnumArrayType;
76
+ export const EnumType = mod.EnumType;
77
+ export const EventManager = mod.EventManager;
78
+ export const EventType = mod.EventType;
79
+ export const EventTypeMap = mod.EventTypeMap;
80
+ export const ExceptionConverter = mod.ExceptionConverter;
81
+ export const FileCacheAdapter = mod.FileCacheAdapter;
82
+ export const Filter = mod.Filter;
83
+ export const FloatType = mod.FloatType;
84
+ export const FlushMode = mod.FlushMode;
85
+ export const ForeignKeyConstraintViolationException = mod.ForeignKeyConstraintViolationException;
86
+ export const Formula = mod.Formula;
87
+ export const GeneratedCacheAdapter = mod.GeneratedCacheAdapter;
88
+ export const GroupOperator = mod.GroupOperator;
89
+ export const HiddenProps = mod.HiddenProps;
90
+ export const Hydrator = mod.Hydrator;
91
+ export const IdentityMap = mod.IdentityMap;
92
+ export const Index = mod.Index;
93
+ export const IntegerType = mod.IntegerType;
94
+ export const IntervalType = mod.IntervalType;
95
+ export const InvalidFieldNameException = mod.InvalidFieldNameException;
96
+ export const IsolationLevel = mod.IsolationLevel;
97
+ export const JsonProperty = mod.JsonProperty;
98
+ export const JsonType = mod.JsonType;
99
+ export const LoadStrategy = mod.LoadStrategy;
100
+ export const LockMode = mod.LockMode;
101
+ export const LockWaitTimeoutException = mod.LockWaitTimeoutException;
102
+ export const ManyToMany = mod.ManyToMany;
103
+ export const ManyToOne = mod.ManyToOne;
104
+ export const MediumIntType = mod.MediumIntType;
105
+ export const MemoryCacheAdapter = mod.MemoryCacheAdapter;
106
+ export const MetadataDiscovery = mod.MetadataDiscovery;
107
+ export const MetadataError = mod.MetadataError;
108
+ export const MetadataProvider = mod.MetadataProvider;
109
+ export const MetadataStorage = mod.MetadataStorage;
110
+ export const MetadataValidator = mod.MetadataValidator;
111
+ export const MikroORM = mod.MikroORM;
112
+ export const MongoNamingStrategy = mod.MongoNamingStrategy;
113
+ export const NodeState = mod.NodeState;
114
+ export const NonUniqueFieldNameException = mod.NonUniqueFieldNameException;
115
+ export const NotFoundError = mod.NotFoundError;
116
+ export const NotNullConstraintViolationException = mod.NotNullConstraintViolationException;
117
+ export const NullCacheAdapter = mod.NullCacheAdapter;
118
+ export const NullHighlighter = mod.NullHighlighter;
119
+ export const ObjectBindingPattern = mod.ObjectBindingPattern;
120
+ export const ObjectHydrator = mod.ObjectHydrator;
121
+ export const OnInit = mod.OnInit;
122
+ export const OnLoad = mod.OnLoad;
123
+ export const OneToMany = mod.OneToMany;
124
+ export const OneToOne = mod.OneToOne;
125
+ export const OptimisticLockError = mod.OptimisticLockError;
126
+ export const OptionalProps = mod.OptionalProps;
127
+ export const PlainObject = mod.PlainObject;
128
+ export const Platform = mod.Platform;
129
+ export const PopulateHint = mod.PopulateHint;
130
+ export const PrimaryKey = mod.PrimaryKey;
131
+ export const PrimaryKeyProp = mod.PrimaryKeyProp;
132
+ export const Property = mod.Property;
133
+ export const QueryFlag = mod.QueryFlag;
134
+ export const QueryHelper = mod.QueryHelper;
135
+ export const QueryOperator = mod.QueryOperator;
136
+ export const QueryOrder = mod.QueryOrder;
137
+ export const QueryOrderNumeric = mod.QueryOrderNumeric;
138
+ export const RawQueryFragment = mod.RawQueryFragment;
139
+ export const ReadOnlyException = mod.ReadOnlyException;
140
+ export const Ref = mod.Ref;
141
+ export const Reference = mod.Reference;
142
+ export const ReferenceKind = mod.ReferenceKind;
143
+ export const ReflectMetadataProvider = mod.ReflectMetadataProvider;
144
+ export const RequestContext = mod.RequestContext;
145
+ export const SCALAR_TYPES = mod.SCALAR_TYPES;
146
+ export const ScalarReference = mod.ScalarReference;
147
+ export const SerializationContext = mod.SerializationContext;
148
+ export const SerializedPrimaryKey = mod.SerializedPrimaryKey;
149
+ export const ServerException = mod.ServerException;
150
+ export const SimpleLogger = mod.SimpleLogger;
151
+ export const SmallIntType = mod.SmallIntType;
152
+ export const StringType = mod.StringType;
153
+ export const SyntaxErrorException = mod.SyntaxErrorException;
154
+ export const TableExistsException = mod.TableExistsException;
155
+ export const TableNotFoundException = mod.TableNotFoundException;
156
+ export const TextType = mod.TextType;
157
+ export const TimeType = mod.TimeType;
158
+ export const TinyIntType = mod.TinyIntType;
159
+ export const TransactionContext = mod.TransactionContext;
160
+ export const TransactionEventBroadcaster = mod.TransactionEventBroadcaster;
161
+ export const Type = mod.Type;
162
+ export const Uint8ArrayType = mod.Uint8ArrayType;
163
+ export const UnderscoreNamingStrategy = mod.UnderscoreNamingStrategy;
164
+ export const Unique = mod.Unique;
165
+ export const UniqueConstraintViolationException = mod.UniqueConstraintViolationException;
166
+ export const UnitOfWork = mod.UnitOfWork;
167
+ export const UnknownType = mod.UnknownType;
168
+ export const Utils = mod.Utils;
169
+ export const UuidType = mod.UuidType;
170
+ export const ValidationError = mod.ValidationError;
171
+ export const WrappedEntity = mod.WrappedEntity;
172
+ export const assign = mod.assign;
173
+ export const colors = mod.colors;
174
+ export const compareArrays = mod.compareArrays;
175
+ export const compareBooleans = mod.compareBooleans;
176
+ export const compareBuffers = mod.compareBuffers;
177
+ export const compareObjects = mod.compareObjects;
178
+ export const createSqlFunction = mod.createSqlFunction;
179
+ export const defineConfig = mod.defineConfig;
180
+ export const equals = mod.equals;
181
+ export const getOnConflictFields = mod.getOnConflictFields;
182
+ export const getOnConflictReturningFields = mod.getOnConflictReturningFields;
183
+ export const helper = mod.helper;
184
+ export const parseJsonSafe = mod.parseJsonSafe;
185
+ export const raw = mod.raw;
186
+ export const ref = mod.ref;
187
+ export const rel = mod.rel;
188
+ export const serialize = mod.serialize;
189
+ export const sql = mod.sql;
190
+ export const t = mod.t;
191
+ export const types = mod.types;
192
+ export const wrap = mod.wrap;
@@ -0,0 +1,32 @@
1
+ import type { Logger, LoggerNamespace, LogContext, LoggerOptions } from './Logger';
2
+ export declare class DefaultLogger implements Logger {
3
+ private readonly options;
4
+ debugMode: boolean | LoggerNamespace[];
5
+ readonly writer: (message: string) => void;
6
+ private readonly usesReplicas?;
7
+ private readonly highlighter?;
8
+ constructor(options: LoggerOptions);
9
+ /**
10
+ * @inheritDoc
11
+ */
12
+ log(namespace: LoggerNamespace, message: string, context?: LogContext): void;
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ error(namespace: LoggerNamespace, message: string, context?: LogContext): void;
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ warn(namespace: LoggerNamespace, message: string, context?: LogContext): void;
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ setDebugMode(debugMode: boolean | LoggerNamespace[]): void;
25
+ isEnabled(namespace: LoggerNamespace, context?: LogContext): boolean;
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ logQuery(context: {
30
+ query: string;
31
+ } & LogContext): void;
32
+ }