react-query-kit 2.0.7 → 2.0.9-beta.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/README.md +5 -4
- package/build/lib/createInfiniteQuery.esm.js +2 -2
- package/build/lib/createInfiniteQuery.esm.js.map +1 -1
- package/build/lib/createInfiniteQuery.js +22 -2
- package/build/lib/createInfiniteQuery.js.map +1 -1
- package/build/lib/createInfiniteQuery.mjs +2 -2
- package/build/lib/createInfiniteQuery.mjs.map +1 -1
- package/build/lib/createMutation.esm.js +2 -2
- package/build/lib/createMutation.esm.js.map +1 -1
- package/build/lib/createMutation.js +22 -2
- package/build/lib/createMutation.js.map +1 -1
- package/build/lib/createMutation.mjs +2 -2
- package/build/lib/createMutation.mjs.map +1 -1
- package/build/lib/createQuery.esm.js +2 -2
- package/build/lib/createQuery.esm.js.map +1 -1
- package/build/lib/createQuery.js +22 -2
- package/build/lib/createQuery.js.map +1 -1
- package/build/lib/createQuery.mjs +2 -2
- package/build/lib/createQuery.mjs.map +1 -1
- package/build/lib/createSuspenseInfiniteQuery.esm.js +3 -3
- package/build/lib/createSuspenseInfiniteQuery.esm.js.map +1 -1
- package/build/lib/createSuspenseInfiniteQuery.js +22 -2
- package/build/lib/createSuspenseInfiniteQuery.js.map +1 -1
- package/build/lib/createSuspenseInfiniteQuery.mjs +3 -3
- package/build/lib/createSuspenseInfiniteQuery.mjs.map +1 -1
- package/build/lib/createSuspenseQuery.esm.js +3 -3
- package/build/lib/createSuspenseQuery.esm.js.map +1 -1
- package/build/lib/createSuspenseQuery.js +22 -2
- package/build/lib/createSuspenseQuery.js.map +1 -1
- package/build/lib/createSuspenseQuery.mjs +3 -3
- package/build/lib/createSuspenseQuery.mjs.map +1 -1
- package/build/lib/types.d.ts +36 -29
- package/build/lib/utils.d.ts +6 -6
- package/build/lib/utils.esm.js +7 -10
- package/build/lib/utils.esm.js.map +1 -1
- package/build/lib/utils.js +27 -9
- package/build/lib/utils.js.map +1 -1
- package/build/lib/utils.mjs +7 -10
- package/build/lib/utils.mjs.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats.json +96 -96
- package/build/umd/index.development.js +31 -14
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/build/zip/zip.esm.js +1 -1
- package/package.json +2 -2
- package/src/createInfiniteQuery.ts +2 -2
- package/src/createMutation.ts +2 -2
- package/src/createQuery.tsx +2 -2
- package/src/createSuspenseInfiniteQuery.ts +5 -3
- package/src/createSuspenseQuery.ts +5 -3
- package/src/types.ts +87 -37
- package/src/utils.ts +11 -16
package/README.md
CHANGED
|
@@ -32,8 +32,6 @@
|
|
|
32
32
|
- Set defaultOptions for custom ReactQuery hooks easier and clearer
|
|
33
33
|
- Middleware
|
|
34
34
|
|
|
35
|
-

|
|
36
|
-
|
|
37
35
|
English | [简体中文](./README-zh_CN.md)
|
|
38
36
|
|
|
39
37
|
## Table of Contents
|
|
@@ -82,7 +80,7 @@ $ yarn add react-query-kit
|
|
|
82
80
|
|
|
83
81
|
```tsx
|
|
84
82
|
import { QueryClient, dehydrate } from '@tanstack/react-query'
|
|
85
|
-
import { createQuery
|
|
83
|
+
import { createQuery } from 'react-query-kit'
|
|
86
84
|
|
|
87
85
|
type Response = { title: string; content: string }
|
|
88
86
|
type Variables = { id: number }
|
|
@@ -140,8 +138,11 @@ const queries = useQueries({
|
|
|
140
138
|
],
|
|
141
139
|
})
|
|
142
140
|
|
|
141
|
+
// getQueryData
|
|
142
|
+
queryClient.getQueryData(usePost.getKey(variables)) // Response
|
|
143
|
+
|
|
143
144
|
// setQueryData
|
|
144
|
-
queryClient.setQueryData
|
|
145
|
+
queryClient.setQueryData(usePost.getKey(variables), {...})
|
|
145
146
|
```
|
|
146
147
|
|
|
147
148
|
### Additional API Reference
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
import { createBaseQuery } from './createBaseQuery.esm.js';
|
|
3
3
|
|
|
4
4
|
const createInfiniteQuery = options => {
|
|
5
|
-
return createBaseQuery(options, useInfiniteQuery);
|
|
5
|
+
return createBaseQuery(options, ReactQuery.useInfiniteQuery);
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export { createInfiniteQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInfiniteQuery.esm.js","sources":["../../src/createInfiniteQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createInfiniteQuery.esm.js","sources":["../../src/createInfiniteQuery.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateInfiniteQueryOptions,\n InfiniteQueryHook,\n} from './types'\n\nexport const createInfiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>\n): InfiniteQueryHook<TFnData, TVariables, TError, TPageParam> => {\n return createBaseQuery(options, ReactQuery.useInfiniteQuery)\n}\n"],"names":["createInfiniteQuery","options","createBaseQuery","ReactQuery","useInfiniteQuery"],"mappings":";;;AASaA,MAAAA,mBAAmB,GAM9BC,OANiC,IAO8B;AAC/D,EAAA,OAAOC,eAAe,CAACD,OAAD,EAAUE,UAAU,CAACC,gBAArB,CAAtB,CAAA;AACD;;;;"}
|
|
@@ -2,11 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var ReactQuery = require('@tanstack/react-query');
|
|
6
6
|
var createBaseQuery = require('./createBaseQuery.js');
|
|
7
7
|
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n["default"] = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var ReactQuery__namespace = /*#__PURE__*/_interopNamespace(ReactQuery);
|
|
27
|
+
|
|
8
28
|
const createInfiniteQuery = options => {
|
|
9
|
-
return createBaseQuery.createBaseQuery(options,
|
|
29
|
+
return createBaseQuery.createBaseQuery(options, ReactQuery__namespace.useInfiniteQuery);
|
|
10
30
|
};
|
|
11
31
|
|
|
12
32
|
exports.createInfiniteQuery = createInfiniteQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInfiniteQuery.js","sources":["../../src/createInfiniteQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createInfiniteQuery.js","sources":["../../src/createInfiniteQuery.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateInfiniteQueryOptions,\n InfiniteQueryHook,\n} from './types'\n\nexport const createInfiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>\n): InfiniteQueryHook<TFnData, TVariables, TError, TPageParam> => {\n return createBaseQuery(options, ReactQuery.useInfiniteQuery)\n}\n"],"names":["createInfiniteQuery","options","createBaseQuery","ReactQuery","useInfiniteQuery"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AASaA,MAAAA,mBAAmB,GAM9BC,OANiC,IAO8B;AAC/D,EAAA,OAAOC,+BAAe,CAACD,OAAD,EAAUE,qBAAU,CAACC,gBAArB,CAAtB,CAAA;AACD;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
import { createBaseQuery } from './createBaseQuery.mjs';
|
|
3
3
|
|
|
4
4
|
const createInfiniteQuery = options => {
|
|
5
|
-
return createBaseQuery(options, useInfiniteQuery);
|
|
5
|
+
return createBaseQuery(options, ReactQuery.useInfiniteQuery);
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export { createInfiniteQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInfiniteQuery.mjs","sources":["../../src/createInfiniteQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createInfiniteQuery.mjs","sources":["../../src/createInfiniteQuery.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateInfiniteQueryOptions,\n InfiniteQueryHook,\n} from './types'\n\nexport const createInfiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>\n): InfiniteQueryHook<TFnData, TVariables, TError, TPageParam> => {\n return createBaseQuery(options, ReactQuery.useInfiniteQuery)\n}\n"],"names":["createInfiniteQuery","options","createBaseQuery","ReactQuery","useInfiniteQuery"],"mappings":";;;AASaA,MAAAA,mBAAmB,GAM9BC,OANiC,IAO8B;AAC/D,EAAA,OAAOC,eAAe,CAACD,OAAD,EAAUE,UAAU,CAACC,gBAArB,CAAtB,CAAA;AACD;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
import { withMiddleware } from './utils.esm.js';
|
|
3
3
|
|
|
4
4
|
const createMutation = defaultOptions => {
|
|
5
5
|
const getKey = () => defaultOptions.mutationKey;
|
|
6
6
|
|
|
7
|
-
return Object.assign(withMiddleware(useMutation, defaultOptions, 'mutations'), {
|
|
7
|
+
return Object.assign(withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'), {
|
|
8
8
|
getKey,
|
|
9
9
|
mutationFn: defaultOptions.mutationFn
|
|
10
10
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMutation.esm.js","sources":["../../src/createMutation.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createMutation.esm.js","sources":["../../src/createMutation.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport type {\n CompatibleError,\n CreateMutationOptions,\n MutationHook,\n} from './types'\nimport { withMiddleware } from './utils'\n\nexport const createMutation = <\n TData = unknown,\n TVariables = void,\n TError = CompatibleError,\n TContext = unknown\n>(\n defaultOptions: CreateMutationOptions<TData, TVariables, TError, TContext>\n): MutationHook<TData, TVariables, TError> => {\n const getKey = () => defaultOptions.mutationKey\n\n return Object.assign(\n withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'),\n {\n getKey,\n mutationFn: defaultOptions.mutationFn,\n }\n ) as MutationHook<TData, TVariables, TError>\n}\n"],"names":["createMutation","defaultOptions","getKey","mutationKey","Object","assign","withMiddleware","ReactQuery","useMutation","mutationFn"],"mappings":";;;AASaA,MAAAA,cAAc,GAMzBC,cAN4B,IAOgB;AAC5C,EAAA,MAAMC,MAAM,GAAG,MAAMD,cAAc,CAACE,WAApC,CAAA;;AAEA,EAAA,OAAOC,MAAM,CAACC,MAAP,CACLC,cAAc,CAACC,UAAU,CAACC,WAAZ,EAAyBP,cAAzB,EAAyC,WAAzC,CADT,EAEL;IACEC,MADF;IAEEO,UAAU,EAAER,cAAc,CAACQ,UAAAA;AAF7B,GAFK,CAAP,CAAA;AAOD;;;;"}
|
|
@@ -2,13 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var ReactQuery = require('@tanstack/react-query');
|
|
6
6
|
var utils = require('./utils.js');
|
|
7
7
|
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n["default"] = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var ReactQuery__namespace = /*#__PURE__*/_interopNamespace(ReactQuery);
|
|
27
|
+
|
|
8
28
|
const createMutation = defaultOptions => {
|
|
9
29
|
const getKey = () => defaultOptions.mutationKey;
|
|
10
30
|
|
|
11
|
-
return Object.assign(utils.withMiddleware(
|
|
31
|
+
return Object.assign(utils.withMiddleware(ReactQuery__namespace.useMutation, defaultOptions, 'mutations'), {
|
|
12
32
|
getKey,
|
|
13
33
|
mutationFn: defaultOptions.mutationFn
|
|
14
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMutation.js","sources":["../../src/createMutation.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createMutation.js","sources":["../../src/createMutation.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport type {\n CompatibleError,\n CreateMutationOptions,\n MutationHook,\n} from './types'\nimport { withMiddleware } from './utils'\n\nexport const createMutation = <\n TData = unknown,\n TVariables = void,\n TError = CompatibleError,\n TContext = unknown\n>(\n defaultOptions: CreateMutationOptions<TData, TVariables, TError, TContext>\n): MutationHook<TData, TVariables, TError> => {\n const getKey = () => defaultOptions.mutationKey\n\n return Object.assign(\n withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'),\n {\n getKey,\n mutationFn: defaultOptions.mutationFn,\n }\n ) as MutationHook<TData, TVariables, TError>\n}\n"],"names":["createMutation","defaultOptions","getKey","mutationKey","Object","assign","withMiddleware","ReactQuery","useMutation","mutationFn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AASaA,MAAAA,cAAc,GAMzBC,cAN4B,IAOgB;AAC5C,EAAA,MAAMC,MAAM,GAAG,MAAMD,cAAc,CAACE,WAApC,CAAA;;AAEA,EAAA,OAAOC,MAAM,CAACC,MAAP,CACLC,oBAAc,CAACC,qBAAU,CAACC,WAAZ,EAAyBP,cAAzB,EAAyC,WAAzC,CADT,EAEL;IACEC,MADF;IAEEO,UAAU,EAAER,cAAc,CAACQ,UAAAA;AAF7B,GAFK,CAAP,CAAA;AAOD;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
import { withMiddleware } from './utils.mjs';
|
|
3
3
|
|
|
4
4
|
const createMutation = defaultOptions => {
|
|
5
5
|
const getKey = () => defaultOptions.mutationKey;
|
|
6
6
|
|
|
7
|
-
return Object.assign(withMiddleware(useMutation, defaultOptions, 'mutations'), {
|
|
7
|
+
return Object.assign(withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'), {
|
|
8
8
|
getKey,
|
|
9
9
|
mutationFn: defaultOptions.mutationFn
|
|
10
10
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMutation.mjs","sources":["../../src/createMutation.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createMutation.mjs","sources":["../../src/createMutation.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport type {\n CompatibleError,\n CreateMutationOptions,\n MutationHook,\n} from './types'\nimport { withMiddleware } from './utils'\n\nexport const createMutation = <\n TData = unknown,\n TVariables = void,\n TError = CompatibleError,\n TContext = unknown\n>(\n defaultOptions: CreateMutationOptions<TData, TVariables, TError, TContext>\n): MutationHook<TData, TVariables, TError> => {\n const getKey = () => defaultOptions.mutationKey\n\n return Object.assign(\n withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'),\n {\n getKey,\n mutationFn: defaultOptions.mutationFn,\n }\n ) as MutationHook<TData, TVariables, TError>\n}\n"],"names":["createMutation","defaultOptions","getKey","mutationKey","Object","assign","withMiddleware","ReactQuery","useMutation","mutationFn"],"mappings":";;;AASaA,MAAAA,cAAc,GAMzBC,cAN4B,IAOgB;AAC5C,EAAA,MAAMC,MAAM,GAAG,MAAMD,cAAc,CAACE,WAApC,CAAA;;AAEA,EAAA,OAAOC,MAAM,CAACC,MAAP,CACLC,cAAc,CAACC,UAAU,CAACC,WAAZ,EAAyBP,cAAzB,EAAyC,WAAzC,CADT,EAEL;IACEC,MADF;IAEEO,UAAU,EAAER,cAAc,CAACQ,UAAAA;AAF7B,GAFK,CAAP,CAAA;AAOD;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
import { createBaseQuery } from './createBaseQuery.esm.js';
|
|
3
3
|
|
|
4
4
|
const createQuery = options => {
|
|
5
|
-
return createBaseQuery(options, useQuery);
|
|
5
|
+
return createBaseQuery(options, ReactQuery.useQuery);
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export { createQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQuery.esm.js","sources":["../../src/createQuery.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createQuery.esm.js","sources":["../../src/createQuery.tsx"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type { CompatibleError, CreateQueryOptions, QueryHook } from './types'\n\nexport const createQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError\n>(\n options: CreateQueryOptions<TFnData, TVariables, TError>\n): QueryHook<TFnData, TVariables, TError> => {\n return createBaseQuery(options, ReactQuery.useQuery)\n}\n"],"names":["createQuery","options","createBaseQuery","ReactQuery","useQuery"],"mappings":";;;AAKaA,MAAAA,WAAW,GAKtBC,OALyB,IAMkB;AAC3C,EAAA,OAAOC,eAAe,CAACD,OAAD,EAAUE,UAAU,CAACC,QAArB,CAAtB,CAAA;AACD;;;;"}
|
package/build/lib/createQuery.js
CHANGED
|
@@ -2,11 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var ReactQuery = require('@tanstack/react-query');
|
|
6
6
|
var createBaseQuery = require('./createBaseQuery.js');
|
|
7
7
|
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n["default"] = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var ReactQuery__namespace = /*#__PURE__*/_interopNamespace(ReactQuery);
|
|
27
|
+
|
|
8
28
|
const createQuery = options => {
|
|
9
|
-
return createBaseQuery.createBaseQuery(options,
|
|
29
|
+
return createBaseQuery.createBaseQuery(options, ReactQuery__namespace.useQuery);
|
|
10
30
|
};
|
|
11
31
|
|
|
12
32
|
exports.createQuery = createQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQuery.js","sources":["../../src/createQuery.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createQuery.js","sources":["../../src/createQuery.tsx"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type { CompatibleError, CreateQueryOptions, QueryHook } from './types'\n\nexport const createQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError\n>(\n options: CreateQueryOptions<TFnData, TVariables, TError>\n): QueryHook<TFnData, TVariables, TError> => {\n return createBaseQuery(options, ReactQuery.useQuery)\n}\n"],"names":["createQuery","options","createBaseQuery","ReactQuery","useQuery"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAKaA,MAAAA,WAAW,GAKtBC,OALyB,IAMkB;AAC3C,EAAA,OAAOC,+BAAe,CAACD,OAAD,EAAUE,qBAAU,CAACC,QAArB,CAAtB,CAAA;AACD;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
import { createBaseQuery } from './createBaseQuery.mjs';
|
|
3
3
|
|
|
4
4
|
const createQuery = options => {
|
|
5
|
-
return createBaseQuery(options, useQuery);
|
|
5
|
+
return createBaseQuery(options, ReactQuery.useQuery);
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export { createQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQuery.mjs","sources":["../../src/createQuery.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createQuery.mjs","sources":["../../src/createQuery.tsx"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type { CompatibleError, CreateQueryOptions, QueryHook } from './types'\n\nexport const createQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError\n>(\n options: CreateQueryOptions<TFnData, TVariables, TError>\n): QueryHook<TFnData, TVariables, TError> => {\n return createBaseQuery(options, ReactQuery.useQuery)\n}\n"],"names":["createQuery","options","createBaseQuery","ReactQuery","useQuery"],"mappings":";;;AAKaA,MAAAA,WAAW,GAKtBC,OALyB,IAMkB;AAC3C,EAAA,OAAOC,eAAe,CAACD,OAAD,EAAUE,UAAU,CAACC,QAArB,CAAtB,CAAA;AACD;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
import { createBaseQuery } from './createBaseQuery.esm.js';
|
|
3
|
-
import { suspenseOptions } from './utils.esm.js';
|
|
3
|
+
import { isV5, suspenseOptions } from './utils.esm.js';
|
|
4
4
|
|
|
5
5
|
const createSuspenseInfiniteQuery = options => {
|
|
6
|
-
return createBaseQuery(options, useInfiniteQuery, suspenseOptions);
|
|
6
|
+
return isV5() ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery) : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions);
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export { createSuspenseInfiniteQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSuspenseInfiniteQuery.esm.js","sources":["../../src/createSuspenseInfiniteQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createSuspenseInfiniteQuery.esm.js","sources":["../../src/createSuspenseInfiniteQuery.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseInfiniteQueryOptions,\n SuspenseInfiniteQueryHook,\n} from './types'\nimport { isV5, suspenseOptions } from './utils'\n\nexport const createSuspenseInfiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: CreateSuspenseInfiniteQueryOptions<\n TFnData,\n TVariables,\n TError,\n TPageParam\n >\n): SuspenseInfiniteQueryHook<TFnData, TVariables, TError, TPageParam> => {\n return isV5()\n ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery)\n : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions)\n}\n"],"names":["createSuspenseInfiniteQuery","options","isV5","createBaseQuery","ReactQuery","useSuspenseInfiniteQuery","useInfiniteQuery","suspenseOptions"],"mappings":";;;;AAUaA,MAAAA,2BAA2B,GAMtCC,OANyC,IAY8B;EACvE,OAAOC,IAAI,KACPC,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACC,wBAArB,CADR,GAEPF,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACE,gBAArB,EAAuCC,eAAvC,CAFnB,CAAA;AAGD;;;;"}
|
|
@@ -2,12 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var ReactQuery = require('@tanstack/react-query');
|
|
6
6
|
var createBaseQuery = require('./createBaseQuery.js');
|
|
7
7
|
var utils = require('./utils.js');
|
|
8
8
|
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n["default"] = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var ReactQuery__namespace = /*#__PURE__*/_interopNamespace(ReactQuery);
|
|
28
|
+
|
|
9
29
|
const createSuspenseInfiniteQuery = options => {
|
|
10
|
-
return createBaseQuery.createBaseQuery(options,
|
|
30
|
+
return utils.isV5() ? createBaseQuery.createBaseQuery(options, ReactQuery__namespace.useSuspenseInfiniteQuery) : createBaseQuery.createBaseQuery(options, ReactQuery__namespace.useInfiniteQuery, utils.suspenseOptions);
|
|
11
31
|
};
|
|
12
32
|
|
|
13
33
|
exports.createSuspenseInfiniteQuery = createSuspenseInfiniteQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSuspenseInfiniteQuery.js","sources":["../../src/createSuspenseInfiniteQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createSuspenseInfiniteQuery.js","sources":["../../src/createSuspenseInfiniteQuery.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseInfiniteQueryOptions,\n SuspenseInfiniteQueryHook,\n} from './types'\nimport { isV5, suspenseOptions } from './utils'\n\nexport const createSuspenseInfiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: CreateSuspenseInfiniteQueryOptions<\n TFnData,\n TVariables,\n TError,\n TPageParam\n >\n): SuspenseInfiniteQueryHook<TFnData, TVariables, TError, TPageParam> => {\n return isV5()\n ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery)\n : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions)\n}\n"],"names":["createSuspenseInfiniteQuery","options","isV5","createBaseQuery","ReactQuery","useSuspenseInfiniteQuery","useInfiniteQuery","suspenseOptions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUaA,MAAAA,2BAA2B,GAMtCC,OANyC,IAY8B;EACvE,OAAOC,UAAI,KACPC,+BAAe,CAACF,OAAD,EAAUG,qBAAU,CAACC,wBAArB,CADR,GAEPF,+BAAe,CAACF,OAAD,EAAUG,qBAAU,CAACE,gBAArB,EAAuCC,qBAAvC,CAFnB,CAAA;AAGD;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
import { createBaseQuery } from './createBaseQuery.mjs';
|
|
3
|
-
import { suspenseOptions } from './utils.mjs';
|
|
3
|
+
import { isV5, suspenseOptions } from './utils.mjs';
|
|
4
4
|
|
|
5
5
|
const createSuspenseInfiniteQuery = options => {
|
|
6
|
-
return createBaseQuery(options, useInfiniteQuery, suspenseOptions);
|
|
6
|
+
return isV5() ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery) : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions);
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export { createSuspenseInfiniteQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSuspenseInfiniteQuery.mjs","sources":["../../src/createSuspenseInfiniteQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createSuspenseInfiniteQuery.mjs","sources":["../../src/createSuspenseInfiniteQuery.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseInfiniteQueryOptions,\n SuspenseInfiniteQueryHook,\n} from './types'\nimport { isV5, suspenseOptions } from './utils'\n\nexport const createSuspenseInfiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: CreateSuspenseInfiniteQueryOptions<\n TFnData,\n TVariables,\n TError,\n TPageParam\n >\n): SuspenseInfiniteQueryHook<TFnData, TVariables, TError, TPageParam> => {\n return isV5()\n ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery)\n : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions)\n}\n"],"names":["createSuspenseInfiniteQuery","options","isV5","createBaseQuery","ReactQuery","useSuspenseInfiniteQuery","useInfiniteQuery","suspenseOptions"],"mappings":";;;;AAUaA,MAAAA,2BAA2B,GAMtCC,OANyC,IAY8B;EACvE,OAAOC,IAAI,KACPC,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACC,wBAArB,CADR,GAEPF,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACE,gBAArB,EAAuCC,eAAvC,CAFnB,CAAA;AAGD;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
import { createBaseQuery } from './createBaseQuery.esm.js';
|
|
3
|
-
import { suspenseOptions } from './utils.esm.js';
|
|
3
|
+
import { isV5, suspenseOptions } from './utils.esm.js';
|
|
4
4
|
|
|
5
5
|
const createSuspenseQuery = options => {
|
|
6
|
-
return createBaseQuery(options, useQuery, suspenseOptions);
|
|
6
|
+
return isV5() ? createBaseQuery(options, ReactQuery.useSuspenseQuery) : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions);
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export { createSuspenseQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSuspenseQuery.esm.js","sources":["../../src/createSuspenseQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createSuspenseQuery.esm.js","sources":["../../src/createSuspenseQuery.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseQueryOptions,\n SuspenseQueryHook,\n} from './types'\nimport { isV5, suspenseOptions } from './utils'\n\nexport const createSuspenseQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError\n>(\n options: CreateSuspenseQueryOptions<TFnData, TVariables, TError>\n): SuspenseQueryHook<TFnData, TVariables, TError> => {\n return isV5()\n ? createBaseQuery(options, ReactQuery.useSuspenseQuery)\n : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions)\n}\n"],"names":["createSuspenseQuery","options","isV5","createBaseQuery","ReactQuery","useSuspenseQuery","useQuery","suspenseOptions"],"mappings":";;;;AAUaA,MAAAA,mBAAmB,GAK9BC,OALiC,IAMkB;EACnD,OAAOC,IAAI,KACPC,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACC,gBAArB,CADR,GAEPF,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACE,QAArB,EAA+BC,eAA/B,CAFnB,CAAA;AAGD;;;;"}
|
|
@@ -2,12 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var ReactQuery = require('@tanstack/react-query');
|
|
6
6
|
var createBaseQuery = require('./createBaseQuery.js');
|
|
7
7
|
var utils = require('./utils.js');
|
|
8
8
|
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n["default"] = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var ReactQuery__namespace = /*#__PURE__*/_interopNamespace(ReactQuery);
|
|
28
|
+
|
|
9
29
|
const createSuspenseQuery = options => {
|
|
10
|
-
return createBaseQuery.createBaseQuery(options,
|
|
30
|
+
return utils.isV5() ? createBaseQuery.createBaseQuery(options, ReactQuery__namespace.useSuspenseQuery) : createBaseQuery.createBaseQuery(options, ReactQuery__namespace.useQuery, utils.suspenseOptions);
|
|
11
31
|
};
|
|
12
32
|
|
|
13
33
|
exports.createSuspenseQuery = createSuspenseQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSuspenseQuery.js","sources":["../../src/createSuspenseQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createSuspenseQuery.js","sources":["../../src/createSuspenseQuery.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseQueryOptions,\n SuspenseQueryHook,\n} from './types'\nimport { isV5, suspenseOptions } from './utils'\n\nexport const createSuspenseQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError\n>(\n options: CreateSuspenseQueryOptions<TFnData, TVariables, TError>\n): SuspenseQueryHook<TFnData, TVariables, TError> => {\n return isV5()\n ? createBaseQuery(options, ReactQuery.useSuspenseQuery)\n : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions)\n}\n"],"names":["createSuspenseQuery","options","isV5","createBaseQuery","ReactQuery","useSuspenseQuery","useQuery","suspenseOptions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUaA,MAAAA,mBAAmB,GAK9BC,OALiC,IAMkB;EACnD,OAAOC,UAAI,KACPC,+BAAe,CAACF,OAAD,EAAUG,qBAAU,CAACC,gBAArB,CADR,GAEPF,+BAAe,CAACF,OAAD,EAAUG,qBAAU,CAACE,QAArB,EAA+BC,qBAA/B,CAFnB,CAAA;AAGD;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
import { createBaseQuery } from './createBaseQuery.mjs';
|
|
3
|
-
import { suspenseOptions } from './utils.mjs';
|
|
3
|
+
import { isV5, suspenseOptions } from './utils.mjs';
|
|
4
4
|
|
|
5
5
|
const createSuspenseQuery = options => {
|
|
6
|
-
return createBaseQuery(options, useQuery, suspenseOptions);
|
|
6
|
+
return isV5() ? createBaseQuery(options, ReactQuery.useSuspenseQuery) : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions);
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export { createSuspenseQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSuspenseQuery.mjs","sources":["../../src/createSuspenseQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createSuspenseQuery.mjs","sources":["../../src/createSuspenseQuery.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseQueryOptions,\n SuspenseQueryHook,\n} from './types'\nimport { isV5, suspenseOptions } from './utils'\n\nexport const createSuspenseQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError\n>(\n options: CreateSuspenseQueryOptions<TFnData, TVariables, TError>\n): SuspenseQueryHook<TFnData, TVariables, TError> => {\n return isV5()\n ? createBaseQuery(options, ReactQuery.useSuspenseQuery)\n : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions)\n}\n"],"names":["createSuspenseQuery","options","isV5","createBaseQuery","ReactQuery","useSuspenseQuery","useQuery","suspenseOptions"],"mappings":";;;;AAUaA,MAAAA,mBAAmB,GAK9BC,OALiC,IAMkB;EACnD,OAAOC,IAAI,KACPC,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACC,gBAArB,CADR,GAEPF,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACE,QAArB,EAA+BC,eAA/B,CAFnB,CAAA;AAGD;;;;"}
|