How to use the graphile-utils.makeWrapResolversPlugin function in graphile-utils

To help you get started, we’ve selected a few graphile-utils 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 alex-ald / postgraphile-nest / lib / factories / plugin.factory.ts View on Github external
public static createWrapResolverPlugin(
    typeName: string,
    fieldName: string,
    requirements: ResolverWrapperRequirements,
    // tslint:disable-next-line:ban-types
    resolver: Function,
  ) {
    if (!typeName || !fieldName) {
      throw new Error('typeName and fieldName are required for WrapResolver');
    }

    typeName = typeName.trim();
    fieldName = fieldName.trim();

    return makeWrapResolversPlugin({
      [typeName]: {
        [fieldName]: {
          requires: requirements,
          // tslint:disable-next-line:ban-types
          resolve: resolver as any,
        },
      },
    });
  }
github clevertech / boilerplate / api / plugins / LoginJwtHook / index.js View on Github external
if (!jwt) {
        throw new Error("Authentication failed")
      }
      try {
        const signedJwt = signJwt(jwt)
        await redisJwtHelper.whitelistJwt(signedJwt)
        context.responseHelper.setJwtCookie(signedJwt)
      } catch (e) {
        console.error(e)
      }
      return null
    },
  }
}

export default makeWrapResolversPlugin(wrapResolversPlugin);