@kubb/plugin-solid-query 4.5.7 → 4.5.8
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/{components-Bb34jFcx.cjs → components-C6vYkQe6.cjs} +2 -2
- package/dist/{components-Bb34jFcx.cjs.map → components-C6vYkQe6.cjs.map} +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/{generators-D8jwI0av.js → generators-C3nwRyGg.js} +9 -9
- package/dist/generators-C3nwRyGg.js.map +1 -0
- package/dist/{generators--pucLXpq.cjs → generators-SSdobNNF.cjs} +10 -10
- package/dist/generators-SSdobNNF.cjs.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +18 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -10
- package/dist/index.js.map +1 -1
- package/dist/{types-r1q7JBAb.d.ts → types-CMszTHJ4.d.cts} +16 -2
- package/dist/{types-DDIFoSr3.d.cts → types-Cl30wqOy.d.ts} +16 -2
- package/package.json +7 -7
- package/src/generators/mutationGenerator.tsx +3 -3
- package/src/generators/queryGenerator.tsx +11 -10
- package/src/plugin.ts +17 -9
- package/src/types.ts +7 -0
- package/dist/generators--pucLXpq.cjs.map +0 -1
- package/dist/generators-D8jwI0av.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_generators = require('./generators
|
|
1
|
+
const require_generators = require('./generators-SSdobNNF.cjs');
|
|
2
2
|
let __kubb_core_utils = require("@kubb/core/utils");
|
|
3
3
|
let __kubb_oas = require("@kubb/oas");
|
|
4
4
|
let __kubb_plugin_client_components = require("@kubb/plugin-client/components");
|
|
@@ -507,4 +507,4 @@ Object.defineProperty(exports, 'QueryOptions', {
|
|
|
507
507
|
return QueryOptions;
|
|
508
508
|
}
|
|
509
509
|
});
|
|
510
|
-
//# sourceMappingURL=components-
|
|
510
|
+
//# sourceMappingURL=components-C6vYkQe6.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-Bb34jFcx.cjs","names":["getParams","FunctionParams","getTransformer: Transformer","URLPath","getTransformer","File","Function","Type","getParams","FunctionParams","Client","File","Function","getParams","FunctionParams","getTransformer: Transformer","URLPath","File","Function","Type","getParams","FunctionParams","Client","File","Function","FunctionParams","File","Function"],"sources":["../src/components/MutationKey.tsx","../src/components/Mutation.tsx","../src/components/QueryKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\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 pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({}: GetParamsProps) {\n return FunctionParams.factory({})\n}\n\nconst getTransformer: Transformer = ({ operation, casing }) => {\n const path = new URLPath(operation.path, { casing })\n\n return [`{ url: '${path.toURLPath()}' }`]\n}\n\nexport function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operation, typeName, transformer = getTransformer }: Props): KubbNode {\n const params = getParams({ pathParamsType, typeSchemas })\n const keys = transformer({ operation, schemas: typeSchemas, casing: paramsCasing })\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\nMutationKey.getParams = getParams\nMutationKey.getTransformer = getTransformer\n","import { isOptional, type Operation } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode, Params } from '@kubb/react-fabric/types'\nimport type { PluginSolidQuery } from '../types.ts'\nimport { MutationKey } from './MutationKey.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n clientName: string\n mutationKeyName: string\n typeSchemas: OperationSchemas\n operation: Operation\n dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType']\n paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginSolidQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsCasing, dataReturnType, typeSchemas }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const mutationParams = FunctionParams.factory({\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 const TRequest = mutationParams.toConstructor()\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const generics = [TData, TError, TRequest ? `{${TRequest}}` : 'void', 'TContext'].join(', ')\n\n return FunctionParams.factory({\n options: {\n type: `\n{\n mutation?: ReturnType<UseMutationOptions<${generics}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'},\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function Mutation({\n name,\n clientName,\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n mutationKeyName,\n}: Props): KubbNode {\n const mutationKeyParams = MutationKey.getParams({\n pathParamsType,\n typeSchemas,\n })\n\n const params = getParams({\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n })\n\n const clientParams = Client.getParams({\n paramsCasing,\n paramsType,\n typeSchemas,\n pathParamsType,\n isConfigurable: true,\n })\n\n const mutationParams = FunctionParams.factory({\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 const dataParams = FunctionParams.factory({\n data: {\n // No use of pathParams because useMutation can only take one argument in object form,\n // see https://tanstack.com/query/latest/docs/framework/react/reference/useMutation#usemutation\n mode: 'object',\n children: Object.entries(mutationParams.params).reduce((acc, [key, value]) => {\n if (value) {\n acc[key] = {\n ...value,\n type: undefined,\n }\n }\n\n return acc\n }, {} as Params),\n },\n })\n\n const TRequest = mutationParams.toConstructor()\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 generics = [TData, TError, TRequest ? `{${TRequest}}` : 'void', 'TContext'].join(', ')\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n generics={['TContext']}\n >\n {`\n const { mutation = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...mutationOptions } = mutation;\n const mutationKey = mutationOptions.mutationKey ?? ${mutationKeyName}(${mutationKeyParams.toCall()})\n\n return useMutation<${generics}>(()=> ({\n mutationFn: async(${dataParams.toConstructor()}) => {\n return ${clientName}(${clientParams.toCall()})\n },\n mutationKey,\n ...mutationOptions\n }), queryClient? () => queryClient: undefined)\n `}\n </Function>\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\nimport { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\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): KubbNode {\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 { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\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 fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\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 fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n}\n\nexport function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType, dataReturnType, pathParamsType, queryKeyName }: Props): KubbNode {\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 { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\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<UseBaseQueryOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\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<UseBaseQueryOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\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): KubbNode {\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 = `UseQueryResult<${['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 UseBaseQueryOptions`\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: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...queryOptions } = queryConfig\n const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})\n\n const query = useQuery(() => ({\n ...${queryOptions},\n queryKey,\n initialData: null,\n ...queryOptions as unknown as Omit<UseBaseQueryOptions, \"queryKey\">\n }), queryClient? () => queryClient: undefined) as ${returnType}\n\n return query\n `}\n </Function>\n </File.Source>\n )\n}\n\nQuery.getParams = getParams\n"],"mappings":";;;;;;;;;AAsBA,SAASA,YAAU,IAAoB;AACrC,QAAOC,mCAAe,QAAQ,EAAE,CAAC;;AAGnC,MAAMC,oBAA+B,EAAE,WAAW,aAAa;AAG7D,QAAO,CAAC,WAFK,IAAIC,0BAAQ,UAAU,MAAM,EAAE,QAAQ,CAAC,CAE5B,WAAW,CAAC,KAAK;;AAG3C,SAAgB,YAAY,EAAE,MAAM,aAAa,gBAAgB,cAAc,WAAW,UAAU,cAAcC,oBAAmC;CACnJ,MAAM,SAASJ,YAAU;EAAE;EAAgB;EAAa,CAAC;CACzD,MAAM,OAAO,YAAY;EAAE;EAAW,SAAS;EAAa,QAAQ;EAAc,CAAC;AAEnF,QACE,iHACE,yDAACK,yBAAK;EAAa;EAAM;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,CAAC;aAC1F,YAAY,SAAS,OAAO,yBAAyB,YAAY,SAAS,KAAK,kCAAkC,qDAAqD;;;GAG7K,SAAS;GACV;EACF,CAAC;;AAGJ,SAAgB,MAAM,EACpB,MACA,kBACA,kBACA,cACA,cACA,YACA,gBACA,gBACA,aACA,aACkB;CAClB,MAAM,QAAQ,mBAAmB,SAAS,YAAY,SAAS,OAAO,kBAAkB,YAAY,SAAS,KAAK;CAElH,MAAM,aAAa,kBAAkB,CAAC,SADvB,uBAAuB,YAAY,QAAQ,KAAK,SAAS,KAAK,KAAK,CAAC,KAAK,MAAM,IAAI,QAAQ,GACpD,CAAC,KAAK,KAAK,CAAC;CAClE,MAAM,WAAW;EAAC,WAAW;EAAS,gBAAgB;EAAS,gCAAgC;EAAmB;CAElH,MAAM,iBAAiB,SAAS,UAAU;EACxC;EACA;EACA;EACD,CAAC;CACF,MAAM,qBAAqB,aAAa,UAAU;EAChD;EACA;EACA;EACA;EACD,CAAC;CACF,MAAM,SAAS,UAAU;EACvB;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,eAAe,GAAG,iBAAiB,GAAG,mBAAmB,QAAQ,CAAC;AAExE,QACE,yDAACC,yBAAK;EAAa;EAAM;EAAa;YACpC,yDAACC;GACO;GACN;GACA,UAAU,SAAS,KAAK,KAAK;GAC7B,QAAQ,OAAO,eAAe;GAC9B,OAAO,EACL,mDAAsB,UAAU,EACjC;aAEA;;;oDAG2C,aAAa,GAAG,eAAe,QAAQ,CAAC;;;aAG/E,aAAa;;;;2DAIiC,WAAW;;;;IAIrD;GACC;;AAIlB,MAAM,YAAY"}
|
|
1
|
+
{"version":3,"file":"components-C6vYkQe6.cjs","names":["getParams","FunctionParams","getTransformer: Transformer","URLPath","getTransformer","File","Function","Type","getParams","FunctionParams","Client","File","Function","getParams","FunctionParams","getTransformer: Transformer","URLPath","File","Function","Type","getParams","FunctionParams","Client","File","Function","FunctionParams","File","Function"],"sources":["../src/components/MutationKey.tsx","../src/components/Mutation.tsx","../src/components/QueryKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\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 pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({}: GetParamsProps) {\n return FunctionParams.factory({})\n}\n\nconst getTransformer: Transformer = ({ operation, casing }) => {\n const path = new URLPath(operation.path, { casing })\n\n return [`{ url: '${path.toURLPath()}' }`]\n}\n\nexport function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operation, typeName, transformer = getTransformer }: Props): KubbNode {\n const params = getParams({ pathParamsType, typeSchemas })\n const keys = transformer({ operation, schemas: typeSchemas, casing: paramsCasing })\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\nMutationKey.getParams = getParams\nMutationKey.getTransformer = getTransformer\n","import { isOptional, type Operation } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode, Params } from '@kubb/react-fabric/types'\nimport type { PluginSolidQuery } from '../types.ts'\nimport { MutationKey } from './MutationKey.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n clientName: string\n mutationKeyName: string\n typeSchemas: OperationSchemas\n operation: Operation\n dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType']\n paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginSolidQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsCasing, dataReturnType, typeSchemas }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const mutationParams = FunctionParams.factory({\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 const TRequest = mutationParams.toConstructor()\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const generics = [TData, TError, TRequest ? `{${TRequest}}` : 'void', 'TContext'].join(', ')\n\n return FunctionParams.factory({\n options: {\n type: `\n{\n mutation?: ReturnType<UseMutationOptions<${generics}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'},\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function Mutation({\n name,\n clientName,\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n mutationKeyName,\n}: Props): KubbNode {\n const mutationKeyParams = MutationKey.getParams({\n pathParamsType,\n typeSchemas,\n })\n\n const params = getParams({\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n })\n\n const clientParams = Client.getParams({\n paramsCasing,\n paramsType,\n typeSchemas,\n pathParamsType,\n isConfigurable: true,\n })\n\n const mutationParams = FunctionParams.factory({\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 const dataParams = FunctionParams.factory({\n data: {\n // No use of pathParams because useMutation can only take one argument in object form,\n // see https://tanstack.com/query/latest/docs/framework/react/reference/useMutation#usemutation\n mode: 'object',\n children: Object.entries(mutationParams.params).reduce((acc, [key, value]) => {\n if (value) {\n acc[key] = {\n ...value,\n type: undefined,\n }\n }\n\n return acc\n }, {} as Params),\n },\n })\n\n const TRequest = mutationParams.toConstructor()\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 generics = [TData, TError, TRequest ? `{${TRequest}}` : 'void', 'TContext'].join(', ')\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n generics={['TContext']}\n >\n {`\n const { mutation = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...mutationOptions } = mutation;\n const mutationKey = mutationOptions.mutationKey ?? ${mutationKeyName}(${mutationKeyParams.toCall()})\n\n return useMutation<${generics}>(()=> ({\n mutationFn: async(${dataParams.toConstructor()}) => {\n return ${clientName}(${clientParams.toCall()})\n },\n mutationKey,\n ...mutationOptions\n }), queryClient? () => queryClient: undefined)\n `}\n </Function>\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\nimport { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\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): KubbNode {\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 { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\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 fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\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 fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n}\n\nexport function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType, dataReturnType, pathParamsType, queryKeyName }: Props): KubbNode {\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 { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\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<UseBaseQueryOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\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<UseBaseQueryOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\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): KubbNode {\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 = `UseQueryResult<${['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 UseBaseQueryOptions`\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: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...queryOptions } = queryConfig\n const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})\n\n const query = useQuery(() => ({\n ...${queryOptions},\n queryKey,\n initialData: null,\n ...queryOptions as unknown as Omit<UseBaseQueryOptions, \"queryKey\">\n }), queryClient? () => queryClient: undefined) as ${returnType}\n\n return query\n `}\n </Function>\n </File.Source>\n )\n}\n\nQuery.getParams = getParams\n"],"mappings":";;;;;;;;;AAsBA,SAASA,YAAU,IAAoB;AACrC,QAAOC,mCAAe,QAAQ,EAAE,CAAC;;AAGnC,MAAMC,oBAA+B,EAAE,WAAW,aAAa;AAG7D,QAAO,CAAC,WAFK,IAAIC,0BAAQ,UAAU,MAAM,EAAE,QAAQ,CAAC,CAE5B,WAAW,CAAC,KAAK;;AAG3C,SAAgB,YAAY,EAAE,MAAM,aAAa,gBAAgB,cAAc,WAAW,UAAU,cAAcC,oBAAmC;CACnJ,MAAM,SAASJ,YAAU;EAAE;EAAgB;EAAa,CAAC;CACzD,MAAM,OAAO,YAAY;EAAE;EAAW,SAAS;EAAa,QAAQ;EAAc,CAAC;AAEnF,QACE,iHACE,yDAACK,yBAAK;EAAa;EAAM;EAAa;YACpC,yDAACC,6BAAS;GAAY;GAAM;GAAO,QAAQ,OAAO,eAAe;GAAE;aAChE,IAAI,KAAK,KAAK,KAAK,CAAC;IACN;GACL,EACd,yDAACD,yBAAK;EAAO,MAAM;EAAU;EAAa;EAAY;YACpD,yDAACE;GAAK,MAAM;GAAU;aACnB,qBAAqB,KAAK;IACtB;GACK,IACb;;AAIP,YAAY,YAAYP;AACxB,YAAY,iBAAiBI;;;;ACrB7B,SAASI,YAAU,EAAE,cAAc,gBAAgB,eAA+B;CAChF,MAAM,QAAQ,mBAAmB,SAAS,YAAY,SAA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IAAI,QAAQ,GACpD,CAAC,KAAK,KAAK,CAAC;CAClE,MAAM,WAAW;EAAC,WAAW;EAAS,gBAAgB;EAAS,gCAAgC;EAAmB;CAElH,MAAM,iBAAiB,SAAS,UAAU;EACxC;EACA;EACA;EACD,CAAC;CACF,MAAM,qBAAqB,aAAa,UAAU;EAChD;EACA;EACA;EACA;EACD,CAAC;CACF,MAAM,SAAS,UAAU;EACvB;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,eAAe,GAAG,iBAAiB,GAAG,mBAAmB,QAAQ,CAAC;AAExE,QACE,yDAACC,yBAAK;EAAa;EAAM;EAAa;YACpC,yDAACC;GACO;GACN;GACA,UAAU,SAAS,KAAK,KAAK;GAC7B,QAAQ,OAAO,eAAe;GAC9B,OAAO,EACL,mDAAsB,UAAU,EACjC;aAEA;;;oDAG2C,aAAa,GAAG,eAAe,QAAQ,CAAC;;;aAG/E,aAAa;;;;2DAIiC,WAAW;;;;IAIrD;GACC;;AAIlB,MAAM,YAAY"}
|
package/dist/components.cjs
CHANGED
package/dist/components.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as OperationSchemas, n as PluginSolidQuery, r as Transformer, s as Operation } from "./types-
|
|
1
|
+
import { a as OperationSchemas, n as PluginSolidQuery, r as Transformer, s as Operation } from "./types-CMszTHJ4.cjs";
|
|
2
2
|
import { FunctionParams } from "@kubb/react-fabric";
|
|
3
3
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
4
4
|
|
package/dist/components.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as OperationSchemas, n as PluginSolidQuery, r as Transformer, s as Operation } from "./types-
|
|
1
|
+
import { a as OperationSchemas, n as PluginSolidQuery, r as Transformer, s as Operation } from "./types-Cl30wqOy.js";
|
|
2
2
|
import { FunctionParams } from "@kubb/react-fabric";
|
|
3
3
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
4
4
|
|
|
@@ -99,20 +99,20 @@ const mutationGenerator = createReactGenerator({
|
|
|
99
99
|
})
|
|
100
100
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
101
101
|
/* @__PURE__ */ jsx(File.Import, {
|
|
102
|
-
name: "fetch",
|
|
102
|
+
name: ["fetch"],
|
|
103
103
|
root: mutation.file.path,
|
|
104
|
-
path: path.resolve(config.root, config.output.path, ".kubb/
|
|
104
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
105
105
|
}),
|
|
106
106
|
/* @__PURE__ */ jsx(File.Import, {
|
|
107
107
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
108
108
|
root: mutation.file.path,
|
|
109
|
-
path: path.resolve(config.root, config.output.path, ".kubb/
|
|
109
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
110
110
|
isTypeOnly: true
|
|
111
111
|
}),
|
|
112
112
|
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
113
113
|
name: ["ResponseConfig"],
|
|
114
114
|
root: mutation.file.path,
|
|
115
|
-
path: path.resolve(config.root, config.output.path, ".kubb/
|
|
115
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
116
116
|
isTypeOnly: true
|
|
117
117
|
})
|
|
118
118
|
] }),
|
|
@@ -281,20 +281,20 @@ const queryGenerator = createReactGenerator({
|
|
|
281
281
|
})
|
|
282
282
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
283
283
|
/* @__PURE__ */ jsx(File.Import, {
|
|
284
|
-
name: "fetch",
|
|
284
|
+
name: ["fetch"],
|
|
285
285
|
root: query.file.path,
|
|
286
|
-
path: path.resolve(config.root, config.output.path, ".kubb/
|
|
286
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
287
287
|
}),
|
|
288
288
|
/* @__PURE__ */ jsx(File.Import, {
|
|
289
289
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
290
290
|
root: query.file.path,
|
|
291
|
-
path: path.resolve(config.root, config.output.path, ".kubb/
|
|
291
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
292
292
|
isTypeOnly: true
|
|
293
293
|
}),
|
|
294
294
|
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
295
295
|
name: ["ResponseConfig"],
|
|
296
296
|
root: query.file.path,
|
|
297
|
-
path: path.resolve(config.root, config.output.path, ".kubb/
|
|
297
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
298
298
|
isTypeOnly: true
|
|
299
299
|
})
|
|
300
300
|
] }),
|
|
@@ -386,4 +386,4 @@ const queryGenerator = createReactGenerator({
|
|
|
386
386
|
|
|
387
387
|
//#endregion
|
|
388
388
|
export { mutationGenerator as n, queryGenerator as t };
|
|
389
|
-
//# sourceMappingURL=generators-
|
|
389
|
+
//# sourceMappingURL=generators-C3nwRyGg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-C3nwRyGg.js","names":[],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'solid-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/solid-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\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 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 mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File\n baseName={mutation.file.baseName}\n path={mutation.file.path}\n meta={mutation.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={mutation.file.path} path={zod.file.path} />\n )}\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} 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 </>\n ) : (\n <>\n <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n {!!hasClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\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={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.mutationKey}\n />\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 || 'data'}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['UseMutationOptions', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'solid-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\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, {\n pluginKey: [pluginTsName],\n type: 'type',\n }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, {\n pluginKey: [pluginZodName],\n type: 'function',\n }),\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 {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} 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 </>\n ) : (\n <>\n <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n {!!hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\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 || 'data'}\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 || 'data'}\n />\n {options.query && (\n <>\n <File.Import name={['useQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'UseBaseQueryOptions', 'UseQueryResult']} 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 || 'data'}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,oBAAoB,qBAAuC;CACtE,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EACJ,SACA,SAAS,EAAE,aACT;EACJ,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,oBAAoB,UAAU;EAGvE,MAAM,aACJ,EAFc,CAAC,CAAC,QAAQ,SAAS,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO,KAGrG,WAAW,QAAQ,WAAW,QAAQ,SAAS,UAAU,EAAE,EAAE,QAAQ,QAAQ,QAAQ,MAAM,UAAU,EAAE,CAAC,CAAC,MAAM,WAAW,UAAU,WAAW,OAAO;EAExJ,MAAM,aAAa,QAAQ,WAA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MACX,cAAc,QAAQ;MACtB,gBAAgB,QAAQ,OAAO,kBAAkB;MACjD,cAAc,SAAS;MACvB,kBAAkB,SAAS;OAC3B;QACD;;IAEA;;CAGZ,CAAC"}
|
|
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
}) : target, mod));
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
|
-
const require_components = require('./components-
|
|
24
|
+
const require_components = require('./components-C6vYkQe6.cjs');
|
|
25
25
|
let node_path = require("node:path");
|
|
26
26
|
node_path = __toESM(node_path);
|
|
27
27
|
let __kubb_plugin_client = require("@kubb/plugin-client");
|
|
@@ -123,20 +123,20 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
123
123
|
})
|
|
124
124
|
] }) : /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
125
125
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
126
|
-
name: "fetch",
|
|
126
|
+
name: ["fetch"],
|
|
127
127
|
root: mutation.file.path,
|
|
128
|
-
path: node_path.default.resolve(config.root, config.output.path, ".kubb/
|
|
128
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
129
129
|
}),
|
|
130
130
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
131
131
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
132
132
|
root: mutation.file.path,
|
|
133
|
-
path: node_path.default.resolve(config.root, config.output.path, ".kubb/
|
|
133
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
134
134
|
isTypeOnly: true
|
|
135
135
|
}),
|
|
136
136
|
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
137
137
|
name: ["ResponseConfig"],
|
|
138
138
|
root: mutation.file.path,
|
|
139
|
-
path: node_path.default.resolve(config.root, config.output.path, ".kubb/
|
|
139
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
140
140
|
isTypeOnly: true
|
|
141
141
|
})
|
|
142
142
|
] }),
|
|
@@ -305,20 +305,20 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
305
305
|
})
|
|
306
306
|
] }) : /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
307
307
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
308
|
-
name: "fetch",
|
|
308
|
+
name: ["fetch"],
|
|
309
309
|
root: query.file.path,
|
|
310
|
-
path: node_path.default.resolve(config.root, config.output.path, ".kubb/
|
|
310
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
311
311
|
}),
|
|
312
312
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
313
313
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
314
314
|
root: query.file.path,
|
|
315
|
-
path: node_path.default.resolve(config.root, config.output.path, ".kubb/
|
|
315
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
316
316
|
isTypeOnly: true
|
|
317
317
|
}),
|
|
318
318
|
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
319
319
|
name: ["ResponseConfig"],
|
|
320
320
|
root: query.file.path,
|
|
321
|
-
path: node_path.default.resolve(config.root, config.output.path, ".kubb/
|
|
321
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
322
322
|
isTypeOnly: true
|
|
323
323
|
})
|
|
324
324
|
] }),
|
|
@@ -427,4 +427,4 @@ Object.defineProperty(exports, 'queryGenerator', {
|
|
|
427
427
|
return queryGenerator;
|
|
428
428
|
}
|
|
429
429
|
});
|
|
430
|
-
//# sourceMappingURL=generators
|
|
430
|
+
//# sourceMappingURL=generators-SSdobNNF.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-SSdobNNF.cjs","names":["pluginTsName","pluginZodName","pluginClientName","File","path","MutationKey","Client","Mutation","pluginClientName","pluginTsName","pluginZodName","File","path","QueryKey","Client","QueryOptions","Query"],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'solid-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/solid-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\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 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 mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File\n baseName={mutation.file.baseName}\n path={mutation.file.path}\n meta={mutation.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={mutation.file.path} path={zod.file.path} />\n )}\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} 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 </>\n ) : (\n <>\n <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n {!!hasClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\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={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.mutationKey}\n />\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 || 'data'}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['UseMutationOptions', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'solid-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\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, {\n pluginKey: [pluginTsName],\n type: 'type',\n }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, {\n pluginKey: [pluginZodName],\n type: 'function',\n }),\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 {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} 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 </>\n ) : (\n <>\n <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n {!!hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\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 || 'data'}\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 || 'data'}\n />\n {options.query && (\n <>\n <File.Import name={['useQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'UseBaseQueryOptions', 'UseQueryResult']} 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 || 'data'}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAa,2EAA2D;CACtE,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EACJ,SACA,SAAS,EAAE,aACT;EACJ,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,6DAAgC,UAAU;EAGvE,MAAM,aACJ,EAFc,CAAC,CAAC,QAAQ,SAAS,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO,4BAG1F,QAAQ,WAAW,QAAQ,SAAS,UAAU,EAAE,EAAE,QAAQ,QAAQ,QAAQ,MAAM,UAAU,EAAE,CAAC,CAAC,MAAM,WAAW,UAAU,WAAW,OAAO;EAExJ,MAAM,aAAa,QAAQ,WAAW,QAAQ,SAAS,aAAa;EAEpE,MAAM,WAAW;GACf,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAO,CAAC;GAC7D,UAAU,QAAQ,WAAW,EAAE,MAAM,QAAQ,CAAC;GAC9C,MAAM,QAAQ,WAAW,EAAE,QAAQ,OAAO,CAAC;GAC5C;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW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,OAAO,QAAQ;KACjB,MAAM,MAAM,KAAK;KACjB,MAAM,KAAK,KAAK;KAChB;MACA;IACF,yDAACE;KACC,MAAM,SAAS;KACf,UAAU,SAAS;KACR;KACX,cAAc,QAAQ;KACtB,gBAAgB,QAAQ;KACxB,aAAa,KAAK;KAClB,aAAa,QAAQ;MACrB;IACD,CAAC,mBACA,yDAACC;KACC,MAAM,OAAO;KACb,SAAS,QAAQ,OAAO;KACb;KACX,aAAa,KAAK;KAClB,YAAY,IAAI;KAChB,gBAAgB,QAAQ,OAAO,kBAAkB;KACjD,cAAc,QAAQ;KACtB,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,QAAQ,QAAQ;MAChB;IAEJ,yDAACH,yBAAK;KAAO,MAAM,CAAC,eAAe;KAAE,MAAM;MAAc;IACzD,yDAACI;KACC,MAAM,aAAa;KACnB,YAAY,OAAO;KACnB,cAAc,SAAS;KACvB,aAAa,KAAK;KAClB,cAAc,QAAQ;KACtB,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,gBAAgB,QAAQ,OAAO,kBAAkB;MACjD;IACD,QAAQ,SACP;KACE,yDAACJ,yBAAK;MAAO,MAAM,CAAC,WAAW;MAAE,MAAM;OAAc;KACrD,yDAACA,yBAAK;MAAO,MAAM;OAAC;OAAY;OAAe;OAAuB;OAAiB;MAAE,MAAM;MAAY;OAAa;KACxH,yDAACK;MACC,MAAM,MAAM;MACZ,kBAAkB,aAAa;MAC/B,aAAa,KAAK;MAClB,YAAY,QAAQ;MACpB,gBAAgB,QAAQ;MACb;MACX,cAAc,QAAQ;MACtB,gBAAgB,QAAQ,OAAO,kBAAkB;MACjD,cAAc,SAAS;MACvB,kBAAkB,SAAS;OAC3B;QACD;;IAEA;;CAGZ,CAAC"}
|
package/dist/generators.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_generators = require('./generators
|
|
2
|
-
require('./components-
|
|
1
|
+
const require_generators = require('./generators-SSdobNNF.cjs');
|
|
2
|
+
require('./components-C6vYkQe6.cjs');
|
|
3
3
|
|
|
4
4
|
exports.mutationGenerator = require_generators.mutationGenerator;
|
|
5
5
|
exports.queryGenerator = require_generators.queryGenerator;
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ReactGenerator, n as PluginSolidQuery } from "./types-
|
|
1
|
+
import { i as ReactGenerator, n as PluginSolidQuery } from "./types-CMszTHJ4.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/mutationGenerator.d.ts
|
|
4
4
|
declare const mutationGenerator: ReactGenerator<PluginSolidQuery>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ReactGenerator, n as PluginSolidQuery } from "./types-
|
|
1
|
+
import { i as ReactGenerator, n as PluginSolidQuery } from "./types-Cl30wqOy.js";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/mutationGenerator.d.ts
|
|
4
4
|
declare const mutationGenerator: ReactGenerator<PluginSolidQuery>;
|
package/dist/generators.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_generators = require('./generators
|
|
2
|
-
const require_components = require('./components-
|
|
1
|
+
const require_generators = require('./generators-SSdobNNF.cjs');
|
|
2
|
+
const require_components = require('./components-C6vYkQe6.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_generators.__toESM(node_path);
|
|
5
5
|
let __kubb_core = require("@kubb/core");
|
|
@@ -13,19 +13,24 @@ let __kubb_plugin_zod = require("@kubb/plugin-zod");
|
|
|
13
13
|
//#region src/plugin.ts
|
|
14
14
|
const pluginSolidQueryName = "plugin-solid-query";
|
|
15
15
|
const pluginSolidQuery = (0, __kubb_core.definePlugin)((options) => {
|
|
16
|
+
const bundle = options.bundle ?? false;
|
|
16
17
|
const { output = {
|
|
17
18
|
path: "hooks",
|
|
18
19
|
barrelType: "named"
|
|
19
20
|
}, group, exclude = [], include, override = [], parser = "client", transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", queryKey = require_components.QueryKey.getTransformer, generators = [require_generators.queryGenerator, require_generators.mutationGenerator].filter(Boolean), mutation = {}, query = {}, mutationKey = require_components.MutationKey.getTransformer, paramsCasing, contentType } = options;
|
|
21
|
+
const clientType = options.client?.client ?? "axios";
|
|
22
|
+
const clientImportPath = options.client?.importPath ?? (!bundle ? `@kubb/plugin-client/clients/${clientType}` : void 0);
|
|
20
23
|
return {
|
|
21
24
|
name: pluginSolidQueryName,
|
|
22
25
|
options: {
|
|
26
|
+
bundle,
|
|
23
27
|
output,
|
|
24
28
|
client: {
|
|
25
|
-
client:
|
|
26
|
-
dataReturnType: "data",
|
|
29
|
+
client: clientType,
|
|
30
|
+
dataReturnType: options.client?.dataReturnType ?? "data",
|
|
27
31
|
pathParamsType,
|
|
28
|
-
|
|
32
|
+
baseURL: options.client?.baseURL,
|
|
33
|
+
importPath: clientImportPath
|
|
29
34
|
},
|
|
30
35
|
queryKey,
|
|
31
36
|
query: query === false ? false : {
|
|
@@ -86,13 +91,15 @@ const pluginSolidQuery = (0, __kubb_core.definePlugin)((options) => {
|
|
|
86
91
|
const baseURL = await this.getBaseURL();
|
|
87
92
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
88
93
|
const hasClientPlugin = !!this.pluginManager.getPluginByKey([__kubb_plugin_client.pluginClientName]);
|
|
89
|
-
const
|
|
90
|
-
if (!hasClientPlugin && !this.plugin.options.client.importPath && !
|
|
91
|
-
baseName: "
|
|
92
|
-
path: node_path.default.resolve(root, ".kubb/
|
|
94
|
+
const containsFetch = this.fabric.files.some((file) => file.baseName === "fetch.ts");
|
|
95
|
+
if (bundle && !hasClientPlugin && !this.plugin.options.client.importPath && !containsFetch) await this.addFile({
|
|
96
|
+
baseName: "fetch.ts",
|
|
97
|
+
path: node_path.default.resolve(root, ".kubb/fetch.ts"),
|
|
93
98
|
sources: [{
|
|
94
|
-
name: "
|
|
95
|
-
value: (0, __kubb_core_utils.resolveModuleSource)(this.plugin.options.client.client === "fetch" ? "@kubb/plugin-client/templates/clients/fetch" : "@kubb/plugin-client/templates/clients/axios").source
|
|
99
|
+
name: "fetch",
|
|
100
|
+
value: (0, __kubb_core_utils.resolveModuleSource)(this.plugin.options.client.client === "fetch" ? "@kubb/plugin-client/templates/clients/fetch" : "@kubb/plugin-client/templates/clients/axios").source,
|
|
101
|
+
isExportable: true,
|
|
102
|
+
isIndexable: true
|
|
96
103
|
}]
|
|
97
104
|
});
|
|
98
105
|
const files = await new __kubb_plugin_oas.OperationGenerator(this.plugin.options, {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["QueryKey","queryGenerator","mutationGenerator","MutationKey","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","pluginClientName","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = definePlugin<PluginSolidQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n paramsCasing,\n contentType,\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n client:
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["QueryKey","queryGenerator","mutationGenerator","MutationKey","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","pluginClientName","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = definePlugin<PluginSolidQuery>((options) => {\n const bundle = options.bundle ?? false\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n paramsCasing,\n contentType,\n } = options\n\n const clientType = options.client?.client ?? 'axios'\n const clientImportPath = options.client?.importPath ?? (!bundle ? `@kubb/plugin-client/clients/${clientType}` : undefined)\n\n return {\n name: pluginSolidQueryName,\n options: {\n bundle,\n output,\n client: {\n client: clientType,\n dataReturnType: options.client?.dataReturnType ?? 'data',\n pathParamsType,\n baseURL: options.client?.baseURL,\n importPath: clientImportPath,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n mutationKey,\n mutation: {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/solid-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n group,\n paramsCasing,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n const containsFetch = this.fabric.files.some((file) => file.baseName === 'fetch.ts')\n\n if (bundle && !hasClientPlugin && !this.plugin.options.client.importPath && !containsFetch) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,uBAAuB;AAEpC,MAAa,kDAAmD,YAAY;CAC1E,MAAM,SAAS,QAAQ,UAAU;CACjC,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,WAAWA,4BAAS,gBACpB,aAAa,CAACC,mCAAgBC,qCAAkB,CAAC,OAAO,QAAQ,EAChE,WAAW,EAAE,EACb,QAAQ,EAAE,EACV,cAAcC,+BAAY,gBAC1B,cACA,gBACE;CAEJ,MAAM,aAAa,QAAQ,QAAQ,UAAU;CAC7C,MAAM,mBAAmB,QAAQ,QAAQ,eAAe,CAAC,SAAS,+BAA+B,eAAe;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;IACN,QAAQ;IACR,gBAAgB,QAAQ,QAAQ,kBAAkB;IAClD;IACA,SAAS,QAAQ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OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,gCAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAC/B,MAAM,UAAU,MAAM,KAAK,YAAY;AAEvC,OAAI,QACF,MAAK,OAAO,QAAQ,OAAO,UAAU;GAGvC,MAAM,kBAAkB,CAAC,CAAC,KAAK,cAAc,eAAe,CAACG,sCAAiB,CAAC;GAC/E,MAAM,gBAAgB,KAAK,OAAO,MAAM,MAAM,SAAS,KAAK,aAAa,WAAW;AAEpF,OAAI,UAAU,CAAC,mBAAmB,CAAC,KAAK,OAAO,QAAQ,OAAO,cAAc,CAAC,cAE3E,OAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMH,kBAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP;KACE,MAAM;KACN,kDACE,KAAK,OAAO,QAAQ,OAAO,WAAW,UAAU,gDAAgD,8CACjG,CAAC;KACF,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;GAeJ,MAAM,QAAQ,MAZa,IAAII,qCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,sCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;EACD"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PluginSolidQuery, o as UserPluginWithLifeCycle, t as Options } from "./types-
|
|
1
|
+
import { n as PluginSolidQuery, o as UserPluginWithLifeCycle, t as Options } from "./types-CMszTHJ4.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginSolidQueryName = "plugin-solid-query";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PluginSolidQuery, o as UserPluginWithLifeCycle, t as Options } from "./types-
|
|
1
|
+
import { n as PluginSolidQuery, o as UserPluginWithLifeCycle, t as Options } from "./types-Cl30wqOy.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginSolidQueryName = "plugin-solid-query";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as MutationKey, r as QueryKey } from "./components-TJW-A9oM.js";
|
|
2
|
-
import { n as mutationGenerator, t as queryGenerator } from "./generators-
|
|
2
|
+
import { n as mutationGenerator, t as queryGenerator } from "./generators-C3nwRyGg.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
5
5
|
import { camelCase, pascalCase } from "@kubb/core/transformers";
|
|
@@ -12,19 +12,24 @@ import { pluginZodName } from "@kubb/plugin-zod";
|
|
|
12
12
|
//#region src/plugin.ts
|
|
13
13
|
const pluginSolidQueryName = "plugin-solid-query";
|
|
14
14
|
const pluginSolidQuery = definePlugin((options) => {
|
|
15
|
+
const bundle = options.bundle ?? false;
|
|
15
16
|
const { output = {
|
|
16
17
|
path: "hooks",
|
|
17
18
|
barrelType: "named"
|
|
18
19
|
}, group, exclude = [], include, override = [], parser = "client", transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", queryKey = QueryKey.getTransformer, generators = [queryGenerator, mutationGenerator].filter(Boolean), mutation = {}, query = {}, mutationKey = MutationKey.getTransformer, paramsCasing, contentType } = options;
|
|
20
|
+
const clientType = options.client?.client ?? "axios";
|
|
21
|
+
const clientImportPath = options.client?.importPath ?? (!bundle ? `@kubb/plugin-client/clients/${clientType}` : void 0);
|
|
19
22
|
return {
|
|
20
23
|
name: pluginSolidQueryName,
|
|
21
24
|
options: {
|
|
25
|
+
bundle,
|
|
22
26
|
output,
|
|
23
27
|
client: {
|
|
24
|
-
client:
|
|
25
|
-
dataReturnType: "data",
|
|
28
|
+
client: clientType,
|
|
29
|
+
dataReturnType: options.client?.dataReturnType ?? "data",
|
|
26
30
|
pathParamsType,
|
|
27
|
-
|
|
31
|
+
baseURL: options.client?.baseURL,
|
|
32
|
+
importPath: clientImportPath
|
|
28
33
|
},
|
|
29
34
|
queryKey,
|
|
30
35
|
query: query === false ? false : {
|
|
@@ -85,13 +90,15 @@ const pluginSolidQuery = definePlugin((options) => {
|
|
|
85
90
|
const baseURL = await this.getBaseURL();
|
|
86
91
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
87
92
|
const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName]);
|
|
88
|
-
const
|
|
89
|
-
if (!hasClientPlugin && !this.plugin.options.client.importPath && !
|
|
90
|
-
baseName: "
|
|
91
|
-
path: path.resolve(root, ".kubb/
|
|
93
|
+
const containsFetch = this.fabric.files.some((file) => file.baseName === "fetch.ts");
|
|
94
|
+
if (bundle && !hasClientPlugin && !this.plugin.options.client.importPath && !containsFetch) await this.addFile({
|
|
95
|
+
baseName: "fetch.ts",
|
|
96
|
+
path: path.resolve(root, ".kubb/fetch.ts"),
|
|
92
97
|
sources: [{
|
|
93
|
-
name: "
|
|
94
|
-
value: resolveModuleSource(this.plugin.options.client.client === "fetch" ? "@kubb/plugin-client/templates/clients/fetch" : "@kubb/plugin-client/templates/clients/axios").source
|
|
98
|
+
name: "fetch",
|
|
99
|
+
value: resolveModuleSource(this.plugin.options.client.client === "fetch" ? "@kubb/plugin-client/templates/clients/fetch" : "@kubb/plugin-client/templates/clients/axios").source,
|
|
100
|
+
isExportable: true,
|
|
101
|
+
isIndexable: true
|
|
95
102
|
}]
|
|
96
103
|
});
|
|
97
104
|
const files = await new OperationGenerator(this.plugin.options, {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = definePlugin<PluginSolidQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n paramsCasing,\n contentType,\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n client:
|
|
1
|
+
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = definePlugin<PluginSolidQuery>((options) => {\n const bundle = options.bundle ?? false\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n paramsCasing,\n contentType,\n } = options\n\n const clientType = options.client?.client ?? 'axios'\n const clientImportPath = options.client?.importPath ?? (!bundle ? `@kubb/plugin-client/clients/${clientType}` : undefined)\n\n return {\n name: pluginSolidQueryName,\n options: {\n bundle,\n output,\n client: {\n client: clientType,\n dataReturnType: options.client?.dataReturnType ?? 'data',\n pathParamsType,\n baseURL: options.client?.baseURL,\n importPath: clientImportPath,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n mutationKey,\n mutation: {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/solid-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n group,\n paramsCasing,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n const containsFetch = this.fabric.files.some((file) => file.baseName === 'fetch.ts')\n\n if (bundle && !hasClientPlugin && !this.plugin.options.client.importPath && !containsFetch) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.add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IAC1C,SAAS,CACP;KACE,MAAM;KACN,OAAO,oBACL,KAAK,OAAO,QAAQ,OAAO,WAAW,UAAU,gDAAgD,8CACjG,CAAC;KACF,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;GAeJ,MAAM,QAAQ,MAZa,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;EACD"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
2
1
|
import * as OasTypes from "oas/types";
|
|
3
2
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
4
3
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -6,6 +5,7 @@ import { OpenAPIV3 } from "openapi-types";
|
|
|
6
5
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
7
6
|
import BaseOas from "oas";
|
|
8
7
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
9
9
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
10
10
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
11
11
|
|
|
@@ -1087,6 +1087,12 @@ type Options$2 = {
|
|
|
1087
1087
|
* @default 'axios'
|
|
1088
1088
|
*/
|
|
1089
1089
|
client?: 'axios' | 'fetch';
|
|
1090
|
+
/**
|
|
1091
|
+
* Bundle the selected client into the generated `.kubb` directory.
|
|
1092
|
+
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
1093
|
+
* @default false
|
|
1094
|
+
*/
|
|
1095
|
+
bundle?: boolean;
|
|
1090
1096
|
transformers?: {
|
|
1091
1097
|
/**
|
|
1092
1098
|
* Customize the names based on the type that is provided by the plugin.
|
|
@@ -1103,6 +1109,7 @@ type ResolvedOptions$1 = {
|
|
|
1103
1109
|
group?: Options$2['group'];
|
|
1104
1110
|
baseURL: string | undefined;
|
|
1105
1111
|
client: Options$2['client'];
|
|
1112
|
+
bundle: boolean;
|
|
1106
1113
|
parser: NonNullable<Options$2['parser']>;
|
|
1107
1114
|
urlType: NonNullable<Options$2['urlType']>;
|
|
1108
1115
|
importPath: Options$2['importPath'];
|
|
@@ -1174,6 +1181,12 @@ type Options$1 = {
|
|
|
1174
1181
|
*/
|
|
1175
1182
|
group?: Group;
|
|
1176
1183
|
client?: Pick<PluginClient['options'], 'client' | 'dataReturnType' | 'importPath' | 'baseURL'>;
|
|
1184
|
+
/**
|
|
1185
|
+
* Bundle the selected client into the generated `.kubb` directory.
|
|
1186
|
+
* When disabled the generated hooks will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
1187
|
+
* @default false
|
|
1188
|
+
*/
|
|
1189
|
+
bundle?: boolean;
|
|
1177
1190
|
/**
|
|
1178
1191
|
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
1179
1192
|
*/
|
|
@@ -1235,6 +1248,7 @@ type ResolvedOptions = {
|
|
|
1235
1248
|
output: Output<Oas>;
|
|
1236
1249
|
group: Options$1['group'];
|
|
1237
1250
|
client: NonNullable<PluginSolidQuery['options']['client']>;
|
|
1251
|
+
bundle: boolean;
|
|
1238
1252
|
parser: Required<NonNullable<Options$1['parser']>>;
|
|
1239
1253
|
paramsCasing: Options$1['paramsCasing'];
|
|
1240
1254
|
paramsType: NonNullable<Options$1['paramsType']>;
|
|
@@ -1247,4 +1261,4 @@ type ResolvedOptions = {
|
|
|
1247
1261
|
type PluginSolidQuery = PluginFactoryOptions<'plugin-solid-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1248
1262
|
//#endregion
|
|
1249
1263
|
export { OperationSchemas as a, ReactGenerator as i, PluginSolidQuery as n, UserPluginWithLifeCycle as o, Transformer as r, Operation$1 as s, Options$1 as t };
|
|
1250
|
-
//# sourceMappingURL=types-
|
|
1264
|
+
//# sourceMappingURL=types-CMszTHJ4.d.cts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
1
2
|
import * as OasTypes from "oas/types";
|
|
2
3
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
3
4
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -5,7 +6,6 @@ import { OpenAPIV3 } from "openapi-types";
|
|
|
5
6
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
6
7
|
import BaseOas from "oas";
|
|
7
8
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
9
9
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
10
10
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
11
11
|
|
|
@@ -1087,6 +1087,12 @@ type Options$2 = {
|
|
|
1087
1087
|
* @default 'axios'
|
|
1088
1088
|
*/
|
|
1089
1089
|
client?: 'axios' | 'fetch';
|
|
1090
|
+
/**
|
|
1091
|
+
* Bundle the selected client into the generated `.kubb` directory.
|
|
1092
|
+
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
1093
|
+
* @default false
|
|
1094
|
+
*/
|
|
1095
|
+
bundle?: boolean;
|
|
1090
1096
|
transformers?: {
|
|
1091
1097
|
/**
|
|
1092
1098
|
* Customize the names based on the type that is provided by the plugin.
|
|
@@ -1103,6 +1109,7 @@ type ResolvedOptions$1 = {
|
|
|
1103
1109
|
group?: Options$2['group'];
|
|
1104
1110
|
baseURL: string | undefined;
|
|
1105
1111
|
client: Options$2['client'];
|
|
1112
|
+
bundle: boolean;
|
|
1106
1113
|
parser: NonNullable<Options$2['parser']>;
|
|
1107
1114
|
urlType: NonNullable<Options$2['urlType']>;
|
|
1108
1115
|
importPath: Options$2['importPath'];
|
|
@@ -1174,6 +1181,12 @@ type Options$1 = {
|
|
|
1174
1181
|
*/
|
|
1175
1182
|
group?: Group;
|
|
1176
1183
|
client?: Pick<PluginClient['options'], 'client' | 'dataReturnType' | 'importPath' | 'baseURL'>;
|
|
1184
|
+
/**
|
|
1185
|
+
* Bundle the selected client into the generated `.kubb` directory.
|
|
1186
|
+
* When disabled the generated hooks will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
1187
|
+
* @default false
|
|
1188
|
+
*/
|
|
1189
|
+
bundle?: boolean;
|
|
1177
1190
|
/**
|
|
1178
1191
|
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
1179
1192
|
*/
|
|
@@ -1235,6 +1248,7 @@ type ResolvedOptions = {
|
|
|
1235
1248
|
output: Output<Oas>;
|
|
1236
1249
|
group: Options$1['group'];
|
|
1237
1250
|
client: NonNullable<PluginSolidQuery['options']['client']>;
|
|
1251
|
+
bundle: boolean;
|
|
1238
1252
|
parser: Required<NonNullable<Options$1['parser']>>;
|
|
1239
1253
|
paramsCasing: Options$1['paramsCasing'];
|
|
1240
1254
|
paramsType: NonNullable<Options$1['paramsType']>;
|
|
@@ -1247,4 +1261,4 @@ type ResolvedOptions = {
|
|
|
1247
1261
|
type PluginSolidQuery = PluginFactoryOptions<'plugin-solid-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1248
1262
|
//#endregion
|
|
1249
1263
|
export { OperationSchemas as a, ReactGenerator as i, PluginSolidQuery as n, UserPluginWithLifeCycle as o, Transformer as r, Operation$1 as s, Options$1 as t };
|
|
1250
|
-
//# sourceMappingURL=types-
|
|
1264
|
+
//# sourceMappingURL=types-Cl30wqOy.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-solid-query",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.8",
|
|
4
4
|
"description": "Solid Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Solid.js applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"solid-query",
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@kubb/react-fabric": "0.2.19",
|
|
72
72
|
"remeda": "^2.32.0",
|
|
73
|
-
"@kubb/core": "4.5.
|
|
74
|
-
"@kubb/oas": "4.5.
|
|
75
|
-
"@kubb/plugin-client": "4.5.
|
|
76
|
-
"@kubb/plugin-oas": "4.5.
|
|
77
|
-
"@kubb/plugin-ts": "4.5.
|
|
78
|
-
"@kubb/plugin-zod": "4.5.
|
|
73
|
+
"@kubb/core": "4.5.8",
|
|
74
|
+
"@kubb/oas": "4.5.8",
|
|
75
|
+
"@kubb/plugin-client": "4.5.8",
|
|
76
|
+
"@kubb/plugin-oas": "4.5.8",
|
|
77
|
+
"@kubb/plugin-ts": "4.5.8",
|
|
78
|
+
"@kubb/plugin-zod": "4.5.8"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@kubb/react-fabric": "0.2.19"
|
|
@@ -89,18 +89,18 @@ export const mutationGenerator = createReactGenerator<PluginSolidQuery>({
|
|
|
89
89
|
</>
|
|
90
90
|
) : (
|
|
91
91
|
<>
|
|
92
|
-
<File.Import name={'fetch'} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/
|
|
92
|
+
<File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />
|
|
93
93
|
<File.Import
|
|
94
94
|
name={['RequestConfig', 'ResponseErrorConfig']}
|
|
95
95
|
root={mutation.file.path}
|
|
96
|
-
path={path.resolve(config.root, config.output.path, '.kubb/
|
|
96
|
+
path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}
|
|
97
97
|
isTypeOnly
|
|
98
98
|
/>
|
|
99
99
|
{options.client.dataReturnType === 'full' && (
|
|
100
100
|
<File.Import
|
|
101
101
|
name={['ResponseConfig']}
|
|
102
102
|
root={mutation.file.path}
|
|
103
|
-
path={path.resolve(config.root, config.output.path, '.kubb/
|
|
103
|
+
path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}
|
|
104
104
|
isTypeOnly
|
|
105
105
|
/>
|
|
106
106
|
)}
|
|
@@ -59,12 +59,18 @@ export const queryGenerator = createReactGenerator<PluginSolidQuery>({
|
|
|
59
59
|
const type = {
|
|
60
60
|
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
61
61
|
//todo remove type?
|
|
62
|
-
schemas: getSchemas(operation, {
|
|
62
|
+
schemas: getSchemas(operation, {
|
|
63
|
+
pluginKey: [pluginTsName],
|
|
64
|
+
type: 'type',
|
|
65
|
+
}),
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
const zod = {
|
|
66
69
|
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
67
|
-
schemas: getSchemas(operation, {
|
|
70
|
+
schemas: getSchemas(operation, {
|
|
71
|
+
pluginKey: [pluginZodName],
|
|
72
|
+
type: 'function',
|
|
73
|
+
}),
|
|
68
74
|
}
|
|
69
75
|
|
|
70
76
|
if (!isQuery || isMutation) {
|
|
@@ -90,20 +96,15 @@ export const queryGenerator = createReactGenerator<PluginSolidQuery>({
|
|
|
90
96
|
</>
|
|
91
97
|
) : (
|
|
92
98
|
<>
|
|
93
|
-
<File.Import name={'fetch'} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/
|
|
99
|
+
<File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />
|
|
94
100
|
<File.Import
|
|
95
101
|
name={['RequestConfig', 'ResponseErrorConfig']}
|
|
96
102
|
root={query.file.path}
|
|
97
|
-
path={path.resolve(config.root, config.output.path, '.kubb/
|
|
103
|
+
path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}
|
|
98
104
|
isTypeOnly
|
|
99
105
|
/>
|
|
100
106
|
{options.client.dataReturnType === 'full' && (
|
|
101
|
-
<File.Import
|
|
102
|
-
name={['ResponseConfig']}
|
|
103
|
-
root={query.file.path}
|
|
104
|
-
path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}
|
|
105
|
-
isTypeOnly
|
|
106
|
-
/>
|
|
107
|
+
<File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />
|
|
107
108
|
)}
|
|
108
109
|
</>
|
|
109
110
|
)}
|
package/src/plugin.ts
CHANGED
|
@@ -13,6 +13,7 @@ import type { PluginSolidQuery } from './types.ts'
|
|
|
13
13
|
export const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']
|
|
14
14
|
|
|
15
15
|
export const pluginSolidQuery = definePlugin<PluginSolidQuery>((options) => {
|
|
16
|
+
const bundle = options.bundle ?? false
|
|
16
17
|
const {
|
|
17
18
|
output = { path: 'hooks', barrelType: 'named' },
|
|
18
19
|
group,
|
|
@@ -32,15 +33,20 @@ export const pluginSolidQuery = definePlugin<PluginSolidQuery>((options) => {
|
|
|
32
33
|
contentType,
|
|
33
34
|
} = options
|
|
34
35
|
|
|
36
|
+
const clientType = options.client?.client ?? 'axios'
|
|
37
|
+
const clientImportPath = options.client?.importPath ?? (!bundle ? `@kubb/plugin-client/clients/${clientType}` : undefined)
|
|
38
|
+
|
|
35
39
|
return {
|
|
36
40
|
name: pluginSolidQueryName,
|
|
37
41
|
options: {
|
|
42
|
+
bundle,
|
|
38
43
|
output,
|
|
39
44
|
client: {
|
|
40
|
-
client:
|
|
41
|
-
dataReturnType: 'data',
|
|
45
|
+
client: clientType,
|
|
46
|
+
dataReturnType: options.client?.dataReturnType ?? 'data',
|
|
42
47
|
pathParamsType,
|
|
43
|
-
|
|
48
|
+
baseURL: options.client?.baseURL,
|
|
49
|
+
importPath: clientImportPath,
|
|
44
50
|
},
|
|
45
51
|
queryKey,
|
|
46
52
|
query:
|
|
@@ -127,19 +133,21 @@ export const pluginSolidQuery = definePlugin<PluginSolidQuery>((options) => {
|
|
|
127
133
|
}
|
|
128
134
|
|
|
129
135
|
const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])
|
|
130
|
-
const
|
|
136
|
+
const containsFetch = this.fabric.files.some((file) => file.baseName === 'fetch.ts')
|
|
131
137
|
|
|
132
|
-
if (!hasClientPlugin && !this.plugin.options.client.importPath && !
|
|
133
|
-
// pre add bundled
|
|
138
|
+
if (bundle && !hasClientPlugin && !this.plugin.options.client.importPath && !containsFetch) {
|
|
139
|
+
// pre add bundled fetch
|
|
134
140
|
await this.addFile({
|
|
135
|
-
baseName: '
|
|
136
|
-
path: path.resolve(root, '.kubb/
|
|
141
|
+
baseName: 'fetch.ts',
|
|
142
|
+
path: path.resolve(root, '.kubb/fetch.ts'),
|
|
137
143
|
sources: [
|
|
138
144
|
{
|
|
139
|
-
name: '
|
|
145
|
+
name: 'fetch',
|
|
140
146
|
value: resolveModuleSource(
|
|
141
147
|
this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',
|
|
142
148
|
).source,
|
|
149
|
+
isExportable: true,
|
|
150
|
+
isIndexable: true,
|
|
143
151
|
},
|
|
144
152
|
],
|
|
145
153
|
})
|
package/src/types.ts
CHANGED
|
@@ -72,6 +72,12 @@ export type Options = {
|
|
|
72
72
|
group?: Group
|
|
73
73
|
|
|
74
74
|
client?: Pick<PluginClient['options'], 'client' | 'dataReturnType' | 'importPath' | 'baseURL'>
|
|
75
|
+
/**
|
|
76
|
+
* Bundle the selected client into the generated `.kubb` directory.
|
|
77
|
+
* When disabled the generated hooks will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
bundle?: boolean
|
|
75
81
|
/**
|
|
76
82
|
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
77
83
|
*/
|
|
@@ -134,6 +140,7 @@ type ResolvedOptions = {
|
|
|
134
140
|
output: Output<Oas>
|
|
135
141
|
group: Options['group']
|
|
136
142
|
client: NonNullable<PluginSolidQuery['options']['client']>
|
|
143
|
+
bundle: boolean
|
|
137
144
|
parser: Required<NonNullable<Options['parser']>>
|
|
138
145
|
paramsCasing: Options['paramsCasing']
|
|
139
146
|
paramsType: NonNullable<Options['paramsType']>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators--pucLXpq.cjs","names":["pluginTsName","pluginZodName","pluginClientName","File","path","MutationKey","Client","Mutation","pluginClientName","pluginTsName","pluginZodName","File","path","QueryKey","Client","QueryOptions","Query"],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'solid-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/solid-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\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 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 mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File\n baseName={mutation.file.baseName}\n path={mutation.file.path}\n meta={mutation.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={mutation.file.path} path={zod.file.path} />\n )}\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} 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 </>\n ) : (\n <>\n <File.Import name={'fetch'} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n {!!hasClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\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={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.mutationKey}\n />\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 || 'data'}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['UseMutationOptions', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'solid-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\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 {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} 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 </>\n ) : (\n <>\n <File.Import name={'fetch'} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n {!!hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\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 || 'data'}\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 || 'data'}\n />\n {options.query && (\n <>\n <File.Import name={['useQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'UseBaseQueryOptions', 'UseQueryResult']} 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 || 'data'}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAa,2EAA2D;CACtE,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EACJ,SACA,SAAS,EAAE,aACT;EACJ,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,6DAAgC,UAAU;EAGvE,MAAM,aACJ,EAFc,CAAC,CAAC,QAAQ,SAAS,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO,4BAG1F,QAAQ,WAAW,QAAQ,SAAS,UAAU,EAAE,EAAE,QAAQ,QAAQ,QAAQ,MAAM,UAAU,EAAE,CAAC,CAAC,MAAM,WAAW,UAAU,WAAW,OAAO;EAExJ,MAAM,aAAa,QAAQ,WAAW,QAAQ,SAAS,aAAa;EAEpE,MAAM,WAAW;GACf,MAAM,QAAQ,WAAW;IAAE,MAAM;IAA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IAEA;;CAGZ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-D8jwI0av.js","names":[],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'solid-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/solid-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\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 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 mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File\n baseName={mutation.file.baseName}\n path={mutation.file.path}\n meta={mutation.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={mutation.file.path} path={zod.file.path} />\n )}\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} 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 </>\n ) : (\n <>\n <File.Import name={'fetch'} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n {!!hasClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\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={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.mutationKey}\n />\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 || 'data'}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['UseMutationOptions', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'solid-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\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 {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} 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 </>\n ) : (\n <>\n <File.Import name={'fetch'} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n {!!hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\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 || 'data'}\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 || 'data'}\n />\n {options.query && (\n <>\n <File.Import name={['useQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'UseBaseQueryOptions', 'UseQueryResult']} 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 || 'data'}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,oBAAoB,qBAAuC;CACtE,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EACJ,SACA,SAAS,EAAE,aACT;EACJ,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,oBAAoB,UAAU;EAGvE,MAAM,aACJ,EAFc,CAAC,CAAC,QAAQ,SAAS,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO,KAGrG,WAAW,QAAQ,WAAW,QAAQ,SAAS,UAAU,EAAE,EAAE,QAAQ,QAAQ,QAAQ,MAAM,UAAU,EAAE,CAAC,CAAC,MAAM,WAAW,UAAU,WAAW,OAAO;EAExJ,MAAM,aAAa,QAAQ,WAAW,QAAQ,SAAS,aAAa;EAEpE,MAAM,WAAW;GACf,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAO,CAAC;GAC7D,UAAU,QAAQ,WAAW,EAAE,MAAM,QAAQ,CAAC;GAC9C,MAAM,QAAQ,WAAW,EAAE,QAAQ,OAAO,CAAC;GAC5C;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,CAAC;GAEvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,aAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;EAED,MAAM,MAAM;GACV,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,cAAc,EAAE,CAAC;GACxD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,cAAc;IAAE,MAAM;IAAY,CAAC;GACjF;EAED,MAAM,kBAAkB,CAAC,CAAC,cAAc,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