@tramvai/react-query 7.5.3 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import type { QueryKey, UseInfiniteQueryOptions, InfiniteQueryObserverOptions } from '@tanstack/react-query';
|
|
1
2
|
import type { ProviderDeps } from '@tinkoff/dippy';
|
|
2
3
|
import type { CreateInfiniteQueryOptions, InfiniteQuery } from './types';
|
|
4
|
+
export type SafeUseInfiniteQueryOptions<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = InfiniteQueryObserverOptions extends {
|
|
5
|
+
experimental_prefetchInRender?: boolean;
|
|
6
|
+
} ? UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> : UseInfiniteQueryOptions<TQueryFnData, TError, TData, TData, TQueryKey>;
|
|
3
7
|
export declare const createInfiniteQuery: <Options, Result, Deps extends ProviderDeps = {}, PageParam = unknown>(queryParameters: CreateInfiniteQueryOptions<Options, PageParam, Result, Deps>) => InfiniteQuery<Options, PageParam, Result, Deps>;
|
|
4
8
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ProvideDepsIterator, ProviderDeps } from '@tinkoff/dippy';
|
|
2
|
-
import type {
|
|
2
|
+
import type { InfiniteData, QueryKey } from '@tanstack/react-query';
|
|
3
3
|
import type { TramvaiAction } from '@tramvai/core';
|
|
4
4
|
import type { BaseCreateQueryOptions, BaseQuery, ReactQueryContext } from '../baseQuery/types';
|
|
5
|
+
import { SafeUseInfiniteQueryOptions } from './create';
|
|
5
6
|
export type CreateInfiniteQueryOptions<Options, PageParam, Result, Deps extends ProviderDeps> = BaseCreateQueryOptions<Options, Deps> & {
|
|
6
|
-
infiniteQueryOptions?: Partial<
|
|
7
|
+
infiniteQueryOptions?: Partial<SafeUseInfiniteQueryOptions<Result, Error, Result, QueryKey, PageParam>>;
|
|
7
8
|
fn: (this: ReactQueryContext<Deps>, options: Options, pageParam: PageParam,
|
|
8
9
|
/**
|
|
9
10
|
* @deprecated use this.deps instead
|
|
@@ -13,7 +14,7 @@ export type CreateInfiniteQueryOptions<Options, PageParam, Result, Deps extends
|
|
|
13
14
|
getNextPageParam?: (lastPage: Result, allPages: Result[]) => PageParam | undefined | null;
|
|
14
15
|
getPreviousPageParam?: (firstPage: Result, allPages: Result[]) => PageParam | undefined | null;
|
|
15
16
|
};
|
|
16
|
-
export type InfiniteQuery<Options, PageParam, Result, Deps extends ProviderDeps> = BaseQuery<Options, CreateInfiniteQueryOptions<Options, PageParam, Result, Deps>, InfiniteQuery<Options, PageParam, Result, Deps>,
|
|
17
|
+
export type InfiniteQuery<Options, PageParam, Result, Deps extends ProviderDeps> = BaseQuery<Options, CreateInfiniteQueryOptions<Options, PageParam, Result, Deps>, InfiniteQuery<Options, PageParam, Result, Deps>, SafeUseInfiniteQueryOptions<Result, Error, Result, QueryKey, PageParam>> & {
|
|
17
18
|
fetchAction(options?: Options): TramvaiAction<[], Promise<InfiniteData<Result>>, any>;
|
|
18
19
|
};
|
|
19
20
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { InfiniteData, QueryKey,
|
|
1
|
+
import type { InfiniteData, QueryKey, UseInfiniteQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import type { ProviderDeps } from '@tinkoff/dippy';
|
|
3
3
|
import type { InfiniteQuery } from './types';
|
|
4
|
+
import { SafeUseInfiniteQueryOptions } from './create';
|
|
4
5
|
type SafeUnpackUseInfiniteQueryResult<Result, Error, T extends UseInfiniteQueryResult<Result, Error>> = T['data'] extends InfiniteData<Result> | undefined ? UseInfiniteQueryResult<Result, Error> : UseInfiniteQueryResult<InfiniteData<Result>, Error>;
|
|
5
|
-
declare function useInfiniteQuery<Options extends void, PageParam, Result, Deps extends ProviderDeps>(query:
|
|
6
|
-
declare function useInfiniteQuery<Options, PageParam, Result, Deps extends ProviderDeps>(query:
|
|
7
|
-
declare function useInfiniteQuery<Options extends void, PageParam, Result, Deps extends ProviderDeps>(query:
|
|
8
|
-
declare function useInfiniteQuery<Options, PageParam, Result, Deps extends ProviderDeps>(query:
|
|
6
|
+
declare function useInfiniteQuery<Options extends void, PageParam, Result, Deps extends ProviderDeps>(query: SafeUseInfiniteQueryOptions<Result, Error, Result, QueryKey> | InfiniteQuery<Options, PageParam, Result, Deps>): SafeUnpackUseInfiniteQueryResult<Result, Error, UseInfiniteQueryResult<Result, Error>>;
|
|
7
|
+
declare function useInfiniteQuery<Options, PageParam, Result, Deps extends ProviderDeps>(query: SafeUseInfiniteQueryOptions<Result, Error, Result, QueryKey> | InfiniteQuery<Options, PageParam, Result, Deps>, options: Options): SafeUnpackUseInfiniteQueryResult<Result, Error, UseInfiniteQueryResult<Result, Error>>;
|
|
8
|
+
declare function useInfiniteQuery<Options extends void, PageParam, Result, Deps extends ProviderDeps>(query: SafeUseInfiniteQueryOptions<Result, Error, Result, QueryKey, PageParam> | InfiniteQuery<Options, PageParam, Result, Deps>): SafeUnpackUseInfiniteQueryResult<Result, Error, UseInfiniteQueryResult<Result, Error>>;
|
|
9
|
+
declare function useInfiniteQuery<Options, PageParam, Result, Deps extends ProviderDeps>(query: SafeUseInfiniteQueryOptions<Result, Error, Result, QueryKey, PageParam> | InfiniteQuery<Options, PageParam, Result, Deps>, options: Options): SafeUnpackUseInfiniteQueryResult<Result, Error, UseInfiniteQueryResult<Result, Error>>;
|
|
9
10
|
export { useInfiniteQuery };
|
|
10
11
|
//# sourceMappingURL=use.d.ts.map
|
package/lib/query/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { UseQueryOptions } from '@tanstack/react-query';
|
|
|
3
3
|
import type { TramvaiAction } from '@tramvai/core';
|
|
4
4
|
import type { BaseCreateQueryOptions, BaseQuery, ReactQueryContext } from '../baseQuery/types';
|
|
5
5
|
export type CreateQueryOptions<Options, Result, Deps extends ProviderDeps> = BaseCreateQueryOptions<Options, Deps> & {
|
|
6
|
-
queryOptions?: UseQueryOptions<Result, Error>;
|
|
6
|
+
queryOptions?: Omit<UseQueryOptions<Result, Error>, 'queryKey'>;
|
|
7
7
|
fn: (this: ReactQueryContext<Deps>, options: Options,
|
|
8
8
|
/**
|
|
9
9
|
* @deprecated use this.deps instead
|
package/lib/query/use.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ import type { ProviderDeps } from '@tinkoff/dippy';
|
|
|
3
3
|
import type { Query } from './types';
|
|
4
4
|
declare function useQuery<Options extends void, Result, Deps extends ProviderDeps>(query: UseQueryOptions<Result, Error> | Query<Options, Result, Deps>): QueryObserverResult<Result, Error>;
|
|
5
5
|
declare function useQuery<Options, Result, Deps extends ProviderDeps>(query: UseQueryOptions<Result, Error> | Query<Options, Result, Deps>, options: Options): QueryObserverResult<Result, Error>;
|
|
6
|
-
declare function useQueries<Result, Deps extends ProviderDeps>(queries: Array<UseQueryOptions<Result, Error> | Query<any, Result, Deps>>): (unknown extends Result | import("@tanstack/query-core/build/legacy/hydration-
|
|
6
|
+
declare function useQueries<Result, Deps extends ProviderDeps>(queries: Array<UseQueryOptions<Result, Error> | Query<any, Result, Deps>>): (unknown extends Result | import("@tanstack/query-core/build/legacy/hydration-BlEVG2Lp").a2<Result> ? import("@tanstack/react-query/build/legacy/types").UseQueryResult<unknown extends Result ? Result : Result, Error> : (Result extends (unknown extends Result ? Result : Result) ? import("@tanstack/react-query/build/legacy/types").DefinedUseQueryResult<unknown extends Result ? Result : Result, Error> : Result extends () => infer TInitialDataResult ? unknown extends TInitialDataResult ? import("@tanstack/react-query/build/legacy/types").UseQueryResult<unknown extends Result ? Result : Result, Error> : TInitialDataResult extends (unknown extends Result ? Result : Result) ? import("@tanstack/react-query/build/legacy/types").DefinedUseQueryResult<unknown extends Result ? Result : Result, Error> : import("@tanstack/react-query/build/legacy/types").UseQueryResult<unknown extends Result ? Result : Result, Error> : import("@tanstack/react-query/build/legacy/types").UseQueryResult<unknown extends Result ? Result : Result, Error>) | (import("@tanstack/query-core/build/legacy/hydration-BlEVG2Lp").a2<Result> extends infer T ? T extends import("@tanstack/query-core/build/legacy/hydration-BlEVG2Lp").a2<Result> ? T extends (unknown extends Result ? Result : Result) ? import("@tanstack/react-query/build/legacy/types").DefinedUseQueryResult<unknown extends Result ? Result : Result, Error> : T extends () => infer TInitialDataResult ? unknown extends TInitialDataResult ? import("@tanstack/react-query/build/legacy/types").UseQueryResult<unknown extends Result ? Result : Result, Error> : TInitialDataResult extends (unknown extends Result ? Result : Result) ? import("@tanstack/react-query/build/legacy/types").DefinedUseQueryResult<unknown extends Result ? Result : Result, Error> : import("@tanstack/react-query/build/legacy/types").UseQueryResult<unknown extends Result ? Result : Result, Error> : import("@tanstack/react-query/build/legacy/types").UseQueryResult<unknown extends Result ? Result : Result, Error> : never : never))[];
|
|
7
7
|
export { useQuery, useQueries };
|
|
8
8
|
//# sourceMappingURL=use.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/react-query",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@tinkoff/react-hooks": "0.6.1",
|
|
22
|
-
"@tramvai/core": "7.
|
|
23
|
-
"@tramvai/module-react-query": "7.
|
|
24
|
-
"@tramvai/react": "7.
|
|
25
|
-
"@tramvai/tokens-common": "7.
|
|
22
|
+
"@tramvai/core": "7.7.0",
|
|
23
|
+
"@tramvai/module-react-query": "7.7.0",
|
|
24
|
+
"@tramvai/react": "7.7.0",
|
|
25
|
+
"@tramvai/tokens-common": "7.7.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@tanstack/react-query": ">=4.0.0
|
|
28
|
+
"@tanstack/react-query": ">=4.0.0 <6",
|
|
29
29
|
"@tinkoff/dippy": "0.13.2",
|
|
30
30
|
"@tinkoff/utils": "^2.1.2",
|
|
31
31
|
"react": ">=16.14.0",
|