Remove authorized function from imported helpers
This creates some issues with init order when using the queue processor.
This commit is contained in:
@ -78,30 +78,6 @@ export const stringToHash = (str: string, convertToUUID = false): string => {
|
||||
).toLowerCase()
|
||||
}
|
||||
|
||||
export function authorized<
|
||||
TSuccess,
|
||||
TError extends { errorCodes: string[] },
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
TArgs = any,
|
||||
TParent = any
|
||||
/* eslint-enable @typescript-eslint/no-explicit-any */
|
||||
>(
|
||||
resolver: ResolverFn<
|
||||
TSuccess | TError,
|
||||
TParent,
|
||||
WithDataSourcesContext & { claims: Claims },
|
||||
TArgs
|
||||
>
|
||||
): ResolverFn<TSuccess | TError, TParent, WithDataSourcesContext, TArgs> {
|
||||
return (parent, args, ctx, info) => {
|
||||
const { claims } = ctx
|
||||
if (claims?.uid) {
|
||||
return resolver(parent, args, { ...ctx, claims, uid: claims.uid }, info)
|
||||
}
|
||||
return { errorCodes: ['UNAUTHORIZED'] } as TError
|
||||
}
|
||||
}
|
||||
|
||||
export const findDelimiter = (
|
||||
text: string,
|
||||
delimiters = ['\t', ',', ':', ';'],
|
||||
|
||||
Reference in New Issue
Block a user