@mikro-orm/core
Advanced tools
+1
-1
| { | ||
| "name": "@mikro-orm/core", | ||
| "version": "7.1.13-dev.8", | ||
| "version": "7.1.13-dev.9", | ||
| "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": [ |
@@ -1,2 +0,2 @@ | ||
| import type { EntityData, EntityMetadata, FilterQuery } from '../typings.js'; | ||
| import type { EntityData, EntityKey, EntityMetadata, FilterQuery } from '../typings.js'; | ||
| import type { UpsertOptions } from '../drivers/IDatabaseDriver.js'; | ||
@@ -6,2 +6,10 @@ import { type Raw } from '../utils/RawQueryFragment.js'; | ||
| export declare function getOnConflictFields<T>(meta: EntityMetadata<T> | undefined, data: EntityData<T>, uniqueFields: (keyof T)[] | Raw, options: UpsertOptions<T>): (keyof T)[]; | ||
| /** | ||
| * Detects properties that will get their value generated by an `onCreate` hook during the upsert, | ||
| * i.e. those with an `onCreate` hook and no value provided. Such values are meant for the insert | ||
| * clause only and must not overwrite an existing row via the `on conflict do update set` clause. | ||
| * The property filter mirrors `EntityFactory.assignDefaultValues`. | ||
| * @internal | ||
| */ | ||
| export declare function getOnCreateGeneratedFields<T extends object>(meta: EntityMetadata<T>, data: T | EntityData<T>): EntityKey<T>[]; | ||
| /** @internal */ | ||
@@ -8,0 +16,0 @@ export declare function getOnConflictReturningFields<T, P extends string>(meta: EntityMetadata<T> | undefined, data: EntityData<T>, uniqueFields: (keyof T)[] | Raw, options: UpsertOptions<T, P>): (keyof T)[] | '*'; |
@@ -75,2 +75,18 @@ import { isRaw } from '../utils/RawQueryFragment.js'; | ||
| } | ||
| /** | ||
| * Detects properties that will get their value generated by an `onCreate` hook during the upsert, | ||
| * i.e. those with an `onCreate` hook and no value provided. Such values are meant for the insert | ||
| * clause only and must not overwrite an existing row via the `on conflict do update set` clause. | ||
| * The property filter mirrors `EntityFactory.assignDefaultValues`. | ||
| * @internal | ||
| */ | ||
| export function getOnCreateGeneratedFields(meta, data) { | ||
| return meta.props | ||
| .filter(prop => prop.onCreate && | ||
| !prop.embedded && | ||
| ![ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(prop.kind) && | ||
| !(prop.getter && !prop.setter) && | ||
| data[prop.name] == null) | ||
| .map(prop => prop.name); | ||
| } | ||
| /** @internal */ | ||
@@ -77,0 +93,0 @@ export function getOnConflictReturningFields(meta, data, uniqueFields, options) { |
+1
-1
@@ -156,3 +156,3 @@ import { clone } from './clone.js'; | ||
| static PK_SEPARATOR = '~~~'; | ||
| static #ORM_VERSION = '7.1.13-dev.8'; | ||
| static #ORM_VERSION = '7.1.13-dev.9'; | ||
| /** | ||
@@ -159,0 +159,0 @@ * Checks if the argument is instance of `Object`. Returns false for arrays. |
Sorry, the diff of this file is too big to display
1588978
0.15%33868
0.11%