@quell/server
Version:
Quell is an open-source NPM package providing a light-weight caching layer implementation and cache invalidation for GraphQL responses on both the client- and server-side. Use Quell to prevent redundant client-side API requests and to minimize costly serv
37 lines • 1.89 kB
TypeScript
import type { ProtoObjType } from '../types/types';
import type { BuildCacheConfig, BuildCacheFromResponseFunction, BuildCacheFromMergedResponseFunction, HandleQueryCachingFunction, HandleQueryCachingConfig } from '../types/buildCacheTypes';
/**
* Creates a function to build cache from GraphQL query response
* This function takes the response from a GraphQL query and stores it in cache
* @param config - Configuration object
* @returns Bound buildCacheFromResponse function
*/
export declare function createBuildCacheFromResponse(config: BuildCacheConfig): BuildCacheFromResponseFunction;
/**
* Creates a function to build cache from merged response
* This handles the case where responses are merged from cache and database
* @param config - Configuration object
* @returns Bound buildCacheFromMergedResponse function
*/
export declare function createBuildCacheFromMergedResponse(config: BuildCacheConfig): BuildCacheFromMergedResponseFunction;
/**
* Creates a function to handle caching logic in the query method
* This is the main integration point for caching query responses
* @param config - Configuration object
* @returns Function that handles the caching logic
*/
export declare function createHandleQueryCaching(config: HandleQueryCachingConfig): HandleQueryCachingFunction;
/**
* Helper function to determine if a response should be cached
* @param operationType - The type of GraphQL operation
* @param responseData - The response data
* @returns Whether the response should be cached
*/
export declare function shouldCacheResponse(operationType: string, responseData: any): boolean;
/**
* Helper function to extract cache keys from a prototype
* @param prototype - The query prototype
* @returns Array of cache keys that should be built
*/
export declare function extractCacheKeys(prototype: ProtoObjType): string[];
//# sourceMappingURL=buildCache.d.ts.map