MCPcopy
hub / github.com/nestjs/nest / ExternalContextCreator

Class ExternalContextCreator

packages/core/helpers/external-context-creator.ts:38–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38export class ExternalContextCreator {
39 private readonly contextUtils = new ContextUtils();
40 private readonly externalErrorProxy = new ExternalErrorProxy();
41 private readonly handlerMetadataStorage =
42 new HandlerMetadataStorage<ExternalHandlerMetadata>();
43 private container: NestContainer;
44
45 constructor(
46 private readonly guardsContextCreator: GuardsContextCreator,
47 private readonly guardsConsumer: GuardsConsumer,
48 private readonly interceptorsContextCreator: InterceptorsContextCreator,
49 private readonly interceptorsConsumer: InterceptorsConsumer,
50 private readonly modulesContainer: ModulesContainer,
51 private readonly pipesContextCreator: PipesContextCreator,
52 private readonly pipesConsumer: PipesConsumer,
53 private readonly filtersContextCreator: ExternalExceptionFilterContext,
54 ) {}
55
56 static fromContainer(container: NestContainer): ExternalContextCreator {
57 const guardsContextCreator = new GuardsContextCreator(
58 container,
59 container.applicationConfig,
60 );
61 const guardsConsumer = new GuardsConsumer();
62 const interceptorsContextCreator = new InterceptorsContextCreator(
63 container,
64 container.applicationConfig,
65 );
66 const interceptorsConsumer = new InterceptorsConsumer();
67 const pipesContextCreator = new PipesContextCreator(
68 container,
69 container.applicationConfig,
70 );
71 const pipesConsumer = new PipesConsumer();
72 const filtersContextCreator = new ExternalExceptionFilterContext(
73 container,
74 container.applicationConfig,
75 );
76
77 const externalContextCreator = new ExternalContextCreator(
78 guardsContextCreator,
79 guardsConsumer,
80 interceptorsContextCreator,
81 interceptorsConsumer,
82 container.getModules(),
83 pipesContextCreator,
84 pipesConsumer,
85 filtersContextCreator,
86 );
87 externalContextCreator.container = container;
88 return externalContextCreator;
89 }
90
91 public create<
92 TParamsMetadata extends ParamsMetadata = ParamsMetadata,
93 TContext extends string = ContextType,
94 >(
95 instance: Controller,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected