UNPKG

@mikro-orm/core

Version:

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.

36 lines (35 loc) 1.36 kB
import type { EntityData, EntityMetadata, EntityDictionary, Primary } from '../typings.js'; /** Represents a pending change (create, update, or delete) for a single entity. */ export declare class ChangeSet<T extends object> { entity: T; type: ChangeSetType; payload: EntityDictionary<T>; meta: EntityMetadata<T>; private primaryKey?; private serializedPrimaryKey?; constructor(entity: T, type: ChangeSetType, payload: EntityDictionary<T>, meta: EntityMetadata<T>); /** Returns the primary key of the entity, optionally as an object for composite keys. */ getPrimaryKey(object?: boolean): Primary<T> | null; /** Returns the serialized (string) form of the primary key. */ getSerializedPrimaryKey(): string | null; } export interface ChangeSet<T> { meta: EntityMetadata<T>; rootMeta: EntityMetadata<T>; schema?: string; type: ChangeSetType; entity: T; payload: EntityDictionary<T>; persisted: boolean; originalEntity?: EntityData<T>; /** For TPT: changesets for parent tables, ordered from immediate parent to root */ tptChangeSets?: ChangeSet<T>[]; } /** Enumeration of change set operation types. */ export declare enum ChangeSetType { CREATE = "create", UPDATE = "update", DELETE = "delete", UPDATE_EARLY = "update_early", DELETE_EARLY = "delete_early" }