@kubb/plugin-react-query 3.4.5 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { Operation } from '@kubb/oas';
2
2
  import { OperationSchemas } from '@kubb/plugin-oas';
3
3
  import { ReactNode } from 'react';
4
- import { P as PluginReactQuery, T as Transformer, I as Infinite } from './types-DbdPn2MA.cjs';
4
+ import { P as PluginReactQuery, T as Transformer, I as Infinite } from './types-18y-1Kmu.cjs';
5
5
  import { FunctionParams } from '@kubb/react';
6
6
  import '@kubb/core';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { Operation } from '@kubb/oas';
2
2
  import { OperationSchemas } from '@kubb/plugin-oas';
3
3
  import { ReactNode } from 'react';
4
- import { P as PluginReactQuery, T as Transformer, I as Infinite } from './types-DbdPn2MA.js';
4
+ import { P as PluginReactQuery, T as Transformer, I as Infinite } from './types-18y-1Kmu.js';
5
5
  import { FunctionParams } from '@kubb/react';
6
6
  import '@kubb/core';
7
7
 
@@ -1,25 +1,25 @@
1
1
  'use strict';
2
2
 
3
- var chunkT7FDN353_cjs = require('./chunk-T7FDN353.cjs');
3
+ var chunkQUDUSXV4_cjs = require('./chunk-QUDUSXV4.cjs');
4
4
  require('./chunk-ZHLF4MXY.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "infiniteQueryGenerator", {
9
9
  enumerable: true,
10
- get: function () { return chunkT7FDN353_cjs.infiniteQueryGenerator; }
10
+ get: function () { return chunkQUDUSXV4_cjs.infiniteQueryGenerator; }
11
11
  });
12
12
  Object.defineProperty(exports, "mutationGenerator", {
13
13
  enumerable: true,
14
- get: function () { return chunkT7FDN353_cjs.mutationGenerator; }
14
+ get: function () { return chunkQUDUSXV4_cjs.mutationGenerator; }
15
15
  });
16
16
  Object.defineProperty(exports, "queryGenerator", {
17
17
  enumerable: true,
18
- get: function () { return chunkT7FDN353_cjs.queryGenerator; }
18
+ get: function () { return chunkQUDUSXV4_cjs.queryGenerator; }
19
19
  });
20
20
  Object.defineProperty(exports, "suspenseQueryGenerator", {
21
21
  enumerable: true,
22
- get: function () { return chunkT7FDN353_cjs.suspenseQueryGenerator; }
22
+ get: function () { return chunkQUDUSXV4_cjs.suspenseQueryGenerator; }
23
23
  });
24
24
  //# sourceMappingURL=generators.cjs.map
25
25
  //# sourceMappingURL=generators.cjs.map
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginReactQuery } from './types-DbdPn2MA.cjs';
2
+ import { P as PluginReactQuery } from './types-18y-1Kmu.cjs';
3
3
  import '@kubb/core';
4
4
  import '@kubb/oas';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginReactQuery } from './types-DbdPn2MA.js';
2
+ import { P as PluginReactQuery } from './types-18y-1Kmu.js';
3
3
  import '@kubb/core';
4
4
  import '@kubb/oas';
5
5
 
@@ -1,4 +1,4 @@
1
- export { infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseQueryGenerator } from './chunk-WNZYQKVV.js';
1
+ export { infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseQueryGenerator } from './chunk-2UDCBM34.js';
2
2
  import './chunk-5J7D6D3Z.js';
3
3
  //# sourceMappingURL=generators.js.map
4
4
  //# sourceMappingURL=generators.js.map
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkT7FDN353_cjs = require('./chunk-T7FDN353.cjs');
3
+ var chunkQUDUSXV4_cjs = require('./chunk-QUDUSXV4.cjs');
4
4
  var chunkZHLF4MXY_cjs = require('./chunk-ZHLF4MXY.cjs');
5
5
  var path = require('path');
6
6
  var core = require('@kubb/core');
@@ -27,7 +27,7 @@ var pluginReactQuery = core.createPlugin((options) => {
27
27
  transformers: transformers$1 = {},
28
28
  paramsType = "inline",
29
29
  pathParamsType = "inline",
30
- generators = [chunkT7FDN353_cjs.queryGenerator, chunkT7FDN353_cjs.suspenseQueryGenerator, chunkT7FDN353_cjs.infiniteQueryGenerator, chunkT7FDN353_cjs.mutationGenerator].filter(Boolean),
30
+ generators = [chunkQUDUSXV4_cjs.queryGenerator, chunkQUDUSXV4_cjs.suspenseQueryGenerator, chunkQUDUSXV4_cjs.infiniteQueryGenerator, chunkQUDUSXV4_cjs.mutationGenerator].filter(Boolean),
31
31
  mutation = {},
32
32
  query = {},
33
33
  mutationKey = chunkZHLF4MXY_cjs.MutationKey.getTransformer,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginReactQuery } from './types-DbdPn2MA.cjs';
2
+ import { O as Options, P as PluginReactQuery } from './types-18y-1Kmu.cjs';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-oas';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginReactQuery } from './types-DbdPn2MA.js';
2
+ import { O as Options, P as PluginReactQuery } from './types-18y-1Kmu.js';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-oas';
5
5
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { queryGenerator, suspenseQueryGenerator, infiniteQueryGenerator, mutationGenerator } from './chunk-WNZYQKVV.js';
1
+ import { queryGenerator, suspenseQueryGenerator, infiniteQueryGenerator, mutationGenerator } from './chunk-2UDCBM34.js';
2
2
  import { MutationKey, QueryKey } from './chunk-5J7D6D3Z.js';
3
3
  import path from 'node:path';
4
4
  import { createPlugin, FileManager, PluginManager } from '@kubb/core';
@@ -1,5 +1,5 @@
1
1
  import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
- import { Operation, HttpMethod } from '@kubb/oas';
2
+ import { Oas, Operation, HttpMethod } from '@kubb/oas';
3
3
  import { ResolvePathOptions, Exclude, Include, Override, Generator, OperationSchemas } from '@kubb/plugin-oas';
4
4
 
5
5
  type Options$1 = {
@@ -7,7 +7,7 @@ type Options$1 = {
7
7
  * Specify the export location for the files and define the behavior of the output
8
8
  * @default { path: 'clients', barrelType: 'named' }
9
9
  */
10
- output?: Output;
10
+ output?: Output<Oas>;
11
11
  /**
12
12
  * Group the clients based on the provided name.
13
13
  */
@@ -91,7 +91,7 @@ type Options$1 = {
91
91
  generators?: Array<Generator<PluginClient>>;
92
92
  };
93
93
  type ResolvedOptions$1 = {
94
- output: Output;
94
+ output: Output<Oas>;
95
95
  group?: Options$1['group'];
96
96
  baseURL: string | undefined;
97
97
  parser: NonNullable<Options$1['parser']>;
@@ -169,7 +169,7 @@ type Options = {
169
169
  * Specify the export location for the files and define the behavior of the output
170
170
  * @default { path: 'hooks', barrelType: 'named' }
171
171
  */
172
- output?: Output;
172
+ output?: Output<Oas>;
173
173
  /**
174
174
  * Group the @tanstack/query hooks based on the provided name.
175
175
  */
@@ -241,7 +241,7 @@ type Options = {
241
241
  generators?: Array<Generator<PluginReactQuery>>;
242
242
  };
243
243
  type ResolvedOptions = {
244
- output: Output;
244
+ output: Output<Oas>;
245
245
  group: Options['group'];
246
246
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
247
247
  baseURL?: string;
@@ -1,5 +1,5 @@
1
1
  import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
- import { Operation, HttpMethod } from '@kubb/oas';
2
+ import { Oas, Operation, HttpMethod } from '@kubb/oas';
3
3
  import { ResolvePathOptions, Exclude, Include, Override, Generator, OperationSchemas } from '@kubb/plugin-oas';
4
4
 
5
5
  type Options$1 = {
@@ -7,7 +7,7 @@ type Options$1 = {
7
7
  * Specify the export location for the files and define the behavior of the output
8
8
  * @default { path: 'clients', barrelType: 'named' }
9
9
  */
10
- output?: Output;
10
+ output?: Output<Oas>;
11
11
  /**
12
12
  * Group the clients based on the provided name.
13
13
  */
@@ -91,7 +91,7 @@ type Options$1 = {
91
91
  generators?: Array<Generator<PluginClient>>;
92
92
  };
93
93
  type ResolvedOptions$1 = {
94
- output: Output;
94
+ output: Output<Oas>;
95
95
  group?: Options$1['group'];
96
96
  baseURL: string | undefined;
97
97
  parser: NonNullable<Options$1['parser']>;
@@ -169,7 +169,7 @@ type Options = {
169
169
  * Specify the export location for the files and define the behavior of the output
170
170
  * @default { path: 'hooks', barrelType: 'named' }
171
171
  */
172
- output?: Output;
172
+ output?: Output<Oas>;
173
173
  /**
174
174
  * Group the @tanstack/query hooks based on the provided name.
175
175
  */
@@ -241,7 +241,7 @@ type Options = {
241
241
  generators?: Array<Generator<PluginReactQuery>>;
242
242
  };
243
243
  type ResolvedOptions = {
244
- output: Output;
244
+ output: Output<Oas>;
245
245
  group: Options['group'];
246
246
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
247
247
  baseURL?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-react-query",
3
- "version": "3.4.5",
3
+ "version": "3.5.0",
4
4
  "description": "Generator react-query hooks",
5
5
  "keywords": [
6
6
  "faker",
@@ -63,21 +63,21 @@
63
63
  ],
64
64
  "dependencies": {
65
65
  "remeda": "^2.19.0",
66
- "@kubb/core": "3.4.5",
67
- "@kubb/fs": "3.4.5",
68
- "@kubb/plugin-oas": "3.4.5",
69
- "@kubb/oas": "3.4.5",
70
- "@kubb/plugin-ts": "3.4.5",
71
- "@kubb/plugin-zod": "3.4.5",
72
- "@kubb/react": "3.4.5"
66
+ "@kubb/core": "3.5.0",
67
+ "@kubb/fs": "3.5.0",
68
+ "@kubb/oas": "3.5.0",
69
+ "@kubb/plugin-oas": "3.5.0",
70
+ "@kubb/plugin-ts": "3.5.0",
71
+ "@kubb/plugin-zod": "3.5.0",
72
+ "@kubb/react": "3.5.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/react": "^18.3.18",
76
76
  "react": "^18.3.1",
77
77
  "tsup": "^8.3.5",
78
78
  "typescript": "^5.7.3",
79
- "@kubb/config-ts": "3.4.5",
80
- "@kubb/config-tsup": "3.4.5"
79
+ "@kubb/config-ts": "3.5.0",
80
+ "@kubb/config-tsup": "3.5.0"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "@kubb/react": "^3.0.0"
@@ -1,6 +1,7 @@
1
1
  import { Client } from '@kubb/plugin-client/components'
2
2
  import { createReactGenerator } from '@kubb/plugin-oas'
3
- import { useOperationManager } from '@kubb/plugin-oas/hooks'
3
+ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
4
+ import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
4
5
  import { pluginTsName } from '@kubb/plugin-ts'
5
6
  import { pluginZodName } from '@kubb/plugin-zod'
6
7
  import { File, useApp } from '@kubb/react'
@@ -16,6 +17,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginReactQuery>({
16
17
  options: { output },
17
18
  },
18
19
  } = useApp<PluginReactQuery>()
20
+ const oas = useOas()
19
21
  const { getSchemas, getName, getFile } = useOperationManager()
20
22
 
21
23
  const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)
@@ -61,7 +63,13 @@ export const infiniteQueryGenerator = createReactGenerator<PluginReactQuery>({
61
63
  }
62
64
 
63
65
  return (
64
- <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>
66
+ <File
67
+ baseName={query.file.baseName}
68
+ path={query.file.path}
69
+ meta={query.file.meta}
70
+ banner={getBanner({ oas, output })}
71
+ footer={getFooter({ oas, output })}
72
+ >
65
73
  {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}
66
74
  <File.Import name={'client'} path={options.client.importPath} />
67
75
  <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
@@ -1,6 +1,7 @@
1
1
  import { Client } from '@kubb/plugin-client/components'
2
2
  import { createReactGenerator } from '@kubb/plugin-oas'
3
- import { useOperationManager } from '@kubb/plugin-oas/hooks'
3
+ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
4
+ import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
4
5
  import { pluginTsName } from '@kubb/plugin-ts'
5
6
  import { pluginZodName } from '@kubb/plugin-zod'
6
7
  import { File, useApp } from '@kubb/react'
@@ -16,6 +17,7 @@ export const mutationGenerator = createReactGenerator<PluginReactQuery>({
16
17
  options: { output },
17
18
  },
18
19
  } = useApp<PluginReactQuery>()
20
+ const oas = useOas()
19
21
  const { getSchemas, getName, getFile } = useOperationManager()
20
22
 
21
23
  const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)
@@ -56,7 +58,13 @@ export const mutationGenerator = createReactGenerator<PluginReactQuery>({
56
58
  }
57
59
 
58
60
  return (
59
- <File baseName={mutation.file.baseName} path={mutation.file.path} meta={mutation.file.meta} banner={output?.banner} footer={output?.footer}>
61
+ <File
62
+ baseName={mutation.file.baseName}
63
+ path={mutation.file.path}
64
+ meta={mutation.file.meta}
65
+ banner={getBanner({ oas, output })}
66
+ footer={getFooter({ oas, output })}
67
+ >
60
68
  {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={mutation.file.path} path={zod.file.path} />}
61
69
  <File.Import name={'client'} path={options.client.importPath} />
62
70
  <File.Import name={['RequestConfig', 'ResponseConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
@@ -1,6 +1,7 @@
1
1
  import { Client } from '@kubb/plugin-client/components'
2
2
  import { createReactGenerator } from '@kubb/plugin-oas'
3
- import { useOperationManager } from '@kubb/plugin-oas/hooks'
3
+ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
4
+ import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
4
5
  import { pluginTsName } from '@kubb/plugin-ts'
5
6
  import { pluginZodName } from '@kubb/plugin-zod'
6
7
  import { File, useApp } from '@kubb/react'
@@ -16,6 +17,7 @@ export const queryGenerator = createReactGenerator<PluginReactQuery>({
16
17
  options: { output },
17
18
  },
18
19
  } = useApp<PluginReactQuery>()
20
+ const oas = useOas()
19
21
  const { getSchemas, getName, getFile } = useOperationManager()
20
22
 
21
23
  const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)
@@ -61,7 +63,13 @@ export const queryGenerator = createReactGenerator<PluginReactQuery>({
61
63
  }
62
64
 
63
65
  return (
64
- <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>
66
+ <File
67
+ baseName={query.file.baseName}
68
+ path={query.file.path}
69
+ meta={query.file.meta}
70
+ banner={getBanner({ oas, output })}
71
+ footer={getFooter({ oas, output })}
72
+ >
65
73
  {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}
66
74
  <File.Import name={'client'} path={options.client.importPath} />
67
75
  <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
@@ -1,7 +1,8 @@
1
1
  import { pluginClientName } from '@kubb/plugin-client'
2
2
  import { Client } from '@kubb/plugin-client/components'
3
3
  import { createReactGenerator } from '@kubb/plugin-oas'
4
- import { useOperationManager } from '@kubb/plugin-oas/hooks'
4
+ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
5
+ import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
5
6
  import { pluginTsName } from '@kubb/plugin-ts'
6
7
  import { pluginZodName } from '@kubb/plugin-zod'
7
8
  import { File, useApp } from '@kubb/react'
@@ -17,6 +18,7 @@ export const suspenseQueryGenerator = createReactGenerator<PluginReactQuery>({
17
18
  options: { output },
18
19
  },
19
20
  } = useApp<PluginReactQuery>()
21
+ const oas = useOas()
20
22
  const { getSchemas, getName, getFile } = useOperationManager()
21
23
 
22
24
  const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)
@@ -63,7 +65,13 @@ export const suspenseQueryGenerator = createReactGenerator<PluginReactQuery>({
63
65
  }
64
66
 
65
67
  return (
66
- <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>
68
+ <File
69
+ baseName={query.file.baseName}
70
+ path={query.file.path}
71
+ meta={query.file.meta}
72
+ banner={getBanner({ oas, output })}
73
+ footer={getFooter({ oas, output })}
74
+ >
67
75
  {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}
68
76
  <File.Import name={'client'} path={options.client.importPath} />
69
77
  <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
package/src/types.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
2
 
3
- import type { HttpMethod, Operation } from '@kubb/oas'
3
+ import type { HttpMethod, Oas, Operation } from '@kubb/oas'
4
4
  import type { PluginClient } from '@kubb/plugin-client'
5
5
  import type { Exclude, Generator, Include, OperationSchemas, Override, ResolvePathOptions } from '@kubb/plugin-oas'
6
6
 
@@ -78,7 +78,7 @@ export type Options = {
78
78
  * Specify the export location for the files and define the behavior of the output
79
79
  * @default { path: 'hooks', barrelType: 'named' }
80
80
  */
81
- output?: Output
81
+ output?: Output<Oas>
82
82
  /**
83
83
  * Group the @tanstack/query hooks based on the provided name.
84
84
  */
@@ -153,7 +153,7 @@ export type Options = {
153
153
  }
154
154
 
155
155
  type ResolvedOptions = {
156
- output: Output
156
+ output: Output<Oas>
157
157
  group: Options['group']
158
158
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & { baseURL?: string }
159
159
  parser: Required<NonNullable<Options['parser']>>