react-query-kit 3.0.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -64,7 +64,7 @@ This module is distributed via [npm][npm] which is bundled with [node][node] and
64
64
  should be installed as one of your project's `dependencies`:
65
65
 
66
66
  ```bash
67
- $ npm i react-query-ki
67
+ $ npm i react-query-kit
68
68
  # or
69
69
  $ yarn add react-query-kit
70
70
  ```
@@ -367,7 +367,7 @@ Options
367
367
  - Optional
368
368
  - array of middleware functions [(details)](#middleware)
369
369
 
370
- Returns
370
+ Expose Methods
371
371
 
372
372
  - `getKey: () => MutationKey`
373
373
  - `getOptions: () => UseMutationOptions`
@@ -403,6 +403,13 @@ const post = router(`post`, {
403
403
  body: JSON.stringify(variables),
404
404
  }).then(res => res.json()),
405
405
  }),
406
+
407
+ // nest router
408
+ command: {
409
+ report: router.mutation({ mutationFn }),
410
+
411
+ promote: router.mutation({ mutationFn }),
412
+ },
406
413
  })
407
414
 
408
415
  // get root key
@@ -414,6 +421,7 @@ post.byId.useSuspenseQuery({ variables: { id: 1 } })
414
421
  post.list.useInfiniteQuery()
415
422
  post.list.useSuspenseInfiniteQuery()
416
423
  post.add.useMutation()
424
+ post.command.report.useMutation()
417
425
 
418
426
  // expose methods
419
427
  post.byId.getKey({ id: 1 }) // ['post', 'byId', { id: 1 }]
@@ -425,13 +433,27 @@ post.add.getOptions()
425
433
  post.add.mutationFn({ title: 'title', content: 'content' })
426
434
 
427
435
  // infer types
428
- type Data = inferData<typeof posts.list>
429
- type FnData = inferFnData<typeof posts.list>
430
- type Variables = inferVariables<typeof posts.list>
431
- type Error = inferError<typeof posts.list>
436
+ type Data = inferData<typeof post.list>
437
+ type FnData = inferFnData<typeof post.list>
438
+ type Variables = inferVariables<typeof post.list>
439
+ type Error = inferError<typeof post.list>
440
+ ```
441
+
442
+ ### Merging Routers
443
+
444
+ ```ts
445
+ import { router } from 'react-query-kit'
446
+
447
+ const user = router(`user`, {})
448
+ const post = router(`post`, {})
449
+
450
+ const k = {
451
+ user,
452
+ post,
453
+ }
432
454
  ```
433
455
 
434
- ## API Reference
456
+ ### API Reference
435
457
 
436
458
  `type Router = (key: string, config: TConfig) => TRouter`
437
459
 
@@ -1,7 +1,7 @@
1
- import type { CreateInfiniteQueryOptions, CreateMutationOptions, CreateQueryOptions, CreateRouter, RouterConfig, RouterInfiniteQuery, RouterMutation, RouterQuery } from './types';
1
+ import type { CreateRouter, RouterConfig, RouterInfiniteQuery, RouterInfiniteQueryOptions, RouterMutation, RouterMutationOptions, RouterQuery, RouterQueryOptions } from './types';
2
2
  export declare const router: {
3
- <TConfig extends RouterConfig>(scope: string, config: TConfig): CreateRouter<TConfig>;
4
- query<TFnData, TVariables = void, TError = Error>(options: Omit<CreateQueryOptions<TFnData, TVariables, TError>, "queryKey">): RouterQuery<TFnData, TVariables, TError>;
5
- infiniteQuery<TFnData_1, TVariables_1 = void, TError_1 = Error, TPageParam = number>(options: Omit<CreateInfiniteQueryOptions<TFnData_1, TVariables_1, TError_1, TPageParam>, "queryKey">): RouterInfiniteQuery<TFnData_1, TVariables_1, TError_1, TPageParam>;
6
- mutation<TFnData_2 = unknown, TVariables_2 = void, TError_2 = Error, TContext = unknown>(options: Omit<CreateMutationOptions<TFnData_2, TVariables_2, TError_2, TContext>, "mutationKey">): RouterMutation<TFnData_2, TVariables_2, TError_2, TContext>;
3
+ <TConfig extends RouterConfig>(key: string, config: TConfig): CreateRouter<TConfig>;
4
+ query<TFnData, TVariables = void, TError = Error>(options: RouterQueryOptions<TFnData, TVariables, TError>): RouterQuery<TFnData, TVariables, TError>;
5
+ infiniteQuery<TFnData_1, TVariables_1 = void, TError_1 = Error, TPageParam = number>(options: RouterInfiniteQueryOptions<TFnData_1, TVariables_1, TError_1, TPageParam>): RouterInfiniteQuery<TFnData_1, TVariables_1, TError_1, TPageParam>;
6
+ mutation<TFnData_2 = unknown, TVariables_2 = void, TError_2 = Error, TContext = unknown>(options: RouterMutationOptions<TFnData_2, TVariables_2, TError_2, TContext>): RouterMutation<TFnData_2, TVariables_2, TError_2, TContext>;
7
7
  };
@@ -4,29 +4,38 @@ import { createQuery } from './createQuery.esm.js';
4
4
  import { createSuspenseInfiniteQuery } from './createSuspenseInfiniteQuery.esm.js';
5
5
  import { createSuspenseQuery } from './createSuspenseQuery.esm.js';
6
6
 
7
- const router = (scope, config) => {
7
+ const buildRouter = (keys, config) => {
8
8
  return Object.entries(config).reduce((acc, [key, opts]) => {
9
- const options = { ...opts,
10
- [opts._type === "m" ? "mutationKey" : "queryKey"]: [scope, key]
11
- };
12
- acc[key] = opts._type === "m" ? {
13
- useMutation: createMutation(options),
14
- ...createMutation(options)
15
- } : opts._type === "q" ? {
16
- useQuery: createQuery(options),
17
- useSuspenseQuery: createSuspenseQuery(options),
18
- ...createQuery(options)
19
- } : {
20
- useInfiniteQuery: createInfiniteQuery(options),
21
- useSuspenseInfiniteQuery: createSuspenseInfiniteQuery(options),
22
- ...createInfiniteQuery(options)
23
- };
9
+ if (!opts._type) {
10
+ acc[key] = buildRouter([...keys, key], opts);
11
+ } else {
12
+ const options = { ...opts,
13
+ [opts._type === "m" ? "mutationKey" : "queryKey"]: [...keys, key]
14
+ };
15
+ acc[key] = opts._type === "m" ? {
16
+ useMutation: createMutation(options),
17
+ ...createMutation(options)
18
+ } : opts._type === "q" ? {
19
+ useQuery: createQuery(options),
20
+ useSuspenseQuery: createSuspenseQuery(options),
21
+ ...createQuery(options)
22
+ } : {
23
+ useInfiniteQuery: createInfiniteQuery(options),
24
+ useSuspenseInfiniteQuery: createSuspenseInfiniteQuery(options),
25
+ ...createInfiniteQuery(options)
26
+ };
27
+ }
28
+
24
29
  return acc;
25
30
  }, {
26
- getKey: () => [scope]
31
+ getKey: () => keys
27
32
  });
28
33
  };
29
34
 
35
+ const router = (key, config) => {
36
+ return buildRouter([key], config);
37
+ };
38
+
30
39
  router.query = options => {
31
40
  return { ...options,
32
41
  _type: 'q'
@@ -1 +1 @@
1
- {"version":3,"file":"router.esm.js","sources":["../../src/router.ts"],"sourcesContent":["import { createInfiniteQuery } from './createInfiniteQuery'\nimport { createMutation } from './createMutation'\nimport { createQuery } from './createQuery'\nimport { createSuspenseInfiniteQuery } from './createSuspenseInfiniteQuery'\nimport { createSuspenseQuery } from './createSuspenseQuery'\nimport type {\n CompatibleError,\n CreateInfiniteQueryOptions,\n CreateMutationOptions,\n CreateQueryOptions,\n CreateRouter,\n RouterConfig,\n RouterInfiniteQuery,\n RouterMutation,\n RouterQuery,\n} from './types'\n\nexport const router = <TConfig extends RouterConfig>(\n scope: string,\n config: TConfig\n): CreateRouter<TConfig> => {\n return Object.entries(config).reduce(\n (acc, [key, opts]) => {\n const options: any = {\n ...opts,\n [opts._type === `m` ? `mutationKey` : `queryKey`]: [scope, key],\n }\n\n acc[key] =\n opts._type === `m`\n ? {\n useMutation: createMutation(options),\n ...createMutation(options),\n }\n : opts._type === `q`\n ? {\n useQuery: createQuery(options),\n useSuspenseQuery: createSuspenseQuery(options),\n ...createQuery(options),\n }\n : {\n useInfiniteQuery: createInfiniteQuery(options),\n useSuspenseInfiniteQuery: createSuspenseInfiniteQuery(options),\n ...createInfiniteQuery(options),\n }\n\n return acc\n },\n {\n getKey: () => [scope],\n } as any\n )\n}\n\nrouter.query = <TFnData, TVariables = void, TError = CompatibleError>(\n options: Omit<CreateQueryOptions<TFnData, TVariables, TError>, 'queryKey'>\n): RouterQuery<TFnData, TVariables, TError> => {\n return {\n ...options,\n _type: 'q',\n }\n}\n\nrouter.infiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: Omit<\n CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>,\n 'queryKey'\n >\n): RouterInfiniteQuery<TFnData, TVariables, TError, TPageParam> => {\n return { ...options, _type: 'inf' }\n}\n\nrouter.mutation = <\n TFnData = unknown,\n TVariables = void,\n TError = CompatibleError,\n TContext = unknown\n>(\n options: Omit<\n CreateMutationOptions<TFnData, TVariables, TError, TContext>,\n 'mutationKey'\n >\n): RouterMutation<TFnData, TVariables, TError, TContext> => {\n return { ...options, _type: 'm' }\n}\n"],"names":["router","scope","config","Object","entries","reduce","acc","key","opts","options","_type","useMutation","createMutation","useQuery","createQuery","useSuspenseQuery","createSuspenseQuery","useInfiniteQuery","createInfiniteQuery","useSuspenseInfiniteQuery","createSuspenseInfiniteQuery","getKey","query","infiniteQuery","mutation"],"mappings":";;;;;;MAiBaA,MAAM,GAAG,CACpBC,KADoB,EAEpBC,MAFoB,KAGM;AAC1B,EAAA,OAAOC,MAAM,CAACC,OAAP,CAAeF,MAAf,EAAuBG,MAAvB,CACL,CAACC,GAAD,EAAM,CAACC,GAAD,EAAMC,IAAN,CAAN,KAAsB;AACpB,IAAA,MAAMC,OAAY,GAAG,EACnB,GAAGD,IADgB;MAEnB,CAACA,IAAI,CAACE,KAAL,KAAA,GAAA,GAAA,aAAA,GAAA,UAAD,GAAmD,CAACT,KAAD,EAAQM,GAAR,CAAA;KAFrD,CAAA;AAKAD,IAAAA,GAAG,CAACC,GAAD,CAAH,GACEC,IAAI,CAACE,KAAL,KACI,GAAA,GAAA;AACEC,MAAAA,WAAW,EAAEC,cAAc,CAACH,OAAD,CAD7B;MAEE,GAAGG,cAAc,CAACH,OAAD,CAAA;AAFnB,KADJ,GAKID,IAAI,CAACE,KAAL,KACA,GAAA,GAAA;AACEG,MAAAA,QAAQ,EAAEC,WAAW,CAACL,OAAD,CADvB;AAEEM,MAAAA,gBAAgB,EAAEC,mBAAmB,CAACP,OAAD,CAFvC;MAGE,GAAGK,WAAW,CAACL,OAAD,CAAA;AAHhB,KADA,GAMA;AACEQ,MAAAA,gBAAgB,EAAEC,mBAAmB,CAACT,OAAD,CADvC;AAEEU,MAAAA,wBAAwB,EAAEC,2BAA2B,CAACX,OAAD,CAFvD;MAGE,GAAGS,mBAAmB,CAACT,OAAD,CAAA;KAf9B,CAAA;AAkBA,IAAA,OAAOH,GAAP,CAAA;AACD,GA1BI,EA2BL;IACEe,MAAM,EAAE,MAAM,CAACpB,KAAD,CAAA;AADhB,GA3BK,CAAP,CAAA;AA+BD,EAnCM;;AAqCPD,MAAM,CAACsB,KAAP,GACEb,OADa,IAEgC;EAC7C,OAAO,EACL,GAAGA,OADE;AAELC,IAAAA,KAAK,EAAE,GAAA;GAFT,CAAA;AAID,CAPD,CAAA;;AASAV,MAAM,CAACuB,aAAP,GAMEd,OANqB,IAU4C;EACjE,OAAO,EAAE,GAAGA,OAAL;AAAcC,IAAAA,KAAK,EAAE,KAAA;GAA5B,CAAA;AACD,CAZD,CAAA;;AAcAV,MAAM,CAACwB,QAAP,GAMEf,OANgB,IAU0C;EAC1D,OAAO,EAAE,GAAGA,OAAL;AAAcC,IAAAA,KAAK,EAAE,GAAA;GAA5B,CAAA;AACD,CAZD;;;;"}
1
+ {"version":3,"file":"router.esm.js","sources":["../../src/router.ts"],"sourcesContent":["import { createInfiniteQuery } from './createInfiniteQuery'\nimport { createMutation } from './createMutation'\nimport { createQuery } from './createQuery'\nimport { createSuspenseInfiniteQuery } from './createSuspenseInfiniteQuery'\nimport { createSuspenseQuery } from './createSuspenseQuery'\nimport type {\n CompatibleError,\n CreateRouter,\n RouterConfig,\n RouterInfiniteQuery,\n RouterInfiniteQueryOptions,\n RouterMutation,\n RouterMutationOptions,\n RouterQuery,\n RouterQueryOptions,\n} from './types'\n\nconst buildRouter = (keys: string[], config: RouterConfig) => {\n return Object.entries(config).reduce(\n (acc, [key, opts]) => {\n if (!opts._type) {\n acc[key] = buildRouter([...keys, key], opts)\n } else {\n const options: any = {\n ...opts,\n [opts._type === `m` ? `mutationKey` : `queryKey`]: [...keys, key],\n }\n\n acc[key] =\n opts._type === `m`\n ? {\n useMutation: createMutation(options),\n ...createMutation(options),\n }\n : opts._type === `q`\n ? {\n useQuery: createQuery(options),\n useSuspenseQuery: createSuspenseQuery(options),\n ...createQuery(options),\n }\n : {\n useInfiniteQuery: createInfiniteQuery(options),\n useSuspenseInfiniteQuery: createSuspenseInfiniteQuery(options),\n ...createInfiniteQuery(options),\n }\n }\n\n return acc\n },\n {\n getKey: () => keys,\n } as any\n )\n}\n\nexport const router = <TConfig extends RouterConfig>(\n key: string,\n config: TConfig\n): CreateRouter<TConfig> => {\n return buildRouter([key], config)\n}\n\nrouter.query = <TFnData, TVariables = void, TError = CompatibleError>(\n options: RouterQueryOptions<TFnData, TVariables, TError>\n) => {\n return {\n ...options,\n _type: 'q',\n } as RouterQuery<TFnData, TVariables, TError>\n}\n\nrouter.infiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: RouterInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>\n) => {\n return { ...options, _type: 'inf' } as RouterInfiniteQuery<\n TFnData,\n TVariables,\n TError,\n TPageParam\n >\n}\n\nrouter.mutation = <\n TFnData = unknown,\n TVariables = void,\n TError = CompatibleError,\n TContext = unknown\n>(\n options: RouterMutationOptions<TFnData, TVariables, TError, TContext>\n) => {\n return { ...options, _type: 'm' } as RouterMutation<\n TFnData,\n TVariables,\n TError,\n TContext\n >\n}\n"],"names":["buildRouter","keys","config","Object","entries","reduce","acc","key","opts","_type","options","useMutation","createMutation","useQuery","createQuery","useSuspenseQuery","createSuspenseQuery","useInfiniteQuery","createInfiniteQuery","useSuspenseInfiniteQuery","createSuspenseInfiniteQuery","getKey","router","query","infiniteQuery","mutation"],"mappings":";;;;;;AAiBA,MAAMA,WAAW,GAAG,CAACC,IAAD,EAAiBC,MAAjB,KAA0C;AAC5D,EAAA,OAAOC,MAAM,CAACC,OAAP,CAAeF,MAAf,EAAuBG,MAAvB,CACL,CAACC,GAAD,EAAM,CAACC,GAAD,EAAMC,IAAN,CAAN,KAAsB;AACpB,IAAA,IAAI,CAACA,IAAI,CAACC,KAAV,EAAiB;AACfH,MAAAA,GAAG,CAACC,GAAD,CAAH,GAAWP,WAAW,CAAC,CAAC,GAAGC,IAAJ,EAAUM,GAAV,CAAD,EAAiBC,IAAjB,CAAtB,CAAA;AACD,KAFD,MAEO;AACL,MAAA,MAAME,OAAY,GAAG,EACnB,GAAGF,IADgB;QAEnB,CAACA,IAAI,CAACC,KAAL,KAAA,GAAA,GAAA,aAAA,GAAA,UAAD,GAAmD,CAAC,GAAGR,IAAJ,EAAUM,GAAV,CAAA;OAFrD,CAAA;AAKAD,MAAAA,GAAG,CAACC,GAAD,CAAH,GACEC,IAAI,CAACC,KAAL,KACI,GAAA,GAAA;AACEE,QAAAA,WAAW,EAAEC,cAAc,CAACF,OAAD,CAD7B;QAEE,GAAGE,cAAc,CAACF,OAAD,CAAA;AAFnB,OADJ,GAKIF,IAAI,CAACC,KAAL,KACA,GAAA,GAAA;AACEI,QAAAA,QAAQ,EAAEC,WAAW,CAACJ,OAAD,CADvB;AAEEK,QAAAA,gBAAgB,EAAEC,mBAAmB,CAACN,OAAD,CAFvC;QAGE,GAAGI,WAAW,CAACJ,OAAD,CAAA;AAHhB,OADA,GAMA;AACEO,QAAAA,gBAAgB,EAAEC,mBAAmB,CAACR,OAAD,CADvC;AAEES,QAAAA,wBAAwB,EAAEC,2BAA2B,CAACV,OAAD,CAFvD;QAGE,GAAGQ,mBAAmB,CAACR,OAAD,CAAA;OAf9B,CAAA;AAiBD,KAAA;;AAED,IAAA,OAAOJ,GAAP,CAAA;AACD,GA9BI,EA+BL;AACEe,IAAAA,MAAM,EAAE,MAAMpB,IAAAA;AADhB,GA/BK,CAAP,CAAA;AAmCD,CApCD,CAAA;;MAsCaqB,MAAM,GAAG,CACpBf,GADoB,EAEpBL,MAFoB,KAGM;AAC1B,EAAA,OAAOF,WAAW,CAAC,CAACO,GAAD,CAAD,EAAQL,MAAR,CAAlB,CAAA;AACD,EALM;;AAOPoB,MAAM,CAACC,KAAP,GACEb,OADa,IAEV;EACH,OAAO,EACL,GAAGA,OADE;AAELD,IAAAA,KAAK,EAAE,GAAA;GAFT,CAAA;AAID,CAPD,CAAA;;AASAa,MAAM,CAACE,aAAP,GAMEd,OANqB,IAOlB;EACH,OAAO,EAAE,GAAGA,OAAL;AAAcD,IAAAA,KAAK,EAAE,KAAA;GAA5B,CAAA;AAMD,CAdD,CAAA;;AAgBAa,MAAM,CAACG,QAAP,GAMEf,OANgB,IAOb;EACH,OAAO,EAAE,GAAGA,OAAL;AAAcD,IAAAA,KAAK,EAAE,GAAA;GAA5B,CAAA;AAMD,CAdD;;;;"}
@@ -8,29 +8,38 @@ var createQuery = require('./createQuery.js');
8
8
  var createSuspenseInfiniteQuery = require('./createSuspenseInfiniteQuery.js');
9
9
  var createSuspenseQuery = require('./createSuspenseQuery.js');
10
10
 
11
- const router = (scope, config) => {
11
+ const buildRouter = (keys, config) => {
12
12
  return Object.entries(config).reduce((acc, [key, opts]) => {
13
- const options = { ...opts,
14
- [opts._type === "m" ? "mutationKey" : "queryKey"]: [scope, key]
15
- };
16
- acc[key] = opts._type === "m" ? {
17
- useMutation: createMutation.createMutation(options),
18
- ...createMutation.createMutation(options)
19
- } : opts._type === "q" ? {
20
- useQuery: createQuery.createQuery(options),
21
- useSuspenseQuery: createSuspenseQuery.createSuspenseQuery(options),
22
- ...createQuery.createQuery(options)
23
- } : {
24
- useInfiniteQuery: createInfiniteQuery.createInfiniteQuery(options),
25
- useSuspenseInfiniteQuery: createSuspenseInfiniteQuery.createSuspenseInfiniteQuery(options),
26
- ...createInfiniteQuery.createInfiniteQuery(options)
27
- };
13
+ if (!opts._type) {
14
+ acc[key] = buildRouter([...keys, key], opts);
15
+ } else {
16
+ const options = { ...opts,
17
+ [opts._type === "m" ? "mutationKey" : "queryKey"]: [...keys, key]
18
+ };
19
+ acc[key] = opts._type === "m" ? {
20
+ useMutation: createMutation.createMutation(options),
21
+ ...createMutation.createMutation(options)
22
+ } : opts._type === "q" ? {
23
+ useQuery: createQuery.createQuery(options),
24
+ useSuspenseQuery: createSuspenseQuery.createSuspenseQuery(options),
25
+ ...createQuery.createQuery(options)
26
+ } : {
27
+ useInfiniteQuery: createInfiniteQuery.createInfiniteQuery(options),
28
+ useSuspenseInfiniteQuery: createSuspenseInfiniteQuery.createSuspenseInfiniteQuery(options),
29
+ ...createInfiniteQuery.createInfiniteQuery(options)
30
+ };
31
+ }
32
+
28
33
  return acc;
29
34
  }, {
30
- getKey: () => [scope]
35
+ getKey: () => keys
31
36
  });
32
37
  };
33
38
 
39
+ const router = (key, config) => {
40
+ return buildRouter([key], config);
41
+ };
42
+
34
43
  router.query = options => {
35
44
  return { ...options,
36
45
  _type: 'q'
@@ -1 +1 @@
1
- {"version":3,"file":"router.js","sources":["../../src/router.ts"],"sourcesContent":["import { createInfiniteQuery } from './createInfiniteQuery'\nimport { createMutation } from './createMutation'\nimport { createQuery } from './createQuery'\nimport { createSuspenseInfiniteQuery } from './createSuspenseInfiniteQuery'\nimport { createSuspenseQuery } from './createSuspenseQuery'\nimport type {\n CompatibleError,\n CreateInfiniteQueryOptions,\n CreateMutationOptions,\n CreateQueryOptions,\n CreateRouter,\n RouterConfig,\n RouterInfiniteQuery,\n RouterMutation,\n RouterQuery,\n} from './types'\n\nexport const router = <TConfig extends RouterConfig>(\n scope: string,\n config: TConfig\n): CreateRouter<TConfig> => {\n return Object.entries(config).reduce(\n (acc, [key, opts]) => {\n const options: any = {\n ...opts,\n [opts._type === `m` ? `mutationKey` : `queryKey`]: [scope, key],\n }\n\n acc[key] =\n opts._type === `m`\n ? {\n useMutation: createMutation(options),\n ...createMutation(options),\n }\n : opts._type === `q`\n ? {\n useQuery: createQuery(options),\n useSuspenseQuery: createSuspenseQuery(options),\n ...createQuery(options),\n }\n : {\n useInfiniteQuery: createInfiniteQuery(options),\n useSuspenseInfiniteQuery: createSuspenseInfiniteQuery(options),\n ...createInfiniteQuery(options),\n }\n\n return acc\n },\n {\n getKey: () => [scope],\n } as any\n )\n}\n\nrouter.query = <TFnData, TVariables = void, TError = CompatibleError>(\n options: Omit<CreateQueryOptions<TFnData, TVariables, TError>, 'queryKey'>\n): RouterQuery<TFnData, TVariables, TError> => {\n return {\n ...options,\n _type: 'q',\n }\n}\n\nrouter.infiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: Omit<\n CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>,\n 'queryKey'\n >\n): RouterInfiniteQuery<TFnData, TVariables, TError, TPageParam> => {\n return { ...options, _type: 'inf' }\n}\n\nrouter.mutation = <\n TFnData = unknown,\n TVariables = void,\n TError = CompatibleError,\n TContext = unknown\n>(\n options: Omit<\n CreateMutationOptions<TFnData, TVariables, TError, TContext>,\n 'mutationKey'\n >\n): RouterMutation<TFnData, TVariables, TError, TContext> => {\n return { ...options, _type: 'm' }\n}\n"],"names":["router","scope","config","Object","entries","reduce","acc","key","opts","options","_type","useMutation","createMutation","useQuery","createQuery","useSuspenseQuery","createSuspenseQuery","useInfiniteQuery","createInfiniteQuery","useSuspenseInfiniteQuery","createSuspenseInfiniteQuery","getKey","query","infiniteQuery","mutation"],"mappings":";;;;;;;;;;MAiBaA,MAAM,GAAG,CACpBC,KADoB,EAEpBC,MAFoB,KAGM;AAC1B,EAAA,OAAOC,MAAM,CAACC,OAAP,CAAeF,MAAf,EAAuBG,MAAvB,CACL,CAACC,GAAD,EAAM,CAACC,GAAD,EAAMC,IAAN,CAAN,KAAsB;AACpB,IAAA,MAAMC,OAAY,GAAG,EACnB,GAAGD,IADgB;MAEnB,CAACA,IAAI,CAACE,KAAL,KAAA,GAAA,GAAA,aAAA,GAAA,UAAD,GAAmD,CAACT,KAAD,EAAQM,GAAR,CAAA;KAFrD,CAAA;AAKAD,IAAAA,GAAG,CAACC,GAAD,CAAH,GACEC,IAAI,CAACE,KAAL,KACI,GAAA,GAAA;AACEC,MAAAA,WAAW,EAAEC,6BAAc,CAACH,OAAD,CAD7B;MAEE,GAAGG,6BAAc,CAACH,OAAD,CAAA;AAFnB,KADJ,GAKID,IAAI,CAACE,KAAL,KACA,GAAA,GAAA;AACEG,MAAAA,QAAQ,EAAEC,uBAAW,CAACL,OAAD,CADvB;AAEEM,MAAAA,gBAAgB,EAAEC,uCAAmB,CAACP,OAAD,CAFvC;MAGE,GAAGK,uBAAW,CAACL,OAAD,CAAA;AAHhB,KADA,GAMA;AACEQ,MAAAA,gBAAgB,EAAEC,uCAAmB,CAACT,OAAD,CADvC;AAEEU,MAAAA,wBAAwB,EAAEC,uDAA2B,CAACX,OAAD,CAFvD;MAGE,GAAGS,uCAAmB,CAACT,OAAD,CAAA;KAf9B,CAAA;AAkBA,IAAA,OAAOH,GAAP,CAAA;AACD,GA1BI,EA2BL;IACEe,MAAM,EAAE,MAAM,CAACpB,KAAD,CAAA;AADhB,GA3BK,CAAP,CAAA;AA+BD,EAnCM;;AAqCPD,MAAM,CAACsB,KAAP,GACEb,OADa,IAEgC;EAC7C,OAAO,EACL,GAAGA,OADE;AAELC,IAAAA,KAAK,EAAE,GAAA;GAFT,CAAA;AAID,CAPD,CAAA;;AASAV,MAAM,CAACuB,aAAP,GAMEd,OANqB,IAU4C;EACjE,OAAO,EAAE,GAAGA,OAAL;AAAcC,IAAAA,KAAK,EAAE,KAAA;GAA5B,CAAA;AACD,CAZD,CAAA;;AAcAV,MAAM,CAACwB,QAAP,GAMEf,OANgB,IAU0C;EAC1D,OAAO,EAAE,GAAGA,OAAL;AAAcC,IAAAA,KAAK,EAAE,GAAA;GAA5B,CAAA;AACD,CAZD;;;;"}
1
+ {"version":3,"file":"router.js","sources":["../../src/router.ts"],"sourcesContent":["import { createInfiniteQuery } from './createInfiniteQuery'\nimport { createMutation } from './createMutation'\nimport { createQuery } from './createQuery'\nimport { createSuspenseInfiniteQuery } from './createSuspenseInfiniteQuery'\nimport { createSuspenseQuery } from './createSuspenseQuery'\nimport type {\n CompatibleError,\n CreateRouter,\n RouterConfig,\n RouterInfiniteQuery,\n RouterInfiniteQueryOptions,\n RouterMutation,\n RouterMutationOptions,\n RouterQuery,\n RouterQueryOptions,\n} from './types'\n\nconst buildRouter = (keys: string[], config: RouterConfig) => {\n return Object.entries(config).reduce(\n (acc, [key, opts]) => {\n if (!opts._type) {\n acc[key] = buildRouter([...keys, key], opts)\n } else {\n const options: any = {\n ...opts,\n [opts._type === `m` ? `mutationKey` : `queryKey`]: [...keys, key],\n }\n\n acc[key] =\n opts._type === `m`\n ? {\n useMutation: createMutation(options),\n ...createMutation(options),\n }\n : opts._type === `q`\n ? {\n useQuery: createQuery(options),\n useSuspenseQuery: createSuspenseQuery(options),\n ...createQuery(options),\n }\n : {\n useInfiniteQuery: createInfiniteQuery(options),\n useSuspenseInfiniteQuery: createSuspenseInfiniteQuery(options),\n ...createInfiniteQuery(options),\n }\n }\n\n return acc\n },\n {\n getKey: () => keys,\n } as any\n )\n}\n\nexport const router = <TConfig extends RouterConfig>(\n key: string,\n config: TConfig\n): CreateRouter<TConfig> => {\n return buildRouter([key], config)\n}\n\nrouter.query = <TFnData, TVariables = void, TError = CompatibleError>(\n options: RouterQueryOptions<TFnData, TVariables, TError>\n) => {\n return {\n ...options,\n _type: 'q',\n } as RouterQuery<TFnData, TVariables, TError>\n}\n\nrouter.infiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: RouterInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>\n) => {\n return { ...options, _type: 'inf' } as RouterInfiniteQuery<\n TFnData,\n TVariables,\n TError,\n TPageParam\n >\n}\n\nrouter.mutation = <\n TFnData = unknown,\n TVariables = void,\n TError = CompatibleError,\n TContext = unknown\n>(\n options: RouterMutationOptions<TFnData, TVariables, TError, TContext>\n) => {\n return { ...options, _type: 'm' } as RouterMutation<\n TFnData,\n TVariables,\n TError,\n TContext\n >\n}\n"],"names":["buildRouter","keys","config","Object","entries","reduce","acc","key","opts","_type","options","useMutation","createMutation","useQuery","createQuery","useSuspenseQuery","createSuspenseQuery","useInfiniteQuery","createInfiniteQuery","useSuspenseInfiniteQuery","createSuspenseInfiniteQuery","getKey","router","query","infiniteQuery","mutation"],"mappings":";;;;;;;;;;AAiBA,MAAMA,WAAW,GAAG,CAACC,IAAD,EAAiBC,MAAjB,KAA0C;AAC5D,EAAA,OAAOC,MAAM,CAACC,OAAP,CAAeF,MAAf,EAAuBG,MAAvB,CACL,CAACC,GAAD,EAAM,CAACC,GAAD,EAAMC,IAAN,CAAN,KAAsB;AACpB,IAAA,IAAI,CAACA,IAAI,CAACC,KAAV,EAAiB;AACfH,MAAAA,GAAG,CAACC,GAAD,CAAH,GAAWP,WAAW,CAAC,CAAC,GAAGC,IAAJ,EAAUM,GAAV,CAAD,EAAiBC,IAAjB,CAAtB,CAAA;AACD,KAFD,MAEO;AACL,MAAA,MAAME,OAAY,GAAG,EACnB,GAAGF,IADgB;QAEnB,CAACA,IAAI,CAACC,KAAL,KAAA,GAAA,GAAA,aAAA,GAAA,UAAD,GAAmD,CAAC,GAAGR,IAAJ,EAAUM,GAAV,CAAA;OAFrD,CAAA;AAKAD,MAAAA,GAAG,CAACC,GAAD,CAAH,GACEC,IAAI,CAACC,KAAL,KACI,GAAA,GAAA;AACEE,QAAAA,WAAW,EAAEC,6BAAc,CAACF,OAAD,CAD7B;QAEE,GAAGE,6BAAc,CAACF,OAAD,CAAA;AAFnB,OADJ,GAKIF,IAAI,CAACC,KAAL,KACA,GAAA,GAAA;AACEI,QAAAA,QAAQ,EAAEC,uBAAW,CAACJ,OAAD,CADvB;AAEEK,QAAAA,gBAAgB,EAAEC,uCAAmB,CAACN,OAAD,CAFvC;QAGE,GAAGI,uBAAW,CAACJ,OAAD,CAAA;AAHhB,OADA,GAMA;AACEO,QAAAA,gBAAgB,EAAEC,uCAAmB,CAACR,OAAD,CADvC;AAEES,QAAAA,wBAAwB,EAAEC,uDAA2B,CAACV,OAAD,CAFvD;QAGE,GAAGQ,uCAAmB,CAACR,OAAD,CAAA;OAf9B,CAAA;AAiBD,KAAA;;AAED,IAAA,OAAOJ,GAAP,CAAA;AACD,GA9BI,EA+BL;AACEe,IAAAA,MAAM,EAAE,MAAMpB,IAAAA;AADhB,GA/BK,CAAP,CAAA;AAmCD,CApCD,CAAA;;MAsCaqB,MAAM,GAAG,CACpBf,GADoB,EAEpBL,MAFoB,KAGM;AAC1B,EAAA,OAAOF,WAAW,CAAC,CAACO,GAAD,CAAD,EAAQL,MAAR,CAAlB,CAAA;AACD,EALM;;AAOPoB,MAAM,CAACC,KAAP,GACEb,OADa,IAEV;EACH,OAAO,EACL,GAAGA,OADE;AAELD,IAAAA,KAAK,EAAE,GAAA;GAFT,CAAA;AAID,CAPD,CAAA;;AASAa,MAAM,CAACE,aAAP,GAMEd,OANqB,IAOlB;EACH,OAAO,EAAE,GAAGA,OAAL;AAAcD,IAAAA,KAAK,EAAE,KAAA;GAA5B,CAAA;AAMD,CAdD,CAAA;;AAgBAa,MAAM,CAACG,QAAP,GAMEf,OANgB,IAOb;EACH,OAAO,EAAE,GAAGA,OAAL;AAAcD,IAAAA,KAAK,EAAE,GAAA;GAA5B,CAAA;AAMD,CAdD;;;;"}
@@ -4,29 +4,38 @@ import { createQuery } from './createQuery.mjs';
4
4
  import { createSuspenseInfiniteQuery } from './createSuspenseInfiniteQuery.mjs';
5
5
  import { createSuspenseQuery } from './createSuspenseQuery.mjs';
6
6
 
7
- const router = (scope, config) => {
7
+ const buildRouter = (keys, config) => {
8
8
  return Object.entries(config).reduce((acc, [key, opts]) => {
9
- const options = { ...opts,
10
- [opts._type === "m" ? "mutationKey" : "queryKey"]: [scope, key]
11
- };
12
- acc[key] = opts._type === "m" ? {
13
- useMutation: createMutation(options),
14
- ...createMutation(options)
15
- } : opts._type === "q" ? {
16
- useQuery: createQuery(options),
17
- useSuspenseQuery: createSuspenseQuery(options),
18
- ...createQuery(options)
19
- } : {
20
- useInfiniteQuery: createInfiniteQuery(options),
21
- useSuspenseInfiniteQuery: createSuspenseInfiniteQuery(options),
22
- ...createInfiniteQuery(options)
23
- };
9
+ if (!opts._type) {
10
+ acc[key] = buildRouter([...keys, key], opts);
11
+ } else {
12
+ const options = { ...opts,
13
+ [opts._type === "m" ? "mutationKey" : "queryKey"]: [...keys, key]
14
+ };
15
+ acc[key] = opts._type === "m" ? {
16
+ useMutation: createMutation(options),
17
+ ...createMutation(options)
18
+ } : opts._type === "q" ? {
19
+ useQuery: createQuery(options),
20
+ useSuspenseQuery: createSuspenseQuery(options),
21
+ ...createQuery(options)
22
+ } : {
23
+ useInfiniteQuery: createInfiniteQuery(options),
24
+ useSuspenseInfiniteQuery: createSuspenseInfiniteQuery(options),
25
+ ...createInfiniteQuery(options)
26
+ };
27
+ }
28
+
24
29
  return acc;
25
30
  }, {
26
- getKey: () => [scope]
31
+ getKey: () => keys
27
32
  });
28
33
  };
29
34
 
35
+ const router = (key, config) => {
36
+ return buildRouter([key], config);
37
+ };
38
+
30
39
  router.query = options => {
31
40
  return { ...options,
32
41
  _type: 'q'
@@ -1 +1 @@
1
- {"version":3,"file":"router.mjs","sources":["../../src/router.ts"],"sourcesContent":["import { createInfiniteQuery } from './createInfiniteQuery'\nimport { createMutation } from './createMutation'\nimport { createQuery } from './createQuery'\nimport { createSuspenseInfiniteQuery } from './createSuspenseInfiniteQuery'\nimport { createSuspenseQuery } from './createSuspenseQuery'\nimport type {\n CompatibleError,\n CreateInfiniteQueryOptions,\n CreateMutationOptions,\n CreateQueryOptions,\n CreateRouter,\n RouterConfig,\n RouterInfiniteQuery,\n RouterMutation,\n RouterQuery,\n} from './types'\n\nexport const router = <TConfig extends RouterConfig>(\n scope: string,\n config: TConfig\n): CreateRouter<TConfig> => {\n return Object.entries(config).reduce(\n (acc, [key, opts]) => {\n const options: any = {\n ...opts,\n [opts._type === `m` ? `mutationKey` : `queryKey`]: [scope, key],\n }\n\n acc[key] =\n opts._type === `m`\n ? {\n useMutation: createMutation(options),\n ...createMutation(options),\n }\n : opts._type === `q`\n ? {\n useQuery: createQuery(options),\n useSuspenseQuery: createSuspenseQuery(options),\n ...createQuery(options),\n }\n : {\n useInfiniteQuery: createInfiniteQuery(options),\n useSuspenseInfiniteQuery: createSuspenseInfiniteQuery(options),\n ...createInfiniteQuery(options),\n }\n\n return acc\n },\n {\n getKey: () => [scope],\n } as any\n )\n}\n\nrouter.query = <TFnData, TVariables = void, TError = CompatibleError>(\n options: Omit<CreateQueryOptions<TFnData, TVariables, TError>, 'queryKey'>\n): RouterQuery<TFnData, TVariables, TError> => {\n return {\n ...options,\n _type: 'q',\n }\n}\n\nrouter.infiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: Omit<\n CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>,\n 'queryKey'\n >\n): RouterInfiniteQuery<TFnData, TVariables, TError, TPageParam> => {\n return { ...options, _type: 'inf' }\n}\n\nrouter.mutation = <\n TFnData = unknown,\n TVariables = void,\n TError = CompatibleError,\n TContext = unknown\n>(\n options: Omit<\n CreateMutationOptions<TFnData, TVariables, TError, TContext>,\n 'mutationKey'\n >\n): RouterMutation<TFnData, TVariables, TError, TContext> => {\n return { ...options, _type: 'm' }\n}\n"],"names":["router","scope","config","Object","entries","reduce","acc","key","opts","options","_type","useMutation","createMutation","useQuery","createQuery","useSuspenseQuery","createSuspenseQuery","useInfiniteQuery","createInfiniteQuery","useSuspenseInfiniteQuery","createSuspenseInfiniteQuery","getKey","query","infiniteQuery","mutation"],"mappings":";;;;;;MAiBaA,MAAM,GAAG,CACpBC,KADoB,EAEpBC,MAFoB,KAGM;AAC1B,EAAA,OAAOC,MAAM,CAACC,OAAP,CAAeF,MAAf,EAAuBG,MAAvB,CACL,CAACC,GAAD,EAAM,CAACC,GAAD,EAAMC,IAAN,CAAN,KAAsB;AACpB,IAAA,MAAMC,OAAY,GAAG,EACnB,GAAGD,IADgB;MAEnB,CAACA,IAAI,CAACE,KAAL,KAAA,GAAA,GAAA,aAAA,GAAA,UAAD,GAAmD,CAACT,KAAD,EAAQM,GAAR,CAAA;KAFrD,CAAA;AAKAD,IAAAA,GAAG,CAACC,GAAD,CAAH,GACEC,IAAI,CAACE,KAAL,KACI,GAAA,GAAA;AACEC,MAAAA,WAAW,EAAEC,cAAc,CAACH,OAAD,CAD7B;MAEE,GAAGG,cAAc,CAACH,OAAD,CAAA;AAFnB,KADJ,GAKID,IAAI,CAACE,KAAL,KACA,GAAA,GAAA;AACEG,MAAAA,QAAQ,EAAEC,WAAW,CAACL,OAAD,CADvB;AAEEM,MAAAA,gBAAgB,EAAEC,mBAAmB,CAACP,OAAD,CAFvC;MAGE,GAAGK,WAAW,CAACL,OAAD,CAAA;AAHhB,KADA,GAMA;AACEQ,MAAAA,gBAAgB,EAAEC,mBAAmB,CAACT,OAAD,CADvC;AAEEU,MAAAA,wBAAwB,EAAEC,2BAA2B,CAACX,OAAD,CAFvD;MAGE,GAAGS,mBAAmB,CAACT,OAAD,CAAA;KAf9B,CAAA;AAkBA,IAAA,OAAOH,GAAP,CAAA;AACD,GA1BI,EA2BL;IACEe,MAAM,EAAE,MAAM,CAACpB,KAAD,CAAA;AADhB,GA3BK,CAAP,CAAA;AA+BD,EAnCM;;AAqCPD,MAAM,CAACsB,KAAP,GACEb,OADa,IAEgC;EAC7C,OAAO,EACL,GAAGA,OADE;AAELC,IAAAA,KAAK,EAAE,GAAA;GAFT,CAAA;AAID,CAPD,CAAA;;AASAV,MAAM,CAACuB,aAAP,GAMEd,OANqB,IAU4C;EACjE,OAAO,EAAE,GAAGA,OAAL;AAAcC,IAAAA,KAAK,EAAE,KAAA;GAA5B,CAAA;AACD,CAZD,CAAA;;AAcAV,MAAM,CAACwB,QAAP,GAMEf,OANgB,IAU0C;EAC1D,OAAO,EAAE,GAAGA,OAAL;AAAcC,IAAAA,KAAK,EAAE,GAAA;GAA5B,CAAA;AACD,CAZD;;;;"}
1
+ {"version":3,"file":"router.mjs","sources":["../../src/router.ts"],"sourcesContent":["import { createInfiniteQuery } from './createInfiniteQuery'\nimport { createMutation } from './createMutation'\nimport { createQuery } from './createQuery'\nimport { createSuspenseInfiniteQuery } from './createSuspenseInfiniteQuery'\nimport { createSuspenseQuery } from './createSuspenseQuery'\nimport type {\n CompatibleError,\n CreateRouter,\n RouterConfig,\n RouterInfiniteQuery,\n RouterInfiniteQueryOptions,\n RouterMutation,\n RouterMutationOptions,\n RouterQuery,\n RouterQueryOptions,\n} from './types'\n\nconst buildRouter = (keys: string[], config: RouterConfig) => {\n return Object.entries(config).reduce(\n (acc, [key, opts]) => {\n if (!opts._type) {\n acc[key] = buildRouter([...keys, key], opts)\n } else {\n const options: any = {\n ...opts,\n [opts._type === `m` ? `mutationKey` : `queryKey`]: [...keys, key],\n }\n\n acc[key] =\n opts._type === `m`\n ? {\n useMutation: createMutation(options),\n ...createMutation(options),\n }\n : opts._type === `q`\n ? {\n useQuery: createQuery(options),\n useSuspenseQuery: createSuspenseQuery(options),\n ...createQuery(options),\n }\n : {\n useInfiniteQuery: createInfiniteQuery(options),\n useSuspenseInfiniteQuery: createSuspenseInfiniteQuery(options),\n ...createInfiniteQuery(options),\n }\n }\n\n return acc\n },\n {\n getKey: () => keys,\n } as any\n )\n}\n\nexport const router = <TConfig extends RouterConfig>(\n key: string,\n config: TConfig\n): CreateRouter<TConfig> => {\n return buildRouter([key], config)\n}\n\nrouter.query = <TFnData, TVariables = void, TError = CompatibleError>(\n options: RouterQueryOptions<TFnData, TVariables, TError>\n) => {\n return {\n ...options,\n _type: 'q',\n } as RouterQuery<TFnData, TVariables, TError>\n}\n\nrouter.infiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: RouterInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>\n) => {\n return { ...options, _type: 'inf' } as RouterInfiniteQuery<\n TFnData,\n TVariables,\n TError,\n TPageParam\n >\n}\n\nrouter.mutation = <\n TFnData = unknown,\n TVariables = void,\n TError = CompatibleError,\n TContext = unknown\n>(\n options: RouterMutationOptions<TFnData, TVariables, TError, TContext>\n) => {\n return { ...options, _type: 'm' } as RouterMutation<\n TFnData,\n TVariables,\n TError,\n TContext\n >\n}\n"],"names":["buildRouter","keys","config","Object","entries","reduce","acc","key","opts","_type","options","useMutation","createMutation","useQuery","createQuery","useSuspenseQuery","createSuspenseQuery","useInfiniteQuery","createInfiniteQuery","useSuspenseInfiniteQuery","createSuspenseInfiniteQuery","getKey","router","query","infiniteQuery","mutation"],"mappings":";;;;;;AAiBA,MAAMA,WAAW,GAAG,CAACC,IAAD,EAAiBC,MAAjB,KAA0C;AAC5D,EAAA,OAAOC,MAAM,CAACC,OAAP,CAAeF,MAAf,EAAuBG,MAAvB,CACL,CAACC,GAAD,EAAM,CAACC,GAAD,EAAMC,IAAN,CAAN,KAAsB;AACpB,IAAA,IAAI,CAACA,IAAI,CAACC,KAAV,EAAiB;AACfH,MAAAA,GAAG,CAACC,GAAD,CAAH,GAAWP,WAAW,CAAC,CAAC,GAAGC,IAAJ,EAAUM,GAAV,CAAD,EAAiBC,IAAjB,CAAtB,CAAA;AACD,KAFD,MAEO;AACL,MAAA,MAAME,OAAY,GAAG,EACnB,GAAGF,IADgB;QAEnB,CAACA,IAAI,CAACC,KAAL,KAAA,GAAA,GAAA,aAAA,GAAA,UAAD,GAAmD,CAAC,GAAGR,IAAJ,EAAUM,GAAV,CAAA;OAFrD,CAAA;AAKAD,MAAAA,GAAG,CAACC,GAAD,CAAH,GACEC,IAAI,CAACC,KAAL,KACI,GAAA,GAAA;AACEE,QAAAA,WAAW,EAAEC,cAAc,CAACF,OAAD,CAD7B;QAEE,GAAGE,cAAc,CAACF,OAAD,CAAA;AAFnB,OADJ,GAKIF,IAAI,CAACC,KAAL,KACA,GAAA,GAAA;AACEI,QAAAA,QAAQ,EAAEC,WAAW,CAACJ,OAAD,CADvB;AAEEK,QAAAA,gBAAgB,EAAEC,mBAAmB,CAACN,OAAD,CAFvC;QAGE,GAAGI,WAAW,CAACJ,OAAD,CAAA;AAHhB,OADA,GAMA;AACEO,QAAAA,gBAAgB,EAAEC,mBAAmB,CAACR,OAAD,CADvC;AAEES,QAAAA,wBAAwB,EAAEC,2BAA2B,CAACV,OAAD,CAFvD;QAGE,GAAGQ,mBAAmB,CAACR,OAAD,CAAA;OAf9B,CAAA;AAiBD,KAAA;;AAED,IAAA,OAAOJ,GAAP,CAAA;AACD,GA9BI,EA+BL;AACEe,IAAAA,MAAM,EAAE,MAAMpB,IAAAA;AADhB,GA/BK,CAAP,CAAA;AAmCD,CApCD,CAAA;;MAsCaqB,MAAM,GAAG,CACpBf,GADoB,EAEpBL,MAFoB,KAGM;AAC1B,EAAA,OAAOF,WAAW,CAAC,CAACO,GAAD,CAAD,EAAQL,MAAR,CAAlB,CAAA;AACD,EALM;;AAOPoB,MAAM,CAACC,KAAP,GACEb,OADa,IAEV;EACH,OAAO,EACL,GAAGA,OADE;AAELD,IAAAA,KAAK,EAAE,GAAA;GAFT,CAAA;AAID,CAPD,CAAA;;AASAa,MAAM,CAACE,aAAP,GAMEd,OANqB,IAOlB;EACH,OAAO,EAAE,GAAGA,OAAL;AAAcD,IAAAA,KAAK,EAAE,KAAA;GAA5B,CAAA;AAMD,CAdD,CAAA;;AAgBAa,MAAM,CAACG,QAAP,GAMEf,OANgB,IAOb;EACH,OAAO,EAAE,GAAGA,OAAL;AAAcD,IAAAA,KAAK,EAAE,GAAA;GAA5B,CAAA;AAMD,CAdD;;;;"}
@@ -9,6 +9,7 @@ type WithRequired<T, K extends keyof T> = T & {
9
9
  type DeepPartial<T> = T extends object ? {
10
10
  [P in keyof T]?: DeepPartial<T[P]>;
11
11
  } : T;
12
+ type DefaultTo<T, D> = unknown extends T ? D : T;
12
13
  export type CompatibleError = CompatibleWithV4<DefaultError, Error>;
13
14
  export type Fetcher<TFnData, TVariables = void, TPageParam = never> = (variables: TVariables, context: QueryFunctionContext<QueryKey, TPageParam>) => TFnData | Promise<TFnData>;
14
15
  export type AdditionalQueryOptions<TFnData, TVariables, TPageParam = never> = {
@@ -126,28 +127,35 @@ export type inferFnData<T> = T extends {
126
127
  export type inferError<T> = T extends ExposeMethods<any, any, infer TError> ? TError : T extends ExposeMethods<any, any, infer TError, any> ? TError : T extends ExposeMutationMethods<any, any, infer TError, any> ? TError : never;
127
128
  export type inferOptions<T> = T extends QueryHook<infer TFnData, infer TVariables, infer TError> ? QueryHookOptions<TFnData, TError, TFnData, TVariables> : T extends SuspenseQueryHook<infer TFnData, infer TVariables, infer TError> ? SuspenseQueryHookOptions<TFnData, TError, TFnData, TVariables> : T extends InfiniteQueryHook<infer TFnData, infer TVariables, infer TError, infer TPageParam> ? InfiniteQueryHookOptions<TFnData, TError, CompatibleWithV4<InfiniteData<TFnData, TPageParam>, TFnData>, TVariables, TPageParam> : T extends SuspenseInfiniteQueryHook<infer TFnData, infer TVariables, infer TError, infer TPageParam> ? SuspenseInfiniteQueryHookOptions<TFnData, TError, CompatibleWithV4<InfiniteData<TFnData, TPageParam>, TFnData>, TVariables, TPageParam> : T extends MutationHook<infer TFnData, infer TVariables, infer TError> ? MutationHookOptions<TFnData, TError, TVariables, unknown> : never;
128
129
  export type inferCreateOptions<T> = T extends QueryHook<infer TFnData, infer TVariables, infer TError> ? CreateQueryOptions<TFnData, TVariables, TError> : T extends SuspenseQueryHook<infer TFnData, infer TVariables, infer TError> ? CreateSuspenseQueryOptions<TFnData, TVariables, TError> : T extends InfiniteQueryHook<infer TFnData, infer TVariables, infer TError, infer TPageParam> ? CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam> : T extends SuspenseInfiniteQueryHook<infer TFnData, infer TVariables, infer TError, infer TPageParam> ? CreateSuspenseInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam> : T extends MutationHook<infer TFnData, infer TVariables, infer TError, infer TContext> ? CreateMutationOptions<TFnData, TError, TVariables, TContext> : never;
129
- export type RouterQuery<TFnData, TVariables = void, TError = CompatibleError> = Omit<CreateQueryOptions<TFnData, TVariables, TError>, 'queryKey'> & {
130
+ export type RouterQueryOptions<TFnData, TVariables = void, TError = CompatibleError> = Omit<CreateQueryOptions<TFnData, TVariables, TError>, 'queryKey'>;
131
+ export type RouterQuery<TFnData, TVariables = void, TError = CompatibleError> = RouterQueryOptions<TFnData, TVariables, TError> & {
130
132
  _type: `q`;
131
133
  };
132
- export type RouterInfiniteQuery<TFnData, TVariables = void, TError = CompatibleError, TPageParam = number> = Omit<CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>, 'queryKey'> & {
134
+ export type ResolvedRouterQuery<TFnData, TVariables = void, TError = CompatibleError> = {
135
+ useQuery: QueryHook<TFnData, TVariables, TError>;
136
+ useSuspenseQuery: SuspenseQueryHook<TFnData, TVariables, TError>;
137
+ } & ExposeMethods<TFnData, TVariables, TError>;
138
+ export type RouterInfiniteQueryOptions<TFnData, TVariables = void, TError = CompatibleError, TPageParam = number> = Omit<CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>, 'queryKey'>;
139
+ export type RouterInfiniteQuery<TFnData, TVariables = void, TError = CompatibleError, TPageParam = number> = RouterInfiniteQueryOptions<TFnData, TVariables, TError, Clone<TPageParam>> & {
133
140
  _type: `inf`;
134
141
  };
135
- export type RouterMutation<TData = unknown, TVariables = void, TError = CompatibleError, TContext = unknown> = Omit<CreateMutationOptions<TData, TVariables, TError, TContext>, 'mutationKey'> & {
142
+ export type ResolvedRouterInfiniteQuery<TFnData, TVariables = void, TError = CompatibleError, TPageParam = number> = {
143
+ useInfiniteQuery: InfiniteQueryHook<TFnData, TVariables, TError, TPageParam>;
144
+ useSuspenseInfiniteQuery: SuspenseInfiniteQueryHook<TFnData, TVariables, TError, TPageParam>;
145
+ } & ExposeMethods<TFnData, TVariables, TError, TPageParam>;
146
+ export type RouterMutationOptions<TData = unknown, TVariables = void, TError = CompatibleError, TContext = unknown> = Omit<CreateMutationOptions<TData, TVariables, TError, TContext>, 'mutationKey'>;
147
+ export type RouterMutation<TData = unknown, TVariables = void, TError = CompatibleError, TContext = unknown> = RouterMutationOptions<TData, TVariables, TError, TContext> & {
136
148
  _type: `m`;
137
149
  };
138
- type DefaultTo<T, D> = unknown extends T ? D : T;
139
- export type RouterConfig = Record<string, RouterQuery<any, any, any> | RouterInfiniteQuery<any, any, any, any> | RouterMutation<any, any, any, any>>;
150
+ export type ResolvedRouterMutation<TData = unknown, TVariables = void, TError = CompatibleError, TContext = unknown> = {
151
+ useMutation: MutationHook<TData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>, TContext>;
152
+ } & ExposeMutationMethods<TData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>, TContext>;
153
+ export interface RouterConfig {
154
+ [k: string]: RouterQuery<any, any, any> | RouterInfiniteQuery<any, any, any, any> | RouterMutation<any, any, any, any> | RouterConfig;
155
+ }
140
156
  export type CreateRouter<TConfig extends RouterConfig> = {
141
- [K in keyof TConfig]: TConfig[K] extends RouterMutation<infer TFnData, infer TVariables, infer TError, infer TContext> ? {
142
- useMutation: MutationHook<TFnData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>, TContext>;
143
- } & ExposeMutationMethods<TFnData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>, TContext> : TConfig[K] extends RouterInfiniteQuery<infer TFnData, infer TVariables, infer TError, infer TPageParam> ? {
144
- useInfiniteQuery: InfiniteQueryHook<TFnData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>, DefaultTo<TPageParam, number>>;
145
- useSuspenseInfiniteQuery: SuspenseInfiniteQueryHook<TFnData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>, DefaultTo<TPageParam, number>>;
146
- } & ExposeMethods<TFnData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>, DefaultTo<TPageParam, number>> : TConfig[K] extends Omit<RouterQuery<infer TFnData, infer TVariables, infer TError>, 'queryKey'> ? {
147
- useQuery: QueryHook<TFnData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>>;
148
- useSuspenseQuery: SuspenseQueryHook<TFnData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>>;
149
- } & ExposeMethods<TFnData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>> : never;
157
+ [K in keyof TConfig]: TConfig[K] extends RouterMutation<infer TFnData, infer TVariables, infer TError, infer TContext> ? ResolvedRouterMutation<TFnData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>, TContext> : TConfig[K] extends RouterInfiniteQuery<infer TFnData, infer TVariables, infer TError, infer TPageParam> ? ResolvedRouterInfiniteQuery<TFnData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>, DefaultTo<TPageParam, number>> : TConfig[K] extends Omit<RouterQuery<infer TFnData, infer TVariables, infer TError>, 'queryKey'> ? ResolvedRouterQuery<TFnData, DefaultTo<TVariables, void>, DefaultTo<TError, CompatibleError>> : TConfig[K] extends RouterConfig ? CreateRouter<TConfig[K]> : never;
150
158
  } & {
151
- getKey: () => [string];
159
+ getKey: () => string[];
152
160
  };
153
161
  export {};
@@ -5,7 +5,7 @@ const isV5 = !!ReactQuery.useSuspenseQuery;
5
5
  const suspenseOptions = {
6
6
  enabled: true,
7
7
  suspense: true,
8
- useErrorBoundary: (_error, query) => query.state.data === undefined
8
+ useErrorBoundary: (_error, query) => typeof query.state.data === 'undefined'
9
9
  };
10
10
  const withMiddleware = (hook, defaultOptions, type) => {
11
11
  return function useMiddleware(options, queryClient) {
@@ -16,12 +16,12 @@ const withMiddleware = (hook, defaultOptions, type) => {
16
16
  } = {}) => [[...u1, ...u2], { ...o1,
17
17
  ...o2
18
18
  }], [[]]);
19
- const composed = uses.reduceRight((next, use) => use(next), hook);
20
- return composed(opts, queryClient);
19
+ const composedHook = uses.reduceRight((next, use) => use(next), hook);
20
+ return composedHook(opts, queryClient);
21
21
  };
22
22
  };
23
23
  const getKey = (queryKey, variables) => {
24
- return variables === undefined ? [...queryKey] : [...queryKey, variables];
24
+ return typeof variables === 'undefined' ? queryKey : [...queryKey, variables];
25
25
  };
26
26
 
27
27
  export { ReactQuery, getKey, isV5, suspenseOptions, withMiddleware };
@@ -1 +1 @@
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 [uses, opts]: [Middleware[], any] = [\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 const composed = uses.reduceRight((next, use) => use(next), hook)\n\n return composed(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","uses","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","composed","reduceRight","next","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,IAAD,EAAOC,IAAP,IAAoC,CACxCrB,UAAU,CAACsB,cAAX;IAEEpB,IAAI,GAAGiB,WAAH,GAAiBD,OAFvB,EAGEK,iBAHF,EAAA,CAGsBP,IAHtB,CADwC,EAKxCD,cALwC,EAMxCG,OANwC,CAAA,CAOxCM,MAPwC,CAQxC,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,CARJ,EAYxC,CAAC,EAAD,CAZwC,CAA1C,CAAA;AAcA,IAAA,MAAMC,QAAQ,GAAGV,IAAI,CAACW,WAAL,CAAiB,CAACC,IAAD,EAAOL,GAAP,KAAeA,GAAG,CAACK,IAAD,CAAnC,EAA2ClB,IAA3C,CAAjB,CAAA;AAEA,IAAA,OAAOgB,QAAQ,CAACT,IAAD,EAAOF,WAAP,CAAf,CAAA;GApBF,CAAA;AAsBD,EA3BM;MA6BMc,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;;;;"}
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 typeof 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 [uses, opts]: [Middleware[], any] = [\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 const composedHook = uses.reduceRight((next, use) => use(next), hook)\n\n return composedHook(opts, queryClient)\n }\n}\n\nexport const getKey = (queryKey: QueryKey, variables?: any): QueryKey => {\n return typeof variables === 'undefined' ? queryKey : [...queryKey, variables]\n}\n"],"names":["ReactQuery","TanstackReactQuery","isV5","useSuspenseQuery","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","uses","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","composedHook","reduceRight","next","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;AAG7BC,EAAAA,gBAAgB,EAAE,CAACC,MAAD,EAAkBC,KAAlB,KAChB,OAAOA,KAAK,CAACC,KAAN,CAAYC,IAAnB,KAA4B,WAAA;AAJD,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,IAAD,EAAOC,IAAP,IAAoC,CACxCpB,UAAU,CAACqB,cAAX;IAEEnB,IAAI,GAAGgB,WAAH,GAAiBD,OAFvB,EAGEK,iBAHF,EAAA,CAGsBP,IAHtB,CADwC,EAKxCD,cALwC,EAMxCG,OANwC,CAAA,CAOxCM,MAPwC,CAQxC,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,CARJ,EAYxC,CAAC,EAAD,CAZwC,CAA1C,CAAA;AAcA,IAAA,MAAMC,YAAY,GAAGV,IAAI,CAACW,WAAL,CAAiB,CAACC,IAAD,EAAOL,GAAP,KAAeA,GAAG,CAACK,IAAD,CAAnC,EAA2ClB,IAA3C,CAArB,CAAA;AAEA,IAAA,OAAOgB,YAAY,CAACT,IAAD,EAAOF,WAAP,CAAnB,CAAA;GApBF,CAAA;AAsBD,EA3BM;MA6BMc,MAAM,GAAG,CAACC,QAAD,EAAqBC,SAArB,KAAmD;AACvE,EAAA,OAAO,OAAOA,SAAP,KAAqB,WAArB,GAAmCD,QAAnC,GAA8C,CAAC,GAAGA,QAAJ,EAAcC,SAAd,CAArD,CAAA;AACD;;;;"}
@@ -29,7 +29,7 @@ const isV5 = !!ReactQuery.useSuspenseQuery;
29
29
  const suspenseOptions = {
30
30
  enabled: true,
31
31
  suspense: true,
32
- useErrorBoundary: (_error, query) => query.state.data === undefined
32
+ useErrorBoundary: (_error, query) => typeof query.state.data === 'undefined'
33
33
  };
34
34
  const withMiddleware = (hook, defaultOptions, type) => {
35
35
  return function useMiddleware(options, queryClient) {
@@ -40,12 +40,12 @@ const withMiddleware = (hook, defaultOptions, type) => {
40
40
  } = {}) => [[...u1, ...u2], { ...o1,
41
41
  ...o2
42
42
  }], [[]]);
43
- const composed = uses.reduceRight((next, use) => use(next), hook);
44
- return composed(opts, queryClient);
43
+ const composedHook = uses.reduceRight((next, use) => use(next), hook);
44
+ return composedHook(opts, queryClient);
45
45
  };
46
46
  };
47
47
  const getKey = (queryKey, variables) => {
48
- return variables === undefined ? [...queryKey] : [...queryKey, variables];
48
+ return typeof variables === 'undefined' ? queryKey : [...queryKey, variables];
49
49
  };
50
50
 
51
51
  exports.ReactQuery = ReactQuery;
@@ -1 +1 @@
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 [uses, opts]: [Middleware[], any] = [\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 const composed = uses.reduceRight((next, use) => use(next), hook)\n\n return composed(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","uses","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","composed","reduceRight","next","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,IAAD,EAAOC,IAAP,IAAoC,CACxCrB,UAAU,CAACsB,cAAX;IAEEpB,IAAI,GAAGiB,WAAH,GAAiBD,OAFvB,EAGEK,iBAHF,EAAA,CAGsBP,IAHtB,CADwC,EAKxCD,cALwC,EAMxCG,OANwC,CAAA,CAOxCM,MAPwC,CAQxC,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,CARJ,EAYxC,CAAC,EAAD,CAZwC,CAA1C,CAAA;AAcA,IAAA,MAAMC,QAAQ,GAAGV,IAAI,CAACW,WAAL,CAAiB,CAACC,IAAD,EAAOL,GAAP,KAAeA,GAAG,CAACK,IAAD,CAAnC,EAA2ClB,IAA3C,CAAjB,CAAA;AAEA,IAAA,OAAOgB,QAAQ,CAACT,IAAD,EAAOF,WAAP,CAAf,CAAA;GApBF,CAAA;AAsBD,EA3BM;MA6BMc,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;;;;;;;;"}
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 typeof 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 [uses, opts]: [Middleware[], any] = [\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 const composedHook = uses.reduceRight((next, use) => use(next), hook)\n\n return composedHook(opts, queryClient)\n }\n}\n\nexport const getKey = (queryKey: QueryKey, variables?: any): QueryKey => {\n return typeof variables === 'undefined' ? queryKey : [...queryKey, variables]\n}\n"],"names":["ReactQuery","TanstackReactQuery","isV5","useSuspenseQuery","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","uses","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","composedHook","reduceRight","next","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;AAG7BC,EAAAA,gBAAgB,EAAE,CAACC,MAAD,EAAkBC,KAAlB,KAChB,OAAOA,KAAK,CAACC,KAAN,CAAYC,IAAnB,KAA4B,WAAA;AAJD,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,IAAD,EAAOC,IAAP,IAAoC,CACxCpB,UAAU,CAACqB,cAAX;IAEEnB,IAAI,GAAGgB,WAAH,GAAiBD,OAFvB,EAGEK,iBAHF,EAAA,CAGsBP,IAHtB,CADwC,EAKxCD,cALwC,EAMxCG,OANwC,CAAA,CAOxCM,MAPwC,CAQxC,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,CARJ,EAYxC,CAAC,EAAD,CAZwC,CAA1C,CAAA;AAcA,IAAA,MAAMC,YAAY,GAAGV,IAAI,CAACW,WAAL,CAAiB,CAACC,IAAD,EAAOL,GAAP,KAAeA,GAAG,CAACK,IAAD,CAAnC,EAA2ClB,IAA3C,CAArB,CAAA;AAEA,IAAA,OAAOgB,YAAY,CAACT,IAAD,EAAOF,WAAP,CAAnB,CAAA;GApBF,CAAA;AAsBD,EA3BM;MA6BMc,MAAM,GAAG,CAACC,QAAD,EAAqBC,SAArB,KAAmD;AACvE,EAAA,OAAO,OAAOA,SAAP,KAAqB,WAArB,GAAmCD,QAAnC,GAA8C,CAAC,GAAGA,QAAJ,EAAcC,SAAd,CAArD,CAAA;AACD;;;;;;;;"}
@@ -5,7 +5,7 @@ const isV5 = !!ReactQuery.useSuspenseQuery;
5
5
  const suspenseOptions = {
6
6
  enabled: true,
7
7
  suspense: true,
8
- useErrorBoundary: (_error, query) => query.state.data === undefined
8
+ useErrorBoundary: (_error, query) => typeof query.state.data === 'undefined'
9
9
  };
10
10
  const withMiddleware = (hook, defaultOptions, type) => {
11
11
  return function useMiddleware(options, queryClient) {
@@ -16,12 +16,12 @@ const withMiddleware = (hook, defaultOptions, type) => {
16
16
  } = {}) => [[...u1, ...u2], { ...o1,
17
17
  ...o2
18
18
  }], [[]]);
19
- const composed = uses.reduceRight((next, use) => use(next), hook);
20
- return composed(opts, queryClient);
19
+ const composedHook = uses.reduceRight((next, use) => use(next), hook);
20
+ return composedHook(opts, queryClient);
21
21
  };
22
22
  };
23
23
  const getKey = (queryKey, variables) => {
24
- return variables === undefined ? [...queryKey] : [...queryKey, variables];
24
+ return typeof variables === 'undefined' ? queryKey : [...queryKey, variables];
25
25
  };
26
26
 
27
27
  export { ReactQuery, getKey, isV5, suspenseOptions, withMiddleware };
@@ -1 +1 @@
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 [uses, opts]: [Middleware[], any] = [\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 const composed = uses.reduceRight((next, use) => use(next), hook)\n\n return composed(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","uses","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","composed","reduceRight","next","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,IAAD,EAAOC,IAAP,IAAoC,CACxCrB,UAAU,CAACsB,cAAX;IAEEpB,IAAI,GAAGiB,WAAH,GAAiBD,OAFvB,EAGEK,iBAHF,EAAA,CAGsBP,IAHtB,CADwC,EAKxCD,cALwC,EAMxCG,OANwC,CAAA,CAOxCM,MAPwC,CAQxC,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,CARJ,EAYxC,CAAC,EAAD,CAZwC,CAA1C,CAAA;AAcA,IAAA,MAAMC,QAAQ,GAAGV,IAAI,CAACW,WAAL,CAAiB,CAACC,IAAD,EAAOL,GAAP,KAAeA,GAAG,CAACK,IAAD,CAAnC,EAA2ClB,IAA3C,CAAjB,CAAA;AAEA,IAAA,OAAOgB,QAAQ,CAACT,IAAD,EAAOF,WAAP,CAAf,CAAA;GApBF,CAAA;AAsBD,EA3BM;MA6BMc,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;;;;"}
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 typeof 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 [uses, opts]: [Middleware[], any] = [\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 const composedHook = uses.reduceRight((next, use) => use(next), hook)\n\n return composedHook(opts, queryClient)\n }\n}\n\nexport const getKey = (queryKey: QueryKey, variables?: any): QueryKey => {\n return typeof variables === 'undefined' ? queryKey : [...queryKey, variables]\n}\n"],"names":["ReactQuery","TanstackReactQuery","isV5","useSuspenseQuery","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","uses","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","composedHook","reduceRight","next","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;AAG7BC,EAAAA,gBAAgB,EAAE,CAACC,MAAD,EAAkBC,KAAlB,KAChB,OAAOA,KAAK,CAACC,KAAN,CAAYC,IAAnB,KAA4B,WAAA;AAJD,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,IAAD,EAAOC,IAAP,IAAoC,CACxCpB,UAAU,CAACqB,cAAX;IAEEnB,IAAI,GAAGgB,WAAH,GAAiBD,OAFvB,EAGEK,iBAHF,EAAA,CAGsBP,IAHtB,CADwC,EAKxCD,cALwC,EAMxCG,OANwC,CAAA,CAOxCM,MAPwC,CAQxC,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,CARJ,EAYxC,CAAC,EAAD,CAZwC,CAA1C,CAAA;AAcA,IAAA,MAAMC,YAAY,GAAGV,IAAI,CAACW,WAAL,CAAiB,CAACC,IAAD,EAAOL,GAAP,KAAeA,GAAG,CAACK,IAAD,CAAnC,EAA2ClB,IAA3C,CAArB,CAAA;AAEA,IAAA,OAAOgB,YAAY,CAACT,IAAD,EAAOF,WAAP,CAAnB,CAAA;GApBF,CAAA;AAsBD,EA3BM;MA6BMc,MAAM,GAAG,CAACC,QAAD,EAAqBC,SAArB,KAAmD;AACvE,EAAA,OAAO,OAAOA,SAAP,KAAqB,WAArB,GAAmCD,QAAnC,GAA8C,CAAC,GAAGA,QAAJ,EAAcC,SAAd,CAArD,CAAA;AACD;;;;"}
@@ -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":"68f7-1","name":"utils.ts"},{"uid":"68f7-3","name":"createBaseQuery.ts"},{"uid":"68f7-5","name":"createQuery.ts"},{"uid":"68f7-7","name":"createSuspenseQuery.ts"},{"uid":"68f7-9","name":"createInfiniteQuery.ts"},{"uid":"68f7-11","name":"createSuspenseInfiniteQuery.ts"},{"uid":"68f7-13","name":"createMutation.ts"},{"uid":"68f7-15","name":"router.ts"},{"uid":"68f7-17","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"68f7-1":{"renderedLength":873,"gzipLength":438,"brotliLength":0,"mainUid":"68f7-0"},"68f7-3":{"renderedLength":1162,"gzipLength":397,"brotliLength":0,"mainUid":"68f7-2"},"68f7-5":{"renderedLength":91,"gzipLength":87,"brotliLength":0,"mainUid":"68f7-4"},"68f7-7":{"renderedLength":179,"gzipLength":118,"brotliLength":0,"mainUid":"68f7-6"},"68f7-9":{"renderedLength":107,"gzipLength":97,"brotliLength":0,"mainUid":"68f7-8"},"68f7-11":{"renderedLength":203,"gzipLength":128,"brotliLength":0,"mainUid":"68f7-10"},"68f7-13":{"renderedLength":271,"gzipLength":168,"brotliLength":0,"mainUid":"68f7-12"},"68f7-15":{"renderedLength":949,"gzipLength":337,"brotliLength":0,"mainUid":"68f7-14"},"68f7-17":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"68f7-16"}},"nodeMetas":{"68f7-0":{"id":"/src/utils.ts","moduleParts":{"zip.esm.js":"68f7-1"},"imported":[{"uid":"68f7-19"}],"importedBy":[{"uid":"68f7-16"},{"uid":"68f7-4"},{"uid":"68f7-6"},{"uid":"68f7-8"},{"uid":"68f7-10"},{"uid":"68f7-12"},{"uid":"68f7-2"}]},"68f7-2":{"id":"/src/createBaseQuery.ts","moduleParts":{"zip.esm.js":"68f7-3"},"imported":[{"uid":"68f7-0"}],"importedBy":[{"uid":"68f7-4"},{"uid":"68f7-6"},{"uid":"68f7-8"},{"uid":"68f7-10"}]},"68f7-4":{"id":"/src/createQuery.ts","moduleParts":{"zip.esm.js":"68f7-5"},"imported":[{"uid":"68f7-2"},{"uid":"68f7-0"}],"importedBy":[{"uid":"68f7-16"},{"uid":"68f7-14"}]},"68f7-6":{"id":"/src/createSuspenseQuery.ts","moduleParts":{"zip.esm.js":"68f7-7"},"imported":[{"uid":"68f7-2"},{"uid":"68f7-0"}],"importedBy":[{"uid":"68f7-16"},{"uid":"68f7-14"}]},"68f7-8":{"id":"/src/createInfiniteQuery.ts","moduleParts":{"zip.esm.js":"68f7-9"},"imported":[{"uid":"68f7-2"},{"uid":"68f7-0"}],"importedBy":[{"uid":"68f7-16"},{"uid":"68f7-14"}]},"68f7-10":{"id":"/src/createSuspenseInfiniteQuery.ts","moduleParts":{"zip.esm.js":"68f7-11"},"imported":[{"uid":"68f7-2"},{"uid":"68f7-0"}],"importedBy":[{"uid":"68f7-16"},{"uid":"68f7-14"}]},"68f7-12":{"id":"/src/createMutation.ts","moduleParts":{"zip.esm.js":"68f7-13"},"imported":[{"uid":"68f7-0"}],"importedBy":[{"uid":"68f7-16"},{"uid":"68f7-14"}]},"68f7-14":{"id":"/src/router.ts","moduleParts":{"zip.esm.js":"68f7-15"},"imported":[{"uid":"68f7-8"},{"uid":"68f7-12"},{"uid":"68f7-4"},{"uid":"68f7-10"},{"uid":"68f7-6"}],"importedBy":[{"uid":"68f7-16"}]},"68f7-16":{"id":"/src/index.ts","moduleParts":{"zip.esm.js":"68f7-17"},"imported":[{"uid":"68f7-4"},{"uid":"68f7-6"},{"uid":"68f7-8"},{"uid":"68f7-10"},{"uid":"68f7-12"},{"uid":"68f7-18"},{"uid":"68f7-14"},{"uid":"68f7-0"}],"importedBy":[],"isEntry":true},"68f7-18":{"id":"/src/types.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"68f7-16"}]},"68f7-19":{"id":"@tanstack/react-query","moduleParts":{},"imported":[],"importedBy":[{"uid":"68f7-0"}],"isExternal":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4017
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"zip.esm.js","children":[{"name":"src","children":[{"uid":"fd7f-1","name":"utils.ts"},{"uid":"fd7f-3","name":"createBaseQuery.ts"},{"uid":"fd7f-5","name":"createQuery.ts"},{"uid":"fd7f-7","name":"createSuspenseQuery.ts"},{"uid":"fd7f-9","name":"createInfiniteQuery.ts"},{"uid":"fd7f-11","name":"createSuspenseInfiniteQuery.ts"},{"uid":"fd7f-13","name":"createMutation.ts"},{"uid":"fd7f-15","name":"router.ts"},{"uid":"fd7f-17","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"fd7f-1":{"renderedLength":894,"gzipLength":449,"brotliLength":0,"mainUid":"fd7f-0"},"fd7f-3":{"renderedLength":1162,"gzipLength":397,"brotliLength":0,"mainUid":"fd7f-2"},"fd7f-5":{"renderedLength":91,"gzipLength":87,"brotliLength":0,"mainUid":"fd7f-4"},"fd7f-7":{"renderedLength":179,"gzipLength":118,"brotliLength":0,"mainUid":"fd7f-6"},"fd7f-9":{"renderedLength":107,"gzipLength":97,"brotliLength":0,"mainUid":"fd7f-8"},"fd7f-11":{"renderedLength":203,"gzipLength":128,"brotliLength":0,"mainUid":"fd7f-10"},"fd7f-13":{"renderedLength":271,"gzipLength":168,"brotliLength":0,"mainUid":"fd7f-12"},"fd7f-15":{"renderedLength":1152,"gzipLength":385,"brotliLength":0,"mainUid":"fd7f-14"},"fd7f-17":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"fd7f-16"}},"nodeMetas":{"fd7f-0":{"id":"/src/utils.ts","moduleParts":{"zip.esm.js":"fd7f-1"},"imported":[{"uid":"fd7f-19"}],"importedBy":[{"uid":"fd7f-16"},{"uid":"fd7f-4"},{"uid":"fd7f-6"},{"uid":"fd7f-8"},{"uid":"fd7f-10"},{"uid":"fd7f-12"},{"uid":"fd7f-2"}]},"fd7f-2":{"id":"/src/createBaseQuery.ts","moduleParts":{"zip.esm.js":"fd7f-3"},"imported":[{"uid":"fd7f-0"}],"importedBy":[{"uid":"fd7f-4"},{"uid":"fd7f-6"},{"uid":"fd7f-8"},{"uid":"fd7f-10"}]},"fd7f-4":{"id":"/src/createQuery.ts","moduleParts":{"zip.esm.js":"fd7f-5"},"imported":[{"uid":"fd7f-2"},{"uid":"fd7f-0"}],"importedBy":[{"uid":"fd7f-16"},{"uid":"fd7f-14"}]},"fd7f-6":{"id":"/src/createSuspenseQuery.ts","moduleParts":{"zip.esm.js":"fd7f-7"},"imported":[{"uid":"fd7f-2"},{"uid":"fd7f-0"}],"importedBy":[{"uid":"fd7f-16"},{"uid":"fd7f-14"}]},"fd7f-8":{"id":"/src/createInfiniteQuery.ts","moduleParts":{"zip.esm.js":"fd7f-9"},"imported":[{"uid":"fd7f-2"},{"uid":"fd7f-0"}],"importedBy":[{"uid":"fd7f-16"},{"uid":"fd7f-14"}]},"fd7f-10":{"id":"/src/createSuspenseInfiniteQuery.ts","moduleParts":{"zip.esm.js":"fd7f-11"},"imported":[{"uid":"fd7f-2"},{"uid":"fd7f-0"}],"importedBy":[{"uid":"fd7f-16"},{"uid":"fd7f-14"}]},"fd7f-12":{"id":"/src/createMutation.ts","moduleParts":{"zip.esm.js":"fd7f-13"},"imported":[{"uid":"fd7f-0"}],"importedBy":[{"uid":"fd7f-16"},{"uid":"fd7f-14"}]},"fd7f-14":{"id":"/src/router.ts","moduleParts":{"zip.esm.js":"fd7f-15"},"imported":[{"uid":"fd7f-8"},{"uid":"fd7f-12"},{"uid":"fd7f-4"},{"uid":"fd7f-10"},{"uid":"fd7f-6"}],"importedBy":[{"uid":"fd7f-16"}]},"fd7f-16":{"id":"/src/index.ts","moduleParts":{"zip.esm.js":"fd7f-17"},"imported":[{"uid":"fd7f-4"},{"uid":"fd7f-6"},{"uid":"fd7f-8"},{"uid":"fd7f-10"},{"uid":"fd7f-12"},{"uid":"fd7f-18"},{"uid":"fd7f-14"},{"uid":"fd7f-0"}],"importedBy":[],"isEntry":true},"fd7f-18":{"id":"/src/types.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"fd7f-16"}]},"fd7f-19":{"id":"@tanstack/react-query","moduleParts":{},"imported":[],"importedBy":[{"uid":"fd7f-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;