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

Method getProviders

packages/core/discovery/discovery-service.ts:84–98  ·  view source on GitHub ↗

* Returns an array of instance wrappers (providers). * Depending on the options, the array will contain either all providers or only providers with the specified metadata key. * @param options Discovery options. * @param modules A list of modules to filter by. * @returns An array of inst

(
    options: DiscoveryOptions = {},
    modules: Module[] = this.getModules(options),
  )

Source from the content-addressed store, hash-verified

82 * @returns An array of instance wrappers (providers).
83 */
84 public getProviders(
85 options: DiscoveryOptions = {},
86 modules: Module[] = this.getModules(options),
87 ): InstanceWrapper[] {
88 if ('metadataKey' in options) {
89 const providers = DiscoverableMetaHostCollection.getProvidersByMetaKey(
90 this.modulesContainer,
91 options.metadataKey!,
92 );
93 return Array.from(providers);
94 }
95
96 const providers = modules.map(item => [...item.providers.values()]);
97 return flatten(providers);
98 }
99
100 /**
101 * Returns an array of instance wrappers (controllers).

Callers 3

getWebhooksMethod · 0.80

Calls 3

getModulesMethod · 0.95
flattenFunction · 0.90
getProvidersByMetaKeyMethod · 0.80

Tested by

no test coverage detected