UNPKG

@liqd-js/mongodb-model

Version:
26 lines (25 loc) 1.16 kB
import { MongoClient, MongoClientOptions, WithTransactionCallback } from 'mongodb'; import { flowStart, flowGet, flowSet, GET_PARENT, REGISTER_MODEL, flowExecute } from './helpers'; import { AbstractPropertyModel } from "./property-model"; import { AbstractModel } from "./model"; export * from 'mongodb'; export * from './types/external'; export * from './helpers/external'; export * from './model'; export * from './property-model'; type ModelInstance = AbstractModel<any, any, any> | AbstractPropertyModel<any, any, any, any>; export declare class AbstractModels { protected client: MongoClient; private models; readonly scope: Readonly<{ start: typeof flowStart; assign: (scope: object) => void; set: typeof flowSet; get: typeof flowGet; execute: typeof flowExecute; }>; protected constructor(connectionString: string, options?: MongoClientOptions); [REGISTER_MODEL](instance: ModelInstance, collection: string, path?: string): void; [GET_PARENT](collection: string, path: string): ModelInstance | undefined; transaction<T = void>(transaction: WithTransactionCallback<T>): Promise<T>; }