@mikro-orm/core 7.0.10-dev.14 → 7.0.10-dev.16
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 +1 -0
- package/EntityManager.js +3 -2
- package/entity/Collection.js +3 -1
- package/entity/Reference.js +4 -2
- package/package.json +1 -1
- package/utils/Utils.js +1 -1
package/EntityManager.d.ts
CHANGED
|
@@ -324,6 +324,7 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
|
|
|
324
324
|
*/
|
|
325
325
|
map<Entity extends object>(entityName: EntityName<Entity>, result: EntityDictionary<Entity>, options?: {
|
|
326
326
|
schema?: string;
|
|
327
|
+
mapped?: boolean;
|
|
327
328
|
}): Entity;
|
|
328
329
|
/**
|
|
329
330
|
* Merges given entity to this EntityManager so it becomes managed. You can force refreshing of existing entities
|
package/EntityManager.js
CHANGED
|
@@ -1295,8 +1295,9 @@ export class EntityManager {
|
|
|
1295
1295
|
* Maps raw database result to an entity and merges it to this EntityManager.
|
|
1296
1296
|
*/
|
|
1297
1297
|
map(entityName, result, options = {}) {
|
|
1298
|
+
const { mapped, ...rest } = options;
|
|
1298
1299
|
const meta = this.metadata.get(entityName);
|
|
1299
|
-
const data = this.driver.mapResult(result, meta);
|
|
1300
|
+
const data = (mapped ? result : this.driver.mapResult(result, meta));
|
|
1300
1301
|
for (const k of Object.keys(data)) {
|
|
1301
1302
|
const prop = meta.properties[k];
|
|
1302
1303
|
if (prop?.kind === ReferenceKind.SCALAR &&
|
|
@@ -1310,7 +1311,7 @@ export class EntityManager {
|
|
|
1310
1311
|
convertCustomTypes: true,
|
|
1311
1312
|
refresh: true,
|
|
1312
1313
|
validate: false,
|
|
1313
|
-
...
|
|
1314
|
+
...rest,
|
|
1314
1315
|
});
|
|
1315
1316
|
}
|
|
1316
1317
|
/**
|
package/entity/Collection.js
CHANGED
|
@@ -5,7 +5,9 @@ import { Reference } from './Reference.js';
|
|
|
5
5
|
import { helper, wrap } from './wrap.js';
|
|
6
6
|
import { QueryHelper } from '../utils/QueryHelper.js';
|
|
7
7
|
import { inspect } from '../logging/inspect.js';
|
|
8
|
-
|
|
8
|
+
// Globally registered so the marker survives the CJS/ESM dual-package hazard
|
|
9
|
+
// (see entitySymbol rationale in EntityHelper.ts and #7515/#7534).
|
|
10
|
+
const collectionSymbol = Symbol.for('@mikro-orm/core/Collection');
|
|
9
11
|
/** Represents a to-many relation (1:m or m:n) as an iterable, managed collection of entities. */
|
|
10
12
|
export class Collection {
|
|
11
13
|
owner;
|
package/entity/Reference.js
CHANGED
|
@@ -4,8 +4,10 @@ import { Utils } from '../utils/Utils.js';
|
|
|
4
4
|
import { QueryHelper } from '../utils/QueryHelper.js';
|
|
5
5
|
import { NotFoundError } from '../errors.js';
|
|
6
6
|
import { inspect } from '../logging/inspect.js';
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
// Globally registered so the markers survive the CJS/ESM dual-package hazard
|
|
8
|
+
// (see entitySymbol rationale in EntityHelper.ts and #7515/#7534).
|
|
9
|
+
const referenceSymbol = Symbol.for('@mikro-orm/core/Reference');
|
|
10
|
+
const scalarReferenceSymbol = Symbol.for('@mikro-orm/core/ScalarReference');
|
|
9
11
|
/** Wrapper around an entity that provides lazy loading capabilities and identity-preserving reference semantics. */
|
|
10
12
|
export class Reference {
|
|
11
13
|
entity;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.0.10-dev.
|
|
3
|
+
"version": "7.0.10-dev.16",
|
|
4
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
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
package/utils/Utils.js
CHANGED
|
@@ -141,7 +141,7 @@ export function parseJsonSafe(value) {
|
|
|
141
141
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
142
142
|
export class Utils {
|
|
143
143
|
static PK_SEPARATOR = '~~~';
|
|
144
|
-
static #ORM_VERSION = '7.0.10-dev.
|
|
144
|
+
static #ORM_VERSION = '7.0.10-dev.16';
|
|
145
145
|
/**
|
|
146
146
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
147
147
|
*/
|