UNPKG

72.6 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../../src/query/react/index.ts","../../../src/query/react/buildHooks.ts","../../../src/query/react/useShallowStableValue.ts","../../../src/query/react/constants.ts","../../../src/query/endpointDefinitions.ts","../../../src/query/utils/capitalize.ts","../../../src/query/tsHelpers.ts","../../../src/query/react/module.ts","../../../src/query/react/ApiProvider.tsx","rtk-query-react.cjs.development.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAA,CAAA,OAAA,CAAA,CAAA;AAAA,QAAA,CAAA,OAAA,EAAA;IAAA,WAAA,EAAA,cAAA,OAAA,WAAA,EAAA,CAAA;IAAA,SAAA,EAAA,cAAA,OAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,EAAA,cAAA,OAAA,gBAAA,EAAA,CAAA;CAAA,CAAA,CAAA;AAAA,IAAA,aAAA,GAAsD,UAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,CAAA,CAAA;;ACCtD,IAAA,cAAA,GAA+B,UAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,CAAA,CAAA;AAC/B,IAAA,aAAA,GAOO,UAAA,CAAA,OAAA,CAAA,OAAA,CAAA,CAAA,CAAA;AACP,IAAA,YAAA,GAAuC,UAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,CAAA,CAAA;AAuBvC,IAAA,mBAAA,GAA6B,UAAA,CAAA,OAAA,CAAA,aAAA,CAAA,CAAA,CAAA;;ACjC7B,IAAA,YAAA,GAAkC,UAAA,CAAA,OAAA,CAAA,OAAA,CAAA,CAAA,CAAA;AAClC,IAAA,kBAAA,GAA6B,UAAA,CAAA,OAAA,CAAA,aAAA,CAAA,CAAA,CAAA;AAEtB,SAAA,qBAAA,CAAkC,KAAA;IACvC,IAAM,KAAA,GAAQ,CAAA,CAAA,EAAA,YAAA,CAAA,MAAA,CAAA,CAAO,KAAA,CAAA,CAAA;IACrB,CAAA,CAAA,EA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\nimport { reactHooksModule, reactHooksModuleName } from './module'\r\n\r\nimport type { MutationHooks, QueryHooks } from './buildHooks'\r\nimport type {\r\n EndpointDefinitions,\r\n QueryDefinition,\r\n MutationDefinition,\r\n QueryArgFrom,\r\n} from '@reduxjs/toolkit/dist/query/endpointDefinitions'\r\nimport type { BaseQueryFn } from '@reduxjs/toolkit/dist/query/baseQueryTypes'\r\n\r\nimport type { QueryKeys } from '@reduxjs/toolkit/dist/query/core/apiState'\r\nimport type { PrefetchOptions } from '@reduxjs/toolkit/dist/query/core/module'\r\n\r\nexport * from '@reduxjs/toolkit/query'\r\nexport { ApiProvider } from './ApiProvider'\r\n\r\nconst createApi = /* @__PURE__ */ buildCreateApi(\r\n coreModule(),\r\n reactHooksModule()\r\n)\r\n\r\nexport { createApi, reactHooksModule }\r\n","import type { AnyAction, ThunkAction, ThunkDispatch } from '@reduxjs/toolkit'\r\nimport { createSelector } from '@reduxjs/toolkit'\r\nimport {\r\n useCallback,\r\n useEffect,\r\n useLayoutEffect,\r\n useMemo,\r\n useRef,\r\n useState,\r\n} from 'react'\r\nimport { QueryStatus, skipToken } from '@reduxjs/toolkit/query'\r\nimport type {\r\n QuerySubState,\r\n SubscriptionOptions,\r\n QueryKeys,\r\n RootState,\r\n} from '@reduxjs/toolkit/dist/query/core/apiState'\r\nimport type {\r\n EndpointDefinitions,\r\n MutationDefinition,\r\n QueryDefinition,\r\n QueryArgFrom,\r\n ResultTypeFrom,\r\n} from '@reduxjs/toolkit/dist/query/endpointDefinitions'\r\nimport type {\r\n QueryResultSelectorResult,\r\n MutationResultSelectorResult,\r\n SkipToken,\r\n} from '@reduxjs/toolkit/dist/query/core/buildSelectors'\r\nimport type {\r\n QueryActionCreatorResult,\r\n MutationActionCreatorResult,\r\n} from '@reduxjs/toolkit/dist/query/core/buildInitiate'\r\nimport { shallowEqual } from 'react-redux'\r\nimport type { Api } from '@reduxjs/toolkit/dist/query/apiTypes'\r\nimport type {\r\n Id,\r\n NoInfer,\r\n Override,\r\n} from '@reduxjs/toolkit/dist/query/tsHelpers'\r\nimport type {\r\n ApiEndpointMutation,\r\n ApiEndpointQuery,\r\n CoreModule,\r\n PrefetchOptions,\r\n} from '@reduxjs/toolkit/dist/query/core/module'\r\nimport type { ReactHooksModuleOptions } from './module'\r\nimport { useShallowStableValue } from './useShallowStableValue'\r\nimport type { UninitializedValue } from './constants'\r\nimport { UNINITIALIZED_VALUE } from './constants'\r\n\r\n// Copy-pasted from React-Redux\r\nexport const useIsomorphicLayoutEffect =\r\n typeof window !== 'undefined' &&\r\n typeof window.document !== 'undefined' &&\r\n typeof window.document.createElement !== 'undefined'\r\n ? useLayoutEffect\r\n : useEffect\r\n\r\nexport interface QueryHooks<\r\n Definition extends QueryDefinition<any, any, any, any, any>\r\n> {\r\n useQuery: UseQuery<Definition>\r\n useLazyQuery: UseLazyQuery<Definition>\r\n useQuerySubscription: UseQuerySubscription<Definition>\r\n useLazyQuerySubscription: UseLazyQuerySubscription<Definition>\r\n useQueryState: UseQueryState<Definition>\r\n}\r\n\r\nexport interface MutationHooks<\r\n Definition extends MutationDefinition<any, any, any, any, any>\r\n> {\r\n useMutation: UseMutation<Definition>\r\n}\r\n\r\n/**\r\n * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\r\n *\r\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.\r\n *\r\n * This hook combines the functionality of both [`useQueryState`](#usequerystate) and [`useQuerySubscription`](#usequerysubscription) together, and is intended to be used in the majority of situations.\r\n *\r\n * #### Features\r\n *\r\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\r\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\r\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\r\n * - Returns the latest request status and cached data from the Redux store\r\n * - Re-renders as the request status changes and data becomes available\r\n */\r\nexport type UseQuery<D extends QueryDefinition<any, any, any, any>> = <\r\n R extends Record<string, any> = UseQueryStateDefaultResult<D>\r\n>(\r\n arg: QueryArgFrom<D> | SkipToken,\r\n options?: UseQuerySubscriptionOptions & UseQueryStateOptions<D, R>\r\n) => UseQueryStateResult<D, R> & ReturnType<UseQuerySubscription<D>>\r\n\r\ninterface UseQuerySubscriptionOptions extends SubscriptionOptions {\r\n /**\r\n * Prevents a query from automatically running.\r\n *\r\n * @remarks\r\n * When `skip` is true (or `skipToken` is passed in as `arg`):\r\n *\r\n * - **If the query has cached data:**\r\n * * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\r\n * * The query will have a status of `uninitialized`\r\n * * If `skip: false` is set after skipping the initial load, the cached result will be used\r\n * - **If the query does not have cached data:**\r\n * * The query will have a status of `uninitialized`\r\n * * The query will not exist in the state when viewed with the dev tools\r\n * * The query will not automatically fetch on mount\r\n * * The query will not automatically run when additional components with the same query are added that do run\r\n *\r\n * @example\r\n * ```tsx\r\n * // codeblock-meta title=\"Skip example\"\r\n * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\r\n * const { data, error, status } = useGetPokemonByNameQuery(name, {\r\n * skip,\r\n * });\r\n *\r\n * return (\r\n * <div>\r\n * {name} - {status}\r\n * </div>\r\n * );\r\n * };\r\n * ```\r\n */\r\n skip?: boolean\r\n /**\r\n * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\r\n * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\r\n * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\r\n * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\r\n *\r\n * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\r\n */\r\n refetchOnMountOrArgChange?: boolean | number\r\n}\r\n\r\n/**\r\n * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data.\r\n *\r\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.\r\n *\r\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useQuery`](#usequery) or [`useQueryState`](#usequerystate).\r\n *\r\n * #### Features\r\n *\r\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\r\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\r\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\r\n */\r\nexport type UseQuerySubscription<\r\n D extends QueryDefinition<any, any, any, any>\r\n> = (\r\n arg: QueryArgFrom<D> | SkipToken,\r\n options?: UseQuerySubscriptionOptions\r\n) => Pick<QueryActionCreatorResult<D>, 'refetch'>\r\n\r\nexport type UseLazyQueryLastPromiseInfo<\r\n D extends QueryDefinition<any, any, any, any>\r\n> = {\r\n lastArg: QueryArgFrom<D>\r\n}\r\n\r\n/**\r\n * A React hook similar to [`useQuery`](#usequery), but with manual control over when the data fetching occurs.\r\n *\r\n * This hook includes the functionality of [`useLazyQuerySubscription`](#uselazyquerysubscription).\r\n *\r\n * #### Features\r\n *\r\n * - Manual control over firing a request to retrieve data\r\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\r\n * - Returns the latest request status and cached data from the Redux store\r\n * - Re-renders as the request status changes and data becomes available\r\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\r\n *\r\n * #### Note\r\n *\r\n * When the trigger function returned from a LazyQuery, it always initiates a new request to the server even if there is cached data. Set `preferCacheValue`(the second argument to the function) as true if you want it to use cache.\r\n */\r\nexport type UseLazyQuery<D extends QueryDefinition<any, any, any, any>> = <\r\n R = UseQueryStateDefaultResult<D>\r\n>(\r\n options?: SubscriptionOptions & Omit<UseQueryStateOptions<D, R>, 'skip'>\r\n) => [\r\n LazyQueryTrigger<D>,\r\n UseQueryStateResult<D, R>,\r\n UseLazyQueryLastPromiseInfo<D>\r\n]\r\n\r\nexport type LazyQueryTrigger<D extends QueryDefinition<any, any, any, any>> = {\r\n /**\r\n * Triggers a lazy query.\r\n *\r\n * By default, this will start a new request even if there is already a value in the cache.\r\n * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.\r\n */\r\n (arg: QueryArgFrom<D>, preferCacheValue?: boolean): void\r\n}\r\n\r\n/**\r\n * A React hook similar to [`useQuerySubscription`](#usequerysubscription), but with manual control over when the data fetching occurs.\r\n *\r\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useLazyQuery`](#uselazyquery).\r\n *\r\n * #### Features\r\n *\r\n * - Manual control over firing a request to retrieve data\r\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\r\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\r\n */\r\nexport type UseLazyQuerySubscription<\r\n D extends QueryDefinition<any, any, any, any>\r\n> = (\r\n options?: SubscriptionOptions\r\n) => [(arg: QueryArgFrom<D>) => void, QueryArgFrom<D> | UninitializedValue]\r\n\r\nexport type QueryStateSelector<\r\n R extends Record<string, any>,\r\n D extends QueryDefinition<any, any, any, any>\r\n> = (state: UseQueryStateDefaultResult<D>) => R\r\n\r\n/**\r\n * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\r\n *\r\n * Note that this hook does not trigger fetching new data. For that use-case, see [`useQuery`](#usequery) or [`useQuerySubscription`](#usequerysubscription).\r\n *\r\n * #### Features\r\n *\r\n * - Returns the latest request status and cached data from the Redux store\r\n * - Re-renders as the request status changes and data becomes available\r\n */\r\nexport type UseQueryState<D extends QueryDefinition<any, any, any, any>> = <\r\n R = UseQueryStateDefaultResult<D>\r\n>(\r\n arg: QueryArgFrom<D> | SkipToken,\r\n options?: UseQueryStateOptions<D, R>\r\n) => UseQueryStateResult<D, R>\r\n\r\nexport type UseQueryStateOptions<\r\n D extends QueryDefinition<any, any, any, any>,\r\n R extends Record<string, any>\r\n> = {\r\n /**\r\n * Prevents a query from automatically running.\r\n *\r\n * @remarks\r\n * When skip is true:\r\n *\r\n * - **If the query has cached data:**\r\n * * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\r\n * * The query will have a status of `uninitialized`\r\n * * If `skip: false` is set after skipping the initial load, the cached result will be used\r\n * - **If the query does not have cached data:**\r\n * * The query will have a status of `uninitialized`\r\n * * The query will not exist in the state when viewed with the dev tools\r\n * * The query will not automatically fetch on mount\r\n * * The query will not automatically run when additional components with the same query are added that do run\r\n *\r\n * @example\r\n * ```ts\r\n * // codeblock-meta title=\"Skip example\"\r\n * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\r\n * const { data, error, status } = useGetPokemonByNameQuery(name, {\r\n * skip,\r\n * });\r\n *\r\n * return (\r\n * <div>\r\n * {name} - {status}\r\n * </div>\r\n * );\r\n * };\r\n * ```\r\n */\r\n skip?: boolean\r\n /**\r\n * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.\r\n * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.\r\n * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.\r\n *\r\n * @example\r\n * ```ts\r\n * // codeblock-meta title=\"Using selectFromResult to extract a single result\"\r\n * function PostsList() {\r\n * const { data: posts } = api.useGetPostsQuery();\r\n *\r\n * return (\r\n * <ul>\r\n * {posts?.data?.map((post) => (\r\n * <PostById key={post.id} id={post.id} />\r\n * ))}\r\n * </ul>\r\n * );\r\n * }\r\n *\r\n * function PostById({ id }: { id: number }) {\r\n * // Will select the post with the given id, and will only rerender if the given posts data changes\r\n * const { post } = api.useGetPostsQuery(undefined, {\r\n * selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),\r\n * });\r\n *\r\n * return <li>{post?.name}</li>;\r\n * }\r\n * ```\r\n */\r\n selectFromResult?: QueryStateSelector<R, D>\r\n}\r\n\r\nexport type UseQueryStateResult<\r\n _ extends QueryDefinition<any, any, any, any>,\r\n R\r\n> = NoInfer<R>\r\n\r\ntype UseQueryStateBaseResult<D extends QueryDefinition<any, any, any, any>> =\r\n QuerySubState<D> & {\r\n /**\r\n * Query has not started yet.\r\n */\r\n isUninitialized: false\r\n /**\r\n * Query is currently loading for the first time. No data yet.\r\n */\r\n isLoading: false\r\n /**\r\n * Query is currently fetching, but might have data from an earlier request.\r\n */\r\n isFetching: false\r\n /**\r\n * Query has data from a successful load.\r\n */\r\n isSuccess: false\r\n /**\r\n * Query is currently in \"error\" state.\r\n */\r\n isError: false\r\n }\r\n\r\ntype UseQueryStateDefaultResult<D extends QueryDefinition<any, any, any, any>> =\r\n Id<\r\n | Override<\r\n Extract<\r\n UseQueryStateBaseResult<D>,\r\n { status: QueryStatus.uninitialized }\r\n >,\r\n { isUninitialized: true }\r\n >\r\n | Override<\r\n UseQueryStateBaseResult<D>,\r\n | { isLoading: true; isFetching: boolean; data: undefined }\r\n | ({\r\n isSuccess: true\r\n isFetching: boolean\r\n error: undefined\r\n } & Required<\r\n Pick<UseQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp'>\r\n >)\r\n | ({ isError: true } & Required<\r\n Pick<UseQueryStateBaseResult<D>, 'error'>\r\n >)\r\n >\r\n > & {\r\n /**\r\n * @deprecated will be removed in the next version\r\n * please use the `isLoading`, `isFetching`, `isSuccess`, `isError`\r\n * and `isUninitialized` flags instead\r\n */\r\n status: QueryStatus\r\n }\r\n\r\nexport type MutationStateSelector<\r\n R extends Record<string, any>,\r\n D extends MutationDefinition<any, any, any, any>\r\n> = (state: MutationResultSelectorResult<D>) => R\r\n\r\nexport type UseMutationStateOptions<\r\n D extends MutationDefinition<any, any, any, any>,\r\n R extends Record<string, any>\r\n> = {\r\n selectFromResult?: MutationStateSelector<R, D>\r\n}\r\n\r\nexport type UseMutationStateResult<\r\n D extends MutationDefinition<any, any, any, any>,\r\n R\r\n> = NoInfer<R> & {\r\n originalArgs?: QueryArgFrom<D>\r\n}\r\n\r\n/**\r\n * A React hook that lets you trigger an update request for a given endpoint, and subscribes the component to read the request status from the Redux store. The component will re-render as the loading status changes.\r\n *\r\n * #### Features\r\n *\r\n * - Manual control over firing a request to alter data on the server or possibly invalidate the cache\r\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\r\n * - Returns the latest request status and cached data from the Redux store\r\n * - Re-renders as the request status changes and data becomes available\r\n */\r\nexport type UseMutation<D extends MutationDefinition<any, any, any, any>> = <\r\n R extends Record<string, any> = MutationResultSelectorResult<D>\r\n>(\r\n options?: UseMutationStateOptions<D, R>\r\n) => [\r\n (arg: QueryArgFrom<D>) => MutationActionCreatorResult<D>,\r\n UseMutationStateResult<D, R>\r\n]\r\n\r\nconst defaultQueryStateSelector: QueryStateSelector<any, any> = (x) => x\r\nconst defaultMutationStateSelector: MutationStateSelector<any, any> = (x) => x\r\n\r\nconst queryStatePreSelector = (\r\n currentState: QueryResultSelectorResult<any>,\r\n lastResult: UseQueryStateDefaultResult<any>\r\n): UseQueryStateDefaultResult<any> => {\r\n // data is the last known good request result we have tracked - or if none has been tracked yet the last good result for the current args\r\n let data = currentState.isSuccess ? currentState.data : lastResult?.data\r\n if (data === undefined) data = currentState.data\r\n\r\n const hasData = data !== undefined\r\n\r\n // isFetching = true any time a request is in flight\r\n const isFetching = currentState.isLoading\r\n // isLoading = true only when loading while no data is present yet (initial load with no data in the cache)\r\n const isLoading = !hasData && isFetching\r\n // isSuccess = true when data is present\r\n const isSuccess = currentState.isSuccess || (isFetching && hasData)\r\n\r\n return {\r\n ...currentState,\r\n data,\r\n isFetching,\r\n isLoading,\r\n isSuccess,\r\n } as UseQueryStateDefaultResult<any>\r\n}\r\n\r\n/**\r\n * Wrapper around `defaultQueryStateSelector` to be used in `useQuery`.\r\n * We want the initial render to already come back with\r\n * `{ isUninitialized: false, isFetching: true, isLoading: true }`\r\n * to prevent that the library user has to do an additional check for `isUninitialized`/\r\n */\r\nconst noPendingQueryStateSelector: QueryStateSelector<any, any> = (\r\n selected\r\n) => {\r\n if (selected.isUninitialized) {\r\n return {\r\n ...selected,\r\n isUninitialized: false,\r\n isFetching: true,\r\n isLoading: selected.data !== undefined ? false : true,\r\n status: QueryStatus.pending,\r\n } as any\r\n }\r\n return selected\r\n}\r\n\r\ntype GenericPrefetchThunk = (\r\n endpointName: any,\r\n arg: any,\r\n options: PrefetchOptions\r\n) => ThunkAction<void, any, any, AnyAction>\r\n\r\n/**\r\n *\r\n * @param opts.api - An API with defined endpoints to create hooks for\r\n * @param opts.moduleOptions.batch - The version of the `batchedUpdates` function to be used\r\n * @param opts.moduleOptions.useDispatch - The version of the `useDispatch` hook to be used\r\n * @param opts.moduleOptions.useSelector - The version of the `useSelector` hook to be used\r\n * @returns An object containing functions to generate hooks based on an endpoint\r\n */\r\nexport function buildHooks<Definitions extends EndpointDefinitions>({\r\n api,\r\n moduleOptions: { batch, useDispatch, useSelector, useStore },\r\n}: {\r\n api: Api<any, Definitions, any, any, CoreModule>\r\n moduleOptions: Required<ReactHooksModuleOptions>\r\n}) {\r\n return { buildQueryHooks, buildMutationHook, usePrefetch }\r\n\r\n function usePrefetch<EndpointName extends QueryKeys<Definitions>>(\r\n endpointName: EndpointName,\r\n defaultOptions?: PrefetchOptions\r\n ) {\r\n const dispatch = useDispatch<ThunkDispatch<any, any, AnyAction>>()\r\n const stableDefaultOptions = useShallowStableValue(defaultOptions)\r\n\r\n return useCallback(\r\n (arg: any, options?: PrefetchOptions) =>\r\n dispatch(\r\n (api.util.prefetch as GenericPrefetchThunk)(endpointName, arg, {\r\n ...stableDefaultOptions,\r\n ...options,\r\n })\r\n ),\r\n [endpointName, dispatch, stableDefaultOptions]\r\n )\r\n }\r\n\r\n function buildQueryHooks(name: string): QueryHooks<any> {\r\n const useQuerySubscription: UseQuerySubscription<any> = (\r\n arg: any,\r\n {\r\n refetchOnReconnect,\r\n refetchOnFocus,\r\n refetchOnMountOrArgChange,\r\n skip = false,\r\n pollingInterval = 0,\r\n } = {}\r\n ) => {\r\n const { initiate } = api.endpoints[name] as ApiEndpointQuery<\r\n QueryDefinition<any, any, any, any, any>,\r\n Definitions\r\n >\r\n const dispatch = useDispatch<ThunkDispatch<any, any, AnyAction>>()\r\n const stableArg = useShallowStableValue(skip ? skipToken : arg)\r\n const stableSubscriptionOptions = useShallowStableValue({\r\n refetchOnReconnect,\r\n refetchOnFocus,\r\n pollingInterval,\r\n })\r\n\r\n const promiseRef = useRef<QueryActionCreatorResult<any>>()\r\n\r\n useEffect(() => {\r\n const lastPromise = promiseRef.current\r\n\r\n if (stableArg === skipToken) {\r\n lastPromise?.unsubscribe()\r\n promiseRef.current = undefined\r\n return\r\n }\r\n\r\n const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions\r\n\r\n if (!lastPromise || lastPromise.arg !== stableArg) {\r\n lastPromise?.unsubscribe()\r\n const promise = dispatch(\r\n initiate(stableArg, {\r\n subscriptionOptions: stableSubscriptionOptions,\r\n forceRefetch: refetchOnMountOrArgChange,\r\n })\r\n )\r\n promiseRef.current = promise\r\n } else if (stableSubscriptionOptions !== lastSubscriptionOptions) {\r\n lastPromise.updateSubscriptionOptions(stableSubscriptionOptions)\r\n }\r\n }, [\r\n dispatch,\r\n initiate,\r\n refetchOnMountOrArgChange,\r\n stableArg,\r\n stableSubscriptionOptions,\r\n ])\r\n\r\n useEffect(() => {\r\n return () => {\r\n promiseRef.current?.unsubscribe()\r\n promiseRef.current = undefined\r\n }\r\n }, [])\r\n\r\n return useMemo(\r\n () => ({\r\n /**\r\n * A method to manually refetch data for the query\r\n */\r\n refetch: () => void promiseRef.current?.refetch(),\r\n }),\r\n []\r\n )\r\n }\r\n\r\n const useLazyQuerySubscription: UseLazyQuerySubscription<any> = ({\r\n refetchOnReconnect,\r\n refetchOnFocus,\r\n pollingInterval = 0,\r\n } = {}) => {\r\n const { initiate } = api.endpoints[name] as ApiEndpointQuery<\r\n QueryDefinition<any, any, any, any, any>,\r\n Definitions\r\n >\r\n const dispatch = useDispatch<ThunkDispatch<any, any, AnyAction>>()\r\n\r\n const [arg, setArg] = useState<any>(UNINITIALIZED_VALUE)\r\n const promiseRef = useRef<QueryActionCreatorResult<any> | undefined>()\r\n\r\n const stableSubscriptionOptions = useShallowStableValue({\r\n refetchOnReconnect,\r\n refetchOnFocus,\r\n pollingInterval,\r\n })\r\n\r\n useEffect(() => {\r\n const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions\r\n\r\n if (stableSubscriptionOptions !== lastSubscriptionOptions) {\r\n promiseRef.current?.updateSubscriptionOptions(\r\n stableSubscriptionOptions\r\n )\r\n }\r\n }, [stableSubscriptionOptions])\r\n\r\n const subscriptionOptionsRef = useRef(stableSubscriptionOptions)\r\n useEffect(() => {\r\n subscriptionOptionsRef.current = stableSubscriptionOptions\r\n }, [stableSubscriptionOptions])\r\n\r\n const trigger = useCallback(\r\n function (arg: any, preferCacheValue = false) {\r\n batch(() => {\r\n promiseRef.current?.unsubscribe()\r\n\r\n promiseRef.current = dispatch(\r\n initiate(arg, {\r\n subscriptionOptions: subscriptionOptionsRef.current,\r\n forceRefetch: !preferCacheValue,\r\n })\r\n )\r\n setArg(arg)\r\n })\r\n },\r\n [dispatch, initiate]\r\n )\r\n\r\n /* cleanup on unmount */\r\n useEffect(() => {\r\n return () => {\r\n promiseRef?.current?.unsubscribe()\r\n }\r\n }, [])\r\n\r\n /* if \"cleanup on unmount\" was triggered from a fast refresh, we want to reinstate the query */\r\n useEffect(() => {\r\n if (arg !== UNINITIALIZED_VALUE && !promiseRef.current) {\r\n trigger(arg, true)\r\n }\r\n }, [arg, trigger])\r\n\r\n return useMemo(() => [trigger, arg], [trigger, arg])\r\n }\r\n\r\n const useQueryState: UseQueryState<any> = (\r\n arg: any,\r\n { skip = false, selectFromResult = defaultQueryStateSelector } = {}\r\n ) => {\r\n const { select } = api.endpoints[name] as ApiEndpointQuery<\r\n QueryDefinition<any, any, any, any, any>,\r\n Definitions\r\n >\r\n const stableArg = useShallowStableValue(skip ? skipToken : arg)\r\n\r\n const lastValue = useRef<any>()\r\n\r\n const selectDefaultResult = useMemo(\r\n () =>\r\n createSelector(\r\n [select(stableArg), (_: any, lastResult: any) => lastResult],\r\n queryStatePreSelector\r\n ),\r\n [select, stableArg]\r\n )\r\n\r\n const querySelector = useMemo(\r\n () => createSelector([selectDefaultResult], selectFromResult),\r\n [selectDefaultResult, selectFromResult]\r\n )\r\n\r\n const currentState = useSelector(\r\n (state: RootState<Definitions, any, any>) =>\r\n querySelector(state, lastValue.current),\r\n shallowEqual\r\n )\r\n\r\n const store = useStore()\r\n const newLastValue = selectDefaultResult(\r\n store.getState(),\r\n lastValue.current\r\n )\r\n useIsomorphicLayoutEffect(() => {\r\n lastValue.current = newLastValue\r\n }, [newLastValue])\r\n\r\n return currentState\r\n }\r\n\r\n return {\r\n useQueryState,\r\n useQuerySubscription,\r\n useLazyQuerySubscription,\r\n useLazyQuery(options) {\r\n const [trigger, arg] = useLazyQuerySubscription(options)\r\n const queryStateResults = useQueryState(arg, {\r\n ...options,\r\n skip: arg === UNINITIALIZED_VALUE,\r\n })\r\n\r\n const info = useMemo(() => ({ lastArg: arg }), [arg])\r\n return useMemo(\r\n () => [trigger, queryStateResults, info],\r\n [trigger, queryStateResults, info]\r\n )\r\n },\r\n useQuery(arg, options) {\r\n const querySubscriptionResults = useQuerySubscription(arg, options)\r\n const queryStateResults = useQueryState(arg, {\r\n selectFromResult:\r\n arg === skipToken || options?.skip\r\n ? undefined\r\n : noPendingQueryStateSelector,\r\n ...options,\r\n })\r\n return useMemo(\r\n () => ({ ...queryStateResults, ...querySubscriptionResults }),\r\n [queryStateResults, querySubscriptionResults]\r\n )\r\n },\r\n }\r\n }\r\n\r\n function buildMutationHook(name: string): UseMutation<any> {\r\n return ({ selectFromResult = defaultMutationStateSelector } = {}) => {\r\n const { select, initiate } = api.endpoints[name] as ApiEndpointMutation<\r\n MutationDefinition<any, any, any, any, any>,\r\n Definitions\r\n >\r\n const dispatch = useDispatch<ThunkDispatch<any, any, AnyAction>>()\r\n const [requestId, setRequestId] = useState<string>()\r\n\r\n const promiseRef = useRef<MutationActionCreatorResult<any>>()\r\n\r\n useEffect(() => {\r\n return () => {\r\n promiseRef.current?.unsubscribe()\r\n promiseRef.current = undefined\r\n }\r\n }, [])\r\n\r\n const triggerMutation = useCallback(\r\n function (arg) {\r\n let promise: MutationActionCreatorResult<any>\r\n batch(() => {\r\n promiseRef?.current?.unsubscribe()\r\n promise = dispatch(initiate(arg))\r\n promiseRef.current = promise\r\n setRequestId(promise.requestId)\r\n })\r\n return promise!\r\n },\r\n [dispatch, initiate]\r\n )\r\n\r\n const mutationSelector = useMemo(\r\n () =>\r\n createSelector([select(requestId || skipToken)], (subState) =>\r\n selectFromResult(subState)\r\n ),\r\n [select, requestId, selectFromResult]\r\n )\r\n\r\n const currentState = useSelector(mutationSelector, shallowEqual)\r\n const originalArgs = promiseRef.current?.arg.originalArgs\r\n const finalState = useMemo(\r\n () => ({\r\n ...currentState,\r\n originalArgs,\r\n }),\r\n [currentState, originalArgs]\r\n )\r\n\r\n return useMemo(\r\n () => [triggerMutation, finalState],\r\n [triggerMutation, finalState]\r\n )\r\n }\r\n }\r\n}\r\n","import { useEffect, useRef } from 'react'\r\nimport { shallowEqual } from 'react-redux'\r\n\r\nexport function useShallowStableValue<T>(value: T) {\r\n const cache = useRef(value)\r\n useEffect(() => {\r\n if (!shallowEqual(cache.current, value)) {\r\n cache.current = value\r\n }\r\n }, [value])\r\n\r\n return shallowEqual(cache.current, value) ? cache.current : value\r\n}\r\n","export const UNINITIALIZED_VALUE = Symbol()\r\nexport type UninitializedValue = typeof UNINITIALIZED_VALUE\r\n","import type { AnyAction, ThunkDispatch } from '@reduxjs/toolkit'\r\nimport type { RootState } from './core/apiState'\r\nimport type {\r\n BaseQueryExtraOptions,\r\n BaseQueryFn,\r\n BaseQueryResult,\r\n BaseQueryArg,\r\n BaseQueryApi,\r\n QueryReturnValue,\r\n BaseQueryError,\r\n BaseQueryMeta,\r\n} from './baseQueryTypes'\r\nimport type {\r\n HasRequiredProps,\r\n MaybePromise,\r\n OmitFromUnion,\r\n CastAny,\r\n} from './tsHelpers'\r\nimport type { NEVER } from './fakeBaseQuery'\r\n\r\nconst resultType = /* @__PURE__ */ Symbol()\r\nconst baseQuery = /* @__PURE__ */ Symbol()\r\n\r\ninterface EndpointDefinitionWithQuery<\r\n QueryArg,\r\n BaseQuery extends BaseQueryFn,\r\n ResultType\r\n> {\r\n /**\r\n * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\r\n *\r\n * @example\r\n *\r\n * ```ts\r\n * // codeblock-meta title=\"query example\"\r\n *\r\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\r\n * interface Post {\r\n * id: number\r\n * name: string\r\n * }\r\n * type PostsResponse = Post[]\r\n *\r\n * const api = createApi({\r\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\r\n * endpoints: (build) => ({\r\n * getPosts: build.query<PostsResponse, void>({\r\n * // highlight-start\r\n * query: () => 'posts',\r\n * // highlight-end\r\n * })\r\n * })\r\n * })\r\n * ```\r\n */\r\n query(arg: QueryArg): BaseQueryArg<BaseQuery>\r\n queryFn?: never\r\n /**\r\n * A function to manipulate the data returned by a query or mutation.\r\n */\r\n transformResponse?(\r\n baseQueryReturnValue: BaseQueryResult<BaseQuery>,\r\n meta: BaseQueryMeta<BaseQuery>\r\n ): ResultType | Promise<ResultType>\r\n}\r\n\r\ninterface EndpointDefinitionWithQueryFn<\r\n QueryArg,\r\n BaseQuery extends BaseQueryFn,\r\n ResultType\r\n> {\r\n /**\r\n * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\r\n *\r\n * @example\r\n * ```ts\r\n * // codeblock-meta title=\"Basic queryFn example\"\r\n *\r\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\r\n * interface Post {\r\n * id: number\r\n * name: string\r\n * }\r\n * type PostsResponse = Post[]\r\n *\r\n * const api = createApi({\r\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\r\n * endpoints: (build) => ({\r\n * getPosts: build.query<PostsResponse, void>({\r\n * query: () => 'posts',\r\n * }),\r\n * flipCoin: build.query<'heads' | 'tails', void>({\r\n * // highlight-start\r\n * queryFn(arg, queryApi, extraOptions, baseQuery) {\r\n * const randomVal = Math.random()\r\n * if (randomVal < 0.45) {\r\n * return { data: 'heads' }\r\n * }\r\n * if (randomVal < 0.9) {\r\n * return { data: 'tails' }\r\n * }\r\n * return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on it's edge!\" } }\r\n * }\r\n * // highlight-end\r\n * })\r\n * })\r\n * })\r\n * ```\r\n */\r\n queryFn(\r\n arg: QueryArg,\r\n api: BaseQueryApi,\r\n extraOptions: BaseQueryExtraOptions<BaseQuery>,\r\n baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>\r\n ): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>>>\r\n query?: never\r\n transformResponse?: never\r\n}\r\n\r\nexport type BaseEndpointDefinition<\r\n QueryArg,\r\n BaseQuery extends BaseQueryFn,\r\n ResultType\r\n> = (\r\n | ([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER]\r\n ? never\r\n : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType>)\r\n | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>\r\n) & {\r\n /* phantom type */\r\n [resultType]?: ResultType\r\n /* phantom type */\r\n [baseQuery]?: BaseQuery\r\n} & HasRequiredProps<\r\n BaseQueryExtraOptions<BaseQuery>,\r\n { extraOptions: BaseQueryExtraOptions<BaseQuery> },\r\n { extraOptions?: BaseQueryExtraOptions<BaseQuery> }\r\n >\r\n\r\nexport enum DefinitionType {\r\n query = 'query',\r\n mutation = 'mutation',\r\n}\r\n\r\nexport type GetResultDescriptionFn<\r\n TagTypes extends string,\r\n ResultType,\r\n QueryArg,\r\n ErrorType\r\n> = (\r\n result: ResultType | undefined,\r\n error: ErrorType | undefined,\r\n arg: QueryArg\r\n) => ReadonlyArray<TagDescription<TagTypes>>\r\n\r\nexport type FullTagDescription<TagType> = {\r\n type: TagType\r\n id?: number | string\r\n}\r\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>\r\nexport type ResultDescription<\r\n TagTypes extends string,\r\n ResultType,\r\n QueryArg,\r\n ErrorType\r\n> =\r\n | ReadonlyArray<TagDescription<TagTypes>>\r\n | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType>\r\n\r\n/** @deprecated please use `onQueryStarted` instead */\r\nexport interface QueryApi<ReducerPath extends string, Context extends {}> {\r\n /** @deprecated please use `onQueryStarted` instead */\r\n dispatch: ThunkDispatch<any, any, AnyAction>\r\n /** @deprecated please use `onQueryStarted` instead */\r\n getState(): RootState<any, any, ReducerPath>\r\n /** @deprecated please use `onQueryStarted` instead */\r\n extra: unknown\r\n /** @deprecated please use `onQueryStarted` instead */\r\n requestId: string\r\n /** @deprecated please use `onQueryStarted` instead */\r\n context: Context\r\n}\r\n\r\nexport interface QueryExtraOptions<\r\n TagTypes extends string,\r\n ResultType,\r\n QueryArg,\r\n BaseQuery extends BaseQueryFn,\r\n ReducerPath extends string = string\r\n> {\r\n type: DefinitionType.query\r\n /**\r\n * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\r\n * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\r\n * 1. `['Post']` - equivalent to `2`\r\n * 2. `[{ type: 'Post' }]` - equivalent to `1`\r\n * 3. `[{ type: 'Post', id: 1 }]`\r\n * 4. `(result, error, arg) => ['Post']` - equivalent to `5`\r\n * 5. `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\r\n * 6. `(result, error, arg) => [{ type: 'Post', id: 1 }]`\r\n *\r\n * @example\r\n *\r\n * ```ts\r\n * // codeblock-meta title=\"providesTags example\"\r\n *\r\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\r\n * interface Post {\r\n * id: number\r\n * name: string\r\n * }\r\n * type PostsResponse = Post[]\r\n *\r\n * const api = createApi({\r\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\r\n * tagTypes: ['Posts'],\r\n * endpoints: (build) => ({\r\n * getPosts: build.query<PostsResponse, void>({\r\n * query: () => 'posts',\r\n * // highlight-start\r\n * providesTags: (result) =>\r\n * result\r\n * ? [\r\n * ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\r\n * { type: 'Posts', id: 'LIST' },\r\n * ]\r\n * : [{ type: 'Posts', id: 'LIST' }],\r\n * // highlight-end\r\n * })\r\n * })\r\n * })\r\n * ```\r\n */\r\n providesTags?: ResultDescription<\r\n TagTypes,\r\n ResultType,\r\n QueryArg,\r\n BaseQueryError<BaseQuery>\r\n >\r\n /**\r\n * Not to be used. A query should not invalidate tags in the cache.\r\n */\r\n invalidatesTags?: never\r\n}\r\n\r\nexport type QueryDefinition<\r\n QueryArg,\r\n BaseQuery extends BaseQueryFn,\r\n TagTypes extends string,\r\n ResultType,\r\n ReducerPath extends string = string\r\n> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType> &\r\n QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath>\r\n\r\nexport interface MutationExtraOptions<\r\n TagTypes extends string,\r\n ResultType,\r\n QueryArg,\r\n BaseQuery extends BaseQueryFn,\r\n ReducerPath extends string = string\r\n> {\r\n type: DefinitionType.mutation\r\n /**\r\n * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\r\n * Expects the same shapes as `providesTags`.\r\n *\r\n * @example\r\n *\r\n * ```ts\r\n * // codeblock-meta title=\"invalidatesTags example\"\r\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\r\n * interface Post {\r\n * id: number\r\n * name: string\r\n * }\r\n * type PostsResponse = Post[]\r\n *\r\n * const api = createApi({\r\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\r\n * tagTypes: ['Posts'],\r\n * endpoints: (build) => ({\r\n * getPosts: build.query<PostsResponse, void>({\r\n * query: () => 'posts',\r\n * providesTags: (result) =>\r\n * result\r\n * ? [\r\n * ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\r\n * { type: 'Posts', id: 'LIST' },\r\n * ]\r\n * : [{ type: 'Posts', id: 'LIST' }],\r\n * }),\r\n * addPost: build.mutation<Post, Partial<Post>>({\r\n * query(body) {\r\n * return {\r\n * url: `posts`,\r\n * method: 'POST',\r\n * body,\r\n * }\r\n * },\r\n * // highlight-start\r\n * invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\r\n * // highlight-end\r\n * }),\r\n * })\r\n * })\r\n * ```\r\n */\r\n invalidatesTags?: ResultDescription<\r\n TagTypes,\r\n ResultType,\r\n QueryArg,\r\n BaseQueryError<BaseQuery>\r\n >\r\n /**\r\n * Not to be used. A mutation should not provide tags to the cache.\r\n */\r\n providesTags?: never\r\n}\r\n\r\nexport type MutationDefinition<\r\n QueryArg,\r\n BaseQuery extends BaseQueryFn,\r\n TagTypes extends string,\r\n ResultType,\r\n ReducerPath extends string = string\r\n> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType> &\r\n MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath>\r\n\r\nexport type EndpointDefinition<\r\n QueryArg,\r\n BaseQuery extends BaseQueryFn,\r\n TagTypes extends string,\r\n ResultType,\r\n ReducerPath extends string = string\r\n> =\r\n | QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>\r\n | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>\r\n\r\nexport type EndpointDefinitions = Record<\r\n string,\r\n EndpointDefinition<any, any, any, any>\r\n>\r\n\r\nexport function isQueryDefinition(\r\n e: EndpointDefinition<any, any, any, any>\r\n): e is QueryDefinition<any, any, any, any> {\r\n return e.type === DefinitionType.query\r\n}\r\n\r\nexport function isMutationDefinition(\r\n e: EndpointDefinition<any, any, any, any>\r\n): e is MutationDefinition<any, any, any, any> {\r\n return e.type === DefinitionType.mutation\r\n}\r\n\r\nexport type EndpointBuilder<\r\n BaseQuery extends BaseQueryFn,\r\n TagTypes extends string,\r\n ReducerPath extends string\r\n> = {\r\n /**\r\n * An endpoint definition that retrieves data, and may provide tags to the cache.\r\n *\r\n * @example\r\n * ```js\r\n * // codeblock-meta title=\"Example of all query endpoint options\"\r\n * const api = createApi({\r\n * baseQuery,\r\n * endpoints: (build) => ({\r\n * getPost: build.query({\r\n * query: (id) => ({ url: `post/${id}` }),\r\n * // Pick out data and prevent nested properties in a hook or selector\r\n * transformResponse: (response) => response.data,\r\n * // `result` is the server response\r\n * providesTags: (result, error, id) => [{ type: 'Post', id }],\r\n * // trigger side effects or optimistic updates\r\n * onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\r\n * // handle subscriptions etc\r\n * onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\r\n * }),\r\n * }),\r\n *});\r\n *```\r\n */\r\n query<ResultType, QueryArg>(\r\n definition: OmitFromUnion<\r\n QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType>,\r\n 'type'\r\n >\r\n ): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType>\r\n /**\r\n * An endpoint definition that alters data on the server or will possibly invalidate the cache.\r\n *\r\n * @example\r\n * ```js\r\n * // codeblock-meta title=\"Example of all mutation endpoint options\"\r\n * const api = createApi({\r\n * baseQuery,\r\n * endpoints: (build) => ({\r\n * updatePost: build.mutation({\r\n * query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\r\n * // Pick out data and prevent nested properties in a hook or selector\r\n * transformResponse: (response) => response.data,\r\n * // `result` is the server response\r\n * invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\r\n * // trigger side effects or optimistic updates\r\n * onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\r\n * // handle subscriptions etc\r\n * onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\r\n * }),\r\n * }),\r\n * });\r\n * ```\r\n */\r\n mutation<ResultType, QueryArg>(\r\n definition: OmitFromUnion<\r\n MutationDefinition<\r\n QueryArg,\r\n BaseQuery,\r\n TagTypes,\r\n ResultType,\r\n ReducerPath\r\n >,\r\n 'type'\r\n >\r\n ): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>\r\n}\r\n\r\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T\r\n\r\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType>(\r\n description:\r\n | ResultDescription<string, ResultType, QueryArg, ErrorType>\r\n | undefined,\r\n result: ResultType | undefined,\r\n error: ErrorType | undefined,\r\n queryArg: QueryArg,\r\n assertTagTypes: AssertTagTypes\r\n): readonly FullTagDescription<string>[] {\r\n if (isFunction(description)) {\r\n return description(result as ResultType, error as undefined, queryArg)\r\n .map(expandTagDescription)\r\n .map(assertTagTypes)\r\n }\r\n if (Array.isArray(description)) {\r\n return description.map(expandTagDescription).map(assertTagTypes)\r\n }\r\n return []\r\n}\r\n\r\nfunction isFunction<T>(t: T): t is Extract<T, Function> {\r\n return typeof t === 'function'\r\n}\r\n\r\nfunction expandTagDescription(\r\n description: TagDescription<string>\r\n): FullTagDescription<string> {\r\n return typeof description === 'string' ? { type: description } : description\r\n}\r\n\r\nexport type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any>> =\r\n D extends BaseEndpointDefinition<infer QA, any, any> ? QA : unknown\r\nexport type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any>> =\r\n D extends BaseEndpointDefinition<any, any, infer RT> ? RT : unknown\r\n\r\nexport type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any>> =\r\n D extends EndpointDefinition<any, any, any, infer RP> ? RP : unknown\r\n\r\nexport type TagTypesFrom<D extends EndpointDefinition<any, any, any, any>> =\r\n D extends EndpointDefinition<any, any, infer RP, any> ? RP : unknown\r\n\r\nexport type ReplaceTagTypes<\r\n Definitions extends EndpointDefinitions,\r\n NewTagTypes extends string\r\n> = {\r\n [K in keyof Definitions]: Definitions[K] extends QueryDefinition<\r\n infer QueryArg,\r\n infer BaseQuery,\r\n any,\r\n infer ResultType,\r\n infer ReducerPath\r\n >\r\n ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, ResultType, ReducerPath>\r\n : Definitions[K] extends MutationDefinition<\r\n infer QueryArg,\r\n infer BaseQuery,\r\n any,\r\n infer ResultType,\r\n infer ReducerPath\r\n >\r\n ? MutationDefinition<\r\n QueryArg,\r\n BaseQuery,\r\n NewTagTypes,\r\n ResultType,\r\n ReducerPath\r\n >\r\n : never\r\n}\r\n","export function capitalize(str: string) {\r\n return str.replace(str[0], str[0].toUpperCase())\r\n}\r\n","export type Id<T> = { [K in keyof T]: T[K] } & {}\r\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> &\r\n Required<Pick<T, K>>\r\nexport type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never\r\nexport function assertCast<T>(v: any): asserts v is T {}\r\n\r\nexport function safeAssign<T extends object>(\r\n target: T,\r\n ...args: Array<Partial<NoInfer<T>>>\r\n) {\r\n Object.assign(target, ...args)\r\n}\r\n\r\n/**\r\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\r\n */\r\nexport type UnionToIntersection<U> = (\r\n U extends any ? (k: U) => void : never\r\n) extends (k: infer I) => void\r\n ? I\r\n : never\r\n\r\nexport type NonOptionalKeys<T> = {\r\n [K in keyof T]-?: undefined extends T[K] ? never : K\r\n}[keyof T]\r\n\r\nexport type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never\r\n ? False\r\n : True\r\n\r\nexport type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>\r\n\r\nexport type NoInfer<T> = [T][T extends any ? 0 : never]\r\n\r\nexport type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T\r\n\r\nexport type MaybePromise<T> = T | PromiseLike<T>\r\n\r\nexport type OmitFromUnion<T, K extends keyof T> = T extends any\r\n ? Omit<T, K>\r\n : never\r\n\r\nexport type IsAny<T, True, False = never> = true | false extends (\r\n T extends never ? true : false\r\n)\r\n ? True\r\n : False\r\n\r\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>\r\n","import type { MutationHooks, QueryHooks } from './buildHooks'\r\nimport { buildHooks } from './buildHooks'\r\nimport { isQueryDefinition, isMutationDefinition } from '../endpointDefinitions'\r\nimport type {\r\n EndpointDefinitions,\r\n QueryDefinition,\r\n MutationDefinition,\r\n QueryArgFrom,\r\n} from '@reduxjs/toolkit/dist/query/endpointDefinitions'\r\nimport type { Api, Module } from '../apiTypes'\r\nimport { capitalize } from '../utils'\r\nimport { safeAssign } from '../tsHelpers'\r\nimport type { BaseQueryFn } from '@reduxjs/toolkit/dist/query/baseQueryTypes'\r\n\r\nimport type { HooksWithUniqueNames } from './versionedTypes'\r\n\r\nimport {\r\n useDispatch as rrUseDispatch,\r\n useSelector as rrUseSelector,\r\n useStore as rrUseStore,\r\n batch as rrBatch,\r\n} from 'react-redux'\r\nimport type { QueryKeys } from '../core/apiState'\r\nimport type { PrefetchOptions } from '../core/module'\r\n\r\nexport const reactHooksModuleName = /* @__PURE__ */ Symbol()\r\nexport type ReactHooksModule = typeof reactHooksModuleName\r\n\r\ndeclare module '@reduxjs/toolkit/dist/query/apiTypes' {\r\n export interface ApiModules<\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n BaseQuery extends BaseQueryFn,\r\n Definitions extends EndpointDefinitions,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n ReducerPath extends string,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n TagTypes extends string\r\n > {\r\n [reactHooksModuleName]: {\r\n /**\r\n * Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.\r\n */\r\n endpoints: {\r\n [K in keyof Definitions]: Definitions[K] extends QueryDefinition<\r\n any,\r\n any,\r\n any,\r\n any,\r\n any\r\n >\r\n ? QueryHooks<Definitions[K]>\r\n : Definitions[K] extends MutationDefinition<any, any, any, any, any>\r\n ? MutationHooks<Definitions[K]>\r\n : never\r\n }\r\n /**\r\n * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.\r\n */\r\n usePrefetch<EndpointName extends QueryKeys<Definitions>>(\r\n endpointName: EndpointName,\r\n options?: PrefetchOptions\r\n ): (\r\n arg: QueryArgFrom<Definitions[EndpointName]>,\r\n options?: PrefetchOptions\r\n ) => void\r\n } & HooksWithUniqueNames<Definitions>\r\n }\r\n}\r\n\r\ntype RR = typeof import('react-redux')\r\n\r\nexport interface ReactHooksModuleOptions {\r\n /**\r\n * The version of the `batchedUpdates` function to be used\r\n */\r\n batch?: RR['batch']\r\n /**\r\n * The version of the `useDispatch` hook to be used\r\n */\r\n useDispatch?: RR['useDispatch']\r\n /**\r\n * The version of the `useSelector` hook to be used\r\n */\r\n useSelector?: RR['useSelector']\r\n /**\r\n * The version of the `useStore` hook to be used\r\n */\r\n useStore?: RR['useStore']\r\n}\r\n\r\n/**\r\n * Creates a module that generates react hooks from endpoints, for use with `buildCreateApi`.\r\n *\r\n * @example\r\n * ```ts\r\n * const MyContext = React.createContext<ReactReduxContextValue>(null as any);\r\n * const customCreateApi = buildCreateApi(\r\n * coreModule(),\r\n * reactHooksModule({ useDispatch: createDispatchHook(MyContext) })\r\n * );\r\n * ```\r\n *\r\n * @returns A module for use with `buildCreateApi`\r\n */\r\nexport const reactHooksModule = ({\r\n batch = rrBatch,\r\n useDispatch = rrUseDispatch,\r\n useSelector = rrUseSelector,\r\n useStore = rrUseStore,\r\n}: ReactHooksModuleOptions = {}): Module<ReactHooksModule> => ({\r\n name: reactHooksModuleName,\r\n init(api, options, context) {\r\n const anyApi = api as any as Api<\r\n any,\r\n Record<string, any>,\r\n string,\r\n string,\r\n ReactHooksModule\r\n >\r\n const { buildQueryHooks, buildMutationHook, usePrefetch } = buildHooks({\r\n api,\r\n moduleOptions: { batch, useDispatch, useSelector, useStore },\r\n })\r\n safeAssign(anyApi, { usePrefetch })\r\n safeAssign(context, { batch })\r\n\r\n return {\r\n injectEndpoint(endpointName, definition) {\r\n if (isQueryDefinition(definition)) {\r\n const {\r\n useQuery,\r\n useLazyQuery,\r\n useLazyQuerySubscription,\r\n useQueryState,\r\n useQuerySubscription,\r\n } = buildQueryHooks(endpointName)\r\n safeAssign(anyApi.endpoints[endpointName], {\r\n useQuery,\r\n useLazyQuery,\r\n useLazyQuerySubscription,\r\n useQueryState,\r\n useQuerySubscription,\r\n })\r\n ;(api as any)[`use${capitalize(endpointName)}Query`] = useQuery\r\n ;(api as any)[`useLazy${capitalize(endpointName)}Query`] =\r\n useLazyQuery\r\n } else if (isMutationDefinition(definition)) {\r\n const useMutation = buildMutationHook(endpointName)\r\n safeAssign(anyApi.endpoints[endpointName], {\r\n useMutation,\r\n })\r\n ;(api as any)[`use${capitalize(endpointName)}Mutation`] = useMutation\r\n }\r\n },\r\n }\r\n },\r\n})\r\n","import { configureStore } from '@reduxjs/toolkit'\r\nimport type { Context } from 'react'\r\nimport React from 'react'\r\nimport type { ReactReduxContextValue } from 'react-redux'\r\nimport { Provider } from 'react-redux'\r\nimport { setupListeners } from '@reduxjs/toolkit/query'\r\nimport type { Api } from '@reduxjs/toolkit/dist/query/apiTypes'\r\n\r\n/**\r\n * Can be used as a `Provider` if you **do not already have a Redux store**.\r\n *\r\n * @example\r\n * ```tsx\r\n * // codeblock-meta title=\"Basic usage - wrap your App with ApiProvider\"\r\n * import * as React from 'react';\r\n * import { ApiProvider } from '@reduxjs/toolkit/query/react';\r\n * import { Pokemon } from './features/Pokemon';\r\n *\r\n * function App() {\r\n * return (\r\n * <ApiProvider api={api}>\r\n * <Pokemon />\r\n * </ApiProvider>\r\n * );\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Using this together with an existing redux store, both will\r\n * conflict with each other - please use the traditional redux setup\r\n * in that case.\r\n */\r\nexport function ApiProvider<A extends Api<any, {}, any, any>>(props: {\r\n children: any\r\n api: A\r\n setupListeners?: Parameters<typeof setupListeners>[1]\r\n context?: Context<ReactReduxContextValue>\r\n}) {\r\n const [store] = React.useState(() =>\r\n configureStore({\r\n reducer: {\r\n [props.api.reducerPath]: props.api.reducer,\r\n },\r\n middleware: (gDM) => gDM().concat(props.api.middleware),\r\n })\r\n )\r\n // Adds the event listeners for online/offline/focus/etc\r\n setupListeners(store.dispatch, props.setupListeners)\r\n\r\n return (\r\n <Provider store={store} context={props.context}>\r\n {props.children}\r\n </Provider>\r\n )\r\n}\r\n",null]}