@ahoo-wang/fetcher-generator 2.5.5 → 2.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -385,7 +385,8 @@ export class CartApiClient implements ApiMetadataCapable {
385
385
  The generated code is designed to work seamlessly with the Fetcher ecosystem:
386
386
 
387
387
  ```typescript
388
- import { Fetcher } from '@ahoo-wang/fetcher';
388
+ import { fetcher, Fetcher } from '@ahoo-wang/fetcher';
389
+ import { all } from '@ahoo-wang/fetcher-wow';
389
390
  import { cartQueryClientFactory } from './generated/example/cart/queryClient';
390
391
  import { CartCommandClient } from './generated/example/cart/commandClient';
391
392
  import { CartApiClient } from './generated/example/CartApiClient';
@@ -395,15 +396,12 @@ const fetcher = new Fetcher({
395
396
  baseURL: 'https://api.example.com',
396
397
  });
397
398
 
398
- // Register the fetcher (if using named fetchers)
399
- Fetcher.register('api', fetcher);
400
-
401
399
  // Use the generated query client factory
402
- const queryClient = cartQueryClientFactory.createQueryClient();
403
- const cartState = await queryClient.loadAggregate('cart-id');
400
+ const snapshotClient = cartQueryClientFactory.createSnapshotQueryClient({ fetcher: fetcher });
401
+ const cartState = await snapshotClient.singleState({ condition: all() });
404
402
 
405
403
  // Use the generated command client
406
- const commandClient = new CartCommandClient();
404
+ const commandClient = new CartCommandClient({ fetcher: fetcher });
407
405
  const result = await commandClient.addCartItem(
408
406
  {
409
407
  command: {
@@ -417,7 +415,7 @@ const result = await commandClient.addCartItem(
417
415
  );
418
416
 
419
417
  // Use the generated API client for custom endpoints (based on OpenAPI tag "cart")
420
- const apiClient = new CartApiClient();
418
+ const apiClient = new CartApiClient({ fetcher: fetcher });
421
419
  const cartData = await apiClient.me();
422
420
  ```
423
421
 
package/README.zh-CN.md CHANGED
@@ -378,6 +378,7 @@ export class CartApiClient implements ApiMetadataCapable {
378
378
 
379
379
  ```typescript
380
380
  import { Fetcher } from '@ahoo-wang/fetcher';
381
+ import { all } from '@ahoo-wang/fetcher-wow';
381
382
  import { cartQueryClientFactory } from './generated/example/cart/queryClient';
382
383
  import { CartCommandClient } from './generated/example/cart/commandClient';
383
384
  import { CartApiClient } from './generated/example/CartApiClient';
@@ -387,15 +388,12 @@ const fetcher = new Fetcher({
387
388
  baseURL: 'https://api.example.com',
388
389
  });
389
390
 
390
- // 注册 fetcher(如果使用命名 fetcher)
391
- Fetcher.register('api', fetcher);
392
-
393
391
  // 使用生成的查询客户端工厂
394
- const queryClient = cartQueryClientFactory.createQueryClient();
395
- const cartState = await queryClient.loadAggregate('cart-id');
392
+ const snapshotClient = cartQueryClientFactory.createSnapshotQueryClient({ fetcher: fetcher });
393
+ const cartState = await snapshotClient.singleState({ condition: all() });
396
394
 
397
395
  // 使用生成的命令客户端
398
- const commandClient = new CartCommandClient();
396
+ const commandClient = new CartCommandClient({ fetcher: fetcher });
399
397
  const result = await commandClient.addCartItem(
400
398
  {
401
399
  command: {
@@ -409,7 +407,7 @@ const result = await commandClient.addCartItem(
409
407
  );
410
408
 
411
409
  // 使用生成的 API 客户端用于自定义端点(基于 OpenAPI 标签 "cart")
412
- const apiClient = new CartApiClient();
410
+ const apiClient = new CartApiClient({ fetcher: fetcher });
413
411
  const cartData = await apiClient.me();
414
412
  ```
415
413
 
package/dist/cli.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("commander"),a=require("./index.cjs");require("@ahoo-wang/fetcher");require("yaml");require("fs");require("path");class f{getTimestamp(){return new Date().toISOString().slice(11,19)}info(e,...t){const o=this.getTimestamp();t.length>0?console.log(`[${o}] ℹ️ ${e}`,...t):console.log(`[${o}] ℹ️ ${e}`)}success(e,...t){const o=this.getTimestamp();t.length>0?console.log(`[${o}] ✅ ${e}`,...t):console.log(`[${o}] ✅ ${e}`)}error(e,...t){const o=this.getTimestamp();t.length>0?console.error(`[${o}] ❌ ${e}`,...t):console.error(`[${o}] ❌ ${e}`)}progress(e,t=0,...o){const i=this.getTimestamp(),r=" ".repeat(t);o.length>0?console.log(`[${i}] 🔄 ${r}${e}`,...o):console.log(`[${i}] 🔄 ${r}${e}`)}progressWithCount(e,t,o,i=0,...r){const s=this.getTimestamp(),p=" ".repeat(i),l=`[${e}/${t}]`;r.length>0?console.log(`[${s}] 🔄 ${p}${l} ${o}`,...r):console.log(`[${s}] 🔄 ${p}${l} ${o}`)}}function h(n){if(!n)return!1;try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return n.length>0}}async function d(n){const e=new f;process.on("SIGINT",()=>{e.error("Generation interrupted by user"),process.exit(130)}),h(n.input)||(e.error("Invalid input: must be a valid file path or HTTP/HTTPS URL"),process.exit(2));try{e.info("Starting code generation...");const t={inputPath:n.input,outputDir:n.output,configPath:n.config,tsConfigFilePath:n.tsConfigFilePath,logger:e};await new a.CodeGenerator(t).generate(),e.success(`Code generation completed successfully! Files generated in: ${n.output}`)}catch(t){e.error(`Error during code generation: ${t}`),process.exit(1)}}const $="2.5.5",m={version:$};function u(){return c.program.name("fetcher-generator").description("OpenAPI Specification TypeScript code generator for Wow").version(m.version),c.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",a.DEFAULT_CONFIG_PATH).option("-t, --ts-config-file-path <file>","TypeScript configuration file path").option("-v, --verbose","Enable verbose logging").option("--dry-run","Show what would be generated without writing files").action(d),c.program}function g(){u().parse()}g();exports.runCLI=g;exports.setupCLI=u;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("commander"),a=require("./index.cjs");require("@ahoo-wang/fetcher");require("yaml");require("fs");require("path");class f{getTimestamp(){return new Date().toISOString().slice(11,19)}info(e,...t){const o=this.getTimestamp();t.length>0?console.log(`[${o}] ℹ️ ${e}`,...t):console.log(`[${o}] ℹ️ ${e}`)}success(e,...t){const o=this.getTimestamp();t.length>0?console.log(`[${o}] ✅ ${e}`,...t):console.log(`[${o}] ✅ ${e}`)}error(e,...t){const o=this.getTimestamp();t.length>0?console.error(`[${o}] ❌ ${e}`,...t):console.error(`[${o}] ❌ ${e}`)}progress(e,t=0,...o){const i=this.getTimestamp(),r=" ".repeat(t);o.length>0?console.log(`[${i}] 🔄 ${r}${e}`,...o):console.log(`[${i}] 🔄 ${r}${e}`)}progressWithCount(e,t,o,i=0,...r){const s=this.getTimestamp(),p=" ".repeat(i),l=`[${e}/${t}]`;r.length>0?console.log(`[${s}] 🔄 ${p}${l} ${o}`,...r):console.log(`[${s}] 🔄 ${p}${l} ${o}`)}}function h(n){if(!n)return!1;try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return n.length>0}}async function d(n){const e=new f;process.on("SIGINT",()=>{e.error("Generation interrupted by user"),process.exit(130)}),h(n.input)||(e.error("Invalid input: must be a valid file path or HTTP/HTTPS URL"),process.exit(2));try{e.info("Starting code generation...");const t={inputPath:n.input,outputDir:n.output,configPath:n.config,tsConfigFilePath:n.tsConfigFilePath,logger:e};await new a.CodeGenerator(t).generate(),e.success(`Code generation completed successfully! Files generated in: ${n.output}`)}catch(t){e.error(`Error during code generation: ${t}`),process.exit(1)}}const $="2.5.8",m={version:$};function u(){return c.program.name("fetcher-generator").description("OpenAPI Specification TypeScript code generator for Wow").version(m.version),c.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",a.DEFAULT_CONFIG_PATH).option("-t, --ts-config-file-path <file>","TypeScript configuration file path").option("-v, --verbose","Enable verbose logging").option("--dry-run","Show what would be generated without writing files").action(d),c.program}function g(){u().parse()}g();exports.runCLI=g;exports.setupCLI=u;
3
3
  //# sourceMappingURL=cli.cjs.map
package/dist/cli.js CHANGED
@@ -63,7 +63,7 @@ async function h(n) {
63
63
  e.error(`Error during code generation: ${t}`), process.exit(1);
64
64
  }
65
65
  }
66
- const $ = "2.5.5", d = {
66
+ const $ = "2.5.8", d = {
67
67
  version: $
68
68
  };
69
69
  function m() {
@@ -1 +1 @@
1
- {"version":3,"file":"apiClientGenerator.d.ts","sourceRoot":"","sources":["../../src/client/apiClientGenerator.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAyChE;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,SAAS;aAUtB,OAAO,EAAE,eAAe;IATpD,OAAO,CAAC,2BAA2B,CAAsB;IACzD,OAAO,CAAC,iBAAiB,CAAuB;IAEhD,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAqB;IAEhE;;;OAGG;gBACyB,OAAO,EAAE,eAAe;IAMpD;;;OAGG;IACH,QAAQ;IAgBR;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAerB;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAuD1B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IA6DzB;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IAiC/B;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAyDzB;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IA8CxB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IA4CvB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IA4BtB,OAAO,CAAC,cAAc;CAUvB"}
1
+ {"version":3,"file":"apiClientGenerator.d.ts","sourceRoot":"","sources":["../../src/client/apiClientGenerator.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAyChE;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,SAAS;aAUtB,OAAO,EAAE,eAAe;IATpD,OAAO,CAAC,2BAA2B,CAAsB;IACzD,OAAO,CAAC,iBAAiB,CAAuB;IAEhD,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAqB;IAEhE;;;OAGG;gBACyB,OAAO,EAAE,eAAe;IAMpD;;;OAGG;IACH,QAAQ;IAgBR;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAyBzB;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAerB;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAuD1B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IA6DzB;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IAiC/B;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAyDzB;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IA8CxB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IA4CvB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IA4BtB,OAAO,CAAC,cAAc;CAUvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"commandClientGenerator.d.ts","sourceRoot":"","sources":["../../src/client/commandClientGenerator.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,gBAAgB,EAChB,UAAU,EAEX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAgBhE;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,SAAS;aAS1B,OAAO,EAAE,eAAe;IARpD,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA4B;IACrE,OAAO,CAAC,QAAQ,CAAC,+BAA+B,CACb;IAEnC;;;OAGG;gBACyB,OAAO,EAAE,eAAe;IAGpD;;OAEG;IACH,QAAQ,IAAI,IAAI;IAwBhB;;;OAGG;IACH,gBAAgB,CAAC,SAAS,EAAE,mBAAmB;IA6E/C,2BAA2B,CACzB,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,mBAAmB;IAsB1C,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM;IAInD,oBAAoB,CAClB,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,mBAAmB,EACxC,QAAQ,GAAE,OAAe;IAyB3B,OAAO,CAAC,iBAAiB;IAiEzB,oBAAoB,CAClB,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,iBAAiB,EAC7B,UAAU,EAAE,MAAM;CAmCrB"}
1
+ {"version":3,"file":"commandClientGenerator.d.ts","sourceRoot":"","sources":["../../src/client/commandClientGenerator.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,gBAAgB,EAChB,UAAU,EAEX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAehE;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,SAAS;aAS1B,OAAO,EAAE,eAAe;IARpD,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA4B;IACrE,OAAO,CAAC,QAAQ,CAAC,+BAA+B,CACb;IAEnC;;;OAGG;gBACyB,OAAO,EAAE,eAAe;IAGpD;;OAEG;IACH,QAAQ,IAAI,IAAI;IAwBhB;;;OAGG;IACH,gBAAgB,CAAC,SAAS,EAAE,mBAAmB;IA0E/C,2BAA2B,CACzB,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,mBAAmB;IAsB1C,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM;IAInD,oBAAoB,CAClB,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,mBAAmB,EACxC,QAAQ,GAAE,OAAe;IAyB3B,OAAO,CAAC,iBAAiB;IAiEzB,oBAAoB,CAClB,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,iBAAiB,EAC7B,UAAU,EAAE,MAAM;CAmCrB"}
@@ -56,4 +56,6 @@ export declare function createDecoratorClass(className: string, sourceFile: Sour
56
56
  * ```
57
57
  */
58
58
  export declare function addApiMetadataCtor(classDeclaration: ClassDeclaration, initializer?: string): void;
59
+ export declare const EVENTSTREAM_MODULE_SPECIFIER = "@ahoo-wang/fetcher-eventstream";
60
+ export declare function addImportEventStream(sourceFile: SourceFile): void;
59
61
  //# sourceMappingURL=decorators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/client/decorators.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,gBAAgB,EAIhB,UAAU,EACX,MAAM,UAAU,CAAC;AAGlB;;GAEG;AACH,eAAO,MAAM,0BAA0B,iCAAiC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,uBAAuB,UAYnC,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;;GAEG;AACH,eAAO,MAAM,gCAAgC,0HAG3C,CAAC;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,QAExD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,MAAM,EAAO,GACrB,gBAAgB,CAWlB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,CAAC,EAAE,MAAM,QAerB"}
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/client/decorators.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,gBAAgB,EAIhB,UAAU,EACX,MAAM,UAAU,CAAC;AAGlB;;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;;GAEG;AACH,eAAO,MAAM,gCAAgC,0HAG3C,CAAC;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,QAExD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,MAAM,EAAO,GACrB,gBAAgB,CAWlB;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,QAE1D"}
package/dist/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("ts-morph"),h=require("@ahoo-wang/fetcher"),j=require("@ahoo-wang/fetcher-wow"),L=require("yaml"),ce=require("fs"),F=require("path");function I(r){return r.$ref.split("/").pop()}function E(r,e){const t=I(r);return e.schemas?.[t]}function k(r,e){const t=I(r);return e.requestBodies?.[t]}function U(r,e){const t=I(r);return e.parameters?.[t]}function S(r,e){return{key:I(r),schema:E(r,e)}}const G=/[-_\s.]+/;function Q(r){return Array.isArray(r)?r.flatMap(e=>_(e.split(G))):_(r.split(G))}function _(r){return r.flatMap(e=>{if(e.length===0)return[];const t=[];let n="";for(let o=0;o<e.length;o++){const s=e[o],i=/[A-Z]/.test(s),a=o>0&&/[a-z]/.test(e[o-1]);i&&a&&n?(t.push(n),n=s):n+=s}return n&&t.push(n),t})}function P(r){return r===""||r.length===0?"":Q(r).filter(t=>t.length>0).map(t=>{const n=t.charAt(0),o=t.slice(1);return(/[a-zA-Z]/.test(n)?n.toUpperCase():n)+o.toLowerCase()}).join("")}function y(r){const e=P(r);return e.charAt(0).toLowerCase()+e.slice(1)}function ge(r){return r===""||Array.isArray(r)&&r.length===0?"":Q(r).filter(t=>t.length>0).map(t=>t.toUpperCase()).join("_")}function g(r){return!!(r&&typeof r=="object"&&"$ref"in r)}function D(r,e){if(e&&!g(e)&&e.content)return e.content[r]?.schema}function V(r){return D(h.ContentTypeValues.APPLICATION_JSON,r)}function le(r){return D(h.ContentTypeValues.TEXT_EVENT_STREAM,r)}function pe(r){return D("*/*",r)}const ue=["string","number","integer","boolean","null"];function b(r){return Array.isArray(r)?!0:ue.includes(r)}function v(r){return r.type==="array"}function de(r){return Array.isArray(r.enum)&&r.enum.length>0}function J(r){return Array.isArray(r.anyOf)&&r.anyOf.length>0}function K(r){return Array.isArray(r.oneOf)&&r.oneOf.length>0}function me(r){return J(r)||K(r)}function fe(r){return Array.isArray(r.allOf)&&r.allOf.length>0}function W(r){return J(r)||K(r)||fe(r)}function z(r){return r.includes("|")||r.includes("&")?`(${r})[]`:`${r}[]`}function he(r){return r.type!=="object"?!1:r.properties?Object.keys(r.properties).length===0:!0}function $(r){if(Array.isArray(r))return r.map(e=>$(e)).join(" | ");switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"any"}}function H(r){return[{method:"get",operation:r.get},{method:"put",operation:r.put},{method:"post",operation:r.post},{method:"delete",operation:r.delete},{method:"options",operation:r.options},{method:"head",operation:r.head},{method:"patch",operation:r.patch},{method:"trace",operation:r.trace}].filter(({operation:e})=>e!==void 0)}function q(r){return r.responses[200]}function B(r){const e=q(r);return V(e)}function ye(r,e){return r.parameters?r.parameters.map(t=>g(t)?U(t,e):t).filter(t=>t.in==="path"):[]}const xe="string";function Y(r){return!r.schema||g(r.schema)||!r.schema.type||!b(r.schema.type)?xe:$(r.schema.type)}function X(r){return r.startsWith("http://")||r.startsWith("https://")?Ae(r):Ce(r)}async function Ae(r){return await(await fetch(r)).text()}function Ce(r){return new Promise((e,t)=>{ce.readFile(r,"utf-8",(n,o)=>{n?t(n):e(o)})})}async function Pe(r){const e=await X(r);switch(Z(e)){case"json":return JSON.parse(e);case"yaml":return L.parse(e);default:throw new Error(`Unsupported file format: ${r}`)}}async function $e(r){const e=await X(r);switch(Z(e)){case"json":return JSON.parse(e);case"yaml":return L.parse(e);default:throw new Error(`Unsupported file format: ${r}`)}}function Z(r){const e=r.trimStart();if(e.startsWith("{")||e.startsWith("["))return"json";if(e.startsWith("-")||e.startsWith("%YAML"))return"yaml";try{return JSON.parse(e),"json"}catch{if(e.length>0)return"yaml"}throw new Error("Unable to infer file format")}const ee="types.ts",Te="@";function Ie(r){return h.combineURLs(r.path,ee)}function te(r,e,t){const n=h.combineURLs(e,t),o=r.getSourceFile(n);return o||r.createSourceFile(n,"",{overwrite:!0})}function R(r,e,t){let n=r.getImportDeclaration(o=>o.getModuleSpecifierValue()===e);n||(n=r.addImportDeclaration({moduleSpecifier:e})),t.forEach(o=>{n.getNamedImports().some(i=>i.getName()===o)||n.addNamedImport(o)})}function f(r,e,t){if(t.path.startsWith(Te)){R(r,t.path,[t.name]);return}const n=r.getDirectoryPath(),o=F.join(e,t.path,ee);let s=F.relative(n,o);s=s.replace(/\.ts$/,""),s.startsWith(".")||(s="./"+s),R(r,s,[t.name])}function w(r,e,t,n){r.path!==n.path&&f(e,t,n)}function Se(r,e){const t=[r,e].filter(n=>n!==void 0&&n.length>0);return t.length>0?t.join(`
2
- `):void 0}function A(r,e,t){const n=Se(e,t);n&&r.addJsDoc({description:n})}function we(r){const e=r.split(".");return e.length!=2||e[0].length===0||e[1].length===0?null:e}function Ee(r){const e=we(r.name);return e?{tag:r,contextAlias:e[0],aggregateName:e[1]}:null}function Re(r){const e=r?.map(n=>Ee(n)).filter(n=>n!==null);if(!e)return new Map;const t=new Map;return e.forEach(n=>{t.set(n.tag.name,{aggregate:n,commands:new Map,events:new Map})}),t}function ve(r){if(!r)return null;const e=r.split(".");return e.length!=3?null:e[2]}const Oe="#/components/responses/wow.CommandOk",Ne="#/components/parameters/wow.id";class De{constructor(e){this.openAPI=e,this.aggregates=Re(e.tags),this.build()}aggregates;build(){for(const[e,t]of Object.entries(this.openAPI.paths)){const n=H(t);for(const o of n)this.commands(e,o),this.state(o.operation),this.events(o.operation),this.fields(o.operation)}}resolve(){const e=new Map;for(const t of this.aggregates.values()){if(!t.state||!t.fields)continue;const n=t.aggregate.contextAlias;let o=e.get(n);o||(o=new Set,e.set(n,o)),o.add(t)}return e}commands(e,t){const n=t.operation;if(n.operationId==="wow.command.send")return;const o=ve(n.operationId);if(!o)return;const s=q(n);if(!s||!g(s)||s.$ref!==Oe||!n.requestBody)return;const i=n.parameters??[],a=i.filter(d=>g(d)&&d.$ref===Ne).at(0),c=i.filter(d=>!g(d)&&d.in==="path");if(a){const d=U(a,this.openAPI.components);c.push(d)}const p=n.requestBody.content[h.ContentTypeValues.APPLICATION_JSON].schema,u=S(p,this.openAPI.components);u.schema.title=u.schema.title||n.summary,u.schema.description=u.schema.description||n.description;const ae={name:o,method:t.method,path:e,pathParameters:c,summary:n.summary,description:n.description,schema:u,operation:n};n.tags?.forEach(d=>{const M=this.aggregates.get(d);M&&M.commands.set(o,ae)})}state(e){if(!e.operationId?.endsWith(".snapshot_state.single"))return;const t=B(e);if(!g(t))return;const n=S(t,this.openAPI.components);e.tags?.forEach(o=>{const s=this.aggregates.get(o);s&&(s.state=n)})}events(e){if(!this.openAPI.components||!e.operationId?.endsWith(".event.list_query"))return;const t=B(e);if(g(t))return;const n=t?.items;if(!g(n))return;const s=E(n,this.openAPI.components).properties.body.items.anyOf.map(i=>{const a=i.title,c=i.properties.name.const,l=i.properties.body,p=S(l,this.openAPI.components);return p.schema.title=p.schema.title||i.title,{title:a,name:c,schema:p}});e.tags?.forEach(i=>{const a=this.aggregates.get(i);a&&s.forEach(c=>{a.events.set(c.name,c)})})}fields(e){if(!this.openAPI.components||!e.operationId?.endsWith(".snapshot.count"))return;const n=k(e.requestBody,this.openAPI.components).content[h.ContentTypeValues.APPLICATION_JSON].schema,s=E(n,this.openAPI.components).properties?.field,i=S(s,this.openAPI.components);e.tags?.forEach(a=>{const c=this.aggregates.get(a);c&&(c.fields=i)})}}const T="@ahoo-wang/fetcher-wow",be={"wow.command.CommandResult":"CommandResult","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.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.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 m(r){if(!r)return{name:"",path:"/"};const e=be[r];if(e)return{name:e,path:T};const t=r.split(".");let n=-1;for(let c=0;c<t.length;c++)if(t[c]&&/^[A-Z]/.test(t[c])){n=c;break}const o=t.slice(0,n),s=o.length>0?`/${o.join("/")}`:"/",i=t.slice(n);return{name:P(i),path:s}}function x(r){const e=I(r);return m(e)}class qe{constructor(e){this.context=e}getOrCreateSourceFile(e){const t=Ie(e);return this.context.getOrCreateSourceFile(t)}generate(){const e=this.context.openAPI.components?.schemas;if(!e){this.context.logger.info("No schemas found in OpenAPI specification");return}const t=this.stateAggregatedTypeNames(),n=this.filterSchemas(e,t);this.context.logger.progress(`Generating models for ${n.length} schemas`),n.forEach((o,s)=>{this.context.logger.progressWithCount(s+1,n.length,`Processing schema: ${o.key}`,2),this.generateKeyedSchema(o)}),this.context.logger.success("Model generation completed")}filterSchemas(e,t){return Object.entries(e).map(([n,o])=>({key:n,schema:o})).filter(n=>!this.isWowSchema(n.key,t))}isWowSchema(e,t){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;const n=m(e);return t.has(n.name)}aggregatedSchemaSuffix=["MaterializedSnapshot","MaterializedSnapshotPagedList","MaterializedSnapshotServerSentEventNonNullData","PagedList","ServerSentEventNonNullData","Snapshot","StateEvent"];stateAggregatedTypeNames(){const e=new Set;for(const t of this.context.contextAggregates.values())for(const n of t)this.aggregatedSchemaSuffix.forEach(o=>{const s=m(n.state.key),i=P(s.name)+o;e.add(i)});return e}generateKeyedSchema({key:e,schema:t}){const n=m(e),o=this.getOrCreateSourceFile(n),s=this.process(n,o,t);s&&A(s,t.title,t.description)}process(e,t,n){if(de(n))return t.addEnum({name:e.name,isExported:!0,members:n.enum.filter(s=>typeof s=="string"&&s.length>0).map(s=>({name:ge(s),initializer:`'${s}'`}))});if(v(n)&&g(n.items)){const s=x(n.items);return w(e,t,this.context.outputDir,s),t.addTypeAlias({name:e.name,type:z(s.name),isExported:!0})}const o=t.addInterface({name:e.name,isExported:!0});return n.type==="object"&&n.properties?this.processInterface(t,e,n,o):(W(n)&&(n.anyOf||n.oneOf||n.allOf).forEach(i=>{if(g(i)){const a=x(i);w(e,t,this.context.outputDir,a),o.addExtends(a.name);return}this.processInterface(t,e,i,o)}),o)}processObject(e,t,n){const o=e.addInterface({name:t.name,isExported:!0});return this.processInterface(e,t,n,o)}processInterface(e,t,n,o){for(const[s,i]of Object.entries(n.properties)){const a=this.resolvePropertyType(t,e,s,i);let c=o.getProperty(s);c?c.setType(a):c=o.addProperty({name:s,type:a}),g(i)||A(c,i.title,i.description)}return o}resolvePropertyType(e,t,n,o){if(g(o)){const s=x(o);return w(e,t,this.context.outputDir,s),s.name}if(o.const)return`'${o.const}'`;if(v(o)){const s=this.resolvePropertyType(e,t,n,o.items);return z(s)}if(o.type&&b(o.type))return $(o.type);if(W(o))return this.resolvePropertyCompositionType(e,t,o);if(o.type==="object"&&o.properties){const s={path:e.path,name:`${e.name}${P(n)}`},i=this.processObject(t,s,o);return A(i,o.title,o.description),s.name}return"any"}resolvePropertyCompositionType(e,t,n){const o=n.anyOf||n.oneOf||n.allOf,s=new Set;o.forEach(a=>{if(g(a)){const c=x(a);w(e,t,this.context.outputDir,c),s.add(c.name);return}s.add($(a.type??"string"))});const i=me(n)?"|":"&";return Array.from(s).join(i)}}const Me="@ahoo-wang/fetcher-decorator",je=["type ApiMetadata","type ApiMetadataCapable","api","post","put","patch","del","request","attribute","path","autoGeneratedError"],Fe={type:"Promise<Response>",metadata:"{resultExtractor: ResultExtractors.Response }"},O=`{
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("ts-morph"),h=require("@ahoo-wang/fetcher"),j=require("@ahoo-wang/fetcher-wow"),B=require("yaml"),ge=require("fs"),F=require("path");function S(r){return r.$ref.split("/").pop()}function w(r,e){const t=S(r);return e.schemas?.[t]}function k(r,e){const t=S(r);return e.requestBodies?.[t]}function U(r,e){const t=S(r);return e.parameters?.[t]}function E(r,e){return{key:S(r),schema:w(r,e)}}const _=/[-_\s.]+/;function Q(r){return Array.isArray(r)?r.flatMap(e=>G(e.split(_))):G(r.split(_))}function G(r){return r.flatMap(e=>{if(e.length===0)return[];const t=[];let n="";for(let o=0;o<e.length;o++){const s=e[o],i=/[A-Z]/.test(s),a=o>0&&/[a-z]/.test(e[o-1]);i&&a&&n?(t.push(n),n=s):n+=s}return n&&t.push(n),t})}function P(r){return r===""||r.length===0?"":Q(r).filter(t=>t.length>0).map(t=>{const n=t.charAt(0),o=t.slice(1);return(/[a-zA-Z]/.test(n)?n.toUpperCase():n)+o.toLowerCase()}).join("")}function y(r){const e=P(r);return e.charAt(0).toLowerCase()+e.slice(1)}function le(r){return r===""||Array.isArray(r)&&r.length===0?"":Q(r).filter(t=>t.length>0).map(t=>t.toUpperCase()).join("_")}function g(r){return!!(r&&typeof r=="object"&&"$ref"in r)}function D(r,e){if(e&&!g(e)&&e.content)return e.content[r]?.schema}function V(r){return D(h.ContentTypeValues.APPLICATION_JSON,r)}function pe(r){return D(h.ContentTypeValues.TEXT_EVENT_STREAM,r)}function ue(r){return D("*/*",r)}const me=["string","number","integer","boolean","null"];function b(r){return Array.isArray(r)?!0:me.includes(r)}function v(r){return r.type==="array"}function de(r){return Array.isArray(r.enum)&&r.enum.length>0}function J(r){return Array.isArray(r.anyOf)&&r.anyOf.length>0}function K(r){return Array.isArray(r.oneOf)&&r.oneOf.length>0}function fe(r){return J(r)||K(r)}function he(r){return Array.isArray(r.allOf)&&r.allOf.length>0}function W(r){return J(r)||K(r)||he(r)}function z(r){return r.includes("|")||r.includes("&")?`(${r})[]`:`${r}[]`}function ye(r){return r.type!=="object"?!1:r.properties?Object.keys(r.properties).length===0:!0}function $(r){if(Array.isArray(r))return r.map(e=>$(e)).join(" | ");switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"any"}}function H(r){return[{method:"get",operation:r.get},{method:"put",operation:r.put},{method:"post",operation:r.post},{method:"delete",operation:r.delete},{method:"options",operation:r.options},{method:"head",operation:r.head},{method:"patch",operation:r.patch},{method:"trace",operation:r.trace}].filter(({operation:e})=>e!==void 0)}function q(r){return r.responses[200]}function L(r){const e=q(r);return V(e)}function xe(r,e){return r.parameters?r.parameters.map(t=>g(t)?U(t,e):t).filter(t=>t.in==="path"):[]}const Ae="string";function Y(r){return!r.schema||g(r.schema)||!r.schema.type||!b(r.schema.type)?Ae:$(r.schema.type)}function X(r){return r.startsWith("http://")||r.startsWith("https://")?Ce(r):Pe(r)}async function Ce(r){return await(await fetch(r)).text()}function Pe(r){return new Promise((e,t)=>{ge.readFile(r,"utf-8",(n,o)=>{n?t(n):e(o)})})}async function $e(r){const e=await X(r);switch(Z(e)){case"json":return JSON.parse(e);case"yaml":return B.parse(e);default:throw new Error(`Unsupported file format: ${r}`)}}async function Te(r){const e=await X(r);switch(Z(e)){case"json":return JSON.parse(e);case"yaml":return B.parse(e);default:throw new Error(`Unsupported file format: ${r}`)}}function Z(r){const e=r.trimStart();if(e.startsWith("{")||e.startsWith("["))return"json";if(e.startsWith("-")||e.startsWith("%YAML"))return"yaml";try{return JSON.parse(e),"json"}catch{if(e.length>0)return"yaml"}throw new Error("Unable to infer file format")}const ee="types.ts",Ie="@";function Se(r){return h.combineURLs(r.path,ee)}function te(r,e,t){const n=h.combineURLs(e,t),o=r.getSourceFile(n);return o||r.createSourceFile(n,"",{overwrite:!0})}function T(r,e,t){let n=r.getImportDeclaration(o=>o.getModuleSpecifierValue()===e);n||(n=r.addImportDeclaration({moduleSpecifier:e})),t.forEach(o=>{n.getNamedImports().some(i=>i.getName()===o)||n.addNamedImport(o)})}function f(r,e,t){if(t.path.startsWith(Ie)){T(r,t.path,[t.name]);return}const n=r.getDirectoryPath(),o=F.join(e,t.path,ee);let s=F.relative(n,o);s=s.replace(/\.ts$/,""),s.startsWith(".")||(s="./"+s),T(r,s,[t.name])}function R(r,e,t,n){r.path!==n.path&&f(e,t,n)}function Ee(r,e){const t=[r,e].filter(n=>n!==void 0&&n.length>0);return t.length>0?t.join(`
2
+ `):void 0}function A(r,e,t){const n=Ee(e,t);n&&r.addJsDoc({description:n})}function Re(r){const e=r.split(".");return e.length!=2||e[0].length===0||e[1].length===0?null:e}function we(r){const e=Re(r.name);return e?{tag:r,contextAlias:e[0],aggregateName:e[1]}:null}function ve(r){const e=r?.map(n=>we(n)).filter(n=>n!==null);if(!e)return new Map;const t=new Map;return e.forEach(n=>{t.set(n.tag.name,{aggregate:n,commands:new Map,events:new Map})}),t}function Oe(r){if(!r)return null;const e=r.split(".");return e.length!=3?null:e[2]}const Ne="#/components/responses/wow.CommandOk",De="#/components/parameters/wow.id";class be{constructor(e){this.openAPI=e,this.aggregates=ve(e.tags),this.build()}aggregates;build(){for(const[e,t]of Object.entries(this.openAPI.paths)){const n=H(t);for(const o of n)this.commands(e,o),this.state(o.operation),this.events(o.operation),this.fields(o.operation)}}resolve(){const e=new Map;for(const t of this.aggregates.values()){if(!t.state||!t.fields)continue;const n=t.aggregate.contextAlias;let o=e.get(n);o||(o=new Set,e.set(n,o)),o.add(t)}return e}commands(e,t){const n=t.operation;if(n.operationId==="wow.command.send")return;const o=Oe(n.operationId);if(!o)return;const s=q(n);if(!s||!g(s)||s.$ref!==Ne||!n.requestBody)return;const i=n.parameters??[],a=i.filter(m=>g(m)&&m.$ref===De).at(0),c=i.filter(m=>!g(m)&&m.in==="path");if(a){const m=U(a,this.openAPI.components);c.push(m)}const p=n.requestBody.content[h.ContentTypeValues.APPLICATION_JSON].schema,u=E(p,this.openAPI.components);u.schema.title=u.schema.title||n.summary,u.schema.description=u.schema.description||n.description;const ce={name:o,method:t.method,path:e,pathParameters:c,summary:n.summary,description:n.description,schema:u,operation:n};n.tags?.forEach(m=>{const M=this.aggregates.get(m);M&&M.commands.set(o,ce)})}state(e){if(!e.operationId?.endsWith(".snapshot_state.single"))return;const t=L(e);if(!g(t))return;const n=E(t,this.openAPI.components);e.tags?.forEach(o=>{const s=this.aggregates.get(o);s&&(s.state=n)})}events(e){if(!this.openAPI.components||!e.operationId?.endsWith(".event.list_query"))return;const t=L(e);if(g(t))return;const n=t?.items;if(!g(n))return;const s=w(n,this.openAPI.components).properties.body.items.anyOf.map(i=>{const a=i.title,c=i.properties.name.const,l=i.properties.body,p=E(l,this.openAPI.components);return p.schema.title=p.schema.title||i.title,{title:a,name:c,schema:p}});e.tags?.forEach(i=>{const a=this.aggregates.get(i);a&&s.forEach(c=>{a.events.set(c.name,c)})})}fields(e){if(!this.openAPI.components||!e.operationId?.endsWith(".snapshot.count"))return;const n=k(e.requestBody,this.openAPI.components).content[h.ContentTypeValues.APPLICATION_JSON].schema,s=w(n,this.openAPI.components).properties?.field,i=E(s,this.openAPI.components);e.tags?.forEach(a=>{const c=this.aggregates.get(a);c&&(c.fields=i)})}}const I="@ahoo-wang/fetcher-wow",qe={"wow.command.CommandResult":"CommandResult","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.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.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 d(r){if(!r)return{name:"",path:"/"};const e=qe[r];if(e)return{name:e,path:I};const t=r.split(".");let n=-1;for(let c=0;c<t.length;c++)if(t[c]&&/^[A-Z]/.test(t[c])){n=c;break}const o=t.slice(0,n),s=o.length>0?`/${o.join("/")}`:"/",i=t.slice(n);return{name:P(i),path:s}}function x(r){const e=S(r);return d(e)}class Me{constructor(e){this.context=e}getOrCreateSourceFile(e){const t=Se(e);return this.context.getOrCreateSourceFile(t)}generate(){const e=this.context.openAPI.components?.schemas;if(!e){this.context.logger.info("No schemas found in OpenAPI specification");return}const t=this.stateAggregatedTypeNames(),n=this.filterSchemas(e,t);this.context.logger.progress(`Generating models for ${n.length} schemas`),n.forEach((o,s)=>{this.context.logger.progressWithCount(s+1,n.length,`Processing schema: ${o.key}`,2),this.generateKeyedSchema(o)}),this.context.logger.success("Model generation completed")}filterSchemas(e,t){return Object.entries(e).map(([n,o])=>({key:n,schema:o})).filter(n=>!this.isWowSchema(n.key,t))}isWowSchema(e,t){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;const n=d(e);return t.has(n.name)}aggregatedSchemaSuffix=["MaterializedSnapshot","MaterializedSnapshotPagedList","MaterializedSnapshotServerSentEventNonNullData","PagedList","ServerSentEventNonNullData","Snapshot","StateEvent"];stateAggregatedTypeNames(){const e=new Set;for(const t of this.context.contextAggregates.values())for(const n of t)this.aggregatedSchemaSuffix.forEach(o=>{const s=d(n.state.key),i=P(s.name)+o;e.add(i)});return e}generateKeyedSchema({key:e,schema:t}){const n=d(e),o=this.getOrCreateSourceFile(n),s=this.process(n,o,t);s&&A(s,t.title,t.description)}process(e,t,n){if(de(n))return t.addEnum({name:e.name,isExported:!0,members:n.enum.filter(s=>typeof s=="string"&&s.length>0).map(s=>({name:le(s),initializer:`'${s}'`}))});if(v(n)&&g(n.items)){const s=x(n.items);return R(e,t,this.context.outputDir,s),t.addTypeAlias({name:e.name,type:z(s.name),isExported:!0})}const o=t.addInterface({name:e.name,isExported:!0});return n.type==="object"&&n.properties?this.processInterface(t,e,n,o):(W(n)&&(n.anyOf||n.oneOf||n.allOf).forEach(i=>{if(g(i)){const a=x(i);R(e,t,this.context.outputDir,a),o.addExtends(a.name);return}this.processInterface(t,e,i,o)}),o)}processObject(e,t,n){const o=e.addInterface({name:t.name,isExported:!0});return this.processInterface(e,t,n,o)}processInterface(e,t,n,o){for(const[s,i]of Object.entries(n.properties)){const a=this.resolvePropertyType(t,e,s,i);let c=o.getProperty(s);c?c.setType(a):c=o.addProperty({name:s,type:a}),g(i)||A(c,i.title,i.description)}return o}resolvePropertyType(e,t,n,o){if(g(o)){const s=x(o);return R(e,t,this.context.outputDir,s),s.name}if(o.const)return`'${o.const}'`;if(v(o)){const s=this.resolvePropertyType(e,t,n,o.items);return z(s)}if(o.type&&b(o.type))return $(o.type);if(W(o))return this.resolvePropertyCompositionType(e,t,o);if(o.type==="object"&&o.properties){const s={path:e.path,name:`${e.name}${P(n)}`},i=this.processObject(t,s,o);return A(i,o.title,o.description),s.name}return"any"}resolvePropertyCompositionType(e,t,n){const o=n.anyOf||n.oneOf||n.allOf,s=new Set;o.forEach(a=>{if(g(a)){const c=x(a);R(e,t,this.context.outputDir,c),s.add(c.name);return}s.add($(a.type??"string"))});const i=fe(n)?"|":"&";return Array.from(s).join(i)}}const je="@ahoo-wang/fetcher-decorator",Fe=["type ApiMetadata","type ApiMetadataCapable","type ParameterRequest","api","get","post","put","patch","del","request","attribute","path","autoGeneratedError"],_e={type:"Promise<Response>",metadata:"{resultExtractor: ResultExtractors.Response }"},O=`{
3
3
  headers: { Accept: ContentTypeValues.TEXT_EVENT_STREAM },
4
4
  resultExtractor: JsonEventStreamResultExtractor,
5
- }`;function ne(r){R(r,Me,je)}function oe(r,e,t=[]){return e.addClass({name:r,isExported:!0,decorators:[{name:"api",arguments:t}]})}function re(r,e){r.addImplements("ApiMetadataCapable"),r.addConstructor({parameters:[{name:"apiMetadata",type:"ApiMetadata",hasQuestionToken:e===void 0,scope:C.Scope.Public,isReadonly:!0,initializer:e}]})}function Ge(r){let e=0,t=0;return r.commands.forEach(n=>{n.path.startsWith(j.ResourceAttributionPathSpec.TENANT)&&(e+=1),n.path.startsWith(j.ResourceAttributionPathSpec.OWNER)&&(t+=1)}),e===0&&t===0?"ResourceAttributionPathSpec.NONE":e>t?"ResourceAttributionPathSpec.TENANT":"ResourceAttributionPathSpec.OWNER"}function se(r,e,t,n){const o=`${t.contextAlias}/${t.aggregateName}/${n}.ts`;return te(r,e,o)}function _e(r,e){return`${P(r.aggregateName)}${e}`}function N(r){return r==="delete"?"del":r}class We{constructor(e){this.context=e,this.apiMetadataCtorInitializer=this.context.currentContextAlias?`{basePath:'${this.context.currentContextAlias}'}`:void 0}defaultParameterRequestType="ParameterRequest";defaultReturnType=Fe;apiMetadataCtorInitializer;generate(){this.context.logger.info("Starting API client generation");const e=this.resolveApiTags();this.context.logger.info(`Resolved ${e.size} API client tags: ${Array.from(e.keys()).join(", ")}`);const 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(const[o,s]of t){n++,this.context.logger.progressWithCount(n,t.size,`Generating API client for tag: ${o}`);const i=e.get(o);this.generateApiClient(i,s)}}createApiClientFile(e){let t=e.path;return this.context.currentContextAlias&&(t=h.combineURLs(this.context.currentContextAlias,t)),t=h.combineURLs(t,`${e.name}ApiClient.ts`),this.context.logger.info(`Creating API client file: ${t}`),this.context.getOrCreateSourceFile(t)}generateApiClient(e,t){const n=m(e.name);this.context.logger.info(`Generating API client class: ${n.name}ApiClient with ${t.size} operations`);const o=this.createApiClientFile(n);ne(o);const s=oe(n.name+"ApiClient",o);A(s,e.description),re(s,this.apiMetadataCtorInitializer),this.context.logger.info(`Processing ${t.size} operations for ${n.name}ApiClient`),t.forEach(i=>{this.processOperation(e,o,s,i)}),this.context.logger.success(`Completed API client: ${n.name}ApiClient`)}getMethodName(e,t){const n=t.operationId.split(".");for(let o=n.length-1;o>=0;o--){const s=y(n.slice(o));if(!e.getMethod(s))return s}return y(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(g(t.requestBody)?(this.context.logger.info(`Extracting request body from reference for operation: ${t.operationId}`),n=k(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"]){const o=n.content["application/json"].schema;if(g(o)){const s=x(o);this.context.logger.info(`Adding import for request body model: ${s.name} from ${s.path}`),f(e,this.context.outputDir,s);const i=`ParameterRequest<${s.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){const o=ye(n,this.context.openAPI.components).filter(a=>!this.context.isIgnoreApiClientPathParameters(e.name,a.name));this.context.logger.info(`Found ${o.length} path parameters for operation ${n.operationId}`);const s=o.map(a=>{const c=Y(a);return this.context.logger.info(`Adding path parameter: ${a.name} (type: ${c})`),{name:a.name,type:c,hasQuestionToken:!1,decorators:[{name:"path",arguments:[`'${a.name}'`]}]}}),i=this.resolveRequestType(t,n);return this.context.logger.info(`Adding httpRequest parameter: ${i}`),s.push({name:"httpRequest",hasQuestionToken:i===this.defaultParameterRequestType,type:`${i}`,decorators:[{name:"request",arguments:[]}]}),this.context.logger.info("Adding attributes parameter: Record<string, any>"),s.push({name:"attributes",hasQuestionToken:!0,type:"Record<string, any>",decorators:[{name:"attribute",arguments:[]}]}),s}resolveSchemaReturnType(e,t){const n="Promise<any>";if(g(t)){const o=x(t);this.context.logger.info(`Adding import for response model: ${o.name} from ${o.path}`),f(e,this.context.outputDir,o);const s=`Promise<${o.name}>`;return this.context.logger.info(`Resolved reference return type: ${s}`),s}if(!t.type)return this.context.logger.info(`Schema has no type, using default return type: ${n}`),n;if(b(t.type)){const s=`Promise<${$(t.type)}>`;return this.context.logger.info(`Resolved primitive return type: ${s}`),s}return this.context.logger.info(`Using default return type: ${n}`),n}resolveReturnType(e,t){const n=q(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;const o=V(n)||pe(n);if(o){const i=this.resolveSchemaReturnType(e,o);return this.context.logger.info(`Resolved JSON/wildcard response return type for operation ${t.operationId}: ${i}`),{type:i}}const s=le(n);if(s){if(g(s)){const a=E(s,this.context.openAPI.components);if(v(a)&&g(a.items)){const c=x(a.items);this.context.logger.info(`Adding import for event stream model: ${c.name} from ${c.path}`),f(e,this.context.outputDir,c);const p=`Promise<JsonServerSentEventStream<${c.name.includes("ServerSentEvent")?`${c.name}['data']`:c.name}>>`;return this.context.logger.info(`Resolved event stream return type for operation ${t.operationId}: ${p}`),{type:p,metadata:O}}}const i="Promise<JsonServerSentEventStream<any>>";return this.context.logger.info(`Resolved generic event stream return type for operation ${t.operationId}: ${i}`),{type:i,metadata:O}}return this.context.logger.info(`Using default return type for operation ${t.operationId}: ${this.defaultReturnType.type}`),this.defaultReturnType}processOperation(e,t,n,o){this.context.logger.info(`Processing operation: ${o.operation.operationId} (${o.method} ${o.path})`);const s=this.getMethodName(n,o.operation);this.context.logger.info(`Generated method name: ${s}`);const i=this.resolveParameters(e,t,o.operation),a=this.resolveReturnType(t,o.operation),c=a.metadata?{name:N(o.method),arguments:[`'${o.path}'`,a.metadata]}:{name:N(o.method),arguments:[`'${o.path}'`]};this.context.logger.info(`Creating method with ${i.length} parameters, return type: ${a.type}`);const l=n.addMethod({name:s,decorators:[c],parameters:i,returnType:a.type,statements:[`throw autoGeneratedError(${i.map(p=>p.name).join(",")});`]});A(l,o.operation.summary,o.operation.description),this.context.logger.success(`Operation method generated: ${s}`)}groupOperations(e){this.context.logger.info("Grouping operations by API client tags");const t=new Map;let n=0;for(const[o,s]of Object.entries(this.context.openAPI.paths)){const i=H(s).filter(a=>{if(!a.operation.operationId)return!1;const c=a.operation.tags;return!c||c.length==0?!1:c.every(l=>e.has(l))});this.context.logger.info(`Path ${o}: found ${i.length} valid operations`);for(const a of i)a.operation.tags.forEach(c=>{const l={...a,path:o};t.has(c)||t.set(c,new Set),t.get(c).add(l),n++})}return this.context.logger.info(`Grouped ${n} operations into ${t.size} tag groups`),t}resolveApiTags(){this.context.logger.info("Resolving API client tags from OpenAPI specification");const e=new Map,t=this.context.openAPI.tags?.length||0;let n=0;return this.context.openAPI.tags?.forEach(o=>{o.name!="wow"&&o.name!="Actuator"&&!this.isAggregateTag(o)?(e.set(o.name,o),n++,this.context.logger.info(`Included API client tag: ${o.name}`)):this.context.logger.info(`Excluded tag: ${o.name} (wow/Actuator/aggregate)`)}),this.context.logger.info(`Resolved ${n} API client tags from ${t} total tags`),e}isAggregateTag(e){for(const t of this.context.contextAggregates.values())for(const n of t)if(n.aggregate.tag.name===e.name)return!0;return!1}}class ze{constructor(e){this.context=e}commandEndpointPathsName="COMMAND_ENDPOINT_PATHS";defaultCommandClientOptionsName="DEFAULT_COMMAND_CLIENT_OPTIONS";generate(){const e=Array.from(this.context.contextAggregates.values()).reduce((n,o)=>n+o.size,0);this.context.logger.info("--- Generating Command Clients ---"),this.context.logger.progress(`Generating command clients for ${e} aggregates`);let t=0;for(const[,n]of this.context.contextAggregates)n.forEach(o=>{t++,this.context.logger.progressWithCount(t,e,`Processing command client for aggregate: ${o.aggregate.aggregateName}`),this.processAggregate(o)});this.context.logger.success("Command client generation completed")}processAggregate(e){this.context.logger.info(`Processing command client for aggregate: ${e.aggregate.aggregateName} in context: ${e.aggregate.contextAlias}`);const t=se(this.context.project,this.context.outputDir,e.aggregate,"commandClient");this.context.logger.info(`Processing command endpoint paths for ${e.commands.size} commands`),this.processCommandEndpointPaths(t,e),this.context.logger.info(`Creating default command client options: ${this.defaultCommandClientOptionsName}`),t.addVariableStatement({declarationKind:C.VariableDeclarationKind.Const,declarations:[{name:this.defaultCommandClientOptionsName,type:"ApiMetadata",initializer:`{
5
+ }`;function ne(r){T(r,je,Fe)}function oe(r,e,t=[]){return e.addClass({name:r,isExported:!0,decorators:[{name:"api",arguments:t}]})}function re(r,e){r.addImplements("ApiMetadataCapable"),r.addConstructor({parameters:[{name:"apiMetadata",type:"ApiMetadata",hasQuestionToken:e===void 0,scope:C.Scope.Public,isReadonly:!0,initializer:e}]})}const Ge="@ahoo-wang/fetcher-eventstream";function se(r){T(r,Ge,["JsonEventStreamResultExtractor","type JsonServerSentEventStream"])}function We(r){let e=0,t=0;return r.commands.forEach(n=>{n.path.startsWith(j.ResourceAttributionPathSpec.TENANT)&&(e+=1),n.path.startsWith(j.ResourceAttributionPathSpec.OWNER)&&(t+=1)}),e===0&&t===0?"ResourceAttributionPathSpec.NONE":e>t?"ResourceAttributionPathSpec.TENANT":"ResourceAttributionPathSpec.OWNER"}function ie(r,e,t,n){const o=`${t.contextAlias}/${t.aggregateName}/${n}.ts`;return te(r,e,o)}function ze(r,e){return`${P(r.aggregateName)}${e}`}function N(r){return r==="delete"?"del":r}class Le{constructor(e){this.context=e,this.apiMetadataCtorInitializer=this.context.currentContextAlias?`{basePath:'${this.context.currentContextAlias}'}`:void 0}defaultParameterRequestType="ParameterRequest";defaultReturnType=_e;apiMetadataCtorInitializer;generate(){this.context.logger.info("Starting API client generation");const e=this.resolveApiTags();this.context.logger.info(`Resolved ${e.size} API client tags: ${Array.from(e.keys()).join(", ")}`);const 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(const[o,s]of t){n++,this.context.logger.progressWithCount(n,t.size,`Generating API client for tag: ${o}`);const i=e.get(o);this.generateApiClient(i,s)}}createApiClientFile(e){let t=e.path;return this.context.currentContextAlias&&(t=h.combineURLs(this.context.currentContextAlias,t)),t=h.combineURLs(t,`${e.name}ApiClient.ts`),this.context.logger.info(`Creating API client file: ${t}`),this.context.getOrCreateSourceFile(t)}generateApiClient(e,t){const n=d(e.name);this.context.logger.info(`Generating API client class: ${n.name}ApiClient with ${t.size} operations`);const o=this.createApiClientFile(n);ne(o),se(o);const s=oe(n.name+"ApiClient",o);A(s,e.description),re(s,this.apiMetadataCtorInitializer),this.context.logger.info(`Processing ${t.size} operations for ${n.name}ApiClient`),t.forEach(i=>{this.processOperation(e,o,s,i)}),this.context.logger.success(`Completed API client: ${n.name}ApiClient`)}getMethodName(e,t){const n=t.operationId.split(".");for(let o=n.length-1;o>=0;o--){const s=y(n.slice(o));if(!e.getMethod(s))return s}return y(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(g(t.requestBody)?(this.context.logger.info(`Extracting request body from reference for operation: ${t.operationId}`),n=k(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"]){const o=n.content["application/json"].schema;if(g(o)){const s=x(o);this.context.logger.info(`Adding import for request body model: ${s.name} from ${s.path}`),f(e,this.context.outputDir,s);const i=`ParameterRequest<${s.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){const o=xe(n,this.context.openAPI.components).filter(a=>!this.context.isIgnoreApiClientPathParameters(e.name,a.name));this.context.logger.info(`Found ${o.length} path parameters for operation ${n.operationId}`);const s=o.map(a=>{const c=Y(a);return this.context.logger.info(`Adding path parameter: ${a.name} (type: ${c})`),{name:a.name,type:c,hasQuestionToken:!1,decorators:[{name:"path",arguments:[`'${a.name}'`]}]}}),i=this.resolveRequestType(t,n);return this.context.logger.info(`Adding httpRequest parameter: ${i}`),s.push({name:"httpRequest",hasQuestionToken:i===this.defaultParameterRequestType,type:`${i}`,decorators:[{name:"request",arguments:[]}]}),this.context.logger.info("Adding attributes parameter: Record<string, any>"),s.push({name:"attributes",hasQuestionToken:!0,type:"Record<string, any>",decorators:[{name:"attribute",arguments:[]}]}),s}resolveSchemaReturnType(e,t){const n="Promise<any>";if(g(t)){const o=x(t);this.context.logger.info(`Adding import for response model: ${o.name} from ${o.path}`),f(e,this.context.outputDir,o);const s=`Promise<${o.name}>`;return this.context.logger.info(`Resolved reference return type: ${s}`),s}if(!t.type)return this.context.logger.info(`Schema has no type, using default return type: ${n}`),n;if(b(t.type)){const s=`Promise<${$(t.type)}>`;return this.context.logger.info(`Resolved primitive return type: ${s}`),s}return this.context.logger.info(`Using default return type: ${n}`),n}resolveReturnType(e,t){const n=q(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;const o=V(n)||ue(n);if(o){const i=this.resolveSchemaReturnType(e,o);return this.context.logger.info(`Resolved JSON/wildcard response return type for operation ${t.operationId}: ${i}`),{type:i}}const s=pe(n);if(s){if(g(s)){const a=w(s,this.context.openAPI.components);if(v(a)&&g(a.items)){const c=x(a.items);this.context.logger.info(`Adding import for event stream model: ${c.name} from ${c.path}`),f(e,this.context.outputDir,c);const p=`Promise<JsonServerSentEventStream<${c.name.includes("ServerSentEvent")?`${c.name}['data']`:c.name}>>`;return this.context.logger.info(`Resolved event stream return type for operation ${t.operationId}: ${p}`),{type:p,metadata:O}}}const i="Promise<JsonServerSentEventStream<any>>";return this.context.logger.info(`Resolved generic event stream return type for operation ${t.operationId}: ${i}`),{type:i,metadata:O}}return this.context.logger.info(`Using default return type for operation ${t.operationId}: ${this.defaultReturnType.type}`),this.defaultReturnType}processOperation(e,t,n,o){this.context.logger.info(`Processing operation: ${o.operation.operationId} (${o.method} ${o.path})`);const s=this.getMethodName(n,o.operation);this.context.logger.info(`Generated method name: ${s}`);const i=this.resolveParameters(e,t,o.operation),a=this.resolveReturnType(t,o.operation),c=a.metadata?{name:N(o.method),arguments:[`'${o.path}'`,a.metadata]}:{name:N(o.method),arguments:[`'${o.path}'`]};this.context.logger.info(`Creating method with ${i.length} parameters, return type: ${a.type}`);const l=n.addMethod({name:s,decorators:[c],parameters:i,returnType:a.type,statements:[`throw autoGeneratedError(${i.map(p=>p.name).join(",")});`]});A(l,o.operation.summary,o.operation.description),this.context.logger.success(`Operation method generated: ${s}`)}groupOperations(e){this.context.logger.info("Grouping operations by API client tags");const t=new Map;let n=0;for(const[o,s]of Object.entries(this.context.openAPI.paths)){const i=H(s).filter(a=>{if(!a.operation.operationId)return!1;const c=a.operation.tags;return!c||c.length==0?!1:c.every(l=>e.has(l))});this.context.logger.info(`Path ${o}: found ${i.length} valid operations`);for(const a of i)a.operation.tags.forEach(c=>{const l={...a,path:o};t.has(c)||t.set(c,new Set),t.get(c).add(l),n++})}return this.context.logger.info(`Grouped ${n} operations into ${t.size} tag groups`),t}resolveApiTags(){this.context.logger.info("Resolving API client tags from OpenAPI specification");const e=new Map,t=this.context.openAPI.tags?.length||0;let n=0;return this.context.openAPI.tags?.forEach(o=>{o.name!="wow"&&o.name!="Actuator"&&!this.isAggregateTag(o)?(e.set(o.name,o),n++,this.context.logger.info(`Included API client tag: ${o.name}`)):this.context.logger.info(`Excluded tag: ${o.name} (wow/Actuator/aggregate)`)}),this.context.logger.info(`Resolved ${n} API client tags from ${t} total tags`),e}isAggregateTag(e){for(const t of this.context.contextAggregates.values())for(const n of t)if(n.aggregate.tag.name===e.name)return!0;return!1}}class Be{constructor(e){this.context=e}commandEndpointPathsName="COMMAND_ENDPOINT_PATHS";defaultCommandClientOptionsName="DEFAULT_COMMAND_CLIENT_OPTIONS";generate(){const e=Array.from(this.context.contextAggregates.values()).reduce((n,o)=>n+o.size,0);this.context.logger.info("--- Generating Command Clients ---"),this.context.logger.progress(`Generating command clients for ${e} aggregates`);let t=0;for(const[,n]of this.context.contextAggregates)n.forEach(o=>{t++,this.context.logger.progressWithCount(t,e,`Processing command client for aggregate: ${o.aggregate.aggregateName}`),this.processAggregate(o)});this.context.logger.success("Command client generation completed")}processAggregate(e){this.context.logger.info(`Processing command client for aggregate: ${e.aggregate.aggregateName} in context: ${e.aggregate.contextAlias}`);const t=ie(this.context.project,this.context.outputDir,e.aggregate,"commandClient");this.context.logger.info(`Processing command endpoint paths for ${e.commands.size} commands`),this.processCommandEndpointPaths(t,e),this.context.logger.info(`Creating default command client options: ${this.defaultCommandClientOptionsName}`),t.addVariableStatement({declarationKind:C.VariableDeclarationKind.Const,declarations:[{name:this.defaultCommandClientOptionsName,type:"ApiMetadata",initializer:`{
6
6
  basePath: '${e.aggregate.contextAlias}'
7
- }`}],isExported:!1}),this.context.logger.info(`Adding imports from ${T}: CommandRequest, CommandResult, CommandResultEventStream, DeleteAggregate, RecoverAggregate`),t.addImportDeclaration({moduleSpecifier:T,namedImports:["CommandRequest","CommandResult","CommandResultEventStream","DeleteAggregate","RecoverAggregate"],isTypeOnly:!0}),this.context.logger.info("Adding import from @ahoo-wang/fetcher-eventstream: JsonEventStreamResultExtractor"),t.addImportDeclaration({moduleSpecifier:"@ahoo-wang/fetcher-eventstream",namedImports:["JsonEventStreamResultExtractor"]}),this.context.logger.info("Adding import from @ahoo-wang/fetcher: ContentTypeValues"),R(t,"@ahoo-wang/fetcher",["ContentTypeValues"]),this.context.logger.info("Adding imports from @ahoo-wang/fetcher-decorator: ApiMetadata types and decorators"),ne(t),this.context.logger.info("Generating standard command client class"),this.processCommandClient(t,e),this.context.logger.info("Generating stream command client class"),this.processCommandClient(t,e,!0),this.context.logger.success(`Command client generation completed for aggregate: ${e.aggregate.aggregateName}`)}processCommandEndpointPaths(e,t){this.context.logger.info(`Creating command endpoint paths enum: ${this.commandEndpointPathsName}`);const n=e.addEnum({name:this.commandEndpointPathsName});t.commands.forEach(o=>{this.context.logger.info(`Adding command endpoint: ${o.name.toUpperCase()} = '${o.path}'`),n.addMember({name:o.name.toUpperCase(),initializer:`'${o.path}'`})}),this.context.logger.success(`Command endpoint paths enum created with ${t.commands.size} entries`)}getEndpointPath(e){return`${this.commandEndpointPathsName}.${e.name.toUpperCase()}`}processCommandClient(e,t,n=!1){let o="CommandClient",s=[],i="Promise<CommandResult>";n&&(o="Stream"+o,s=["''",O],i="Promise<CommandResultEventStream>");const a=_e(t.aggregate,o),c=oe(a,e,s);re(c,this.defaultCommandClientOptionsName),t.commands.forEach(l=>{this.processCommandMethod(t,e,c,l,i)})}resolveParameters(e,t,n){const o=m(n.schema.key);this.context.logger.info(`Adding import for command model: ${o.name} from path: ${o.path}`),f(t,this.context.outputDir,o);const s=n.pathParameters.filter(i=>!this.context.isIgnoreCommandClientPathParameters(e.name,i.name)).map(i=>{const a=Y(i);return this.context.logger.info(`Adding path parameter: ${i.name} (type: ${a})`),{name:i.name,type:a,hasQuestionToken:!1,decorators:[{name:"path",arguments:[`'${i.name}'`]}]}});return this.context.logger.info(`Adding command request parameter: commandRequest (type: CommandRequest<${o.name}>)`),s.push({name:"commandRequest",hasQuestionToken:he(n.schema.schema),type:`CommandRequest<${o.name}>`,decorators:[{name:"request",arguments:[]}]}),this.context.logger.info("Adding attributes parameter: attributes (type: Record<string, any>)"),s.push({name:"attributes",hasQuestionToken:!0,type:"Record<string, any>",decorators:[{name:"attribute",arguments:[]}]}),s}processCommandMethod(e,t,n,o,s){this.context.logger.info(`Generating command method: ${y(o.name)} for command: ${o.name}`),this.context.logger.info(`Command method details: HTTP ${o.method}, path: ${o.path}, return type: ${s}`);const i=this.resolveParameters(e.aggregate.tag,t,o),a=n.addMethod({name:y(o.name),decorators:[{name:N(o.method),arguments:[`${this.getEndpointPath(o)}`]}],parameters:i,returnType:s,statements:[`throw autoGeneratedError(${i.map(c=>c.name).join(",")});`]});(o.summary||o.description)&&this.context.logger.info(`Adding JSDoc documentation for method: ${y(o.name)}`),A(a,o.summary,o.description),this.context.logger.success(`Command method generated: ${y(o.name)}`)}}class Be{constructor(e){this.context=e}generate(){const e=Array.from(this.context.contextAggregates.values()).reduce((n,o)=>n+o.size,0);this.context.logger.info("--- Generating Query Clients ---"),this.context.logger.progress(`Generating query clients for ${e} aggregates`);let t=0;for(const[,n]of this.context.contextAggregates)n.forEach(o=>{t++,this.context.logger.progressWithCount(t,e,`Processing query client for aggregate: ${o.aggregate.aggregateName}`),this.processQueryClient(o)});this.context.logger.success("Query client generation completed")}createClientFilePath(e,t){return se(this.context.project,this.context.outputDir,e,t)}processQueryClient(e){const t=this.createClientFilePath(e.aggregate,"queryClient");this.context.logger.info(`Processing query client for aggregate: ${e.aggregate.aggregateName} in context: ${e.aggregate.contextAlias}`),this.context.logger.info(`Adding imports from ${T}: QueryClientFactory, QueryClientOptions, ResourceAttributionPathSpec`),t.addImportDeclaration({moduleSpecifier:T,namedImports:["QueryClientFactory","QueryClientOptions","ResourceAttributionPathSpec"]});const n="DEFAULT_QUERY_CLIENT_OPTIONS";this.context.logger.info(`Creating default query client options: ${n}`),t.addVariableStatement({declarationKind:C.VariableDeclarationKind.Const,declarations:[{name:n,type:"QueryClientOptions",initializer:`{
7
+ }`}],isExported:!1}),this.context.logger.info(`Adding imports from ${I}: CommandRequest, CommandResult, CommandResultEventStream, DeleteAggregate, RecoverAggregate`),t.addImportDeclaration({moduleSpecifier:I,namedImports:["CommandRequest","CommandResult","CommandResultEventStream","DeleteAggregate","RecoverAggregate"],isTypeOnly:!0}),this.context.logger.info("Adding import from @ahoo-wang/fetcher-eventstream: JsonEventStreamResultExtractor"),se(t),this.context.logger.info("Adding import from @ahoo-wang/fetcher: ContentTypeValues"),T(t,"@ahoo-wang/fetcher",["ContentTypeValues"]),this.context.logger.info("Adding imports from @ahoo-wang/fetcher-decorator: ApiMetadata types and decorators"),ne(t),this.context.logger.info("Generating standard command client class"),this.processCommandClient(t,e),this.context.logger.info("Generating stream command client class"),this.processCommandClient(t,e,!0),this.context.logger.success(`Command client generation completed for aggregate: ${e.aggregate.aggregateName}`)}processCommandEndpointPaths(e,t){this.context.logger.info(`Creating command endpoint paths enum: ${this.commandEndpointPathsName}`);const n=e.addEnum({name:this.commandEndpointPathsName});t.commands.forEach(o=>{this.context.logger.info(`Adding command endpoint: ${o.name.toUpperCase()} = '${o.path}'`),n.addMember({name:o.name.toUpperCase(),initializer:`'${o.path}'`})}),this.context.logger.success(`Command endpoint paths enum created with ${t.commands.size} entries`)}getEndpointPath(e){return`${this.commandEndpointPathsName}.${e.name.toUpperCase()}`}processCommandClient(e,t,n=!1){let o="CommandClient",s=[],i="Promise<CommandResult>";n&&(o="Stream"+o,s=["''",O],i="Promise<CommandResultEventStream>");const a=ze(t.aggregate,o),c=oe(a,e,s);re(c,this.defaultCommandClientOptionsName),t.commands.forEach(l=>{this.processCommandMethod(t,e,c,l,i)})}resolveParameters(e,t,n){const o=d(n.schema.key);this.context.logger.info(`Adding import for command model: ${o.name} from path: ${o.path}`),f(t,this.context.outputDir,o);const s=n.pathParameters.filter(i=>!this.context.isIgnoreCommandClientPathParameters(e.name,i.name)).map(i=>{const a=Y(i);return this.context.logger.info(`Adding path parameter: ${i.name} (type: ${a})`),{name:i.name,type:a,hasQuestionToken:!1,decorators:[{name:"path",arguments:[`'${i.name}'`]}]}});return this.context.logger.info(`Adding command request parameter: commandRequest (type: CommandRequest<${o.name}>)`),s.push({name:"commandRequest",hasQuestionToken:ye(n.schema.schema),type:`CommandRequest<${o.name}>`,decorators:[{name:"request",arguments:[]}]}),this.context.logger.info("Adding attributes parameter: attributes (type: Record<string, any>)"),s.push({name:"attributes",hasQuestionToken:!0,type:"Record<string, any>",decorators:[{name:"attribute",arguments:[]}]}),s}processCommandMethod(e,t,n,o,s){this.context.logger.info(`Generating command method: ${y(o.name)} for command: ${o.name}`),this.context.logger.info(`Command method details: HTTP ${o.method}, path: ${o.path}, return type: ${s}`);const i=this.resolveParameters(e.aggregate.tag,t,o),a=n.addMethod({name:y(o.name),decorators:[{name:N(o.method),arguments:[`${this.getEndpointPath(o)}`]}],parameters:i,returnType:s,statements:[`throw autoGeneratedError(${i.map(c=>c.name).join(",")});`]});(o.summary||o.description)&&this.context.logger.info(`Adding JSDoc documentation for method: ${y(o.name)}`),A(a,o.summary,o.description),this.context.logger.success(`Command method generated: ${y(o.name)}`)}}class ke{constructor(e){this.context=e}generate(){const e=Array.from(this.context.contextAggregates.values()).reduce((n,o)=>n+o.size,0);this.context.logger.info("--- Generating Query Clients ---"),this.context.logger.progress(`Generating query clients for ${e} aggregates`);let t=0;for(const[,n]of this.context.contextAggregates)n.forEach(o=>{t++,this.context.logger.progressWithCount(t,e,`Processing query client for aggregate: ${o.aggregate.aggregateName}`),this.processQueryClient(o)});this.context.logger.success("Query client generation completed")}createClientFilePath(e,t){return ie(this.context.project,this.context.outputDir,e,t)}processQueryClient(e){const t=this.createClientFilePath(e.aggregate,"queryClient");this.context.logger.info(`Processing query client for aggregate: ${e.aggregate.aggregateName} in context: ${e.aggregate.contextAlias}`),this.context.logger.info(`Adding imports from ${I}: QueryClientFactory, QueryClientOptions, ResourceAttributionPathSpec`),t.addImportDeclaration({moduleSpecifier:I,namedImports:["QueryClientFactory","QueryClientOptions","ResourceAttributionPathSpec"]});const n="DEFAULT_QUERY_CLIENT_OPTIONS";this.context.logger.info(`Creating default query client options: ${n}`),t.addVariableStatement({declarationKind:C.VariableDeclarationKind.Const,declarations:[{name:n,type:"QueryClientOptions",initializer:`{
8
8
  contextAlias: '${e.aggregate.contextAlias}',
9
9
  aggregateName: '${e.aggregate.aggregateName}',
10
- resourceAttribution: ${Ge(e)},
11
- }`}],isExported:!1});const o=[];this.context.logger.info(`Processing ${e.events.size} domain events for aggregate: ${e.aggregate.aggregateName}`);for(const p of e.events.values()){const u=m(p.schema.key);this.context.logger.info(`Adding import for event model: ${u.name} from path: ${u.path}`),f(t,this.context.outputDir,u),o.push(u)}const s="DOMAIN_EVENT_TYPES",i=o.map(p=>p.name).join(" | ");this.context.logger.info(`Creating domain event types union: ${s} = ${i}`),t.addTypeAlias({name:s,type:i});const a=`${y(e.aggregate.aggregateName)}QueryClientFactory`,c=m(e.state.key),l=m(e.fields.key);this.context.logger.info(`Adding import for state model: ${c.name} from path: ${c.path}`),f(t,this.context.outputDir,c),this.context.logger.info(`Adding import for fields model: ${l.name} from path: ${l.path}`),f(t,this.context.outputDir,l),this.context.logger.info(`Creating query client factory: ${a}`),t.addVariableStatement({declarationKind:C.VariableDeclarationKind.Const,declarations:[{name:a,initializer:`new QueryClientFactory<${c.name}, ${l.name} | string, ${s}>(${n})`}],isExported:!0}),this.context.logger.success(`Query client generation completed for aggregate: ${e.aggregate.aggregateName}`)}}class Le{constructor(e){this.context=e,this.queryClientGenerator=new Be(e),this.commandClientGenerator=new ze(e),this.apiClientGenerator=new We(e)}queryClientGenerator;commandClientGenerator;apiClientGenerator;generate(){this.context.logger.info("--- Generating Clients ---"),this.context.logger.progress(`Generating clients for ${this.context.contextAggregates.size} bounded contexts`);let e=0;for(const[t]of this.context.contextAggregates)e++,this.context.logger.progressWithCount(e,this.context.contextAggregates.size,`Processing bounded context: ${t}`,1),this.processBoundedContext(t);this.queryClientGenerator.generate(),this.commandClientGenerator.generate(),this.apiClientGenerator.generate(),this.context.logger.success("Client generation completed")}processBoundedContext(e){const t=`${e}/boundedContext.ts`;this.context.logger.info(`Creating bounded context file: ${t}`);const n=this.context.getOrCreateSourceFile(t);this.context.logger.info(`Adding bounded context alias constant: BOUNDED_CONTEXT_ALIAS = '${e}'`),n.addStatements(`export const BOUNDED_CONTEXT_ALIAS = '${e}';`),this.context.logger.success(`Bounded context file created successfully: ${t}`)}}class ke{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 te(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)}}const ie="./fetcher-generator.config.json";class Ue{constructor(e){this.options=e,this.project=new C.Project({tsConfigFilePath:this.options.tsConfigFilePath}),this.options.logger.info("Project instance created with tsConfigFilePath: ",this.options.tsConfigFilePath)}project;async generate(){this.options.logger.info("Starting code generation from OpenAPI specification"),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");const e=await Pe(this.options.inputPath);this.options.logger.info("OpenAPI specification parsed successfully"),this.options.logger.info("Resolving bounded context aggregates");const n=new De(e).resolve();this.options.logger.info(`Resolved ${n.size} bounded context aggregates`);const o=this.options.configPath??ie;let s={};try{this.options.logger.info("Parsing configuration file:",o),s=await $e(o)}catch(l){this.options.logger.info("Configuration file parsing failed ",l)}const i=new ke({openAPI:e,project:this.project,outputDir:this.options.outputDir,contextAggregates:n,logger:this.options.logger,config:s});this.options.logger.info("Generating models"),new qe(i).generate(),this.options.logger.info("Models generated successfully"),this.options.logger.info("Generating clients"),new Le(i).generate(),this.options.logger.info("Clients generated successfully"),this.options.logger.info("Generating index files"),this.generateIndex(),this.options.logger.info("Index files generated successfully"),this.options.logger.info("Optimizing source files"),this.optimizeSourceFiles(),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(){this.options.logger.info(`Generating index files for output directory: ${this.options.outputDir}`);const e=this.project.getDirectory(this.options.outputDir);if(!e){this.options.logger.info("Output directory not found, skipping index generation");return}this.processDirectory(e),this.generateIndexForDirectory(e),this.options.logger.info("Index file generation completed")}processDirectory(e){const t=e.getDirectories();this.options.logger.info(`Processing ${t.length} subdirectories`);for(const n of t)this.options.logger.info(`Processing subdirectory: ${n.getPath()}`),this.generateIndexForDirectory(n),this.processDirectory(n)}generateIndexForDirectory(e){const t=e.getPath();this.options.logger.info(`Generating index for directory: ${t}`);const n=e.getSourceFiles().filter(a=>a.getBaseName().endsWith(".ts")&&a.getBaseName()!=="index.ts"),o=e.getDirectories();if(this.options.logger.info(`Found ${n.length} TypeScript files and ${o.length} subdirectories in ${t}`),n.length===0&&o.length===0){this.options.logger.info(`No files or subdirectories to export in ${t}, skipping index generation`);return}const s=`${t}/index.ts`;this.options.logger.info(`Creating/updating index file: ${s}`);const i=this.project.getSourceFile(s)||this.project.createSourceFile(s,"",{overwrite:!0});i.removeText();for(const a of n){const c=`./${a.getBaseNameWithoutExtension()}`;this.options.logger.info(`Adding export for file: ${c}`),i.addExportDeclaration({moduleSpecifier:c,isTypeOnly:!1,namedExports:[]})}for(const a of o){const c=`./${a.getBaseName()}`;this.options.logger.info(`Adding export for subdirectory: ${c}`),i.addExportDeclaration({moduleSpecifier:c,isTypeOnly:!1,namedExports:[]})}this.options.logger.info(`Index file generated for ${t} with ${n.length+o.length} exports`)}optimizeSourceFiles(){const e=this.project.getSourceFiles();this.options.logger.info(`Optimizing ${e.length} source files`),e.forEach((t,n)=>{this.options.logger.info(`Optimizing file ${n+1}/${e.length}`),t.formatText(),t.organizeImports(),t.fixMissingImports()}),this.options.logger.info("All source files optimized")}}exports.CodeGenerator=Ue;exports.DEFAULT_CONFIG_PATH=ie;
10
+ resourceAttribution: ${We(e)},
11
+ }`}],isExported:!1});const o=[];this.context.logger.info(`Processing ${e.events.size} domain events for aggregate: ${e.aggregate.aggregateName}`);for(const p of e.events.values()){const u=d(p.schema.key);this.context.logger.info(`Adding import for event model: ${u.name} from path: ${u.path}`),f(t,this.context.outputDir,u),o.push(u)}const s="DOMAIN_EVENT_TYPES",i=o.map(p=>p.name).join(" | ");this.context.logger.info(`Creating domain event types union: ${s} = ${i}`),t.addTypeAlias({name:s,type:i});const a=`${y(e.aggregate.aggregateName)}QueryClientFactory`,c=d(e.state.key),l=d(e.fields.key);this.context.logger.info(`Adding import for state model: ${c.name} from path: ${c.path}`),f(t,this.context.outputDir,c),this.context.logger.info(`Adding import for fields model: ${l.name} from path: ${l.path}`),f(t,this.context.outputDir,l),this.context.logger.info(`Creating query client factory: ${a}`),t.addVariableStatement({declarationKind:C.VariableDeclarationKind.Const,declarations:[{name:a,initializer:`new QueryClientFactory<${c.name}, ${l.name} | string, ${s}>(${n})`}],isExported:!0}),this.context.logger.success(`Query client generation completed for aggregate: ${e.aggregate.aggregateName}`)}}class Ue{constructor(e){this.context=e,this.queryClientGenerator=new ke(e),this.commandClientGenerator=new Be(e),this.apiClientGenerator=new Le(e)}queryClientGenerator;commandClientGenerator;apiClientGenerator;generate(){this.context.logger.info("--- Generating Clients ---"),this.context.logger.progress(`Generating clients for ${this.context.contextAggregates.size} bounded contexts`);let e=0;for(const[t]of this.context.contextAggregates)e++,this.context.logger.progressWithCount(e,this.context.contextAggregates.size,`Processing bounded context: ${t}`,1),this.processBoundedContext(t);this.queryClientGenerator.generate(),this.commandClientGenerator.generate(),this.apiClientGenerator.generate(),this.context.logger.success("Client generation completed")}processBoundedContext(e){const t=`${e}/boundedContext.ts`;this.context.logger.info(`Creating bounded context file: ${t}`);const n=this.context.getOrCreateSourceFile(t);this.context.logger.info(`Adding bounded context alias constant: BOUNDED_CONTEXT_ALIAS = '${e}'`),n.addStatements(`export const BOUNDED_CONTEXT_ALIAS = '${e}';`),this.context.logger.success(`Bounded context file created successfully: ${t}`)}}class Qe{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 te(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)}}const ae="./fetcher-generator.config.json";class Ve{constructor(e){this.options=e,this.project=new C.Project({tsConfigFilePath:this.options.tsConfigFilePath}),this.options.logger.info("Project instance created with tsConfigFilePath: ",this.options.tsConfigFilePath)}project;async generate(){this.options.logger.info("Starting code generation from OpenAPI specification"),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");const e=await $e(this.options.inputPath);this.options.logger.info("OpenAPI specification parsed successfully"),this.options.logger.info("Resolving bounded context aggregates");const n=new be(e).resolve();this.options.logger.info(`Resolved ${n.size} bounded context aggregates`);const o=this.options.configPath??ae;let s={};try{this.options.logger.info("Parsing configuration file:",o),s=await Te(o)}catch(l){this.options.logger.info("Configuration file parsing failed ",l)}const i=new Qe({openAPI:e,project:this.project,outputDir:this.options.outputDir,contextAggregates:n,logger:this.options.logger,config:s});this.options.logger.info("Generating models"),new Me(i).generate(),this.options.logger.info("Models generated successfully"),this.options.logger.info("Generating clients"),new Ue(i).generate(),this.options.logger.info("Clients generated successfully"),this.options.logger.info("Generating index files"),this.generateIndex(),this.options.logger.info("Index files generated successfully"),this.options.logger.info("Optimizing source files"),this.optimizeSourceFiles(),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(){this.options.logger.info(`Generating index files for output directory: ${this.options.outputDir}`);const e=this.project.getDirectory(this.options.outputDir);if(!e){this.options.logger.info("Output directory not found, skipping index generation");return}this.processDirectory(e),this.generateIndexForDirectory(e),this.options.logger.info("Index file generation completed")}processDirectory(e){const t=e.getDirectories();this.options.logger.info(`Processing ${t.length} subdirectories`);for(const n of t)this.options.logger.info(`Processing subdirectory: ${n.getPath()}`),this.generateIndexForDirectory(n),this.processDirectory(n)}generateIndexForDirectory(e){const t=e.getPath();this.options.logger.info(`Generating index for directory: ${t}`);const n=e.getSourceFiles().filter(a=>a.getBaseName().endsWith(".ts")&&a.getBaseName()!=="index.ts"),o=e.getDirectories();if(this.options.logger.info(`Found ${n.length} TypeScript files and ${o.length} subdirectories in ${t}`),n.length===0&&o.length===0){this.options.logger.info(`No files or subdirectories to export in ${t}, skipping index generation`);return}const s=`${t}/index.ts`;this.options.logger.info(`Creating/updating index file: ${s}`);const i=this.project.getSourceFile(s)||this.project.createSourceFile(s,"",{overwrite:!0});i.removeText();for(const a of n){const c=`./${a.getBaseNameWithoutExtension()}`;this.options.logger.info(`Adding export for file: ${c}`),i.addExportDeclaration({moduleSpecifier:c,isTypeOnly:!1,namedExports:[]})}for(const a of o){const c=`./${a.getBaseName()}`;this.options.logger.info(`Adding export for subdirectory: ${c}`),i.addExportDeclaration({moduleSpecifier:c,isTypeOnly:!1,namedExports:[]})}this.options.logger.info(`Index file generated for ${t} with ${n.length+o.length} exports`)}optimizeSourceFiles(){const e=this.project.getSourceFiles();this.options.logger.info(`Optimizing ${e.length} source files`),e.forEach((t,n)=>{this.options.logger.info(`Optimizing file ${n+1}/${e.length}`),t.formatText(),t.organizeImports(),t.fixMissingImports()}),this.options.logger.info("All source files optimized")}}exports.CodeGenerator=Ve;exports.DEFAULT_CONFIG_PATH=ae;
12
12
  //# sourceMappingURL=index.cjs.map