How to use the @gapi/core.Container.get function in @gapi/core

To help you get started, we’ve selected a few @gapi/core 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 rxdi / graphqj / src / helpers / react-to-changes.ts View on Github external
config = await traverseConfig(path, newFile, config)
    }

    lazyTypes.clear();
    Container.get(BootstrapService).Fields = {
      mutation: {},
      query: {},
      subscription: {}
    };
    if (config.$mode === 'basic') {
      await MakeBasicSchema(config);
    }
    if (config.$mode === 'advanced') {
      await MakeAdvancedSchema(config);
    }
    Container.get(ApolloService).init();
    // await SchemaIntrospection()
  } catch (e) {
    console.error(e);
  }
  isRunning = false;
  if (config.$views) {
    config.$views = await transpileComponentsForViews(config.$views)
  }

  if(config.$components) {
    config.$components = (await transpileComponentsInit(config.$components as string[])).map(c => c && c.link ? c.link : c) as any;
  }

  Container.reset(Config)
  Container.remove(Config)
  Container.set(Config, config);
github rxdi / graphqj / src / helpers / react-to-changes.ts View on Github external
let metaKey: string;
    if (config._meta) {
      metaKey = findMetaKey(getMetaPath(path), config._meta);
    }
    if (configWatchers.filter(p => path.includes(p)).length) {
      config = await deep(newFile);
    } else if (config._meta && metaKey) {
      // First level deepnest
      config[metaKey] = await deep(newFile);
    } else {
      // Traverse recursive and find metadata for specific file and update it
      config = await traverseConfig(path, newFile, config)
    }

    lazyTypes.clear();
    Container.get(BootstrapService).Fields = {
      mutation: {},
      query: {},
      subscription: {}
    };
    if (config.$mode === 'basic') {
      await MakeBasicSchema(config);
    }
    if (config.$mode === 'advanced') {
      await MakeAdvancedSchema(config);
    }
    Container.get(ApolloService).init();
    // await SchemaIntrospection()
  } catch (e) {
    console.error(e);
  }
  isRunning = false;
github rxdi / graphqj / src / helpers / react-to-changes.ts View on Github external
console.error(e);
  }
  isRunning = false;
  if (config.$views) {
    config.$views = await transpileComponentsForViews(config.$views)
  }

  if(config.$components) {
    config.$components = (await transpileComponentsInit(config.$components as string[])).map(c => c && c.link ? c.link : c) as any;
  }

  Container.reset(Config)
  Container.remove(Config)
  Container.set(Config, config);
  if (config.$views) {
    Container.get(PubSubService).publish('listenForChanges', config.$views);
  }
  Container.reset('main-config-compiled')
  Container.remove('main-config-compiled')
  Container.set('main-config-compiled', config)
  console.log(`📦  Bundle realoaded! ${Date.now() - timer}ms`, path);
}
github rxdi / graphqj / src / app / client / client.controller.ts View on Github external
getViewsConfig(views?: ConfigViews) {
    const config = Container.get('main-config-compiled');
    return {
      components: config.$components,
      views: viewsToArray(views || config.$views),
      schema: printSchema(Container.get(BootstrapService).schema)
    };
  }
github rxdi / graphqj / src / helpers / basic-schema.ts View on Github external
fields[key] = { type: GraphQLBoolean };
      }
      if (typeof resolver !== 'string' && resolver.length) {
        if (typeof resolver[0] === 'string') {
          fields[key] = { type: new GraphQLList(GraphQLString) };
        }

        if (typeof resolver[0] === 'number') {
          fields[key] = { type: new GraphQLList(GraphQLInt) };
        }
        if (typeof resolver[0] === 'boolean') {
          fields[key] = { type: new GraphQLList(GraphQLBoolean) };
        }
      }
    });
    Container.get(BootstrapService).Fields.query[method_name] = {
      type: new GraphQLObjectType({
        name: `${method_name}_type`,
        fields: () => fields
      }),
      args,
      method_name,
      public: true,
      method_type: 'query',
      target: () => {},
      resolve: typeof resolve === 'function' ? resolve : () => resolve
    } as any;
  });
}