davinci<ActionType extends ActionTypes = ActionTypes>( options: { config: DaVinciConfig; logger?: { custom?: CustomLogger; level: LogLevel }; requestMiddleware?: RequestMiddleware<ActionType>[]; },): Promise< { cache: { getLatestResponse: () => | { status: fulfilled } & Omit< BaseMutationSubState< MutationDefinition< any, BaseQueryFn< (...)
| (...)
, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta, >, never, unknown, "davinci", any, >, >, "data" | "fulfilledTimeStamp", > & Required< Pick< BaseMutationSubState< MutationDefinition< any, BaseQueryFn<(...)
, (...)
, (...)
, (...)
, (...)
>, never, unknown, "davinci", any, >, >, "data" | "fulfilledTimeStamp", >, > & { error: undefined } & { isError: false; isLoading: false; isSuccess: true; isUninitialized: false; status: fulfilled; } | { status: rejected } & Omit< BaseMutationSubState< MutationDefinition< any, BaseQueryFn< (...)
| (...)
, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta, >, never, unknown, "davinci", any, >, >, "error", > & Required< Pick< BaseMutationSubState< MutationDefinition< any, BaseQueryFn<(...)
, (...)
, (...)
, (...)
, (...)
>, never, unknown, "davinci", any, >, >, "error", >, > & { isError: true; isLoading: false; isSuccess: false; isUninitialized: false; status: rejected; } | { error: { message: string; type: string } }; getResponseWithId: ( requestId: string, ) => | { status: fulfilled } & Omit< BaseMutationSubState< MutationDefinition< any, BaseQueryFn< (...)
| (...)
, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta, >, never, unknown, "davinci", any, >, >, "data" | "fulfilledTimeStamp", > & Required< Pick< BaseMutationSubState< MutationDefinition< any, BaseQueryFn<(...)
, (...)
, (...)
, (...)
, (...)
>, never, unknown, "davinci", any, >, >, "data" | "fulfilledTimeStamp", >, > & { error: undefined } & { isError: false; isLoading: false; isSuccess: true; isUninitialized: false; status: fulfilled; } | { status: rejected } & Omit< BaseMutationSubState< MutationDefinition< any, BaseQueryFn< (...)
| (...)
, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta, >, never, unknown, "davinci", any, >, >, "error", > & Required< Pick< BaseMutationSubState< MutationDefinition< any, BaseQueryFn<(...)
, (...)
, (...)
, (...)
, (...)
>, never, unknown, "davinci", any, >, >, "error", >, > & { isError: true; isLoading: false; isSuccess: false; isUninitialized: false; status: rejected; } | { error: { message: string; type: string } }; }; externalIdp: () => () => Promise<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<NodeStates>; pollStatus: (collector: PollingCollector) => Poller; resume: ( __namedParameters: { continueToken: string }, ) => Promise<InternalErrorResponse | NodeStates>; start: <QueryParams extends OutgoingQueryParams = OutgoingQueryParams>( options?: StartOptions<QueryParams>, ) => Promise< ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode, >; subscribe: (listener: ListenerCallback) => Unsubscribe; update: < T extends | SingleValueCollectors | MultiSelectCollector | ObjectValueCollectors | AutoCollectors, >( collector: T, ) => Updater<T>; validate: ( collector: | SingleValueCollectors | MultiValueCollectors | ObjectValueCollectors | AutoCollectors, ) => Validator; },> Returns Promise<
{
cache: {
getLatestResponse: () => | { status: fulfilled } & Omit<
BaseMutationSubState<
MutationDefinition<
any,
BaseQueryFn<
(...)
| (...),
unknown,
FetchBaseQueryError,
{},
FetchBaseQueryMeta,
>,
never,
unknown,
"davinci",
any,
>,
>,
"data" | "fulfilledTimeStamp",
> & Required<
Pick<
BaseMutationSubState<
MutationDefinition<
any,
BaseQueryFn<(...), (...), (...), (...), (...)>,
never,
unknown,
"davinci",
any,
>,
>,
"data" | "fulfilledTimeStamp",
>,
> & { error: undefined } & {
isError: false;
isLoading: false;
isSuccess: true;
isUninitialized: false;
status: fulfilled;
}
| { status: rejected } & Omit<
BaseMutationSubState<
MutationDefinition<
any,
BaseQueryFn<
(...)
| (...),
unknown,
FetchBaseQueryError,
{},
FetchBaseQueryMeta,
>,
never,
unknown,
"davinci",
any,
>,
>,
"error",
> & Required<
Pick<
BaseMutationSubState<
MutationDefinition<
any,
BaseQueryFn<(...), (...), (...), (...), (...)>,
never,
unknown,
"davinci",
any,
>,
>,
"error",
>,
> & {
isError: true;
isLoading: false;
isSuccess: false;
isUninitialized: false;
status: rejected;
}
| { error: { message: string; type: string } };
getResponseWithId: (
requestId: string,
) =>
| { status: fulfilled } & Omit<
BaseMutationSubState<
MutationDefinition<
any,
BaseQueryFn<
(...)
| (...),
unknown,
FetchBaseQueryError,
{},
FetchBaseQueryMeta,
>,
never,
unknown,
"davinci",
any,
>,
>,
"data" | "fulfilledTimeStamp",
> & Required<
Pick<
BaseMutationSubState<
MutationDefinition<
any,
BaseQueryFn<(...), (...), (...), (...), (...)>,
never,
unknown,
"davinci",
any,
>,
>,
"data" | "fulfilledTimeStamp",
>,
> & { error: undefined } & {
isError: false;
isLoading: false;
isSuccess: true;
isUninitialized: false;
status: fulfilled;
}
| { status: rejected } & Omit<
BaseMutationSubState<
MutationDefinition<
any,
BaseQueryFn<
(...)
| (...),
unknown,
FetchBaseQueryError,
{},
FetchBaseQueryMeta,
>,
never,
unknown,
"davinci",
any,
>,
>,
"error",
> & Required<
Pick<
BaseMutationSubState<
MutationDefinition<
any,
BaseQueryFn<(...), (...), (...), (...), (...)>,
never,
unknown,
"davinci",
any,
>,
>,
"error",
>,
> & {
isError: true;
isLoading: false;
isSuccess: false;
isUninitialized: false;
status: rejected;
}
| { error: { message: string; type: string } };
};
externalIdp: () => () => Promise<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<NodeStates>;
pollStatus: (collector: PollingCollector) => Poller;
resume: (
__namedParameters: { continueToken: string },
) => Promise<InternalErrorResponse | NodeStates>;
start: <QueryParams extends OutgoingQueryParams = OutgoingQueryParams>(
options?: StartOptions<QueryParams>,
) => Promise<
ContinueNode
| ErrorNode
| FailureNode
| StartNode
| SuccessNode,
>;
subscribe: (listener: ListenerCallback) => Unsubscribe;
update: <
T extends
| SingleValueCollectors
| MultiSelectCollector
| ObjectValueCollectors
| AutoCollectors,
>(
collector: T,
) => Updater<T>;
validate: (
collector:
| SingleValueCollectors
| MultiValueCollectors
| ObjectValueCollectors
| AutoCollectors,
) => Validator;
},
>
- an observable client for DaVinci flows
Create a client function that returns a set of methods to interact with and normalize the DaVinci API.