import { EntityManager, FindOptionsOrder, FindOptionsRelations, FindOptionsWhere } from 'typeorm'; import { EntityTarget } from 'typeorm/common/EntityTarget'; import { ChangeTracker } from './hot'; export interface EntityClass { new (): T; } export interface Entity { id: string; } /** * Defines a special criteria to find specific entity. */ export interface FindOneOptions { /** * Adds a comment with the supplied string in the generated query. This is * helpful for debugging purposes, such as finding a specific query in the * database server's logs, or for categorization using an APM product. */ comment?: string; /** * Simple condition that should be applied to match entities. */ where?: FindOptionsWhere[] | FindOptionsWhere; /** * Indicates what relations of entity should be loaded (simplified left join form). */ relations?: FindOptionsRelations; /** * Order, in which entities should be ordered. */ order?: FindOptionsOrder; } export interface FindManyOptions extends FindOneOptions { /** * Offset (paginated) where from entities should be taken. */ skip?: number; /** * Limit (paginated) - max number of entities should be taken. */ take?: number; } /** * Restricted version of TypeORM entity manager for squid data handlers. */ export declare class Store { private em; private changes?; constructor(em: () => EntityManager, changes?: ChangeTracker | undefined); /** * Alias for {@link Store.upsert} */ save(entity: E): Promise; save(entities: E[]): Promise; /** * Upserts a given entity or entities into the database. * * It always executes a primitive operation without cascades, relations, etc. */ upsert(entity: E): Promise; upsert(entities: E[]): Promise; private saveMany; private getFkSignature; private upsertMany; /** * Inserts a given entity or entities into the database. * Does not check if the entity(s) exist in the database and will fail if a duplicate is inserted. * * Executes a primitive INSERT operation without cascades, relations, etc. */ insert(entity: E): Promise; insert(entities: E[]): Promise; /** * Deletes a given entity or entities from the database. * * Unlike {@link EntityManager.remove} executes a primitive DELETE query without cascades, relations, etc. */ remove(entity: E): Promise; remove(entities: E[]): Promise; remove(entityClass: EntityClass, id: string | string[]): Promise; count(entityClass: EntityClass, options?: FindManyOptions): Promise; countBy(entityClass: EntityClass, where: FindOptionsWhere | FindOptionsWhere[]): Promise; find(entityClass: EntityClass, options?: FindManyOptions): Promise; findBy(entityClass: EntityClass, where: FindOptionsWhere | FindOptionsWhere[]): Promise; findOne(entityClass: EntityClass, options: FindOneOptions): Promise; findOneBy(entityClass: EntityClass, where: FindOptionsWhere | FindOptionsWhere[]): Promise; findOneOrFail(entityClass: EntityTarget, options: FindOneOptions): Promise; findOneByOrFail(entityClass: EntityTarget, where: FindOptionsWhere | FindOptionsWhere[]): Promise; get(entityClass: EntityClass, optionsOrId: FindOneOptions | string): Promise; } //# sourceMappingURL=store.d.ts.map