@tramvai/react-query 5.49.1 → 6.59.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.
- package/__migrations__/1-react-query-creating.js +106 -118
- package/lib/baseQuery/types.d.ts +3 -3
- package/lib/infiniteQuery/create.d.ts +1 -1
- package/lib/infiniteQuery/create.es.js +5 -1
- package/lib/infiniteQuery/create.js +5 -1
- package/lib/infiniteQuery/types.d.ts +6 -5
- package/lib/infiniteQuery/use.d.ts +6 -3
- package/lib/infiniteQuery/use.es.js +1 -0
- package/lib/infiniteQuery/use.js +1 -0
- package/lib/query/create.d.ts +1 -1
- package/lib/query/use.d.ts +1 -1
- package/lib/shared/normalizeKey.d.ts +1 -2
- package/package.json +8 -8
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var createQueryImportSpecifier = 'createQuery';
|
|
7
|
-
var creatInfiniteQueryImportSpecifier = 'createInfiniteQuery';
|
|
3
|
+
const createQueryModuleSpecifier = '@tramvai/react-query';
|
|
4
|
+
const createQueryImportSpecifier = 'createQuery';
|
|
5
|
+
const creatInfiniteQueryImportSpecifier = 'createInfiniteQuery';
|
|
8
6
|
function searchForImports(j, parsed, importSpecifierName) {
|
|
9
|
-
|
|
7
|
+
const result = {
|
|
10
8
|
isImported: false,
|
|
11
9
|
isImportedByName: false,
|
|
12
10
|
importedName: importSpecifierName,
|
|
@@ -14,14 +12,13 @@ function searchForImports(j, parsed, importSpecifierName) {
|
|
|
14
12
|
};
|
|
15
13
|
parsed
|
|
16
14
|
.find(j.ImportDeclaration, { source: { value: createQueryModuleSpecifier } })
|
|
17
|
-
.forEach(
|
|
15
|
+
.forEach((importDeclaration) => {
|
|
18
16
|
result.isImported = true;
|
|
19
17
|
if (importDeclaration.value.specifiers) {
|
|
20
|
-
importDeclaration.value.specifiers.forEach(
|
|
21
|
-
var _a, _b, _c;
|
|
18
|
+
importDeclaration.value.specifiers.forEach((specifier) => {
|
|
22
19
|
// Default imports
|
|
23
20
|
if (specifier.type === 'ImportDefaultSpecifier') {
|
|
24
|
-
result.importedDefaultName =
|
|
21
|
+
result.importedDefaultName = specifier.local?.name ?? '';
|
|
25
22
|
return;
|
|
26
23
|
}
|
|
27
24
|
// Named imports
|
|
@@ -29,7 +26,7 @@ function searchForImports(j, parsed, importSpecifierName) {
|
|
|
29
26
|
specifier.imported.name === importSpecifierName) {
|
|
30
27
|
result.isImportedByName = true;
|
|
31
28
|
// Named with overriding local name
|
|
32
|
-
if (
|
|
29
|
+
if (specifier.local?.name) {
|
|
33
30
|
result.importedName = specifier.local.name;
|
|
34
31
|
}
|
|
35
32
|
}
|
|
@@ -39,114 +36,105 @@ function searchForImports(j, parsed, importSpecifierName) {
|
|
|
39
36
|
return result;
|
|
40
37
|
}
|
|
41
38
|
// eslint-disable-next-line import/no-default-export
|
|
42
|
-
var _1ReactQueryCreating =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
// ---------------------------------------------------------------------------
|
|
139
|
-
// --------- CHANGING FILES ---------------
|
|
140
|
-
if (hasChanged) {
|
|
141
|
-
return parsed.toSource(printOptions);
|
|
142
|
-
}
|
|
143
|
-
// ----------------------------------------
|
|
144
|
-
})];
|
|
145
|
-
case 1:
|
|
146
|
-
_a.sent();
|
|
147
|
-
return [2 /*return*/];
|
|
39
|
+
var _1ReactQueryCreating = async (api) => {
|
|
40
|
+
await api.transform(({ source }, { j }, { printOptions }) => {
|
|
41
|
+
const parsed = j(source);
|
|
42
|
+
// ---------------- SEARCHING FOR THE RIGHT IMPORTS ------------------
|
|
43
|
+
const createQueryImport = searchForImports(j, parsed, createQueryImportSpecifier);
|
|
44
|
+
const createInfiniteQueryImport = searchForImports(j, parsed, creatInfiniteQueryImportSpecifier);
|
|
45
|
+
// -----------------------------------------------------------------
|
|
46
|
+
// ------- FUNCTION TO VALIDATE AND APPLY CHANGES IN PROPERTIES OF CALL EXPRESSION --------
|
|
47
|
+
let hasChanged = false;
|
|
48
|
+
const forEachCallExpression = (callExpression) => {
|
|
49
|
+
const firstArgument = callExpression.value.arguments[0];
|
|
50
|
+
let shouldAddActionNamePostfix = false;
|
|
51
|
+
let isObjectAlreadyHasActionNamePostfix = false;
|
|
52
|
+
if (!(firstArgument && firstArgument.type === 'ObjectExpression'))
|
|
53
|
+
return;
|
|
54
|
+
firstArgument.properties.forEach((property) => {
|
|
55
|
+
// for arrow function in property
|
|
56
|
+
if (property.type === 'ObjectProperty' &&
|
|
57
|
+
property.key.type === 'Identifier' &&
|
|
58
|
+
property.key.name === 'key' &&
|
|
59
|
+
property.value.type === 'ArrowFunctionExpression') {
|
|
60
|
+
shouldAddActionNamePostfix = true;
|
|
61
|
+
}
|
|
62
|
+
// for method property
|
|
63
|
+
if (property.type === 'ObjectMethod' &&
|
|
64
|
+
property.key.type === 'Identifier' &&
|
|
65
|
+
property.key.name === 'key') {
|
|
66
|
+
shouldAddActionNamePostfix = true;
|
|
67
|
+
}
|
|
68
|
+
if (property.type === 'ObjectProperty' &&
|
|
69
|
+
property.key.type === 'Identifier' &&
|
|
70
|
+
property.key.name === 'actionNamePostfix') {
|
|
71
|
+
isObjectAlreadyHasActionNamePostfix = true;
|
|
72
|
+
}
|
|
73
|
+
return property;
|
|
74
|
+
});
|
|
75
|
+
if (shouldAddActionNamePostfix &&
|
|
76
|
+
!isObjectAlreadyHasActionNamePostfix &&
|
|
77
|
+
callExpression.parent.value.type === 'VariableDeclarator') {
|
|
78
|
+
hasChanged = true;
|
|
79
|
+
j(callExpression).replaceWith(j.callExpression(callExpression.value.callee, [
|
|
80
|
+
j.objectExpression([
|
|
81
|
+
...firstArgument.properties,
|
|
82
|
+
j.objectProperty(j.identifier('actionNamePostfix'), j.stringLiteral(callExpression.parent.value.id.name)),
|
|
83
|
+
]),
|
|
84
|
+
]));
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
// ---------------------------------------------------------------------
|
|
88
|
+
// --------- INITIATION OF RECOGNIZING CALL EXPRESSION WITH REQUIRED PROPERTIES ---------
|
|
89
|
+
if (createQueryImport.isImported) {
|
|
90
|
+
if (createQueryImport.isImportedByName) {
|
|
91
|
+
parsed
|
|
92
|
+
.find(j.CallExpression, { callee: { name: createQueryImport.importedName } })
|
|
93
|
+
.forEach(forEachCallExpression);
|
|
94
|
+
}
|
|
95
|
+
if (createQueryImport.importedDefaultName) {
|
|
96
|
+
parsed
|
|
97
|
+
.find(j.CallExpression, {
|
|
98
|
+
callee: {
|
|
99
|
+
object: {
|
|
100
|
+
name: createQueryImport.importedDefaultName,
|
|
101
|
+
},
|
|
102
|
+
property: {
|
|
103
|
+
name: createQueryImportSpecifier,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
.forEach(forEachCallExpression);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (createInfiniteQueryImport.isImported) {
|
|
111
|
+
if (createInfiniteQueryImport.isImportedByName) {
|
|
112
|
+
parsed
|
|
113
|
+
.find(j.CallExpression, { callee: { name: createInfiniteQueryImport.importedName } })
|
|
114
|
+
.forEach(forEachCallExpression);
|
|
115
|
+
}
|
|
116
|
+
if (createInfiniteQueryImport.importedDefaultName) {
|
|
117
|
+
parsed
|
|
118
|
+
.find(j.CallExpression, {
|
|
119
|
+
callee: {
|
|
120
|
+
object: {
|
|
121
|
+
name: createInfiniteQueryImport.importedDefaultName,
|
|
122
|
+
},
|
|
123
|
+
property: {
|
|
124
|
+
name: creatInfiniteQueryImportSpecifier,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
})
|
|
128
|
+
.forEach(forEachCallExpression);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
// --------- CHANGING FILES ---------------
|
|
133
|
+
if (hasChanged) {
|
|
134
|
+
return parsed.toSource(printOptions);
|
|
148
135
|
}
|
|
136
|
+
// ----------------------------------------
|
|
149
137
|
});
|
|
150
|
-
}
|
|
138
|
+
};
|
|
151
139
|
|
|
152
140
|
module.exports = _1ReactQueryCreating;
|
package/lib/baseQuery/types.d.ts
CHANGED
|
@@ -23,10 +23,10 @@ export type CreateQueryOptionsWithNonSerializableKey<Options, Deps extends Provi
|
|
|
23
23
|
deps?: Deps;
|
|
24
24
|
conditions?: ActionConditionsParameters;
|
|
25
25
|
};
|
|
26
|
-
export type BaseCreateQueryOptions<Options, Deps extends ProviderDeps> =
|
|
26
|
+
export type BaseCreateQueryOptions<Options, Deps extends ProviderDeps> = CreateQueryOptionsWithNonSerializableKey<Options, Deps> | CreateQueryOptionsWithSerializableKey<Options, Deps>;
|
|
27
27
|
export interface BaseQuery<Options, TCreateQuery, TQuery, TUseQuery> {
|
|
28
28
|
[QUERY_PARAMETERS]: TCreateQuery;
|
|
29
|
-
fork(options: TUseQuery): TQuery;
|
|
29
|
+
fork(options: Partial<TUseQuery>): TQuery;
|
|
30
30
|
raw(di: Container, options?: Options): TUseQuery;
|
|
31
31
|
/**
|
|
32
32
|
* @deprecated pass di as first parameter instead of context
|
|
@@ -35,5 +35,5 @@ export interface BaseQuery<Options, TCreateQuery, TQuery, TUseQuery> {
|
|
|
35
35
|
prefetchAction(options?: Options): TramvaiAction<[], Promise<void>, any>;
|
|
36
36
|
actionNamePostfix: string;
|
|
37
37
|
}
|
|
38
|
-
export declare const isQuery: <Options, Result, TCreateQuery, TQuery, TUseQuery>(arg: BaseQuery<Options, TCreateQuery, TQuery, TUseQuery> | QueryOptions<Result, any, any, any>) => arg is BaseQuery<Options, TCreateQuery, TQuery, TUseQuery>;
|
|
38
|
+
export declare const isQuery: <Options, Result, TCreateQuery, TQuery, TUseQuery>(arg: BaseQuery<Options, TCreateQuery, TQuery, TUseQuery> | QueryOptions<Result, any, any, any, never>) => arg is BaseQuery<Options, TCreateQuery, TQuery, TUseQuery>;
|
|
39
39
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ProviderDeps } from '@tinkoff/dippy';
|
|
2
2
|
import type { CreateInfiniteQueryOptions, InfiniteQuery } from './types';
|
|
3
|
-
export declare const createInfiniteQuery: <Options
|
|
3
|
+
export declare const createInfiniteQuery: <Options, Result, Deps extends ProviderDeps = {}, PageParam = unknown>(queryParameters: CreateInfiniteQueryOptions<Options, PageParam, Result, Deps>) => InfiniteQuery<Options, PageParam, Result, Deps>;
|
|
4
4
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -10,7 +10,9 @@ import { mapQuerySignalToxecutionContext } from '../shared/signal.es.js';
|
|
|
10
10
|
import { createUniqueActionKeyForQuery } from '../shared/createUniqueActionKeyForQuery.es.js';
|
|
11
11
|
|
|
12
12
|
const convertToRawQuery = (query, di, options) => {
|
|
13
|
-
const { key = identity, fn,
|
|
13
|
+
const { key = identity, fn,
|
|
14
|
+
// TODO: remove after dropping support @tanstack/react-query v4
|
|
15
|
+
initialPageParam = 0, getNextPageParam = () => null, getPreviousPageParam, deps = {}, conditions, infiniteQueryOptions, } = query[QUERY_PARAMETERS];
|
|
14
16
|
const resolvedDeps = di.getOfDeps(deps);
|
|
15
17
|
const ctx = { deps: resolvedDeps };
|
|
16
18
|
const rawQueryKey = typeof key === 'function' ? key.call(ctx, options) : key;
|
|
@@ -28,6 +30,7 @@ const convertToRawQuery = (query, di, options) => {
|
|
|
28
30
|
});
|
|
29
31
|
return {
|
|
30
32
|
...infiniteQueryOptions,
|
|
33
|
+
initialPageParam,
|
|
31
34
|
getNextPageParam,
|
|
32
35
|
getPreviousPageParam,
|
|
33
36
|
queryKey,
|
|
@@ -36,6 +39,7 @@ const convertToRawQuery = (query, di, options) => {
|
|
|
36
39
|
},
|
|
37
40
|
queryFn: (queryContext) => {
|
|
38
41
|
const context = di.get(CONTEXT_TOKEN);
|
|
42
|
+
// @ts-expect-error TODO: remove comment after drop support for @tanstack/react-query v4
|
|
39
43
|
return context.executeAction(actionWrapper, queryContext);
|
|
40
44
|
},
|
|
41
45
|
};
|
|
@@ -18,7 +18,9 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
18
18
|
var identity__default = /*#__PURE__*/_interopDefaultLegacy(identity);
|
|
19
19
|
|
|
20
20
|
const convertToRawQuery = (query, di, options) => {
|
|
21
|
-
const { key = identity__default["default"], fn,
|
|
21
|
+
const { key = identity__default["default"], fn,
|
|
22
|
+
// TODO: remove after dropping support @tanstack/react-query v4
|
|
23
|
+
initialPageParam = 0, getNextPageParam = () => null, getPreviousPageParam, deps = {}, conditions, infiniteQueryOptions, } = query[types.QUERY_PARAMETERS];
|
|
22
24
|
const resolvedDeps = di.getOfDeps(deps);
|
|
23
25
|
const ctx = { deps: resolvedDeps };
|
|
24
26
|
const rawQueryKey = typeof key === 'function' ? key.call(ctx, options) : key;
|
|
@@ -36,6 +38,7 @@ const convertToRawQuery = (query, di, options) => {
|
|
|
36
38
|
});
|
|
37
39
|
return {
|
|
38
40
|
...infiniteQueryOptions,
|
|
41
|
+
initialPageParam,
|
|
39
42
|
getNextPageParam,
|
|
40
43
|
getPreviousPageParam,
|
|
41
44
|
queryKey,
|
|
@@ -44,6 +47,7 @@ const convertToRawQuery = (query, di, options) => {
|
|
|
44
47
|
},
|
|
45
48
|
queryFn: (queryContext) => {
|
|
46
49
|
const context = di.get(tokensCommon.CONTEXT_TOKEN);
|
|
50
|
+
// @ts-expect-error TODO: remove comment after drop support for @tanstack/react-query v4
|
|
47
51
|
return context.executeAction(actionWrapper, queryContext);
|
|
48
52
|
},
|
|
49
53
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type { ProvideDepsIterator, ProviderDeps } from '@tinkoff/dippy';
|
|
2
|
-
import type { UseInfiniteQueryOptions, InfiniteData } from '@tanstack/react-query';
|
|
2
|
+
import type { UseInfiniteQueryOptions, 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
5
|
export type CreateInfiniteQueryOptions<Options, PageParam, Result, Deps extends ProviderDeps> = BaseCreateQueryOptions<Options, Deps> & {
|
|
6
|
-
infiniteQueryOptions?: UseInfiniteQueryOptions<Result, Error
|
|
6
|
+
infiniteQueryOptions?: Partial<UseInfiniteQueryOptions<Result, Error, Result, Result, QueryKey, PageParam>>;
|
|
7
7
|
fn: (this: ReactQueryContext<Deps>, options: Options, pageParam: PageParam,
|
|
8
8
|
/**
|
|
9
9
|
* @deprecated use this.deps instead
|
|
10
10
|
*/
|
|
11
11
|
deps: ProvideDepsIterator<Deps>) => Promise<Result>;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
initialPageParam?: PageParam;
|
|
13
|
+
getNextPageParam?: (lastPage: Result, allPages: Result[]) => PageParam | undefined | null;
|
|
14
|
+
getPreviousPageParam?: (firstPage: Result, allPages: Result[]) => PageParam | undefined | null;
|
|
14
15
|
};
|
|
15
|
-
export type InfiniteQuery<Options, PageParam, Result, Deps extends ProviderDeps> = BaseQuery<Options, CreateInfiniteQueryOptions<Options, PageParam, Result, Deps>, InfiniteQuery<Options, PageParam, Result, Deps>, UseInfiniteQueryOptions<Result, Error>> & {
|
|
16
|
+
export type InfiniteQuery<Options, PageParam, Result, Deps extends ProviderDeps> = BaseQuery<Options, CreateInfiniteQueryOptions<Options, PageParam, Result, Deps>, InfiniteQuery<Options, PageParam, Result, Deps>, UseInfiniteQueryOptions<Result, Error, Result, Result, QueryKey, PageParam>> & {
|
|
16
17
|
fetchAction(options?: Options): TramvaiAction<[], Promise<InfiniteData<Result>>, any>;
|
|
17
18
|
};
|
|
18
19
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { InfiniteData, QueryKey, UseInfiniteQueryOptions, UseInfiniteQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import type { ProviderDeps } from '@tinkoff/dippy';
|
|
3
3
|
import type { InfiniteQuery } from './types';
|
|
4
|
-
|
|
5
|
-
declare function useInfiniteQuery<Options, PageParam, Result, Deps extends ProviderDeps>(query: UseInfiniteQueryOptions<Result, Error> | InfiniteQuery<Options, PageParam, Result, Deps
|
|
4
|
+
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: UseInfiniteQueryOptions<Result, Error, Result, Result, QueryKey> | InfiniteQuery<Options, PageParam, Result, Deps>): SafeUnpackUseInfiniteQueryResult<Result, Error, UseInfiniteQueryResult<Result, Error>>;
|
|
6
|
+
declare function useInfiniteQuery<Options, PageParam, Result, Deps extends ProviderDeps>(query: UseInfiniteQueryOptions<Result, Error, Result, Result, QueryKey> | InfiniteQuery<Options, PageParam, Result, Deps>, options: Options): SafeUnpackUseInfiniteQueryResult<Result, Error, UseInfiniteQueryResult<Result, Error>>;
|
|
7
|
+
declare function useInfiniteQuery<Options extends void, PageParam, Result, Deps extends ProviderDeps>(query: UseInfiniteQueryOptions<Result, Error, Result, Result, QueryKey, PageParam> | InfiniteQuery<Options, PageParam, Result, Deps>): SafeUnpackUseInfiniteQueryResult<Result, Error, UseInfiniteQueryResult<Result, Error>>;
|
|
8
|
+
declare function useInfiniteQuery<Options, PageParam, Result, Deps extends ProviderDeps>(query: UseInfiniteQueryOptions<Result, Error, Result, Result, QueryKey, PageParam> | InfiniteQuery<Options, PageParam, Result, Deps>, options: Options): SafeUnpackUseInfiniteQueryResult<Result, Error, UseInfiniteQueryResult<Result, Error>>;
|
|
6
9
|
export { useInfiniteQuery };
|
|
7
10
|
//# sourceMappingURL=use.d.ts.map
|
package/lib/infiniteQuery/use.js
CHANGED
package/lib/query/create.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ProviderDeps } from '@tinkoff/dippy';
|
|
2
2
|
import type { CreateQueryOptions, Query } from './types';
|
|
3
|
-
export declare const createQuery: <Options
|
|
3
|
+
export declare const createQuery: <Options, Result, Deps extends ProviderDeps = {}>(queryParameters: CreateQueryOptions<Options, Result, Deps>) => Query<Options, Result, Deps>;
|
|
4
4
|
//# sourceMappingURL=create.d.ts.map
|
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>>): import("@tanstack/react-query").UseQueryResult<unknown extends Result ? Result : 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-p5rrYdPC").Y<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-p5rrYdPC").Y<Result> extends infer T ? T extends import("@tanstack/query-core/build/legacy/hydration-p5rrYdPC").Y<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
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { QueryKey } from '@tanstack/react-query';
|
|
2
1
|
import type { ReactQueryKeyOrString } from '../baseQuery/types';
|
|
3
|
-
export declare const normalizeKey: (key: ReactQueryKeyOrString) =>
|
|
2
|
+
export declare const normalizeKey: (key: ReactQueryKeyOrString) => readonly unknown[];
|
|
4
3
|
//# sourceMappingURL=normalizeKey.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/react-query",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.59.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
"watch": "tsc -w"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tinkoff/react-hooks": "0.
|
|
22
|
-
"@tramvai/core": "
|
|
23
|
-
"@tramvai/module-react-query": "
|
|
24
|
-
"@tramvai/react": "
|
|
25
|
-
"@tramvai/tokens-common": "
|
|
21
|
+
"@tinkoff/react-hooks": "0.5.0",
|
|
22
|
+
"@tramvai/core": "6.59.0",
|
|
23
|
+
"@tramvai/module-react-query": "6.59.0",
|
|
24
|
+
"@tramvai/react": "6.59.0",
|
|
25
|
+
"@tramvai/tokens-common": "6.59.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@
|
|
28
|
+
"@tanstack/react-query": ">=4.0.0 <=5.72.1",
|
|
29
|
+
"@tinkoff/dippy": "0.12.3",
|
|
29
30
|
"@tinkoff/utils": "^2.1.2",
|
|
30
31
|
"react": ">=16.14.0",
|
|
31
|
-
"@tanstack/react-query": "^4.7.1",
|
|
32
32
|
"tslib": "^2.4.0"
|
|
33
33
|
},
|
|
34
34
|
"module": "lib/index.es.js",
|