import { type CustomLogger, type LogLevel } from '@forgerock/sdk-logger'; import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; /** * Import the DaVinciRequest types */ import type { DaVinciConfig } from './config.types.js'; import type { DaVinciAction, DaVinciRequest, OutgoingQueryParams, StartOptions } from './davinci.types.js'; import type { SingleValueCollectors, MultiSelectCollector, ObjectValueCollectors, AutoCollectors, PollingCollector, MultiValueCollectors } from './collector.types.js'; import type { InitFlow, InternalErrorResponse, NodeStates, Updater, Validator, Poller } from './client.types.js'; import type { ContinueNode, StartNode } from './node.types.js'; /** * Create a client function that returns a set of methods * to interact with and normalize the DaVinci API. * * @function davinciClient - returns an "observable" client for DaVinci flows * @param {ConfigurationOptions} options - the configuration options for the client * @returns {Observable} - an observable client for DaVinci flows */ export declare function davinci({ config, requestMiddleware, logger, }: { config: DaVinciConfig; requestMiddleware?: RequestMiddleware[]; logger?: { level: LogLevel; custom?: CustomLogger; }; }): Promise<{ subscribe: (listener: () => void) => import("@reduxjs/toolkit").Unsubscribe; /** * Social Login Handler * Use this as part of an event when clicking on * a social login button. Pass in the collector responsible * for the social login being started. * * This method will save the `continueUrl` * and then the app developer can use the url * from the collector to redirect their application * * Can return an error when no continue url is found * or no authenticate url is found in the collectors * * @method: externalIdp * @param collector IdpCollector * @returns {function} */ externalIdp: () => (() => Promise); /** * @method flow - Method for initiating a new flow, different than current flow * @param {DaVinciAction} action - the action to initiate the flow * @returns {function} - an async function to call the flow */ flow: (action: DaVinciAction) => InitFlow; /** * @method next - Method for initiating the next node in the current flow * @param {DaVinciRequest} args - the arguments to pass to the next * @returns {Promise} - a promise that resolves to the next node */ next: (args?: DaVinciRequest) => Promise; /** * @method: resume - Resume a social login flow when returned to application * @returns unknown */ resume: ({ continueToken, }: { continueToken: string; }) => Promise; /** * @method start - Method for initiating a DaVinci flow * @returns {Promise} - a promise that initiates a DaVinci flow and returns a node */ start: (options?: StartOptions | undefined) => Promise; /** * @method update - Exclusive method for updating the current node with user provided values * @param {SingleValueCollector | MultiSelectCollector | ObjectValueCollectors | AutoCollectors} collector - the collector to update * @returns {function} - a function to call for updating collector value */ update: (collector: T) => Updater; /** * @method validate - Method for validating the value against validation rules * @param {SingleValueCollectors | ObjectValueCollectors | MultiValueCollectors | AutoCollectors} collector - the collector to validate * @returns {function} - a function to call for validating collector value * @throws {Error} - if the collector cannot be validated */ validate: (collector: SingleValueCollectors | ObjectValueCollectors | MultiValueCollectors | AutoCollectors) => Validator; /** * @method pollStatus - A helper for challenge or continue polling * @description - In challenge polling mode, periodically polls the `/status` endpoint and returns a status. * In continue polling mode, returns a polling status after a delay based on poll retries remaining. * The polling mode is automatically detected. * @param {PollingCollector} collector - The polling collector * @returns {Promise} - Returns a promise that resolves to a polling status or error */ pollStatus: (collector: PollingCollector) => Poller; /** * @method client - Selector to get the node.client from state * @returns {Node.client} - the client property from the current node */ getClient: () => { action: string; collectors: import("./node.types.js").Collectors[]; description?: string; name?: string; status: "continue"; } | { action: string; collectors: import("./node.types.js").Collectors[]; description?: string; name?: string; status: "error"; } | { status: "failure"; } | { status: "start"; } | { authorization?: { code?: string; state?: string; }; status: "success"; } | null; /** * @method collectors - Selector to get the collectors from state * @returns {Collector[]} - The collectors from the current node in state */ getCollectors: () => import("./node.types.js").Collectors[]; getError: () => import("./node.types.js").DaVinciError | null; getErrorCollectors: () => import("./node.types.js").CollectorErrors[]; /** * @method node - Selector to get the node from state * @returns {Node} - the current node from state */ getNode: () => ContinueNode | import("./node.types.js").ErrorNode | import("./node.types.js").FailureNode | StartNode | import("./node.types.js").SuccessNode; /** * @method server - Selector to get the node.server from state * @returns {Node.server} - the server property from the current node */ getServer: () => { _links?: import("./davinci.types.js").Links; id?: string; interactionId?: string; interactionToken?: string; href?: string; eventName?: string; status: "continue"; } | { _links?: import("./davinci.types.js").Links; eventName?: string; id?: string; interactionId?: string; interactionToken?: string; status: "error"; } | { _links?: import("./davinci.types.js").Links; eventName?: string; href?: string; id?: string; interactionId?: string; interactionToken?: string; status: "failure"; } | { status: "start"; } | { _links?: import("./davinci.types.js").Links; eventName?: string; id?: string; interactionId?: string; interactionToken?: string; href?: string; session?: string; status: "success"; } | null; /** * Utilities to help query cached responses from server */ cache: { getLatestResponse: () => ({ status: import("@reduxjs/toolkit/query").QueryStatus.fulfilled; } & Omit<{ requestId: string; data?: unknown; error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined; endpointName: string; startedTimeStamp: number; fulfilledTimeStamp?: number; }, "data" | "fulfilledTimeStamp"> & Required> & { error: undefined; } & { status: import("@reduxjs/toolkit/query").QueryStatus.fulfilled; isUninitialized: false; isLoading: false; isSuccess: true; isError: false; }) | ({ status: import("@reduxjs/toolkit/query").QueryStatus.rejected; } & Omit<{ requestId: string; data?: unknown; error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined; endpointName: string; startedTimeStamp: number; fulfilledTimeStamp?: number; }, "error"> & Required> & { status: import("@reduxjs/toolkit/query").QueryStatus.rejected; isUninitialized: false; isLoading: false; isSuccess: false; isError: true; }) | { error: { message: string; type: string; }; }; getResponseWithId: (requestId: string) => ({ status: import("@reduxjs/toolkit/query").QueryStatus.fulfilled; } & Omit<{ requestId: string; data?: unknown; error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined; endpointName: string; startedTimeStamp: number; fulfilledTimeStamp?: number; }, "data" | "fulfilledTimeStamp"> & Required> & { error: undefined; } & { status: import("@reduxjs/toolkit/query").QueryStatus.fulfilled; isUninitialized: false; isLoading: false; isSuccess: true; isError: false; }) | ({ status: import("@reduxjs/toolkit/query").QueryStatus.rejected; } & Omit<{ requestId: string; data?: unknown; error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined; endpointName: string; startedTimeStamp: number; fulfilledTimeStamp?: number; }, "error"> & Required> & { status: import("@reduxjs/toolkit/query").QueryStatus.rejected; isUninitialized: false; isLoading: false; isSuccess: false; isError: true; }) | { error: { message: string; type: string; }; }; }; }>; //# sourceMappingURL=client.store.d.ts.map