@mikro-orm/core 7.0.0-dev.234 → 7.0.0-dev.236
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/package.json +1 -1
- package/unit-of-work/ChangeSetComputer.d.ts +3 -6
- package/unit-of-work/ChangeSetComputer.js +7 -7
- package/unit-of-work/ChangeSetPersister.d.ts +7 -10
- package/unit-of-work/ChangeSetPersister.js +10 -10
- package/unit-of-work/UnitOfWork.js +2 -2
- package/utils/Utils.js +1 -1
- package/utils/fs-utils.js +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0.0-dev.
|
|
4
|
+
"version": "7.0.0-dev.236",
|
|
5
5
|
"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.",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./package.json": "./package.json",
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { type Configuration } from '../utils/Configuration.js';
|
|
2
|
-
import type { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
3
1
|
import type { AnyEntity } from '../typings.js';
|
|
4
2
|
import { ChangeSet } from './ChangeSet.js';
|
|
5
3
|
import { type Collection } from '../entity/Collection.js';
|
|
6
|
-
import type { Platform } from '../platforms/Platform.js';
|
|
7
4
|
import type { EntityManager } from '../EntityManager.js';
|
|
8
5
|
export declare class ChangeSetComputer {
|
|
6
|
+
private readonly em;
|
|
9
7
|
private readonly collectionUpdates;
|
|
8
|
+
private readonly comparator;
|
|
10
9
|
private readonly metadata;
|
|
11
10
|
private readonly platform;
|
|
12
11
|
private readonly config;
|
|
13
|
-
|
|
14
|
-
private readonly comparator;
|
|
15
|
-
constructor(collectionUpdates: Set<Collection<AnyEntity>>, metadata: MetadataStorage, platform: Platform, config: Configuration, em: EntityManager);
|
|
12
|
+
constructor(em: EntityManager, collectionUpdates: Set<Collection<AnyEntity>>);
|
|
16
13
|
computeChangeSet<T extends object>(entity: T): ChangeSet<T> | null;
|
|
17
14
|
/**
|
|
18
15
|
* Traverses entity graph and executes `onCreate` and `onUpdate` methods, assigning the values to given properties.
|
|
@@ -7,18 +7,18 @@ import { Reference } from '../entity/Reference.js';
|
|
|
7
7
|
import { PolymorphicRef } from '../entity/PolymorphicRef.js';
|
|
8
8
|
import { ReferenceKind } from '../enums.js';
|
|
9
9
|
export class ChangeSetComputer {
|
|
10
|
+
em;
|
|
10
11
|
collectionUpdates;
|
|
12
|
+
comparator;
|
|
11
13
|
metadata;
|
|
12
14
|
platform;
|
|
13
15
|
config;
|
|
14
|
-
em
|
|
15
|
-
comparator;
|
|
16
|
-
constructor(collectionUpdates, metadata, platform, config, em) {
|
|
17
|
-
this.collectionUpdates = collectionUpdates;
|
|
18
|
-
this.metadata = metadata;
|
|
19
|
-
this.platform = platform;
|
|
20
|
-
this.config = config;
|
|
16
|
+
constructor(em, collectionUpdates) {
|
|
21
17
|
this.em = em;
|
|
18
|
+
this.collectionUpdates = collectionUpdates;
|
|
19
|
+
this.config = this.em.config;
|
|
20
|
+
this.metadata = this.em.getMetadata();
|
|
21
|
+
this.platform = this.em.getPlatform();
|
|
22
22
|
this.comparator = this.config.getComparator(this.metadata);
|
|
23
23
|
}
|
|
24
24
|
computeChangeSet(entity) {
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Dictionary, EntityDictionary, EntityMetadata, IHydrator } from '../typings.js';
|
|
3
|
-
import { type EntityFactory } from '../entity/EntityFactory.js';
|
|
1
|
+
import type { Dictionary, EntityDictionary, EntityMetadata } from '../typings.js';
|
|
4
2
|
import { type ChangeSet } from './ChangeSet.js';
|
|
5
|
-
import {
|
|
6
|
-
import type { DriverMethodOptions, IDatabaseDriver } from '../drivers/IDatabaseDriver.js';
|
|
3
|
+
import type { DriverMethodOptions } from '../drivers/IDatabaseDriver.js';
|
|
7
4
|
import type { EntityManager } from '../EntityManager.js';
|
|
8
5
|
export declare class ChangeSetPersister {
|
|
6
|
+
private readonly em;
|
|
7
|
+
private readonly platform;
|
|
8
|
+
private readonly comparator;
|
|
9
|
+
private readonly usesReturningStatement;
|
|
9
10
|
private readonly driver;
|
|
10
11
|
private readonly metadata;
|
|
11
12
|
private readonly hydrator;
|
|
12
13
|
private readonly factory;
|
|
13
14
|
private readonly config;
|
|
14
|
-
|
|
15
|
-
private readonly platform;
|
|
16
|
-
private readonly comparator;
|
|
17
|
-
private readonly usesReturningStatement;
|
|
18
|
-
constructor(driver: IDatabaseDriver, metadata: MetadataStorage, hydrator: IHydrator, factory: EntityFactory, config: Configuration, em: EntityManager);
|
|
15
|
+
constructor(em: EntityManager);
|
|
19
16
|
executeInserts<T extends object>(changeSets: ChangeSet<T>[], options?: DriverMethodOptions, withSchema?: boolean): Promise<void>;
|
|
20
17
|
executeUpdates<T extends object>(changeSets: ChangeSet<T>[], batched: boolean, options?: DriverMethodOptions, withSchema?: boolean): Promise<void>;
|
|
21
18
|
executeDeletes<T extends object>(changeSets: ChangeSet<T>[], options?: DriverMethodOptions, withSchema?: boolean): Promise<void>;
|
|
@@ -7,23 +7,23 @@ import { Utils } from '../utils/Utils.js';
|
|
|
7
7
|
import { OptimisticLockError, ValidationError } from '../errors.js';
|
|
8
8
|
import { ReferenceKind } from '../enums.js';
|
|
9
9
|
export class ChangeSetPersister {
|
|
10
|
+
em;
|
|
11
|
+
platform;
|
|
12
|
+
comparator;
|
|
13
|
+
usesReturningStatement;
|
|
10
14
|
driver;
|
|
11
15
|
metadata;
|
|
12
16
|
hydrator;
|
|
13
17
|
factory;
|
|
14
18
|
config;
|
|
15
|
-
em
|
|
16
|
-
platform;
|
|
17
|
-
comparator;
|
|
18
|
-
usesReturningStatement;
|
|
19
|
-
constructor(driver, metadata, hydrator, factory, config, em) {
|
|
20
|
-
this.driver = driver;
|
|
21
|
-
this.metadata = metadata;
|
|
22
|
-
this.hydrator = hydrator;
|
|
23
|
-
this.factory = factory;
|
|
24
|
-
this.config = config;
|
|
19
|
+
constructor(em) {
|
|
25
20
|
this.em = em;
|
|
21
|
+
this.driver = this.em.getDriver();
|
|
22
|
+
this.config = this.em.config;
|
|
23
|
+
this.metadata = this.em.getMetadata();
|
|
24
|
+
this.factory = this.em.getEntityFactory();
|
|
26
25
|
this.platform = this.driver.getPlatform();
|
|
26
|
+
this.hydrator = this.config.getHydrator(this.metadata);
|
|
27
27
|
this.comparator = this.config.getComparator(this.metadata);
|
|
28
28
|
this.usesReturningStatement = this.platform.usesReturningStatement() || this.platform.usesOutputStatement();
|
|
29
29
|
}
|
|
@@ -42,8 +42,8 @@ export class UnitOfWork {
|
|
|
42
42
|
this.identityMap = new IdentityMap(this.platform.getDefaultSchemaName());
|
|
43
43
|
this.eventManager = this.em.getEventManager();
|
|
44
44
|
this.comparator = this.em.getComparator();
|
|
45
|
-
this.changeSetComputer = new ChangeSetComputer(this.
|
|
46
|
-
this.changeSetPersister = new ChangeSetPersister(this.em
|
|
45
|
+
this.changeSetComputer = new ChangeSetComputer(this.em, this.collectionUpdates);
|
|
46
|
+
this.changeSetPersister = new ChangeSetPersister(this.em);
|
|
47
47
|
}
|
|
48
48
|
merge(entity, visited) {
|
|
49
49
|
const wrapped = helper(entity);
|
package/utils/Utils.js
CHANGED
|
@@ -123,7 +123,7 @@ export function parseJsonSafe(value) {
|
|
|
123
123
|
}
|
|
124
124
|
export class Utils {
|
|
125
125
|
static PK_SEPARATOR = '~~~';
|
|
126
|
-
static #ORM_VERSION = '7.0.0-dev.
|
|
126
|
+
static #ORM_VERSION = '7.0.0-dev.236';
|
|
127
127
|
/**
|
|
128
128
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
129
129
|
*/
|
package/utils/fs-utils.js
CHANGED
|
@@ -77,8 +77,8 @@ export const fs = {
|
|
|
77
77
|
getPackageConfig(basePath = process.cwd()) {
|
|
78
78
|
if (this.pathExists(`${basePath}/package.json`)) {
|
|
79
79
|
try {
|
|
80
|
-
const path = import.meta.resolve(`${basePath}/package.json`);
|
|
81
|
-
return this.readJSONSync(
|
|
80
|
+
const path = this.normalizePath(import.meta.resolve(`${basePath}/package.json`));
|
|
81
|
+
return this.readJSONSync(path);
|
|
82
82
|
}
|
|
83
83
|
catch (e) {
|
|
84
84
|
/* v8 ignore next */
|