How to use the @gapi/core.Type 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 / app / client / client.controller.ts View on Github external
}
  })
  async listenForChanges(views: ConfigViews) {
    return this.getViewsConfig(views);
  }

  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)
    };
  }

  @Type(ClientType)
  @Mutation()
  async clientReady(root, payload, context) {
    // const config = Container.get('main-config-compiled');
    // if (config.$views) {
    //   config.$views = modifyViewsConfig(
    //     config.$views,
    //     await mapComponentsPath(config.$views)
    //   );
    //   this.pubsub.publish('listenForChanges', config.$views);
    // }
    return this.getViewsConfig();
  }
}
github rxdi / graphqj / src / app / client / client.controller.ts View on Github external
modifyViewsConfig
} from '../../helpers/component.parser';

export const viewsToArray = (a: { [key: string]: T }): Array =>
  Object.keys(a).reduce(
    (acc, curr) => [...acc, { ...a[curr], name: curr }],
    []
  );
@Controller({
  guards: [],
  type: []
})
export class ClientController {
  constructor(private pubsub: PubSubService) {}

  @Type(ClientType)
  @Subscribe(
    withFilter(
      function(self: ClientController) {
        return self.pubsub.asyncIterator('listenForChanges');
      },
      function(global, unused, payload, context) {
        const isCorrectLength = context.clientid.length + context.clientid.length;
        if (isCorrectLength === 100 && payload.clientId === context.clientid) {
          return true;
        }
        return false;
      }
    )
  )
  @Subscription({
    clientId: {