import type { DataSourceWire } from '../types/dataSource.type'; import type { Outcome } from '../types/outcome.type'; import type { V2PageInfo } from '../types/request.type'; import { type V2PageRequest } from '../utils/piperLiteRequest.util'; export type UseV2DataSourceOptions = { /** Opt-in cursor pagination: adds `limit`/`cursor` to the request. */ page?: V2PageRequest; /** * Whether the request feeds the page's «Datos al…» stamp (default `true`). * Pass `false` for requests that are not report data, such as the options * of a filter control. */ reportDataAsOf?: boolean; }; export type UseV2DataSourceResult = { outcome: Outcome; retry: () => void; /** Only when the `page` option is given. */ page?: V2PageInfo; }; /** * Fetches a V2 data source and returns it as one `Outcome`. Sends the wire's * url and headers, and its body mapped to piper-lite's protocol * (`piperLiteRequest`), with the values of its `dependsOn` state keys (read from * `userFlow`'s entries) injected into `args`. Pieces of one `V2PageProvider` * that send the same request (url, headers, payload and `dependsOn` values) * share one request, one outcome and one `retry()`. The first piece to mount * provides the request's `userFlow` and the closure `retry()` re-runs, so all * pieces of one provider must share the same `userFlow` (one flow per page). * It refetches only when that * request changes or on `retry()`. `userFlow` is also sent with the request so * a 401 reaches the same token-refresh interceptor V1 uses; omit it only * outside a page. */ export declare const useV2DataSource: (dataSource: DataSourceWire, userFlow?: string, options?: UseV2DataSourceOptions) => UseV2DataSourceResult;