@ahoo-wang/fetcher-generator 3.15.9 → 3.16.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"aggregateResolver.d.ts","sourceRoot":"","sources":["../../src/aggregate/aggregateResolver.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EAKV,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAEV,wBAAwB,EAGzB,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,EACV,eAAe,EAAC,MAAM,UAAU,CAAC;AAiBnC;;;GAGG;AACH,qBAAa,iBAAiB;IAUhB,OAAO,CAAC,QAAQ,CAAC,OAAO;IATpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAGzB;IAEF;;;OAGG;gBAC0B,OAAO,EAAE,OAAO;IAK7C;;;OAGG;IACH,OAAO,CAAC,KAAK;IAUb;;;OAGG;IACH,OAAO,IAAI,wBAAwB;IAoBnC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe;IAoEvD;;;OAGG;IACH,KAAK,CAAC,SAAS,EAAE,SAAS;IAqB1B;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS;IAkD3B;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;CA4BnC"}
1
+ {"version":3,"file":"aggregateResolver.d.ts","sourceRoot":"","sources":["../../src/aggregate/aggregateResolver.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EAKV,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAEV,wBAAwB,EAGzB,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAiBhD;;;GAGG;AACH,qBAAa,iBAAiB;IAUhB,OAAO,CAAC,QAAQ,CAAC,OAAO;IATpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAGzB;IAEF;;;OAGG;gBAC0B,OAAO,EAAE,OAAO;IAK7C;;;OAGG;IACH,OAAO,CAAC,KAAK;IAUb;;;OAGG;IACH,OAAO,IAAI,wBAAwB;IAoBnC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe;IAoEvD;;;OAGG;IACH,KAAK,CAAC,SAAS,EAAE,SAAS;IAqB1B;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS;IAkD3B;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;CA4BnC"}
package/dist/cli.cjs CHANGED
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env node
2
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-_BvdpX41.cjs`);let t=require(`commander`);function n(){return t.program.name(`fetcher-generator`).description(`OpenAPI Specification TypeScript code generator for Wow`).version(e.i.version,`-v, --version`),t.program.command(`generate`).description(`Generate TypeScript code from OpenAPI specification`).requiredOption(`-i, --input <file>`,`Input OpenAPI specification file path or URL (http/https)`).option(`-o, --output <path>`,`Output directory path`,`src/generated`).option(`-c, --config <file>`,`Configuration file path`,e.n).option(`-t, --ts-config-file-path <file>`,`TypeScript configuration file path`).action(e.r),t.program}function r(){n().parse()}r(),exports.runCLI=r,exports.setupCLI=n;
2
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-BeMHvuFm.cjs`);let t=require(`commander`);var n=class{getTimestamp(){return new Date().toTimeString().slice(0,8)}info(e,...t){let n=this.getTimestamp();t.length>0?console.log(`[${n}] ℹ️ ${e}`,...t):console.log(`[${n}] ℹ️ ${e}`)}success(e,...t){let n=this.getTimestamp();t.length>0?console.log(`[${n}] ${e}`,...t):console.log(`[${n}] ${e}`)}error(e,...t){let n=this.getTimestamp();t.length>0?console.error(`[${n}] ❌ ${e}`,...t):console.error(`[${n}] ❌ ${e}`)}progress(e,t=0,...n){let r=this.getTimestamp(),i=` `.repeat(t);n.length>0?console.log(`[${r}] 🔄 ${i}${e}`,...n):console.log(`[${r}] 🔄 ${i}${e}`)}progressWithCount(e,t,n,r=0,...i){let a=this.getTimestamp(),o=` `.repeat(r),s=`[${e}/${t}]`;i.length>0?console.log(`[${a}] 🔄 ${o}${s} ${n}`,...i):console.log(`[${a}] 🔄 ${o}${s} ${n}`)}},r={name:`@ahoo-wang/fetcher-generator`,version:`3.16.1`,description:`A powerful TypeScript code generation tool that automatically generates type-safe API client code based on OpenAPI specifications. It is designed for general use cases and is also deeply optimized for the [Wow](https://github.com/Ahoo-Wang/Wow) Domain-Driven Design framework, providing native support for the CQRS architectural pattern.`,keywords:[`fetch`,`http`,`client`,`openapi`,`openapi3`,`swagger`,`generator`,`typescript`,`codegen`,`api`,`rest`],author:`Ahoo-Wang`,license:`Apache-2.0`,homepage:`https://github.com/Ahoo-Wang/fetcher/tree/master/packages/generator`,repository:{type:`git`,url:`https://github.com/Ahoo-Wang/fetcher.git`,directory:`packages/generator`},bugs:{url:`https://github.com/Ahoo-Wang/fetcher/issues`},type:`module`,engines:{node:`>=18.0.0`},main:`./dist/index.umd.js`,module:`./dist/index.es.js`,types:`./dist/index.d.ts`,bin:{"fetcher-generator":`./dist/cli.js`},exports:{".":{types:`./dist/index.d.ts`,import:`./dist/index.es.js`,require:`./dist/index.umd.js`}},files:[`dist`,`README.md`,`README.zh-CN.md`],sideEffects:!1,scripts:{build:`vite build`,"test:ui":`vitest --ui`,test:`vitest run --coverage --testTimeout=15000`,lint:`eslint . --fix`,clean:`rm -rf dist`,analyze:`npx vite-bundle-analyzer -p auto`,generate:`node dist/cli.js generate -i test/demo.spec.json -o test-output -t tsconfig.json`},peerDependencies:{"@ahoo-wang/fetcher":`workspace:^3.0.0`,"@ahoo-wang/fetcher-eventstream":`workspace:^3.0.0`,"@ahoo-wang/fetcher-decorator":`workspace:^3.0.0`,"@ahoo-wang/fetcher-openapi":`workspace:^3.0.0`,"@ahoo-wang/fetcher-wow":`workspace:^3.0.0`},dependencies:{"ts-morph":`catalog:`,commander:`catalog:`,yaml:`catalog:`},devDependencies:{"@eslint/js":`catalog:`,"@types/node":`catalog:`,"@vitest/coverage-v8":`catalog:`,"@vitest/ui":`catalog:`,eslint:`catalog:`,globals:`catalog:`,prettier:`catalog:`,typescript:`catalog:`,"typescript-eslint":`catalog:`,"unplugin-dts":`catalog:`,vite:`catalog:`,"vite-bundle-analyzer":`catalog:`,vitest:`catalog:`}};function i(e){if(!e)return!1;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return e.length>0}}async function a(t){let a=new n;process.on(`SIGINT`,()=>{a.error(`Generation interrupted by user`),process.exit(130)}),i(t.input)||(a.error(`Invalid input: must be a valid file path or HTTP/HTTPS URL`),process.exit(2));try{a.info(`Fetcher Generator v${r.version}`),a.info(`Starting code generation...`),await new e.t({inputPath:t.input,outputDir:t.output,configPath:t.config,tsConfigFilePath:t.tsConfigFilePath,logger:a}).generate(),a.success(`Code generation completed successfully! Files generated in: ${t.output}`)}catch(e){a.error(`Error during code generation:
3
+ `,e),process.exit(1)}}function o(){return t.program.name(`fetcher-generator`).description(`OpenAPI Specification TypeScript code generator for Wow`).version(r.version,`-v, --version`),t.program.command(`generate`).description(`Generate TypeScript code from OpenAPI specification`).requiredOption(`-i, --input <file>`,`Input OpenAPI specification file path or URL (http/https)`).option(`-o, --output <path>`,`Output directory path`,`src/generated`).option(`-c, --config <file>`,`Configuration file path`,e.n).option(`-t, --ts-config-file-path <file>`,`TypeScript configuration file path`).action(a),t.program}function s(){o().parse()}s(),exports.runCLI=s,exports.setupCLI=o;
3
4
  //# sourceMappingURL=cli.cjs.map
package/dist/cli.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI entry point for the Fetcher OpenAPI code generator.\n * Sets up the commander program with generate command and handles execution.\n */\n\nimport { program } from 'commander';\nimport packageJson from '../package.json';\nimport { DEFAULT_CONFIG_PATH } from './index';\nimport { generateAction } from './utils';\n\n/**\n * Sets up the CLI program with all commands and options.\n * @returns The configured commander program instance\n */\nexport function setupCLI() {\n program\n .name('fetcher-generator')\n .description('OpenAPI Specification TypeScript code generator for Wow')\n .version(packageJson.version, '-v, --version');\n\n program\n .command('generate')\n .description('Generate TypeScript code from OpenAPI specification')\n .requiredOption(\n '-i, --input <file>',\n 'Input OpenAPI specification file path or URL (http/https)',\n )\n .option('-o, --output <path>', 'Output directory path', 'src/generated')\n .option(\n '-c, --config <file>',\n 'Configuration file path',\n DEFAULT_CONFIG_PATH,\n )\n .option(\n '-t, --ts-config-file-path <file>',\n 'TypeScript configuration file path',\n )\n .action(generateAction);\n\n return program;\n}\n\n/**\n * Runs the CLI program by parsing command line arguments.\n * Only executes when this file is run directly (not imported).\n */\nexport function runCLI() {\n setupCLI().parse();\n}\n\nrunCLI();\n"],"mappings":";oIAgBA,SAAgB,GAAW,CAyBzB,OAxBA,EAAA,QACG,KAAK,oBAAoB,CACzB,YAAY,0DAA0D,CACtE,QAAQ,EAAA,EAAY,QAAS,gBAAgB,CAEhD,EAAA,QACG,QAAQ,WAAW,CACnB,YAAY,sDAAsD,CAClE,eACC,qBACA,4DACD,CACA,OAAO,sBAAuB,wBAAyB,gBAAgB,CACvE,OACC,sBACA,0BACA,EAAA,EACD,CACA,OACC,mCACA,qCACD,CACA,OAAO,EAAA,EAAe,CAElB,EAAA,QAOT,SAAgB,GAAS,CACvB,GAAU,CAAC,OAAO,CAGpB,GAAQ"}
1
+ {"version":3,"file":"cli.cjs","names":[],"sources":["../src/utils/logger.ts","../package.json","../src/utils/clis.ts","../src/cli.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from '../types';\n\n/**\n * Default console-based logger implementation.\n * Provides friendly colored output for different log levels.\n */\nexport class ConsoleLogger implements Logger {\n private getTimestamp(): string {\n return new Date().toTimeString().slice(0, 8); // HH:MM:SS format\n }\n\n info(message: string, ...params: any[]): void {\n const timestamp = this.getTimestamp();\n if (params.length > 0) {\n console.log(`[${timestamp}] ℹ️ ${message}`, ...params);\n } else {\n console.log(`[${timestamp}] ℹ️ ${message}`);\n }\n }\n\n success(message: string, ...params: any[]): void {\n const timestamp = this.getTimestamp();\n if (params.length > 0) {\n console.log(`[${timestamp}] ✅ ${message}`, ...params);\n } else {\n console.log(`[${timestamp}] ✅ ${message}`);\n }\n }\n\n error(message: string, ...params: any[]): void {\n const timestamp = this.getTimestamp();\n if (params.length > 0) {\n console.error(`[${timestamp}] ❌ ${message}`, ...params);\n } else {\n console.error(`[${timestamp}] ❌ ${message}`);\n }\n }\n\n progress(message: string, level = 0, ...params: any[]): void {\n const timestamp = this.getTimestamp();\n const indent = ' '.repeat(level);\n if (params.length > 0) {\n console.log(`[${timestamp}] 🔄 ${indent}${message}`, ...params);\n } else {\n console.log(`[${timestamp}] 🔄 ${indent}${message}`);\n }\n }\n\n progressWithCount(\n current: number,\n total: number,\n message: string,\n level = 0,\n ...params: any[]\n ): void {\n const timestamp = this.getTimestamp();\n const indent = ' '.repeat(level);\n const countStr = `[${current}/${total}]`;\n if (params.length > 0) {\n console.log(\n `[${timestamp}] 🔄 ${indent}${countStr} ${message}`,\n ...params,\n );\n } else {\n console.log(`[${timestamp}] 🔄 ${indent}${countStr} ${message}`);\n }\n }\n}\n\n/**\n * Silent logger that suppresses all output.\n */\nexport class SilentLogger implements Logger {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n info(_message: string, ...params: any[]): void {}\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n success(_message: string, ...params: any[]): void {}\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n error(_message: string, ...params: any[]): void {}\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n progress(_message: string, ...params: any[]): void {}\n\n /* eslint-disable @typescript-eslint/no-unused-vars */\n progressWithCount(\n _current: number,\n _total: number,\n _message: string,\n _level = 0,\n ..._params: any[]\n ): void {}\n\n /* eslint-enable @typescript-eslint/no-unused-vars */\n}\n","{\n \"name\": \"@ahoo-wang/fetcher-generator\",\n \"version\": \"3.16.1\",\n \"description\": \"A powerful TypeScript code generation tool that automatically generates type-safe API client code based on OpenAPI specifications. It is designed for general use cases and is also deeply optimized for the [Wow](https://github.com/Ahoo-Wang/Wow) Domain-Driven Design framework, providing native support for the CQRS architectural pattern.\",\n \"keywords\": [\n \"fetch\",\n \"http\",\n \"client\",\n \"openapi\",\n \"openapi3\",\n \"swagger\",\n \"generator\",\n \"typescript\",\n \"codegen\",\n \"api\",\n \"rest\"\n ],\n \"author\": \"Ahoo-Wang\",\n \"license\": \"Apache-2.0\",\n \"homepage\": \"https://github.com/Ahoo-Wang/fetcher/tree/master/packages/generator\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Ahoo-Wang/fetcher.git\",\n \"directory\": \"packages/generator\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/Ahoo-Wang/fetcher/issues\"\n },\n \"type\": \"module\",\n \"engines\": {\n \"node\": \">=18.0.0\"\n },\n \"main\": \"./dist/index.umd.js\",\n \"module\": \"./dist/index.es.js\",\n \"types\": \"./dist/index.d.ts\",\n \"bin\": {\n \"fetcher-generator\": \"./dist/cli.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.es.js\",\n \"require\": \"./dist/index.umd.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"README.md\",\n \"README.zh-CN.md\"\n ],\n \"sideEffects\": false,\n \"scripts\": {\n \"build\": \"vite build\",\n \"test:ui\": \"vitest --ui\",\n \"test\": \"vitest run --coverage --testTimeout=15000\",\n \"lint\": \"eslint . --fix\",\n \"clean\": \"rm -rf dist\",\n \"analyze\": \"npx vite-bundle-analyzer -p auto\",\n \"generate\": \"node dist/cli.js generate -i test/demo.spec.json -o test-output -t tsconfig.json\"\n },\n \"peerDependencies\": {\n \"@ahoo-wang/fetcher\": \"workspace:^3.0.0\",\n \"@ahoo-wang/fetcher-eventstream\": \"workspace:^3.0.0\",\n \"@ahoo-wang/fetcher-decorator\": \"workspace:^3.0.0\",\n \"@ahoo-wang/fetcher-openapi\": \"workspace:^3.0.0\",\n \"@ahoo-wang/fetcher-wow\": \"workspace:^3.0.0\"\n },\n \"dependencies\": {\n \"ts-morph\": \"catalog:\",\n \"commander\": \"catalog:\",\n \"yaml\": \"catalog:\"\n },\n \"devDependencies\": {\n \"@eslint/js\": \"catalog:\",\n \"@types/node\": \"catalog:\",\n \"@vitest/coverage-v8\": \"catalog:\",\n \"@vitest/ui\": \"catalog:\",\n \"eslint\": \"catalog:\",\n \"globals\": \"catalog:\",\n \"prettier\": \"catalog:\",\n \"typescript\": \"catalog:\",\n \"typescript-eslint\": \"catalog:\",\n \"unplugin-dts\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vite-bundle-analyzer\": \"catalog:\",\n \"vitest\": \"catalog:\"\n }\n}\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CodeGenerator } from '../index';\nimport type { GeneratorOptions } from '../types';\nimport { ConsoleLogger } from './logger';\nimport packageJson from '../../package.json';\n\n/**\n * Validates the input path or URL.\n * @param input - Input path or URL\n * @returns true if valid\n */\nexport function validateInput(input: string): boolean {\n if (!input) return false;\n\n // Check if it's a URL\n try {\n const url = new URL(input);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n // Not a URL, check if it's a file path\n // For file paths, we'll let parseOpenAPI handle it\n return input.length > 0;\n }\n}\n\n/**\n * Action handler for the generate command.\n * @param options - Command options\n */\nexport async function generateAction(options: {\n input: string;\n output: string;\n config?: string;\n tsConfigFilePath?: string;\n}) {\n const logger = new ConsoleLogger();\n\n // Handle signals\n process.on('SIGINT', () => {\n logger.error('Generation interrupted by user');\n process.exit(130);\n });\n\n // Validate input\n if (!validateInput(options.input)) {\n logger.error('Invalid input: must be a valid file path or HTTP/HTTPS URL');\n process.exit(2);\n }\n\n try {\n logger.info(`Fetcher Generator v${packageJson.version}`);\n logger.info('Starting code generation...');\n const generatorOptions: GeneratorOptions = {\n inputPath: options.input,\n outputDir: options.output,\n configPath: options.config,\n tsConfigFilePath: options.tsConfigFilePath,\n logger,\n };\n const codeGenerator = new CodeGenerator(generatorOptions);\n await codeGenerator.generate();\n logger.success(\n `Code generation completed successfully! Files generated in: ${options.output}`,\n );\n } catch (error) {\n logger.error(`Error during code generation: \\n`, error);\n process.exit(1);\n }\n}\n","#!/usr/bin/env node\n\n/**\n * CLI entry point for the Fetcher OpenAPI code generator.\n * Sets up the commander program with generate command and handles execution.\n */\n\nimport { program } from 'commander';\nimport packageJson from '../package.json';\nimport { DEFAULT_CONFIG_PATH } from './index';\nimport { generateAction } from './utils';\n\n/**\n * Sets up the CLI program with all commands and options.\n * @returns The configured commander program instance\n */\nexport function setupCLI() {\n program\n .name('fetcher-generator')\n .description('OpenAPI Specification TypeScript code generator for Wow')\n .version(packageJson.version, '-v, --version');\n\n program\n .command('generate')\n .description('Generate TypeScript code from OpenAPI specification')\n .requiredOption(\n '-i, --input <file>',\n 'Input OpenAPI specification file path or URL (http/https)',\n )\n .option('-o, --output <path>', 'Output directory path', 'src/generated')\n .option(\n '-c, --config <file>',\n 'Configuration file path',\n DEFAULT_CONFIG_PATH,\n )\n .option(\n '-t, --ts-config-file-path <file>',\n 'TypeScript configuration file path',\n )\n .action(generateAction);\n\n return program;\n}\n\n/**\n * Runs the CLI program by parsing command line arguments.\n * Only executes when this file is run directly (not imported).\n */\nexport function runCLI() {\n setupCLI().parse();\n}\n\nrunCLI();\n"],"mappings":";oIAmBA,IAAa,EAAb,KAA6C,CAC3C,cAA+B,CAC7B,OAAO,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,EAAG,EAAE,CAG9C,KAAK,EAAiB,GAAG,EAAqB,CAC5C,IAAM,EAAY,KAAK,cAAc,CACjC,EAAO,OAAS,EAClB,QAAQ,IAAI,IAAI,EAAU,QAAQ,IAAW,GAAG,EAAO,CAEvD,QAAQ,IAAI,IAAI,EAAU,QAAQ,IAAU,CAIhD,QAAQ,EAAiB,GAAG,EAAqB,CAC/C,IAAM,EAAY,KAAK,cAAc,CACjC,EAAO,OAAS,EAClB,QAAQ,IAAI,IAAI,EAAU,MAAM,IAAW,GAAG,EAAO,CAErD,QAAQ,IAAI,IAAI,EAAU,MAAM,IAAU,CAI9C,MAAM,EAAiB,GAAG,EAAqB,CAC7C,IAAM,EAAY,KAAK,cAAc,CACjC,EAAO,OAAS,EAClB,QAAQ,MAAM,IAAI,EAAU,MAAM,IAAW,GAAG,EAAO,CAEvD,QAAQ,MAAM,IAAI,EAAU,MAAM,IAAU,CAIhD,SAAS,EAAiB,EAAQ,EAAG,GAAG,EAAqB,CAC3D,IAAM,EAAY,KAAK,cAAc,CAC/B,EAAS,KAAK,OAAO,EAAM,CAC7B,EAAO,OAAS,EAClB,QAAQ,IAAI,IAAI,EAAU,OAAO,IAAS,IAAW,GAAG,EAAO,CAE/D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,sDAAsD,CAClE,eACC,qBACA,4DACD,CACA,OAAO,sBAAuB,wBAAyB,gBAAgB,CACvE,OACC,sBACA,0BACA,EAAA,EACD,CACA,OACC,mCACA,qCACD,CACA,OAAO,EAAe,CAElB,EAAA,QAOT,SAAgB,GAAS,CACvB,GAAU,CAAC,OAAO,CAGpB,GAAQ"}
package/dist/cli.js CHANGED
@@ -1,15 +1,149 @@
1
1
  #!/usr/bin/env node
2
- import { i as e, n as t, r as n } from "./src--JU4xGKu.js";
3
- import { program as r } from "commander";
2
+ import { n as e, t } from "./src-Drc8UO0Q.js";
3
+ import { program as n } from "commander";
4
+ //#region src/utils/logger.ts
5
+ var r = class {
6
+ getTimestamp() {
7
+ return (/* @__PURE__ */ new Date()).toTimeString().slice(0, 8);
8
+ }
9
+ info(e, ...t) {
10
+ let n = this.getTimestamp();
11
+ t.length > 0 ? console.log(`[${n}] ℹ️ ${e}`, ...t) : console.log(`[${n}] ℹ️ ${e}`);
12
+ }
13
+ success(e, ...t) {
14
+ let n = this.getTimestamp();
15
+ t.length > 0 ? console.log(`[${n}] ✅ ${e}`, ...t) : console.log(`[${n}] ✅ ${e}`);
16
+ }
17
+ error(e, ...t) {
18
+ let n = this.getTimestamp();
19
+ t.length > 0 ? console.error(`[${n}] ❌ ${e}`, ...t) : console.error(`[${n}] ❌ ${e}`);
20
+ }
21
+ progress(e, t = 0, ...n) {
22
+ let r = this.getTimestamp(), i = " ".repeat(t);
23
+ n.length > 0 ? console.log(`[${r}] 🔄 ${i}${e}`, ...n) : console.log(`[${r}] 🔄 ${i}${e}`);
24
+ }
25
+ progressWithCount(e, t, n, r = 0, ...i) {
26
+ let a = this.getTimestamp(), o = " ".repeat(r), s = `[${e}/${t}]`;
27
+ i.length > 0 ? console.log(`[${a}] 🔄 ${o}${s} ${n}`, ...i) : console.log(`[${a}] 🔄 ${o}${s} ${n}`);
28
+ }
29
+ }, i = {
30
+ name: "@ahoo-wang/fetcher-generator",
31
+ version: "3.16.1",
32
+ description: "A powerful TypeScript code generation tool that automatically generates type-safe API client code based on OpenAPI specifications. It is designed for general use cases and is also deeply optimized for the [Wow](https://github.com/Ahoo-Wang/Wow) Domain-Driven Design framework, providing native support for the CQRS architectural pattern.",
33
+ keywords: [
34
+ "fetch",
35
+ "http",
36
+ "client",
37
+ "openapi",
38
+ "openapi3",
39
+ "swagger",
40
+ "generator",
41
+ "typescript",
42
+ "codegen",
43
+ "api",
44
+ "rest"
45
+ ],
46
+ author: "Ahoo-Wang",
47
+ license: "Apache-2.0",
48
+ homepage: "https://github.com/Ahoo-Wang/fetcher/tree/master/packages/generator",
49
+ repository: {
50
+ type: "git",
51
+ url: "https://github.com/Ahoo-Wang/fetcher.git",
52
+ directory: "packages/generator"
53
+ },
54
+ bugs: { url: "https://github.com/Ahoo-Wang/fetcher/issues" },
55
+ type: "module",
56
+ engines: { node: ">=18.0.0" },
57
+ main: "./dist/index.umd.js",
58
+ module: "./dist/index.es.js",
59
+ types: "./dist/index.d.ts",
60
+ bin: { "fetcher-generator": "./dist/cli.js" },
61
+ exports: { ".": {
62
+ types: "./dist/index.d.ts",
63
+ import: "./dist/index.es.js",
64
+ require: "./dist/index.umd.js"
65
+ } },
66
+ files: [
67
+ "dist",
68
+ "README.md",
69
+ "README.zh-CN.md"
70
+ ],
71
+ sideEffects: !1,
72
+ scripts: {
73
+ build: "vite build",
74
+ "test:ui": "vitest --ui",
75
+ test: "vitest run --coverage --testTimeout=15000",
76
+ lint: "eslint . --fix",
77
+ clean: "rm -rf dist",
78
+ analyze: "npx vite-bundle-analyzer -p auto",
79
+ generate: "node dist/cli.js generate -i test/demo.spec.json -o test-output -t tsconfig.json"
80
+ },
81
+ peerDependencies: {
82
+ "@ahoo-wang/fetcher": "workspace:^3.0.0",
83
+ "@ahoo-wang/fetcher-eventstream": "workspace:^3.0.0",
84
+ "@ahoo-wang/fetcher-decorator": "workspace:^3.0.0",
85
+ "@ahoo-wang/fetcher-openapi": "workspace:^3.0.0",
86
+ "@ahoo-wang/fetcher-wow": "workspace:^3.0.0"
87
+ },
88
+ dependencies: {
89
+ "ts-morph": "catalog:",
90
+ commander: "catalog:",
91
+ yaml: "catalog:"
92
+ },
93
+ devDependencies: {
94
+ "@eslint/js": "catalog:",
95
+ "@types/node": "catalog:",
96
+ "@vitest/coverage-v8": "catalog:",
97
+ "@vitest/ui": "catalog:",
98
+ eslint: "catalog:",
99
+ globals: "catalog:",
100
+ prettier: "catalog:",
101
+ typescript: "catalog:",
102
+ "typescript-eslint": "catalog:",
103
+ "unplugin-dts": "catalog:",
104
+ vite: "catalog:",
105
+ "vite-bundle-analyzer": "catalog:",
106
+ vitest: "catalog:"
107
+ }
108
+ };
109
+ //#endregion
110
+ //#region src/utils/clis.ts
111
+ function a(e) {
112
+ if (!e) return !1;
113
+ try {
114
+ let t = new URL(e);
115
+ return t.protocol === "http:" || t.protocol === "https:";
116
+ } catch {
117
+ return e.length > 0;
118
+ }
119
+ }
120
+ async function o(e) {
121
+ let n = new r();
122
+ process.on("SIGINT", () => {
123
+ n.error("Generation interrupted by user"), process.exit(130);
124
+ }), a(e.input) || (n.error("Invalid input: must be a valid file path or HTTP/HTTPS URL"), process.exit(2));
125
+ try {
126
+ n.info(`Fetcher Generator v${i.version}`), n.info("Starting code generation..."), await new t({
127
+ inputPath: e.input,
128
+ outputDir: e.output,
129
+ configPath: e.config,
130
+ tsConfigFilePath: e.tsConfigFilePath,
131
+ logger: n
132
+ }).generate(), n.success(`Code generation completed successfully! Files generated in: ${e.output}`);
133
+ } catch (e) {
134
+ n.error("Error during code generation: \n", e), process.exit(1);
135
+ }
136
+ }
137
+ //#endregion
4
138
  //#region src/cli.ts
5
- function i() {
6
- return r.name("fetcher-generator").description("OpenAPI Specification TypeScript code generator for Wow").version(e.version, "-v, --version"), r.command("generate").description("Generate TypeScript code from OpenAPI specification").requiredOption("-i, --input <file>", "Input OpenAPI specification file path or URL (http/https)").option("-o, --output <path>", "Output directory path", "src/generated").option("-c, --config <file>", "Configuration file path", t).option("-t, --ts-config-file-path <file>", "TypeScript configuration file path").action(n), r;
139
+ function s() {
140
+ return n.name("fetcher-generator").description("OpenAPI Specification TypeScript code generator for Wow").version(i.version, "-v, --version"), n.command("generate").description("Generate TypeScript code from OpenAPI specification").requiredOption("-i, --input <file>", "Input OpenAPI specification file path or URL (http/https)").option("-o, --output <path>", "Output directory path", "src/generated").option("-c, --config <file>", "Configuration file path", e).option("-t, --ts-config-file-path <file>", "TypeScript configuration file path").action(o), n;
7
141
  }
8
- function a() {
9
- i().parse();
142
+ function c() {
143
+ s().parse();
10
144
  }
11
- a();
145
+ c();
12
146
  //#endregion
13
- export { a as runCLI, i as setupCLI };
147
+ export { c as runCLI, s as setupCLI };
14
148
 
15
149
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI entry point for the Fetcher OpenAPI code generator.\n * Sets up the commander program with generate command and handles execution.\n */\n\nimport { program } from 'commander';\nimport packageJson from '../package.json';\nimport { DEFAULT_CONFIG_PATH } from './index';\nimport { generateAction } from './utils';\n\n/**\n * Sets up the CLI program with all commands and options.\n * @returns The configured commander program instance\n */\nexport function setupCLI() {\n program\n .name('fetcher-generator')\n .description('OpenAPI Specification TypeScript code generator for Wow')\n .version(packageJson.version, '-v, --version');\n\n program\n .command('generate')\n .description('Generate TypeScript code from OpenAPI specification')\n .requiredOption(\n '-i, --input <file>',\n 'Input OpenAPI specification file path or URL (http/https)',\n )\n .option('-o, --output <path>', 'Output directory path', 'src/generated')\n .option(\n '-c, --config <file>',\n 'Configuration file path',\n DEFAULT_CONFIG_PATH,\n )\n .option(\n '-t, --ts-config-file-path <file>',\n 'TypeScript configuration file path',\n )\n .action(generateAction);\n\n return program;\n}\n\n/**\n * Runs the CLI program by parsing command line arguments.\n * Only executes when this file is run directly (not imported).\n */\nexport function runCLI() {\n setupCLI().parse();\n}\n\nrunCLI();\n"],"mappings":";;;;AAgBA,SAAgB,IAAW;AAyBzB,QAxBA,EACG,KAAK,oBAAoB,CACzB,YAAY,0DAA0D,CACtE,QAAQ,EAAY,SAAS,gBAAgB,EAEhD,EACG,QAAQ,WAAW,CACnB,YAAY,sDAAsD,CAClE,eACC,sBACA,4DACD,CACA,OAAO,uBAAuB,yBAAyB,gBAAgB,CACvE,OACC,uBACA,2BACA,EACD,CACA,OACC,oCACA,qCACD,CACA,OAAO,EAAe,EAElB;;AAOT,SAAgB,IAAS;AACvB,IAAU,CAAC,OAAO;;AAGpB,GAAQ"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/utils/logger.ts","../package.json","../src/utils/clis.ts","../src/cli.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from '../types';\n\n/**\n * Default console-based logger implementation.\n * Provides friendly colored output for different log levels.\n */\nexport class ConsoleLogger implements Logger {\n private getTimestamp(): string {\n return new Date().toTimeString().slice(0, 8); // HH:MM:SS format\n }\n\n info(message: string, ...params: any[]): void {\n const timestamp = this.getTimestamp();\n if (params.length > 0) {\n console.log(`[${timestamp}] ℹ️ ${message}`, ...params);\n } else {\n console.log(`[${timestamp}] ℹ️ ${message}`);\n }\n }\n\n success(message: string, ...params: any[]): void {\n const timestamp = this.getTimestamp();\n if (params.length > 0) {\n console.log(`[${timestamp}] ✅ ${message}`, ...params);\n } else {\n console.log(`[${timestamp}] ✅ ${message}`);\n }\n }\n\n error(message: string, ...params: any[]): void {\n const timestamp = this.getTimestamp();\n if (params.length > 0) {\n console.error(`[${timestamp}] ❌ ${message}`, ...params);\n } else {\n console.error(`[${timestamp}] ❌ ${message}`);\n }\n }\n\n progress(message: string, level = 0, ...params: any[]): void {\n const timestamp = this.getTimestamp();\n const indent = ' '.repeat(level);\n if (params.length > 0) {\n console.log(`[${timestamp}] 🔄 ${indent}${message}`, ...params);\n } else {\n console.log(`[${timestamp}] 🔄 ${indent}${message}`);\n }\n }\n\n progressWithCount(\n current: number,\n total: number,\n message: string,\n level = 0,\n ...params: any[]\n ): void {\n const timestamp = this.getTimestamp();\n const indent = ' '.repeat(level);\n const countStr = `[${current}/${total}]`;\n if (params.length > 0) {\n console.log(\n `[${timestamp}] 🔄 ${indent}${countStr} ${message}`,\n ...params,\n );\n } else {\n console.log(`[${timestamp}] 🔄 ${indent}${countStr} ${message}`);\n }\n }\n}\n\n/**\n * Silent logger that suppresses all output.\n */\nexport class SilentLogger implements Logger {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n info(_message: string, ...params: any[]): void {}\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n success(_message: string, ...params: any[]): void {}\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n error(_message: string, ...params: any[]): void {}\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n progress(_message: string, ...params: any[]): void {}\n\n /* eslint-disable @typescript-eslint/no-unused-vars */\n progressWithCount(\n _current: number,\n _total: number,\n _message: string,\n _level = 0,\n ..._params: any[]\n ): void {}\n\n /* eslint-enable @typescript-eslint/no-unused-vars */\n}\n","{\n \"name\": \"@ahoo-wang/fetcher-generator\",\n \"version\": \"3.16.1\",\n \"description\": \"A powerful TypeScript code generation tool that automatically generates type-safe API client code based on OpenAPI specifications. It is designed for general use cases and is also deeply optimized for the [Wow](https://github.com/Ahoo-Wang/Wow) Domain-Driven Design framework, providing native support for the CQRS architectural pattern.\",\n \"keywords\": [\n \"fetch\",\n \"http\",\n \"client\",\n \"openapi\",\n \"openapi3\",\n \"swagger\",\n \"generator\",\n \"typescript\",\n \"codegen\",\n \"api\",\n \"rest\"\n ],\n \"author\": \"Ahoo-Wang\",\n \"license\": \"Apache-2.0\",\n \"homepage\": \"https://github.com/Ahoo-Wang/fetcher/tree/master/packages/generator\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Ahoo-Wang/fetcher.git\",\n \"directory\": \"packages/generator\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/Ahoo-Wang/fetcher/issues\"\n },\n \"type\": \"module\",\n \"engines\": {\n \"node\": \">=18.0.0\"\n },\n \"main\": \"./dist/index.umd.js\",\n \"module\": \"./dist/index.es.js\",\n \"types\": \"./dist/index.d.ts\",\n \"bin\": {\n \"fetcher-generator\": \"./dist/cli.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.es.js\",\n \"require\": \"./dist/index.umd.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"README.md\",\n \"README.zh-CN.md\"\n ],\n \"sideEffects\": false,\n \"scripts\": {\n \"build\": \"vite build\",\n \"test:ui\": \"vitest --ui\",\n \"test\": \"vitest run --coverage --testTimeout=15000\",\n \"lint\": \"eslint . --fix\",\n \"clean\": \"rm -rf dist\",\n \"analyze\": \"npx vite-bundle-analyzer -p auto\",\n \"generate\": \"node dist/cli.js generate -i test/demo.spec.json -o test-output -t tsconfig.json\"\n },\n \"peerDependencies\": {\n \"@ahoo-wang/fetcher\": \"workspace:^3.0.0\",\n \"@ahoo-wang/fetcher-eventstream\": \"workspace:^3.0.0\",\n \"@ahoo-wang/fetcher-decorator\": \"workspace:^3.0.0\",\n \"@ahoo-wang/fetcher-openapi\": \"workspace:^3.0.0\",\n \"@ahoo-wang/fetcher-wow\": \"workspace:^3.0.0\"\n },\n \"dependencies\": {\n \"ts-morph\": \"catalog:\",\n \"commander\": \"catalog:\",\n \"yaml\": \"catalog:\"\n },\n \"devDependencies\": {\n \"@eslint/js\": \"catalog:\",\n \"@types/node\": \"catalog:\",\n \"@vitest/coverage-v8\": \"catalog:\",\n \"@vitest/ui\": \"catalog:\",\n \"eslint\": \"catalog:\",\n \"globals\": \"catalog:\",\n \"prettier\": \"catalog:\",\n \"typescript\": \"catalog:\",\n \"typescript-eslint\": \"catalog:\",\n \"unplugin-dts\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vite-bundle-analyzer\": \"catalog:\",\n \"vitest\": \"catalog:\"\n }\n}\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CodeGenerator } from '../index';\nimport type { GeneratorOptions } from '../types';\nimport { ConsoleLogger } from './logger';\nimport packageJson from '../../package.json';\n\n/**\n * Validates the input path or URL.\n * @param input - Input path or URL\n * @returns true if valid\n */\nexport function validateInput(input: string): boolean {\n if (!input) return false;\n\n // Check if it's a URL\n try {\n const url = new URL(input);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n // Not a URL, check if it's a file path\n // For file paths, we'll let parseOpenAPI handle it\n return input.length > 0;\n }\n}\n\n/**\n * Action handler for the generate command.\n * @param options - Command options\n */\nexport async function generateAction(options: {\n input: string;\n output: string;\n config?: string;\n tsConfigFilePath?: string;\n}) {\n const logger = new ConsoleLogger();\n\n // Handle signals\n process.on('SIGINT', () => {\n logger.error('Generation interrupted by user');\n process.exit(130);\n });\n\n // Validate input\n if (!validateInput(options.input)) {\n logger.error('Invalid input: must be a valid file path or HTTP/HTTPS URL');\n process.exit(2);\n }\n\n try {\n logger.info(`Fetcher Generator v${packageJson.version}`);\n logger.info('Starting code generation...');\n const generatorOptions: GeneratorOptions = {\n inputPath: options.input,\n outputDir: options.output,\n configPath: options.config,\n tsConfigFilePath: options.tsConfigFilePath,\n logger,\n };\n const codeGenerator = new CodeGenerator(generatorOptions);\n await codeGenerator.generate();\n logger.success(\n `Code generation completed successfully! Files generated in: ${options.output}`,\n );\n } catch (error) {\n logger.error(`Error during code generation: \\n`, error);\n process.exit(1);\n }\n}\n","#!/usr/bin/env node\n\n/**\n * CLI entry point for the Fetcher OpenAPI code generator.\n * Sets up the commander program with generate command and handles execution.\n */\n\nimport { program } from 'commander';\nimport packageJson from '../package.json';\nimport { DEFAULT_CONFIG_PATH } from './index';\nimport { generateAction } from './utils';\n\n/**\n * Sets up the CLI program with all commands and options.\n * @returns The configured commander program instance\n */\nexport function setupCLI() {\n program\n .name('fetcher-generator')\n .description('OpenAPI Specification TypeScript code generator for Wow')\n .version(packageJson.version, '-v, --version');\n\n program\n .command('generate')\n .description('Generate TypeScript code from OpenAPI specification')\n .requiredOption(\n '-i, --input <file>',\n 'Input OpenAPI specification file path or URL (http/https)',\n )\n .option('-o, --output <path>', 'Output directory path', 'src/generated')\n .option(\n '-c, --config <file>',\n 'Configuration file path',\n DEFAULT_CONFIG_PATH,\n )\n .option(\n '-t, --ts-config-file-path <file>',\n 'TypeScript configuration file path',\n )\n .action(generateAction);\n\n return program;\n}\n\n/**\n * Runs the CLI program by parsing command line arguments.\n * Only executes when this file is run directly (not imported).\n */\nexport function runCLI() {\n setupCLI().parse();\n}\n\nrunCLI();\n"],"mappings":";;;;AAmBA,IAAa,IAAb,MAA6C;CAC3C,eAA+B;AAC7B,0BAAO,IAAI,MAAM,EAAC,cAAc,CAAC,MAAM,GAAG,EAAE;;CAG9C,KAAK,GAAiB,GAAG,GAAqB;EAC5C,IAAM,IAAY,KAAK,cAAc;AACrC,EAAI,EAAO,SAAS,IAClB,QAAQ,IAAI,IAAI,EAAU,QAAQ,KAAW,GAAG,EAAO,GAEvD,QAAQ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SAAO,EAAM,SAAS;;;AAQ1B,eAAsB,EAAe,GAKlC;CACD,IAAM,IAAS,IAAI,GAAe;AASlC,CANA,QAAQ,GAAG,gBAAgB;AAEzB,EADA,EAAO,MAAM,iCAAiC,EAC9C,QAAQ,KAAK,IAAI;GACjB,EAGG,EAAc,EAAQ,MAAM,KAC/B,EAAO,MAAM,6DAA6D,EAC1E,QAAQ,KAAK,EAAE;AAGjB,KAAI;AAYF,EAXA,EAAO,KAAK,sBAAsB,EAAY,UAAU,EACxD,EAAO,KAAK,8BAA8B,EAS1C,MADsB,IAAI,EAPiB;GACzC,WAAW,EAAQ;GACnB,WAAW,EAAQ;GACnB,YAAY,EAAQ;GACpB,kBAAkB,EAAQ;GAC1B;GACD,CACwD,CACrC,UAAU,EAC9B,EAAO,QACL,+DAA+D,EAAQ,SACxE;UACM,GAAO;AAEd,EADA,EAAO,MAAM,oCAAoC,EAAM,EACvD,QAAQ,KAAK,EAAE;;;;;AC9DnB,SAAgB,IAAW;AAyBzB,QAxBA,EACG,KAAK,oBAAoB,CACzB,YAAY,0DAA0D,CACtE,QAAQ,EAAY,SAAS,gBAAgB,EAEhD,EACG,QAAQ,WAAW,CACnB,YAAY,sDAAsD,CAClE,eACC,sBACA,4DACD,CACA,OAAO,uBAAuB,yBAAyB,gBAAgB,CACvE,OACC,uBACA,2BACA,EACD,CACA,OACC,oCACA,qCACD,CACA,OAAO,EAAe,EAElB;;AAOT,SAAgB,IAAS;AACvB,IAAU,CAAC,OAAO;;AAGpB,GAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"commandClientGenerator.d.ts","sourceRoot":"","sources":["../../src/client/commandClientGenerator.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,gBAAgB,EAGhB,UAAU,EAAC,MAAM,UAAU,CAAC;AAI9B,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,eAAe,EAAE,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+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/client/decorators.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,gBAAgB,EAGhB,UAAU,EACX,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAC7D,eAAO,MAAM,qBAAqB,UAAuB,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,0BAA0B,iCAAiC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,uBAAuB,UAcnC,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,mBAAmB,EAAE,gBAGjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAGhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gCAAgC,0HAG3C,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,QAEtD;AACD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,QAExD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,MAAM,EAAO,EACtB,cAAc,GAAE,MAAM,EAAO,EAC7B,YAAY,CAAC,EAAE,MAAM,GACpB,gBAAgB,CAalB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,CAAC,EAAE,MAAM,QAerB;AAED,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAE7E,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,QAK1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"queryClientGenerator.d.ts","sourceRoot":"","sources":["../../src/client/queryClientGenerator.ts"],"names":[],"mappings":"AAaA,OAAO,KAA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1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-_BvdpX41.cjs`);exports.CodeGenerator=e.t,exports.DEFAULT_CONFIG_PATH=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-BeMHvuFm.cjs`);exports.CodeGenerator=e.t,exports.DEFAULT_CONFIG_PATH=e.n;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./src--JU4xGKu.js";
1
+ import { n as e, t } from "./src-Drc8UO0Q.js";
2
2
  export { t as CodeGenerator, e as DEFAULT_CONFIG_PATH };
@@ -1 +1 @@
1
- {"version":3,"file":"modelGenerator.d.ts","sourceRoot":"","sources":["../../src/model/modelGenerator.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAUzC;;;;;;;;GAQG;AACH,qBAAa,cAAe,YAAW,SAAS;aAClB,OAAO,EAAE,eAAe;gBAAxB,OAAO,EAAE,eAAe;IAGpD,OAAO,CAAC,qBAAqB;IAK7B;;;;;;;OAOG;IACH,QAAQ;IAuBR,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,WAAW;IAkCnB,OAAO,CAAC,sBAAsB,CAQ5B;IAEF,OAAO,CAAC,wBAAwB;IAehC;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,SAAS,EAAE,SAAS;IAYxC,sBAAsB,CAAC,YAAY,EAAE,MAAM;CAO5C"}
1
+ {"version":3,"file":"modelGenerator.d.ts","sourceRoot":"","sources":["../../src/model/modelGenerator.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAM1C;;;;;;;;GAQG;AACH,qBA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AM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM;IAkC/C,OAAO,CAAC,WAAW;IA0BnB,OAAO,CAAC,sBAAsB;IAoB9B,OAAO,CAAC,gBAAgB;IA2BxB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,mBAAmB;IA2B3B,OAAO,CAAC,gBAAgB;CAOzB"}
@@ -0,0 +1,19 @@
1
+ let e=require(`ts-morph`),t=require(`@ahoo-wang/fetcher`),n=require(`yaml`),r=require(`fs`),i=require(`path`),a=require(`@ahoo-wang/fetcher-wow`);var o=`#/components/`;`${o}`,`${o}`,`${o}`,`${o}`,`${o}`;function s(e){return e.$ref.split(`/`).pop()}function c(e,t){let n=s(e);return t.schemas?.[n]}function l(e,t){let n=s(e);return t.requestBodies?.[n]}function u(e,t){let n=s(e);return t.parameters?.[n]}function d(e,t){return{key:s(e),schema:c(e,t)}}var f=/[-_'\s./?;:,()[\]{}|\\]+/;function p(e){return e.split(f)}function m(e){return Array.isArray(e)?e.flatMap(e=>ee(p(e))):ee(p(e))}function ee(e){return e.flatMap(e=>{if(e.length===0)return[];let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r],a=/[A-Z]/.test(i),o=r>0&&/[a-z]/.test(e[r-1]);a&&o&&n?(t.push(n),n=i):n+=i}return n&&t.push(n),t})}function h(e){return e===``||e.length===0?``:m(e).filter(e=>e.length>0).map(e=>{let t=e.charAt(0),n=e.slice(1);return(/[a-zA-Z]/.test(t)?t.toUpperCase():t)+n.toLowerCase()}).join(``)}function g(e){let t=h(e);return t.charAt(0).toLowerCase()+t.slice(1)}function te(e){return e===``||Array.isArray(e)&&e.length===0?``:m(e).filter(e=>e.length>0).map(e=>e.toUpperCase()).join(`_`)}function _(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)?e:`'${e}'`}function ne(e){return/^\d+$/.test(e)?`NUM_${e}`:_(te(e))}function v(e){return!!(e&&typeof e==`object`&&`$ref`in e)}function y(e,t){if(t&&!v(t)&&t.content)return t.content[e]?.schema}function b(e){return y(t.ContentTypeValues.APPLICATION_JSON,e)}function re(e){return y(t.ContentTypeValues.TEXT_EVENT_STREAM,e)}function ie(e){return y(`*/*`,e)}var ae=[`string`,`number`,`integer`,`boolean`,`null`];function x(e){return Array.isArray(e)?!0:ae.includes(e)}function S(e){return Array.isArray(e.enum)&&e.enum.length>0}var oe=`x-enum-text`;function se(e){return e[oe]}function C(e){return e.type===`object`&&!!e.properties}function w(e){return e.type===`array`&&!!e.items}function ce(e){return Array.isArray(e.anyOf)&&e.anyOf.length>0}function le(e){return Array.isArray(e.oneOf)&&e.oneOf.length>0}function T(e){return Array.isArray(e.allOf)&&e.allOf.length>0}function ue(e){return ce(e)||le(e)||T(e)}function E(e){return e.includes(`|`)||e.includes(`&`)?`(${e})[]`:`${e}[]`}function D(e){return e.type===`object`&&!e.properties&&e.additionalProperties!==void 0}var de=`x-map-key-schema`;function fe(e){return e[de]}function pe(e){return e.type===`object`?e.properties?Object.keys(e.properties).length===0:!0:!1}function me(e){return e.readOnly===!0}function O(e){if(Array.isArray(e))return e.map(e=>O(e)).join(` | `);switch(e){case`string`:return`string`;case`number`:case`integer`:return`number`;case`boolean`:return`boolean`;case`null`:return`null`;default:return`any`}}function he(e){if(!C(e))return[];let t=e.required||[];return Object.keys(e.properties).filter(e=>!t.includes(e))}function ge(e,t){return e.operation.operationId&&t.operation.operationId?e.operation.operationId.localeCompare(t.operation.operationId):e.path&&t.path?e.path.localeCompare(t.path):e.method&&t.method?e.method.localeCompare(t.method):0}function k(e){let t=[];for(let[n,r]of Object.entries(e))A(r).forEach(e=>{t.push({method:e.method,operation:e.operation,path:n})});return t.sort(ge)}function A(e){return[{method:`get`,operation:e.get},{method:`put`,operation:e.put},{method:`post`,operation:e.post},{method:`delete`,operation:e.delete},{method:`options`,operation:e.options},{method:`head`,operation:e.head},{method:`patch`,operation:e.patch},{method:`trace`,operation:e.trace}].filter(({operation:e})=>e!==void 0)}function j(e){return e.responses[200]}function M(e){return b(j(e))}function _e(e,t){return e.parameters?e.parameters.map(e=>v(e)?u(e,t):e).filter(e=>e.in===`path`):[]}var ve=`string`;function N(e){return!e.schema||v(e.schema)||!e.schema.type||!x(e.schema.type)?ve:O(e.schema.type)}function P(e){return e.startsWith(`http://`)||e.startsWith(`https://`)?ye(e):be(e)}async function ye(e){return await(await fetch(e)).text()}function be(e){return new Promise((t,n)=>{(0,r.readFile)(e,`utf-8`,(e,r)=>{e?n(e):t(r)})})}async function xe(e){let t=await P(e);switch(I(t)){case F.JSON:return JSON.parse(t);case F.YAML:return(0,n.parse)(t);default:throw Error(`Unsupported file format: ${e}`)}}async function Se(e){let t=await P(e);switch(I(t)){case F.JSON:return JSON.parse(t);case F.YAML:return(0,n.parse)(t);default:throw Error(`Unsupported file format: ${e}`)}}var F=function(e){return e.JSON=`json`,e.YAML=`yaml`,e}({});function I(e){let t=e.trimStart();if(t.startsWith(`{`)||t.startsWith(`[`))return F.JSON;if(t.startsWith(`-`)||t.startsWith(`%YAML`))return F.YAML;try{return JSON.parse(t),F.JSON}catch{if(t.length>0)return F.YAML}throw Error(`Unable to infer file format`)}var L=`types.ts`,Ce=`@`;function we(e){return(0,t.combineURLs)(e.path,L)}function R(e,n,r){let i=(0,t.combineURLs)(n,r);return e.getSourceFile(i)||e.createSourceFile(i,``,{overwrite:!0})}function z(e,t,n){let r=e.getImportDeclaration(e=>e.getModuleSpecifierValue()===t);r||=e.addImportDeclaration({moduleSpecifier:t}),n.forEach(e=>{r.getNamedImports().some(t=>t.getName()===e)||r.addNamedImport(e)})}function B(e,t,n){if(n.path.startsWith(Ce)){z(e,n.path,[n.name]);return}let r=(0,i.relative)(e.getDirectoryPath(),(0,i.join)(t,n.path,L));r=r.replace(/\.ts$/,``),r=r.split(i.sep).join(`/`),r.startsWith(`.`)||(r=`./`+r),z(e,r,[n.name])}function Te(e,t,n,r){e.path!==r.path&&B(t,n,r)}function V(e,t=`
2
+ `){if(!Array.isArray(e))return;let n=e.filter(e=>typeof e==`string`&&e.length>0);return n.length>0?n.join(t):void 0}function H(e,t){let n=V(t);n&&e.addJsDoc(n)}function U(e,t){let n=[e.title,e.description];return t&&n.push(`- key: ${t}`),e.format&&n.push(`- format: ${e.format}`),W(n,e,`default`),W(n,e,`example`),Oe(n,e),ke(n,e),Ae(n,e),n}function Ee(e,t,n){H(e,U(t,n))}function De(e,t,n){let r=U(t,n);G(r,`schema`,t),H(e,r)}function W(e,t,n){let r=t[n];if(r){if(typeof r!=`object`){e.push(`- ${n}: \`${r}\``);return}G(e,n,r)}}function G(e,t,n){e.push(`- ${t}: `),e.push("```json"),e.push(JSON.stringify(n,null,2)),e.push("```")}function Oe(e,t){let n=[`- Numeric Constraints`];t.minimum!==void 0&&n.push(` - minimum: ${t.minimum}`),t.maximum!==void 0&&n.push(` - maximum: ${t.maximum}`),t.exclusiveMinimum!==void 0&&n.push(` - exclusiveMinimum: ${t.exclusiveMinimum}`),t.exclusiveMaximum!==void 0&&n.push(` - exclusiveMaximum: ${t.exclusiveMaximum}`),t.multipleOf!==void 0&&n.push(` - multipleOf: ${t.multipleOf}`),n.length!==1&&e.push(...n)}function ke(e,t){let n=[`- String Constraints`];t.minLength!==void 0&&n.push(` - minLength: ${t.minLength}`),t.maxLength!==void 0&&n.push(` - maxLength: ${t.maxLength}`),t.pattern!==void 0&&n.push(` - pattern: ${t.pattern}`),n.length!==1&&e.push(...n)}function Ae(e,t){let n=[`- Array Constraints`];t.minItems!==void 0&&n.push(` - minItems: ${t.minItems}`),t.maxItems!==void 0&&n.push(` - maxItems: ${t.maxItems}`),t.uniqueItems!==void 0&&n.push(` - uniqueItems: ${t.uniqueItems}`),n.length!==1&&e.push(...n)}function je(e){let t=e.split(`.`);return t.length!=2||t[0].length===0||t[1].length===0?null:t}function Me(e){let t=je(e.name);return t?{tag:e,contextAlias:t[0],aggregateName:t[1]}:null}function Ne(e){let t=e?.map(e=>Me(e)).filter(e=>e!==null);if(!t)return new Map;let n=new Map;return t.forEach(e=>{n.set(e.tag.name,{aggregate:e,commands:new Map,events:new Map})}),n}function Pe(e){if(!e)return null;let t=e.split(`.`);return t.length==3?t[2]:null}var Fe=`#/components/responses/wow.CommandOk`,Ie=`#/components/parameters/wow.id`,Le=class{aggregates;constructor(e){this.openAPI=e,this.aggregates=Ne(e.tags),this.build()}build(){let e=k(this.openAPI.paths);for(let t of e)this.commands(t.path,t),this.state(t.operation),this.events(t.operation),this.fields(t.operation)}resolve(){let e=new Map;for(let t of this.aggregates.values()){if(!t.state||!t.fields)continue;let n=t.aggregate.contextAlias,r=e.get(n);r||(r=new Set,e.set(n,r)),r.add(t)}return e}commands(e,n){let r=n.operation;if(r.operationId===`wow.command.send`)return;let i=Pe(r.operationId);if(!i)return;let a=j(r);if(!a||!v(a)||a.$ref!==Fe||!r.requestBody)return;let o=r.parameters??[],s=o.filter(e=>v(e)&&e.$ref===Ie).at(0),c=o.filter(e=>!v(e)&&e.in===`path`);if(s){let e=u(s,this.openAPI.components);c.push(e)}let l=r.requestBody.content[t.ContentTypeValues.APPLICATION_JSON].schema,f=d(l,this.openAPI.components);f.schema.title=f.schema.title||r.summary,f.schema.description=f.schema.description||r.description;let p={name:i,method:n.method,path:e,pathParameters:c,summary:r.summary,description:r.description,schema:f,operation:r};r.tags?.forEach(e=>{let t=this.aggregates.get(e);t&&t.commands.set(i,p)})}state(e){if(!e.operationId?.endsWith(`.snapshot_state.single`))return;let t=M(e);if(!v(t))return;let n=d(t,this.openAPI.components);e.tags?.forEach(e=>{let t=this.aggregates.get(e);t&&(t.state=n)})}events(e){if(!this.openAPI.components||!e.operationId?.endsWith(`.event.list_query`))return;let t=M(e);if(v(t))return;let n=t?.items;if(!v(n))return;let r=c(n,this.openAPI.components).properties.body.items.anyOf.map(e=>{let t=e.title,n=e.properties.name.const,r=e.properties.body,i=d(r,this.openAPI.components);return i.schema.title=i.schema.title||e.title,{title:t,name:n,schema:i}});e.tags?.forEach(e=>{let t=this.aggregates.get(e);t&&r.forEach(e=>{t.events.set(e.name,e)})})}fields(e){if(!this.openAPI.components||!e.operationId?.endsWith(`.snapshot.count`))return;let n=l(e.requestBody,this.openAPI.components).content[t.ContentTypeValues.APPLICATION_JSON].schema,r=c(n,this.openAPI.components).properties?.field,i=d(r,this.openAPI.components);e.tags?.forEach(e=>{let t=this.aggregates.get(e);t&&(t.fields=i)})}},K=`@ahoo-wang/fetcher-wow`,Re={"wow.command.CommandResult":`CommandResult`,"wow.command.CommandResultArray":`CommandResultArray`,"wow.MessageHeaderSqlType":`MessageHeaderSqlType`,"wow.api.BindingError":`BindingError`,"wow.api.DefaultErrorInfo":`ErrorInfo`,"wow.api.RecoverableType":`RecoverableType`,"wow.api.command.DefaultDeleteAggregate":`DeleteAggregate`,"wow.api.command.DefaultRecoverAggregate":`RecoverAggregate`,"wow.api.abac.DefaultApplyResourceTags":`ApplyResourceTags`,"wow.api.messaging.FunctionInfoData":`FunctionInfo`,"wow.api.messaging.FunctionKind":`FunctionKind`,"wow.api.modeling.AggregateId":`AggregateId`,"wow.api.query.Condition":`Condition`,"wow.api.query.ConditionOptions":`ConditionOptions`,"wow.api.query.ListQuery":`ListQuery`,"wow.api.query.Operator":`Operator`,"wow.api.query.PagedQuery":`PagedQuery`,"wow.api.query.Pagination":`Pagination`,"wow.api.query.Projection":`Projection`,"wow.api.query.Sort":`FieldSort`,"wow.api.query.Sort.Direction":`SortDirection`,"wow.api.query.DynamicDocument":`DynamicDocument`,"wow.api.query.DynamicDocumentArray":`DynamicDocumentArray`,"wow.command.CommandStage":`CommandStage`,"wow.command.SimpleWaitSignal":`WaitSignal`,"wow.configuration.Aggregate":`Aggregate`,"wow.configuration.BoundedContext":`BoundedContext`,"wow.configuration.WowMetadata":`WowMetadata`,"wow.modeling.DomainEvent":`DomainEvent`,"wow.openapi.BatchResult":`BatchResult`,"wow.messaging.CompensationTarget":`CompensationTarget`};function q(e){if(!e)return{name:``,path:`/`};let t=Re[e];if(t)return{name:t,path:K};let n=e.split(`.`),r=-1;for(let e=0;e<n.length;e++)if(n[e]&&/^[A-Z]/.test(n[e])){r=e;break}let i=n.slice(0,r),a=i.length>0?`/${i.join(`/`)}`:`/`;return{name:h(n.slice(r)),path:a}}function J(e){return q(s(e))}function Y(e){return`${te(e)}_BOUNDED_CONTEXT_ALIAS`}var ze=class{constructor(e,t,n,r){this.modelInfo=e,this.sourceFile=t,this.keySchema=n,this.outputDir=r}generate(){let e=this.process();e&&De(e,this.keySchema.schema,this.keySchema.key)}process(){let{schema:e}=this.keySchema;return S(e)?this.processEnum(e):C(e)?this.processInterface(e):w(e)?this.processArray(e):T(e)?this.processIntersection(e):ue(e)?this.processComposition(e):this.processTypeAlias(e)}resolveReference(e){let t=J(e);return Te(this.modelInfo,this.sourceFile,this.outputDir,t),t}resolveAdditionalProperties(e){return e.additionalProperties===void 0||e.additionalProperties===!1?``:e.additionalProperties===!0?`[key: string]: any`:`[key: string]: ${this.resolveType(e.additionalProperties)}`}resolvePropertyDefinitions(e){let{properties:t}=e;return Object.entries(t).map(([e,t])=>{let n=this.resolveType(t),r=_(e);if(!v(t)){let e=V(U(t),`
3
+ * `);if(e)return`
4
+ /**
5
+ * ${e}
6
+ */
7
+ ${r}: ${n}
8
+ `}return`${r}: ${n}`})}resolveObjectType(e){let t=[];if(C(e)){let n=this.resolvePropertyDefinitions(e);t.push(...n)}let n=this.resolveAdditionalProperties(e);return n&&t.push(n),t.length===0?`Record<string, any>`:`{\n ${t.join(`;
9
+ `)}; \n}`}resolveMapValueType(e){return e.additionalProperties===void 0||e.additionalProperties===!1||e.additionalProperties===!0?`any`:this.resolveType(e.additionalProperties)}resolveMapKeyType(e){let t=fe(e);return t?this.resolveType(t):`string`}resolveMapType(e){return`Record<${this.resolveMapKeyType(e)},${this.resolveMapValueType(e)}>`}resolveType(e){if(v(e))return this.resolveReference(e).name;if(D(e))return this.resolveMapType(e);if(e.const)return`'${e.const}'`;if(S(e))return e.enum.map(e=>`\`${e}\``).join(` | `);if(ue(e)){let t=(e.oneOf||e.anyOf||e.allOf||[]).map(e=>this.resolveType(e)),n=T(e)?` & `:` | `;return`(${t.join(n)})`}return w(e)?E(this.resolveType(e.items)):e.type===`object`?this.resolveObjectType(e):e.type?O(e.type):`any`}processEnum(e){let t=se(e);return t&&this.sourceFile.addEnum({name:this.modelInfo.name+`EnumText`,isExported:!0,members:Object.entries(t).map(([e,t])=>({name:ne(e),initializer:`\`${t}\``}))}),this.sourceFile.addEnum({name:this.modelInfo.name,isExported:!0,members:e.enum.filter(e=>typeof e==`string`&&e.length>0).map(e=>({name:ne(e),initializer:`\`${e}\``}))})}addPropertyToInterface(e,t,n){let r=this.resolveType(n),i=_(t),a=e.getProperty(i);a?a.setType(r):a=e.addProperty({name:i,type:r,isReadonly:me(n)}),Ee(a,n)}processInterface(e){let t=this.sourceFile.addInterface({name:this.modelInfo.name,isExported:!0}),n=e.properties||{};return Object.entries(n).forEach(([e,n])=>{this.addPropertyToInterface(t,e,n)}),e.additionalProperties&&t.addIndexSignature({keyName:`key`,keyType:`string`,returnType:this.resolveType(e.additionalProperties===!0?{}:e.additionalProperties)}).addJsDoc(`Additional properties`),t}processArray(e){let t=this.resolveType(e.items);return this.sourceFile.addTypeAlias({name:this.modelInfo.name,type:`Array<${t}>`,isExported:!0})}processComposition(e){return this.sourceFile.addTypeAlias({name:this.modelInfo.name,type:this.resolveType(e),isExported:!0})}processIntersection(e){let t=this.sourceFile.addInterface({name:this.modelInfo.name,isExported:!0});return e.allOf.forEach(e=>{if(v(e)){let n=this.resolveType(e);t.addExtends(n);return}C(e)&&Object.entries(e.properties).forEach(([e,n])=>{this.addPropertyToInterface(t,e,n)})}),t}processTypeAlias(e){return this.sourceFile.addTypeAlias({name:this.modelInfo.name,type:this.resolveType(e),isExported:!0})}},Be=class{constructor(e){this.context=e}getOrCreateSourceFile(e){let t=we(e);return this.context.getOrCreateSourceFile(t)}generate(){let e=this.context.openAPI.components?.schemas;if(!e){this.context.logger.info(`No schemas found in OpenAPI specification`);return}let t=this.stateAggregatedTypeNames(),n=this.filterSchemas(e,t);this.context.logger.progress(`Generating models for ${n.length} schemas`),n.forEach((e,t)=>{this.context.logger.progressWithCount(t+1,n.length,`Processing schema: ${e.key}`,2),this.generateKeyedSchema(e)}),this.context.logger.success(`Model generation completed`)}filterSchemas(e,t){return Object.entries(e).map(([e,t])=>({key:e,schema:t})).filter(e=>!this.isWowSchema(e.key,t))}isWowSchema(e,t){if(e!==`wow.api.query.PagedList`&&e.startsWith(`wow.api.query.`)&&e.endsWith(`PagedList`)||e.startsWith(`wow.api.query.Operator`)&&e.endsWith(`Map`))return!1;if(e.startsWith(`wow.`)||e.endsWith(`AggregatedCondition`)||e.endsWith(`AggregatedDomainEventStream`)||e.endsWith(`AggregatedDomainEventStreamPagedList`)||e.endsWith(`AggregatedDomainEventStreamServerSentEventNonNullData`)||e.endsWith(`AggregatedListQuery`)||e.endsWith(`AggregatedPagedQuery`)||e.endsWith(`AggregatedSingleQuery`))return!0;let n=q(e);return t.has(n.name)}aggregatedSchemaSuffix=[`MaterializedSnapshot`,`MaterializedSnapshotPagedList`,`MaterializedSnapshotServerSentEventNonNullData`,`PagedList`,`ServerSentEventNonNullData`,`Snapshot`,`StateEvent`];stateAggregatedTypeNames(){let e=new Set;for(let[t,n]of this.context.contextAggregates){this.generateBoundedContext(t);for(let t of n)this.aggregatedSchemaSuffix.forEach(n=>{let r=h(q(t.state.key).name)+n;e.add(r)})}return e}generateKeyedSchema(e){let t=q(e.key);new ze(t,this.getOrCreateSourceFile(t),e,this.context.outputDir).generate()}generateBoundedContext(e){let t=`${e}/boundedContext.ts`;this.context.logger.info(`Creating bounded context file: ${t}`);let n=this.context.getOrCreateSourceFile(t),r=Y(e);n.addStatements(`export const ${r} = '${e}';`)}},Ve=`@ahoo-wang/fetcher`,He=[`ResultExtractors`],Ue=`@ahoo-wang/fetcher-decorator`,We=[`type ApiMetadata`,`type ApiMetadataCapable`,`type ParameterRequest`,`api`,`get`,`post`,`put`,`patch`,`del`,`request`,`attribute`,`path`,`autoGeneratedError`],Ge={type:`Promise<Response>`,metadata:`{resultExtractor: ResultExtractors.Response }`},Ke={type:`Promise<string>`,metadata:`{resultExtractor: ResultExtractors.Text }`},X=`{
10
+ headers: { Accept: ContentTypeValues.TEXT_EVENT_STREAM },
11
+ resultExtractor: JsonEventStreamResultExtractor,
12
+ }`;function qe(e){z(e,Ve,He)}function Je(e){z(e,Ue,We)}function Z(e,t,n=[],r=[],i){return t.addClass({name:e,isExported:!0,typeParameters:r,extends:i,decorators:[{name:`api`,arguments:n}]})}function Ye(t,n){t.addImplements(`ApiMetadataCapable`),t.addConstructor({parameters:[{name:`apiMetadata`,type:`ApiMetadata`,hasQuestionToken:n===void 0,scope:e.Scope.Public,isReadonly:!0,initializer:n}]})}var Xe=`@ahoo-wang/fetcher-eventstream`;function Ze(e){z(e,Xe,[`JsonEventStreamResultExtractor`,`type JsonServerSentEventStream`])}function Qe(e){let t=0,n=0;return e.commands.forEach(e=>{e.path.startsWith(a.ResourceAttributionPathSpec.TENANT)&&(t+=1),e.path.startsWith(a.ResourceAttributionPathSpec.OWNER)&&(n+=1)}),t===0&&n===0?`ResourceAttributionPathSpec.NONE`:t>n?`ResourceAttributionPathSpec.TENANT`:`ResourceAttributionPathSpec.OWNER`}function $e(e,t,n,r){return R(e,t,`${n.contextAlias}/${n.aggregateName}/${r}.ts`)}function Q(e,t){return`${h(e.aggregateName)}${t}`}function $(e){return e===`delete`?`del`:e}var et=`x-fetcher-method`;function tt(e,t){let n=e[et];if(n)return n;if(!e.operationId)return;let r=p(e.operationId);for(let e=r.length-1;e>=0;e--){let n=g(r.slice(e));if(!t(n))return n}return g(r)}var nt=class{defaultParameterRequestType=`ParameterRequest`;defaultReturnType=Ge;apiMetadataCtorInitializer;constructor(e){this.context=e,this.apiMetadataCtorInitializer=this.context.currentContextAlias?`{basePath:${Y(this.context.currentContextAlias)}}`:void 0}generate(){this.context.logger.info(`Starting API client generation`);let e=this.resolveApiTags();this.context.logger.info(`Resolved ${e.size} API client tags: ${Array.from(e.keys()).join(`, `)}`);let t=this.groupOperations(e);this.context.logger.info(`Grouped operations into ${t.size} tag groups`),this.generateApiClients(e,t),this.context.logger.success(`API client generation completed`)}generateApiClients(e,t){this.context.logger.info(`Generating ${t.size} API client classes`);let n=0;for(let[r,i]of t){n++,this.context.logger.progressWithCount(n,t.size,`Generating API client for tag: ${r}`);let a=e.get(r);this.generateApiClient(a,i)}}createApiClientFile(e){let n=e.path;return this.context.currentContextAlias&&(n=(0,t.combineURLs)(this.context.currentContextAlias,n)),n=(0,t.combineURLs)(n,`${e.name}ApiClient.ts`),this.context.logger.info(`Creating API client file: ${n}`),this.context.getOrCreateSourceFile(n)}generateApiClient(e,t){let n=q(e.name);this.context.logger.info(`Generating API client class: ${n.name}ApiClient with ${t.size} operations`);let r=this.createApiClientFile(n);qe(r),Je(r),Ze(r);let i=Z(n.name+`ApiClient`,r);H(i,[e.description]),Ye(i,this.apiMetadataCtorInitializer),this.context.logger.info(`Processing ${t.size} operations for ${n.name}ApiClient`),t.forEach(t=>{this.processOperation(e,r,i,t)}),this.context.logger.success(`Completed API client: ${n.name}ApiClient`)}getMethodName(e,t){let n=tt(t,t=>e.getMethod(t)!==void 0);if(!n)throw Error(`Unable to resolve method name for apiClientClass:${e.getName()}.`);return n}resolveRequestType(e,t){if(!t.requestBody)return this.context.logger.info(`No request body found for operation ${t.operationId}, using default: ${this.defaultParameterRequestType}`),this.defaultParameterRequestType;let n;if(v(t.requestBody)?(this.context.logger.info(`Extracting request body from reference for operation: ${t.operationId}`),n=l(t.requestBody,this.context.openAPI.components)):n=t.requestBody,!n)return this.context.logger.info(`Request body extraction failed for operation ${t.operationId}, using default: ${this.defaultParameterRequestType}`),this.defaultParameterRequestType;if(n.content[`multipart/form-data`])return this.context.logger.info(`Detected multipart/form-data content for operation ${t.operationId}, using ParameterRequest<FormData>`),`ParameterRequest<FormData>`;if(n.content[`application/json`]){let r=n.content[`application/json`].schema;if(v(r)){let n=J(r);this.context.logger.info(`Adding import for request body model: ${n.name} from ${n.path}`),B(e,this.context.outputDir,n);let i=`ParameterRequest<${n.name}>`;return this.context.logger.info(`Resolved request type for operation ${t.operationId}: ${i}`),i}}return this.context.logger.info(`Using default request type for operation ${t.operationId}: ${this.defaultParameterRequestType}`),this.defaultParameterRequestType}resolveParameters(e,t,n){let r=_e(n,this.context.openAPI.components).filter(t=>!this.context.isIgnoreApiClientPathParameters(e.name,t.name));this.context.logger.info(`Found ${r.length} path parameters for operation ${n.operationId}`);let i=r.map(e=>{let t=N(e);return this.context.logger.info(`Adding path parameter: ${e.name} (type: ${t})`),{name:e.name,type:t,hasQuestionToken:!1,decorators:[{name:`path`,arguments:[`'${e.name}'`]}]}}),a=this.resolveRequestType(t,n);return this.context.logger.info(`Adding httpRequest parameter: ${a}`),i.push({name:`httpRequest`,hasQuestionToken:a===this.defaultParameterRequestType,type:`${a}`,decorators:[{name:`request`,arguments:[]}]}),this.context.logger.info(`Adding attributes parameter: Record<string, any>`),i.push({name:`attributes`,hasQuestionToken:!0,type:`Record<string, any>`,decorators:[{name:`attribute`,arguments:[]}]}),i}resolveType(e,t){if(v(t)){let n=J(t);return B(e,this.context.outputDir,n),n.name}if(w(t))return E(this.resolveType(e,t.items));if(D(t)){let n=t.additionalProperties;return typeof n==`boolean`?`Record<string, any>`:`Record<string, ${this.resolveType(e,n)}>`}return t.type&&x(t.type)?O(t.type):`any`}resolveSchemaReturnType(e,t){return`Promise<${this.resolveType(e,t)}>`}resolveReturnType(e,t){let n=j(t);if(!n)return this.context.logger.info(`No OK response found for operation ${t.operationId}, using default return type: ${this.defaultReturnType.type}`),this.defaultReturnType;let r=b(n)||ie(n);if(r){let n=this.resolveSchemaReturnType(e,r);return this.context.logger.info(`Resolved JSON/wildcard response return type for operation ${t.operationId}: ${n}`),{type:n,metadata:n===Ke.type?Ke.metadata:void 0}}let i=re(n);if(i){if(v(i)){let n=c(i,this.context.openAPI.components);if(w(n)&&v(n.items)){let r=J(n.items);this.context.logger.info(`Adding import for event stream model: ${r.name} from ${r.path}`),B(e,this.context.outputDir,r);let i=`Promise<JsonServerSentEventStream<${r.name.includes(`ServerSentEvent`)?`${r.name}['data']`:r.name}>>`;return this.context.logger.info(`Resolved event stream return type for operation ${t.operationId}: ${i}`),{type:i,metadata:X}}}let n=`Promise<JsonServerSentEventStream<any>>`;return this.context.logger.info(`Resolved generic event stream return type for operation ${t.operationId}: ${n}`),{type:n,metadata:X}}return this.context.logger.info(`Using default return type for operation ${t.operationId}: ${this.defaultReturnType.type}`),this.defaultReturnType}processOperation(e,t,n,r){this.context.logger.info(`Processing operation: ${r.operation.operationId} (${r.method} ${r.path})`);let i=this.getMethodName(n,r.operation);this.context.logger.info(`Generated method name: ${i}`);let a=this.resolveParameters(e,t,r.operation),o=this.resolveReturnType(t,r.operation),s=o.metadata?{name:$(r.method),arguments:[`'${r.path}'`,o.metadata]}:{name:$(r.method),arguments:[`'${r.path}'`]};this.context.logger.info(`Creating method with ${a.length} parameters, return type: ${o.type}`),H(n.addMethod({name:i,decorators:[s],parameters:a,returnType:o.type,statements:[`throw autoGeneratedError(${a.map(e=>e.name).join(`,`)});`]}),[r.operation.summary,r.operation.description,`- operationId: \`${r.operation.operationId}\``,`- path: \`${r.path}\``]),this.context.logger.success(`Operation method generated: ${i}`)}groupOperations(e){this.context.logger.info(`Grouping operations by API client tags`);let t=new Map,n=k(this.context.openAPI.paths).filter(t=>{if(!t.operation.operationId)return!1;let n=t.operation.tags;return!n||n.length==0?!1:n.every(t=>e.has(t))}),r=0;for(let e of n)e.operation.tags.forEach(n=>{t.has(n)||t.set(n,new Set),t.get(n).add(e),r++});return this.context.logger.info(`Grouped ${r} operations into ${t.size} tag groups`),t}shouldIgnoreTag(e){return e===`wow`||e===`Actuator`||this.isAggregateTag(e)}resolveApiTags(){this.context.logger.info(`Resolving API client tags from OpenAPI specification`);let e=new Map,t=this.context.openAPI.tags?.length||0;for(let t of Object.values(this.context.openAPI.paths))A(t).forEach(t=>{t.operation.tags?.forEach(t=>{!this.shouldIgnoreTag(t)&&!e.has(t)&&e.set(t,{name:t,description:``})})});let n=0;return this.context.openAPI.tags?.forEach(t=>{this.shouldIgnoreTag(t.name)?this.context.logger.info(`Excluded tag: ${t.name} (wow/Actuator/aggregate)`):(e.set(t.name,t),n++,this.context.logger.info(`Included API client tag: ${t.name}`))}),this.context.logger.info(`Resolved ${n} API client tags from ${t} total tags`),e}isAggregateTag(e){for(let t of this.context.contextAggregates.values())for(let n of t)if(n.aggregate.tag.name===e)return!0;return!1}},rt=class{commandEndpointPathsSuffix=`CommandEndpointPaths`;defaultCommandClientOptionsName=`DEFAULT_COMMAND_CLIENT_OPTIONS`;constructor(e){this.context=e}generate(){let e=Array.from(this.context.contextAggregates.values()).reduce((e,t)=>e+t.size,0);this.context.logger.info(`--- Generating Command Clients ---`),this.context.logger.progress(`Generating command clients for ${e} aggregates`);let t=0;for(let[,n]of this.context.contextAggregates)n.forEach(n=>{t++,this.context.logger.progressWithCount(t,e,`Processing command client for aggregate: ${n.aggregate.aggregateName}`),this.processAggregate(n)});this.context.logger.success(`Command client generation completed`)}processAggregate(t){this.context.logger.info(`Processing command client for aggregate: ${t.aggregate.aggregateName} in context: ${t.aggregate.contextAlias}`);let n=$e(this.context.project,this.context.outputDir,t.aggregate,`commandClient`);this.context.logger.info(`Processing command endpoint paths for ${t.commands.size} commands`);let r=this.processCommandEndpointPaths(n,t);this.processCommandTypes(n,t),this.context.logger.info(`Creating default command client options: ${this.defaultCommandClientOptionsName}`),n.addVariableStatement({declarationKind:e.VariableDeclarationKind.Const,declarations:[{name:this.defaultCommandClientOptionsName,type:`ApiMetadata`,initializer:`{
13
+ basePath: ${Y(t.aggregate.contextAlias)}
14
+ }`}],isExported:!1}),this.context.logger.info(`Adding imports from ${K}: CommandRequest, CommandResult, CommandResultEventStream, CommandBody, DeleteAggregateCommand, RecoverAggregateCommand`),n.addImportDeclaration({moduleSpecifier:K,namedImports:[`CommandRequest`,`CommandResult`,`CommandResultEventStream`,`CommandBody`,`DeleteAggregateCommand`,`RecoverAggregateCommand`],isTypeOnly:!0}),this.context.logger.info(`Adding import from @ahoo-wang/fetcher-eventstream: JsonEventStreamResultExtractor`),Ze(n),this.context.logger.info(`Adding import from @ahoo-wang/fetcher: ContentTypeValues`),z(n,`@ahoo-wang/fetcher`,[`ContentTypeValues`]),this.context.logger.info(`Adding imports from @ahoo-wang/fetcher-decorator: ApiMetadata types and decorators`),Je(n),this.context.logger.info(`Generating standard command client class`),this.processCommandClient(n,t,r),this.context.logger.info(`Generating stream command client class`),this.processStreamCommandClient(n,t),this.context.logger.success(`Command client generation completed for aggregate: ${t.aggregate.aggregateName}`)}resolveAggregateCommandEndpointPathsName(e){return Q(e,this.commandEndpointPathsSuffix)}processCommandEndpointPaths(e,t){let n=this.resolveAggregateCommandEndpointPathsName(t.aggregate);this.context.logger.info(`Creating command endpoint paths enum: ${n}`);let r=e.addEnum({name:n,isExported:!0});return t.commands.forEach(e=>{this.context.logger.info(`Adding command endpoint: ${e.name.toUpperCase()} = '${e.path}'`),r.addMember({name:e.name.toUpperCase(),initializer:`'${e.path}'`})}),this.context.logger.success(`Command endpoint paths enum created with ${t.commands.size} entries`),n}resolveCommandTypeName(e){let t=q(e.schema.key);return[t,t.name+`Command`]}resolveCommandType(e,t){let[n,r]=this.resolveCommandTypeName(t);if(n.path===`@ahoo-wang/fetcher-wow`)return;B(e,this.context.outputDir,n);let i=`${n.name}`,a=he(t.schema.schema).map(e=>`'${e}'`).join(` | `);a!==``&&(i=`PartialBy<${i},${a}>`),i=`CommandBody<${i}>`,e.addTypeAlias({name:r,type:`${i}`,isExported:!0})}processCommandTypes(e,t){t.commands.forEach(t=>{this.resolveCommandType(e,t)})}getEndpointPath(e,t){return`${e}.${t.name.toUpperCase()}`}processCommandClient(e,t,n){let r=Z(Q(t.aggregate,`CommandClient`),e,[],[`R = CommandResult`]);Ye(r,this.defaultCommandClientOptionsName),t.commands.forEach(e=>{this.processCommandMethod(t,r,e,n)})}processStreamCommandClient(e,t){let n=Q(t.aggregate,`CommandClient`);Z(Q(t.aggregate,`StreamCommandClient`),e,[`''`,X],[],`${n}<CommandResultEventStream>`).addConstructor({parameters:[{name:`apiMetadata`,type:`ApiMetadata`,initializer:this.defaultCommandClientOptionsName}],statements:`super(apiMetadata);`})}resolveParameters(e,t){let[n,r]=this.resolveCommandTypeName(t);this.context.logger.info(`Adding import for command model: ${n.name} from path: ${n.path}`);let i=t.pathParameters.filter(t=>!this.context.isIgnoreCommandClientPathParameters(e.name,t.name)).map(e=>{let t=N(e);return this.context.logger.info(`Adding path parameter: ${e.name} (type: ${t})`),{name:e.name,type:t,hasQuestionToken:!1,decorators:[{name:`path`,arguments:[`'${e.name}'`]}]}});return this.context.logger.info(`Adding command request parameter: commandRequest (type: CommandRequest<${r}>)`),i.push({name:`commandRequest`,hasQuestionToken:pe(t.schema.schema),type:`CommandRequest<${r}>`,decorators:[{name:`request`,arguments:[]}]}),this.context.logger.info(`Adding attributes parameter: attributes (type: Record<string, any>)`),i.push({name:`attributes`,hasQuestionToken:!0,type:`Record<string, any>`,decorators:[{name:`attribute`,arguments:[]}]}),i}processCommandMethod(e,t,n,r){this.context.logger.info(`Generating command method: ${g(n.name)} for command: ${n.name}`),this.context.logger.info(`Command method details: HTTP ${n.method}, path: ${n.path}`);let i=this.resolveParameters(e.aggregate.tag,n),a=t.addMethod({name:g(n.name),decorators:[{name:$(n.method),arguments:[`${this.getEndpointPath(r,n)}`]}],parameters:i,returnType:`Promise<R>`,statements:`throw autoGeneratedError(${i.map(e=>e.name).join(`,`)});`});this.context.logger.info(`Adding JSDoc documentation for method: ${g(n.name)}`),H(a,[n.summary,n.description,`- operationId: \`${n.operation.operationId}\``,`- path: \`${n.path}\``]),this.context.logger.success(`Command method generated: ${g(n.name)}`)}},it=class{domainEventTypeSuffix=`DomainEventType`;domainEventTypeMapTitleSuffix=`DomainEventTypeMapTitle`;constructor(e){this.context=e}generate(){let e=Array.from(this.context.contextAggregates.values()).reduce((e,t)=>e+t.size,0);this.context.logger.info(`--- Generating Query Clients ---`),this.context.logger.progress(`Generating query clients for ${e} aggregates`);let t=0;for(let[,n]of this.context.contextAggregates)n.forEach(n=>{t++,this.context.logger.progressWithCount(t,e,`Processing query client for aggregate: ${n.aggregate.aggregateName}`),this.processQueryClient(n)});this.context.logger.success(`Query client generation completed`)}createClientFilePath(e,t){return $e(this.context.project,this.context.outputDir,e,t)}processQueryClient(t){let n=this.createClientFilePath(t.aggregate,`queryClient`);this.context.logger.info(`Processing query client for aggregate: ${t.aggregate.aggregateName} in context: ${t.aggregate.contextAlias}`),this.context.logger.info(`Adding imports from ${K}: QueryClientFactory, QueryClientOptions, ResourceAttributionPathSpec`),n.addImportDeclaration({moduleSpecifier:K,namedImports:[`QueryClientFactory`,`QueryClientOptions`,`ResourceAttributionPathSpec`]});let r=`DEFAULT_QUERY_CLIENT_OPTIONS`;this.context.logger.info(`Creating default query client options: ${r}`),n.addVariableStatement({declarationKind:e.VariableDeclarationKind.Const,declarations:[{name:r,type:`QueryClientOptions`,initializer:`{
15
+ contextAlias: ${Y(t.aggregate.contextAlias)},
16
+ aggregateName: '${t.aggregate.aggregateName}',
17
+ resourceAttribution: ${Qe(t)},
18
+ }`}],isExported:!1}),this.processAggregateDomainEventTypes(t,n);let i=this.processAggregateDomainEventType(t,n),a=`${g(t.aggregate.aggregateName)}QueryClientFactory`,o=q(t.state.key),s=q(t.fields.key);this.context.logger.info(`Adding import for state model: ${o.name} from path: ${o.path}`),B(n,this.context.outputDir,o),this.context.logger.info(`Adding import for fields model: ${s.name} from path: ${s.path}`),B(n,this.context.outputDir,s),this.context.logger.info(`Creating query client factory: ${a}`),n.addVariableStatement({declarationKind:e.VariableDeclarationKind.Const,declarations:[{name:a,initializer:`new QueryClientFactory<${o.name}, ${s.name} | string, ${i}>(${r})`}],isExported:!0}),this.context.logger.success(`Query client generation completed for aggregate: ${t.aggregate.aggregateName}`)}processAggregateDomainEventType(e,t){let n=[];this.context.logger.info(`Processing ${e.events.size} domain events for aggregate: ${e.aggregate.aggregateName}`);for(let r of e.events.values()){let e=q(r.schema.key);this.context.logger.info(`Adding import for event model: ${e.name} from path: ${e.path}`),B(t,this.context.outputDir,e),n.push(e)}let r=Q(e.aggregate,this.domainEventTypeSuffix),i=n.map(e=>e.name).join(` | `);return this.context.logger.info(`Creating domain event types union: ${r} = ${i}`),t.addTypeAlias({isExported:!0,name:r,type:i}),r}processAggregateDomainEventTypes(e,t){let n=Q(e.aggregate,this.domainEventTypeMapTitleSuffix),r=t.addEnum({name:n,isExported:!0});for(let t of e.events.values())r.addMember({name:t.name,initializer:`'${t.title}'`})}},at=class{queryClientGenerator;commandClientGenerator;apiClientGenerator;constructor(e){this.context=e,this.queryClientGenerator=new it(e),this.commandClientGenerator=new rt(e),this.apiClientGenerator=new nt(e)}generate(){this.context.logger.info(`--- Generating Clients ---`),this.context.logger.progress(`Generating clients for ${this.context.contextAggregates.size} bounded contexts`);let e=0;for(let[t]of this.context.contextAggregates)e++,this.context.logger.progressWithCount(e,this.context.contextAggregates.size,`Processing bounded context: ${t}`,1);this.queryClientGenerator.generate(),this.commandClientGenerator.generate(),this.apiClientGenerator.generate(),this.context.logger.success(`Client generation completed`)}},ot=class{project;openAPI;outputDir;contextAggregates;logger;config;defaultIgnorePathParameters=[`tenantId`,`ownerId`];currentContextAlias;constructor(e){this.project=e.project,this.openAPI=e.openAPI,this.outputDir=e.outputDir,this.contextAggregates=e.contextAggregates,this.logger=e.logger,this.config=e.config??{},this.currentContextAlias=this.openAPI.info[`x-wow-context-alias`]}getOrCreateSourceFile(e){return R(this.project,this.outputDir,e)}isIgnoreApiClientPathParameters(e,t){return(this.config.apiClients?.[e]?.ignorePathParameters??this.defaultIgnorePathParameters).includes(t)}isIgnoreCommandClientPathParameters(e,t){return this.defaultIgnorePathParameters.includes(t)}},st=`./fetcher-generator.config.json`,ct=class{project;constructor(t){this.options=t,this.project=new e.Project(t),this.options.logger.info(`Project instance created with tsConfigFilePath: ${this.options.tsConfigFilePath}`)}async generate(){this.options.logger.info(`Starting code generation from OpenAPI specification`);let e=process.cwd();this.options.logger.info(`Work directory: ${e}`),this.options.logger.info(`Input path: ${this.options.inputPath}`),this.options.logger.info(`Output directory: ${this.options.outputDir}`),this.options.logger.info(`Parsing OpenAPI specification`);let t=await xe(this.options.inputPath);this.options.logger.info(`OpenAPI specification parsed successfully`),this.options.logger.info(`Resolving bounded context aggregates`);let n=new Le(t).resolve();this.options.logger.info(`Resolved ${n.size} bounded context aggregates`);let r=this.options.configPath??`./fetcher-generator.config.json`,i={};try{this.options.logger.info(`Parsing configuration file: ${r}`),i=await Se(r)}catch(e){this.options.logger.info(`Configuration file parsing failed: ${e}`)}let a=new ot({openAPI:t,project:this.project,outputDir:this.options.outputDir,contextAggregates:n,logger:this.options.logger,config:i});this.options.logger.info(`Generating models`),new Be(a).generate(),this.options.logger.info(`Models generated successfully`),this.options.logger.info(`Generating clients`),new at(a).generate(),this.options.logger.info(`Clients generated successfully`);let o=this.project.getDirectory(this.options.outputDir);if(!o){this.options.logger.info(`Output directory not found.`);return}this.options.logger.info(`Generating index files`),this.generateIndex(o),this.options.logger.info(`Index files generated successfully`),this.options.logger.info(`Optimizing source files`),this.optimizeSourceFiles(o),this.options.logger.info(`Source files optimized successfully`),this.options.logger.info(`Saving project to disk`),await this.project.save(),this.options.logger.info(`Code generation completed successfully`)}generateIndex(e){this.options.logger.info(`Generating index files for output directory: ${this.options.outputDir}`),this.processDirectory(e),this.generateIndexForDirectory(e),this.options.logger.info(`Index file generation completed`)}processDirectory(e){let t=e.getDirectories();this.options.logger.info(`Processing ${t.length} subdirectories`);for(let e of t)this.options.logger.info(`Processing subdirectory: ${e.getPath()}`),this.generateIndexForDirectory(e),this.processDirectory(e)}generateIndexForDirectory(e){let t=e.getPath();this.options.logger.info(`Generating index for directory: ${t}`);let n=e.getSourceFiles().filter(e=>e.getBaseName().endsWith(`.ts`)&&e.getBaseName()!==`index.ts`),r=e.getDirectories();if(this.options.logger.info(`Found ${n.length} TypeScript files and ${r.length} subdirectories in ${t}`),n.length===0&&r.length===0){this.options.logger.info(`No files or subdirectories to export in ${t}, skipping index generation`);return}let i=`${t}/index.ts`,a=this.project.getSourceFile(i)||this.project.createSourceFile(i,``,{overwrite:!0});a.removeText();for(let e of n){let t=`./${e.getBaseNameWithoutExtension()}`;a.addExportDeclaration({moduleSpecifier:t,isTypeOnly:!1,namedExports:[]})}for(let e of r){let t=`./${e.getBaseName()}`;a.addExportDeclaration({moduleSpecifier:t,isTypeOnly:!1,namedExports:[]})}this.options.logger.info(`Index file generated for ${t} with ${n.length+r.length} exports`)}optimizeSourceFiles(e){let t=e.getDescendantSourceFiles();this.options.logger.info(`Optimizing ${t.length} source files in ${e.getPath()}`),t.forEach((e,n)=>{this.options.logger.info(`Optimizing file [${e.getFilePath()}] - ${n+1}/${t.length}`),e.formatText(),e.organizeImports(),e.fixMissingImports()}),this.options.logger.info(`All source files optimized`)}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return st}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return ct}});
19
+ //# sourceMappingURL=src-BeMHvuFm.cjs.map