'use strict'; var chunkPBJIUPCN_cjs = require('./chunk-PBJIUPCN.cjs'); var chunkWOYQTGDC_cjs = require('./chunk-WOYQTGDC.cjs'); var path = require('path'); var core = require('@kubb/core'); var transformers = require('@kubb/core/transformers'); var pluginOas = require('@kubb/plugin-oas'); var pluginTs = require('@kubb/plugin-ts'); var pluginZod = require('@kubb/plugin-zod'); function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } var path__default = /*#__PURE__*/_interopDefault(path); var pluginReactQueryName = "plugin-react-query"; var pluginReactQuery = core.createPlugin((options) => { const { output = { path: "hooks", barrelType: "named" }, group, exclude = [], include, override = [], parser = "client", suspense = {}, infinite = false, transformers: transformers$1 = {}, paramsType = "inline", pathParamsType = "inline", generators = [chunkPBJIUPCN_cjs.queryGenerator, chunkPBJIUPCN_cjs.suspenseQueryGenerator, chunkPBJIUPCN_cjs.infiniteQueryGenerator, chunkPBJIUPCN_cjs.mutationGenerator].filter(Boolean), mutation = {}, query = {}, mutationKey = chunkWOYQTGDC_cjs.MutationKey.getTransformer, queryKey = chunkWOYQTGDC_cjs.QueryKey.getTransformer } = options; return { name: pluginReactQueryName, options: { output, client: { importPath: "@kubb/plugin-client/client", dataReturnType: "data", ...options.client }, infinite: infinite ? { queryParam: "id", initialPageParam: 0, cursorParam: void 0, ...infinite } : false, suspense, queryKey, query: query === false ? false : { methods: ["get"], importPath: "@tanstack/react-query", ...query }, mutationKey, mutation: { methods: ["post", "put", "patch", "delete"], importPath: "@tanstack/react-query", ...mutation }, paramsType, pathParamsType: paramsType === "object" ? "object" : pathParamsType, parser }, pre: [pluginOas.pluginOasName, pluginTs.pluginTsName, parser === "zod" ? pluginZod.pluginZodName : void 0].filter(Boolean), resolvePath(baseName, pathMode, options2) { const root = path__default.default.resolve(this.config.root, this.config.output.path); const mode = pathMode ?? core.FileManager.getMode(path__default.default.resolve(root, output.path)); if (options2?.tag && group?.type === "tag") { const groupName = group?.name ? group.name : (ctx) => `${ctx.group}Controller`; return path__default.default.resolve(root, output.path, groupName({ group: transformers.camelCase(options2.tag) }), baseName); } if (mode === "single") { return path__default.default.resolve(root, output.path); } return path__default.default.resolve(root, output.path, baseName); }, resolveName(name, type) { let resolvedName = transformers.camelCase(name); if (type === "file" || type === "function") { resolvedName = transformers.camelCase(name, { isFile: type === "file" }); } if (type === "type") { resolvedName = transformers.pascalCase(name); } if (type) { return transformers$1?.name?.(resolvedName, type) || resolvedName; } return resolvedName; }, async buildStart() { const [swaggerPlugin] = core.PluginManager.getDependedPlugins(this.plugins, [pluginOas.pluginOasName]); const oas = await swaggerPlugin.context.getOas(); const root = path__default.default.resolve(this.config.root, this.config.output.path); const mode = core.FileManager.getMode(path__default.default.resolve(root, output.path)); const baseURL = await swaggerPlugin.context.getBaseURL(); if (baseURL) { this.plugin.options.client.baseURL = baseURL; } const operationGenerator = new pluginOas.OperationGenerator(this.plugin.options, { oas, pluginManager: this.pluginManager, plugin: this.plugin, contentType: swaggerPlugin.context.contentType, exclude, include, override, mode }); const files = await operationGenerator.build(...generators); await this.addFile(...files); const barrelFiles = await this.fileManager.getBarrelFiles({ type: output.barrelType ?? "named", root, output, files: this.fileManager.files, meta: { pluginKey: this.plugin.key }, logger: this.logger }); await this.addFile(...barrelFiles); } }; }); exports.pluginReactQuery = pluginReactQuery; exports.pluginReactQueryName = pluginReactQueryName; //# sourceMappingURL=index.cjs.map //# sourceMappingURL=index.cjs.map