@mikro-orm/core 7.0.0-dev.0 → 7.0.0-dev.2
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.
- package/EntityManager.d.ts +18 -13
- package/EntityManager.js +202 -202
- package/MikroORM.d.ts +7 -6
- package/MikroORM.js +33 -45
- package/cache/CacheAdapter.js +1 -2
- package/cache/FileCacheAdapter.d.ts +1 -1
- package/cache/FileCacheAdapter.js +18 -26
- package/cache/GeneratedCacheAdapter.d.ts +2 -2
- package/cache/GeneratedCacheAdapter.js +1 -5
- package/cache/MemoryCacheAdapter.d.ts +1 -1
- package/cache/MemoryCacheAdapter.js +1 -5
- package/cache/NullCacheAdapter.d.ts +1 -1
- package/cache/NullCacheAdapter.js +1 -5
- package/cache/index.d.ts +5 -5
- package/cache/index.js +5 -21
- package/connections/Connection.d.ts +7 -7
- package/connections/Connection.js +8 -12
- package/connections/index.d.ts +1 -1
- package/connections/index.js +1 -17
- package/decorators/Check.d.ts +1 -1
- package/decorators/Check.js +5 -8
- package/decorators/CreateRequestContext.d.ts +1 -1
- package/decorators/CreateRequestContext.js +9 -13
- package/decorators/Embeddable.d.ts +1 -1
- package/decorators/Embeddable.js +3 -6
- package/decorators/Embedded.d.ts +1 -1
- package/decorators/Embedded.js +10 -12
- package/decorators/Entity.d.ts +2 -2
- package/decorators/Entity.js +5 -8
- package/decorators/Enum.d.ts +2 -2
- package/decorators/Enum.js +7 -10
- package/decorators/Filter.d.ts +1 -1
- package/decorators/Filter.js +3 -6
- package/decorators/Formula.d.ts +2 -2
- package/decorators/Formula.js +7 -10
- package/decorators/Indexed.d.ts +2 -2
- package/decorators/Indexed.js +6 -10
- package/decorators/ManyToMany.d.ts +3 -3
- package/decorators/ManyToMany.js +10 -12
- package/decorators/ManyToOne.d.ts +3 -3
- package/decorators/ManyToOne.js +10 -12
- package/decorators/OneToMany.d.ts +3 -3
- package/decorators/OneToMany.js +11 -14
- package/decorators/OneToOne.d.ts +4 -4
- package/decorators/OneToOne.js +4 -7
- package/decorators/PrimaryKey.d.ts +2 -2
- package/decorators/PrimaryKey.js +10 -13
- package/decorators/Property.d.ts +5 -5
- package/decorators/Property.js +10 -12
- package/decorators/Transactional.d.ts +2 -2
- package/decorators/Transactional.js +7 -10
- package/decorators/hooks.js +23 -35
- package/decorators/index.d.ts +17 -17
- package/decorators/index.js +17 -36
- package/drivers/DatabaseDriver.d.ts +13 -12
- package/drivers/DatabaseDriver.js +60 -64
- package/drivers/IDatabaseDriver.d.ts +12 -12
- package/drivers/IDatabaseDriver.js +1 -4
- package/drivers/index.d.ts +2 -2
- package/drivers/index.js +2 -18
- package/entity/ArrayCollection.d.ts +2 -2
- package/entity/ArrayCollection.js +29 -33
- package/entity/BaseEntity.d.ts +6 -6
- package/entity/BaseEntity.js +17 -21
- package/entity/Collection.d.ts +6 -6
- package/entity/Collection.js +40 -44
- package/entity/EntityAssigner.d.ts +2 -2
- package/entity/EntityAssigner.js +58 -63
- package/entity/EntityFactory.d.ts +3 -3
- package/entity/EntityFactory.js +58 -62
- package/entity/EntityHelper.d.ts +2 -2
- package/entity/EntityHelper.js +41 -45
- package/entity/EntityIdentifier.d.ts +1 -1
- package/entity/EntityIdentifier.js +1 -5
- package/entity/EntityLoader.d.ts +5 -5
- package/entity/EntityLoader.js +92 -96
- package/entity/EntityRepository.d.ts +7 -7
- package/entity/EntityRepository.js +7 -11
- package/entity/EntityValidator.d.ts +1 -1
- package/entity/EntityValidator.js +25 -29
- package/entity/Reference.d.ts +2 -2
- package/entity/Reference.js +35 -42
- package/entity/WrappedEntity.d.ts +12 -12
- package/entity/WrappedEntity.js +23 -27
- package/entity/index.d.ts +13 -13
- package/entity/index.js +13 -29
- package/entity/utils.d.ts +1 -1
- package/entity/utils.js +9 -12
- package/entity/wrap.d.ts +1 -1
- package/entity/wrap.js +2 -6
- package/enums.d.ts +3 -3
- package/enums.js +37 -41
- package/errors.d.ts +1 -1
- package/errors.js +15 -24
- package/events/EventManager.d.ts +3 -3
- package/events/EventManager.js +8 -12
- package/events/EventSubscriber.d.ts +5 -4
- package/events/EventSubscriber.js +1 -2
- package/events/TransactionEventBroadcaster.d.ts +3 -3
- package/events/TransactionEventBroadcaster.js +1 -5
- package/events/index.d.ts +3 -3
- package/events/index.js +3 -19
- package/exceptions.js +18 -39
- package/hydration/Hydrator.d.ts +5 -5
- package/hydration/Hydrator.js +3 -6
- package/hydration/ObjectHydrator.d.ts +3 -3
- package/hydration/ObjectHydrator.js +25 -28
- package/hydration/index.d.ts +2 -2
- package/hydration/index.js +2 -18
- package/index.d.ts +21 -21
- package/index.js +21 -46
- package/logging/DefaultLogger.d.ts +1 -1
- package/logging/DefaultLogger.js +9 -13
- package/logging/Logger.d.ts +1 -1
- package/logging/Logger.js +1 -2
- package/logging/SimpleLogger.d.ts +2 -2
- package/logging/SimpleLogger.js +2 -6
- package/logging/colors.js +1 -5
- package/logging/index.d.ts +4 -4
- package/logging/index.js +4 -20
- package/metadata/EntitySchema.d.ts +12 -4
- package/metadata/EntitySchema.js +41 -45
- package/metadata/MetadataDiscovery.d.ts +7 -7
- package/metadata/MetadataDiscovery.js +174 -177
- package/metadata/MetadataProvider.d.ts +2 -2
- package/metadata/MetadataProvider.js +4 -7
- package/metadata/MetadataStorage.d.ts +2 -2
- package/metadata/MetadataStorage.js +15 -19
- package/metadata/MetadataValidator.d.ts +4 -4
- package/metadata/MetadataValidator.js +49 -53
- package/metadata/ReflectMetadataProvider.d.ts +2 -2
- package/metadata/ReflectMetadataProvider.js +8 -12
- package/metadata/index.d.ts +6 -6
- package/metadata/index.js +6 -22
- package/naming-strategy/AbstractNamingStrategy.d.ts +2 -2
- package/naming-strategy/AbstractNamingStrategy.js +4 -8
- package/naming-strategy/EntityCaseNamingStrategy.d.ts +1 -1
- package/naming-strategy/EntityCaseNamingStrategy.js +2 -6
- package/naming-strategy/MongoNamingStrategy.d.ts +1 -1
- package/naming-strategy/MongoNamingStrategy.js +2 -6
- package/naming-strategy/NamingStrategy.d.ts +1 -1
- package/naming-strategy/NamingStrategy.js +1 -2
- package/naming-strategy/UnderscoreNamingStrategy.d.ts +1 -1
- package/naming-strategy/UnderscoreNamingStrategy.js +2 -6
- package/naming-strategy/index.d.ts +5 -5
- package/naming-strategy/index.js +5 -21
- package/package.json +5 -14
- package/platforms/ExceptionConverter.d.ts +2 -2
- package/platforms/ExceptionConverter.js +4 -8
- package/platforms/Platform.d.ts +10 -10
- package/platforms/Platform.js +57 -61
- package/platforms/index.d.ts +2 -2
- package/platforms/index.js +2 -18
- package/serialization/EntitySerializer.d.ts +2 -2
- package/serialization/EntitySerializer.js +36 -41
- package/serialization/EntityTransformer.d.ts +1 -1
- package/serialization/EntityTransformer.js +27 -31
- package/serialization/SerializationContext.d.ts +2 -2
- package/serialization/SerializationContext.js +10 -14
- package/serialization/index.d.ts +3 -3
- package/serialization/index.js +3 -19
- package/types/ArrayType.d.ts +3 -3
- package/types/ArrayType.js +7 -11
- package/types/BigIntType.d.ts +3 -3
- package/types/BigIntType.js +3 -6
- package/types/BlobType.d.ts +3 -3
- package/types/BlobType.js +2 -8
- package/types/BooleanType.d.ts +3 -3
- package/types/BooleanType.js +2 -6
- package/types/CharacterType.d.ts +3 -3
- package/types/CharacterType.js +2 -6
- package/types/DateTimeType.d.ts +3 -3
- package/types/DateTimeType.js +2 -6
- package/types/DateType.d.ts +3 -3
- package/types/DateType.js +2 -6
- package/types/DecimalType.d.ts +3 -3
- package/types/DecimalType.js +4 -7
- package/types/DoubleType.d.ts +3 -3
- package/types/DoubleType.js +3 -6
- package/types/EnumArrayType.d.ts +4 -4
- package/types/EnumArrayType.js +5 -10
- package/types/EnumType.d.ts +3 -3
- package/types/EnumType.js +2 -6
- package/types/FloatType.d.ts +3 -3
- package/types/FloatType.js +2 -6
- package/types/IntegerType.d.ts +3 -3
- package/types/IntegerType.js +2 -6
- package/types/IntervalType.d.ts +3 -3
- package/types/IntervalType.js +2 -6
- package/types/JsonType.d.ts +3 -3
- package/types/JsonType.js +2 -6
- package/types/MediumIntType.d.ts +3 -3
- package/types/MediumIntType.js +2 -6
- package/types/SmallIntType.d.ts +3 -3
- package/types/SmallIntType.js +2 -6
- package/types/StringType.d.ts +3 -3
- package/types/StringType.js +2 -6
- package/types/TextType.d.ts +3 -3
- package/types/TextType.js +2 -6
- package/types/TimeType.d.ts +3 -3
- package/types/TimeType.js +4 -8
- package/types/TinyIntType.d.ts +3 -3
- package/types/TinyIntType.js +3 -6
- package/types/Type.d.ts +2 -2
- package/types/Type.js +5 -9
- package/types/Uint8ArrayType.d.ts +3 -3
- package/types/Uint8ArrayType.js +3 -9
- package/types/UnknownType.d.ts +3 -3
- package/types/UnknownType.js +2 -6
- package/types/UuidType.d.ts +3 -3
- package/types/UuidType.js +2 -6
- package/types/index.d.ts +25 -25
- package/types/index.js +52 -79
- package/typings.d.ts +22 -20
- package/typings.js +34 -38
- package/unit-of-work/ChangeSet.d.ts +1 -1
- package/unit-of-work/ChangeSet.js +13 -17
- package/unit-of-work/ChangeSetComputer.d.ts +8 -7
- package/unit-of-work/ChangeSetComputer.js +26 -30
- package/unit-of-work/ChangeSetPersister.d.ts +7 -6
- package/unit-of-work/ChangeSetPersister.js +44 -47
- package/unit-of-work/CommitOrderCalculator.d.ts +1 -1
- package/unit-of-work/CommitOrderCalculator.js +6 -10
- package/unit-of-work/IdentityMap.d.ts +1 -1
- package/unit-of-work/IdentityMap.js +1 -5
- package/unit-of-work/UnitOfWork.d.ts +8 -7
- package/unit-of-work/UnitOfWork.js +171 -172
- package/unit-of-work/index.d.ts +6 -6
- package/unit-of-work/index.js +6 -22
- package/utils/AbstractSchemaGenerator.d.ts +6 -6
- package/utils/AbstractSchemaGenerator.js +7 -11
- package/utils/Configuration.d.ts +26 -27
- package/utils/Configuration.js +50 -55
- package/utils/ConfigurationLoader.d.ts +9 -8
- package/utils/ConfigurationLoader.js +71 -86
- package/utils/Cursor.d.ts +3 -3
- package/utils/Cursor.js +22 -25
- package/utils/DataloaderUtils.d.ts +4 -4
- package/utils/DataloaderUtils.js +12 -16
- package/utils/EntityComparator.d.ts +2 -2
- package/utils/EntityComparator.js +48 -52
- package/utils/NullHighlighter.d.ts +1 -1
- package/utils/NullHighlighter.js +1 -5
- package/utils/QueryHelper.d.ts +3 -3
- package/utils/QueryHelper.js +47 -51
- package/utils/RawQueryFragment.d.ts +1 -1
- package/utils/RawQueryFragment.js +16 -24
- package/utils/RequestContext.d.ts +2 -2
- package/utils/RequestContext.js +3 -7
- package/utils/TransactionContext.d.ts +1 -1
- package/utils/TransactionContext.js +4 -8
- package/utils/Utils.d.ts +16 -12
- package/utils/Utils.js +89 -93
- package/utils/clone.js +8 -11
- package/utils/index.d.ts +13 -13
- package/utils/index.js +13 -29
- package/utils/resolveContextProvider.d.ts +3 -3
- package/utils/resolveContextProvider.js +9 -12
- package/utils/upsert-utils.d.ts +3 -3
- package/utils/upsert-utils.js +5 -9
- package/index.mjs +0 -199
package/utils/Utils.js
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const node_module_1 = require("node:module");
|
|
14
|
-
const globby_1 = __importDefault(require("globby"));
|
|
15
|
-
const node_path_1 = require("node:path");
|
|
16
|
-
const node_os_1 = require("node:os");
|
|
17
|
-
const node_url_1 = require("node:url");
|
|
18
|
-
const fs_extra_1 = require("fs-extra");
|
|
19
|
-
const node_crypto_1 = require("node:crypto");
|
|
20
|
-
const esprima_1 = require("esprima");
|
|
21
|
-
const clone_1 = require("./clone");
|
|
22
|
-
const enums_1 = require("../enums");
|
|
23
|
-
const wrap_1 = require("../entity/wrap");
|
|
24
|
-
exports.ObjectBindingPattern = Symbol('ObjectBindingPattern');
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import globby from 'globby';
|
|
3
|
+
import { extname, isAbsolute, join, normalize, relative, resolve } from 'node:path';
|
|
4
|
+
import { platform } from 'node:os';
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
|
+
import { existsSync, mkdirSync, readFileSync } from 'node:fs';
|
|
7
|
+
import { createHash } from 'node:crypto';
|
|
8
|
+
import { tokenize } from 'esprima';
|
|
9
|
+
import { clone } from './clone.js';
|
|
10
|
+
import { ARRAY_OPERATORS, JSON_KEY_OPERATORS, GroupOperator, PlainObject, QueryOperator, ReferenceKind } from '../enums.js';
|
|
11
|
+
import { helper } from '../entity/wrap.js';
|
|
12
|
+
export const ObjectBindingPattern = Symbol('ObjectBindingPattern');
|
|
25
13
|
function compareConstructors(a, b) {
|
|
26
14
|
if (a.constructor === b.constructor) {
|
|
27
15
|
return true;
|
|
@@ -34,10 +22,7 @@ function compareConstructors(a, b) {
|
|
|
34
22
|
}
|
|
35
23
|
return false;
|
|
36
24
|
}
|
|
37
|
-
function
|
|
38
|
-
return typeof value === 'object' && !!value && '__raw' in value;
|
|
39
|
-
}
|
|
40
|
-
function compareObjects(a, b) {
|
|
25
|
+
export function compareObjects(a, b) {
|
|
41
26
|
if (a === b || (a == null && b == null)) {
|
|
42
27
|
return true;
|
|
43
28
|
}
|
|
@@ -56,6 +41,7 @@ function compareObjects(a, b) {
|
|
|
56
41
|
}
|
|
57
42
|
return timeA === timeB;
|
|
58
43
|
}
|
|
44
|
+
/* v8 ignore next 9 */
|
|
59
45
|
if ((typeof a === 'function' && typeof b === 'function') ||
|
|
60
46
|
(typeof a === 'object' && a.client && ['Ref', 'Raw'].includes(a.constructor.name) && typeof b === 'object' && b.client && ['Ref', 'Raw'].includes(b.constructor.name)) || // knex qb
|
|
61
47
|
(a instanceof RegExp && b instanceof RegExp) ||
|
|
@@ -82,7 +68,7 @@ function compareObjects(a, b) {
|
|
|
82
68
|
}
|
|
83
69
|
return true;
|
|
84
70
|
}
|
|
85
|
-
function compareArrays(a, b) {
|
|
71
|
+
export function compareArrays(a, b) {
|
|
86
72
|
const length = a.length;
|
|
87
73
|
if (length !== b.length) {
|
|
88
74
|
return false;
|
|
@@ -95,12 +81,12 @@ function compareArrays(a, b) {
|
|
|
95
81
|
}
|
|
96
82
|
return true;
|
|
97
83
|
}
|
|
98
|
-
function compareBooleans(a, b) {
|
|
84
|
+
export function compareBooleans(a, b) {
|
|
99
85
|
a = typeof a === 'number' ? Boolean(a) : a;
|
|
100
86
|
b = typeof b === 'number' ? Boolean(b) : b;
|
|
101
87
|
return a === b;
|
|
102
88
|
}
|
|
103
|
-
function compareBuffers(a, b) {
|
|
89
|
+
export function compareBuffers(a, b) {
|
|
104
90
|
const length = a.length;
|
|
105
91
|
if (length !== b.length) {
|
|
106
92
|
return false;
|
|
@@ -115,7 +101,7 @@ function compareBuffers(a, b) {
|
|
|
115
101
|
/**
|
|
116
102
|
* Checks if arguments are deeply (but not strictly) equal.
|
|
117
103
|
*/
|
|
118
|
-
function equals(a, b) {
|
|
104
|
+
export function equals(a, b) {
|
|
119
105
|
if (a === b) {
|
|
120
106
|
return true;
|
|
121
107
|
}
|
|
@@ -131,8 +117,9 @@ function equals(a, b) {
|
|
|
131
117
|
return Number.isNaN(a) && Number.isNaN(b);
|
|
132
118
|
}
|
|
133
119
|
const equalsFn = equals;
|
|
134
|
-
function parseJsonSafe(value) {
|
|
120
|
+
export function parseJsonSafe(value) {
|
|
135
121
|
if (typeof value === 'string') {
|
|
122
|
+
/* v8 ignore next 6 */
|
|
136
123
|
try {
|
|
137
124
|
return JSON.parse(value);
|
|
138
125
|
}
|
|
@@ -143,9 +130,9 @@ function parseJsonSafe(value) {
|
|
|
143
130
|
}
|
|
144
131
|
return value;
|
|
145
132
|
}
|
|
146
|
-
class Utils {
|
|
133
|
+
export class Utils {
|
|
147
134
|
static PK_SEPARATOR = '~~~';
|
|
148
|
-
/*
|
|
135
|
+
/* v8 ignore next */
|
|
149
136
|
static dynamicImportProvider = (id) => import(id);
|
|
150
137
|
/**
|
|
151
138
|
* Checks if the argument is not undefined
|
|
@@ -220,7 +207,6 @@ class Utils {
|
|
|
220
207
|
static getObjectKeysSize(object) {
|
|
221
208
|
let size = 0;
|
|
222
209
|
for (const key in object) {
|
|
223
|
-
/* istanbul ignore else */
|
|
224
210
|
if (Object.hasOwn(object, key)) {
|
|
225
211
|
size++;
|
|
226
212
|
}
|
|
@@ -233,7 +219,6 @@ class Utils {
|
|
|
233
219
|
*/
|
|
234
220
|
static hasObjectKeys(object) {
|
|
235
221
|
for (const key in object) {
|
|
236
|
-
/* istanbul ignore else */
|
|
237
222
|
if (Object.hasOwn(object, key)) {
|
|
238
223
|
return true;
|
|
239
224
|
}
|
|
@@ -297,7 +282,7 @@ class Utils {
|
|
|
297
282
|
target[key] = Utils.copy(value);
|
|
298
283
|
continue;
|
|
299
284
|
}
|
|
300
|
-
/*
|
|
285
|
+
/* v8 ignore next 3 */
|
|
301
286
|
if (!(key in target)) {
|
|
302
287
|
Object.assign(target, { [key]: {} });
|
|
303
288
|
}
|
|
@@ -338,7 +323,7 @@ class Utils {
|
|
|
338
323
|
* Creates deep copy of given object.
|
|
339
324
|
*/
|
|
340
325
|
static copy(entity, respectCustomCloneMethod = true) {
|
|
341
|
-
return
|
|
326
|
+
return clone(entity, respectCustomCloneMethod);
|
|
342
327
|
}
|
|
343
328
|
/**
|
|
344
329
|
* Normalize the argument to always be an array.
|
|
@@ -380,11 +365,11 @@ class Utils {
|
|
|
380
365
|
if (Array.isArray(func)) {
|
|
381
366
|
return func;
|
|
382
367
|
}
|
|
368
|
+
/* v8 ignore next 5 */
|
|
383
369
|
try {
|
|
384
|
-
return
|
|
370
|
+
return tokenize(func.toString(), { tolerant: true });
|
|
385
371
|
}
|
|
386
372
|
catch {
|
|
387
|
-
/* istanbul ignore next */
|
|
388
373
|
return [];
|
|
389
374
|
}
|
|
390
375
|
}
|
|
@@ -412,7 +397,7 @@ class Utils {
|
|
|
412
397
|
break;
|
|
413
398
|
}
|
|
414
399
|
if (inside === 2 && token.type === 'Punctuator' && token.value === '{' && i === currentBlockStart + 1) {
|
|
415
|
-
ret.push(
|
|
400
|
+
ret.push(ObjectBindingPattern);
|
|
416
401
|
i = tokens.findIndex((t, idx) => idx > i + 2 && t.type === 'Punctuator' && t.value === '}');
|
|
417
402
|
continue;
|
|
418
403
|
}
|
|
@@ -450,7 +435,7 @@ class Utils {
|
|
|
450
435
|
return data;
|
|
451
436
|
}
|
|
452
437
|
if (Utils.isEntity(data, true)) {
|
|
453
|
-
return
|
|
438
|
+
return helper(data).getPrimaryKey();
|
|
454
439
|
}
|
|
455
440
|
if (strict && meta && Utils.getObjectKeysSize(data) !== meta.primaryKeys.length) {
|
|
456
441
|
return null;
|
|
@@ -499,7 +484,7 @@ class Utils {
|
|
|
499
484
|
return key.split(this.PK_SEPARATOR);
|
|
500
485
|
}
|
|
501
486
|
static getPrimaryKeyValues(entity, primaryKeys, allowScalar = false, convertCustomTypes = false) {
|
|
502
|
-
/*
|
|
487
|
+
/* v8 ignore next 3 */
|
|
503
488
|
if (entity == null) {
|
|
504
489
|
return entity;
|
|
505
490
|
}
|
|
@@ -510,7 +495,7 @@ class Utils {
|
|
|
510
495
|
return val;
|
|
511
496
|
}
|
|
512
497
|
const pk = Utils.isEntity(entity, true)
|
|
513
|
-
?
|
|
498
|
+
? helper(entity).getPrimaryKey(convertCustomTypes)
|
|
514
499
|
: primaryKeys.reduce((o, pk) => { o[pk] = entity[pk]; return o; }, {});
|
|
515
500
|
if (primaryKeys.length > 1) {
|
|
516
501
|
return toArray(pk);
|
|
@@ -570,7 +555,7 @@ class Utils {
|
|
|
570
555
|
if (convertCustomTypes && platform && prop.customType && !prop.targetMeta) {
|
|
571
556
|
value = prop.customType.convertToJSValue(value, platform);
|
|
572
557
|
}
|
|
573
|
-
if (prop.kind !==
|
|
558
|
+
if (prop.kind !== ReferenceKind.SCALAR && prop.targetMeta) {
|
|
574
559
|
const value2 = this.getOrderedPrimaryKeys(value, prop.targetMeta, platform, convertCustomTypes);
|
|
575
560
|
value = value2.length > 1 ? value2 : value2[0];
|
|
576
561
|
}
|
|
@@ -631,19 +616,17 @@ class Utils {
|
|
|
631
616
|
.map(field => field === allSymbol ? allSymbol : field.substring(prefix.length + 1));
|
|
632
617
|
}
|
|
633
618
|
/**
|
|
634
|
-
* Tries to detect
|
|
619
|
+
* Tries to detect TypeScript support.
|
|
635
620
|
*/
|
|
636
|
-
static
|
|
637
|
-
/*
|
|
621
|
+
static detectTypeScriptSupport() {
|
|
622
|
+
/* v8 ignore next 7 */
|
|
638
623
|
return process.argv[0].endsWith('ts-node') // running via ts-node directly
|
|
639
|
-
//
|
|
640
|
-
|| !!process[Symbol.for('ts-node.register.instance')] // check if internal ts-node symbol exists
|
|
624
|
+
|| !!process.env.MIKRO_ORM_CLI_ALWAYS_ALLOW_TS // forced explicitly or enabled via `registerTypeScriptSupport()`
|
|
641
625
|
|| !!process.env.TS_JEST // check if ts-jest is used (works only with v27.0.4+)
|
|
642
626
|
|| !!process.env.VITEST // check if vitest is used
|
|
643
627
|
|| !!process.versions.bun // check if bun is used
|
|
644
628
|
|| process.argv.slice(1).some(arg => arg.includes('ts-node')) // registering ts-node runner
|
|
645
|
-
|| process.execArgv.some(arg => arg === 'ts-node/esm') // check for ts-node/esm module loader
|
|
646
|
-
|| (require.extensions && !!require.extensions['.ts']); // check if the extension is registered
|
|
629
|
+
|| process.execArgv.some(arg => arg === 'ts-node/esm'); // check for ts-node/esm module loader
|
|
647
630
|
}
|
|
648
631
|
/**
|
|
649
632
|
* Uses some dark magic to get source path to caller where decorator is used.
|
|
@@ -705,7 +688,7 @@ class Utils {
|
|
|
705
688
|
&& typeof value.constructor === 'function'
|
|
706
689
|
&& (Object.hasOwn(value.constructor.prototype, 'isPrototypeOf') || Object.getPrototypeOf(value.constructor.prototype) === null))
|
|
707
690
|
|| (value && Object.getPrototypeOf(value) === null)
|
|
708
|
-
|| value instanceof
|
|
691
|
+
|| value instanceof PlainObject;
|
|
709
692
|
}
|
|
710
693
|
/**
|
|
711
694
|
* Executes the `cb` promise serially on every element of the `items` array and returns array of resolved values.
|
|
@@ -722,7 +705,7 @@ class Utils {
|
|
|
722
705
|
}
|
|
723
706
|
static fileURLToPath(url) {
|
|
724
707
|
// expose `fileURLToPath` on Utils so that it can be properly mocked in tests
|
|
725
|
-
return
|
|
708
|
+
return fileURLToPath(url);
|
|
726
709
|
}
|
|
727
710
|
/**
|
|
728
711
|
* Resolves and normalizes a series of path parts relative to each preceding part.
|
|
@@ -735,7 +718,7 @@ class Utils {
|
|
|
735
718
|
let start = 0;
|
|
736
719
|
for (let i = 0; i < parts.length; i++) {
|
|
737
720
|
const part = parts[i];
|
|
738
|
-
if (
|
|
721
|
+
if (isAbsolute(part)) {
|
|
739
722
|
start = i;
|
|
740
723
|
}
|
|
741
724
|
else if (part.startsWith('file:')) {
|
|
@@ -747,7 +730,7 @@ class Utils {
|
|
|
747
730
|
parts = parts.slice(start);
|
|
748
731
|
}
|
|
749
732
|
let path = parts.join('/').replace(/\\/g, '/').replace(/\/$/, '');
|
|
750
|
-
path =
|
|
733
|
+
path = normalize(path).replace(/\\/g, '/');
|
|
751
734
|
return (path.match(/^[/.]|[a-zA-Z]:/) || path.startsWith('!')) ? path : './' + path;
|
|
752
735
|
}
|
|
753
736
|
/**
|
|
@@ -762,7 +745,7 @@ class Utils {
|
|
|
762
745
|
if (path.startsWith('.')) {
|
|
763
746
|
return path;
|
|
764
747
|
}
|
|
765
|
-
path =
|
|
748
|
+
path = relative(Utils.normalizePath(relativeTo), path);
|
|
766
749
|
return Utils.normalizePath(path);
|
|
767
750
|
}
|
|
768
751
|
/**
|
|
@@ -773,13 +756,13 @@ class Utils {
|
|
|
773
756
|
if (!path) {
|
|
774
757
|
return Utils.normalizePath(baseDir);
|
|
775
758
|
}
|
|
776
|
-
if (!
|
|
759
|
+
if (!isAbsolute(path) && !path.startsWith('file://')) {
|
|
777
760
|
path = baseDir + '/' + path;
|
|
778
761
|
}
|
|
779
762
|
return Utils.normalizePath(path);
|
|
780
763
|
}
|
|
781
764
|
static hash(data, length) {
|
|
782
|
-
const hash =
|
|
765
|
+
const hash = createHash('md5').update(data).digest('hex');
|
|
783
766
|
if (length) {
|
|
784
767
|
return hash.substring(0, length);
|
|
785
768
|
}
|
|
@@ -812,11 +795,11 @@ class Utils {
|
|
|
812
795
|
return Math.round(Math.random() * (max - min)) + min;
|
|
813
796
|
}
|
|
814
797
|
static async pathExists(path, options = {}) {
|
|
815
|
-
if (
|
|
816
|
-
const found = await (
|
|
798
|
+
if (globby.hasMagic(path)) {
|
|
799
|
+
const found = await globby(path, options);
|
|
817
800
|
return found.length > 0;
|
|
818
801
|
}
|
|
819
|
-
return
|
|
802
|
+
return this.pathExistsSync(path);
|
|
820
803
|
}
|
|
821
804
|
/**
|
|
822
805
|
* Extracts all possible values of a TS enum. Works with both string and numeric enums.
|
|
@@ -839,18 +822,18 @@ class Utils {
|
|
|
839
822
|
}
|
|
840
823
|
static isOperator(key, includeGroupOperators = true) {
|
|
841
824
|
if (!includeGroupOperators) {
|
|
842
|
-
return key in
|
|
825
|
+
return key in QueryOperator;
|
|
843
826
|
}
|
|
844
|
-
return key in
|
|
827
|
+
return key in GroupOperator || key in QueryOperator;
|
|
845
828
|
}
|
|
846
829
|
static isGroupOperator(key) {
|
|
847
|
-
return key in
|
|
830
|
+
return key in GroupOperator;
|
|
848
831
|
}
|
|
849
832
|
static isArrayOperator(key) {
|
|
850
|
-
return
|
|
833
|
+
return ARRAY_OPERATORS.includes(key);
|
|
851
834
|
}
|
|
852
835
|
static isJsonKeyOperator(key) {
|
|
853
|
-
return
|
|
836
|
+
return JSON_KEY_OPERATORS.includes(key);
|
|
854
837
|
}
|
|
855
838
|
static hasNestedKey(object, key) {
|
|
856
839
|
if (!object) {
|
|
@@ -875,49 +858,55 @@ class Utils {
|
|
|
875
858
|
* @param [from] Location to start the node resolution
|
|
876
859
|
*/
|
|
877
860
|
static requireFrom(id, from = process.cwd()) {
|
|
878
|
-
if (!
|
|
879
|
-
from =
|
|
861
|
+
if (!extname(from)) {
|
|
862
|
+
from = join(from, '__fake.js');
|
|
880
863
|
}
|
|
881
|
-
return
|
|
864
|
+
return createRequire(resolve(from))(id);
|
|
882
865
|
}
|
|
883
866
|
static async dynamicImport(id) {
|
|
884
|
-
/*
|
|
885
|
-
if (
|
|
867
|
+
/* v8 ignore next 7 */
|
|
868
|
+
if (platform() === 'win32') {
|
|
886
869
|
try {
|
|
887
|
-
id =
|
|
870
|
+
id = pathToFileURL(id).toString();
|
|
888
871
|
}
|
|
889
872
|
catch {
|
|
890
873
|
// ignore
|
|
891
874
|
}
|
|
892
|
-
// If the extension is not registered, we need to fall back to a file path.
|
|
893
|
-
if (require.extensions && !require.extensions[(0, node_path_1.extname)(id)]) {
|
|
894
|
-
id = (0, node_url_1.fileURLToPath)(id);
|
|
895
|
-
}
|
|
896
875
|
}
|
|
897
|
-
/*
|
|
876
|
+
/* v8 ignore next */
|
|
898
877
|
return this.dynamicImportProvider(id);
|
|
899
878
|
}
|
|
900
|
-
/*
|
|
879
|
+
/* v8 ignore next 3 */
|
|
901
880
|
static setDynamicImportProvider(provider) {
|
|
902
881
|
this.dynamicImportProvider = provider;
|
|
903
882
|
}
|
|
883
|
+
static ensureDir(path) {
|
|
884
|
+
if (!existsSync(path)) {
|
|
885
|
+
mkdirSync(path, { recursive: true });
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
static pathExistsSync(path) {
|
|
889
|
+
return existsSync(path);
|
|
890
|
+
}
|
|
891
|
+
static readJSONSync(path) {
|
|
892
|
+
const file = readFileSync(path);
|
|
893
|
+
return JSON.parse(file.toString());
|
|
894
|
+
}
|
|
904
895
|
static getORMVersion() {
|
|
905
|
-
/* istanbul ignore next */
|
|
906
896
|
try {
|
|
907
|
-
// this works
|
|
908
|
-
|
|
909
|
-
|
|
897
|
+
// this works during development where we have `src` folder
|
|
898
|
+
return this.requireFrom('../../package.json', import.meta.dirname).version;
|
|
899
|
+
/* v8 ignore next 5 */
|
|
910
900
|
}
|
|
911
901
|
catch {
|
|
912
|
-
// this works
|
|
913
|
-
|
|
914
|
-
return require('../package.json').version;
|
|
902
|
+
// this works in production build where we do not have the `src` folder
|
|
903
|
+
return this.requireFrom('../package.json', import.meta.dirname).version;
|
|
915
904
|
}
|
|
916
905
|
}
|
|
917
|
-
/* istanbul ignore next */
|
|
918
906
|
static createFunction(context, code) {
|
|
919
907
|
try {
|
|
920
908
|
return new Function(...context.keys(), `'use strict';\n` + code)(...context.values());
|
|
909
|
+
/* v8 ignore next 5 */
|
|
921
910
|
}
|
|
922
911
|
catch (e) {
|
|
923
912
|
// eslint-disable-next-line no-console
|
|
@@ -925,12 +914,12 @@ class Utils {
|
|
|
925
914
|
throw e;
|
|
926
915
|
}
|
|
927
916
|
}
|
|
928
|
-
/* istanbul ignore next */
|
|
929
917
|
static callCompiledFunction(fn, ...args) {
|
|
930
918
|
try {
|
|
931
919
|
return fn(...args);
|
|
932
920
|
}
|
|
933
921
|
catch (e) {
|
|
922
|
+
/* v8 ignore start */
|
|
934
923
|
if ([SyntaxError, TypeError, EvalError, ReferenceError].some(t => e instanceof t)) {
|
|
935
924
|
const position = e.stack.match(/<anonymous>:(\d+):(\d+)/);
|
|
936
925
|
let code = fn.toString();
|
|
@@ -947,6 +936,7 @@ class Utils {
|
|
|
947
936
|
// eslint-disable-next-line no-console
|
|
948
937
|
console.error(`JIT runtime error: ${e.message}\n\n${code}`);
|
|
949
938
|
}
|
|
939
|
+
/* v8 ignore stop */
|
|
950
940
|
throw e;
|
|
951
941
|
}
|
|
952
942
|
}
|
|
@@ -1052,6 +1042,16 @@ class Utils {
|
|
|
1052
1042
|
throw err;
|
|
1053
1043
|
}
|
|
1054
1044
|
}
|
|
1045
|
+
static async tryImport({ module, warning }) {
|
|
1046
|
+
try {
|
|
1047
|
+
return await this.dynamicImport(module);
|
|
1048
|
+
}
|
|
1049
|
+
catch (err) {
|
|
1050
|
+
// eslint-disable-next-line no-console
|
|
1051
|
+
console.warn(warning);
|
|
1052
|
+
return undefined;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
1055
|
static stripRelativePath(str) {
|
|
1056
1056
|
return str.replace(/^(?:\.\.\/|\.\/)+/, '/');
|
|
1057
1057
|
}
|
|
@@ -1087,9 +1087,6 @@ class Utils {
|
|
|
1087
1087
|
static entries(obj) {
|
|
1088
1088
|
return Object.entries(obj);
|
|
1089
1089
|
}
|
|
1090
|
-
static isRawSql(value) {
|
|
1091
|
-
return isRawSql(value);
|
|
1092
|
-
}
|
|
1093
1090
|
static primaryKeyToObject(meta, primaryKey, visible) {
|
|
1094
1091
|
const pks = meta.compositePK && Utils.isPlainObject(primaryKey) ? Object.values(primaryKey) : Utils.asArray(primaryKey);
|
|
1095
1092
|
const pkProps = meta.getPrimaryProps();
|
|
@@ -1107,4 +1104,3 @@ class Utils {
|
|
|
1107
1104
|
}, {});
|
|
1108
1105
|
}
|
|
1109
1106
|
}
|
|
1110
|
-
exports.Utils = Utils;
|
package/utils/clone.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Inspired by https://github.com/pvorb/clone but simplified and never tries to
|
|
4
3
|
* clone `EventEmitter`s to get around https://github.com/mikro-orm/mikro-orm/issues/2748
|
|
5
4
|
* @internal
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const node_events_1 = require("node:events");
|
|
10
|
-
const RawQueryFragment_1 = require("./RawQueryFragment");
|
|
6
|
+
import { EventEmitter } from 'node:events';
|
|
7
|
+
import { RawQueryFragment } from './RawQueryFragment.js';
|
|
11
8
|
/**
|
|
12
9
|
* Get the property descriptor of a property on an object or its prototype chain.
|
|
13
10
|
*
|
|
@@ -25,7 +22,7 @@ function getPropertyDescriptor(obj, prop) {
|
|
|
25
22
|
}
|
|
26
23
|
return null;
|
|
27
24
|
}
|
|
28
|
-
function clone(parent, respectCustomCloneMethod = true) {
|
|
25
|
+
export function clone(parent, respectCustomCloneMethod = true) {
|
|
29
26
|
const allParents = [];
|
|
30
27
|
const allChildren = [];
|
|
31
28
|
function _clone(parent) {
|
|
@@ -33,11 +30,11 @@ function clone(parent, respectCustomCloneMethod = true) {
|
|
|
33
30
|
if (parent === null) {
|
|
34
31
|
return null;
|
|
35
32
|
}
|
|
36
|
-
const raw =
|
|
33
|
+
const raw = RawQueryFragment.getKnownFragment(parent, false);
|
|
37
34
|
if (raw && respectCustomCloneMethod) {
|
|
38
35
|
return raw.clone();
|
|
39
36
|
}
|
|
40
|
-
if (typeof parent !== 'object' || parent instanceof
|
|
37
|
+
if (typeof parent !== 'object' || parent instanceof EventEmitter) {
|
|
41
38
|
return parent;
|
|
42
39
|
}
|
|
43
40
|
if (respectCustomCloneMethod && 'clone' in parent && typeof parent.clone === 'function') {
|
|
@@ -84,7 +81,7 @@ function clone(parent, respectCustomCloneMethod = true) {
|
|
|
84
81
|
return child;
|
|
85
82
|
}
|
|
86
83
|
else if (parent instanceof Error) {
|
|
87
|
-
child =
|
|
84
|
+
child = new parent.constructor(parent.message);
|
|
88
85
|
}
|
|
89
86
|
else {
|
|
90
87
|
proto = Object.getPrototypeOf(parent);
|
|
@@ -117,7 +114,7 @@ function clone(parent, respectCustomCloneMethod = true) {
|
|
|
117
114
|
if (attrs && typeof attrs.get === 'function' && attrs.set == null) {
|
|
118
115
|
continue;
|
|
119
116
|
}
|
|
120
|
-
const raw =
|
|
117
|
+
const raw = RawQueryFragment.getKnownFragment(i, false);
|
|
121
118
|
if (raw && respectCustomCloneMethod) {
|
|
122
119
|
const i2 = raw.clone().toString();
|
|
123
120
|
child[i2] = _clone(parent[i]);
|
|
@@ -130,7 +127,7 @@ function clone(parent, respectCustomCloneMethod = true) {
|
|
|
130
127
|
for (let i = 0; i < symbols.length; i++) {
|
|
131
128
|
const symbol = symbols[i];
|
|
132
129
|
const descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
|
|
133
|
-
/*
|
|
130
|
+
/* v8 ignore next 3 */
|
|
134
131
|
if (descriptor && !descriptor.enumerable) {
|
|
135
132
|
continue;
|
|
136
133
|
}
|
package/utils/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export * from './Configuration';
|
|
2
|
-
export * from './ConfigurationLoader';
|
|
3
|
-
export * from './Cursor';
|
|
4
|
-
export * from './DataloaderUtils';
|
|
5
|
-
export * from './Utils';
|
|
6
|
-
export * from './RequestContext';
|
|
7
|
-
export * from './TransactionContext';
|
|
8
|
-
export * from './QueryHelper';
|
|
9
|
-
export * from './NullHighlighter';
|
|
10
|
-
export * from './EntityComparator';
|
|
11
|
-
export * from './AbstractSchemaGenerator';
|
|
12
|
-
export * from './RawQueryFragment';
|
|
13
|
-
export * from './upsert-utils';
|
|
1
|
+
export * from './Configuration.js';
|
|
2
|
+
export * from './ConfigurationLoader.js';
|
|
3
|
+
export * from './Cursor.js';
|
|
4
|
+
export * from './DataloaderUtils.js';
|
|
5
|
+
export * from './Utils.js';
|
|
6
|
+
export * from './RequestContext.js';
|
|
7
|
+
export * from './TransactionContext.js';
|
|
8
|
+
export * from './QueryHelper.js';
|
|
9
|
+
export * from './NullHighlighter.js';
|
|
10
|
+
export * from './EntityComparator.js';
|
|
11
|
+
export * from './AbstractSchemaGenerator.js';
|
|
12
|
+
export * from './RawQueryFragment.js';
|
|
13
|
+
export * from './upsert-utils.js';
|
package/utils/index.js
CHANGED
|
@@ -1,29 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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("./Configuration"), exports);
|
|
18
|
-
__exportStar(require("./ConfigurationLoader"), exports);
|
|
19
|
-
__exportStar(require("./Cursor"), exports);
|
|
20
|
-
__exportStar(require("./DataloaderUtils"), exports);
|
|
21
|
-
__exportStar(require("./Utils"), exports);
|
|
22
|
-
__exportStar(require("./RequestContext"), exports);
|
|
23
|
-
__exportStar(require("./TransactionContext"), exports);
|
|
24
|
-
__exportStar(require("./QueryHelper"), exports);
|
|
25
|
-
__exportStar(require("./NullHighlighter"), exports);
|
|
26
|
-
__exportStar(require("./EntityComparator"), exports);
|
|
27
|
-
__exportStar(require("./AbstractSchemaGenerator"), exports);
|
|
28
|
-
__exportStar(require("./RawQueryFragment"), exports);
|
|
29
|
-
__exportStar(require("./upsert-utils"), exports);
|
|
1
|
+
export * from './Configuration.js';
|
|
2
|
+
export * from './ConfigurationLoader.js';
|
|
3
|
+
export * from './Cursor.js';
|
|
4
|
+
export * from './DataloaderUtils.js';
|
|
5
|
+
export * from './Utils.js';
|
|
6
|
+
export * from './RequestContext.js';
|
|
7
|
+
export * from './TransactionContext.js';
|
|
8
|
+
export * from './QueryHelper.js';
|
|
9
|
+
export * from './NullHighlighter.js';
|
|
10
|
+
export * from './EntityComparator.js';
|
|
11
|
+
export * from './AbstractSchemaGenerator.js';
|
|
12
|
+
export * from './RawQueryFragment.js';
|
|
13
|
+
export * from './upsert-utils.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityManager } from '../EntityManager';
|
|
2
|
-
import { MikroORM } from '../MikroORM';
|
|
3
|
-
import type { ContextProvider, MaybePromise } from '../typings';
|
|
1
|
+
import { EntityManager } from '../EntityManager.js';
|
|
2
|
+
import { MikroORM } from '../MikroORM.js';
|
|
3
|
+
import type { ContextProvider, MaybePromise } from '../typings.js';
|
|
4
4
|
/**
|
|
5
5
|
* Find `EntityManager` in provided context, or else in instance's `orm` or `em` properties.
|
|
6
6
|
*/
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const EntityRepository_1 = require("../entity/EntityRepository");
|
|
5
|
-
const EntityManager_1 = require("../EntityManager");
|
|
6
|
-
const MikroORM_1 = require("../MikroORM");
|
|
1
|
+
import { EntityRepository } from '../entity/EntityRepository.js';
|
|
2
|
+
import { EntityManager } from '../EntityManager.js';
|
|
3
|
+
import { MikroORM } from '../MikroORM.js';
|
|
7
4
|
function getEntityManager(caller, context) {
|
|
8
|
-
if (context instanceof
|
|
5
|
+
if (context instanceof EntityManager) {
|
|
9
6
|
return context;
|
|
10
7
|
}
|
|
11
|
-
if (context instanceof
|
|
8
|
+
if (context instanceof EntityRepository) {
|
|
12
9
|
return context.getEntityManager();
|
|
13
10
|
}
|
|
14
|
-
if (context instanceof
|
|
11
|
+
if (context instanceof MikroORM) {
|
|
15
12
|
return context.em;
|
|
16
13
|
}
|
|
17
|
-
if (caller.em instanceof
|
|
14
|
+
if (caller.em instanceof EntityManager) {
|
|
18
15
|
return caller.em;
|
|
19
16
|
}
|
|
20
|
-
if (caller.orm instanceof
|
|
17
|
+
if (caller.orm instanceof MikroORM) {
|
|
21
18
|
return caller.orm.em;
|
|
22
19
|
}
|
|
23
20
|
return undefined;
|
|
@@ -25,7 +22,7 @@ function getEntityManager(caller, context) {
|
|
|
25
22
|
/**
|
|
26
23
|
* Find `EntityManager` in provided context, or else in instance's `orm` or `em` properties.
|
|
27
24
|
*/
|
|
28
|
-
async function resolveContextProvider(caller, provider) {
|
|
25
|
+
export async function resolveContextProvider(caller, provider) {
|
|
29
26
|
const context = typeof provider === 'function' ? await provider(caller) : await provider;
|
|
30
27
|
return getEntityManager({ orm: await caller.orm, em: await caller.em }, context);
|
|
31
28
|
}
|
package/utils/upsert-utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { EntityData, EntityMetadata } from '../typings';
|
|
2
|
-
import type { UpsertOptions } from '../drivers/IDatabaseDriver';
|
|
3
|
-
import type { RawQueryFragment } from '../utils/RawQueryFragment';
|
|
1
|
+
import type { EntityData, EntityMetadata } from '../typings.js';
|
|
2
|
+
import type { UpsertOptions } from '../drivers/IDatabaseDriver.js';
|
|
3
|
+
import type { RawQueryFragment } from '../utils/RawQueryFragment.js';
|
|
4
4
|
/** @internal */
|
|
5
5
|
export declare function getOnConflictFields<T>(meta: EntityMetadata<T> | undefined, data: EntityData<T>, uniqueFields: (keyof T)[] | RawQueryFragment, options: UpsertOptions<T>): (keyof T)[];
|
|
6
6
|
/** @internal */
|