import { Micro } from 'effect'; import { SerializedError } from '@reduxjs/toolkit/react'; import { FetchBaseQueryError } from '@reduxjs/toolkit/query/react'; import type { logger as loggerFn } from '@forgerock/sdk-logger'; import type { ClientStore, RootState } from './client.store.utils.js'; import type { PollingStatus, InternalErrorResponse } from './client.types.js'; import type { PollingCollector } from './collector.types.js'; /** * Shape returned by RTK Query's dispatch for the poll endpoint. */ export interface PollDispatchResult { data?: unknown; error?: FetchBaseQueryError | SerializedError; } /** * Validated prerequisites needed to initiate challenge polling. */ interface PollingPrerequisites { interactionId: string; challengeEndpoint: string; } /** * Discriminated union representing the validated polling mode. */ export type PollingMode = { _tag: 'challenge'; challenge: string; } | { _tag: 'continue'; retriesRemaining: number; pollInterval: number; } | { _tag: 'unknown'; }; /** * Determines the polling mode for a given PollingCollector. * Succeeds with a discriminated PollingMode, or fails with InternalErrorResponse. */ export declare function getPollingModeµ(collector: PollingCollector): Micro.Micro; /** * Constructs the challenge polling endpoint from a self link URL. * Returns InternalErrorResponse if URL cannot be parsed, instead of throwing. */ export declare function buildChallengeEndpoint(selfHref: string, challenge: string): string | InternalErrorResponse; /** * Validates all prerequisites for challenge polling and constructs the endpoint URL. * validate challenge → select server → select self link → build endpoint → assemble */ export declare function validatePollingPrerequisitesµ(rootState: RootState, challenge: string): Micro.Micro; /** * Pure predicate: determines if challenge polling should continue. * Returns true when the challenge has not yet completed and no error occurred. */ export declare function isChallengeStillPending(response: PollDispatchResult): boolean; export declare function interpretChallengeResponse(response: PollDispatchResult, log: ReturnType): PollingStatus | InternalErrorResponse; /** * Routes a validated PollingMode to the appropriate polling effect. * This is the single entry point — the caller lifts getPollingMode into Micro, pipes through this. */ export declare function pollingµ({ mode, collector, store, log, }: { mode: PollingMode; collector: PollingCollector; store: ReturnType; log: ReturnType; }): Micro.Micro; export {}; //# sourceMappingURL=client.store.effects.d.ts.map