nestjs-http-promise/lib/interfaces/http-module.interface.ts

26 lines
878 B
TypeScript
Raw Normal View History

import type {
InjectionToken,
ModuleMetadata,
OptionalFactoryDependency,
Provider,
Type,
} from '@nestjs/common';
import type { AxiosRequestConfig } from 'axios';
import type { IAxiosRetryConfig } from 'axios-retry';
2023-07-05 22:37:57 +00:00
export type HttpModuleOptions = AxiosRequestConfig &
IAxiosRetryConfig & { isBetterStackTraceEnabled?: boolean };
export interface HttpModuleOptionsFactory {
2023-07-05 22:37:57 +00:00
createHttpOptions(): Promise<HttpModuleOptions> | HttpModuleOptions;
}
2023-07-05 22:37:57 +00:00
export interface HttpModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
useExisting?: Type<HttpModuleOptionsFactory>;
useClass?: Type<HttpModuleOptionsFactory>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2023-07-05 22:37:57 +00:00
useFactory?: (...args: any[]) => Promise<HttpModuleOptions> | HttpModuleOptions;
inject?: (InjectionToken | OptionalFactoryDependency)[];
2023-07-05 22:37:57 +00:00
extraProviders?: Provider[];
}