react-query-kit 3.0.0-beta.1 → 3.0.0-beta.2
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 +1 -1
- package/build/lib/createInfiniteQuery.esm.js.map +1 -1
- package/build/lib/createInfiniteQuery.js +2 -22
- package/build/lib/createInfiniteQuery.js.map +1 -1
- package/build/lib/createInfiniteQuery.mjs +1 -1
- package/build/lib/createInfiniteQuery.mjs.map +1 -1
- package/build/lib/createMutation.esm.js +1 -2
- package/build/lib/createMutation.esm.js.map +1 -1
- package/build/lib/createMutation.js +1 -22
- package/build/lib/createMutation.js.map +1 -1
- package/build/lib/createMutation.mjs +1 -2
- package/build/lib/createMutation.mjs.map +1 -1
- package/build/lib/createQuery.esm.js +1 -1
- package/build/lib/createQuery.esm.js.map +1 -1
- package/build/lib/createQuery.js +2 -22
- package/build/lib/createQuery.js.map +1 -1
- package/build/lib/createQuery.mjs +1 -1
- package/build/lib/createQuery.mjs.map +1 -1
- package/build/lib/createSuspenseInfiniteQuery.esm.js +1 -2
- package/build/lib/createSuspenseInfiniteQuery.esm.js.map +1 -1
- package/build/lib/createSuspenseInfiniteQuery.js +1 -22
- package/build/lib/createSuspenseInfiniteQuery.js.map +1 -1
- package/build/lib/createSuspenseInfiniteQuery.mjs +1 -2
- package/build/lib/createSuspenseInfiniteQuery.mjs.map +1 -1
- package/build/lib/createSuspenseQuery.esm.js +1 -2
- package/build/lib/createSuspenseQuery.esm.js.map +1 -1
- package/build/lib/createSuspenseQuery.js +1 -22
- package/build/lib/createSuspenseQuery.js.map +1 -1
- package/build/lib/createSuspenseQuery.mjs +1 -2
- package/build/lib/createSuspenseQuery.mjs.map +1 -1
- package/build/lib/utils.d.ts +3 -2
- package/build/lib/utils.esm.js +4 -4
- package/build/lib/utils.esm.js.map +1 -1
- package/build/lib/utils.js +6 -5
- package/build/lib/utils.js.map +1 -1
- package/build/lib/utils.mjs +4 -4
- package/build/lib/utils.mjs.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats.json +84 -102
- package/build/umd/index.development.js +10 -10
- 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 +1 -2
- package/src/createMutation.ts +1 -3
- package/src/createQuery.ts +1 -2
- package/src/createSuspenseInfiniteQuery.ts +1 -3
- package/src/createSuspenseQuery.ts +1 -3
- package/src/utils.ts +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as ReactQuery from '@tanstack/react-query';
|
|
2
1
|
import { createBaseQuery } from './createBaseQuery.esm.js';
|
|
2
|
+
import { ReactQuery } from './utils.esm.js';
|
|
3
3
|
|
|
4
4
|
const createInfiniteQuery = options => {
|
|
5
5
|
return createBaseQuery(options, ReactQuery.useInfiniteQuery);
|
|
@@ -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 { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateInfiniteQueryOptions,\n InfiniteQueryHook,\n} from './types'\nimport { ReactQuery } from './utils'\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":";;;AAQaA,MAAAA,mBAAmB,GAM9BC,OANiC,IAO8B;AAC/D,EAAA,OAAOC,eAAe,CAACD,OAAD,EAAUE,UAAU,CAACC,gBAArB,CAAtB,CAAA;AACD;;;;"}
|
|
@@ -2,31 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ReactQuery = require('@tanstack/react-query');
|
|
6
5
|
var createBaseQuery = require('./createBaseQuery.js');
|
|
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);
|
|
6
|
+
var utils = require('./utils.js');
|
|
27
7
|
|
|
28
8
|
const createInfiniteQuery = options => {
|
|
29
|
-
return createBaseQuery.createBaseQuery(options,
|
|
9
|
+
return createBaseQuery.createBaseQuery(options, utils.ReactQuery.useInfiniteQuery);
|
|
30
10
|
};
|
|
31
11
|
|
|
32
12
|
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 { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateInfiniteQueryOptions,\n InfiniteQueryHook,\n} from './types'\nimport { ReactQuery } from './utils'\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":";;;;;;;AAQaA,MAAAA,mBAAmB,GAM9BC,OANiC,IAO8B;AAC/D,EAAA,OAAOC,+BAAe,CAACD,OAAD,EAAUE,gBAAU,CAACC,gBAArB,CAAtB,CAAA;AACD;;;;"}
|
|
@@ -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 { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateInfiniteQueryOptions,\n InfiniteQueryHook,\n} from './types'\nimport { ReactQuery } from './utils'\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":";;;AAQaA,MAAAA,mBAAmB,GAM9BC,OANiC,IAO8B;AAC/D,EAAA,OAAOC,eAAe,CAACD,OAAD,EAAUE,UAAU,CAACC,gBAArB,CAAtB,CAAA;AACD;;;;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { withMiddleware } from './utils.esm.js';
|
|
1
|
+
import { withMiddleware, ReactQuery } from './utils.esm.js';
|
|
3
2
|
|
|
4
3
|
const createMutation = defaultOptions => {
|
|
5
4
|
return Object.assign(withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'), {
|
|
@@ -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 type {\n CompatibleError,\n CreateMutationOptions,\n MutationHook,\n} from './types'\nimport { ReactQuery, 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, TContext> => {\n return Object.assign(\n withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'),\n {\n getKey: () => defaultOptions.mutationKey,\n getOptions: () => defaultOptions,\n mutationFn: defaultOptions.mutationFn,\n }\n ) as MutationHook<TData, TVariables, TError, TContext>\n}\n"],"names":["createMutation","defaultOptions","Object","assign","withMiddleware","ReactQuery","useMutation","getKey","mutationKey","getOptions","mutationFn"],"mappings":";;AAOaA,MAAAA,cAAc,GAMzBC,cAN4B,IAO0B;AACtD,EAAA,OAAOC,MAAM,CAACC,MAAP,CACLC,cAAc,CAACC,UAAU,CAACC,WAAZ,EAAyBL,cAAzB,EAAyC,WAAzC,CADT,EAEL;AACEM,IAAAA,MAAM,EAAE,MAAMN,cAAc,CAACO,WAD/B;IAEEC,UAAU,EAAE,MAAMR,cAFpB;IAGES,UAAU,EAAET,cAAc,CAACS,UAAAA;AAH7B,GAFK,CAAP,CAAA;AAQD;;;;"}
|
|
@@ -2,31 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ReactQuery = require('@tanstack/react-query');
|
|
6
5
|
var utils = require('./utils.js');
|
|
7
6
|
|
|
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
|
-
|
|
28
7
|
const createMutation = defaultOptions => {
|
|
29
|
-
return Object.assign(utils.withMiddleware(
|
|
8
|
+
return Object.assign(utils.withMiddleware(utils.ReactQuery.useMutation, defaultOptions, 'mutations'), {
|
|
30
9
|
getKey: () => defaultOptions.mutationKey,
|
|
31
10
|
getOptions: () => defaultOptions,
|
|
32
11
|
mutationFn: defaultOptions.mutationFn
|
|
@@ -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 type {\n CompatibleError,\n CreateMutationOptions,\n MutationHook,\n} from './types'\nimport { ReactQuery, 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, TContext> => {\n return Object.assign(\n withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'),\n {\n getKey: () => defaultOptions.mutationKey,\n getOptions: () => defaultOptions,\n mutationFn: defaultOptions.mutationFn,\n }\n ) as MutationHook<TData, TVariables, TError, TContext>\n}\n"],"names":["createMutation","defaultOptions","Object","assign","withMiddleware","ReactQuery","useMutation","getKey","mutationKey","getOptions","mutationFn"],"mappings":";;;;;;AAOaA,MAAAA,cAAc,GAMzBC,cAN4B,IAO0B;AACtD,EAAA,OAAOC,MAAM,CAACC,MAAP,CACLC,oBAAc,CAACC,gBAAU,CAACC,WAAZ,EAAyBL,cAAzB,EAAyC,WAAzC,CADT,EAEL;AACEM,IAAAA,MAAM,EAAE,MAAMN,cAAc,CAACO,WAD/B;IAEEC,UAAU,EAAE,MAAMR,cAFpB;IAGES,UAAU,EAAET,cAAc,CAACS,UAAAA;AAH7B,GAFK,CAAP,CAAA;AAQD;;;;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { withMiddleware } from './utils.mjs';
|
|
1
|
+
import { withMiddleware, ReactQuery } from './utils.mjs';
|
|
3
2
|
|
|
4
3
|
const createMutation = defaultOptions => {
|
|
5
4
|
return Object.assign(withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'), {
|
|
@@ -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 type {\n CompatibleError,\n CreateMutationOptions,\n MutationHook,\n} from './types'\nimport { ReactQuery, 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, TContext> => {\n return Object.assign(\n withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'),\n {\n getKey: () => defaultOptions.mutationKey,\n getOptions: () => defaultOptions,\n mutationFn: defaultOptions.mutationFn,\n }\n ) as MutationHook<TData, TVariables, TError, TContext>\n}\n"],"names":["createMutation","defaultOptions","Object","assign","withMiddleware","ReactQuery","useMutation","getKey","mutationKey","getOptions","mutationFn"],"mappings":";;AAOaA,MAAAA,cAAc,GAMzBC,cAN4B,IAO0B;AACtD,EAAA,OAAOC,MAAM,CAACC,MAAP,CACLC,cAAc,CAACC,UAAU,CAACC,WAAZ,EAAyBL,cAAzB,EAAyC,WAAzC,CADT,EAEL;AACEM,IAAAA,MAAM,EAAE,MAAMN,cAAc,CAACO,WAD/B;IAEEC,UAAU,EAAE,MAAMR,cAFpB;IAGES,UAAU,EAAET,cAAc,CAACS,UAAAA;AAH7B,GAFK,CAAP,CAAA;AAQD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQuery.esm.js","sources":["../../src/createQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createQuery.esm.js","sources":["../../src/createQuery.ts"],"sourcesContent":["import { createBaseQuery } from './createBaseQuery'\nimport type { CompatibleError, CreateQueryOptions, QueryHook } from './types'\nimport { ReactQuery } from './utils'\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":";;;AAIaA,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,31 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ReactQuery = require('@tanstack/react-query');
|
|
6
5
|
var createBaseQuery = require('./createBaseQuery.js');
|
|
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);
|
|
6
|
+
var utils = require('./utils.js');
|
|
27
7
|
|
|
28
8
|
const createQuery = options => {
|
|
29
|
-
return createBaseQuery.createBaseQuery(options,
|
|
9
|
+
return createBaseQuery.createBaseQuery(options, utils.ReactQuery.useQuery);
|
|
30
10
|
};
|
|
31
11
|
|
|
32
12
|
exports.createQuery = createQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQuery.js","sources":["../../src/createQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createQuery.js","sources":["../../src/createQuery.ts"],"sourcesContent":["import { createBaseQuery } from './createBaseQuery'\nimport type { CompatibleError, CreateQueryOptions, QueryHook } from './types'\nimport { ReactQuery } from './utils'\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":";;;;;;;AAIaA,MAAAA,WAAW,GAKtBC,OALyB,IAMkB;AAC3C,EAAA,OAAOC,+BAAe,CAACD,OAAD,EAAUE,gBAAU,CAACC,QAArB,CAAtB,CAAA;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQuery.mjs","sources":["../../src/createQuery.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"createQuery.mjs","sources":["../../src/createQuery.ts"],"sourcesContent":["import { createBaseQuery } from './createBaseQuery'\nimport type { CompatibleError, CreateQueryOptions, QueryHook } from './types'\nimport { ReactQuery } from './utils'\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":";;;AAIaA,MAAAA,WAAW,GAKtBC,OALyB,IAMkB;AAC3C,EAAA,OAAOC,eAAe,CAACD,OAAD,EAAUE,UAAU,CAACC,QAArB,CAAtB,CAAA;AACD;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as ReactQuery from '@tanstack/react-query';
|
|
2
1
|
import { createBaseQuery } from './createBaseQuery.esm.js';
|
|
3
|
-
import { isV5, suspenseOptions } from './utils.esm.js';
|
|
2
|
+
import { isV5, ReactQuery, suspenseOptions } from './utils.esm.js';
|
|
4
3
|
|
|
5
4
|
const createSuspenseInfiniteQuery = options => {
|
|
6
5
|
return isV5 ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery) : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions);
|
|
@@ -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 { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseInfiniteQueryOptions,\n SuspenseInfiniteQueryHook,\n} from './types'\nimport { ReactQuery, 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":";;;AAQaA,MAAAA,2BAA2B,GAMtCC,OANyC,IAY8B;EACvE,OAAOC,IAAI,GACPC,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACC,wBAArB,CADR,GAEPF,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACE,gBAArB,EAAuCC,eAAvC,CAFnB,CAAA;AAGD;;;;"}
|
|
@@ -2,32 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ReactQuery = require('@tanstack/react-query');
|
|
6
5
|
var createBaseQuery = require('./createBaseQuery.js');
|
|
7
6
|
var utils = require('./utils.js');
|
|
8
7
|
|
|
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
|
-
|
|
29
8
|
const createSuspenseInfiniteQuery = options => {
|
|
30
|
-
return utils.isV5 ? createBaseQuery.createBaseQuery(options,
|
|
9
|
+
return utils.isV5 ? createBaseQuery.createBaseQuery(options, utils.ReactQuery.useSuspenseInfiniteQuery) : createBaseQuery.createBaseQuery(options, utils.ReactQuery.useInfiniteQuery, utils.suspenseOptions);
|
|
31
10
|
};
|
|
32
11
|
|
|
33
12
|
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 { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseInfiniteQueryOptions,\n SuspenseInfiniteQueryHook,\n} from './types'\nimport { ReactQuery, 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":";;;;;;;AAQaA,MAAAA,2BAA2B,GAMtCC,OANyC,IAY8B;EACvE,OAAOC,UAAI,GACPC,+BAAe,CAACF,OAAD,EAAUG,gBAAU,CAACC,wBAArB,CADR,GAEPF,+BAAe,CAACF,OAAD,EAAUG,gBAAU,CAACE,gBAArB,EAAuCC,qBAAvC,CAFnB,CAAA;AAGD;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as ReactQuery from '@tanstack/react-query';
|
|
2
1
|
import { createBaseQuery } from './createBaseQuery.mjs';
|
|
3
|
-
import { isV5, suspenseOptions } from './utils.mjs';
|
|
2
|
+
import { isV5, ReactQuery, suspenseOptions } from './utils.mjs';
|
|
4
3
|
|
|
5
4
|
const createSuspenseInfiniteQuery = options => {
|
|
6
5
|
return isV5 ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery) : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions);
|
|
@@ -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 { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseInfiniteQueryOptions,\n SuspenseInfiniteQueryHook,\n} from './types'\nimport { ReactQuery, 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":";;;AAQaA,MAAAA,2BAA2B,GAMtCC,OANyC,IAY8B;EACvE,OAAOC,IAAI,GACPC,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACC,wBAArB,CADR,GAEPF,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACE,gBAArB,EAAuCC,eAAvC,CAFnB,CAAA;AAGD;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as ReactQuery from '@tanstack/react-query';
|
|
2
1
|
import { createBaseQuery } from './createBaseQuery.esm.js';
|
|
3
|
-
import { isV5, suspenseOptions } from './utils.esm.js';
|
|
2
|
+
import { isV5, ReactQuery, suspenseOptions } from './utils.esm.js';
|
|
4
3
|
|
|
5
4
|
const createSuspenseQuery = options => {
|
|
6
5
|
return isV5 ? createBaseQuery(options, ReactQuery.useSuspenseQuery) : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions);
|
|
@@ -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 { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseQueryOptions,\n SuspenseQueryHook,\n} from './types'\nimport { ReactQuery, 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":";;;AAQaA,MAAAA,mBAAmB,GAK9BC,OALiC,IAMkB;EACnD,OAAOC,IAAI,GACPC,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACC,gBAArB,CADR,GAEPF,eAAe,CAACF,OAAD,EAAUG,UAAU,CAACE,QAArB,EAA+BC,eAA/B,CAFnB,CAAA;AAGD;;;;"}
|
|
@@ -2,32 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ReactQuery = require('@tanstack/react-query');
|
|
6
5
|
var createBaseQuery = require('./createBaseQuery.js');
|
|
7
6
|
var utils = require('./utils.js');
|
|
8
7
|
|
|
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
|
-
|
|
29
8
|
const createSuspenseQuery = options => {
|
|
30
|
-
return utils.isV5 ? createBaseQuery.createBaseQuery(options,
|
|
9
|
+
return utils.isV5 ? createBaseQuery.createBaseQuery(options, utils.ReactQuery.useSuspenseQuery) : createBaseQuery.createBaseQuery(options, utils.ReactQuery.useQuery, utils.suspenseOptions);
|
|
31
10
|
};
|
|
32
11
|
|
|
33
12
|
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 { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseQueryOptions,\n SuspenseQueryHook,\n} from './types'\nimport { ReactQuery, 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":";;;;;;;AAQaA,MAAAA,mBAAmB,GAK9BC,OALiC,IAMkB;EACnD,OAAOC,UAAI,GACPC,+BAAe,CAACF,OAAD,EAAUG,gBAAU,CAACC,gBAArB,CADR,GAEPF,+BAAe,CAACF,OAAD,EAAUG,gBAAU,CAACE,QAArB,EAA+BC,qBAA/B,CAFnB,CAAA;AAGD;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as ReactQuery from '@tanstack/react-query';
|
|
2
1
|
import { createBaseQuery } from './createBaseQuery.mjs';
|
|
3
|
-
import { isV5, suspenseOptions } from './utils.mjs';
|
|
2
|
+
import { isV5, ReactQuery, suspenseOptions } from './utils.mjs';
|
|
4
3
|
|
|
5
4
|
const createSuspenseQuery = options => {
|
|
6
5
|
return isV5 ? createBaseQuery(options, ReactQuery.useSuspenseQuery) : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions);
|
|
@@ -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 { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseQueryOptions,\n SuspenseQueryHook,\n} from './types'\nimport { ReactQuery, 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":";;;AAQaA,MAAAA,mBAAmB,GAK9BC,OALiC,IAMkB;EACnD,OAAOC,IAAI,GACPC,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/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as TanstackReactQuery from '@tanstack/react-query';
|
|
2
2
|
import type { Query, QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import type { Middleware } from './types';
|
|
4
|
+
export declare const ReactQuery: typeof TanstackReactQuery;
|
|
4
5
|
export declare const isV5 = true;
|
|
5
6
|
export declare const suspenseOptions: {
|
|
6
7
|
enabled: boolean;
|
|
@@ -11,4 +12,4 @@ export declare const withMiddleware: (hook: any, defaultOptions: any, type: 'que
|
|
|
11
12
|
client?: QueryClient;
|
|
12
13
|
use?: Middleware[];
|
|
13
14
|
}, queryClient?: QueryClient) => any;
|
|
14
|
-
export declare const getKey: (queryKey:
|
|
15
|
+
export declare const getKey: (queryKey: TanstackReactQuery.QueryKey, variables?: any) => TanstackReactQuery.QueryKey;
|
package/build/lib/utils.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
const isV5 = !!ReactQuery.useSuspenseQuery; // Compatible with ReactQuery v4
|
|
1
|
+
import * as TanstackReactQuery from '@tanstack/react-query';
|
|
4
2
|
|
|
3
|
+
const ReactQuery = TanstackReactQuery;
|
|
4
|
+
const isV5 = !!ReactQuery.useSuspenseQuery;
|
|
5
5
|
const suspenseOptions = {
|
|
6
6
|
enabled: true,
|
|
7
7
|
suspense: true,
|
|
@@ -29,5 +29,5 @@ const getKey = (queryKey, variables) => {
|
|
|
29
29
|
return variables === undefined ? [...queryKey] : [...queryKey, variables];
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
export { getKey, isV5, suspenseOptions, withMiddleware };
|
|
32
|
+
export { ReactQuery, getKey, isV5, suspenseOptions, withMiddleware };
|
|
33
33
|
//# sourceMappingURL=utils.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.esm.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as
|
|
1
|
+
{"version":3,"file":"utils.esm.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as TanstackReactQuery from '@tanstack/react-query'\nimport type { Query, QueryClient, QueryKey } from '@tanstack/react-query'\n\nimport type { Middleware } from './types'\n\nexport const ReactQuery = TanstackReactQuery\n\nexport const isV5 = !!ReactQuery.useSuspenseQuery\n\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: Query) =>\n query.state.data === undefined,\n}\n\nexport const withMiddleware = (\n hook: any,\n defaultOptions: any,\n type: 'queries' | 'mutations'\n) => {\n return function useMiddleware(\n options?: { client?: QueryClient; use?: Middleware[] },\n queryClient?: 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\nexport const getKey = (queryKey: QueryKey, variables?: any): QueryKey => {\n return variables === undefined ? [...queryKey] : [...queryKey, variables]\n}\n"],"names":["ReactQuery","TanstackReactQuery","isV5","useSuspenseQuery","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","undefined","withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","middleware","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","next","i","length","getKey","queryKey","variables"],"mappings":";;AAKO,MAAMA,UAAU,GAAGC,mBAAnB;MAEMC,IAAI,GAAG,CAAC,CAACF,UAAU,CAACG,iBAA1B;AAEA,MAAMC,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,MAAMC,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,CACzBrB,UAAU,CAACsB,cAAX;IAEEpB,IAAI,GAAGiB,WAAH,GAAiBD,OAFvB,EAGEK,iBAHF,EAAA,CAGsBP,IAHtB,CADyB,EAKzBD,cALyB,EAMzBG,OANyB,CAAA,CAOzBM,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,GAAGhB,IAAX,CAAA;;IACA,KAAK,IAAIiB,CAAC,GAAGX,UAAU,CAACY,MAAxB,EAAgCD,CAAC,EAAjC,GAAuC;AACrCD,MAAAA,IAAI,GAAGV,UAAU,CAACW,CAAD,CAAV,CAAcD,IAAd,CAAP,CAAA;AACD,KAAA;;AAED,IAAA,OAAOA,IAAI,CAACT,IAAD,EAAOF,WAAP,CAAX,CAAA;GAxBF,CAAA;AA0BD,EA/BM;MAiCMc,MAAM,GAAG,CAACC,QAAD,EAAqBC,SAArB,KAAmD;AACvE,EAAA,OAAOA,SAAS,KAAKvB,SAAd,GAA0B,CAAC,GAAGsB,QAAJ,CAA1B,GAA0C,CAAC,GAAGA,QAAJ,EAAcC,SAAd,CAAjD,CAAA;AACD;;;;"}
|
package/build/lib/utils.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var TanstackReactQuery = require('@tanstack/react-query');
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -22,10 +22,10 @@ function _interopNamespace(e) {
|
|
|
22
22
|
return Object.freeze(n);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
const isV5 = !!ReactQuery__namespace.useSuspenseQuery; // Compatible with ReactQuery v4
|
|
25
|
+
var TanstackReactQuery__namespace = /*#__PURE__*/_interopNamespace(TanstackReactQuery);
|
|
28
26
|
|
|
27
|
+
const ReactQuery = TanstackReactQuery__namespace;
|
|
28
|
+
const isV5 = !!ReactQuery.useSuspenseQuery;
|
|
29
29
|
const suspenseOptions = {
|
|
30
30
|
enabled: true,
|
|
31
31
|
suspense: true,
|
|
@@ -33,7 +33,7 @@ const suspenseOptions = {
|
|
|
33
33
|
};
|
|
34
34
|
const withMiddleware = (hook, defaultOptions, type) => {
|
|
35
35
|
return function useMiddleware(options, queryClient) {
|
|
36
|
-
const [middleware, opts] = [
|
|
36
|
+
const [middleware, opts] = [ReactQuery.useQueryClient( // @ts-ignore Compatible with ReactQuery v4
|
|
37
37
|
isV5 ? queryClient : options).getDefaultOptions()[type], defaultOptions, options].reduce(([u1, o1], {
|
|
38
38
|
use: u2 = [],
|
|
39
39
|
...o2
|
|
@@ -53,6 +53,7 @@ const getKey = (queryKey, variables) => {
|
|
|
53
53
|
return variables === undefined ? [...queryKey] : [...queryKey, variables];
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
exports.ReactQuery = ReactQuery;
|
|
56
57
|
exports.getKey = getKey;
|
|
57
58
|
exports.isV5 = isV5;
|
|
58
59
|
exports.suspenseOptions = suspenseOptions;
|
package/build/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as TanstackReactQuery from '@tanstack/react-query'\nimport type { Query, QueryClient, QueryKey } from '@tanstack/react-query'\n\nimport type { Middleware } from './types'\n\nexport const ReactQuery = TanstackReactQuery\n\nexport const isV5 = !!ReactQuery.useSuspenseQuery\n\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: Query) =>\n query.state.data === undefined,\n}\n\nexport const withMiddleware = (\n hook: any,\n defaultOptions: any,\n type: 'queries' | 'mutations'\n) => {\n return function useMiddleware(\n options?: { client?: QueryClient; use?: Middleware[] },\n queryClient?: 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\nexport const getKey = (queryKey: QueryKey, variables?: any): QueryKey => {\n return variables === undefined ? [...queryKey] : [...queryKey, variables]\n}\n"],"names":["ReactQuery","TanstackReactQuery","isV5","useSuspenseQuery","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","undefined","withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","middleware","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","next","i","length","getKey","queryKey","variables"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAMA,UAAU,GAAGC,8BAAnB;MAEMC,IAAI,GAAG,CAAC,CAACF,UAAU,CAACG,iBAA1B;AAEA,MAAMC,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,MAAMC,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,CACzBrB,UAAU,CAACsB,cAAX;IAEEpB,IAAI,GAAGiB,WAAH,GAAiBD,OAFvB,EAGEK,iBAHF,EAAA,CAGsBP,IAHtB,CADyB,EAKzBD,cALyB,EAMzBG,OANyB,CAAA,CAOzBM,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,GAAGhB,IAAX,CAAA;;IACA,KAAK,IAAIiB,CAAC,GAAGX,UAAU,CAACY,MAAxB,EAAgCD,CAAC,EAAjC,GAAuC;AACrCD,MAAAA,IAAI,GAAGV,UAAU,CAACW,CAAD,CAAV,CAAcD,IAAd,CAAP,CAAA;AACD,KAAA;;AAED,IAAA,OAAOA,IAAI,CAACT,IAAD,EAAOF,WAAP,CAAX,CAAA;GAxBF,CAAA;AA0BD,EA/BM;MAiCMc,MAAM,GAAG,CAACC,QAAD,EAAqBC,SAArB,KAAmD;AACvE,EAAA,OAAOA,SAAS,KAAKvB,SAAd,GAA0B,CAAC,GAAGsB,QAAJ,CAA1B,GAA0C,CAAC,GAAGA,QAAJ,EAAcC,SAAd,CAAjD,CAAA;AACD;;;;;;;;"}
|
package/build/lib/utils.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
const isV5 = !!ReactQuery.useSuspenseQuery; // Compatible with ReactQuery v4
|
|
1
|
+
import * as TanstackReactQuery from '@tanstack/react-query';
|
|
4
2
|
|
|
3
|
+
const ReactQuery = TanstackReactQuery;
|
|
4
|
+
const isV5 = !!ReactQuery.useSuspenseQuery;
|
|
5
5
|
const suspenseOptions = {
|
|
6
6
|
enabled: true,
|
|
7
7
|
suspense: true,
|
|
@@ -29,5 +29,5 @@ const getKey = (queryKey, variables) => {
|
|
|
29
29
|
return variables === undefined ? [...queryKey] : [...queryKey, variables];
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
export { getKey, isV5, suspenseOptions, withMiddleware };
|
|
32
|
+
export { ReactQuery, getKey, isV5, suspenseOptions, withMiddleware };
|
|
33
33
|
//# sourceMappingURL=utils.mjs.map
|
package/build/lib/utils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/utils.ts"],"sourcesContent":["import * as
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/utils.ts"],"sourcesContent":["import * as TanstackReactQuery from '@tanstack/react-query'\nimport type { Query, QueryClient, QueryKey } from '@tanstack/react-query'\n\nimport type { Middleware } from './types'\n\nexport const ReactQuery = TanstackReactQuery\n\nexport const isV5 = !!ReactQuery.useSuspenseQuery\n\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: Query) =>\n query.state.data === undefined,\n}\n\nexport const withMiddleware = (\n hook: any,\n defaultOptions: any,\n type: 'queries' | 'mutations'\n) => {\n return function useMiddleware(\n options?: { client?: QueryClient; use?: Middleware[] },\n queryClient?: 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\nexport const getKey = (queryKey: QueryKey, variables?: any): QueryKey => {\n return variables === undefined ? [...queryKey] : [...queryKey, variables]\n}\n"],"names":["ReactQuery","TanstackReactQuery","isV5","useSuspenseQuery","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","undefined","withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","middleware","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","next","i","length","getKey","queryKey","variables"],"mappings":";;AAKO,MAAMA,UAAU,GAAGC,mBAAnB;MAEMC,IAAI,GAAG,CAAC,CAACF,UAAU,CAACG,iBAA1B;AAEA,MAAMC,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,MAAMC,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,CACzBrB,UAAU,CAACsB,cAAX;IAEEpB,IAAI,GAAGiB,WAAH,GAAiBD,OAFvB,EAGEK,iBAHF,EAAA,CAGsBP,IAHtB,CADyB,EAKzBD,cALyB,EAMzBG,OANyB,CAAA,CAOzBM,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,GAAGhB,IAAX,CAAA;;IACA,KAAK,IAAIiB,CAAC,GAAGX,UAAU,CAACY,MAAxB,EAAgCD,CAAC,EAAjC,GAAuC;AACrCD,MAAAA,IAAI,GAAGV,UAAU,CAACW,CAAD,CAAV,CAAcD,IAAd,CAAP,CAAA;AACD,KAAA;;AAED,IAAA,OAAOA,IAAI,CAACT,IAAD,EAAOF,WAAP,CAAX,CAAA;GAxBF,CAAA;AA0BD,EA/BM;MAiCMc,MAAM,GAAG,CAACC,QAAD,EAAqBC,SAArB,KAAmD;AACvE,EAAA,OAAOA,SAAS,KAAKvB,SAAd,GAA0B,CAAC,GAAGsB,QAAJ,CAA1B,GAA0C,CAAC,GAAGA,QAAJ,EAAcC,SAAd,CAAjD,CAAA;AACD;;;;"}
|
package/build/stats-html.html
CHANGED
|
@@ -4014,7 +4014,7 @@ var drawChart = (function (exports) {
|
|
|
4014
4014
|
</script>
|
|
4015
4015
|
<script>
|
|
4016
4016
|
/*<!--*/
|
|
4017
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"zip.esm.js","children":[{"name":"src","children":[{"uid":"
|
|
4017
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"zip.esm.js","children":[{"name":"src","children":[{"uid":"3e2c-1","name":"utils.ts"},{"uid":"3e2c-3","name":"createBaseQuery.ts"},{"uid":"3e2c-5","name":"createQuery.ts"},{"uid":"3e2c-7","name":"createSuspenseQuery.ts"},{"uid":"3e2c-9","name":"createInfiniteQuery.ts"},{"uid":"3e2c-11","name":"createSuspenseInfiniteQuery.ts"},{"uid":"3e2c-13","name":"createMutation.ts"},{"uid":"3e2c-15","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"3e2c-1":{"renderedLength":911,"gzipLength":456,"brotliLength":0,"mainUid":"3e2c-0"},"3e2c-3":{"renderedLength":1162,"gzipLength":397,"brotliLength":0,"mainUid":"3e2c-2"},"3e2c-5":{"renderedLength":91,"gzipLength":87,"brotliLength":0,"mainUid":"3e2c-4"},"3e2c-7":{"renderedLength":179,"gzipLength":118,"brotliLength":0,"mainUid":"3e2c-6"},"3e2c-9":{"renderedLength":107,"gzipLength":97,"brotliLength":0,"mainUid":"3e2c-8"},"3e2c-11":{"renderedLength":203,"gzipLength":128,"brotliLength":0,"mainUid":"3e2c-10"},"3e2c-13":{"renderedLength":271,"gzipLength":168,"brotliLength":0,"mainUid":"3e2c-12"},"3e2c-15":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"3e2c-14"}},"nodeMetas":{"3e2c-0":{"id":"/src/utils.ts","moduleParts":{"zip.esm.js":"3e2c-1"},"imported":[{"uid":"3e2c-17"}],"importedBy":[{"uid":"3e2c-14"},{"uid":"3e2c-4"},{"uid":"3e2c-6"},{"uid":"3e2c-8"},{"uid":"3e2c-10"},{"uid":"3e2c-12"},{"uid":"3e2c-2"}]},"3e2c-2":{"id":"/src/createBaseQuery.ts","moduleParts":{"zip.esm.js":"3e2c-3"},"imported":[{"uid":"3e2c-0"}],"importedBy":[{"uid":"3e2c-4"},{"uid":"3e2c-6"},{"uid":"3e2c-8"},{"uid":"3e2c-10"}]},"3e2c-4":{"id":"/src/createQuery.ts","moduleParts":{"zip.esm.js":"3e2c-5"},"imported":[{"uid":"3e2c-2"},{"uid":"3e2c-0"}],"importedBy":[{"uid":"3e2c-14"}]},"3e2c-6":{"id":"/src/createSuspenseQuery.ts","moduleParts":{"zip.esm.js":"3e2c-7"},"imported":[{"uid":"3e2c-2"},{"uid":"3e2c-0"}],"importedBy":[{"uid":"3e2c-14"}]},"3e2c-8":{"id":"/src/createInfiniteQuery.ts","moduleParts":{"zip.esm.js":"3e2c-9"},"imported":[{"uid":"3e2c-2"},{"uid":"3e2c-0"}],"importedBy":[{"uid":"3e2c-14"}]},"3e2c-10":{"id":"/src/createSuspenseInfiniteQuery.ts","moduleParts":{"zip.esm.js":"3e2c-11"},"imported":[{"uid":"3e2c-2"},{"uid":"3e2c-0"}],"importedBy":[{"uid":"3e2c-14"}]},"3e2c-12":{"id":"/src/createMutation.ts","moduleParts":{"zip.esm.js":"3e2c-13"},"imported":[{"uid":"3e2c-0"}],"importedBy":[{"uid":"3e2c-14"}]},"3e2c-14":{"id":"/src/index.ts","moduleParts":{"zip.esm.js":"3e2c-15"},"imported":[{"uid":"3e2c-4"},{"uid":"3e2c-6"},{"uid":"3e2c-8"},{"uid":"3e2c-10"},{"uid":"3e2c-12"},{"uid":"3e2c-16"},{"uid":"3e2c-0"}],"importedBy":[],"isEntry":true},"3e2c-16":{"id":"/src/types.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"3e2c-14"}]},"3e2c-17":{"id":"@tanstack/react-query","moduleParts":{},"imported":[],"importedBy":[{"uid":"3e2c-0"}],"isExternal":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
4018
4018
|
|
|
4019
4019
|
const run = () => {
|
|
4020
4020
|
const width = window.innerWidth;
|