(app: NestApplication, adapter: HttpServer)
| 348 | } |
| 349 | |
| 350 | private createAdapterProxy<T>(app: NestApplication, adapter: HttpServer): T { |
| 351 | const proxy = new Proxy(app, { |
| 352 | get: (receiver: Record<string, any>, prop: string) => { |
| 353 | const mapToProxy = (result: unknown) => { |
| 354 | return result instanceof Promise |
| 355 | ? result.then(mapToProxy) |
| 356 | : result instanceof NestApplication |
| 357 | ? proxy |
| 358 | : result; |
| 359 | }; |
| 360 | |
| 361 | if (!(prop in receiver) && prop in adapter) { |
| 362 | return (...args: unknown[]) => { |
| 363 | const result = this.createExceptionZone(adapter, prop)(...args); |
| 364 | return mapToProxy(result); |
| 365 | }; |
| 366 | } |
| 367 | if (isFunction(receiver[prop])) { |
| 368 | return (...args: unknown[]) => { |
| 369 | const result = receiver[prop](...args); |
| 370 | return mapToProxy(result); |
| 371 | }; |
| 372 | } |
| 373 | return receiver[prop]; |
| 374 | }, |
| 375 | }); |
| 376 | return proxy as unknown as T; |
| 377 | } |
| 378 | |
| 379 | private createGraphInspector( |
| 380 | appOptions: NestApplicationContextOptions, |
no test coverage detected