@kubb/plugin-solid-query 3.3.5 → 3.4.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.
- package/dist/{chunk-DPOIDUZD.js → chunk-2S6OAY7A.js} +4 -4
- package/dist/chunk-2S6OAY7A.js.map +1 -0
- package/dist/{chunk-BX4WR76J.js → chunk-6GYHRQ43.js} +53 -22
- package/dist/chunk-6GYHRQ43.js.map +1 -0
- package/dist/{chunk-XQNDC64Y.cjs → chunk-7B6MOH7D.cjs} +53 -22
- package/dist/chunk-7B6MOH7D.cjs.map +1 -0
- package/dist/{chunk-JOFIK6QT.cjs → chunk-YYSQGXZJ.cjs} +8 -8
- package/dist/chunk-YYSQGXZJ.cjs.map +1 -0
- package/dist/components.cjs +4 -4
- package/dist/components.js +1 -1
- package/dist/generators.cjs +3 -3
- package/dist/generators.js +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.js +2 -2
- package/package.json +10 -10
- package/src/components/Query.tsx +5 -3
- package/src/components/QueryOptions.tsx +1 -1
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +10 -5
- package/src/generators/__snapshots__/clientGetImportPath.ts +5 -5
- package/src/generators/__snapshots__/findByTags.ts +5 -5
- package/src/generators/__snapshots__/findByTagsObject.ts +5 -5
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +5 -5
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +5 -5
- package/src/generators/__snapshots__/findByTagsWithZod.ts +5 -5
- package/src/generators/__snapshots__/postAsQuery.ts +5 -5
- package/src/generators/queryGenerator.tsx +1 -1
- package/dist/chunk-BX4WR76J.js.map +0 -1
- package/dist/chunk-DPOIDUZD.js.map +0 -1
- package/dist/chunk-JOFIK6QT.cjs.map +0 -1
- package/dist/chunk-XQNDC64Y.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generators/queryGenerator.tsx"],"names":["createReactGenerator","useApp","use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Q,CAAA,YAAA;AAAA,UACtB,YAAY,OAAQ,CAAA,UAAA;AAAA,UACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,UACxB,cAAA,EAAgB,QAAQ,MAAO,CAAA;AAAA;AAAA,OACjC;AAAA,MACC,OAAA,CAAQ,yBAELC,eAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAACL,cAAA,CAAAD,UAAA,CAAK,QAAL,EAAY,IAAA,EAAM,CAAC,aAAa,CAAA,EAAG,MAAM,UAAY,EAAA,CAAA;AAAA,wBACrDC,cAAA,CAAAD,UAAA,CAAK,MAAL,EAAA,EAAY,IAAM,EAAA,CAAC,UAAY,EAAA,wBAAA,EAA0B,mBAAmB,CAAA,EAAG,IAAM,EAAA,UAAA,EAAY,YAAU,IAAC,EAAA,CAAA;AAAA,wBAC7GC,cAAA;AAAA,UAACM,uBAAA;AAAA,UAAA;AAAA,YACC,MAAM,KAAM,CAAA,IAAA;AAAA,YACZ,kBAAkB,YAAa,CAAA,IAAA;AAAA,YAC/B,aAAa,IAAK,CAAA,OAAA;AAAA,YAClB,YAAY,OAAQ,CAAA,UAAA;AAAA,YACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,YACxB,SAAA;AAAA,YACA,cAAc,OAAQ,CAAA,YAAA;AAAA,YACtB,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,YAC/B,cAAc,QAAS,CAAA,IAAA;AAAA,YACvB,kBAAkB,QAAS,CAAA;AAAA;AAAA;AAC7B,OACF,EAAA;AAAA,KAEJ,EAAA,CAAA;AAAA;AAGN,CAAC","file":"chunk-YYSQGXZJ.cjs","sourcesContent":["import { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSolidQuery>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(['post', 'put', 'delete', 'patch'], options.query ? options.query.methods : []).some((method) => operation.method === method)\n const importPath = options.query ? options.query.importPath : '@tanstack/solid-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n />\n {options.query && (\n <>\n <File.Import name={['createQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"]}
|
package/dist/components.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7B6MOH7D_cjs = require('./chunk-7B6MOH7D.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Query", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk7B6MOH7D_cjs.Query; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "QueryKey", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk7B6MOH7D_cjs.QueryKey; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "QueryOptions", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk7B6MOH7D_cjs.QueryOptions; }
|
|
18
18
|
});
|
|
19
19
|
//# sourceMappingURL=components.cjs.map
|
|
20
20
|
//# sourceMappingURL=components.cjs.map
|
package/dist/components.js
CHANGED
package/dist/generators.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkYYSQGXZJ_cjs = require('./chunk-YYSQGXZJ.cjs');
|
|
4
|
+
require('./chunk-7B6MOH7D.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "queryGenerator", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkYYSQGXZJ_cjs.queryGenerator; }
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=generators.cjs.map
|
|
13
13
|
//# sourceMappingURL=generators.cjs.map
|
package/dist/generators.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkYYSQGXZJ_cjs = require('./chunk-YYSQGXZJ.cjs');
|
|
4
|
+
var chunk7B6MOH7D_cjs = require('./chunk-7B6MOH7D.cjs');
|
|
5
5
|
var path = require('path');
|
|
6
6
|
var core = require('@kubb/core');
|
|
7
7
|
var transformers = require('@kubb/core/transformers');
|
|
@@ -25,8 +25,8 @@ var pluginSolidQuery = core.createPlugin((options) => {
|
|
|
25
25
|
transformers: transformers$1 = {},
|
|
26
26
|
paramsType = "inline",
|
|
27
27
|
pathParamsType = "inline",
|
|
28
|
-
queryKey =
|
|
29
|
-
generators = [
|
|
28
|
+
queryKey = chunk7B6MOH7D_cjs.QueryKey.getTransformer,
|
|
29
|
+
generators = [chunkYYSQGXZJ_cjs.queryGenerator].filter(Boolean),
|
|
30
30
|
query = {},
|
|
31
31
|
paramsCasing
|
|
32
32
|
} = options;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { queryGenerator } from './chunk-
|
|
2
|
-
import { QueryKey } from './chunk-
|
|
1
|
+
import { queryGenerator } from './chunk-2S6OAY7A.js';
|
|
2
|
+
import { QueryKey } from './chunk-6GYHRQ43.js';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { createPlugin, FileManager, PluginManager } from '@kubb/core';
|
|
5
5
|
import { camelCase, pascalCase } from '@kubb/core/transformers';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-solid-query",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Generator solid-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.
|
|
67
|
-
"@kubb/fs": "3.
|
|
68
|
-
"@kubb/oas": "3.
|
|
69
|
-
"@kubb/plugin-oas": "3.
|
|
70
|
-
"@kubb/plugin-ts": "3.
|
|
71
|
-
"@kubb/plugin-zod": "3.
|
|
72
|
-
"@kubb/react": "3.
|
|
66
|
+
"@kubb/core": "3.4.0",
|
|
67
|
+
"@kubb/fs": "3.4.0",
|
|
68
|
+
"@kubb/oas": "3.4.0",
|
|
69
|
+
"@kubb/plugin-oas": "3.4.0",
|
|
70
|
+
"@kubb/plugin-ts": "3.4.0",
|
|
71
|
+
"@kubb/plugin-zod": "3.4.0",
|
|
72
|
+
"@kubb/react": "3.4.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.2",
|
|
79
|
-
"@kubb/config-ts": "3.
|
|
80
|
-
"@kubb/config-tsup": "3.
|
|
79
|
+
"@kubb/config-ts": "3.4.0",
|
|
80
|
+
"@kubb/config-tsup": "3.4.0"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"@kubb/react": "^3.0.0"
|
package/src/components/Query.tsx
CHANGED
|
@@ -34,6 +34,7 @@ type GetParamsProps = {
|
|
|
34
34
|
|
|
35
35
|
function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
|
|
36
36
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
37
|
+
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
37
38
|
|
|
38
39
|
if (paramsType === 'object') {
|
|
39
40
|
return FunctionParams.factory({
|
|
@@ -64,7 +65,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, t
|
|
|
64
65
|
options: {
|
|
65
66
|
type: `
|
|
66
67
|
{
|
|
67
|
-
query?: Partial<CreateBaseQueryOptions<${[TData,
|
|
68
|
+
query?: Partial<CreateBaseQueryOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>,
|
|
68
69
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'}
|
|
69
70
|
}
|
|
70
71
|
`,
|
|
@@ -102,7 +103,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, t
|
|
|
102
103
|
options: {
|
|
103
104
|
type: `
|
|
104
105
|
{
|
|
105
|
-
query?: Partial<CreateBaseQueryOptions<${[TData,
|
|
106
|
+
query?: Partial<CreateBaseQueryOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>,
|
|
106
107
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'}
|
|
107
108
|
}
|
|
108
109
|
`,
|
|
@@ -124,7 +125,8 @@ export function Query({
|
|
|
124
125
|
operation,
|
|
125
126
|
}: Props): ReactNode {
|
|
126
127
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
127
|
-
const
|
|
128
|
+
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
129
|
+
const returnType = `CreateQueryResult<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`
|
|
128
130
|
const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]
|
|
129
131
|
|
|
130
132
|
const queryKeyParams = QueryKey.getParams({
|
|
@@ -96,7 +96,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: Ge
|
|
|
96
96
|
|
|
97
97
|
export function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType, dataReturnType, pathParamsType, queryKeyName }: Props): ReactNode {
|
|
98
98
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
99
|
-
const TError = typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'
|
|
99
|
+
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
100
100
|
|
|
101
101
|
const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })
|
|
102
102
|
const clientParams = Client.getParams({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
|
-
import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios'
|
|
2
|
+
import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
3
|
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
|
|
4
4
|
import { queryOptions, createQuery } from '@tanstack/svelte-query'
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
13
13
|
* {@link /pet/findByTags}
|
|
14
14
|
*/
|
|
15
15
|
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
17
17
|
method: 'GET',
|
|
18
18
|
url: `/pet/findByTags`,
|
|
19
19
|
params,
|
|
@@ -25,7 +25,12 @@ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: Find
|
|
|
25
25
|
|
|
26
26
|
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
27
27
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
28
|
-
return queryOptions<
|
|
28
|
+
return queryOptions<
|
|
29
|
+
ResponseConfig<FindPetsByTagsQueryResponse>,
|
|
30
|
+
ResponseErrorConfig<FindPetsByTags400>,
|
|
31
|
+
ResponseConfig<FindPetsByTagsQueryResponse>,
|
|
32
|
+
typeof queryKey
|
|
33
|
+
>({
|
|
29
34
|
queryKey,
|
|
30
35
|
queryFn: async ({ signal }) => {
|
|
31
36
|
config.signal = signal
|
|
@@ -47,7 +52,7 @@ export function createFindPetsByTags<
|
|
|
47
52
|
headers: FindPetsByTagsHeaderParams,
|
|
48
53
|
params?: FindPetsByTagsQueryParams,
|
|
49
54
|
options: {
|
|
50
|
-
query?: Partial<CreateBaseQueryOptions<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400
|
|
55
|
+
query?: Partial<CreateBaseQueryOptions<ResponseConfig<FindPetsByTagsQueryResponse>, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
51
56
|
client?: Partial<RequestConfig>
|
|
52
57
|
} = {},
|
|
53
58
|
) {
|
|
@@ -59,7 +64,7 @@ export function createFindPetsByTags<
|
|
|
59
64
|
queryKey,
|
|
60
65
|
initialData: null,
|
|
61
66
|
...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
|
|
62
|
-
})) as CreateQueryResult<TData, FindPetsByTags400
|
|
67
|
+
})) as CreateQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
63
68
|
|
|
64
69
|
query.queryKey = queryKey as TQueryKey
|
|
65
70
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from 'axios'
|
|
2
2
|
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
|
|
3
|
-
import type { RequestConfig } from 'axios'
|
|
3
|
+
import type { RequestConfig, ResponseErrorConfig } from 'axios'
|
|
4
4
|
import { queryOptions, createQuery } from '@tanstack/svelte-query'
|
|
5
5
|
|
|
6
6
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -13,7 +13,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
13
13
|
* {@link /pet/findByTags}
|
|
14
14
|
*/
|
|
15
15
|
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
17
17
|
method: 'GET',
|
|
18
18
|
url: `/pet/findByTags`,
|
|
19
19
|
params,
|
|
@@ -25,7 +25,7 @@ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: Find
|
|
|
25
25
|
|
|
26
26
|
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
27
27
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
28
|
-
return queryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
28
|
+
return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
|
|
29
29
|
queryKey,
|
|
30
30
|
queryFn: async ({ signal }) => {
|
|
31
31
|
config.signal = signal
|
|
@@ -47,7 +47,7 @@ export function createFindPetsByTags<
|
|
|
47
47
|
headers: FindPetsByTagsHeaderParams,
|
|
48
48
|
params?: FindPetsByTagsQueryParams,
|
|
49
49
|
options: {
|
|
50
|
-
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
50
|
+
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
51
51
|
client?: Partial<RequestConfig>
|
|
52
52
|
} = {},
|
|
53
53
|
) {
|
|
@@ -59,7 +59,7 @@ export function createFindPetsByTags<
|
|
|
59
59
|
queryKey,
|
|
60
60
|
initialData: null,
|
|
61
61
|
...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
|
|
62
|
-
})) as CreateQueryResult<TData, FindPetsByTags400
|
|
62
|
+
})) as CreateQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
63
63
|
|
|
64
64
|
query.queryKey = queryKey as TQueryKey
|
|
65
65
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
2
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
3
|
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
|
|
4
4
|
import { queryOptions, createQuery } from '@tanstack/svelte-query'
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
13
13
|
* {@link /pet/findByTags}
|
|
14
14
|
*/
|
|
15
15
|
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
17
17
|
method: 'GET',
|
|
18
18
|
url: `/pet/findByTags`,
|
|
19
19
|
params,
|
|
@@ -25,7 +25,7 @@ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: Find
|
|
|
25
25
|
|
|
26
26
|
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
27
27
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
28
|
-
return queryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
28
|
+
return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
|
|
29
29
|
queryKey,
|
|
30
30
|
queryFn: async ({ signal }) => {
|
|
31
31
|
config.signal = signal
|
|
@@ -47,7 +47,7 @@ export function createFindPetsByTags<
|
|
|
47
47
|
headers: FindPetsByTagsHeaderParams,
|
|
48
48
|
params?: FindPetsByTagsQueryParams,
|
|
49
49
|
options: {
|
|
50
|
-
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
50
|
+
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
51
51
|
client?: Partial<RequestConfig>
|
|
52
52
|
} = {},
|
|
53
53
|
) {
|
|
@@ -59,7 +59,7 @@ export function createFindPetsByTags<
|
|
|
59
59
|
queryKey,
|
|
60
60
|
initialData: null,
|
|
61
61
|
...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
|
|
62
|
-
})) as CreateQueryResult<TData, FindPetsByTags400
|
|
62
|
+
})) as CreateQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
63
63
|
|
|
64
64
|
query.queryKey = queryKey as TQueryKey
|
|
65
65
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
2
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
3
|
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
|
|
4
4
|
import { queryOptions, createQuery } from '@tanstack/svelte-query'
|
|
5
5
|
|
|
@@ -16,7 +16,7 @@ async function findPetsByTags(
|
|
|
16
16
|
{ headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
|
|
17
17
|
config: Partial<RequestConfig> = {},
|
|
18
18
|
) {
|
|
19
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
19
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
20
20
|
method: 'GET',
|
|
21
21
|
url: `/pet/findByTags`,
|
|
22
22
|
params,
|
|
@@ -31,7 +31,7 @@ export function findPetsByTagsQueryOptions(
|
|
|
31
31
|
config: Partial<RequestConfig> = {},
|
|
32
32
|
) {
|
|
33
33
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
34
|
-
return queryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
34
|
+
return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
|
|
35
35
|
queryKey,
|
|
36
36
|
queryFn: async ({ signal }) => {
|
|
37
37
|
config.signal = signal
|
|
@@ -52,7 +52,7 @@ export function createFindPetsByTags<
|
|
|
52
52
|
>(
|
|
53
53
|
{ headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
|
|
54
54
|
options: {
|
|
55
|
-
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
55
|
+
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
56
56
|
client?: Partial<RequestConfig>
|
|
57
57
|
} = {},
|
|
58
58
|
) {
|
|
@@ -64,7 +64,7 @@ export function createFindPetsByTags<
|
|
|
64
64
|
queryKey,
|
|
65
65
|
initialData: null,
|
|
66
66
|
...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
|
|
67
|
-
})) as CreateQueryResult<TData, FindPetsByTags400
|
|
67
|
+
})) as CreateQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
68
68
|
|
|
69
69
|
query.queryKey = queryKey as TQueryKey
|
|
70
70
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
2
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
3
|
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
|
|
4
4
|
import { queryOptions, createQuery } from '@tanstack/svelte-query'
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
13
13
|
* {@link /pet/findByTags}
|
|
14
14
|
*/
|
|
15
15
|
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
17
17
|
method: 'GET',
|
|
18
18
|
url: `/pet/findByTags`,
|
|
19
19
|
params,
|
|
@@ -25,7 +25,7 @@ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: Find
|
|
|
25
25
|
|
|
26
26
|
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
27
27
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
28
|
-
return queryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
28
|
+
return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
|
|
29
29
|
queryKey,
|
|
30
30
|
queryFn: async ({ signal }) => {
|
|
31
31
|
config.signal = signal
|
|
@@ -47,7 +47,7 @@ export function createFindPetsByTags<
|
|
|
47
47
|
headers: FindPetsByTagsHeaderParams,
|
|
48
48
|
params?: FindPetsByTagsQueryParams,
|
|
49
49
|
options: {
|
|
50
|
-
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
50
|
+
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
51
51
|
client?: Partial<RequestConfig>
|
|
52
52
|
} = {},
|
|
53
53
|
) {
|
|
@@ -59,7 +59,7 @@ export function createFindPetsByTags<
|
|
|
59
59
|
queryKey,
|
|
60
60
|
initialData: null,
|
|
61
61
|
...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
|
|
62
|
-
})) as CreateQueryResult<TData, FindPetsByTags400
|
|
62
|
+
})) as CreateQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
63
63
|
|
|
64
64
|
query.queryKey = queryKey as TQueryKey
|
|
65
65
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
2
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
3
|
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/react-query'
|
|
4
4
|
import { queryOptions, createQuery } from '@tanstack/react-query'
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
13
13
|
* {@link /pet/findByTags}
|
|
14
14
|
*/
|
|
15
15
|
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
17
17
|
method: 'GET',
|
|
18
18
|
url: `/pet/findByTags`,
|
|
19
19
|
params,
|
|
@@ -25,7 +25,7 @@ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: Find
|
|
|
25
25
|
|
|
26
26
|
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
27
27
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
28
|
-
return queryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
28
|
+
return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
|
|
29
29
|
queryKey,
|
|
30
30
|
queryFn: async ({ signal }) => {
|
|
31
31
|
config.signal = signal
|
|
@@ -47,7 +47,7 @@ export function createFindPetsByTags<
|
|
|
47
47
|
headers: FindPetsByTagsHeaderParams,
|
|
48
48
|
params?: FindPetsByTagsQueryParams,
|
|
49
49
|
options: {
|
|
50
|
-
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
50
|
+
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
51
51
|
client?: Partial<RequestConfig>
|
|
52
52
|
} = {},
|
|
53
53
|
) {
|
|
@@ -59,7 +59,7 @@ export function createFindPetsByTags<
|
|
|
59
59
|
queryKey,
|
|
60
60
|
initialData: null,
|
|
61
61
|
...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
|
|
62
|
-
})) as CreateQueryResult<TData, FindPetsByTags400
|
|
62
|
+
})) as CreateQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
63
63
|
|
|
64
64
|
query.queryKey = queryKey as TQueryKey
|
|
65
65
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
2
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
3
|
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
|
|
4
4
|
import { queryOptions, createQuery } from '@tanstack/svelte-query'
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
13
13
|
* {@link /pet/findByTags}
|
|
14
14
|
*/
|
|
15
15
|
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
17
17
|
method: 'GET',
|
|
18
18
|
url: `/pet/findByTags`,
|
|
19
19
|
params,
|
|
@@ -25,7 +25,7 @@ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: Find
|
|
|
25
25
|
|
|
26
26
|
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
27
27
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
28
|
-
return queryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
28
|
+
return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
|
|
29
29
|
queryKey,
|
|
30
30
|
queryFn: async ({ signal }) => {
|
|
31
31
|
config.signal = signal
|
|
@@ -47,7 +47,7 @@ export function createFindPetsByTags<
|
|
|
47
47
|
headers: FindPetsByTagsHeaderParams,
|
|
48
48
|
params?: FindPetsByTagsQueryParams,
|
|
49
49
|
options: {
|
|
50
|
-
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
50
|
+
query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
51
51
|
client?: Partial<RequestConfig>
|
|
52
52
|
} = {},
|
|
53
53
|
) {
|
|
@@ -59,7 +59,7 @@ export function createFindPetsByTags<
|
|
|
59
59
|
queryKey,
|
|
60
60
|
initialData: null,
|
|
61
61
|
...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
|
|
62
|
-
})) as CreateQueryResult<TData, FindPetsByTags400
|
|
62
|
+
})) as CreateQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
63
63
|
|
|
64
64
|
query.queryKey = queryKey as TQueryKey
|
|
65
65
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
2
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
3
|
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from 'custom-query'
|
|
4
4
|
import { queryOptions, createQuery } from 'custom-query'
|
|
5
5
|
|
|
@@ -21,7 +21,7 @@ async function updatePetWithForm(
|
|
|
21
21
|
params?: UpdatePetWithFormQueryParams,
|
|
22
22
|
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
|
|
23
23
|
) {
|
|
24
|
-
const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
24
|
+
const res = await client<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
|
|
25
25
|
method: 'POST',
|
|
26
26
|
url: `/pet/${petId}`,
|
|
27
27
|
params,
|
|
@@ -38,7 +38,7 @@ export function updatePetWithFormQueryOptions(
|
|
|
38
38
|
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
|
|
39
39
|
) {
|
|
40
40
|
const queryKey = updatePetWithFormQueryKey(petId, data, params)
|
|
41
|
-
return queryOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
41
|
+
return queryOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationResponse, typeof queryKey>({
|
|
42
42
|
enabled: !!petId,
|
|
43
43
|
queryKey,
|
|
44
44
|
queryFn: async ({ signal }) => {
|
|
@@ -61,7 +61,7 @@ export function createUpdatePetWithForm<
|
|
|
61
61
|
data?: UpdatePetWithFormMutationRequest,
|
|
62
62
|
params?: UpdatePetWithFormQueryParams,
|
|
63
63
|
options: {
|
|
64
|
-
query?: Partial<CreateBaseQueryOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
64
|
+
query?: Partial<CreateBaseQueryOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, TData, TQueryData, TQueryKey>>
|
|
65
65
|
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>
|
|
66
66
|
} = {},
|
|
67
67
|
) {
|
|
@@ -73,7 +73,7 @@ export function createUpdatePetWithForm<
|
|
|
73
73
|
queryKey,
|
|
74
74
|
initialData: null,
|
|
75
75
|
...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
|
|
76
|
-
})) as CreateQueryResult<TData, UpdatePetWithForm405
|
|
76
|
+
})) as CreateQueryResult<TData, ResponseErrorConfig<UpdatePetWithForm405>> & { queryKey: TQueryKey }
|
|
77
77
|
|
|
78
78
|
query.queryKey = queryKey as TQueryKey
|
|
79
79
|
|
|
@@ -60,7 +60,7 @@ export const queryGenerator = createReactGenerator<PluginSolidQuery>({
|
|
|
60
60
|
<File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>
|
|
61
61
|
{options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}
|
|
62
62
|
<File.Import name={'client'} path={options.client.importPath} />
|
|
63
|
-
<File.Import name={['RequestConfig']} path={options.client.importPath} isTypeOnly />
|
|
63
|
+
<File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
64
64
|
{options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}
|
|
65
65
|
<File.Import
|
|
66
66
|
name={[
|