react-query-kit 2.0.8 → 2.0.9
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/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 +9 -11
- package/build/lib/utils.d.ts +5 -4
- package/build/lib/utils.esm.js +5 -4
- package/build/lib/utils.esm.js.map +1 -1
- package/build/lib/utils.js +25 -3
- package/build/lib/utils.js.map +1 -1
- package/build/lib/utils.mjs +5 -4
- 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 +29 -8
- 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 +1 -1
- package/src/createInfiniteQuery.ts +2 -2
- package/src/createMutation.ts +2 -2
- package/src/createQuery.tsx +2 -2
- package/src/createSuspenseInfiniteQuery.ts +5 -8
- package/src/createSuspenseQuery.ts +5 -5
- package/src/types.ts +9 -23
- package/src/utils.ts +8 -11
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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;;;;"}
|
package/build/lib/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DataTag, DefaultError, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, GetNextPageParamFunction, GetPreviousPageParamFunction, InfiniteData, InfiniteQueryObserverSuccessResult, MutationFunction, MutationKey, QueryClient, QueryFunction, QueryKey, QueryKeyHashFunction, QueryObserverSuccessResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
type CompatibleWithV4<V5, V4> = InfiniteData<unknown> extends UseInfiniteQueryResult<InfiniteData<unknown>>['data'] ? V5 : V4;
|
|
3
|
-
type CompatibleQueryFunction<T = unknown, TQueryKey extends QueryKey = QueryKey, TPageParam =
|
|
3
|
+
type CompatibleQueryFunction<T = unknown, TQueryKey extends QueryKey = QueryKey, TPageParam = never> = CompatibleWithV4<QueryFunction<T, TQueryKey, TPageParam>, QueryFunction<T, TQueryKey>>;
|
|
4
4
|
type CompatibleInfiniteQueryPageParamsOptions<TQueryFnData = unknown, TPageParam = unknown> = CompatibleWithV4<{
|
|
5
5
|
getPreviousPageParam?: GetPreviousPageParamFunction<TPageParam, TQueryFnData>;
|
|
6
6
|
getNextPageParam: GetNextPageParamFunction<TPageParam, TQueryFnData>;
|
|
@@ -19,7 +19,7 @@ export type CompatibleError = CompatibleWithV4<DefaultError, Error>;
|
|
|
19
19
|
type GetQueryKey<TVariables> = TVariables extends void ? [string] : [string, TVariables];
|
|
20
20
|
export type inferQueryKey<TFnData, TVariables, TPageParam = never> = CompatibleWithV4<DataTag<GetQueryKey<TVariables>, [
|
|
21
21
|
TPageParam
|
|
22
|
-
] extends [never] ? TFnData :
|
|
22
|
+
] extends [never] ? TFnData : InfiniteData<TFnData, TPageParam>>, GetQueryKey<TVariables>>;
|
|
23
23
|
export type AdditionalQueryOptions<TFnData, TVariables, TPageParam = never> = {
|
|
24
24
|
primaryKey: string;
|
|
25
25
|
queryFn: CompatibleQueryFunction<TFnData, inferQueryKey<TFnData, TVariables, TPageParam>, TPageParam>;
|
|
@@ -36,20 +36,18 @@ export type ExposeMethods<TFnData, TVariables, TError, TPageParam = never> = {
|
|
|
36
36
|
queryFn: CompatibleQueryFunction<TFnData, inferQueryKey<TFnData, TVariables, TPageParam>, TPageParam>;
|
|
37
37
|
queryKeyHashFn: QueryKeyHashFunction<inferQueryKey<TFnData, TVariables, TPageParam>>;
|
|
38
38
|
getFetchOptions: (variables: TVariables extends void ? TVariables | void : TVariables) => [TPageParam] extends [never] ? {
|
|
39
|
-
queryKey: inferQueryKey<TFnData, TVariables
|
|
40
|
-
queryFn: CompatibleQueryFunction<TFnData, inferQueryKey<TFnData, TVariables
|
|
41
|
-
queryKeyHashFn?: QueryKeyHashFunction<inferQueryKey<TFnData, TVariables
|
|
39
|
+
queryKey: inferQueryKey<TFnData, TVariables>;
|
|
40
|
+
queryFn: CompatibleQueryFunction<TFnData, inferQueryKey<TFnData, TVariables>>;
|
|
41
|
+
queryKeyHashFn?: QueryKeyHashFunction<inferQueryKey<TFnData, TVariables>>;
|
|
42
42
|
} : {
|
|
43
43
|
queryKey: inferQueryKey<TFnData, TVariables, TPageParam>;
|
|
44
44
|
queryFn: CompatibleQueryFunction<TFnData, inferQueryKey<TFnData, TVariables, TPageParam>, TPageParam>;
|
|
45
45
|
queryKeyHashFn?: QueryKeyHashFunction<inferQueryKey<TFnData, TVariables, TPageParam>>;
|
|
46
46
|
} & CompatibleInfiniteQueryPageParamsOptions<TFnData, TPageParam>;
|
|
47
|
-
getOptions: (variables: TVariables extends void ? TVariables | void : TVariables) => [TPageParam] extends [never] ? CompatibleWithV4<UseQueryOptions<TFnData, TError, TFnData,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
queryFn: CompatibleQueryFunction<TFnData, inferQueryKey<TFnData, TVariables, TPageParam>, TPageParam>;
|
|
52
|
-
queryKeyHashFn?: QueryKeyHashFunction<inferQueryKey<TFnData, TVariables, TPageParam>>;
|
|
47
|
+
getOptions: (variables: TVariables extends void ? TVariables | void : TVariables) => [TPageParam] extends [never] ? CompatibleWithV4<UseQueryOptions<TFnData, TError, TFnData, DataTag<GetQueryKey<TVariables>, TFnData>>, {
|
|
48
|
+
queryKey: GetQueryKey<TVariables>;
|
|
49
|
+
queryFn: QueryFunction<TFnData, GetQueryKey<TVariables>>;
|
|
50
|
+
queryKeyHashFn?: QueryKeyHashFunction<GetQueryKey<TVariables>>;
|
|
53
51
|
}> : CompatibleUseInfiniteQueryOptions<TFnData, TVariables, TFnData, TError, TPageParam>;
|
|
54
52
|
};
|
|
55
53
|
export interface CreateQueryOptions<TFnData = unknown, TVariables = void, TError = CompatibleError> extends Omit<UseQueryOptions<TFnData, TError, TFnData, inferQueryKey<TFnData, TVariables>>, 'queryKey' | 'queryFn' | 'select'>, AdditionalQueryOptions<TFnData, TVariables> {
|
package/build/lib/utils.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
import type { Middleware, inferQueryKey } from './types';
|
|
3
3
|
export declare const withMiddleware: (hook: any, defaultOptions: any, type: 'queries' | 'mutations') => (options?: {
|
|
4
|
-
client?: QueryClient;
|
|
4
|
+
client?: ReactQuery.QueryClient;
|
|
5
5
|
use?: Middleware[];
|
|
6
|
-
}, queryClient?: QueryClient) => any;
|
|
6
|
+
}, queryClient?: ReactQuery.QueryClient) => any;
|
|
7
7
|
export declare const suspenseOptions: {
|
|
8
8
|
enabled: boolean;
|
|
9
9
|
suspense: boolean;
|
|
10
|
-
useErrorBoundary: (_error: unknown, query: Query) => boolean;
|
|
10
|
+
useErrorBoundary: (_error: unknown, query: ReactQuery.Query) => boolean;
|
|
11
11
|
};
|
|
12
|
+
export declare const isV5: () => boolean;
|
|
12
13
|
export declare const getKey: <TVariables = void>(primaryKey: string, variables?: TVariables | undefined) => inferQueryKey<unknown, TVariables>;
|
package/build/lib/utils.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ReactQuery from '@tanstack/react-query';
|
|
2
2
|
|
|
3
3
|
const withMiddleware = (hook, defaultOptions, type) => {
|
|
4
4
|
return function useMiddleware(options, queryClient) {
|
|
5
|
-
const [middleware, opts] = [useQueryClient( // @ts-ignore Compatible with ReactQuery v4
|
|
6
|
-
|
|
5
|
+
const [middleware, opts] = [ReactQuery.useQueryClient( // @ts-ignore Compatible with ReactQuery v4
|
|
6
|
+
isV5() ? queryClient : options).getDefaultOptions()[type], defaultOptions, options].reduce(([u1, o1], {
|
|
7
7
|
use: u2 = [],
|
|
8
8
|
...o2
|
|
9
9
|
} = {}) => [[...u1, ...u2], { ...o1,
|
|
@@ -24,9 +24,10 @@ const suspenseOptions = {
|
|
|
24
24
|
suspense: true,
|
|
25
25
|
useErrorBoundary: (_error, query) => query.state.data === undefined
|
|
26
26
|
};
|
|
27
|
+
const isV5 = () => !!ReactQuery.useSuspenseQuery;
|
|
27
28
|
const getKey = (primaryKey, variables) => {
|
|
28
29
|
return variables === undefined ? [primaryKey] : [primaryKey, variables];
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
export { getKey, suspenseOptions, withMiddleware };
|
|
32
|
+
export { getKey, isV5, suspenseOptions, withMiddleware };
|
|
32
33
|
//# sourceMappingURL=utils.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.esm.js","sources":["../../src/utils.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"utils.esm.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport type { Middleware, inferQueryKey } from './types'\n\nexport const withMiddleware = (\n hook: any,\n defaultOptions: any,\n type: 'queries' | 'mutations'\n) => {\n return function useMiddleware(\n options?: { client?: ReactQuery.QueryClient; use?: Middleware[] },\n queryClient?: ReactQuery.QueryClient\n ) {\n const [middleware, opts] = [\n ReactQuery.useQueryClient(\n // @ts-ignore Compatible with ReactQuery v4\n isV5() ? queryClient : options\n ).getDefaultOptions()[type],\n defaultOptions,\n options,\n ].reduce(\n ([u1, o1], { use: u2 = [], ...o2 } = {}) => [\n [...u1, ...u2],\n { ...o1, ...o2 },\n ],\n [[]]\n )\n\n let next = hook\n for (let i = middleware.length; i--; ) {\n next = middleware[i](next)\n }\n\n return next(opts, queryClient)\n }\n}\n\n// Compatible with ReactQuery v4\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: ReactQuery.Query) =>\n query.state.data === undefined,\n}\n\nexport const isV5 = () => !!ReactQuery.useSuspenseQuery\n\nexport const getKey = <TVariables = void>(\n primaryKey: string,\n variables?: TVariables\n) => {\n return (\n variables === undefined ? [primaryKey] : [primaryKey, variables]\n ) as inferQueryKey<unknown, TVariables>\n}\n"],"names":["withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","middleware","opts","ReactQuery","useQueryClient","isV5","getDefaultOptions","reduce","u1","o1","use","u2","o2","next","i","length","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","undefined","useSuspenseQuery","getKey","primaryKey","variables"],"mappings":";;AAIO,MAAMA,cAAc,GAAG,CAC5BC,IAD4B,EAE5BC,cAF4B,EAG5BC,IAH4B,KAIzB;AACH,EAAA,OAAO,SAASC,aAAT,CACLC,OADK,EAELC,WAFK,EAGL;IACA,MAAM,CAACC,UAAD,EAAaC,IAAb,IAAqB,CACzBC,UAAU,CAACC,cAAX;IAEEC,IAAI,EAAA,GAAKL,WAAL,GAAmBD,OAFzB,EAGEO,iBAHF,EAAA,CAGsBT,IAHtB,CADyB,EAKzBD,cALyB,EAMzBG,OANyB,CAAA,CAOzBQ,MAPyB,CAQzB,CAAC,CAACC,EAAD,EAAKC,EAAL,CAAD,EAAW;MAAEC,GAAG,EAAEC,EAAE,GAAG,EAAZ;MAAgB,GAAGC,EAAAA;AAAnB,KAAA,GAA0B,EAArC,KAA4C,CAC1C,CAAC,GAAGJ,EAAJ,EAAQ,GAAGG,EAAX,CAD0C,EAE1C,EAAE,GAAGF,EAAL;MAAS,GAAGG,EAAAA;AAAZ,KAF0C,CARnB,EAYzB,CAAC,EAAD,CAZyB,CAA3B,CAAA;IAeA,IAAIC,IAAI,GAAGlB,IAAX,CAAA;;IACA,KAAK,IAAImB,CAAC,GAAGb,UAAU,CAACc,MAAxB,EAAgCD,CAAC,EAAjC,GAAuC;AACrCD,MAAAA,IAAI,GAAGZ,UAAU,CAACa,CAAD,CAAV,CAAcD,IAAd,CAAP,CAAA;AACD,KAAA;;AAED,IAAA,OAAOA,IAAI,CAACX,IAAD,EAAOF,WAAP,CAAX,CAAA;GAxBF,CAAA;AA0BD;;AAGM,MAAMgB,eAAe,GAAG;AAC7BC,EAAAA,OAAO,EAAE,IADoB;AAE7BC,EAAAA,QAAQ,EAAE,IAFmB;EAG7BC,gBAAgB,EAAE,CAACC,MAAD,EAAkBC,KAAlB,KAChBA,KAAK,CAACC,KAAN,CAAYC,IAAZ,KAAqBC,SAAAA;AAJM,EAAxB;AAOA,MAAMnB,IAAI,GAAG,MAAM,CAAC,CAACF,UAAU,CAACsB,iBAAhC;MAEMC,MAAM,GAAG,CACpBC,UADoB,EAEpBC,SAFoB,KAGjB;AACH,EAAA,OACEA,SAAS,KAAKJ,SAAd,GAA0B,CAACG,UAAD,CAA1B,GAAyC,CAACA,UAAD,EAAaC,SAAb,CAD3C,CAAA;AAGD;;;;"}
|