@kubb/plugin-solid-query 3.10.10 → 3.10.11
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-P7PP4SS2.js → chunk-6MS45DTW.js} +10 -196
- package/dist/chunk-6MS45DTW.js.map +1 -0
- package/dist/chunk-DX7FN4CR.cjs +161 -0
- package/dist/chunk-DX7FN4CR.cjs.map +1 -0
- package/dist/chunk-EBY2GJUJ.js +159 -0
- package/dist/chunk-EBY2GJUJ.js.map +1 -0
- package/dist/{chunk-NUP5RKX7.cjs → chunk-J4MF3435.cjs} +18 -207
- package/dist/chunk-J4MF3435.cjs.map +1 -0
- package/dist/components.cjs +4 -4
- package/dist/components.d.cts +2 -1
- package/dist/components.d.ts +2 -1
- package/dist/components.js +1 -1
- package/dist/generators.cjs +3 -3
- package/dist/generators.d.cts +2 -1
- package/dist/generators.d.ts +2 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/types-Cx6RgBxP.d.cts +114 -0
- package/dist/types-Cx6RgBxP.d.ts +114 -0
- package/package.json +11 -10
- package/src/types.ts +2 -3
- package/dist/chunk-HBJIQLPC.cjs +0 -447
- package/dist/chunk-HBJIQLPC.cjs.map +0 -1
- package/dist/chunk-NUP5RKX7.cjs.map +0 -1
- package/dist/chunk-P7PP4SS2.js.map +0 -1
- package/dist/chunk-SE5LBLVZ.js +0 -441
- package/dist/chunk-SE5LBLVZ.js.map +0 -1
- package/dist/types-6ZuUeFA7.d.cts +0 -391
- package/dist/types-6ZuUeFA7.d.ts +0 -391
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generators/queryGenerator.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAYO,IAAM,iBAAiB,oBAAuC,CAAA;AAAA,EACnE,IAAM,EAAA,cAAA;AAAA,EACN,SAAU,CAAA,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BAC/B,aAAa,IAAK,CAAA,OAAA;AAAA,gBAClB,YAAY,OAAQ,CAAA,UAAA;AAAA,gBACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,gBACxB,SAAA;AAAA,gBACA,cAAc,OAAQ,CAAA,YAAA;AAAA,gBACtB,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,gBAC/B,cAAc,QAAS,CAAA,IAAA;AAAA,gBACvB,kBAAkB,QAAS,CAAA;AAAA;AAAA;AAC7B,WACF,EAAA;AAAA;AAAA;AAAA,KAEJ;AAAA;AAGN,CAAC","file":"chunk-EBY2GJUJ.js","sourcesContent":["import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\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 pluginManager,\n } = useApp<PluginSolidQuery>()\n const oas = useOas()\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 hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n const client = {\n name: hasClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginKey: [pluginClientName],\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\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\n baseName={query.file.baseName}\n path={query.file.path}\n meta={query.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={query.file.path} path={zod.file.path} />\n )}\n <File.Import name={'client'} path={options.client.importPath} />\n {!!hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\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 {!hasClientPlugin && (\n <Client\n name={client.name}\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 )}\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', 'QueryClient', '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"]}
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
var react = require('@kubb/react');
|
|
4
4
|
var oas = require('@kubb/oas');
|
|
5
|
-
var utils
|
|
6
|
-
var utils = require('@kubb/core/utils');
|
|
5
|
+
var utils = require('@kubb/plugin-oas/utils');
|
|
6
|
+
var utils$1 = require('@kubb/core/utils');
|
|
7
7
|
var jsxRuntime = require('@kubb/react/jsx-runtime');
|
|
8
|
+
var components = require('@kubb/plugin-client/components');
|
|
8
9
|
|
|
9
10
|
// src/components/Query.tsx
|
|
10
11
|
function getParams({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
11
12
|
return react.FunctionParams.factory({
|
|
12
13
|
pathParams: {
|
|
13
14
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
14
|
-
children: utils
|
|
15
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing })
|
|
15
16
|
},
|
|
16
17
|
data: typeSchemas.request?.name ? {
|
|
17
18
|
type: typeSchemas.request?.name,
|
|
@@ -24,7 +25,7 @@ function getParams({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
var getTransformer = ({ operation, schemas, casing }) => {
|
|
27
|
-
const path = new utils.URLPath(operation.path, { casing });
|
|
28
|
+
const path = new utils$1.URLPath(operation.path, { casing });
|
|
28
29
|
const keys = [
|
|
29
30
|
path.toObject({
|
|
30
31
|
type: "path",
|
|
@@ -55,194 +56,7 @@ function getParams2({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
55
56
|
data: {
|
|
56
57
|
mode: "object",
|
|
57
58
|
children: {
|
|
58
|
-
...utils
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
return react.FunctionParams.factory({
|
|
64
|
-
pathParams: typeSchemas.pathParams?.name ? {
|
|
65
|
-
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
66
|
-
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
67
|
-
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
68
|
-
} : void 0
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function Url({ name, isExportable = true, isIndexable = true, typeSchemas, baseURL, paramsType, paramsCasing, pathParamsType, operation }) {
|
|
72
|
-
const path = new utils.URLPath(operation.path, { casing: paramsCasing });
|
|
73
|
-
const params = getParams2({ paramsType, paramsCasing, pathParamsType, typeSchemas });
|
|
74
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable, isIndexable, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function, { name, export: isExportable, params: params.toConstructor(), children: `return ${path.toTemplateString({ prefix: baseURL })} as const` }) });
|
|
75
|
-
}
|
|
76
|
-
Url.getParams = getParams2;
|
|
77
|
-
function getParams3({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable }) {
|
|
78
|
-
if (paramsType === "object") {
|
|
79
|
-
return react.FunctionParams.factory({
|
|
80
|
-
data: {
|
|
81
|
-
mode: "object",
|
|
82
|
-
children: {
|
|
83
|
-
...utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
84
|
-
data: typeSchemas.request?.name ? {
|
|
85
|
-
type: typeSchemas.request?.name,
|
|
86
|
-
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
87
|
-
} : void 0,
|
|
88
|
-
params: typeSchemas.queryParams?.name ? {
|
|
89
|
-
type: typeSchemas.queryParams?.name,
|
|
90
|
-
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
91
|
-
} : void 0,
|
|
92
|
-
headers: typeSchemas.headerParams?.name ? {
|
|
93
|
-
type: typeSchemas.headerParams?.name,
|
|
94
|
-
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
95
|
-
} : void 0
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
config: isConfigurable ? {
|
|
99
|
-
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
100
|
-
default: "{}"
|
|
101
|
-
} : void 0
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
return react.FunctionParams.factory({
|
|
105
|
-
pathParams: typeSchemas.pathParams?.name ? {
|
|
106
|
-
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
107
|
-
children: utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
108
|
-
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
109
|
-
} : void 0,
|
|
110
|
-
data: typeSchemas.request?.name ? {
|
|
111
|
-
type: typeSchemas.request?.name,
|
|
112
|
-
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
113
|
-
} : void 0,
|
|
114
|
-
params: typeSchemas.queryParams?.name ? {
|
|
115
|
-
type: typeSchemas.queryParams?.name,
|
|
116
|
-
optional: oas.isOptional(typeSchemas.queryParams?.schema)
|
|
117
|
-
} : void 0,
|
|
118
|
-
headers: typeSchemas.headerParams?.name ? {
|
|
119
|
-
type: typeSchemas.headerParams?.name,
|
|
120
|
-
optional: oas.isOptional(typeSchemas.headerParams?.schema)
|
|
121
|
-
} : void 0,
|
|
122
|
-
config: isConfigurable ? {
|
|
123
|
-
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
|
|
124
|
-
default: "{}"
|
|
125
|
-
} : void 0
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function Client({
|
|
129
|
-
name,
|
|
130
|
-
isExportable = true,
|
|
131
|
-
isIndexable = true,
|
|
132
|
-
returnType,
|
|
133
|
-
typeSchemas,
|
|
134
|
-
baseURL,
|
|
135
|
-
dataReturnType,
|
|
136
|
-
parser,
|
|
137
|
-
zodSchemas,
|
|
138
|
-
paramsType,
|
|
139
|
-
paramsCasing,
|
|
140
|
-
pathParamsType,
|
|
141
|
-
operation,
|
|
142
|
-
urlName,
|
|
143
|
-
children,
|
|
144
|
-
isConfigurable = true
|
|
145
|
-
}) {
|
|
146
|
-
const path = new utils.URLPath(operation.path, { casing: paramsCasing });
|
|
147
|
-
const contentType = operation.getContentType();
|
|
148
|
-
const isFormData = contentType === "multipart/form-data";
|
|
149
|
-
const headers = [
|
|
150
|
-
contentType !== "application/json" ? `'Content-Type': '${contentType}'` : void 0,
|
|
151
|
-
typeSchemas.headerParams?.name ? "...headers" : void 0
|
|
152
|
-
].filter(Boolean);
|
|
153
|
-
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
154
|
-
const generics = [typeSchemas.response.name, TError, typeSchemas.request?.name || "unknown"].filter(Boolean);
|
|
155
|
-
const params = getParams3({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable });
|
|
156
|
-
const urlParams = Url.getParams({
|
|
157
|
-
paramsType,
|
|
158
|
-
paramsCasing,
|
|
159
|
-
pathParamsType,
|
|
160
|
-
typeSchemas
|
|
161
|
-
});
|
|
162
|
-
const clientParams = react.FunctionParams.factory({
|
|
163
|
-
config: {
|
|
164
|
-
mode: "object",
|
|
165
|
-
children: {
|
|
166
|
-
method: {
|
|
167
|
-
value: JSON.stringify(operation.method.toUpperCase())
|
|
168
|
-
},
|
|
169
|
-
url: {
|
|
170
|
-
value: urlName ? `${urlName}(${urlParams.toCall()}).toString()` : path.template
|
|
171
|
-
},
|
|
172
|
-
baseURL: baseURL && !urlName ? {
|
|
173
|
-
value: JSON.stringify(baseURL)
|
|
174
|
-
} : void 0,
|
|
175
|
-
params: typeSchemas.queryParams?.name ? {} : void 0,
|
|
176
|
-
data: typeSchemas.request?.name ? {
|
|
177
|
-
value: parser === "zod" && zodSchemas ? `${zodSchemas.request?.name}.parse(${isFormData ? "formData" : "data"})` : isFormData ? "formData" : void 0
|
|
178
|
-
} : void 0,
|
|
179
|
-
requestConfig: isConfigurable ? {
|
|
180
|
-
mode: "inlineSpread"
|
|
181
|
-
} : void 0,
|
|
182
|
-
headers: headers.length ? {
|
|
183
|
-
value: isConfigurable ? `{ ${headers.join(", ")}, ...requestConfig.headers }` : `{ ${headers.join(", ")} }`
|
|
184
|
-
} : void 0
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
const formData = isFormData ? `
|
|
189
|
-
const formData = new FormData()
|
|
190
|
-
if(data) {
|
|
191
|
-
Object.keys(data).forEach((key) => {
|
|
192
|
-
const value = data[key as keyof typeof data];
|
|
193
|
-
if (typeof key === "string" && (typeof value === "string" || (value as Blob) instanceof Blob)) {
|
|
194
|
-
formData.append(key, value as unknown as string);
|
|
195
|
-
}
|
|
196
|
-
})
|
|
197
|
-
}
|
|
198
|
-
` : "";
|
|
199
|
-
const childrenElement = children ? children : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
200
|
-
dataReturnType === "full" && parser === "zod" && zodSchemas && `return {...res, data: ${zodSchemas.response.name}.parse(res.data)}`,
|
|
201
|
-
dataReturnType === "data" && parser === "zod" && zodSchemas && `return ${zodSchemas.response.name}.parse(res.data)`,
|
|
202
|
-
dataReturnType === "full" && parser === "client" && "return res",
|
|
203
|
-
dataReturnType === "data" && parser === "client" && "return res.data"
|
|
204
|
-
] });
|
|
205
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable, isIndexable, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
206
|
-
react.Function,
|
|
207
|
-
{
|
|
208
|
-
name,
|
|
209
|
-
async: true,
|
|
210
|
-
export: isExportable,
|
|
211
|
-
params: params.toConstructor(),
|
|
212
|
-
JSDoc: {
|
|
213
|
-
comments: utils$1.getComments(operation)
|
|
214
|
-
},
|
|
215
|
-
returnType,
|
|
216
|
-
children: [
|
|
217
|
-
isConfigurable ? "const { client:request = client, ...requestConfig } = config" : "",
|
|
218
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
219
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
220
|
-
formData,
|
|
221
|
-
isConfigurable ? `const res = await request<${generics.join(", ")}>(${clientParams.toCall()})` : `const res = await client<${generics.join(", ")}>(${clientParams.toCall()})`,
|
|
222
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
223
|
-
childrenElement
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
) });
|
|
227
|
-
}
|
|
228
|
-
Client.getParams = getParams3;
|
|
229
|
-
function Operations({ name, operations }) {
|
|
230
|
-
const operationsObject = {};
|
|
231
|
-
operations.forEach((operation) => {
|
|
232
|
-
operationsObject[operation.getOperationId()] = {
|
|
233
|
-
path: new utils.URLPath(operation.path).URL,
|
|
234
|
-
method: operation.method
|
|
235
|
-
};
|
|
236
|
-
});
|
|
237
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Const, { name, export: true, asConst: true, children: JSON.stringify(operationsObject, void 0, 2) }) });
|
|
238
|
-
}
|
|
239
|
-
function getParams4({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
240
|
-
if (paramsType === "object") {
|
|
241
|
-
return react.FunctionParams.factory({
|
|
242
|
-
data: {
|
|
243
|
-
mode: "object",
|
|
244
|
-
children: {
|
|
245
|
-
...utils$1.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
59
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
246
60
|
data: typeSchemas.request?.name ? {
|
|
247
61
|
type: typeSchemas.request?.name,
|
|
248
62
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -266,7 +80,7 @@ function getParams4({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
266
80
|
return react.FunctionParams.factory({
|
|
267
81
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
268
82
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
269
|
-
children: utils
|
|
83
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
270
84
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
271
85
|
} : void 0,
|
|
272
86
|
data: typeSchemas.request?.name ? {
|
|
@@ -290,8 +104,8 @@ function getParams4({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
|
290
104
|
function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType, dataReturnType, pathParamsType, queryKeyName }) {
|
|
291
105
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
292
106
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
293
|
-
const params =
|
|
294
|
-
const clientParams = Client.getParams({
|
|
107
|
+
const params = getParams2({ paramsType, paramsCasing, pathParamsType, typeSchemas });
|
|
108
|
+
const clientParams = components.Client.getParams({
|
|
295
109
|
paramsCasing,
|
|
296
110
|
typeSchemas,
|
|
297
111
|
paramsType,
|
|
@@ -317,8 +131,8 @@ function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType,
|
|
|
317
131
|
})
|
|
318
132
|
` }) });
|
|
319
133
|
}
|
|
320
|
-
QueryOptions.getParams =
|
|
321
|
-
function
|
|
134
|
+
QueryOptions.getParams = getParams2;
|
|
135
|
+
function getParams3({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }) {
|
|
322
136
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
323
137
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
|
|
324
138
|
if (paramsType === "object") {
|
|
@@ -326,7 +140,7 @@ function getParams5({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
326
140
|
data: {
|
|
327
141
|
mode: "object",
|
|
328
142
|
children: {
|
|
329
|
-
...utils
|
|
143
|
+
...utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
330
144
|
data: typeSchemas.request?.name ? {
|
|
331
145
|
type: typeSchemas.request?.name,
|
|
332
146
|
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
@@ -355,7 +169,7 @@ function getParams5({ paramsType, paramsCasing, pathParamsType, dataReturnType,
|
|
|
355
169
|
return react.FunctionParams.factory({
|
|
356
170
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
357
171
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
358
|
-
children: utils
|
|
172
|
+
children: utils.getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
359
173
|
optional: oas.isOptional(typeSchemas.pathParams?.schema)
|
|
360
174
|
} : void 0,
|
|
361
175
|
data: typeSchemas.request?.name ? {
|
|
@@ -408,7 +222,7 @@ function Query({
|
|
|
408
222
|
pathParamsType,
|
|
409
223
|
typeSchemas
|
|
410
224
|
});
|
|
411
|
-
const params =
|
|
225
|
+
const params = getParams3({
|
|
412
226
|
paramsCasing,
|
|
413
227
|
paramsType,
|
|
414
228
|
pathParamsType,
|
|
@@ -424,7 +238,7 @@ function Query({
|
|
|
424
238
|
generics: generics.join(", "),
|
|
425
239
|
params: params.toConstructor(),
|
|
426
240
|
JSDoc: {
|
|
427
|
-
comments: utils
|
|
241
|
+
comments: utils.getComments(operation)
|
|
428
242
|
},
|
|
429
243
|
children: `
|
|
430
244
|
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
@@ -444,13 +258,10 @@ function Query({
|
|
|
444
258
|
}
|
|
445
259
|
) });
|
|
446
260
|
}
|
|
447
|
-
Query.getParams =
|
|
261
|
+
Query.getParams = getParams3;
|
|
448
262
|
|
|
449
|
-
exports.Client = Client;
|
|
450
|
-
exports.Operations = Operations;
|
|
451
263
|
exports.Query = Query;
|
|
452
264
|
exports.QueryKey = QueryKey;
|
|
453
265
|
exports.QueryOptions = QueryOptions;
|
|
454
|
-
|
|
455
|
-
//# sourceMappingURL=chunk-
|
|
456
|
-
//# sourceMappingURL=chunk-NUP5RKX7.cjs.map
|
|
266
|
+
//# sourceMappingURL=chunk-J4MF3435.cjs.map
|
|
267
|
+
//# sourceMappingURL=chunk-J4MF3435.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/QueryKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx"],"names":["FunctionParams","getPathParams","isOptional","URLPath","jsxs","Fragment","jsx","File","Function","Type","getParams","Client","getComments"],"mappings":";;;;;;;;;;AAyBA,SAAS,SAAU,CAAA,EA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aAAc,EAAA;AAAA,MAC7B,KAAO,EAAA;AAAA,QACL,QAAA,EAAUI,kBAAY,SAAS;AAAA,OACjC;AAAA,MAEC,QAAA,EAAA;AAAA;AAAA,kDAAA,EAE2C,YAAY,CAAA,CAAA,EAAI,cAAe,CAAA,MAAA,EAAQ,CAAA;;AAAA;AAAA,WAAA,EAG9E,YAAY,CAAA;AAAA;AAAA;AAAA;AAAA,yDAAA,EAIkC,UAAU;;AAAA;;AAAA;AAAA,OAAA;AAAA;AAAA,GAOjE,EAAA,CAAA;AAEJ;AAEA,KAAA,CAAM,SAAYF,GAAAA,UAAAA","file":"chunk-J4MF3435.cjs","sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams, Type } from '@kubb/react'\n\nimport { type Operation, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport type { ReactNode } from 'react'\nimport type { PluginSolidQuery, Transformer } from '../types'\n\ntype Props = {\n name: string\n typeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n transformer: Transformer | undefined\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ pathParamsType, paramsCasing, typeSchemas }: GetParamsProps) {\n return FunctionParams.factory({\n pathParams: {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n },\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n })\n}\n\nconst getTransformer: Transformer = ({ operation, schemas, casing }) => {\n const path = new URLPath(operation.path, { casing })\n const keys = [\n path.toObject({\n type: 'path',\n stringify: true,\n }),\n schemas.queryParams?.name ? '...(params ? [params] : [])' : undefined,\n schemas.request?.name ? '...(data ? [data] : [])' : undefined,\n ].filter(Boolean)\n\n return keys\n}\n\nexport function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props): ReactNode {\n const params = getParams({ pathParamsType, paramsCasing, typeSchemas })\n const keys = transformer({\n operation,\n schemas: typeSchemas,\n casing: paramsCasing,\n })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={params.toConstructor()} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type name={typeName} export>\n {`ReturnType<typeof ${name}>`}\n </Type>\n </File.Source>\n </>\n )\n}\n\nQueryKey.getParams = getParams\nQueryKey.getTransformer = getTransformer\n","import { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react'\n\nimport type { ReactNode } from 'react'\n\nimport { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport type { PluginSolidQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\n\ntype Props = {\n name: string\n clientName: string\n queryKeyName: string\n typeSchemas: OperationSchemas\n paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginSolidQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginSolidQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }`\n : 'Partial<RequestConfig> & { client?: typeof client }',\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }`\n : 'Partial<RequestConfig> & { client?: typeof client }',\n default: '{}',\n },\n })\n}\n\nexport function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType, dataReturnType, pathParamsType, queryKeyName }: Props): ReactNode {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n\n const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })\n const clientParams = Client.getParams({\n paramsCasing,\n typeSchemas,\n paramsType,\n pathParamsType,\n isConfigurable: true,\n })\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n paramsCasing,\n typeSchemas,\n })\n\n const enabled = Object.entries(queryKeyParams.flatParams)\n .map(([key, item]) => (item && !item.optional ? key : undefined))\n .filter(Boolean)\n .join('&& ')\n\n const enabledText = enabled ? `enabled: !!(${enabled}),` : ''\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})\n return queryOptions<${TData}, ${TError}, ${TData}, typeof queryKey>({\n ${enabledText}\n queryKey,\n queryFn: async ({ signal }) => {\n config.signal = signal\n return ${clientName}(${clientParams.toCall()})\n },\n })\n`}\n </Function>\n </File.Source>\n )\n}\n\nQueryOptions.getParams = getParams\n","import { File, Function, FunctionParams } from '@kubb/react'\n\nimport { type Operation, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport type { ReactNode } from 'react'\nimport type { PluginSolidQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\nimport { QueryOptions } from './QueryOptions.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginSolidQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginSolidQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n options: {\n type: `\n{\n query?: Partial<CreateBaseQueryOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : 'Partial<RequestConfig> & { client?: typeof client }'}\n}\n`,\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: `\n{\n query?: Partial<CreateBaseQueryOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : 'Partial<RequestConfig> & { client?: typeof client }'}\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function Query({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n}: Props): ReactNode {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const returnType = `CreateQueryResult<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`\n const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]\n\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const queryOptionsParams = QueryOptions.getParams({\n paramsType,\n paramsCasing,\n pathParamsType,\n typeSchemas,\n })\n const params = getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n })\n\n const queryOptions = `${queryOptionsName}(${queryOptionsParams.toCall()}) as unknown as CreateBaseQueryOptions`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={generics.join(', ')}\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n >\n {`\n const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}\n const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})\n\n const query = createQuery(() => ({\n ...${queryOptions},\n queryKey,\n initialData: null,\n ...queryOptions as unknown as Omit<CreateBaseQueryOptions, \"queryKey\">\n }), queryClient? () => queryClient: undefined) as ${returnType}\n\n query.queryKey = queryKey as TQueryKey\n\n return query\n `}\n </Function>\n </File.Source>\n )\n}\n\nQuery.getParams = getParams\n"]}
|
package/dist/components.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJ4MF3435_cjs = require('./chunk-J4MF3435.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 chunkJ4MF3435_cjs.Query; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "QueryKey", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkJ4MF3435_cjs.QueryKey; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "QueryOptions", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkJ4MF3435_cjs.QueryOptions; }
|
|
18
18
|
});
|
|
19
19
|
//# sourceMappingURL=components.cjs.map
|
|
20
20
|
//# sourceMappingURL=components.cjs.map
|
package/dist/components.d.cts
CHANGED
|
@@ -2,8 +2,9 @@ import { FunctionParams } from '@kubb/react';
|
|
|
2
2
|
import { Operation } from '@kubb/oas';
|
|
3
3
|
import { OperationSchemas } from '@kubb/plugin-oas';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
|
-
import { P as PluginSolidQuery, T as Transformer } from './types-
|
|
5
|
+
import { P as PluginSolidQuery, T as Transformer } from './types-Cx6RgBxP.cjs';
|
|
6
6
|
import '@kubb/core';
|
|
7
|
+
import '@kubb/plugin-client';
|
|
7
8
|
|
|
8
9
|
type Props$2 = {
|
|
9
10
|
/**
|
package/dist/components.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { FunctionParams } from '@kubb/react';
|
|
|
2
2
|
import { Operation } from '@kubb/oas';
|
|
3
3
|
import { OperationSchemas } from '@kubb/plugin-oas';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
|
-
import { P as PluginSolidQuery, T as Transformer } from './types-
|
|
5
|
+
import { P as PluginSolidQuery, T as Transformer } from './types-Cx6RgBxP.js';
|
|
6
6
|
import '@kubb/core';
|
|
7
|
+
import '@kubb/plugin-client';
|
|
7
8
|
|
|
8
9
|
type Props$2 = {
|
|
9
10
|
/**
|
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 chunkDX7FN4CR_cjs = require('./chunk-DX7FN4CR.cjs');
|
|
4
|
+
require('./chunk-J4MF3435.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 chunkDX7FN4CR_cjs.queryGenerator; }
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=generators.cjs.map
|
|
13
13
|
//# sourceMappingURL=generators.cjs.map
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as _kubb_plugin_oas from '@kubb/plugin-oas';
|
|
2
|
-
import { P as PluginSolidQuery } from './types-
|
|
2
|
+
import { P as PluginSolidQuery } from './types-Cx6RgBxP.cjs';
|
|
3
3
|
import '@kubb/core';
|
|
4
4
|
import '@kubb/oas';
|
|
5
|
+
import '@kubb/plugin-client';
|
|
5
6
|
|
|
6
7
|
declare const queryGenerator: _kubb_plugin_oas.Generator<PluginSolidQuery>;
|
|
7
8
|
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as _kubb_plugin_oas from '@kubb/plugin-oas';
|
|
2
|
-
import { P as PluginSolidQuery } from './types-
|
|
2
|
+
import { P as PluginSolidQuery } from './types-Cx6RgBxP.js';
|
|
3
3
|
import '@kubb/core';
|
|
4
4
|
import '@kubb/oas';
|
|
5
|
+
import '@kubb/plugin-client';
|
|
5
6
|
|
|
6
7
|
declare const queryGenerator: _kubb_plugin_oas.Generator<PluginSolidQuery>;
|
|
7
8
|
|
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 chunkDX7FN4CR_cjs = require('./chunk-DX7FN4CR.cjs');
|
|
4
|
+
var chunkJ4MF3435_cjs = require('./chunk-J4MF3435.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 = paramsType === "object" ? "object" : options.pathParamsType || "inline",
|
|
28
|
-
queryKey =
|
|
29
|
-
generators = [
|
|
28
|
+
queryKey = chunkJ4MF3435_cjs.QueryKey.getTransformer,
|
|
29
|
+
generators = [chunkDX7FN4CR_cjs.queryGenerator].filter(Boolean),
|
|
30
30
|
query = {},
|
|
31
31
|
paramsCasing,
|
|
32
32
|
contentType
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _kubb_core from '@kubb/core';
|
|
2
|
-
import { O as Options, P as PluginSolidQuery } from './types-
|
|
2
|
+
import { O as Options, P as PluginSolidQuery } from './types-Cx6RgBxP.cjs';
|
|
3
3
|
import '@kubb/oas';
|
|
4
|
+
import '@kubb/plugin-client';
|
|
4
5
|
import '@kubb/plugin-oas';
|
|
5
6
|
|
|
6
7
|
declare const pluginSolidQueryName = "plugin-solid-query";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _kubb_core from '@kubb/core';
|
|
2
|
-
import { O as Options, P as PluginSolidQuery } from './types-
|
|
2
|
+
import { O as Options, P as PluginSolidQuery } from './types-Cx6RgBxP.js';
|
|
3
3
|
import '@kubb/oas';
|
|
4
|
+
import '@kubb/plugin-client';
|
|
4
5
|
import '@kubb/plugin-oas';
|
|
5
6
|
|
|
6
7
|
declare const pluginSolidQueryName = "plugin-solid-query";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { queryGenerator } from './chunk-
|
|
2
|
-
import { QueryKey } from './chunk-
|
|
1
|
+
import { queryGenerator } from './chunk-EBY2GJUJ.js';
|
|
2
|
+
import { QueryKey } from './chunk-6MS45DTW.js';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { createPlugin, PluginManager, FileManager } from '@kubb/core';
|
|
5
5
|
import { camelCase, pascalCase } from '@kubb/core/transformers';
|