Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
},
},
});
}
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);