• Create a client function that returns a set of methods to interact with and normalize the DaVinci API.

    Parameters

    • options: { config: DaVinciConfig; requestMiddleware?: RequestMiddleware[] }

      the configuration options for the client

    Returns Promise<
        {
            cache: {
                getLatestResponse: () => | (
                    state: RootState,
                ) =>
                    | {
                        data?: undefined;
                        endpointName?: string;
                        error?: undefined;
                        fulfilledTimeStamp?: undefined;
                        requestId?: undefined;
                        startedTimeStamp?: undefined;
                        status: uninitialized;
                    } & {
                        isError: false;
                        isLoading: false;
                        isSuccess: false;
                        isUninitialized: true;
                        status: uninitialized;
                    }
                    | never
                    | never
                    | never
                    | never
                    | never
                    | { status: fulfilled } & Omit<
                        BaseMutationSubState<
                            MutationDefinition<(...), (...), (...), (...), (...)>,
                        >,
                        "data" | "fulfilledTimeStamp",
                    > & Required<Pick<BaseMutationSubState<(...)>, (...) | (...)>> & {
                        error: undefined;
                    } & {
                        isError: false;
                        isLoading: false;
                        isSuccess: true;
                        isUninitialized: false;
                        status: fulfilled;
                    }
                    | never
                    | never
                    | { status: pending } & BaseMutationSubState<
                        MutationDefinition<
                            any,
                            BaseQueryFn<(...), (...), (...), (...), (...)>,
                            never,
                            unknown,
                            "davinci",
                        >,
                    > & { data?: undefined } & {
                        isError: false;
                        isLoading: true;
                        isSuccess: false;
                        isUninitialized: false;
                        status: pending;
                    }
                    | never
                    | never
                    | never
                    | never
                    | never
                    | { status: rejected } & Omit<
                        BaseMutationSubState<
                            MutationDefinition<(...), (...), (...), (...), (...)>,
                        >,
                        "error",
                    > & Required<Pick<BaseMutationSubState<(...)>, "error">> & {
                        isError: true;
                        isLoading: false;
                        isSuccess: false;
                        isUninitialized: false;
                        status: rejected;
                    }
                | { error: { message: string; type: string } };
                getResponseWithId: (
                    requestId: string,
                ) =>
                    | (
                        state: RootState,
                    ) =>
                        | {
                            data?: undefined;
                            endpointName?: string;
                            error?: undefined;
                            fulfilledTimeStamp?: undefined;
                            requestId?: undefined;
                            startedTimeStamp?: undefined;
                            status: uninitialized;
                        } & {
                            isError: false;
                            isLoading: false;
                            isSuccess: false;
                            isUninitialized: true;
                            status: uninitialized;
                        }
                        | never
                        | never
                        | never
                        | never
                        | never
                        | { status: fulfilled } & Omit<
                            BaseMutationSubState<
                                MutationDefinition<(...), (...), (...), (...), (...)>,
                            >,
                            "data" | "fulfilledTimeStamp",
                        > & Required<Pick<BaseMutationSubState<(...)>, (...) | (...)>> & {
                            error: undefined;
                        } & {
                            isError: false;
                            isLoading: false;
                            isSuccess: true;
                            isUninitialized: false;
                            status: fulfilled;
                        }
                        | never
                        | never
                        | { status: pending } & BaseMutationSubState<
                            MutationDefinition<
                                any,
                                BaseQueryFn<(...), (...), (...), (...), (...)>,
                                never,
                                unknown,
                                "davinci",
                            >,
                        > & { data?: undefined } & {
                            isError: false;
                            isLoading: true;
                            isSuccess: false;
                            isUninitialized: false;
                            status: pending;
                        }
                        | never
                        | never
                        | never
                        | never
                        | never
                        | { status: rejected } & Omit<
                            BaseMutationSubState<
                                MutationDefinition<(...), (...), (...), (...), (...)>,
                            >,
                            "error",
                        > & Required<Pick<BaseMutationSubState<(...)>, "error">> & {
                            isError: true;
                            isLoading: false;
                            isSuccess: false;
                            isUninitialized: false;
                            status: rejected;
                        }
                    | { error: { message: string; type: string } };
            };
            externalIdp: (
                collector: IdpCollector,
            ) => () => void | InternalErrorResponse;
            flow: (action: DaVinciAction) => InitFlow;
            getClient: () => | null
            | {
                action: string;
                collectors: Collectors[];
                description?: string;
                name?: string;
                status: "continue";
            }
            | {
                action: string;
                collectors: Collectors[];
                description?: string;
                name?: string;
                status: "error";
            }
            | { status: "failure" }
            | { status: "start" }
            | { authorization?: { code?: string; state?: string }; status: "success" };
            getCollectors: () => Collectors[];
            getError: () => null | DaVinciError;
            getErrorCollectors: () => CollectorErrors[];
            getNode: () => | ContinueNode
            | ErrorNode
            | FailureNode
            | StartNode
            | SuccessNode;
            getServer: () => | null
            | {
                _links?: Links;
                eventName?: string;
                href?: string;
                id?: string;
                interactionId?: string;
                interactionToken?: string;
                status: "continue";
            }
            | {
                _links?: Links;
                eventName?: string;
                id?: string;
                interactionId?: string;
                interactionToken?: string;
                status: "error";
            }
            | {
                _links?: Links;
                eventName?: string;
                href?: string;
                id?: string;
                interactionId?: string;
                interactionToken?: string;
                status: "failure";
            }
            | { status: "start" }
            | {
                _links?: Links;
                eventName?: string;
                href?: string;
                id?: string;
                interactionId?: string;
                interactionToken?: string;
                session?: string;
                status: "success";
            };
            next: (
                args?: DaVinciRequest,
            ) => Promise<
                | ContinueNode
                | ErrorNode
                | FailureNode
                | StartNode
                | SuccessNode
                | {
                    cache: null;
                    client: { status: "start" };
                    error: string;
                    server: { status: "start" };
                    status: "start";
                },
            >;
            resume: (
                __namedParameters: { continueToken: string },
            ) => Promise<
                ContinueNode
                | ErrorNode
                | FailureNode
                | StartNode
                | SuccessNode,
            >;
            start: <QueryParams extends OutgoingQueryParams = OutgoingQueryParams>(
                options?: StartOptions<QueryParams>,
            ) => Promise<
                ContinueNode
                | ErrorNode
                | FailureNode
                | StartNode
                | SuccessNode,
            >;
            subscribe: (listener: ListenerCallback) => Unsubscribe;
            update: (
                collector: SingleValueCollectors | MultiSelectCollector,
            ) => Updater;
            validate: (collector: SingleValueCollectors) => Validator;
        },
    >

    • an observable client for DaVinci flows

    davinciClient - returns an "observable" client for DaVinci flows