mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
refactor: reduce implicit types
This commit is contained in:
@@ -23,7 +23,7 @@ export class CacheInterceptor implements NestInterceptor {
|
|||||||
@Inject(HTTP_SERVER_REF)
|
@Inject(HTTP_SERVER_REF)
|
||||||
protected readonly httpServer: HttpServer,
|
protected readonly httpServer: HttpServer,
|
||||||
@Inject(CACHE_MANAGER) protected readonly cacheManager: any,
|
@Inject(CACHE_MANAGER) protected readonly cacheManager: any,
|
||||||
@Inject(REFLECTOR) protected readonly reflector,
|
@Inject(REFLECTOR) protected readonly reflector: any,
|
||||||
) {
|
) {
|
||||||
this.isHttpApp = httpServer && !!httpServer.getRequestMethod;
|
this.isHttpApp = httpServer && !!httpServer.getRequestMethod;
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,9 @@ export class CacheInterceptor implements NestInterceptor {
|
|||||||
if (value) {
|
if (value) {
|
||||||
return of(value);
|
return of(value);
|
||||||
}
|
}
|
||||||
return call$.pipe(tap(response => this.cacheManager.set(key, response)));
|
return call$.pipe(
|
||||||
|
tap((response: any) => this.cacheManager.set(key, response)),
|
||||||
|
);
|
||||||
} catch {
|
} catch {
|
||||||
return call$;
|
return call$;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,12 @@
|
|||||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
|
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
|
||||||
* @param {} ...decorators
|
* @param {} ...decorators
|
||||||
*/
|
*/
|
||||||
export function Bind(...decorators: any[]) {
|
export function Bind(...decorators: any[]): MethodDecorator {
|
||||||
return (target: object, key, descriptor) => {
|
return <T>(
|
||||||
|
target: object,
|
||||||
|
key: string | symbol,
|
||||||
|
descriptor: TypedPropertyDescriptor<T>,
|
||||||
|
) => {
|
||||||
decorators.forEach((fn, index) => fn(target, key, index));
|
decorators.forEach((fn, index) => fn(target, key, index));
|
||||||
return descriptor;
|
return descriptor;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export function FileFieldsInterceptor(
|
|||||||
this.upload.fields(uploadFields)(
|
this.upload.fields(uploadFields)(
|
||||||
ctx.getRequest(),
|
ctx.getRequest(),
|
||||||
ctx.getResponse(),
|
ctx.getResponse(),
|
||||||
err => {
|
(err: any) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
const error = transformException(err);
|
const error = transformException(err);
|
||||||
return reject(error);
|
return reject(error);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export function FileInterceptor(
|
|||||||
this.upload.single(fieldName)(
|
this.upload.single(fieldName)(
|
||||||
ctx.getRequest(),
|
ctx.getRequest(),
|
||||||
ctx.getResponse(),
|
ctx.getResponse(),
|
||||||
err => {
|
(err: any) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
const error = transformException(err);
|
const error = transformException(err);
|
||||||
return reject(error);
|
return reject(error);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export function FilesInterceptor(
|
|||||||
this.upload.array(fieldName, maxCount)(
|
this.upload.array(fieldName, maxCount)(
|
||||||
ctx.getRequest(),
|
ctx.getRequest(),
|
||||||
ctx.getResponse(),
|
ctx.getResponse(),
|
||||||
err => {
|
(err: any) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
const error = transformException(err);
|
const error = transformException(err);
|
||||||
return reject(error);
|
return reject(error);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export type Transform<T = any> = (value: T, metadata: ArgumentMetadata) => any;
|
|||||||
|
|
||||||
export interface ArgumentMetadata {
|
export interface ArgumentMetadata {
|
||||||
readonly type: Paramtype;
|
readonly type: Paramtype;
|
||||||
readonly metatype?: new (...args) => any | undefined;
|
readonly metatype?: new (...args: any[]) => any | undefined;
|
||||||
readonly data?: string | undefined;
|
readonly data?: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export interface INestApplication extends INestApplicationContext {
|
|||||||
*
|
*
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
use(...args): this;
|
use(...args: any[]): this;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables CORS (Cross-Origin Resource Sharing)
|
* Enables CORS (Cross-Origin Resource Sharing)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { Observable } from 'rxjs';
|
|||||||
|
|
||||||
export interface WebSocketAdapter<T = any> {
|
export interface WebSocketAdapter<T = any> {
|
||||||
create(port: number, options?: T);
|
create(port: number, options?: T);
|
||||||
bindClientConnect(server: any, callback: (...args) => void);
|
bindClientConnect(server: any, callback: (...args: any[]) => void);
|
||||||
bindClientDisconnect?(client: any, callback: (...args) => void);
|
bindClientDisconnect?(client: any, callback: (...args: any[]) => void);
|
||||||
bindMessageHandlers(
|
bindMessageHandlers(
|
||||||
client: any,
|
client: any,
|
||||||
handlers: Array<{
|
handlers: Array<{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
export const isUndefined = (obj): obj is undefined =>
|
export const isUndefined = (obj: any): obj is undefined =>
|
||||||
typeof obj === 'undefined';
|
typeof obj === 'undefined';
|
||||||
export const isFunction = (fn): boolean => typeof fn === 'function';
|
export const isFunction = (fn: any): boolean => typeof fn === 'function';
|
||||||
export const isObject = (fn): fn is object => typeof fn === 'object';
|
export const isObject = (fn: any): fn is object => typeof fn === 'object';
|
||||||
export const isString = (fn): fn is string => typeof fn === 'string';
|
export const isString = (fn: any): fn is string => typeof fn === 'string';
|
||||||
export const isConstructor = (fn): boolean => fn === 'constructor';
|
export const isConstructor = (fn: any): boolean => fn === 'constructor';
|
||||||
export const validatePath = (path): string =>
|
export const validatePath = (path: string): string =>
|
||||||
path.charAt(0) !== '/' ? '/' + path : path;
|
path.charAt(0) !== '/' ? '/' + path : path;
|
||||||
export const isNil = (obj): boolean => isUndefined(obj) || obj === null;
|
export const isNil = (obj: any): boolean => isUndefined(obj) || obj === null;
|
||||||
export const isEmpty = (array): boolean => !(array && array.length > 0);
|
export const isEmpty = (array: any): boolean => !(array && array.length > 0);
|
||||||
export const isSymbol = (fn): boolean => typeof fn === 'symbol';
|
export const isSymbol = (fn: any): boolean => typeof fn === 'symbol';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { isEmpty } from '@nestjs/common/utils/shared.utils';
|
|
||||||
import { Controller } from '@nestjs/common/interfaces';
|
|
||||||
import { CanActivate } from '@nestjs/common';
|
import { CanActivate } from '@nestjs/common';
|
||||||
|
import { Controller } from '@nestjs/common/interfaces';
|
||||||
|
import { isEmpty } from '@nestjs/common/utils/shared.utils';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { ExecutionContextHost } from '../helpers/execution-context.host';
|
import { ExecutionContextHost } from '../helpers/execution-context.host';
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ export class GuardsConsumer {
|
|||||||
guards: CanActivate[],
|
guards: CanActivate[],
|
||||||
args: any[],
|
args: any[],
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
if (!guards || isEmpty(guards)) {
|
if (!guards || isEmpty(guards)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -28,7 +28,7 @@ export class GuardsConsumer {
|
|||||||
public createContext(
|
public createContext(
|
||||||
args: any[],
|
args: any[],
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
): ExecutionContextHost {
|
): ExecutionContextHost {
|
||||||
return new ExecutionContextHost(
|
return new ExecutionContextHost(
|
||||||
args,
|
args,
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ import { CanActivate } from '@nestjs/common';
|
|||||||
import { GUARDS_METADATA } from '@nestjs/common/constants';
|
import { GUARDS_METADATA } from '@nestjs/common/constants';
|
||||||
import { Controller } from '@nestjs/common/interfaces';
|
import { Controller } from '@nestjs/common/interfaces';
|
||||||
import { ConfigurationProvider } from '@nestjs/common/interfaces/configuration-provider.interface';
|
import { ConfigurationProvider } from '@nestjs/common/interfaces/configuration-provider.interface';
|
||||||
import { isEmpty, isFunction, isUndefined } from '@nestjs/common/utils/shared.utils';
|
import {
|
||||||
|
isEmpty,
|
||||||
|
isFunction,
|
||||||
|
isUndefined,
|
||||||
|
} from '@nestjs/common/utils/shared.utils';
|
||||||
import iterate from 'iterare';
|
import iterate from 'iterare';
|
||||||
import { ContextCreator } from '../helpers/context-creator';
|
import { ContextCreator } from '../helpers/context-creator';
|
||||||
import { NestContainer } from '../injector/container';
|
import { NestContainer } from '../injector/container';
|
||||||
@@ -19,7 +23,7 @@ export class GuardsContextCreator extends ContextCreator {
|
|||||||
|
|
||||||
public create(
|
public create(
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
module: string,
|
module: string,
|
||||||
): CanActivate[] {
|
): CanActivate[] {
|
||||||
this.moduleContext = module;
|
this.moduleContext = module;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export abstract class ContextCreator {
|
|||||||
|
|
||||||
public createContext<T extends any[], R extends any[]>(
|
public createContext<T extends any[], R extends any[]>(
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
metadataKey: string,
|
metadataKey: string,
|
||||||
): R {
|
): R {
|
||||||
const globalMetadata =
|
const globalMetadata =
|
||||||
@@ -28,7 +28,7 @@ export abstract class ContextCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public reflectMethodMetadata<T>(
|
public reflectMethodMetadata<T>(
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
metadataKey: string,
|
metadataKey: string,
|
||||||
): T {
|
): T {
|
||||||
return Reflect.getMetadata(metadataKey, callback);
|
return Reflect.getMetadata(metadataKey, callback);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export class ExternalContextCreator {
|
|||||||
|
|
||||||
public create<T extends ParamsMetadata = ParamsMetadata>(
|
public create<T extends ParamsMetadata = ParamsMetadata>(
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
methodName: string,
|
methodName: string,
|
||||||
metadataKey?: string,
|
metadataKey?: string,
|
||||||
paramsFactory?: ParamsFactory,
|
paramsFactory?: ParamsFactory,
|
||||||
@@ -95,7 +95,7 @@ export class ExternalContextCreator {
|
|||||||
return callback.apply(instance, args);
|
return callback.apply(instance, args);
|
||||||
};
|
};
|
||||||
|
|
||||||
return async (...args) => {
|
return async (...args: any[]) => {
|
||||||
const initialArgs = this.contextUtils.createNullArray(argsLength);
|
const initialArgs = this.contextUtils.createNullArray(argsLength);
|
||||||
const canActivate = await this.guardsConsumer.tryActivate(
|
const canActivate = await this.guardsConsumer.tryActivate(
|
||||||
guards,
|
guards,
|
||||||
@@ -165,9 +165,12 @@ export class ExternalContextCreator {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCustomFactory(factory: (...args) => void, data): (...args) => any {
|
public getCustomFactory(
|
||||||
|
factory: (...args: any[]) => void,
|
||||||
|
data,
|
||||||
|
): (...args: any[]) => any {
|
||||||
return !isUndefined(factory) && isFunction(factory)
|
return !isUndefined(factory) && isFunction(factory)
|
||||||
? (...args) => factory(data, args)
|
? (...args: any[]) => factory(data, args)
|
||||||
: () => null;
|
: () => null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export interface CustomProvider {
|
|||||||
export type OpaqueToken = string | symbol | object | Type<any>;
|
export type OpaqueToken = string | symbol | object | Type<any>;
|
||||||
export type CustomClass = CustomProvider & { useClass: Type<any> };
|
export type CustomClass = CustomProvider & { useClass: Type<any> };
|
||||||
export type CustomFactory = CustomProvider & {
|
export type CustomFactory = CustomProvider & {
|
||||||
useFactory: (...args) => any;
|
useFactory: (...args: any[]) => any;
|
||||||
inject?: OpaqueToken[];
|
inject?: OpaqueToken[];
|
||||||
};
|
};
|
||||||
export type CustomValue = CustomProvider & { useValue: any };
|
export type CustomValue = CustomProvider & { useValue: any };
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export class InterceptorsConsumer {
|
|||||||
interceptors: NestInterceptor[],
|
interceptors: NestInterceptor[],
|
||||||
args: any[],
|
args: any[],
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
next: () => Promise<any>,
|
next: () => Promise<any>,
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
if (isEmpty(interceptors)) {
|
if (isEmpty(interceptors)) {
|
||||||
@@ -27,7 +27,8 @@ export class InterceptorsConsumer {
|
|||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
const result$ = await interceptors.reduce(
|
const result$ = await interceptors.reduce(
|
||||||
async (stream$, interceptor) => interceptor.intercept(context, await stream$),
|
async (stream$, interceptor) =>
|
||||||
|
interceptor.intercept(context, await stream$),
|
||||||
Promise.resolve(start$),
|
Promise.resolve(start$),
|
||||||
);
|
);
|
||||||
return result$.toPromise();
|
return result$.toPromise();
|
||||||
@@ -36,7 +37,7 @@ export class InterceptorsConsumer {
|
|||||||
public createContext(
|
public createContext(
|
||||||
args: any[],
|
args: any[],
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
): ExecutionContextHost {
|
): ExecutionContextHost {
|
||||||
return new ExecutionContextHost(
|
return new ExecutionContextHost(
|
||||||
args,
|
args,
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import { INTERCEPTORS_METADATA } from '@nestjs/common/constants';
|
import { INTERCEPTORS_METADATA } from '@nestjs/common/constants';
|
||||||
import { Controller, NestInterceptor } from '@nestjs/common/interfaces';
|
import { Controller, NestInterceptor } from '@nestjs/common/interfaces';
|
||||||
import { ConfigurationProvider } from '@nestjs/common/interfaces/configuration-provider.interface';
|
import { ConfigurationProvider } from '@nestjs/common/interfaces/configuration-provider.interface';
|
||||||
import { isEmpty, isFunction, isUndefined } from '@nestjs/common/utils/shared.utils';
|
import {
|
||||||
|
isEmpty,
|
||||||
|
isFunction,
|
||||||
|
isUndefined,
|
||||||
|
} from '@nestjs/common/utils/shared.utils';
|
||||||
import iterate from 'iterare';
|
import iterate from 'iterare';
|
||||||
import { ContextCreator } from '../helpers/context-creator';
|
import { ContextCreator } from '../helpers/context-creator';
|
||||||
import { NestContainer } from '../injector/container';
|
import { NestContainer } from '../injector/container';
|
||||||
@@ -18,7 +22,7 @@ export class InterceptorsContextCreator extends ContextCreator {
|
|||||||
|
|
||||||
public create(
|
public create(
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
module: string,
|
module: string,
|
||||||
): NestInterceptor[] {
|
): NestInterceptor[] {
|
||||||
this.moduleContext = module;
|
this.moduleContext = module;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const mapToClass = middleware => {
|
|||||||
}
|
}
|
||||||
return assignToken(
|
return assignToken(
|
||||||
class {
|
class {
|
||||||
resolve = (...args) => (...params) => middleware(...params);
|
resolve = (...args: any[]) => (...params) => middleware(...params);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export class NestFactoryStatic {
|
|||||||
if (!(prop in receiver)) return;
|
if (!(prop in receiver)) return;
|
||||||
|
|
||||||
if (isFunction(receiver[prop])) {
|
if (isFunction(receiver[prop])) {
|
||||||
return (...args) => {
|
return (...args: any[]) => {
|
||||||
let result;
|
let result;
|
||||||
ExceptionsZone.run(() => {
|
ExceptionsZone.run(() => {
|
||||||
result = receiver[prop](...args);
|
result = receiver[prop](...args);
|
||||||
|
|||||||
@@ -1,24 +1,23 @@
|
|||||||
import { Transform } from '@nestjs/common/interfaces';
|
import { RouteParamtypes } from '@nestjs/common/enums/route-paramtypes.enum';
|
||||||
|
import { ArgumentMetadata, Transform } from '@nestjs/common/interfaces';
|
||||||
import { ParamsTokenFactory } from './params-token-factory';
|
import { ParamsTokenFactory } from './params-token-factory';
|
||||||
|
|
||||||
export class PipesConsumer {
|
export class PipesConsumer {
|
||||||
private readonly paramsTokenFactory = new ParamsTokenFactory();
|
private readonly paramsTokenFactory = new ParamsTokenFactory();
|
||||||
|
|
||||||
public async apply(
|
public async apply<TInput = any>(
|
||||||
value,
|
value: TInput,
|
||||||
{ metatype, type, data },
|
{ metatype, type, data }: ArgumentMetadata,
|
||||||
transforms: Transform<any>[],
|
transforms: Transform<any>[],
|
||||||
) {
|
) {
|
||||||
const token = this.paramsTokenFactory.exchangeEnumForString(type);
|
const token = this.paramsTokenFactory.exchangeEnumForString(
|
||||||
return this.applyPipes(
|
(type as any) as RouteParamtypes,
|
||||||
value,
|
|
||||||
{ metatype, type: token, data },
|
|
||||||
transforms,
|
|
||||||
);
|
);
|
||||||
|
return this.applyPipes(value, { metatype, type: token, data }, transforms);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async applyPipes(
|
public async applyPipes<TInput = any>(
|
||||||
value,
|
value: TInput,
|
||||||
{ metatype, type, data }: { metatype; type?; data? },
|
{ metatype, type, data }: { metatype; type?; data? },
|
||||||
transforms: Transform<any>[],
|
transforms: Transform<any>[],
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
import { PIPES_METADATA } from '@nestjs/common/constants';
|
import { PIPES_METADATA } from '@nestjs/common/constants';
|
||||||
import { Controller, PipeTransform, Transform } from '@nestjs/common/interfaces';
|
import {
|
||||||
import { isEmpty, isFunction, isUndefined } from '@nestjs/common/utils/shared.utils';
|
Controller,
|
||||||
|
PipeTransform,
|
||||||
|
Transform,
|
||||||
|
} from '@nestjs/common/interfaces';
|
||||||
|
import {
|
||||||
|
isEmpty,
|
||||||
|
isFunction,
|
||||||
|
isUndefined,
|
||||||
|
} from '@nestjs/common/utils/shared.utils';
|
||||||
import iterate from 'iterare';
|
import iterate from 'iterare';
|
||||||
import { ApplicationConfig } from '../application-config';
|
import { ApplicationConfig } from '../application-config';
|
||||||
import { ContextCreator } from '../helpers/context-creator';
|
import { ContextCreator } from '../helpers/context-creator';
|
||||||
@@ -18,7 +26,7 @@ export class PipesContextCreator extends ContextCreator {
|
|||||||
|
|
||||||
public create(
|
public create(
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
module: string,
|
module: string,
|
||||||
): Transform<any>[] {
|
): Transform<any>[] {
|
||||||
this.moduleContext = module;
|
this.moduleContext = module;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export class RouterExecutionContext {
|
|||||||
|
|
||||||
public create(
|
public create(
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
methodName: string,
|
methodName: string,
|
||||||
module: string,
|
module: string,
|
||||||
requestMethod: RequestMethod,
|
requestMethod: RequestMethod,
|
||||||
@@ -127,7 +127,7 @@ export class RouterExecutionContext {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public reflectHttpStatusCode(callback: (...args) => any): number {
|
public reflectHttpStatusCode(callback: (...args: any[]) => any): number {
|
||||||
return Reflect.getMetadata(HTTP_CODE_METADATA, callback);
|
return Reflect.getMetadata(HTTP_CODE_METADATA, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +168,10 @@ export class RouterExecutionContext {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCustomFactory(factory: (...args) => void, data): (...args) => any {
|
public getCustomFactory(
|
||||||
|
factory: (...args: any[]) => void,
|
||||||
|
data,
|
||||||
|
): (...args: any[]) => any {
|
||||||
return !isUndefined(factory) && isFunction(factory)
|
return !isUndefined(factory) && isFunction(factory)
|
||||||
? (req, res, next) => factory(data, req)
|
? (req, res, next) => factory(data, req)
|
||||||
: () => null;
|
: () => null;
|
||||||
@@ -197,7 +200,7 @@ export class RouterExecutionContext {
|
|||||||
public createGuardsFn(
|
public createGuardsFn(
|
||||||
guards: any[],
|
guards: any[],
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
): Function | null {
|
): Function | null {
|
||||||
const canActivateFn = async (args: any[]) => {
|
const canActivateFn = async (args: any[]) => {
|
||||||
const canActivate = await this.guardsConsumer.tryActivate(
|
const canActivate = await this.guardsConsumer.tryActivate(
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
export class Reflector {
|
export class Reflector {
|
||||||
public get<T>(metadataKey, target): T {
|
public get<TResult = any, TKey = any, TInput = any>(
|
||||||
return Reflect.getMetadata(metadataKey, target) as T;
|
metadataKey: TKey,
|
||||||
|
target: TInput,
|
||||||
|
): TResult {
|
||||||
|
return Reflect.getMetadata(metadataKey, target) as TResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import * as sinon from 'sinon';
|
|
||||||
import { expect } from 'chai';
|
|
||||||
import { ExceptionsHandler } from '../../exceptions/exceptions-handler';
|
|
||||||
import { Logger } from '../../../common/services/logger.service';
|
|
||||||
import { NestEnvironment } from '../../../common/enums/nest-environment.enum';
|
|
||||||
import { InvalidExceptionFilterException } from '../../errors/exceptions/invalid-exception-filter.exception';
|
|
||||||
import { HttpException } from '@nestjs/common';
|
import { HttpException } from '@nestjs/common';
|
||||||
|
import { expect } from 'chai';
|
||||||
|
import * as sinon from 'sinon';
|
||||||
|
import { NestEnvironment } from '../../../common/enums/nest-environment.enum';
|
||||||
|
import { Logger } from '../../../common/services/logger.service';
|
||||||
import { ExpressAdapter } from '../../adapters/express-adapter';
|
import { ExpressAdapter } from '../../adapters/express-adapter';
|
||||||
|
import { InvalidExceptionFilterException } from '../../errors/exceptions/invalid-exception-filter.exception';
|
||||||
|
import { ExceptionsHandler } from '../../exceptions/exceptions-handler';
|
||||||
import { ExecutionContextHost } from '../../helpers/execution-context.host';
|
import { ExecutionContextHost } from '../../helpers/execution-context.host';
|
||||||
|
|
||||||
describe('ExceptionsHandler', () => {
|
describe('ExceptionsHandler', () => {
|
||||||
@@ -116,7 +116,7 @@ describe('ExceptionsHandler', () => {
|
|||||||
const exception = new TestException();
|
const exception = new TestException();
|
||||||
const res = { foo: 'bar' };
|
const res = { foo: 'bar' };
|
||||||
|
|
||||||
handler.invokeCustomFilters(exception, res);
|
handler.invokeCustomFilters(exception, res as any);
|
||||||
expect(funcSpy.calledWith(exception, res)).to.be.true;
|
expect(funcSpy.calledWith(exception, res)).to.be.true;
|
||||||
});
|
});
|
||||||
it('should returns true', () => {
|
it('should returns true', () => {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc {
|
|||||||
public createServiceMethod(
|
public createServiceMethod(
|
||||||
client: any,
|
client: any,
|
||||||
methodName: string,
|
methodName: string,
|
||||||
): (...args) => Observable<any> {
|
): (...args: any[]) => Observable<any> {
|
||||||
return client[methodName].responseStream
|
return client[methodName].responseStream
|
||||||
? this.createStreamServiceMethod(client, methodName)
|
? this.createStreamServiceMethod(client, methodName)
|
||||||
: this.createUnaryServiceMethod(client, methodName);
|
: this.createUnaryServiceMethod(client, methodName);
|
||||||
@@ -66,8 +66,8 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc {
|
|||||||
public createStreamServiceMethod(
|
public createStreamServiceMethod(
|
||||||
client: any,
|
client: any,
|
||||||
methodName: string,
|
methodName: string,
|
||||||
): (...args) => Observable<any> {
|
): (...args: any[]) => Observable<any> {
|
||||||
return (...args) => {
|
return (...args: any[]) => {
|
||||||
return new Observable(observer => {
|
return new Observable(observer => {
|
||||||
let isClientCanceled = false;
|
let isClientCanceled = false;
|
||||||
const call = client[methodName](...args);
|
const call = client[methodName](...args);
|
||||||
@@ -100,8 +100,8 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc {
|
|||||||
public createUnaryServiceMethod(
|
public createUnaryServiceMethod(
|
||||||
client: any,
|
client: any,
|
||||||
methodName: string,
|
methodName: string,
|
||||||
): (...args) => Observable<any> {
|
): (...args: any[]) => Observable<any> {
|
||||||
return (...args) => {
|
return (...args: any[]) => {
|
||||||
return new Observable(observer => {
|
return new Observable(observer => {
|
||||||
client[methodName](...args, (error: any, data: any) => {
|
client[methodName](...args, (error: any, data: any) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export class ClientMqtt extends ClientProxy {
|
|||||||
source$: Observable<T>,
|
source$: Observable<T>,
|
||||||
): Observable<T> {
|
): Observable<T> {
|
||||||
const close$ = fromEvent(instance, CLOSE_EVENT).pipe(
|
const close$ = fromEvent(instance, CLOSE_EVENT).pipe(
|
||||||
map(err => {
|
map((err: any) => {
|
||||||
throw err;
|
throw err;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -81,7 +81,7 @@ export class ClientMqtt extends ClientProxy {
|
|||||||
public handleError(client: MqttClient) {
|
public handleError(client: MqttClient) {
|
||||||
client.addListener(
|
client.addListener(
|
||||||
ERROR_EVENT,
|
ERROR_EVENT,
|
||||||
err => err.code !== ECONNREFUSED && this.logger.error(err),
|
(err: any) => err.code !== ECONNREFUSED && this.logger.error(err),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ export class ClientMqtt extends ClientProxy {
|
|||||||
const pattern = this.normalizePattern(partialPacket.pattern);
|
const pattern = this.normalizePattern(partialPacket.pattern);
|
||||||
const responseChannel = this.getResPatternName(pattern);
|
const responseChannel = this.getResPatternName(pattern);
|
||||||
|
|
||||||
this.mqttClient.subscribe(responseChannel, err => {
|
this.mqttClient.subscribe(responseChannel, (err: any) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export class ClientNats extends ClientProxy {
|
|||||||
public handleError(client: Client) {
|
public handleError(client: Client) {
|
||||||
client.addListener(
|
client.addListener(
|
||||||
ERROR_EVENT,
|
ERROR_EVENT,
|
||||||
err => err.code !== CONN_ERR && this.logger.error(err),
|
(err: any) => err.code !== CONN_ERR && this.logger.error(err),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export abstract class ClientProxy {
|
|||||||
connectEvent = CONNECT_EVENT,
|
connectEvent = CONNECT_EVENT,
|
||||||
): Observable<any> {
|
): Observable<any> {
|
||||||
const error$ = fromEvent(instance, errorEvent).pipe(
|
const error$ = fromEvent(instance, errorEvent).pipe(
|
||||||
map(err => {
|
map((err: any) => {
|
||||||
throw err;
|
throw err;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ export class ClientRedis extends ClientProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public handleError(client: RedisClient) {
|
public handleError(client: RedisClient) {
|
||||||
client.addListener(ERROR_EVENT, err => this.logger.error(err));
|
client.addListener(ERROR_EVENT, (err: any) => this.logger.error(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
public getClientOptions(error$: Subject<Error>): Partial<ClientOpts> {
|
public getClientOptions(error$: Subject<Error>): Partial<ClientOpts> {
|
||||||
@@ -148,7 +148,7 @@ export class ClientRedis extends ClientProxy {
|
|||||||
const responseChannel = this.getResPatternName(pattern);
|
const responseChannel = this.getResPatternName(pattern);
|
||||||
|
|
||||||
this.routingMap.set(packet.id, callback);
|
this.routingMap.set(packet.id, callback);
|
||||||
this.subClient.subscribe(responseChannel, err => {
|
this.subClient.subscribe(responseChannel, (err: any) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ export class ClientRMQ extends ClientProxy {
|
|||||||
this.channel.addSetup(channel =>
|
this.channel.addSetup(channel =>
|
||||||
channel.consume(
|
channel.consume(
|
||||||
this.replyQueue,
|
this.replyQueue,
|
||||||
msg => this.responseEmitter.emit(msg.properties.correlationId, msg),
|
(msg: any) =>
|
||||||
|
this.responseEmitter.emit(msg.properties.correlationId, msg),
|
||||||
{ noAck: true },
|
{ noAck: true },
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -101,7 +102,7 @@ export class ClientRMQ extends ClientProxy {
|
|||||||
source$: Observable<T>,
|
source$: Observable<T>,
|
||||||
): Observable<T> {
|
): Observable<T> {
|
||||||
const close$ = fromEvent(instance, DISCONNECT_EVENT).pipe(
|
const close$ = fromEvent(instance, DISCONNECT_EVENT).pipe(
|
||||||
map(err => {
|
map((err: any) => {
|
||||||
throw err;
|
throw err;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -166,6 +167,6 @@ export class ClientRMQ extends ClientProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public handleError(client: any): void {
|
public handleError(client: any): void {
|
||||||
client.addListener(ERROR_EVENT, err => this.logger.error(err));
|
client.addListener(ERROR_EVENT, (err: any) => this.logger.error(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export class ClientTCP extends ClientProxy {
|
|||||||
public bindEvents(socket: JsonSocket) {
|
public bindEvents(socket: JsonSocket) {
|
||||||
socket.on(
|
socket.on(
|
||||||
ERROR_EVENT,
|
ERROR_EVENT,
|
||||||
err => err.code !== ECONNREFUSED && this.handleError(err),
|
(err: any) => err.code !== ECONNREFUSED && this.handleError(err),
|
||||||
);
|
);
|
||||||
socket.on(CLOSE_EVENT, () => this.handleClose());
|
socket.on(CLOSE_EVENT, () => this.handleClose());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export class ExceptionFiltersContext extends BaseExceptionFilterContext {
|
|||||||
|
|
||||||
public create(
|
public create(
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (data) => Observable<any>,
|
callback: <T = any>(data: T) => Observable<any>,
|
||||||
module: string,
|
module: string,
|
||||||
): RpcExceptionsHandler {
|
): RpcExceptionsHandler {
|
||||||
this.moduleContext = module;
|
this.moduleContext = module;
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ export class RpcContextCreator {
|
|||||||
|
|
||||||
public create(
|
public create(
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (data) => Observable<any>,
|
callback: (data: any) => Observable<any>,
|
||||||
module,
|
module: string,
|
||||||
): (...args) => Promise<Observable<any>> {
|
): (...args: any[]) => Promise<Observable<any>> {
|
||||||
const exceptionHandler = this.exceptionFiltersContext.create(
|
const exceptionHandler = this.exceptionFiltersContext.create(
|
||||||
instance,
|
instance,
|
||||||
callback,
|
callback,
|
||||||
@@ -53,7 +53,7 @@ export class RpcContextCreator {
|
|||||||
return callback.call(instance, result, ...params);
|
return callback.call(instance, result, ...params);
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.rpcProxy.create(async (...args) => {
|
return this.rpcProxy.create(async (...args: any[]) => {
|
||||||
fnCanActivate && (await fnCanActivate(args));
|
fnCanActivate && (await fnCanActivate(args));
|
||||||
|
|
||||||
return this.interceptorsConsumer.intercept(
|
return this.interceptorsConsumer.intercept(
|
||||||
@@ -68,12 +68,15 @@ export class RpcContextCreator {
|
|||||||
|
|
||||||
public reflectCallbackParamtypes(
|
public reflectCallbackParamtypes(
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
): any[] {
|
): any[] {
|
||||||
return Reflect.getMetadata(PARAMTYPES_METADATA, instance, callback.name);
|
return Reflect.getMetadata(PARAMTYPES_METADATA, instance, callback.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getDataMetatype(instance, callback) {
|
public getDataMetatype(
|
||||||
|
instance: Controller,
|
||||||
|
callback: (...args: any[]) => any,
|
||||||
|
) {
|
||||||
const paramtypes = this.reflectCallbackParamtypes(instance, callback);
|
const paramtypes = this.reflectCallbackParamtypes(instance, callback);
|
||||||
return paramtypes && paramtypes.length ? paramtypes[0] : null;
|
return paramtypes && paramtypes.length ? paramtypes[0] : null;
|
||||||
}
|
}
|
||||||
@@ -81,7 +84,7 @@ export class RpcContextCreator {
|
|||||||
public createGuardsFn(
|
public createGuardsFn(
|
||||||
guards: any[],
|
guards: any[],
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
): Function | null {
|
): Function | null {
|
||||||
const canActivateFn = async (args: any[]) => {
|
const canActivateFn = async (args: any[]) => {
|
||||||
const canActivate = await this.guardsConsumer.tryActivate(
|
const canActivate = await this.guardsConsumer.tryActivate(
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import { RpcExceptionsHandler } from '../exceptions/rpc-exceptions-handler';
|
|||||||
|
|
||||||
export class RpcProxy {
|
export class RpcProxy {
|
||||||
public create(
|
public create(
|
||||||
targetCallback: (...args) => Promise<Observable<any>>,
|
targetCallback: (...args: any[]) => Promise<Observable<any>>,
|
||||||
exceptionsHandler: RpcExceptionsHandler,
|
exceptionsHandler: RpcExceptionsHandler,
|
||||||
): (...args) => Promise<Observable<any>> {
|
): (...args: any[]) => Promise<Observable<any>> {
|
||||||
return async (...args) => {
|
return async (...args: any[]) => {
|
||||||
try {
|
try {
|
||||||
return await targetCallback(...args);
|
return await targetCallback(...args);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { Controller } from '@nestjs/common/interfaces/controllers/controller.interface';
|
import { Controller } from '@nestjs/common/interfaces/controllers/controller.interface';
|
||||||
import { isFunction, isUndefined } from '@nestjs/common/utils/shared.utils';
|
import { isFunction, isUndefined } from '@nestjs/common/utils/shared.utils';
|
||||||
|
import { MetadataScanner } from '@nestjs/core/metadata-scanner';
|
||||||
import {
|
import {
|
||||||
PATTERN_METADATA,
|
|
||||||
PATTERN_HANDLER_METADATA,
|
|
||||||
CLIENT_CONFIGURATION_METADATA,
|
CLIENT_CONFIGURATION_METADATA,
|
||||||
CLIENT_METADATA,
|
CLIENT_METADATA,
|
||||||
|
PATTERN_HANDLER_METADATA,
|
||||||
|
PATTERN_METADATA,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import { PatternMetadata } from './interfaces/pattern-metadata.interface';
|
|
||||||
import { ClientOptions } from './interfaces/client-metadata.interface';
|
import { ClientOptions } from './interfaces/client-metadata.interface';
|
||||||
import { MetadataScanner } from '@nestjs/core/metadata-scanner';
|
import { PatternMetadata } from './interfaces/pattern-metadata.interface';
|
||||||
|
|
||||||
export class ListenerMetadataExplorer {
|
export class ListenerMetadataExplorer {
|
||||||
constructor(private readonly metadataScanner: MetadataScanner) {}
|
constructor(private readonly metadataScanner: MetadataScanner) {}
|
||||||
@@ -71,5 +71,5 @@ export interface ClientProperties {
|
|||||||
|
|
||||||
export interface PatternProperties {
|
export interface PatternProperties {
|
||||||
pattern: PatternMetadata;
|
pattern: PatternMetadata;
|
||||||
targetCallback: (...args) => any;
|
targetCallback: (...args: any[]) => any;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ import { Server } from './server';
|
|||||||
let grpcPackage: any = {};
|
let grpcPackage: any = {};
|
||||||
let grpcProtoLoaderPackage: any = {};
|
let grpcProtoLoaderPackage: any = {};
|
||||||
|
|
||||||
|
interface GrpcCall<TRequest = any, TMetadata = any> {
|
||||||
|
request: TRequest;
|
||||||
|
metadata: TMetadata;
|
||||||
|
end: Function;
|
||||||
|
write: Function;
|
||||||
|
}
|
||||||
export class ServerGrpc extends Server implements CustomTransportStrategy {
|
export class ServerGrpc extends Server implements CustomTransportStrategy {
|
||||||
private readonly url: string;
|
private readonly url: string;
|
||||||
private grpcClient: any;
|
private grpcClient: any;
|
||||||
@@ -99,22 +105,22 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
|
|||||||
: this.createUnaryServiceMethod(methodHandler);
|
: this.createUnaryServiceMethod(methodHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public createUnaryServiceMethod(methodHandler): Function {
|
public createUnaryServiceMethod(methodHandler: Function): Function {
|
||||||
return async (call, callback) => {
|
return async (call: GrpcCall, callback: Function) => {
|
||||||
const handler = methodHandler(call.request, call.metadata);
|
const handler = methodHandler(call.request, call.metadata);
|
||||||
this.transformToObservable(await handler).subscribe(
|
this.transformToObservable(await handler).subscribe(
|
||||||
data => callback(null, data),
|
data => callback(null, data),
|
||||||
err => callback(err),
|
(err: any) => callback(err),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public createStreamServiceMethod(methodHandler): Function {
|
public createStreamServiceMethod(methodHandler: Function): Function {
|
||||||
return async (call, callback) => {
|
return async (call: GrpcCall, callback: Function) => {
|
||||||
const handler = methodHandler(call.request, call.metadata);
|
const handler = methodHandler(call.request, call.metadata);
|
||||||
const result$ = this.transformToObservable(await handler);
|
const result$ = this.transformToObservable(await handler);
|
||||||
await result$
|
await result$
|
||||||
.pipe(takeUntil(fromEvent(call, CANCEL_EVENT)))
|
.pipe(takeUntil(fromEvent(call as any, CANCEL_EVENT)))
|
||||||
.forEach(data => call.write(data));
|
.forEach(data => call.write(data));
|
||||||
call.end();
|
call.end();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ export class ServerMqtt extends Server implements CustomTransportStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getMessageHandler(pub: MqttClient): any {
|
public getMessageHandler(pub: MqttClient): any {
|
||||||
return async (channel, buffer) => this.handleMessage(channel, buffer, pub);
|
return async (channel: string, buffer: Buffer) =>
|
||||||
|
this.handleMessage(channel, buffer, pub);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async handleMessage(
|
public async handleMessage(
|
||||||
@@ -81,14 +82,14 @@ export class ServerMqtt extends Server implements CustomTransportStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getPublisher(client: MqttClient, pattern: any, id: string): any {
|
public getPublisher(client: MqttClient, pattern: any, id: string): any {
|
||||||
return response =>
|
return (response: any) =>
|
||||||
client.publish(
|
client.publish(
|
||||||
this.getResQueueName(pattern),
|
this.getResQueueName(pattern),
|
||||||
JSON.stringify(Object.assign(response, { id })),
|
JSON.stringify(Object.assign(response, { id })),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public deserialize(content): ReadPacket & PacketId {
|
public deserialize(content: any): ReadPacket & PacketId {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(content);
|
return JSON.parse(content);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -104,7 +105,7 @@ export class ServerMqtt extends Server implements CustomTransportStrategy {
|
|||||||
return `${pattern}_res`;
|
return `${pattern}_res`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public handleError(stream) {
|
public handleError(stream: any) {
|
||||||
stream.on(ERROR_EVENT, err => this.logger.error(err));
|
stream.on(ERROR_EVENT, (err: any) => this.logger.error(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export class ServerNats extends Server implements CustomTransportStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getMessageHandler(channel: string, client: Client) {
|
public getMessageHandler(channel: string, client: Client) {
|
||||||
return async (buffer, replyTo: string) =>
|
return async (buffer: ReadPacket & PacketId, replyTo: string) =>
|
||||||
this.handleMessage(channel, buffer, client, replyTo);
|
this.handleMessage(channel, buffer, client, replyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ export class ServerNats extends Server implements CustomTransportStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getPublisher(publisher: Client, replyTo: string, id: string) {
|
public getPublisher(publisher: Client, replyTo: string, id: string) {
|
||||||
return response =>
|
return (response: any) =>
|
||||||
publisher.publish(
|
publisher.publish(
|
||||||
replyTo,
|
replyTo,
|
||||||
Object.assign(response, {
|
Object.assign(response, {
|
||||||
@@ -107,6 +107,6 @@ export class ServerNats extends Server implements CustomTransportStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public handleError(stream) {
|
public handleError(stream) {
|
||||||
stream.on(ERROR_EVENT, err => this.logger.error(err));
|
stream.on(ERROR_EVENT, (err: any) => this.logger.error(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export class ServerRedis extends Server implements CustomTransportStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getPublisher(pub: RedisClient, pattern: any, id: string) {
|
public getPublisher(pub: RedisClient, pattern: any, id: string) {
|
||||||
return response =>
|
return (response: any) =>
|
||||||
pub.publish(
|
pub.publish(
|
||||||
this.getResQueueName(pattern),
|
this.getResQueueName(pattern),
|
||||||
JSON.stringify(Object.assign(response, { id })),
|
JSON.stringify(Object.assign(response, { id })),
|
||||||
@@ -115,7 +115,7 @@ export class ServerRedis extends Server implements CustomTransportStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public handleError(stream) {
|
public handleError(stream) {
|
||||||
stream.on(ERROR_EVENT, err => this.logger.error(err));
|
stream.on(ERROR_EVENT, (err: any) => this.logger.error(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
public getClientOptions(): Partial<ClientOpts> {
|
public getClientOptions(): Partial<ClientOpts> {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export class ServerRMQ extends Server implements CustomTransportStrategy {
|
|||||||
setup: channel => this.setupChannel(channel, callback),
|
setup: channel => this.setupChannel(channel, callback),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.server.on(DISCONNECT_EVENT, err => {
|
this.server.on(DISCONNECT_EVENT, (err: any) => {
|
||||||
this.logger.error(DISCONNECTED_RMQ_MESSAGE);
|
this.logger.error(DISCONNECTED_RMQ_MESSAGE);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,13 +40,13 @@ export abstract class Server {
|
|||||||
): Subscription {
|
): Subscription {
|
||||||
return stream$
|
return stream$
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError(err => {
|
catchError((err: any) => {
|
||||||
respond({ err, response: null });
|
respond({ err, response: null });
|
||||||
return empty;
|
return empty;
|
||||||
}),
|
}),
|
||||||
finalize(() => respond({ isDisposed: true })),
|
finalize(() => respond({ isDisposed: true })),
|
||||||
)
|
)
|
||||||
.subscribe(response => respond({ err: null, response }));
|
.subscribe((response: any) => respond({ err: null, response }));
|
||||||
}
|
}
|
||||||
|
|
||||||
public transformToObservable<T = any>(resultOrDeffered): Observable<T> {
|
public transformToObservable<T = any>(resultOrDeffered): Observable<T> {
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ describe('ClientMqtt', () => {
|
|||||||
};
|
};
|
||||||
client
|
client
|
||||||
.mergeCloseEvent(instance as any, empty())
|
.mergeCloseEvent(instance as any, empty())
|
||||||
.subscribe(null, err => expect(err).to.be.eql(error));
|
.subscribe(null, (err: any) => expect(err).to.be.eql(error));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('handleError', () => {
|
describe('handleError', () => {
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ describe('ClientRQM', () => {
|
|||||||
};
|
};
|
||||||
client
|
client
|
||||||
.mergeDisconnectEvent(instance as any, empty())
|
.mergeDisconnectEvent(instance as any, empty())
|
||||||
.subscribe(null, err => expect(err).to.be.eql(error));
|
.subscribe(null, (err: any) => expect(err).to.be.eql(error));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import * as sinon from 'sinon';
|
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { RpcExceptionsHandler } from '../../exceptions/rpc-exceptions-handler';
|
import { EMPTY as empty, of } from 'rxjs';
|
||||||
import { RpcException } from '../../exceptions/rpc-exception';
|
|
||||||
import { Observable, of, EMPTY as empty } from 'rxjs';
|
|
||||||
import { catchError } from 'rxjs/operators';
|
import { catchError } from 'rxjs/operators';
|
||||||
|
import * as sinon from 'sinon';
|
||||||
|
import { RpcException } from '../../exceptions/rpc-exception';
|
||||||
|
import { RpcExceptionsHandler } from '../../exceptions/rpc-exceptions-handler';
|
||||||
|
|
||||||
describe('RpcExceptionsHandler', () => {
|
describe('RpcExceptionsHandler', () => {
|
||||||
let handler: RpcExceptionsHandler;
|
let handler: RpcExceptionsHandler;
|
||||||
@@ -17,7 +17,7 @@ describe('RpcExceptionsHandler', () => {
|
|||||||
const stream$ = handler.handle(new Error(), null);
|
const stream$ = handler.handle(new Error(), null);
|
||||||
stream$
|
stream$
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError(err => {
|
catchError((err: any) => {
|
||||||
expect(err).to.be.eql({
|
expect(err).to.be.eql({
|
||||||
status: 'error',
|
status: 'error',
|
||||||
message: 'Internal server error',
|
message: 'Internal server error',
|
||||||
@@ -36,7 +36,7 @@ describe('RpcExceptionsHandler', () => {
|
|||||||
const stream$ = handler.handle(new RpcException(message), null);
|
const stream$ = handler.handle(new RpcException(message), null);
|
||||||
stream$
|
stream$
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError(err => {
|
catchError((err: any) => {
|
||||||
expect(err).to.be.eql(message);
|
expect(err).to.be.eql(message);
|
||||||
done();
|
done();
|
||||||
return empty;
|
return empty;
|
||||||
@@ -50,7 +50,7 @@ describe('RpcExceptionsHandler', () => {
|
|||||||
const stream$ = handler.handle(new RpcException(message), null);
|
const stream$ = handler.handle(new RpcException(message), null);
|
||||||
stream$
|
stream$
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError(err => {
|
catchError((err: any) => {
|
||||||
expect(err).to.be.eql({ message, status: 'error' });
|
expect(err).to.be.eql({ message, status: 'error' });
|
||||||
done();
|
done();
|
||||||
return empty;
|
return empty;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ describe('ServerNats', () => {
|
|||||||
.stub(server, 'handleMessage')
|
.stub(server, 'handleMessage')
|
||||||
.callsFake(() => null);
|
.callsFake(() => null);
|
||||||
(await server.getMessageHandler('', (server as any).natsClient))(
|
(await server.getMessageHandler('', (server as any).natsClient))(
|
||||||
'',
|
'' as any,
|
||||||
'',
|
'',
|
||||||
);
|
);
|
||||||
expect(handleMessageStub.called).to.be.true;
|
expect(handleMessageStub.called).to.be.true;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export interface OverrideByFactoryOptions {
|
export interface OverrideByFactoryOptions {
|
||||||
factory: (...args) => any;
|
factory: (...args: any[]) => any;
|
||||||
inject?: any[];
|
inject?: any[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { OverrideByFactoryOptions } from './override-by-factory-options.interface';
|
|
||||||
import { TestingModuleBuilder } from '../testing-module.builder';
|
import { TestingModuleBuilder } from '../testing-module.builder';
|
||||||
|
import { OverrideByFactoryOptions } from './override-by-factory-options.interface';
|
||||||
|
|
||||||
export interface OverrideBy {
|
export interface OverrideBy {
|
||||||
useValue: (value) => TestingModuleBuilder;
|
useValue: (value: any) => TestingModuleBuilder;
|
||||||
useFactory: (options: OverrideByFactoryOptions) => TestingModuleBuilder;
|
useFactory: (options: OverrideByFactoryOptions) => TestingModuleBuilder;
|
||||||
useClass: (metatype) => TestingModuleBuilder;
|
useClass: (metatype: any) => TestingModuleBuilder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,31 +27,31 @@ export class TestingModuleBuilder {
|
|||||||
this.module = this.createModule(metadata);
|
this.module = this.createModule(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public overridePipe(typeOrToken): OverrideBy {
|
public overridePipe<T = any>(typeOrToken: T): OverrideBy {
|
||||||
return this.override(typeOrToken, false);
|
return this.override(typeOrToken, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public overrideFilter(typeOrToken): OverrideBy {
|
public overrideFilter<T = any>(typeOrToken: T): OverrideBy {
|
||||||
return this.override(typeOrToken, false);
|
return this.override(typeOrToken, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public overrideGuard(typeOrToken): OverrideBy {
|
public overrideGuard<T = any>(typeOrToken: T): OverrideBy {
|
||||||
return this.override(typeOrToken, false);
|
return this.override(typeOrToken, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public overrideInterceptor(typeOrToken): OverrideBy {
|
public overrideInterceptor<T = any>(typeOrToken: T): OverrideBy {
|
||||||
return this.override(typeOrToken, false);
|
return this.override(typeOrToken, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
public overrideComponent(typeOrToken): OverrideBy {
|
public overrideComponent<T = any>(typeOrToken: T): OverrideBy {
|
||||||
deprecate(
|
deprecate(
|
||||||
'The "overrideComponent()" method is deprecated and will be removed within next major release. Use "overrideProvider()" instead.',
|
'The "overrideComponent()" method is deprecated and will be removed within next major release. Use "overrideProvider()" instead.',
|
||||||
);
|
);
|
||||||
return this.override(typeOrToken, true);
|
return this.override(typeOrToken, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public overrideProvider(typeOrToken): OverrideBy {
|
public overrideProvider<T = any>(typeOrToken: T): OverrideBy {
|
||||||
return this.override(typeOrToken, true);
|
return this.override(typeOrToken, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,8 +67,8 @@ export class TestingModuleBuilder {
|
|||||||
return new TestingModule(this.container, [], root, this.applicationConfig);
|
return new TestingModule(this.container, [], root, this.applicationConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
private override(typeOrToken, isProvider: boolean): OverrideBy {
|
private override<T = any>(typeOrToken: T, isProvider: boolean): OverrideBy {
|
||||||
const addOverload = options => {
|
const addOverload = (options: any) => {
|
||||||
this.overloadsMap.set(typeOrToken, {
|
this.overloadsMap.set(typeOrToken, {
|
||||||
...options,
|
...options,
|
||||||
isProvider,
|
isProvider,
|
||||||
@@ -79,7 +79,7 @@ export class TestingModuleBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private createOverrideByBuilder(
|
private createOverrideByBuilder(
|
||||||
add: (provider) => TestingModuleBuilder,
|
add: (provider: any) => TestingModuleBuilder,
|
||||||
): OverrideBy {
|
): OverrideBy {
|
||||||
return {
|
return {
|
||||||
useValue: value => add({ useValue: value }),
|
useValue: value => add({ useValue: value }),
|
||||||
@@ -100,7 +100,7 @@ export class TestingModuleBuilder {
|
|||||||
return modules.next().value;
|
return modules.next().value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private createModule(metadata) {
|
private createModule(metadata: ModuleMetadata) {
|
||||||
class TestModule {}
|
class TestModule {}
|
||||||
Module(metadata)(TestModule);
|
Module(metadata)(TestModule);
|
||||||
return TestModule;
|
return TestModule;
|
||||||
|
|||||||
@@ -18,12 +18,13 @@ import { ExpressFactory } from '@nestjs/core/adapters/express-factory';
|
|||||||
import { FastifyAdapter } from '@nestjs/core/adapters/fastify-adapter';
|
import { FastifyAdapter } from '@nestjs/core/adapters/fastify-adapter';
|
||||||
import { ApplicationConfig } from '@nestjs/core/application-config';
|
import { ApplicationConfig } from '@nestjs/core/application-config';
|
||||||
import { NestContainer } from '@nestjs/core/injector/container';
|
import { NestContainer } from '@nestjs/core/injector/container';
|
||||||
|
import { Module } from '@nestjs/core/injector/module';
|
||||||
|
|
||||||
export class TestingModule extends NestApplicationContext {
|
export class TestingModule extends NestApplicationContext {
|
||||||
constructor(
|
constructor(
|
||||||
container: NestContainer,
|
container: NestContainer,
|
||||||
scope: Type<any>[],
|
scope: Type<any>[],
|
||||||
contextModule,
|
contextModule: Module,
|
||||||
private readonly applicationConfig: ApplicationConfig,
|
private readonly applicationConfig: ApplicationConfig,
|
||||||
) {
|
) {
|
||||||
super(container, scope, contextModule);
|
super(container, scope, contextModule);
|
||||||
|
|||||||
@@ -43,11 +43,11 @@ export class IoAdapter implements WebSocketAdapter {
|
|||||||
return io(port, options);
|
return io(port, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bindClientConnect(server: any, callback: (...args) => void) {
|
public bindClientConnect(server: any, callback: (...args: any[]) => void) {
|
||||||
server.on(CONNECTION_EVENT, callback);
|
server.on(CONNECTION_EVENT, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bindClientDisconnect(client: any, callback: (...args) => void) {
|
public bindClientDisconnect(client: any, callback: (...args: any[]) => void) {
|
||||||
client.on(DISCONNECT_EVENT, callback);
|
client.on(DISCONNECT_EVENT, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,8 +66,8 @@ export class IoAdapter implements WebSocketAdapter {
|
|||||||
mergeMap((payload: any) => {
|
mergeMap((payload: any) => {
|
||||||
const { data, ack } = this.mapPayload(payload);
|
const { data, ack } = this.mapPayload(payload);
|
||||||
return transform(callback(data)).pipe(
|
return transform(callback(data)).pipe(
|
||||||
filter(response => !isNil(response)),
|
filter((response: any) => !isNil(response)),
|
||||||
map(response => [response, ack]),
|
map((response: any) => [response, ack]),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
takeUntil(disconnect$),
|
takeUntil(disconnect$),
|
||||||
@@ -78,7 +78,8 @@ export class IoAdapter implements WebSocketAdapter {
|
|||||||
}
|
}
|
||||||
isFunction(ack) && ack(response);
|
isFunction(ack) && ack(response);
|
||||||
};
|
};
|
||||||
const onError = err => this.baseExceptionFilter.handleError(client, err);
|
const onError = (err: any) =>
|
||||||
|
this.baseExceptionFilter.handleError(client, err);
|
||||||
source$.subscribe(onMessage as any, onError);
|
source$.subscribe(onMessage as any, onError);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,11 +59,11 @@ export class WsAdapter implements WebSocketAdapter {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bindClientConnect(server, callback: (...args) => void) {
|
public bindClientConnect(server, callback: (...args: any[]) => void) {
|
||||||
server.on(CONNECTION_EVENT, callback);
|
server.on(CONNECTION_EVENT, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bindClientDisconnect(client, callback: (...args) => void) {
|
public bindClientDisconnect(client, callback: (...args: any[]) => void) {
|
||||||
client.on(CLOSE_EVENT, callback);
|
client.on(CLOSE_EVENT, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,13 +81,14 @@ export class WsAdapter implements WebSocketAdapter {
|
|||||||
),
|
),
|
||||||
takeUntil(close$),
|
takeUntil(close$),
|
||||||
);
|
);
|
||||||
const onMessage = response => {
|
const onMessage = (response: any) => {
|
||||||
if (client.readyState !== READY_STATE.OPEN_STATE) {
|
if (client.readyState !== READY_STATE.OPEN_STATE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
client.send(JSON.stringify(response));
|
client.send(JSON.stringify(response));
|
||||||
};
|
};
|
||||||
const onError = err => this.baseExceptionFilter.handleError(client, err);
|
const onError = (err: any) =>
|
||||||
|
this.baseExceptionFilter.handleError(client, err);
|
||||||
source$.subscribe(onMessage, onError);
|
source$.subscribe(onMessage, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,9 +115,9 @@ export class WsAdapter implements WebSocketAdapter {
|
|||||||
|
|
||||||
public bindErrorHandler(server: any) {
|
public bindErrorHandler(server: any) {
|
||||||
server.on(CONNECTION_EVENT, ws =>
|
server.on(CONNECTION_EVENT, ws =>
|
||||||
ws.on(ERROR_EVENT, err => this.logger.error(err)),
|
ws.on(ERROR_EVENT, (err: any) => this.logger.error(err)),
|
||||||
);
|
);
|
||||||
server.on(ERROR_EVENT, err => this.logger.error(err));
|
server.on(ERROR_EVENT, (err: any) => this.logger.error(err));
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ export class WsContextCreator {
|
|||||||
|
|
||||||
public create(
|
public create(
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => void,
|
callback: (...args: any[]) => void,
|
||||||
module,
|
module: string,
|
||||||
): (...args) => Promise<void> {
|
): (...args: any[]) => Promise<void> {
|
||||||
const exceptionHandler = this.exceptionFiltersContext.create(
|
const exceptionHandler = this.exceptionFiltersContext.create(
|
||||||
instance,
|
instance,
|
||||||
callback,
|
callback,
|
||||||
@@ -52,7 +52,7 @@ export class WsContextCreator {
|
|||||||
return callback.call(instance, client, result, ...params);
|
return callback.call(instance, client, result, ...params);
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.wsProxy.create(async (...args) => {
|
return this.wsProxy.create(async (...args: any[]) => {
|
||||||
fnCanActivate && (await fnCanActivate(args));
|
fnCanActivate && (await fnCanActivate(args));
|
||||||
|
|
||||||
return this.interceptorsConsumer.intercept(
|
return this.interceptorsConsumer.intercept(
|
||||||
@@ -67,12 +67,15 @@ export class WsContextCreator {
|
|||||||
|
|
||||||
public reflectCallbackParamtypes(
|
public reflectCallbackParamtypes(
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
): any[] {
|
): any[] {
|
||||||
return Reflect.getMetadata(PARAMTYPES_METADATA, instance, callback.name);
|
return Reflect.getMetadata(PARAMTYPES_METADATA, instance, callback.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getDataMetatype(instance, callback) {
|
public getDataMetatype(
|
||||||
|
instance: Controller,
|
||||||
|
callback: (...args: any[]) => any,
|
||||||
|
) {
|
||||||
const paramtypes = this.reflectCallbackParamtypes(instance, callback);
|
const paramtypes = this.reflectCallbackParamtypes(instance, callback);
|
||||||
return paramtypes && paramtypes.length ? paramtypes[1] : null;
|
return paramtypes && paramtypes.length ? paramtypes[1] : null;
|
||||||
}
|
}
|
||||||
@@ -80,7 +83,7 @@ export class WsContextCreator {
|
|||||||
public createGuardsFn(
|
public createGuardsFn(
|
||||||
guards: any[],
|
guards: any[],
|
||||||
instance: Controller,
|
instance: Controller,
|
||||||
callback: (...args) => any,
|
callback: (...args: any[]) => any,
|
||||||
): Function | null {
|
): Function | null {
|
||||||
const canActivateFn = async (args: any[]) => {
|
const canActivateFn = async (args: any[]) => {
|
||||||
const canActivate = await this.guardsConsumer.tryActivate(
|
const canActivate = await this.guardsConsumer.tryActivate(
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import { WsExceptionsHandler } from '../exceptions/ws-exceptions-handler';
|
|||||||
|
|
||||||
export class WsProxy {
|
export class WsProxy {
|
||||||
public create(
|
public create(
|
||||||
targetCallback: (...args) => Promise<void>,
|
targetCallback: (...args: any[]) => Promise<void>,
|
||||||
exceptionsHandler: WsExceptionsHandler,
|
exceptionsHandler: WsExceptionsHandler,
|
||||||
): (...args) => Promise<void> {
|
): (...args: any[]) => Promise<void> {
|
||||||
return async (...args) => {
|
return async (...args: any[]) => {
|
||||||
try {
|
try {
|
||||||
return await targetCallback(...args);
|
return await targetCallback(...args);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { NestGateway } from './interfaces/nest-gateway.interface';
|
|||||||
|
|
||||||
export interface MessageMappingProperties {
|
export interface MessageMappingProperties {
|
||||||
message: any;
|
message: any;
|
||||||
callback: (...args) => Observable<any> | Promise<any> | any;
|
callback: (...args: any[]) => Observable<any> | Promise<any> | any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GatewayMetadataExplorer {
|
export class GatewayMetadataExplorer {
|
||||||
@@ -27,7 +27,7 @@ export class GatewayMetadataExplorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public exploreMethodMetadata(
|
public exploreMethodMetadata(
|
||||||
instancePrototype,
|
instancePrototype: any,
|
||||||
methodName: string,
|
methodName: string,
|
||||||
): MessageMappingProperties {
|
): MessageMappingProperties {
|
||||||
const callback = instancePrototype[methodName];
|
const callback = instancePrototype[methodName];
|
||||||
|
|||||||
@@ -12,16 +12,8 @@
|
|||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"lib": [
|
"lib": ["es7"]
|
||||||
"es7"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["packages/**/*", "integration/**/*"],
|
||||||
"packages/**/*",
|
"exclude": ["node_modules", "**/*.spec.ts"]
|
||||||
"integration/**/*"
|
}
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"**/*.spec.ts"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user