/** * Sessions Helper * * Utility functions for session verification and context extraction * to be used across all executors (actions, database, graph, vector, etc.) * * Session token format: session_tag:jwt_token * The token contains both the session tag and JWT in a single string. */ import { ISessionData, ISessionContext } from './sessions.resolver'; /** * Result of session verification for an executor */ export interface ISessionVerificationResult { /** Whether session was provided and is valid */ valid: boolean; /** Session data if valid */ sessionData?: ISessionData; /** Session context for logging (identifier, session_id, session_tag) */ context?: ISessionContext; /** Error message if invalid */ error?: string; } /** * Log fields extracted from session for ILogData */ export interface ISessionLogFields { session_user_id?: string; session_id?: string; session_tag?: string; } /** * Verify a session token and extract context for logging * * @param sessionToken - Session token string in format: session_tag:jwt_token * @param privateKey - Product private key for JWT verification * @param env - Current environment slug * @param selector - Optional selector path for identifier extraction * @returns Session verification result with context for logging */ export declare function verifyAndExtractSession(sessionToken: string | undefined, privateKey: string, env?: string, selector?: string): Promise; /** * Extract log fields from session context */ export declare function getSessionLogFields(context: ISessionContext | undefined): ISessionLogFields; /** * Resolve $Session{key}{...} references in input data * * @param input - Input data that may contain session references * @param sessionData - Verified session data * @returns Resolved input with session references replaced */ export declare function resolveSessionReferences(input: T, sessionData: ISessionData | undefined): T; /** * Options for processing session for execution */ export interface IProcessSessionOptions { /** Session token string in format: session_tag:jwt_token */ sessionToken: string | undefined; /** Product private key for JWT verification */ privateKey: string; /** Input data that may contain $Session{} references */ input: T; /** Current environment slug */ env?: string; /** Optional selector path for identifier extraction (e.g., "$Session{email}") */ selector?: string; /** Optional function to fetch session selector from config by tag */ fetchSessionSelector?: (tag: string) => Promise; } /** * Combined helper that verifies session and resolves references in one call * * @param sessionToken - Session token string in format: session_tag:jwt_token * @param privateKey - Product private key for JWT verification * @param input - Input data that may contain $Session{} references * @param env - Current environment slug * @param selectorOrOptions - Optional selector path OR options object with fetchSessionSelector */ export declare function processSessionForExecution(sessionToken: string | undefined, privateKey: string, input: T, env?: string, selectorOrOptions?: string | { selector?: string; fetchSessionSelector?: (tag: string) => Promise; }): Promise<{ input: T; logFields: ISessionLogFields; sessionData?: ISessionData; error?: string; }>;