import { DocumentNode } from 'graphql/language/index.js'; import { CdmLogger } from '@cdm-logger/core'; export type GenerateQueryCacheKeyOptions = { query: string | DocumentNode; variables: Record; userId?: string; tenantId?: string; appName?: string; logger?: CdmLogger.ILogger; }; /** * Generates a cache key for GraphQL queries using standardized Redis key builder * * Key format: `[appName]:[tenantId]:[userId]:queryName:queryHash[:variablesHash]` * or legacy format: `[tenantId]:[userId]:queryName:queryHash[:variablesHash]` * - Query and variables are hashed for consistent, compact keys * - Uses buildRedisKey for proper sanitization and validation * - Optional components are omitted if not provided * * @param options - Cache key generation options * @returns Generated cache key string * * @example * ```typescript * // With appName (recommended) * generateQueryCacheKey({ * query: GetCurrentPagePermissionsDocument, * variables: { resourceUri: '...' }, * userId: 'auth0|123', * tenantId: 'default', * appName: 'CDMBASE_TEST', * logger: myLogger * }) * // Returns: 'CDMBASE_TEST:default:auth0-123:currentPagePermissions:hash1:hash2' * * // Legacy format without appName (for backward compatibility) * generateQueryCacheKey({ * query: GetCurrentPagePermissionsDocument, * variables: { resourceUri: '...' }, * userId: 'auth0|123', * tenantId: 'default', * }) * // Returns: 'default:auth0-123:currentPagePermissions:hash1:hash2' * ``` */ export declare const generateQueryCacheKey: ({ query, variables, logger, userId, tenantId, appName, }: GenerateQueryCacheKeyOptions) => string;