@mikro-orm/core 7.0.0-rc.2 → 7.0.0
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 +4 -16
- package/EntityManager.js +248 -181
- package/MikroORM.d.ts +4 -6
- package/MikroORM.js +24 -24
- package/README.md +5 -4
- package/cache/FileCacheAdapter.d.ts +1 -5
- package/cache/FileCacheAdapter.js +22 -24
- package/cache/GeneratedCacheAdapter.d.ts +1 -1
- package/cache/GeneratedCacheAdapter.js +6 -6
- package/cache/MemoryCacheAdapter.d.ts +1 -2
- package/cache/MemoryCacheAdapter.js +8 -8
- package/cache/index.d.ts +1 -1
- package/cache/index.js +0 -1
- package/connections/Connection.d.ts +1 -0
- package/connections/Connection.js +43 -14
- package/drivers/DatabaseDriver.d.ts +0 -2
- package/drivers/DatabaseDriver.js +28 -12
- package/drivers/IDatabaseDriver.d.ts +43 -0
- package/entity/Collection.d.ts +1 -9
- package/entity/Collection.js +124 -108
- package/entity/EntityAssigner.js +23 -11
- package/entity/EntityFactory.d.ts +1 -8
- package/entity/EntityFactory.js +79 -59
- package/entity/EntityHelper.js +25 -16
- package/entity/EntityLoader.d.ts +1 -3
- package/entity/EntityLoader.js +90 -60
- package/entity/Reference.d.ts +2 -3
- package/entity/Reference.js +48 -19
- package/entity/WrappedEntity.d.ts +4 -2
- package/entity/WrappedEntity.js +5 -1
- package/entity/defineEntity.d.ts +42 -85
- package/entity/utils.js +28 -26
- package/entity/validators.js +2 -1
- package/enums.d.ts +2 -1
- package/enums.js +13 -17
- package/errors.d.ts +11 -11
- package/errors.js +8 -8
- package/events/EventManager.d.ts +1 -4
- package/events/EventManager.js +26 -23
- package/events/index.d.ts +1 -1
- package/events/index.js +0 -1
- package/exceptions.js +9 -2
- package/hydration/ObjectHydrator.d.ts +1 -2
- package/hydration/ObjectHydrator.js +41 -27
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/logging/DefaultLogger.js +6 -7
- package/logging/Logger.d.ts +2 -1
- package/logging/colors.js +2 -5
- package/logging/index.d.ts +1 -1
- package/logging/index.js +0 -1
- package/metadata/EntitySchema.d.ts +3 -3
- package/metadata/EntitySchema.js +12 -2
- package/metadata/MetadataDiscovery.d.ts +1 -9
- package/metadata/MetadataDiscovery.js +251 -179
- package/metadata/MetadataProvider.js +26 -1
- package/metadata/MetadataStorage.d.ts +1 -5
- package/metadata/MetadataStorage.js +37 -39
- package/metadata/MetadataValidator.js +20 -5
- package/metadata/discover-entities.js +1 -1
- package/metadata/index.d.ts +1 -1
- package/metadata/index.js +0 -1
- package/metadata/types.d.ts +2 -2
- package/naming-strategy/AbstractNamingStrategy.js +6 -3
- package/naming-strategy/EntityCaseNamingStrategy.js +1 -1
- package/naming-strategy/index.d.ts +1 -1
- package/naming-strategy/index.js +0 -1
- package/not-supported.js +5 -1
- package/package.json +38 -38
- package/platforms/Platform.d.ts +24 -1
- package/platforms/Platform.js +106 -27
- package/serialization/EntitySerializer.js +8 -4
- package/serialization/EntityTransformer.js +4 -1
- package/serialization/SerializationContext.d.ts +4 -8
- package/serialization/SerializationContext.js +21 -16
- package/types/UuidType.d.ts +2 -0
- package/types/UuidType.js +14 -2
- package/types/index.d.ts +2 -1
- package/typings.d.ts +35 -24
- package/typings.js +9 -9
- package/unit-of-work/ChangeSet.js +4 -4
- package/unit-of-work/ChangeSetComputer.d.ts +1 -6
- package/unit-of-work/ChangeSetComputer.js +29 -27
- package/unit-of-work/ChangeSetPersister.d.ts +1 -9
- package/unit-of-work/ChangeSetPersister.js +63 -58
- package/unit-of-work/CommitOrderCalculator.d.ts +1 -4
- package/unit-of-work/CommitOrderCalculator.js +17 -15
- package/unit-of-work/IdentityMap.d.ts +2 -5
- package/unit-of-work/IdentityMap.js +18 -18
- package/unit-of-work/UnitOfWork.d.ts +12 -20
- package/unit-of-work/UnitOfWork.js +228 -191
- package/utils/AbstractMigrator.d.ts +2 -2
- package/utils/AbstractMigrator.js +10 -12
- package/utils/AbstractSchemaGenerator.js +2 -1
- package/utils/AsyncContext.js +1 -1
- package/utils/Configuration.d.ts +90 -189
- package/utils/Configuration.js +97 -77
- package/utils/Cursor.d.ts +3 -3
- package/utils/Cursor.js +8 -6
- package/utils/DataloaderUtils.js +15 -12
- package/utils/EntityComparator.d.ts +8 -15
- package/utils/EntityComparator.js +100 -92
- package/utils/QueryHelper.d.ts +16 -1
- package/utils/QueryHelper.js +108 -50
- package/utils/RawQueryFragment.d.ts +4 -4
- package/utils/RawQueryFragment.js +3 -2
- package/utils/TransactionManager.js +3 -3
- package/utils/Utils.d.ts +2 -2
- package/utils/Utils.js +39 -32
- package/utils/clone.js +5 -0
- package/utils/env-vars.js +6 -5
- package/utils/fs-utils.d.ts +3 -17
- package/utils/fs-utils.js +2 -5
- package/utils/upsert-utils.js +7 -4
|
@@ -13,7 +13,12 @@ export class MetadataProvider {
|
|
|
13
13
|
}
|
|
14
14
|
else if (prop.entity) {
|
|
15
15
|
const tmp = prop.entity();
|
|
16
|
-
prop.type = Array.isArray(tmp)
|
|
16
|
+
prop.type = Array.isArray(tmp)
|
|
17
|
+
? tmp
|
|
18
|
+
.map(t => Utils.className(t))
|
|
19
|
+
.sort()
|
|
20
|
+
.join(' | ')
|
|
21
|
+
: Utils.className(tmp);
|
|
17
22
|
prop.target = tmp instanceof EntitySchema ? tmp.meta.class : tmp;
|
|
18
23
|
}
|
|
19
24
|
else if (!prop.type && !((prop.enum || prop.array) && (prop.items?.length ?? 0) > 0)) {
|
|
@@ -29,7 +34,27 @@ export class MetadataProvider {
|
|
|
29
34
|
delete prop.items;
|
|
30
35
|
}
|
|
31
36
|
});
|
|
37
|
+
// Preserve function expressions from indexes/uniques — they can't survive JSON cache serialization
|
|
38
|
+
const expressionMap = new Map();
|
|
39
|
+
for (const arr of [meta.indexes, meta.uniques]) {
|
|
40
|
+
for (const idx of arr ?? []) {
|
|
41
|
+
if (typeof idx.expression === 'function' && idx.name) {
|
|
42
|
+
expressionMap.set(idx.name, idx.expression);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
32
46
|
Utils.mergeConfig(meta, cache);
|
|
47
|
+
// Restore function expressions that were lost during JSON serialization
|
|
48
|
+
if (expressionMap.size > 0) {
|
|
49
|
+
for (const arr of [meta.indexes, meta.uniques]) {
|
|
50
|
+
for (const idx of arr ?? []) {
|
|
51
|
+
const fn = idx.name && expressionMap.get(idx.name);
|
|
52
|
+
if (fn && typeof idx.expression !== 'function') {
|
|
53
|
+
idx.expression = fn;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
33
58
|
}
|
|
34
59
|
static useCache() {
|
|
35
60
|
return false;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { type Dictionary, EntityMetadata, type EntityName } from '../typings.js';
|
|
2
2
|
import type { EntityManager } from '../EntityManager.js';
|
|
3
3
|
export declare class MetadataStorage {
|
|
4
|
+
#private;
|
|
4
5
|
static readonly PATH_SYMBOL: unique symbol;
|
|
5
|
-
private static readonly metadata;
|
|
6
|
-
private readonly metadata;
|
|
7
|
-
private readonly idMap;
|
|
8
|
-
private readonly classNameMap;
|
|
9
|
-
private readonly uniqueNameMap;
|
|
10
6
|
constructor(metadata?: Dictionary<EntityMetadata>);
|
|
11
7
|
static getMetadata(): Dictionary<EntityMetadata>;
|
|
12
8
|
static getMetadata<T = any>(entity: string, path: string): EntityMetadata<T>;
|
|
@@ -9,40 +9,40 @@ function getGlobalStorage(namespace) {
|
|
|
9
9
|
return globalThis[key];
|
|
10
10
|
}
|
|
11
11
|
export class MetadataStorage {
|
|
12
|
-
static PATH_SYMBOL = Symbol('MetadataStorage.PATH_SYMBOL');
|
|
13
|
-
static metadata = getGlobalStorage('metadata');
|
|
14
|
-
|
|
15
|
-
idMap;
|
|
16
|
-
classNameMap;
|
|
17
|
-
uniqueNameMap;
|
|
12
|
+
static PATH_SYMBOL = Symbol.for('@mikro-orm/core/MetadataStorage.PATH_SYMBOL');
|
|
13
|
+
static #metadata = getGlobalStorage('metadata');
|
|
14
|
+
#metadataMap = new Map();
|
|
15
|
+
#idMap;
|
|
16
|
+
#classNameMap;
|
|
17
|
+
#uniqueNameMap;
|
|
18
18
|
constructor(metadata = {}) {
|
|
19
|
-
this
|
|
20
|
-
this
|
|
21
|
-
this
|
|
22
|
-
for (const meta of Object.values(this
|
|
23
|
-
this
|
|
24
|
-
this
|
|
25
|
-
this.
|
|
19
|
+
this.#idMap = {};
|
|
20
|
+
this.#uniqueNameMap = {};
|
|
21
|
+
this.#classNameMap = Utils.copy(metadata, false);
|
|
22
|
+
for (const meta of Object.values(this.#classNameMap)) {
|
|
23
|
+
this.#idMap[meta._id] = meta;
|
|
24
|
+
this.#uniqueNameMap[meta.uniqueName] = meta;
|
|
25
|
+
this.#metadataMap.set(meta.class, meta);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
static getMetadata(entity, path) {
|
|
29
29
|
const key = entity && path ? entity + '-' + Utils.hash(path) : null;
|
|
30
|
-
if (key && !MetadataStorage
|
|
31
|
-
MetadataStorage
|
|
30
|
+
if (key && !MetadataStorage.#metadata[key]) {
|
|
31
|
+
MetadataStorage.#metadata[key] = new EntityMetadata({ className: entity, path });
|
|
32
32
|
}
|
|
33
33
|
if (key) {
|
|
34
|
-
return MetadataStorage
|
|
34
|
+
return MetadataStorage.#metadata[key];
|
|
35
35
|
}
|
|
36
|
-
return MetadataStorage
|
|
36
|
+
return MetadataStorage.#metadata;
|
|
37
37
|
}
|
|
38
38
|
static isKnownEntity(name) {
|
|
39
|
-
return !!Object.values(this
|
|
39
|
+
return !!Object.values(this.#metadata).find(meta => meta.className === name);
|
|
40
40
|
}
|
|
41
41
|
static clear() {
|
|
42
|
-
Object.keys(this
|
|
42
|
+
Object.keys(this.#metadata).forEach(k => delete this.#metadata[k]);
|
|
43
43
|
}
|
|
44
44
|
getAll() {
|
|
45
|
-
return this
|
|
45
|
+
return this.#metadataMap;
|
|
46
46
|
}
|
|
47
47
|
get(entityName, init = false) {
|
|
48
48
|
const exists = this.find(entityName);
|
|
@@ -61,52 +61,50 @@ export class MetadataStorage {
|
|
|
61
61
|
if (!entityName) {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
const meta = this.
|
|
64
|
+
const meta = this.#metadataMap.get(entityName);
|
|
65
65
|
if (meta) {
|
|
66
66
|
return meta;
|
|
67
67
|
}
|
|
68
68
|
if (entityName instanceof EntitySchema) {
|
|
69
|
-
return this.
|
|
69
|
+
return this.#metadataMap.get(entityName.meta.class) ?? entityName.meta;
|
|
70
70
|
}
|
|
71
|
-
return this
|
|
71
|
+
return this.#classNameMap[Utils.className(entityName)];
|
|
72
72
|
}
|
|
73
73
|
has(entityName) {
|
|
74
|
-
return this.
|
|
74
|
+
return this.#metadataMap.has(entityName);
|
|
75
75
|
}
|
|
76
76
|
set(entityName, meta) {
|
|
77
|
-
this.
|
|
78
|
-
this
|
|
79
|
-
this
|
|
80
|
-
this
|
|
77
|
+
this.#metadataMap.set(entityName, meta);
|
|
78
|
+
this.#idMap[meta._id] = meta;
|
|
79
|
+
this.#uniqueNameMap[meta.uniqueName] = meta;
|
|
80
|
+
this.#classNameMap[Utils.className(entityName)] = meta;
|
|
81
81
|
return meta;
|
|
82
82
|
}
|
|
83
83
|
reset(entityName) {
|
|
84
84
|
const meta = this.find(entityName);
|
|
85
85
|
if (meta) {
|
|
86
|
-
this.
|
|
87
|
-
delete this
|
|
88
|
-
delete this
|
|
89
|
-
delete this
|
|
86
|
+
this.#metadataMap.delete(meta.class);
|
|
87
|
+
delete this.#idMap[meta._id];
|
|
88
|
+
delete this.#uniqueNameMap[meta.uniqueName];
|
|
89
|
+
delete this.#classNameMap[meta.className];
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
decorate(em) {
|
|
93
|
-
[...this.
|
|
94
|
-
.filter(meta => meta.prototype)
|
|
95
|
-
.forEach(meta => EntityHelper.decorate(meta, em));
|
|
93
|
+
[...this.#metadataMap.values()].filter(meta => meta.prototype).forEach(meta => EntityHelper.decorate(meta, em));
|
|
96
94
|
}
|
|
97
95
|
*[Symbol.iterator]() {
|
|
98
|
-
for (const meta of this.
|
|
96
|
+
for (const meta of this.#metadataMap.values()) {
|
|
99
97
|
yield meta;
|
|
100
98
|
}
|
|
101
99
|
}
|
|
102
100
|
getById(id) {
|
|
103
|
-
return this
|
|
101
|
+
return this.#idMap[id];
|
|
104
102
|
}
|
|
105
103
|
getByClassName(className, validate = true) {
|
|
106
|
-
return this.validate(this
|
|
104
|
+
return this.validate(this.#classNameMap[className], className, validate);
|
|
107
105
|
}
|
|
108
106
|
getByUniqueName(uniqueName, validate = true) {
|
|
109
|
-
return this.validate(this
|
|
107
|
+
return this.validate(this.#uniqueNameMap[uniqueName], uniqueName, validate);
|
|
110
108
|
}
|
|
111
109
|
validate(meta, id, validate) {
|
|
112
110
|
if (!meta && validate) {
|
|
@@ -63,7 +63,11 @@ export class MetadataValidator {
|
|
|
63
63
|
}
|
|
64
64
|
// Validate no mixing of STI and TPT in the same hierarchy
|
|
65
65
|
this.validateInheritanceStrategies(discovered);
|
|
66
|
-
const tableNames = discovered.filter(meta => !meta.abstract &&
|
|
66
|
+
const tableNames = discovered.filter(meta => !meta.abstract &&
|
|
67
|
+
!meta.embeddable &&
|
|
68
|
+
meta === meta.root &&
|
|
69
|
+
(meta.tableName || meta.collection) &&
|
|
70
|
+
meta.schema !== '*');
|
|
67
71
|
const duplicateTableNames = Utils.findDuplicates(tableNames.map(meta => {
|
|
68
72
|
const tableName = meta.tableName || meta.collection;
|
|
69
73
|
return (meta.schema ? '.' + meta.schema : '') + tableName;
|
|
@@ -88,7 +92,10 @@ export class MetadataValidator {
|
|
|
88
92
|
const pivotProps = new Map();
|
|
89
93
|
// check for not discovered entities
|
|
90
94
|
discovered.forEach(meta => Object.values(meta.properties).forEach(prop => {
|
|
91
|
-
if (prop.kind !== ReferenceKind.SCALAR &&
|
|
95
|
+
if (prop.kind !== ReferenceKind.SCALAR &&
|
|
96
|
+
!unwrap(prop.type)
|
|
97
|
+
.split(/ ?\| ?/)
|
|
98
|
+
.every(type => discovered.find(m => m.className === type))) {
|
|
92
99
|
throw MetadataError.fromUnknownEntity(prop.type, `${meta.className}.${prop.name}`);
|
|
93
100
|
}
|
|
94
101
|
if (prop.pivotEntity) {
|
|
@@ -122,7 +129,10 @@ export class MetadataValidator {
|
|
|
122
129
|
if (targetMeta.abstract && !targetMeta.root?.inheritanceType && !targetMeta.embeddable) {
|
|
123
130
|
throw MetadataError.targetIsAbstract(meta, prop);
|
|
124
131
|
}
|
|
125
|
-
if ([ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(prop.kind) &&
|
|
132
|
+
if ([ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(prop.kind) &&
|
|
133
|
+
prop.persist === false &&
|
|
134
|
+
targetMeta.compositePK &&
|
|
135
|
+
options.checkNonPersistentCompositeProps) {
|
|
126
136
|
throw MetadataError.nonPersistentCompositeProp(meta, prop);
|
|
127
137
|
}
|
|
128
138
|
this.validateTargetKey(meta, prop, targetMeta);
|
|
@@ -248,7 +258,9 @@ export class MetadataValidator {
|
|
|
248
258
|
// has correct `mappedBy` reference type
|
|
249
259
|
// For polymorphic relations, check if this entity is one of the polymorphic targets
|
|
250
260
|
const isValidPolymorphicInverse = owner.polymorphic && owner.polymorphTargets?.some(target => target.class === meta.root.class);
|
|
251
|
-
if (!isValidPolymorphicInverse &&
|
|
261
|
+
if (!isValidPolymorphicInverse &&
|
|
262
|
+
owner.type !== meta.className &&
|
|
263
|
+
owner.targetMeta?.root.class !== meta.root.class) {
|
|
252
264
|
throw MetadataError.fromWrongReference(meta, prop, 'mappedBy', owner);
|
|
253
265
|
}
|
|
254
266
|
// owning side is not defined as inverse
|
|
@@ -280,7 +292,10 @@ export class MetadataValidator {
|
|
|
280
292
|
}
|
|
281
293
|
validateDuplicateFieldNames(meta, options) {
|
|
282
294
|
const candidates = Object.values(meta.properties)
|
|
283
|
-
.filter(prop => prop.persist !== false &&
|
|
295
|
+
.filter(prop => prop.persist !== false &&
|
|
296
|
+
!prop.inherited &&
|
|
297
|
+
prop.fieldNames?.length === 1 &&
|
|
298
|
+
(prop.kind !== ReferenceKind.EMBEDDED || prop.object))
|
|
284
299
|
.map(prop => prop.fieldNames[0]);
|
|
285
300
|
const duplicates = Utils.findDuplicates(candidates);
|
|
286
301
|
if (duplicates.length > 0 && options.checkDuplicateFieldNames) {
|
|
@@ -31,7 +31,7 @@ export async function discoverEntities(paths, options) {
|
|
|
31
31
|
const found = new Map();
|
|
32
32
|
for (const filepath of files) {
|
|
33
33
|
const filename = basename(filepath);
|
|
34
|
-
if (
|
|
34
|
+
if (!/\.[cm]?[jt]s$/.exec(filename) || /\.d\.[cm]?ts/.exec(filename)) {
|
|
35
35
|
continue;
|
|
36
36
|
}
|
|
37
37
|
await getEntityClassOrSchema(filepath, found, baseDir);
|
package/metadata/index.d.ts
CHANGED
package/metadata/index.js
CHANGED
package/metadata/types.d.ts
CHANGED
|
@@ -526,7 +526,7 @@ export interface IndexColumnOptions {
|
|
|
526
526
|
}
|
|
527
527
|
interface BaseOptions<T, H extends string> {
|
|
528
528
|
name?: string;
|
|
529
|
-
properties?:
|
|
529
|
+
properties?: T extends EntityClass<infer P> ? Properties<P, H> : Properties<T, H>;
|
|
530
530
|
options?: Dictionary;
|
|
531
531
|
expression?: string | (T extends EntityClass<infer P> ? IndexCallback<P> : IndexCallback<T>);
|
|
532
532
|
/**
|
|
@@ -540,7 +540,7 @@ interface BaseOptions<T, H extends string> {
|
|
|
540
540
|
* Columns to include in the index but not as part of the key (PostgreSQL, MSSQL).
|
|
541
541
|
* These columns are stored in the leaf level of the index but not used for searching.
|
|
542
542
|
*/
|
|
543
|
-
include?:
|
|
543
|
+
include?: T extends EntityClass<infer P> ? Properties<P, H> : Properties<T, H>;
|
|
544
544
|
/** Fill factor for the index as a percentage 0-100 (PostgreSQL, MSSQL). */
|
|
545
545
|
fillFactor?: number;
|
|
546
546
|
}
|
|
@@ -34,11 +34,14 @@ export class AbstractNamingStrategy {
|
|
|
34
34
|
* @inheritDoc
|
|
35
35
|
*/
|
|
36
36
|
getEntityName(tableName, schemaName) {
|
|
37
|
-
const name =
|
|
38
|
-
return this.getClassName(name.replaceAll(/[^\u200C\u200D\p{ID_Continue}]+/
|
|
37
|
+
const name = /^[^$_\p{ID_Start}]/u.exec(tableName) ? `E_${tableName}` : tableName;
|
|
38
|
+
return this.getClassName(name.replaceAll(/[^\u200C\u200D\p{ID_Continue}]+/gu, r => r
|
|
39
|
+
.split('')
|
|
40
|
+
.map(c => `$${c.codePointAt(0)}`)
|
|
41
|
+
.join('')), '_');
|
|
39
42
|
}
|
|
40
43
|
columnNameToProperty(columnName) {
|
|
41
|
-
const propName = columnName.replace(/[_\- ]+(\w)/
|
|
44
|
+
const propName = columnName.replace(/[_\- ]+(\w)/gu, (_, p1) => p1.toUpperCase());
|
|
42
45
|
if (populatePathMembers.includes(propName.replace(/^\${2,}/u, '$$').replace(/^\$\*$/u, '*'))) {
|
|
43
46
|
return `$${propName}`;
|
|
44
47
|
}
|
|
@@ -11,7 +11,7 @@ export class EntityCaseNamingStrategy extends AbstractNamingStrategy {
|
|
|
11
11
|
}
|
|
12
12
|
joinKeyColumnName(entityName, referencedColumnName, composite, tableName) {
|
|
13
13
|
entityName = this.classToTableName(entityName, tableName);
|
|
14
|
-
const name = entityName.
|
|
14
|
+
const name = entityName.substring(0, 1).toLowerCase() + entityName.substring(1);
|
|
15
15
|
if (composite && referencedColumnName) {
|
|
16
16
|
return name + '_' + referencedColumnName;
|
|
17
17
|
}
|
package/naming-strategy/index.js
CHANGED
package/not-supported.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export function discoverEntities() {
|
|
2
2
|
throw new Error('Folder-based discovery is not supported in this environment.');
|
|
3
3
|
}
|
|
4
|
-
export const fs = new Proxy({}, {
|
|
4
|
+
export const fs = new Proxy({}, {
|
|
5
|
+
get: () => {
|
|
6
|
+
throw new Error('File system is not supported in this environment.');
|
|
7
|
+
},
|
|
8
|
+
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"
|
|
4
|
-
"version": "7.0.0-rc.2",
|
|
3
|
+
"version": "7.0.0",
|
|
5
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"data-mapper",
|
|
7
|
+
"ddd",
|
|
8
|
+
"entity",
|
|
9
|
+
"identity-map",
|
|
10
|
+
"javascript",
|
|
11
|
+
"js",
|
|
12
|
+
"mariadb",
|
|
13
|
+
"mikro-orm",
|
|
14
|
+
"mongo",
|
|
15
|
+
"mongodb",
|
|
16
|
+
"mysql",
|
|
17
|
+
"orm",
|
|
18
|
+
"postgresql",
|
|
19
|
+
"sqlite",
|
|
20
|
+
"sqlite3",
|
|
21
|
+
"ts",
|
|
22
|
+
"typescript",
|
|
23
|
+
"unit-of-work"
|
|
24
|
+
],
|
|
25
|
+
"homepage": "https://mikro-orm.io",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/mikro-orm/mikro-orm/issues"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"author": "Martin Adámek",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
|
|
34
|
+
},
|
|
35
|
+
"funding": "https://github.com/sponsors/b4nan",
|
|
36
|
+
"type": "module",
|
|
6
37
|
"exports": {
|
|
7
38
|
"./package.json": "./package.json",
|
|
8
39
|
".": "./index.js",
|
|
@@ -18,39 +49,8 @@
|
|
|
18
49
|
"./schema": "./utils/AbstractSchemaGenerator.js",
|
|
19
50
|
"./dataloader": "./utils/DataloaderUtils.js"
|
|
20
51
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
|
|
24
|
-
},
|
|
25
|
-
"funding": "https://github.com/sponsors/b4nan",
|
|
26
|
-
"keywords": [
|
|
27
|
-
"orm",
|
|
28
|
-
"mongo",
|
|
29
|
-
"mongodb",
|
|
30
|
-
"mysql",
|
|
31
|
-
"mariadb",
|
|
32
|
-
"postgresql",
|
|
33
|
-
"sqlite",
|
|
34
|
-
"sqlite3",
|
|
35
|
-
"ts",
|
|
36
|
-
"typescript",
|
|
37
|
-
"js",
|
|
38
|
-
"javascript",
|
|
39
|
-
"entity",
|
|
40
|
-
"ddd",
|
|
41
|
-
"mikro-orm",
|
|
42
|
-
"unit-of-work",
|
|
43
|
-
"data-mapper",
|
|
44
|
-
"identity-map"
|
|
45
|
-
],
|
|
46
|
-
"author": "Martin Adámek",
|
|
47
|
-
"license": "MIT",
|
|
48
|
-
"bugs": {
|
|
49
|
-
"url": "https://github.com/mikro-orm/mikro-orm/issues"
|
|
50
|
-
},
|
|
51
|
-
"homepage": "https://mikro-orm.io",
|
|
52
|
-
"engines": {
|
|
53
|
-
"node": ">= 22.17.0"
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "yarn compile && yarn copy",
|
|
@@ -58,9 +58,6 @@
|
|
|
58
58
|
"compile": "yarn run -T tsc -p tsconfig.build.json",
|
|
59
59
|
"copy": "node ../../scripts/copy.mjs"
|
|
60
60
|
},
|
|
61
|
-
"publishConfig": {
|
|
62
|
-
"access": "public"
|
|
63
|
-
},
|
|
64
61
|
"peerDependencies": {
|
|
65
62
|
"dataloader": "2.2.3"
|
|
66
63
|
},
|
|
@@ -68,5 +65,8 @@
|
|
|
68
65
|
"dataloader": {
|
|
69
66
|
"optional": true
|
|
70
67
|
}
|
|
68
|
+
},
|
|
69
|
+
"engines": {
|
|
70
|
+
"node": ">= 22.17.0"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/platforms/Platform.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityRepository } from '../entity/EntityRepository.js';
|
|
2
2
|
import { type NamingStrategy } from '../naming-strategy/NamingStrategy.js';
|
|
3
|
-
import type { Constructor, EntityMetadata, EntityProperty, IPrimaryKey, ISchemaGenerator, PopulateOptions, Primary, SimpleColumnMeta } from '../typings.js';
|
|
3
|
+
import type { Constructor, EntityMetadata, EntityProperty, IPrimaryKey, ISchemaGenerator, PopulateOptions, Primary, SimpleColumnMeta, FilterQuery, EntityValue, EntityKey } from '../typings.js';
|
|
4
4
|
import { ExceptionConverter } from './ExceptionConverter.js';
|
|
5
5
|
import type { EntityManager } from '../EntityManager.js';
|
|
6
6
|
import type { Configuration } from '../utils/Configuration.js';
|
|
@@ -61,6 +61,13 @@ export declare abstract class Platform {
|
|
|
61
61
|
getDateTypeDeclarationSQL(length?: number): string;
|
|
62
62
|
getTimeTypeDeclarationSQL(length?: number): string;
|
|
63
63
|
getRegExpOperator(val?: unknown, flags?: string): string;
|
|
64
|
+
mapRegExpCondition(mappedKey: string, value: {
|
|
65
|
+
$re: string;
|
|
66
|
+
$flags?: string;
|
|
67
|
+
}): {
|
|
68
|
+
sql: string;
|
|
69
|
+
params: unknown[];
|
|
70
|
+
};
|
|
64
71
|
getRegExpValue(val: RegExp): {
|
|
65
72
|
$re: string;
|
|
66
73
|
$flags?: string;
|
|
@@ -139,7 +146,13 @@ export declare abstract class Platform {
|
|
|
139
146
|
getMappedType(type: string): Type<unknown>;
|
|
140
147
|
getDefaultMappedType(type: string): Type<unknown>;
|
|
141
148
|
supportsMultipleCascadePaths(): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Returns true if the platform supports ON UPDATE foreign key rules.
|
|
151
|
+
* Oracle doesn't support ON UPDATE rules.
|
|
152
|
+
*/
|
|
153
|
+
supportsOnUpdate(): boolean;
|
|
142
154
|
supportsMultipleStatements(): boolean;
|
|
155
|
+
supportsUnionWhere(): boolean;
|
|
143
156
|
getArrayDeclarationSQL(): string;
|
|
144
157
|
marshallArray(values: string[]): string;
|
|
145
158
|
unmarshallArray(value: string): string[];
|
|
@@ -147,6 +160,8 @@ export declare abstract class Platform {
|
|
|
147
160
|
getJsonDeclarationSQL(): string;
|
|
148
161
|
getSearchJsonPropertySQL(path: string, type: string, aliased: boolean): string | Raw;
|
|
149
162
|
getSearchJsonPropertyKey(path: string[], type: string, aliased: boolean, value?: unknown): string | Raw;
|
|
163
|
+
processJsonCondition<T extends object>(o: FilterQuery<T>, value: EntityValue<T>, path: EntityKey<T>[], alias: boolean): FilterQuery<T>;
|
|
164
|
+
protected getJsonValueType(value: unknown): string;
|
|
150
165
|
getJsonIndexDefinition(index: {
|
|
151
166
|
columnNames: string[];
|
|
152
167
|
}): string[];
|
|
@@ -159,6 +174,14 @@ export declare abstract class Platform {
|
|
|
159
174
|
convertDateToJSValue(value: string | Date): string;
|
|
160
175
|
convertIntervalToJSValue(value: string): unknown;
|
|
161
176
|
convertIntervalToDatabaseValue(value: unknown): unknown;
|
|
177
|
+
usesAsKeyword(): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Determines how UUID values are compared in the change set tracking.
|
|
180
|
+
* Return `'string'` for inline string comparison (fast), or `'any'` for deep comparison via type methods.
|
|
181
|
+
*/
|
|
182
|
+
compareUuids(): string;
|
|
183
|
+
convertUuidToJSValue(value: unknown): unknown;
|
|
184
|
+
convertUuidToDatabaseValue(value: unknown): unknown;
|
|
162
185
|
parseDate(value: string | number): Date;
|
|
163
186
|
getRepositoryClass<T extends object>(): Constructor<EntityRepository<T>>;
|
|
164
187
|
getDefaultCharset(): string;
|