How to use the @graphql-modules/di.Injector function in @graphql-modules/di

To help you get started, we’ve selected a few @graphql-modules/di examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Urigo / graphql-modules / packages / core / src / graphql-module.ts View on Github external
get injector(): Injector {
    if (typeof this._cache.injector === 'undefined') {
      this.checkConfiguration();
      const injector = (this._cache.injector = new Injector({
        name: this.name,
        injectorScope: ProviderScope.Application,
        defaultProviderScope: this.selfDefaultProviderScope,
        hooks: [
          'onInit',
          'onRequest',
          'onResponse',
          'onError',
          'onConnect',
          'onOperation',
          'onOperationComplete',
          'onDisconnect'
        ],
        initialProviders: this.selfProviders,
        children: this.selfImports.map(module => module.injector)
      }));
github Urigo / graphql-modules / packages / core / src / graphql-module.ts View on Github external
this._cacheAsync.injectorAsync = new Promise(async (resolve, reject) => {
          try {
            this.checkConfiguration();
            const [initialProviders, children] = await Promise.all([
              Promise.resolve().then(() => this.selfProviders),
              Promise.resolve().then(() => Promise.all(this.selfImports.map(module => module.injectorAsync)))
            ]);
            const injector = (this._cache.injector = new Injector({
              name: this.name,
              injectorScope: ProviderScope.Application,
              defaultProviderScope: this.selfDefaultProviderScope,
              hooks: [
                'onInit',
                'onRequest',
                'onResponse',
                'onError',
                'onConnect',
                'onOperation',
                'onOperationComplete',
                'onDisconnect'
              ],
              initialProviders,
              children
            }));

@graphql-modules/di

MIT
Latest version published 5 years ago

Package Health Score

66 / 100
Full package analysis

Similar packages