UNPKG

2.75 kBTypeScriptView Raw
1import { Type } from '@nestjs/common';
2import { Observable } from 'rxjs';
3import { DataSource, DataSourceOptions } from 'typeorm';
4import { EntityClassOrSchema } from '../interfaces/entity-class-or-schema.type';
5/**
6 * This function generates an injection token for an Entity or Repository
7 * @param {EntityClassOrSchema} entity parameter can either be an Entity or Repository
8 * @param {string} [dataSource='default'] DataSource name
9 * @returns {string} The Entity | Repository injection token
10 */
11export declare function getRepositoryToken(entity: EntityClassOrSchema, dataSource?: DataSource | DataSourceOptions | string): Function | string;
12/**
13 * This function generates an injection token for an Entity or Repository
14 * @param {Function} This parameter can either be an Entity or Repository
15 * @returns {string} The Repository injection token
16 */
17export declare function getCustomRepositoryToken(repository: Function): string;
18/**
19 * This function returns a DataSource injection token for the given DataSource, DataSourceOptions or dataSource name.
20 * @param {DataSource | DataSourceOptions | string} [dataSource='default'] This optional parameter is either
21 * a DataSource, or a DataSourceOptions or a string.
22 * @returns {string | Function} The DataSource injection token.
23 */
24export declare function getDataSourceToken(dataSource?: DataSource | DataSourceOptions | string): string | Function | Type<DataSource>;
25/** @deprecated */
26export declare const getConnectionToken: typeof getDataSourceToken;
27/**
28 * This function returns a DataSource prefix based on the dataSource name
29 * @param {DataSource | DataSourceOptions | string} [dataSource='default'] This optional parameter is either
30 * a DataSource, or a DataSourceOptions or a string.
31 * @returns {string | Function} The DataSource injection token.
32 */
33export declare function getDataSourcePrefix(dataSource?: DataSource | DataSourceOptions | string): string;
34/**
35 * This function returns an EntityManager injection token for the given DataSource, DataSourceOptions or dataSource name.
36 * @param {DataSource | DataSourceOptions | string} [dataSource='default'] This optional parameter is either
37 * a DataSource, or a DataSourceOptions or a string.
38 * @returns {string | Function} The EntityManager injection token.
39 */
40export declare function getEntityManagerToken(dataSource?: DataSource | DataSourceOptions | string): string | Function;
41export declare function handleRetry(retryAttempts?: number, retryDelay?: number, dataSourceName?: string, verboseRetryLog?: boolean, toRetry?: (err: any) => boolean): <T>(source: Observable<T>) => Observable<T>;
42export declare function getDataSourceName(options: DataSourceOptions): string;
43export declare const generateString: () => string;