@acrool/rtk-query-codegen-openapi 1.1.2 → 1.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bin/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- var G=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var Ae=Object.prototype.hasOwnProperty;var k=(n,e)=>()=>(n&&(e=n(n=0)),e);var $e=(n,e)=>{for(var t in e)G(n,t,{get:e[t],enumerable:!0})},Se=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Te(e))!Ae.call(n,o)&&o!==t&&G(n,o,{get:()=>e[o],enumerable:!(r=Ce(e,o))||r.enumerable});return n};var Re=n=>Se(G({},"__esModule",{value:!0}),n);import{fileURLToPath as Ne}from"node:url";var Ee,l,c=k(()=>{"use strict";Ee=()=>Ne(import.meta.url),l=Ee()});var ie={};$e(ie,{argumentMatches:()=>Be,defaultIsDataResponse:()=>Qe,getOperationName:()=>S,getOverrides:()=>M,getTags:()=>_e,operationMatches:()=>oe});import{getOperationName as We}from"oazapfts/generate";function Qe(n,e){if(e&&n==="default")return!0;let t=Number(n);return!Number.isNaN(t)&&t>=200&&t<300}function S({verb:n,path:e}){return We(n,e,void 0)}function _e({verb:n,pathItem:e}){return n?e[n]?.tags||[]:[]}function ne(n){let e=Array.isArray(n)?n:[n];return function(r){return n?e.some(o=>typeof o=="string"?o===r:o?.test(r)):!0}}function oe(n){let e=typeof n=="function"?n:ne(n);return function(r){if(!n)return!0;let o=S(r);return e(o,r)}}function Be(n){let e=typeof n=="function"?n:ne(n);return function(r){if(!n||r.in==="path")return!0;let o=r.name;return e(o,r)}}function M(n,e){return e?.find(t=>oe(t.pattern)(n))}var K=k(()=>{"use strict";c()});c();import q from"commander";import{createRequire as tt}from"node:module";c();import we from"commander";import{createRequire as Fe}from"node:module";import{resolve as V}from"node:path";import{existsSync as D,rmSync as qe,readdirSync as Ie,statSync as Ge,mkdirSync as De}from"node:fs";import U from"node:path";var x=Fe(l);function je(n){let e=new Map;if(!D(n))return e;function t(r){try{let o=Ie(r);for(let i of o){let p=U.join(r,i);if(Ge(p).isDirectory())t(p);else if(i==="enhanceEndpoints.ts"){let u=x("node:fs").readFileSync(p);e.set(p,u)}}}catch{}}return t(n),e}function Me(n){for(let[e,t]of n)try{let r=U.dirname(e);D(r)||De(r,{recursive:!0}),x("node:fs").writeFileSync(e,t)}catch(r){console.warn(`Failed to restore ${e}:`,r)}}function W(n){let e=["/","/usr","/etc","/var","/home","/Users",".",".."],t=V(n);if(e.some(r=>t===V(r))&&(console.error(`Dangerous path detected: ${t}. Refusing to delete.`),process.exit(1)),D(n)){console.log(`Cleaning output directory: ${n}`);let r=je(n);qe(n,{recursive:!0,force:!0}),r.size>0&&(Me(r),console.log(`Protected ${r.size} enhanceEndpoints.ts file(s) from deletion`)),console.log(`Directory cleaned: ${n}`)}}function Q(){try{if(x.resolve("esbuild")&&x.resolve("esbuild-runner"))return x("esbuild-runner/register"),!0}catch{}try{if(x.resolve("typescript")&&x.resolve("ts-node"))return x("ts-node").register({transpileOnly:!0,compilerOptions:{target:"es6",module:"commonjs"}}),!0}catch{}return!1}function _(n){(!n||!/\.([mc]?(jsx?|tsx?)|jsonc?)?$/.test(n))&&(console.error("Please provide a valid configuration file."),we.help())}function B(n,e){/\.[mc]?tsx?$/.test(n)&&!e&&(console.error("Encountered a TypeScript config file, but neither esbuild-runner nor ts-node are installed."),process.exit(1))}import{dirname as rt,resolve as nt}from"node:path";c();c();import w from"node:path";import ye from"typescript";c();c();function C(n){return n.replace(n[0],n[0].toUpperCase())}c();import j from"node:fs";import Ke from"node:path";c();function z(n){try{new URL(n)}catch{return!1}return!0}async function L(n,e){if(!z(n))throw new Error(`remoteFile must be a valid URL: ${n}`);try{let t=Ke.dirname(e);j.existsSync(t)||await j.promises.mkdir(t,{recursive:!0});let r=await fetch(n);if(!r.ok)throw new Error(`Failed to download schema from ${n}: ${r.statusText}`);let o=await r.text();return await j.promises.writeFile(e,o,"utf-8"),console.log(`Schema downloaded from ${n} to ${e}`),e}catch(t){throw console.error(`Error downloading schema from ${n}:`,t),t}}c();c();var H=["get","put","post","delete","options","head","patch","trace"];function Z(n){return Object.entries(n.paths).flatMap(([e,t])=>t?Object.entries(t).filter(r=>H.includes(r[0])).map(([r,o])=>({path:e,verb:r,pathItem:t,operation:o})):[])}c();import ke from"@apidevtools/swagger-parser";import Ve from"swagger2openapi";async function Y(n,e){let t=await ke.bundle(n,{resolve:{http:e}});return"openapi"in t&&t.openapi.startsWith("3")?t:(await Ve.convertObj(t,{})).openapi}c();function J(n,e,t,r){return r?r(n,e):t?.type?t.type==="query":n==="get"}var T=class{docCache={};async getDocument(e,t){if(this.docCache[e])return this.docCache[e];let r=await Y(e,t);return this.docCache[e]=r,r}async downloadSchema(e,t){return L(e,t)}getPaths(e){return Object.keys(e.paths||{})}clearCache(){this.docCache={}}};c();import X from"lodash.camelcase";var A=class{groupPaths(e,t){let{groupKeyMatch:r,outputDir:o}=t,i=e.reduce((a,u)=>{let s=r(u),m=s?X(s):"_common";return a[m]||(a[m]=[]),a[m].push(u),a},{}),p={};for(let[a,u]of Object.entries(i))p[a]={groupKey:a,paths:u,outputPath:`${o}/${a}/query.service.ts`};return p}createGroupFilter(e,t){return(r,o)=>{let i=o.path,p=X(t.groupKeyMatch(i)||"");return p!==e&&(p||"_common")!==e?!1:t.filterEndpoint?t.filterEndpoint(r,i,e):!0}}};c();import re from"node:fs";import h from"node:path";c();import Ue from"node:path";import ee from"node:fs";async function te(n){let e=Ue.dirname(n);ee.existsSync(e)||await ee.promises.mkdir(e,{recursive:!0})}var $=class{async writeFile(e,t){try{let r=h.resolve(process.cwd(),e);return h.basename(r)==="enhanceEndpoints.ts"&&re.existsSync(r)?{path:r,success:!0}:(await te(r),re.writeFileSync(r,t),{path:r,success:!0})}catch(r){return{path:e,success:!1,error:r}}}async writeFiles(e){let t=[];for(let[r,o]of Object.entries(e)){let i=await this.writeFile(r,o);t.push(i)}return t}async writeGroupFiles(e,t){let r={};return t.types&&(r[h.join(e,"types.ts")]=t.types),t.queryService&&(r[h.join(e,"query.generated.ts")]=t.queryService),t.enhanceEndpoints&&(r[h.join(e,"enhanceEndpoints.ts")]=t.enhanceEndpoints),t.index&&(r[h.join(e,"index.ts")]=t.index),this.writeFiles(r)}async writeSharedFiles(e,t){let r={};return t.commonTypes&&(r[h.join(e,"common-types.ts")]=t.commonTypes),t.doNotModify&&(r[h.join(e,"DO_NOT_MODIFY.md")]=t.doNotModify),t.utils&&(r[h.join(e,"utils.ts")]=t.utils),this.writeFiles(r)}async writeSchemaFile(e,t){let r={};return r[h.join(e,"schema.ts")]=t,this.writeFiles(r)}};c();import ze from"oazapfts/generate";var R=class{constructor(e,t){this.v3Doc=e;this.apiGen=new ze(e,{unionUndefined:t.unionUndefined,mergeReadWriteOnly:t.mergeReadWriteOnly})}apiGen;initialize(){this.apiGen.spec.components?.schemas&&(Object.keys(this.apiGen.spec.components.schemas).forEach(e=>{let t=this.apiGen.spec.components.schemas[e];t&&typeof t=="object"&&"title"in t&&delete t.title}),this.apiGen.preprocessComponents(this.apiGen.spec.components.schemas),Object.keys(this.apiGen.spec.components.schemas).forEach(e=>{try{this.apiGen.getRefAlias({$ref:`#/components/schemas/${e}`})}catch{}}))}getOperationDefinitions(e){let{operationMatches:t}=(K(),Re(ie));return Z(this.v3Doc).filter(t(e))}getApiGenerator(){return this.apiGen}getDocument(){return this.v3Doc}getSchemaTypeNames(){return new Set}};c();function se(){return`/* eslint-disable */
2
+ var G=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var $e=Object.prototype.hasOwnProperty;var k=(n,e)=>()=>(n&&(e=n(n=0)),e);var Se=(n,e)=>{for(var t in e)G(n,t,{get:e[t],enumerable:!0})},Re=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ae(e))!$e.call(n,o)&&o!==t&&G(n,o,{get:()=>e[o],enumerable:!(r=Te(e,o))||r.enumerable});return n};var Ne=n=>Re(G({},"__esModule",{value:!0}),n);import{fileURLToPath as Ee}from"node:url";var we,l,c=k(()=>{"use strict";we=()=>Ee(import.meta.url),l=we()});var ie={};Se(ie,{argumentMatches:()=>ze,defaultIsDataResponse:()=>_e,getOperationName:()=>R,getOverrides:()=>M,getTags:()=>Be,operationMatches:()=>oe});import{getOperationName as Qe}from"oazapfts/generate";function _e(n,e){if(e&&n==="default")return!0;let t=Number(n);return!Number.isNaN(t)&&t>=200&&t<300}function R({verb:n,path:e}){return Qe(n,e,void 0)}function Be({verb:n,pathItem:e}){return n?e[n]?.tags||[]:[]}function ne(n){let e=Array.isArray(n)?n:[n];return function(r){return n?e.some(o=>typeof o=="string"?o===r:o?.test(r)):!0}}function oe(n){let e=typeof n=="function"?n:ne(n);return function(r){if(!n)return!0;let o=R(r);return e(o,r)}}function ze(n){let e=typeof n=="function"?n:ne(n);return function(r){if(!n||r.in==="path")return!0;let o=r.name;return e(o,r)}}function M(n,e){return e?.find(t=>oe(t.pattern)(n))}var K=k(()=>{"use strict";c()});c();import I from"commander";import{createRequire as rt}from"node:module";c();import Fe from"commander";import{createRequire as qe}from"node:module";import{resolve as V}from"node:path";import{existsSync as D,rmSync as Ie,readdirSync as Ge,statSync as De,mkdirSync as je}from"node:fs";import U from"node:path";var b=qe(l);function Me(n){let e=new Map;if(!D(n))return e;function t(r){try{let o=Ge(r);for(let i of o){let p=U.join(r,i);if(De(p).isDirectory())t(p);else if(i==="enhanceEndpoints.ts"){let u=b("node:fs").readFileSync(p);e.set(p,u)}}}catch{}}return t(n),e}function Ke(n){for(let[e,t]of n)try{let r=U.dirname(e);D(r)||je(r,{recursive:!0}),b("node:fs").writeFileSync(e,t)}catch(r){console.warn(`Failed to restore ${e}:`,r)}}function W(n){let e=["/","/usr","/etc","/var","/home","/Users",".",".."],t=V(n);if(e.some(r=>t===V(r))&&(console.error(`Dangerous path detected: ${t}. Refusing to delete.`),process.exit(1)),D(n)){console.log(`Cleaning output directory: ${n}`);let r=Me(n);Ie(n,{recursive:!0,force:!0}),r.size>0&&(Ke(r),console.log(`Protected ${r.size} enhanceEndpoints.ts file(s) from deletion`)),console.log(`Directory cleaned: ${n}`)}}function Q(){try{if(b.resolve("esbuild")&&b.resolve("esbuild-runner"))return b("esbuild-runner/register"),!0}catch{}try{if(b.resolve("typescript")&&b.resolve("ts-node"))return b("ts-node").register({transpileOnly:!0,compilerOptions:{target:"es6",module:"commonjs"}}),!0}catch{}return!1}function _(n){(!n||!/\.([mc]?(jsx?|tsx?)|jsonc?)?$/.test(n))&&(console.error("Please provide a valid configuration file."),Fe.help())}function B(n,e){/\.[mc]?tsx?$/.test(n)&&!e&&(console.error("Encountered a TypeScript config file, but neither esbuild-runner nor ts-node are installed."),process.exit(1))}import{dirname as nt,resolve as ot}from"node:path";c();c();import F from"node:path";import ye from"typescript";c();c();function T(n){return n.replace(n[0],n[0].toUpperCase())}c();import j from"node:fs";import ke from"node:path";c();function z(n){try{new URL(n)}catch{return!1}return!0}async function L(n,e){if(!z(n))throw new Error(`remoteFile must be a valid URL: ${n}`);try{let t=ke.dirname(e);j.existsSync(t)||await j.promises.mkdir(t,{recursive:!0});let r=await fetch(n);if(!r.ok)throw new Error(`Failed to download schema from ${n}: ${r.statusText}`);let o=await r.text();return await j.promises.writeFile(e,o,"utf-8"),console.log(`Schema downloaded from ${n} to ${e}`),e}catch(t){throw console.error(`Error downloading schema from ${n}:`,t),t}}c();c();var H=["get","put","post","delete","options","head","patch","trace"];function Z(n){return Object.entries(n.paths).flatMap(([e,t])=>t?Object.entries(t).filter(r=>H.includes(r[0])).map(([r,o])=>({path:e,verb:r,pathItem:t,operation:o})):[])}c();import Ve from"@apidevtools/swagger-parser";import Ue from"swagger2openapi";async function Y(n,e){let t=await Ve.bundle(n,{resolve:{http:e}});return"openapi"in t&&t.openapi.startsWith("3")?t:(await Ue.convertObj(t,{})).openapi}c();function J(n,e,t,r){return r?r(n,e):t?.type?t.type==="query":n==="get"}var A=class{docCache={};async getDocument(e,t){if(this.docCache[e])return this.docCache[e];let r=await Y(e,t);return this.docCache[e]=r,r}async downloadSchema(e,t){return L(e,t)}getPaths(e){return Object.keys(e.paths||{})}clearCache(){this.docCache={}}};c();import X from"lodash.camelcase";var $=class{groupPaths(e,t){let{groupKeyMatch:r,outputDir:o}=t,i=e.reduce((a,u)=>{let s=r(u),m=s?X(s):"_common";return a[m]||(a[m]=[]),a[m].push(u),a},{}),p={};for(let[a,u]of Object.entries(i))p[a]={groupKey:a,paths:u,outputPath:`${o}/${a}/query.service.ts`};return p}createGroupFilter(e,t){return(r,o)=>{let i=o.path,p=X(t.groupKeyMatch(i)||"");return p!==e&&(p||"_common")!==e?!1:t.filterEndpoint?t.filterEndpoint(r,i,e):!0}}};c();import re from"node:fs";import h from"node:path";c();import We from"node:path";import ee from"node:fs";async function te(n){let e=We.dirname(n);ee.existsSync(e)||await ee.promises.mkdir(e,{recursive:!0})}var S=class{async writeFile(e,t){try{let r=h.resolve(process.cwd(),e);return h.basename(r)==="enhanceEndpoints.ts"&&re.existsSync(r)?{path:r,success:!0}:(await te(r),re.writeFileSync(r,t),{path:r,success:!0})}catch(r){return{path:e,success:!1,error:r}}}async writeFiles(e){let t=[];for(let[r,o]of Object.entries(e)){let i=await this.writeFile(r,o);t.push(i)}return t}async writeGroupFiles(e,t){let r={};return t.types&&(r[h.join(e,"types.ts")]=t.types),t.queryService&&(r[h.join(e,"query.generated.ts")]=t.queryService),t.enhanceEndpoints&&(r[h.join(e,"enhanceEndpoints.ts")]=t.enhanceEndpoints),t.index&&(r[h.join(e,"index.ts")]=t.index),this.writeFiles(r)}async writeSharedFiles(e,t){let r={};return t.commonTypes&&(r[h.join(e,"common-types.ts")]=t.commonTypes),t.doNotModify&&(r[h.join(e,"DO_NOT_MODIFY.md")]=t.doNotModify),t.utils&&(r[h.join(e,"utils.ts")]=t.utils),this.writeFiles(r)}async writeSchemaFile(e,t){let r={};return r[h.join(e,"schema.ts")]=t,this.writeFiles(r)}};c();import Le from"oazapfts/generate";var N=class{constructor(e,t){this.v3Doc=e;this.apiGen=new Le(e,{unionUndefined:t.unionUndefined,mergeReadWriteOnly:t.mergeReadWriteOnly})}apiGen;initialize(){this.apiGen.spec.components?.schemas&&(Object.keys(this.apiGen.spec.components.schemas).forEach(e=>{let t=this.apiGen.spec.components.schemas[e];t&&typeof t=="object"&&"title"in t&&delete t.title}),this.apiGen.preprocessComponents(this.apiGen.spec.components.schemas),Object.keys(this.apiGen.spec.components.schemas).forEach(e=>{try{this.apiGen.getRefAlias({$ref:`#/components/schemas/${e}`})}catch{}}))}getOperationDefinitions(e){let{operationMatches:t}=(K(),Ne(ie));return Z(this.v3Doc).filter(t(e))}getApiGenerator(){return this.apiGen}getDocument(){return this.v3Doc}getSchemaTypeNames(){return new Set}};c();function se(){return`/* eslint-disable */
3
3
  // [Warning] Generated automatically - do not edit manually
4
4
 
5
5
  export interface RequestOptions {
@@ -20,7 +20,7 @@ export type IRestFulEndpointsQueryReturn<TVariables> = TVariables extends void ?
20
20
  variables: TVariables;
21
21
  fetchOptions?: IRequestConfig;
22
22
  };
23
- `}c();import d from"typescript";function Le(n){return n.charAt(0).toUpperCase()+n.slice(1)}function He(n,e,t){return d.transform(n,[r=>o=>d.visitNode(o,function i(p){return d.isIdentifier(p)&&p.text===e?d.factory.createIdentifier(t):d.visitEachChild(p,i,r)})]).transformed[0]}function ae(n){let e=d.createPrinter({newLine:d.NewLineKind.LineFeed}),t=d.createSourceFile("component-schema.ts","",d.ScriptTarget.Latest,!1,d.ScriptKind.TS),r=[],o={};return Object.entries(n).forEach(([i,p])=>{let a=Le(i);o[i]=a;let u=He(p,i,a),s=e.printNode(d.EmitHint.Unspecified,u,t);r.push(s)}),`/* eslint-disable */
23
+ `}c();import d from"typescript";function He(n){return n.charAt(0).toUpperCase()+n.slice(1)}function Ze(n,e,t){return d.transform(n,[r=>o=>d.visitNode(o,function i(p){return d.isIdentifier(p)&&p.text===e?d.factory.createIdentifier(t):d.visitEachChild(p,i,r)})]).transformed[0]}function ae(n){let e=d.createPrinter({newLine:d.NewLineKind.LineFeed}),t=d.createSourceFile("component-schema.ts","",d.ScriptTarget.Latest,!1,d.ScriptKind.TS),r=[],o={};return Object.entries(n).forEach(([i,p])=>{let a=He(i);o[i]=a;let u=Ze(p,i,a),s=e.printNode(d.EmitHint.Unspecified,u,t);r.push(s)}),`/* eslint-disable */
24
24
  // [Warning] Generated automatically - do not edit manually
25
25
 
26
26
  ${r.join(`
@@ -44,32 +44,34 @@ ${r.join(`
44
44
  \u9019\u4E9B\u6A94\u6848\u662F\u7531 @acrool/rtk-query-codegen-openapi \u7522\u751F\u5668\u6240\u5EFA\u7ACB\u3002
45
45
 
46
46
  \u5982\u6709\u7591\u554F\uFF0C\u8ACB\u53C3\u8003\u5C08\u6848\u6587\u4EF6\u6216\u806F\u7E6B\u958B\u767C\u5718\u968A\u3002
47
- `}c();import fe from"typescript";c();K();import{supportDeepObjects as Ze}from"oazapfts/generate";var N=class{constructor(e){this.options=e}extractEndpointInfos(e){return e.map(t=>this.extractSingleEndpointInfo(t))}extractSingleEndpointInfo(e){let{verb:t,path:r,operation:o}=e,{operationNameSuffix:i="",argSuffix:p="Req",responseSuffix:a="Res",queryMatch:u,endpointOverrides:s}=this.options,m=S({verb:t,path:r}),g=i?C(m+i):m,y=C(m+i+p),b=C(m+i+a),v=J(t,r,M(e,s),u),P=`${m.replace(/([A-Z])/g,"_$1").toUpperCase()}`,I=o.summary||`${t.toUpperCase()} ${r}`,{queryParams:Oe,pathParams:xe,isVoidArg:ve,hasRequestBody:be}=this.extractParameters(e),Pe=this.extractContentType(o);return{operationName:g,argTypeName:y,responseTypeName:b,isQuery:v,verb:t.toUpperCase(),path:r,queryKeyName:P,queryParams:Oe,pathParams:xe,isVoidArg:ve,summary:I,contentType:Pe,hasRequestBody:be}}extractParameters(e){let{operation:t,pathItem:r}=e,o=this.resolveArray(t.parameters),i=this.resolveArray(r.parameters).filter(g=>!o.some(y=>y.name===g.name&&y.in===g.in)),p=Ze([...i,...o]).filter(g=>g.in!=="header"),a=p.filter(g=>g.in==="query"),u=p.filter(g=>g.in==="path"),s=!!t.requestBody,m=a.length===0&&u.length===0&&!t.requestBody;return{queryParams:a,pathParams:u,isVoidArg:m,hasRequestBody:s}}resolveArray(e){return e?Array.isArray(e)?e:[e]:[]}extractContentType(e){if(!e.requestBody)return"application/json";let t=e.requestBody.content;if(!t||typeof t!="object")return"application/json";let r=Object.keys(t);return r.length===0?"application/json":r[0]}};c();var Ye=n=>n.charAt(0).toUpperCase()+n.slice(1);function ue(n,e,t,r){let o={};t&&Object.keys(t).forEach(s=>{if(o[s]=s,s.endsWith("Vo")){let m=s.slice(0,-2)+"VO";o[m]=s}if(s.endsWith("Dto")){let m=s.slice(0,-3)+"DTO";o[m]=s}});let i=`/* eslint-disable */
47
+ `}c();import ge from"typescript";c();K();import{supportDeepObjects as Ye}from"oazapfts/generate";var E=class{constructor(e){this.options=e}extractEndpointInfos(e){return e.map(t=>this.extractSingleEndpointInfo(t))}extractSingleEndpointInfo(e){let{verb:t,path:r,operation:o}=e,{operationNameSuffix:i="",argSuffix:p="Req",responseSuffix:a="Res",queryMatch:u,endpointOverrides:s}=this.options,m=R({verb:t,path:r}),f=i?T(m+i):m,y=T(m+i+p),C=T(m+i+a),P=J(t,r,M(e,s),u),v=`${m.replace(/([A-Z])/g,"_$1").toUpperCase()}`,x=o.summary||`${t.toUpperCase()} ${r}`,{queryParams:ve,pathParams:Oe,isVoidArg:xe,hasRequestBody:be}=this.extractParameters(e),Pe=this.extractContentType(o),Ce=Array.isArray(o.tags)?o.tags:[];return{operationName:f,argTypeName:y,responseTypeName:C,isQuery:P,verb:t.toUpperCase(),path:r,queryKeyName:v,queryParams:ve,pathParams:Oe,isVoidArg:xe,summary:x,contentType:Pe,hasRequestBody:be,tags:Ce}}extractParameters(e){let{operation:t,pathItem:r}=e,o=this.resolveArray(t.parameters),i=this.resolveArray(r.parameters).filter(f=>!o.some(y=>y.name===f.name&&y.in===f.in)),p=Ye([...i,...o]).filter(f=>f.in!=="header"),a=p.filter(f=>f.in==="query"),u=p.filter(f=>f.in==="path"),s=!!t.requestBody,m=a.length===0&&u.length===0&&!t.requestBody;return{queryParams:a,pathParams:u,isVoidArg:m,hasRequestBody:s}}resolveArray(e){return e?Array.isArray(e)?e:[e]:[]}extractContentType(e){if(!e.requestBody)return"application/json";let t=e.requestBody.content;if(!t||typeof t!="object")return"application/json";let r=Object.keys(t);return r.length===0?"application/json":r[0]}};c();var Je=n=>n.charAt(0).toUpperCase()+n.slice(1);function ue(n,e,t,r){let o={};t&&Object.keys(t).forEach(s=>{if(o[s]=s,s.endsWith("Vo")){let m=s.slice(0,-2)+"VO";o[m]=s}if(s.endsWith("Dto")){let m=s.slice(0,-3)+"DTO";o[m]=s}});let i=`/* eslint-disable */
48
48
  // [Warning] Generated automatically - do not edit manually
49
49
 
50
50
  `;t&&Object.keys(t).length>0&&(i+=`import * as Schema from "../schema";
51
51
  `),i+=`
52
- `;let a=[],u=[];return n.forEach(s=>{let m=s.argTypeName,g=s.responseTypeName;if(m){let y=Je(s,r,o);y.trim()===""?u.push(`export type ${m} = void;`,""):u.push(`export type ${m} = {`,y,"};","")}if(g){let y=Xe(s,r,o);y.trim()===""?u.push(`export type ${g} = void;`,""):u.push(`export type ${g} = {`,y,"};","")}}),u.length>0&&a.push(u.join(`
52
+ `;let a=[],u=[];return n.forEach(s=>{let m=s.argTypeName,f=s.responseTypeName;if(m){let y=Xe(s,r,o);y.trim()===""?u.push(`export type ${m} = void;`,""):u.push(`export type ${m} = {`,y,"};","")}if(f){let y=et(s,r,o);y.trim()===""?u.push(`export type ${f} = void;`,""):u.push(`export type ${f} = {`,y,"};","")}}),u.length>0&&a.push(u.join(`
53
53
  `)),a.length===0&&a.push("// \u6B64\u6A94\u6848\u7528\u65BC\u5B9A\u7FA9 API \u76F8\u95DC\u7684\u985E\u578B","// \u985E\u578B\u5B9A\u7FA9\u6703\u6839\u64DA OpenAPI Schema \u81EA\u52D5\u751F\u6210",""),i+a.join(`
54
54
 
55
- `)}function Je(n,e,t={}){let r=[];n.queryParams&&n.queryParams.length>0&&n.queryParams.forEach(i=>{let p=i.required?"":"?",a=ce(i,t);r.push(` ${i.name}${p}: ${a};`)}),n.pathParams&&n.pathParams.length>0&&n.pathParams.forEach(i=>{let p=i.required?"":"?",a=ce(i,t);r.push(` ${i.name}${p}: ${a};`)});let o=e?.find(i=>i.operation?.operationId===n.operationName||i.operation?.operationId===n.operationName.toLowerCase()||i.verb===n.verb.toLowerCase()&&i.path===n.path);if(o?.operation?.requestBody){let p=o.operation.requestBody.content,a=p["application/json"]||p["*/*"],u=p["multipart/form-data"]||p["application/x-www-form-urlencoded"];if(a?.schema){let s=O(a.schema,t,1);r.push(` body: ${s};`)}else if(u?.schema){let s=O(u.schema,t,1);r.push(` body: ${s};`)}else{let s=Object.values(p)[0];if(s?.schema){let m=O(s.schema,t,1);r.push(` body: ${m};`)}else r.push(" body?: any; // Request body from OpenAPI")}}return r.length===0?"":r.join(`
56
- `)}function Xe(n,e,t={}){let r=[],o=e?.find(i=>i.operation?.operationId===n.operationName||i.operation?.operationId===n.operationName.toLowerCase()||i.verb===n.verb.toLowerCase()&&i.path===n.path);if(o?.operation?.responses){let i=o.operation.responses[200]||o.operation.responses[201];if(i?.content){let p=i.content["application/json"]||i.content["*/*"]||Object.values(i.content)[0];if(p?.schema){let a=et(p.schema,t);r.push(...a)}else r.push(" // Success response from OpenAPI"),r.push(" data?: any;")}}return r.length===0?"":r.join(`
57
- `)}function et(n,e={}){let t=[];if(n.type==="object"&&n.properties){let r=n.required||[];Object.entries(n.properties).forEach(([o,i])=>{let a=r.includes(o)?"":"?",u=O(i,e,1),m=/[^a-zA-Z0-9_$]/.test(o)?`"${o}"`:o;i.description&&t.push(` /** ${i.description} */`),t.push(` ${m}${a}: ${u};`)})}return t}function O(n,e={},t=0){if(!n)return"any";if(n.$ref){let o=n.$ref;if(o.startsWith("#/components/schemas/")){let i=o.replace("#/components/schemas/",""),p=e[i]||i,u=`Schema.${Ye(p)}`;return n.nullable?`${u} | null`:u}}let r;switch(n.type){case"string":n.enum?r=n.enum.map(p=>`"${p}"`).join(" | "):n.format==="binary"?r="Blob":r="string";break;case"number":case"integer":r="number";break;case"boolean":r="boolean";break;case"array":let o=n.items?O(n.items,e,t):"any";r=o.includes("|")?`(${o})[]`:`${o}[]`;break;case"object":if(n.properties){let p=Object.entries(n.properties);if(p.length===0)n.additionalProperties?r=`Record<string, ${n.additionalProperties===!0?"any":O(n.additionalProperties,e,t)}>`:r="{}";else{let a=" ".repeat(t+1),u=" ".repeat(t),s=[];p.forEach(([m,g])=>{let b=(n.required||[]).includes(m)?"":"?",v=O(g,e,t+1),I=/[^a-zA-Z0-9_$]/.test(m)?`"${m}"`:m;g.description&&s.push(`${a}/** ${g.description} */`),s.push(`${a}${I}${b}: ${v};`)}),r=`{
55
+ `)}function Xe(n,e,t={}){let r=[];n.queryParams&&n.queryParams.length>0&&n.queryParams.forEach(i=>{let p=i.required?"":"?",a=ce(i,t);r.push(` ${i.name}${p}: ${a};`)}),n.pathParams&&n.pathParams.length>0&&n.pathParams.forEach(i=>{let p=i.required?"":"?",a=ce(i,t);r.push(` ${i.name}${p}: ${a};`)});let o=e?.find(i=>i.operation?.operationId===n.operationName||i.operation?.operationId===n.operationName.toLowerCase()||i.verb===n.verb.toLowerCase()&&i.path===n.path);if(o?.operation?.requestBody){let p=o.operation.requestBody.content,a=p["application/json"]||p["*/*"],u=p["multipart/form-data"]||p["application/x-www-form-urlencoded"];if(a?.schema){let s=O(a.schema,t,1);r.push(` body: ${s};`)}else if(u?.schema){let s=O(u.schema,t,1);r.push(` body: ${s};`)}else{let s=Object.values(p)[0];if(s?.schema){let m=O(s.schema,t,1);r.push(` body: ${m};`)}else r.push(" body?: any; // Request body from OpenAPI")}}return r.length===0?"":r.join(`
56
+ `)}function et(n,e,t={}){let r=[],o=e?.find(i=>i.operation?.operationId===n.operationName||i.operation?.operationId===n.operationName.toLowerCase()||i.verb===n.verb.toLowerCase()&&i.path===n.path);if(o?.operation?.responses){let i=o.operation.responses[200]||o.operation.responses[201];if(i?.content){let p=i.content["application/json"]||i.content["*/*"]||Object.values(i.content)[0];if(p?.schema){let a=tt(p.schema,t);r.push(...a)}else r.push(" // Success response from OpenAPI"),r.push(" data?: any;")}}return r.length===0?"":r.join(`
57
+ `)}function tt(n,e={}){let t=[];if(n.type==="object"&&n.properties){let r=n.required||[];Object.entries(n.properties).forEach(([o,i])=>{let a=r.includes(o)?"":"?",u=O(i,e,1),m=/[^a-zA-Z0-9_$]/.test(o)?`"${o}"`:o;i.description&&t.push(` /** ${i.description} */`),t.push(` ${m}${a}: ${u};`)})}return t}function O(n,e={},t=0){if(!n)return"any";if(n.$ref){let o=n.$ref;if(o.startsWith("#/components/schemas/")){let i=o.replace("#/components/schemas/",""),p=e[i]||i,u=`Schema.${Je(p)}`;return n.nullable?`${u} | null`:u}}let r;switch(n.type){case"string":n.enum?r=n.enum.map(p=>`"${p}"`).join(" | "):n.format==="binary"?r="Blob":r="string";break;case"number":case"integer":r="number";break;case"boolean":r="boolean";break;case"array":let o=n.items?O(n.items,e,t):"any";r=o.includes("|")?`(${o})[]`:`${o}[]`;break;case"object":if(n.properties){let p=Object.entries(n.properties);if(p.length===0)n.additionalProperties?r=`Record<string, ${n.additionalProperties===!0?"any":O(n.additionalProperties,e,t)}>`:r="{}";else{let a=" ".repeat(t+1),u=" ".repeat(t),s=[];p.forEach(([m,f])=>{let C=(n.required||[]).includes(m)?"":"?",P=O(f,e,t+1),x=/[^a-zA-Z0-9_$]/.test(m)?`"${m}"`:m;f.description&&s.push(`${a}/** ${f.description} */`),s.push(`${a}${x}${C}: ${P};`)}),r=`{
58
58
  ${s.join(`
59
59
  `)}
60
- ${u}}`}}else n.additionalProperties?r=`Record<string, ${n.additionalProperties===!0?"any":O(n.additionalProperties,e,t)}>`:r="any";break;default:r="any";break}return n.nullable?`${r} | null`:r}function ce(n,e={}){return n.schema?O(n.schema,e):"any"}c();function me(n,e){let{groupKey:t}=e,r=e.httpClient?.importReturnTypeName||e.httpClient?.importName||"IRestFulEndpointsQueryReturn",o=n.map(s=>{let m=s.isQuery?"query":"mutation",g=s.isVoidArg?"void":`${r}<${s.argTypeName}>`,y=s.path;s.pathParams&&s.pathParams.length>0?(s.pathParams.forEach(v=>{y=y.replace(`{${v.name}}`,`\${queryArg.variables.${v.name}}`)}),y="`"+y+"`"):y=`"${y}"`;let b="";return s.queryParams&&s.queryParams.length>0&&(b=`
60
+ ${u}}`}}else n.additionalProperties?r=`Record<string, ${n.additionalProperties===!0?"any":O(n.additionalProperties,e,t)}>`:r="any";break;default:r="any";break}return n.nullable?`${r} | null`:r}function ce(n,e={}){return n.schema?O(n.schema,e):"any"}c();function me(n,e){let{groupKey:t}=e,r=e.httpClient?.importReturnTypeName||e.httpClient?.importName||"IRestFulEndpointsQueryReturn",o=n.map(s=>{let m=s.isQuery?"query":"mutation",f=s.isVoidArg?"void":`${r}<${s.argTypeName}>`,y=s.path;s.pathParams&&s.pathParams.length>0?(s.pathParams.forEach(v=>{y=y.replace(`{${v.name}}`,`\${queryArg.variables.${v.name}}`)}),y="`"+y+"`"):y=`"${y}"`;let C="";s.queryParams&&s.queryParams.length>0&&(C=`
61
61
  params: {
62
- ${s.queryParams.map(P=>` ${P.name}: queryArg.variables.${P.name},`).join(`
62
+ ${s.queryParams.map(x=>` ${x.name}: queryArg.variables.${x.name},`).join(`
63
63
  `)}
64
- },`),` /** ${s.summary||s.operationName} */
64
+ },`);let P="";if(s.tags&&s.tags.length>0){let v=s.tags.map(x=>`"${x}"`).join(", ");s.isQuery?P=`
65
+ providesTags: [${v}],`:P=`
66
+ invalidatesTags: [${v}],`}return` /** ${s.summary||s.operationName} */
65
67
  ${s.operationName}: build.${m}<
66
68
  ${s.responseTypeName},
67
- ${g}
68
- >({
69
+ ${f}
70
+ >({${P}
69
71
  query: (queryArg) => ({
70
72
  url: ${y},
71
73
  method: "${s.verb.toUpperCase()}",
72
- contentType: "${s.contentType}",${b}${s.hasRequestBody?`
74
+ contentType: "${s.contentType}",${C}${s.hasRequestBody?`
73
75
  body: queryArg.variables.body,`:""}${s.isVoidArg?"":`
74
76
  fetchOptions: queryArg?.fetchOptions,`}
75
77
  }),
@@ -92,8 +94,8 @@ ${o}
92
94
  });
93
95
 
94
96
  export const {
95
- ${n.map(s=>{let m=s.operationName.charAt(0).toUpperCase()+s.operationName.slice(1);if(s.isQuery){let g=`use${m}Query`;if(e.useLazyQueries){let y=`useLazy${m}Query`;return` ${g},
96
- ${y},`}else return` ${g},`}else return` ${`use${m}Mutation`},`}).join(`
97
+ ${n.map(s=>{let m=s.operationName.charAt(0).toUpperCase()+s.operationName.slice(1);if(s.isQuery){let f=`use${m}Query`;if(e.useLazyQueries){let y=`useLazy${m}Query`;return` ${f},
98
+ ${y},`}else return` ${f},`}else return` ${`use${m}Mutation`},`}).join(`
97
99
  `)}
98
100
  } = injectedRtkApi;
99
101
 
@@ -116,13 +118,13 @@ ${o}
116
118
  });
117
119
 
118
120
  export default enhancedApi;
119
- `}var E=class{constructor(e,t){this.parserService=e;this.options=t;this.infoExtractor=new N(t)}infoExtractor;async generate(){let e=this.parserService.getOperationDefinitions(this.options.filterEndpoints),t=this.infoExtractor.extractEndpointInfos(e);return this.generateRtkQueryCode(t)}generateRtkQueryCode(e){let t=this.generateTypes(e),r=me(e,this.options),o=le(e,this.options),i=this.generateIndex();return{operationNames:e.map(a=>a.operationName),files:{types:t,queryService:r,index:i,enhanceEndpoints:o}}}generateTypes(e){let t={...this.options,apiConfiguration:this.options.apiConfiguration||{file:"@/store/webapi",importName:"WebApiConfiguration"}},o=this.parserService.getApiGenerator().aliases.reduce((p,a)=>{if(fe.isInterfaceDeclaration(a)||fe.isTypeAliasDeclaration(a)){let u=a.name.text;return{...p,[u]:a}}return p},{}),i=this.parserService.getOperationDefinitions(this.options.filterEndpoints);return ue(e,t,o,i)}generateIndex(){let e=this.options.groupKey||"";return`/* eslint-disable */
121
+ `}var w=class{constructor(e,t){this.parserService=e;this.options=t;this.infoExtractor=new E(t)}infoExtractor;async generate(){let e=this.parserService.getOperationDefinitions(this.options.filterEndpoints),t=this.infoExtractor.extractEndpointInfos(e);return this.generateRtkQueryCode(t)}generateRtkQueryCode(e){let t=this.generateTypes(e),r=me(e,this.options),o=le(e,this.options),i=this.generateIndex();return{operationNames:e.map(a=>a.operationName),files:{types:t,queryService:r,index:i,enhanceEndpoints:o}}}generateTypes(e){let t={...this.options,apiConfiguration:this.options.apiConfiguration||{file:"@/store/webapi",importName:"WebApiConfiguration"}},o=this.parserService.getApiGenerator().aliases.reduce((p,a)=>{if(ge.isInterfaceDeclaration(a)||ge.isTypeAliasDeclaration(a)){let u=a.name.text;return{...p,[u]:a}}return p},{}),i=this.parserService.getOperationDefinitions(this.options.filterEndpoints);return ue(e,t,o,i)}generateIndex(){let e=this.options.groupKey||"";return`/* eslint-disable */
120
122
  // [Warning] Generated automatically - do not edit manually
121
123
 
122
124
  export { default as ${e?`${e.charAt(0).toLowerCase()+e.slice(1)}Api`:"api"} } from "./enhanceEndpoints";
123
125
  export * from "./query.generated";
124
126
  export * from "./types";
125
- `}};c();function ge(){return`/* eslint-disable */
127
+ `}};c();function fe(){return`/* eslint-disable */
126
128
  // [Warning] Generated automatically - do not edit manually
127
129
 
128
130
  /**
@@ -135,10 +137,10 @@ export function withoutUndefined(obj?: Record<string, any>) {
135
137
  );
136
138
  }
137
139
 
138
- `}var F=class{_options;openApiService=new T;groupService=new A;fileWriterService=new $;openApiDoc=null;parserService=null;schemaInterfaces={};actualSchemaFile="";generatedContent={groups:[],commonTypes:"",componentSchema:"",doNotModify:"",utils:""};constructor(e){this._options=e}async generateAll(){return await this.prepare(),await this.generateApi(),this.generateCommonTypesContent(),this.generateSchemaContent(),this.generateUtilsContent(),this.generateDoNotModifyContent(),await this.release()}async prepare(){this.actualSchemaFile=this._options.schemaFile,this._options.remoteFile&&(this.actualSchemaFile=await this.openApiService.downloadSchema(this._options.remoteFile,this._options.schemaFile)),this.openApiDoc=await this.openApiService.getDocument(this.actualSchemaFile,this._options.httpResolverOptions),this.parserService=new R(this.openApiDoc,this._options),this.parserService.initialize();let e=this.parserService.getApiGenerator();this.schemaInterfaces=e.aliases.reduce((t,r)=>{if(ye.isInterfaceDeclaration(r)||ye.isTypeAliasDeclaration(r)){let o=r.name.text;return{...t,[o]:r}}return t},{})}async generateApi(){if(!this.openApiDoc||!this.parserService)throw new Error("\u8ACB\u5148\u8ABF\u7528 prepare() \u65B9\u6CD5");let e=this.openApiService.getPaths(this.openApiDoc),t=this.groupService.groupPaths(e,this._options.outputFiles);for(let r of Object.values(t))try{let o=await this.generateApiGroupContent(this._options,r);o.operationNames.length>0&&this.generatedContent.groups.push({groupKey:r.groupKey,outputPath:r.outputPath,content:o})}catch(o){throw new Error(`\u7FA4\u7D44 ${r.groupKey} \u751F\u6210\u5931\u6557: ${o}`)}}async generateCommonTypesContent(){this.generatedContent.commonTypes=se()}async generateSchemaContent(){this.generatedContent.componentSchema=ae(this.schemaInterfaces)}async generateDoNotModifyContent(){this.generatedContent.doNotModify=pe()}async generateUtilsContent(){this.generatedContent.utils=ge()}async release(){let e=[],t=[],r=[];try{for(let a of this.generatedContent.groups)try{if(a.content?.files){let u=w.dirname(a.outputPath),s=await this.fileWriterService.writeGroupFiles(u,{types:a.content.files.types,queryService:a.content.files.queryService,enhanceEndpoints:a.content.files.enhanceEndpoints,index:a.content.files.index});e.push(...s),r.push(a.groupKey)}}catch(u){t.push(new Error(`\u5BEB\u5165\u7FA4\u7D44 ${a.groupKey} \u5931\u6557: ${u}`))}let o=this.generatedContent.groups[0]?w.dirname(w.dirname(this.generatedContent.groups[0].outputPath)):"./generated";if(this.generatedContent.commonTypes||this.generatedContent.doNotModify||this.generatedContent.utils){let a=await this.fileWriterService.writeSharedFiles(o,{commonTypes:this.generatedContent.commonTypes||void 0,doNotModify:this.generatedContent.doNotModify||void 0,utils:this.generatedContent.utils||void 0});e.push(...a)}if(this.generatedContent.componentSchema){let a=await this.fileWriterService.writeSchemaFile(o,this.generatedContent.componentSchema);e.push(...a)}let i=this.generateMainIndex(r),p=await this.fileWriterService.writeFile(w.join(o,"index.ts"),i);e.push(p)}catch(o){t.push(o)}return{success:t.length===0,writtenFiles:e,errors:t,generatedGroups:r}}async generateApiGroupContent(e,t){let{outputFiles:r,...o}=e,i={...o,schemaFile:this.actualSchemaFile,outputFile:t.outputPath,sharedTypesFile:`${r.outputDir}/common-types.ts`,filterEndpoints:this.groupService.createGroupFilter(t.groupKey,r),queryMatch:r.queryMatch,groupKey:t.groupKey};if(!this.openApiDoc||!this.parserService)throw new Error("OpenAPI \u6587\u6A94\u672A\u521D\u59CB\u5316\uFF0C\u8ACB\u5148\u8ABF\u7528 prepare()");return await new E(this.parserService,i).generate()}generateMainIndex(e){return`/* eslint-disable */
140
+ `}var q=class{_options;openApiService=new A;groupService=new $;fileWriterService=new S;openApiDoc=null;parserService=null;schemaInterfaces={};actualSchemaFile="";generatedContent={groups:[],commonTypes:"",componentSchema:"",doNotModify:"",utils:""};constructor(e){this._options=e}async generateAll(){return await this.prepare(),await this.generateApi(),this.generateCommonTypesContent(),this.generateSchemaContent(),this.generateUtilsContent(),this.generateDoNotModifyContent(),await this.release()}async prepare(){this.actualSchemaFile=this._options.schemaFile,this._options.remoteFile&&(this.actualSchemaFile=await this.openApiService.downloadSchema(this._options.remoteFile,this._options.schemaFile)),this.openApiDoc=await this.openApiService.getDocument(this.actualSchemaFile,this._options.httpResolverOptions),this.parserService=new N(this.openApiDoc,this._options),this.parserService.initialize();let e=this.parserService.getApiGenerator();this.schemaInterfaces=e.aliases.reduce((t,r)=>{if(ye.isInterfaceDeclaration(r)||ye.isTypeAliasDeclaration(r)){let o=r.name.text;return{...t,[o]:r}}return t},{})}async generateApi(){if(!this.openApiDoc||!this.parserService)throw new Error("\u8ACB\u5148\u8ABF\u7528 prepare() \u65B9\u6CD5");let e=this.openApiService.getPaths(this.openApiDoc),t=this.groupService.groupPaths(e,this._options.outputFiles);for(let r of Object.values(t))try{let o=await this.generateApiGroupContent(this._options,r);o.operationNames.length>0&&this.generatedContent.groups.push({groupKey:r.groupKey,outputPath:r.outputPath,content:o})}catch(o){throw new Error(`\u7FA4\u7D44 ${r.groupKey} \u751F\u6210\u5931\u6557: ${o}`)}}async generateCommonTypesContent(){this.generatedContent.commonTypes=se()}async generateSchemaContent(){this.generatedContent.componentSchema=ae(this.schemaInterfaces)}async generateDoNotModifyContent(){this.generatedContent.doNotModify=pe()}async generateUtilsContent(){this.generatedContent.utils=fe()}async release(){let e=[],t=[],r=[];try{for(let a of this.generatedContent.groups)try{if(a.content?.files){let u=F.dirname(a.outputPath),s=await this.fileWriterService.writeGroupFiles(u,{types:a.content.files.types,queryService:a.content.files.queryService,enhanceEndpoints:a.content.files.enhanceEndpoints,index:a.content.files.index});e.push(...s),r.push(a.groupKey)}}catch(u){t.push(new Error(`\u5BEB\u5165\u7FA4\u7D44 ${a.groupKey} \u5931\u6557: ${u}`))}let o=this.generatedContent.groups[0]?F.dirname(F.dirname(this.generatedContent.groups[0].outputPath)):"./generated";if(this.generatedContent.commonTypes||this.generatedContent.doNotModify||this.generatedContent.utils){let a=await this.fileWriterService.writeSharedFiles(o,{commonTypes:this.generatedContent.commonTypes||void 0,doNotModify:this.generatedContent.doNotModify||void 0,utils:this.generatedContent.utils||void 0});e.push(...a)}if(this.generatedContent.componentSchema){let a=await this.fileWriterService.writeSchemaFile(o,this.generatedContent.componentSchema);e.push(...a)}let i=this.generateMainIndex(r),p=await this.fileWriterService.writeFile(F.join(o,"index.ts"),i);e.push(p)}catch(o){t.push(o)}return{success:t.length===0,writtenFiles:e,errors:t,generatedGroups:r}}async generateApiGroupContent(e,t){let{outputFiles:r,...o}=e,i={...o,schemaFile:this.actualSchemaFile,outputFile:t.outputPath,sharedTypesFile:`${r.outputDir}/common-types.ts`,filterEndpoints:this.groupService.createGroupFilter(t.groupKey,r),queryMatch:r.queryMatch,groupKey:t.groupKey};if(!this.openApiDoc||!this.parserService)throw new Error("OpenAPI \u6587\u6A94\u672A\u521D\u59CB\u5316\uFF0C\u8ACB\u5148\u8ABF\u7528 prepare()");return await new w(this.parserService,i).generate()}generateMainIndex(e){return`/* eslint-disable */
139
141
  // [Warning] Generated automatically - do not edit manually
140
142
 
141
143
  ${e.map(r=>`export * from "./${r}";`).join(`
142
144
  `)}
143
- `}};async function de(n){let t=await new F(n).generateAll();if(!t.success&&t.errors.length>0)throw t.errors[0]}var he=tt(l);async function ot(n){let e=nt(process.cwd(),n);process.chdir(rt(e));let t=he(e),r=t.default??t;"outputFiles"in r||(console.error('Configuration must include "outputFiles" property. Single file output is no longer supported.'),process.exit(1)),r.outputFiles&&r.outputFiles.outputDir&&W(r.outputFiles.outputDir);try{console.log("Generating multiple outputs..."),await de(r),console.log("Done")}catch(o){console.error("Generation failed:",o),process.exit(1)}}async function it(){let n=he("../../package.json"),e=Q();q.version(n.version).usage("<path/to/config.js>").parse(process.argv);let t=q.args[0];if(q.args.length===0){q.help();return}_(t),B(t,e),await ot(t)}it().catch(n=>{console.error("CLI execution failed:",n),process.exit(1)});export{ot as runGeneration};
145
+ `}};async function de(n){let t=await new q(n).generateAll();if(!t.success&&t.errors.length>0)throw t.errors[0]}var he=rt(l);async function it(n){let e=ot(process.cwd(),n);process.chdir(nt(e));let t=he(e),r=t.default??t;"outputFiles"in r||(console.error('Configuration must include "outputFiles" property. Single file output is no longer supported.'),process.exit(1)),r.outputFiles&&r.outputFiles.outputDir&&W(r.outputFiles.outputDir);try{console.log("Generating multiple outputs..."),await de(r),console.log("Done")}catch(o){console.error("Generation failed:",o),process.exit(1)}}async function st(){let n=he("../../package.json"),e=Q();I.version(n.version).usage("<path/to/config.js>").parse(process.argv);let t=I.args[0];if(I.args.length===0){I.help();return}_(t),B(t,e),await it(t)}st().catch(n=>{console.error("CLI execution failed:",n),process.exit(1)});export{it as runGeneration};
144
146
  //# sourceMappingURL=cli.mjs.map