(
path: TApiPath,
...[
{staleTime, path: pathParams, ...options},
]: ExtractPathParams<TApiPath> extends never
? [Options & {path?: never}]
: [Options & PathParamOptions<TApiPath>]
)
| 82 | } |
| 83 | |
| 84 | function _apiOptionsInfinite< |
| 85 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters |
| 86 | TManualData = never, |
| 87 | TApiPath extends KnownApiUrls = KnownApiUrls, |
| 88 | // todo: infer the actual data type from the ApiMapping |
| 89 | TActualData = TManualData, |
| 90 | >( |
| 91 | path: TApiPath, |
| 92 | ...[ |
| 93 | {staleTime, path: pathParams, ...options}, |
| 94 | ]: ExtractPathParams<TApiPath> extends never |
| 95 | ? [Options & {path?: never}] |
| 96 | : [Options & PathParamOptions<TApiPath>] |
| 97 | ) { |
| 98 | const url = getApiUrl(path, ...([{path: pathParams}] as OptionalPathParams<TApiPath>)); |
| 99 | const strippedOptions = stripUndefinedValues(options); |
| 100 | |
| 101 | return infiniteQueryOptions({ |
| 102 | queryKey: [url, strippedOptions, {infinite: true}] as const, |
| 103 | queryFn: pathParams === skipToken ? skipToken : apiFetchInfinite<TActualData>, |
| 104 | getPreviousPageParam: parsePageParam('previous'), |
| 105 | getNextPageParam: parsePageParam('next'), |
| 106 | initialPageParam: undefined, |
| 107 | enabled: pathParams !== skipToken, |
| 108 | staleTime, |
| 109 | }); |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Type-safe factory for TanStack Query options that hit Sentry API endpoints. |
no test coverage detected