react-query-kit 2.0.9 → 2.0.10

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.
Files changed (54) hide show
  1. package/build/lib/createInfiniteQuery.esm.js +1 -1
  2. package/build/lib/createInfiniteQuery.esm.js.map +1 -1
  3. package/build/lib/createInfiniteQuery.js +2 -22
  4. package/build/lib/createInfiniteQuery.js.map +1 -1
  5. package/build/lib/createInfiniteQuery.mjs +1 -1
  6. package/build/lib/createInfiniteQuery.mjs.map +1 -1
  7. package/build/lib/createMutation.d.ts +1 -1
  8. package/build/lib/createMutation.esm.js +1 -2
  9. package/build/lib/createMutation.esm.js.map +1 -1
  10. package/build/lib/createMutation.js +1 -22
  11. package/build/lib/createMutation.js.map +1 -1
  12. package/build/lib/createMutation.mjs +1 -2
  13. package/build/lib/createMutation.mjs.map +1 -1
  14. package/build/lib/createQuery.esm.js +1 -1
  15. package/build/lib/createQuery.esm.js.map +1 -1
  16. package/build/lib/createQuery.js +2 -22
  17. package/build/lib/createQuery.js.map +1 -1
  18. package/build/lib/createQuery.mjs +1 -1
  19. package/build/lib/createQuery.mjs.map +1 -1
  20. package/build/lib/createSuspenseInfiniteQuery.esm.js +2 -3
  21. package/build/lib/createSuspenseInfiniteQuery.esm.js.map +1 -1
  22. package/build/lib/createSuspenseInfiniteQuery.js +1 -22
  23. package/build/lib/createSuspenseInfiniteQuery.js.map +1 -1
  24. package/build/lib/createSuspenseInfiniteQuery.mjs +2 -3
  25. package/build/lib/createSuspenseInfiniteQuery.mjs.map +1 -1
  26. package/build/lib/createSuspenseQuery.esm.js +2 -3
  27. package/build/lib/createSuspenseQuery.esm.js.map +1 -1
  28. package/build/lib/createSuspenseQuery.js +1 -22
  29. package/build/lib/createSuspenseQuery.js.map +1 -1
  30. package/build/lib/createSuspenseQuery.mjs +2 -3
  31. package/build/lib/createSuspenseQuery.mjs.map +1 -1
  32. package/build/lib/types.d.ts +5 -3
  33. package/build/lib/utils.d.ts +7 -5
  34. package/build/lib/utils.esm.js +5 -4
  35. package/build/lib/utils.esm.js.map +1 -1
  36. package/build/lib/utils.js +7 -5
  37. package/build/lib/utils.js.map +1 -1
  38. package/build/lib/utils.mjs +5 -4
  39. package/build/lib/utils.mjs.map +1 -1
  40. package/build/stats-html.html +1 -1
  41. package/build/stats.json +88 -106
  42. package/build/umd/index.development.js +11 -10
  43. package/build/umd/index.development.js.map +1 -1
  44. package/build/umd/index.production.js +1 -1
  45. package/build/umd/index.production.js.map +1 -1
  46. package/build/zip/zip.esm.js +1 -1
  47. package/package.json +1 -1
  48. package/src/createInfiniteQuery.ts +1 -2
  49. package/src/createMutation.ts +3 -5
  50. package/src/createQuery.tsx +1 -2
  51. package/src/createSuspenseInfiniteQuery.ts +2 -4
  52. package/src/createSuspenseQuery.ts +2 -4
  53. package/src/types.ts +6 -3
  54. package/src/utils.ts +10 -7
@@ -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 * 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
+ {"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, ReactQuery__namespace.useInfiniteQuery);
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 * 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
+ {"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,5 +1,5 @@
1
- import * as ReactQuery from '@tanstack/react-query';
2
1
  import { createBaseQuery } from './createBaseQuery.mjs';
2
+ import { ReactQuery } from './utils.mjs';
3
3
 
4
4
  const createInfiniteQuery = options => {
5
5
  return createBaseQuery(options, ReactQuery.useInfiniteQuery);
@@ -1 +1 @@
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
+ {"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,2 +1,2 @@
1
1
  import type { CreateMutationOptions, MutationHook } from './types';
2
- export declare const createMutation: <TData = unknown, TVariables = void, TError = Error, TContext = unknown>(defaultOptions: CreateMutationOptions<TData, TVariables, TError, TContext>) => MutationHook<TData, TVariables, TError>;
2
+ export declare const createMutation: <TData = unknown, TVariables = void, TError = Error, TContext = unknown>(defaultOptions: CreateMutationOptions<TData, TVariables, TError, TContext>) => MutationHook<TData, TVariables, TError, TContext>;
@@ -1,5 +1,4 @@
1
- import * as ReactQuery from '@tanstack/react-query';
2
- import { withMiddleware } from './utils.esm.js';
1
+ import { withMiddleware, ReactQuery } from './utils.esm.js';
3
2
 
4
3
  const createMutation = defaultOptions => {
5
4
  const getKey = () => defaultOptions.mutationKey;
@@ -1 +1 @@
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;;;;"}
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 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, TContext>\n}\n"],"names":["createMutation","defaultOptions","getKey","mutationKey","Object","assign","withMiddleware","ReactQuery","useMutation","mutationFn"],"mappings":";;AAOaA,MAAAA,cAAc,GAMzBC,cAN4B,IAO0B;AACtD,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,33 +2,12 @@
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
8
  const getKey = () => defaultOptions.mutationKey;
30
9
 
31
- return Object.assign(utils.withMiddleware(ReactQuery__namespace.useMutation, defaultOptions, 'mutations'), {
10
+ return Object.assign(utils.withMiddleware(utils.ReactQuery.useMutation, defaultOptions, 'mutations'), {
32
11
  getKey,
33
12
  mutationFn: defaultOptions.mutationFn
34
13
  });
@@ -1 +1 @@
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
+ {"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 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, TContext>\n}\n"],"names":["createMutation","defaultOptions","getKey","mutationKey","Object","assign","withMiddleware","ReactQuery","useMutation","mutationFn"],"mappings":";;;;;;AAOaA,MAAAA,cAAc,GAMzBC,cAN4B,IAO0B;AACtD,EAAA,MAAMC,MAAM,GAAG,MAAMD,cAAc,CAACE,WAApC,CAAA;;AAEA,EAAA,OAAOC,MAAM,CAACC,MAAP,CACLC,oBAAc,CAACC,gBAAU,CAACC,WAAZ,EAAyBP,cAAzB,EAAyC,WAAzC,CADT,EAEL;IACEC,MADF;IAEEO,UAAU,EAAER,cAAc,CAACQ,UAAAA;AAF7B,GAFK,CAAP,CAAA;AAOD;;;;"}
@@ -1,5 +1,4 @@
1
- import * as ReactQuery from '@tanstack/react-query';
2
- import { withMiddleware } from './utils.mjs';
1
+ import { withMiddleware, ReactQuery } from './utils.mjs';
3
2
 
4
3
  const createMutation = defaultOptions => {
5
4
  const getKey = () => defaultOptions.mutationKey;
@@ -1 +1 @@
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
+ {"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 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, TContext>\n}\n"],"names":["createMutation","defaultOptions","getKey","mutationKey","Object","assign","withMiddleware","ReactQuery","useMutation","mutationFn"],"mappings":";;AAOaA,MAAAA,cAAc,GAMzBC,cAN4B,IAO0B;AACtD,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,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 createQuery = options => {
5
5
  return createBaseQuery(options, ReactQuery.useQuery);
@@ -1 +1 @@
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;;;;"}
1
+ {"version":3,"file":"createQuery.esm.js","sources":["../../src/createQuery.tsx"],"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;;;;"}
@@ -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, ReactQuery__namespace.useQuery);
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.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
+ {"version":3,"file":"createQuery.js","sources":["../../src/createQuery.tsx"],"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,5 +1,5 @@
1
- import * as ReactQuery from '@tanstack/react-query';
2
1
  import { createBaseQuery } from './createBaseQuery.mjs';
2
+ import { ReactQuery } from './utils.mjs';
3
3
 
4
4
  const createQuery = options => {
5
5
  return createBaseQuery(options, ReactQuery.useQuery);
@@ -1 +1 @@
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
+ {"version":3,"file":"createQuery.mjs","sources":["../../src/createQuery.tsx"],"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,9 +1,8 @@
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
- return isV5() ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery) : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions);
5
+ return isV5 ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery) : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions);
7
6
  };
8
7
 
9
8
  export { createSuspenseInfiniteQuery };
@@ -1 +1 @@
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;;;;"}
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, ReactQuery__namespace.useSuspenseInfiniteQuery) : createBaseQuery.createBaseQuery(options, ReactQuery__namespace.useInfiniteQuery, utils.suspenseOptions);
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 * 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
+ {"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,9 +1,8 @@
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
- return isV5() ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery) : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions);
5
+ return isV5 ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery) : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions);
7
6
  };
8
7
 
9
8
  export { createSuspenseInfiniteQuery };
@@ -1 +1 @@
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
+ {"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,9 +1,8 @@
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
- return isV5() ? createBaseQuery(options, ReactQuery.useSuspenseQuery) : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions);
5
+ return isV5 ? createBaseQuery(options, ReactQuery.useSuspenseQuery) : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions);
7
6
  };
8
7
 
9
8
  export { createSuspenseQuery };
@@ -1 +1 @@
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;;;;"}
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, ReactQuery__namespace.useSuspenseQuery) : createBaseQuery.createBaseQuery(options, ReactQuery__namespace.useQuery, utils.suspenseOptions);
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 * 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
+ {"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,9 +1,8 @@
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
- return isV5() ? createBaseQuery(options, ReactQuery.useSuspenseQuery) : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions);
5
+ return isV5 ? createBaseQuery(options, ReactQuery.useSuspenseQuery) : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions);
7
6
  };
8
7
 
9
8
  export { createSuspenseQuery };
@@ -1 +1 @@
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;;;;"}
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;;;;"}
@@ -69,6 +69,7 @@ export interface QueryHook<TFnData = unknown, TVariables = any, TError = Compati
69
69
  }
70
70
  export interface CreateSuspenseQueryOptions<TFnData = unknown, TVariables = void, TError = CompatibleError> extends Omit<UseQueryOptions<TFnData, TError, TFnData, inferQueryKey<TFnData, TVariables>>, 'queryKey' | 'queryFn' | 'enabled' | 'select' | 'suspense' | 'throwOnError' | 'placeholderData' | 'keepPreviousData' | 'useErrorBoundary'>, AdditionalQueryOptions<TFnData, TVariables> {
71
71
  use?: Middleware<SuspenseQueryHook<TFnData, TVariables, TVariables>>[];
72
+ variables?: TVariables;
72
73
  }
73
74
  export interface SuspenseQueryHookOptions<TFnData, TError, TData, TVariables> extends Omit<UseQueryOptions<TFnData, TError, TData, inferQueryKey<TFnData, TVariables>>, 'queryKey' | 'queryFn' | 'queryKeyHashFn' | 'enabled' | 'suspense' | 'throwOnError' | 'placeholderData' | 'keepPreviousData' | 'useErrorBoundary'> {
74
75
  use?: Middleware<SuspenseQueryHook<TFnData, TVariables, TVariables>>[];
@@ -80,6 +81,7 @@ export interface SuspenseQueryHook<TFnData = unknown, TVariables = void, TError
80
81
  }
81
82
  export interface CreateInfiniteQueryOptions<TFnData = unknown, TVariables = void, TError = CompatibleError, TPageParam = number> extends Omit<CompatibleUseInfiniteQueryOptions<TFnData, TVariables, TFnData, TError, TPageParam>, 'queryKey' | 'queryFn' | 'select'>, AdditionalQueryOptions<TFnData, TVariables, TPageParam> {
82
83
  use?: Middleware<InfiniteQueryHook<TFnData, TVariables, TError, TPageParam>>[];
84
+ variables?: TVariables;
83
85
  }
84
86
  export interface InfiniteQueryHookOptions<TFnData, TError, TData, TVariables, TPageParam = number> extends Omit<CompatibleUseInfiniteQueryOptions<TFnData, TVariables, TData, TError, TPageParam>, 'queryKey' | 'queryFn' | 'queryKeyHashFn' | 'initialPageParam' | 'getPreviousPageParam' | 'getNextPageParam'> {
85
87
  use?: Middleware<InfiniteQueryHook<TFnData, TVariables, TError, TPageParam>>[];
@@ -96,6 +98,7 @@ export interface InfiniteQueryHook<TFnData = unknown, TVariables = void, TError
96
98
  }
97
99
  export interface CreateSuspenseInfiniteQueryOptions<TFnData = unknown, TVariables = void, TError = CompatibleError, TPageParam = number> extends Omit<CompatibleUseInfiniteQueryOptions<TFnData, TVariables, TFnData, TError, TPageParam>, 'queryKey' | 'queryFn' | 'enabled' | 'select' | 'suspense' | 'throwOnError' | 'placeholderData' | 'keepPreviousData' | 'useErrorBoundary'>, AdditionalQueryOptions<TFnData, TVariables, TPageParam> {
98
100
  use?: Middleware<SuspenseInfiniteQueryHook<TFnData, TVariables, TVariables>>[];
101
+ variables?: TVariables;
99
102
  }
100
103
  export interface SuspenseInfiniteQueryHookOptions<TFnData, TError, TData, TVariables, TPageParam = number> extends Omit<CompatibleUseInfiniteQueryOptions<TFnData, TVariables, TData, TError, TPageParam>, 'queryKey' | 'queryFn' | 'queryKeyHashFn' | 'enabled' | 'initialPageParam' | 'getPreviousPageParam' | 'getNextPageParam' | 'suspense' | 'throwOnError' | 'placeholderData' | 'keepPreviousData' | 'useErrorBoundary'> {
101
104
  use?: Middleware<SuspenseInfiniteQueryHook<TFnData, TVariables, TVariables>>[];
@@ -110,11 +113,10 @@ export interface CreateMutationOptions<TData = unknown, TVariables = void, TErro
110
113
  }
111
114
  export interface MutationHookOptions<TData, TError, TVariables, TContext> extends Omit<UseMutationOptions<TData, TError, TVariables, TContext>, 'mutationFn' | 'mutationKey'> {
112
115
  use?: Middleware<MutationHook<TData, TError, TVariables>>[];
113
- variables?: TVariables;
114
116
  }
115
117
  export type MutationHookResult<TData = unknown, TError = CompatibleError, TVariables = void, TContext = unknown> = UseMutationResult<TData, TError, TVariables, TContext>;
116
- export interface MutationHook<TData = unknown, TVariables = void, TError = unknown> {
117
- <TContext>(options?: MutationHookOptions<TData, TError, TVariables, TContext>, queryClient?: CompatibleWithV4<QueryClient, void>): MutationHookResult<TData, TError, TVariables, TContext>;
118
+ export interface MutationHook<TData = unknown, TVariables = void, TError = unknown, TDefaultContext = unknown> {
119
+ <TContext = TDefaultContext>(options?: MutationHookOptions<TData, TError, TVariables, TContext>, queryClient?: CompatibleWithV4<QueryClient, void>): MutationHookResult<TData, TError, TVariables, TContext>;
118
120
  getKey: () => MutationKey | undefined;
119
121
  mutationFn: MutationFunction<TData, TVariables>;
120
122
  }
@@ -1,13 +1,15 @@
1
- import * as ReactQuery from '@tanstack/react-query';
1
+ import * as TanstackReactQuery from '@tanstack/react-query';
2
+ import type { Query, QueryClient } from '@tanstack/react-query';
2
3
  import type { Middleware, inferQueryKey } from './types';
4
+ export declare const ReactQuery: typeof TanstackReactQuery;
5
+ export declare const isV5 = true;
3
6
  export declare const withMiddleware: (hook: any, defaultOptions: any, type: 'queries' | 'mutations') => (options?: {
4
- client?: ReactQuery.QueryClient;
7
+ client?: QueryClient;
5
8
  use?: Middleware[];
6
- }, queryClient?: ReactQuery.QueryClient) => any;
9
+ }, queryClient?: QueryClient) => any;
7
10
  export declare const suspenseOptions: {
8
11
  enabled: boolean;
9
12
  suspense: boolean;
10
- useErrorBoundary: (_error: unknown, query: ReactQuery.Query) => boolean;
13
+ useErrorBoundary: (_error: unknown, query: Query) => boolean;
11
14
  };
12
- export declare const isV5: () => boolean;
13
15
  export declare const getKey: <TVariables = void>(primaryKey: string, variables?: TVariables | undefined) => inferQueryKey<unknown, TVariables>;
@@ -1,9 +1,11 @@
1
- import * as ReactQuery from '@tanstack/react-query';
1
+ import * as TanstackReactQuery from '@tanstack/react-query';
2
2
 
3
+ const ReactQuery = TanstackReactQuery;
4
+ const isV5 = !!ReactQuery.useSuspenseQuery;
3
5
  const withMiddleware = (hook, defaultOptions, type) => {
4
6
  return function useMiddleware(options, queryClient) {
5
7
  const [middleware, opts] = [ReactQuery.useQueryClient( // @ts-ignore Compatible with ReactQuery v4
6
- isV5() ? queryClient : options).getDefaultOptions()[type], defaultOptions, options].reduce(([u1, o1], {
8
+ isV5 ? queryClient : options).getDefaultOptions()[type], defaultOptions, options].reduce(([u1, o1], {
7
9
  use: u2 = [],
8
10
  ...o2
9
11
  } = {}) => [[...u1, ...u2], { ...o1,
@@ -24,10 +26,9 @@ const suspenseOptions = {
24
26
  suspense: true,
25
27
  useErrorBoundary: (_error, query) => query.state.data === undefined
26
28
  };
27
- const isV5 = () => !!ReactQuery.useSuspenseQuery;
28
29
  const getKey = (primaryKey, variables) => {
29
30
  return variables === undefined ? [primaryKey] : [primaryKey, variables];
30
31
  };
31
32
 
32
- export { getKey, isV5, suspenseOptions, withMiddleware };
33
+ export { ReactQuery, getKey, isV5, suspenseOptions, withMiddleware };
33
34
  //# sourceMappingURL=utils.esm.js.map
@@ -1 +1 @@
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;;;;"}
1
+ {"version":3,"file":"utils.esm.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as TanstackReactQuery from '@tanstack/react-query'\nimport type { Query, QueryClient } from '@tanstack/react-query'\n\nimport type { Middleware, inferQueryKey } from './types'\n\nexport const ReactQuery = TanstackReactQuery\n\nexport const isV5 = !!ReactQuery.useSuspenseQuery\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\n// Compatible with ReactQuery v4\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: Query) =>\n query.state.data === undefined,\n}\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":["ReactQuery","TanstackReactQuery","isV5","useSuspenseQuery","withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","middleware","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","next","i","length","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","undefined","getKey","primaryKey","variables"],"mappings":";;AAKO,MAAMA,UAAU,GAAGC,mBAAnB;MAEMC,IAAI,GAAG,CAAC,CAACF,UAAU,CAACG,iBAA1B;AAEA,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,CACzBZ,UAAU,CAACa,cAAX;IAEEX,IAAI,GAAGQ,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;;AAGM,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;MAOMC,MAAM,GAAG,CACpBC,UADoB,EAEpBC,SAFoB,KAGjB;AACH,EAAA,OACEA,SAAS,KAAKH,SAAd,GAA0B,CAACE,UAAD,CAA1B,GAAyC,CAACA,UAAD,EAAaC,SAAb,CAD3C,CAAA;AAGD;;;;"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ReactQuery = require('@tanstack/react-query');
5
+ var TanstackReactQuery = require('@tanstack/react-query');
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -22,12 +22,14 @@ function _interopNamespace(e) {
22
22
  return Object.freeze(n);
23
23
  }
24
24
 
25
- var ReactQuery__namespace = /*#__PURE__*/_interopNamespace(ReactQuery);
25
+ var TanstackReactQuery__namespace = /*#__PURE__*/_interopNamespace(TanstackReactQuery);
26
26
 
27
+ const ReactQuery = TanstackReactQuery__namespace;
28
+ const isV5 = !!ReactQuery.useSuspenseQuery;
27
29
  const withMiddleware = (hook, defaultOptions, type) => {
28
30
  return function useMiddleware(options, queryClient) {
29
- const [middleware, opts] = [ReactQuery__namespace.useQueryClient( // @ts-ignore Compatible with ReactQuery v4
30
- isV5() ? queryClient : options).getDefaultOptions()[type], defaultOptions, options].reduce(([u1, o1], {
31
+ const [middleware, opts] = [ReactQuery.useQueryClient( // @ts-ignore Compatible with ReactQuery v4
32
+ isV5 ? queryClient : options).getDefaultOptions()[type], defaultOptions, options].reduce(([u1, o1], {
31
33
  use: u2 = [],
32
34
  ...o2
33
35
  } = {}) => [[...u1, ...u2], { ...o1,
@@ -48,11 +50,11 @@ const suspenseOptions = {
48
50
  suspense: true,
49
51
  useErrorBoundary: (_error, query) => query.state.data === undefined
50
52
  };
51
- const isV5 = () => !!ReactQuery__namespace.useSuspenseQuery;
52
53
  const getKey = (primaryKey, variables) => {
53
54
  return variables === undefined ? [primaryKey] : [primaryKey, variables];
54
55
  };
55
56
 
57
+ exports.ReactQuery = ReactQuery;
56
58
  exports.getKey = getKey;
57
59
  exports.isV5 = isV5;
58
60
  exports.suspenseOptions = suspenseOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.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,qBAAU,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,qBAAU,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;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as TanstackReactQuery from '@tanstack/react-query'\nimport type { Query, QueryClient } from '@tanstack/react-query'\n\nimport type { Middleware, inferQueryKey } from './types'\n\nexport const ReactQuery = TanstackReactQuery\n\nexport const isV5 = !!ReactQuery.useSuspenseQuery\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\n// Compatible with ReactQuery v4\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: Query) =>\n query.state.data === undefined,\n}\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":["ReactQuery","TanstackReactQuery","isV5","useSuspenseQuery","withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","middleware","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","next","i","length","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","undefined","getKey","primaryKey","variables"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAMA,UAAU,GAAGC,8BAAnB;MAEMC,IAAI,GAAG,CAAC,CAACF,UAAU,CAACG,iBAA1B;AAEA,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,CACzBZ,UAAU,CAACa,cAAX;IAEEX,IAAI,GAAGQ,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;;AAGM,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;MAOMC,MAAM,GAAG,CACpBC,UADoB,EAEpBC,SAFoB,KAGjB;AACH,EAAA,OACEA,SAAS,KAAKH,SAAd,GAA0B,CAACE,UAAD,CAA1B,GAAyC,CAACA,UAAD,EAAaC,SAAb,CAD3C,CAAA;AAGD;;;;;;;;"}