@mikro-orm/core
Advanced tools
+1
-1
| { | ||
| "name": "@mikro-orm/core", | ||
| "version": "7.1.4-dev.0", | ||
| "version": "7.1.4-dev.1", | ||
| "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,0 +5,0 @@ "keywords": [ |
@@ -396,3 +396,21 @@ import { clone } from './clone.js'; | ||
| } | ||
| lines.push(` for (let k in result) { if (Object.hasOwn(result, k) && !mapped[k] && ret[k] === undefined) ret[k] = result[k]; }`); | ||
| // pass through any unmapped columns (e.g. extra selections or virtual props). for embeddables we restrict | ||
| // this to declared keys, otherwise JSON keys not part of the schema leak into the original data while | ||
| // hydration drops them from the entity, diverging the snapshot and triggering spurious updates. | ||
| let knownKeysGuard = ''; | ||
| if (meta.embeddable) { | ||
| const knownKeys = new Set(); | ||
| for (const m of meta.polymorphs?.length ? meta.polymorphs : [meta]) { | ||
| for (const prop of m.props) { | ||
| knownKeys.add(prop.name); | ||
| if (prop.embedded) { | ||
| knownKeys.add(prop.embedded[1]); | ||
| } | ||
| prop.fieldNames?.forEach(field => knownKeys.add(field)); | ||
| } | ||
| } | ||
| context.set('knownKeys', knownKeys); | ||
| knownKeysGuard = ' && knownKeys.has(k)'; | ||
| } | ||
| lines.push(` for (let k in result) { if (Object.hasOwn(result, k) && !mapped[k] && ret[k] === undefined${knownKeysGuard}) ret[k] = result[k]; }`); | ||
| const code = `// compiled mapper for entity ${meta.className}\n` + | ||
@@ -399,0 +417,0 @@ `return function(result) {\n const ret = {};\n${lines.join('\n')}\n return ret;\n}`; |
+1
-1
@@ -144,3 +144,3 @@ import { clone } from './clone.js'; | ||
| static PK_SEPARATOR = '~~~'; | ||
| static #ORM_VERSION = '7.1.4-dev.0'; | ||
| static #ORM_VERSION = '7.1.4-dev.1'; | ||
| /** | ||
@@ -147,0 +147,0 @@ * Checks if the argument is instance of `Object`. Returns false for arrays. |
Sorry, the diff of this file is too big to display
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
1561050
0.07%33446
0.06%