UNPKG

lakutata

Version:

An IoC-based universal application framework.

157 lines (153 loc) 5.32 kB
import { MetadataArgsStorage } from './TypeDef.internal.32.js'; import { DataSourceOptions, DataSource } from './TypeDef.internal.33.js'; import { ConnectionManager } from './TypeDef.internal.34.js'; import { EntityManager, MongoEntityManager, SqljsEntityManager } from './TypeDef.internal.35.js'; import { ObjectLiteral, EntityTarget, ObjectType } from './TypeDef.internal.36.js'; import { Repository, TreeRepository, MongoRepository } from './TypeDef.internal.37.js'; import { SelectQueryBuilder } from './TypeDef.internal.38.js'; import './TypeDef.internal.30.js'; /** * Gets metadata args storage. */ declare function getMetadataArgsStorage(): MetadataArgsStorage; /** * Reads connection options stored in ormconfig configuration file. * * @deprecated */ declare function getConnectionOptions(connectionName?: string): Promise<DataSourceOptions>; /** * Gets a ConnectionManager which creates connections. * * @deprecated */ declare function getConnectionManager(): ConnectionManager; /** * Creates a new connection and registers it in the manager. * Only one connection from ormconfig will be created (name "default" or connection without name). * * @deprecated */ declare function createConnection(): Promise<DataSource>; /** * Creates a new connection from the ormconfig file with a given name. * * @deprecated */ declare function createConnection(name: string): Promise<DataSource>; /** * Creates a new connection and registers it in the manager. * * @deprecated */ declare function createConnection(options: DataSourceOptions): Promise<DataSource>; /** * Creates new connections and registers them in the manager. * * If connection options were not specified, then it will try to create connection automatically, * based on content of ormconfig (json/js/env) file or environment variables. * All connections from the ormconfig will be created. * * @deprecated */ declare function createConnections(options?: DataSourceOptions[]): Promise<DataSource[]>; /** * Gets connection from the connection manager. * If connection name wasn't specified, then "default" connection will be retrieved. * * @deprecated */ declare function getConnection(connectionName?: string): DataSource; /** * Gets entity manager from the connection. * If connection name wasn't specified, then "default" connection will be retrieved. * * @deprecated */ declare function getManager(connectionName?: string): EntityManager; /** * Gets MongoDB entity manager from the connection. * If connection name wasn't specified, then "default" connection will be retrieved. * * @deprecated */ declare function getMongoManager(connectionName?: string): MongoEntityManager; /** * Gets Sqljs entity manager from connection name. * "default" connection is used, when no name is specified. * Only works when Sqljs driver is used. * * @deprecated */ declare function getSqljsManager(connectionName?: string): SqljsEntityManager; /** * Gets repository for the given entity class. * * @deprecated */ declare function getRepository<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, connectionName?: string): Repository<Entity>; /** * Gets tree repository for the given entity class. * * @deprecated */ declare function getTreeRepository<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, connectionName?: string): TreeRepository<Entity>; /** * Gets tree repository for the given entity class. * * @deprecated */ declare function getCustomRepository<T>(customRepository: ObjectType<T>, connectionName?: string): T; /** * Gets mongodb repository for the given entity class or name. * * @deprecated */ declare function getMongoRepository<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, connectionName?: string): MongoRepository<Entity>; /** * Creates a new query builder. * * @deprecated */ declare function createQueryBuilder<Entity extends ObjectLiteral>(entityClass?: EntityTarget<Entity>, alias?: string, connectionName?: string): SelectQueryBuilder<Entity>; /** * Container options. * * @deprecated */ interface UseContainerOptions { /** * If set to true, then default container will be used in the case if given container haven't returned anything. */ fallback?: boolean; /** * If set to true, then default container will be used in the case if given container thrown an exception. */ fallbackOnErrors?: boolean; } /** * @deprecated */ type ContainedType<T> = { new (...args: any[]): T; } | Function; /** * @deprecated */ interface ContainerInterface { get<T>(someClass: ContainedType<T>): T; } /** * Sets container to be used by this library. * * @deprecated */ declare function useContainer(iocContainer: ContainerInterface, options?: UseContainerOptions): void; /** * Gets the IOC container used by this library. * * @deprecated */ declare function getFromContainer<T>(someClass: ContainedType<T>): T; export { createConnection, createConnections, createQueryBuilder, getConnection, getConnectionManager, getConnectionOptions, getCustomRepository, getFromContainer, getManager, getMetadataArgsStorage, getMongoManager, getMongoRepository, getRepository, getSqljsManager, getTreeRepository, useContainer }; export type { ContainedType, ContainerInterface, UseContainerOptions };