INNER CODE UNIT · TypeScript
defaultKeyGenerator
ravangen/graphql-rate-limit · src/index.ts:177
export function defaultKeyGenerator<TContext>(
directiveArgs: RateLimitArgs,
source: unknown,
args: { [key: string]: unknown },
context: TContext,
info: GraphQLResolveInfo,
): string {
return getSchemaCoordinate(info);
}
/**
* Calculate the number of points to consume.
* @param directiveArgs The arguments defined in the schema for the directive.
* @param source The previous result returned from the resolver on the parent field.
* @param args The arguments provided to the field in the GraphQL operation.
* @param context Contains per-request state shared by all resolvers in a particular operation.
* @param info Holds field-specific information relevant to the current operation as well as the schema details.
*/