@ahoo-wang/fetcher-generator 2.10.3 → 2.10.5
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 +3 -8
- package/README.zh-CN.md +4 -3
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,20 +8,14 @@
|
|
|
8
8
|
[](https://www.npmjs.com/package/@ahoo-wang/fetcher-generator)
|
|
9
9
|
[](https://deepwiki.com/Ahoo-Wang/fetcher)
|
|
10
10
|
|
|
11
|
-
TypeScript code
|
|
12
|
-
Generates type-safe models, query
|
|
13
|
-
clients, and command clients from OpenAPI specifications.
|
|
11
|
+
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.
|
|
14
12
|
|
|
15
|
-
**[Wow](https://github.com/Ahoo-Wang/Wow) Framework**: A domain-driven design framework that provides event sourcing,
|
|
16
|
-
CQRS (Command Query Responsibility
|
|
17
|
-
Segregation),
|
|
18
|
-
and aggregate patterns for building scalable distributed systems.
|
|
13
|
+
**[Wow](https://github.com/Ahoo-Wang/Wow) Framework**: A domain-driven design framework that provides event sourcing, CQRS (Command Query Responsibility Segregation), and aggregate patterns for building scalable distributed systems. This generator provides enhanced support for Wow's CQRS architecture while remaining compatible with standard REST APIs.
|
|
19
14
|
|
|
20
15
|
## 🌟 Features
|
|
21
16
|
|
|
22
17
|
- **🎯 OpenAPI 3.0+ Support**: Full support for OpenAPI 3.0+ specifications (JSON/YAML)
|
|
23
18
|
- **📦 TypeScript Code Generation**: Generates type-safe TypeScript interfaces, enums, and classes
|
|
24
|
-
- **🏗️ Domain-Driven Design**: Specialized for WOW framework with aggregates, commands, queries, and events
|
|
25
19
|
- **🔧 CLI Tool**: Easy-to-use command-line interface for code generation
|
|
26
20
|
- **🎨 Decorator-Based APIs**: Generates decorator-based client classes for clean API interactions
|
|
27
21
|
- **📋 Comprehensive Models**: Handles complex schemas including unions, intersections, enums, and references
|
|
@@ -30,6 +24,7 @@ and aggregate patterns for building scalable distributed systems.
|
|
|
30
24
|
- **📁 Auto Index Generation**: Automatically generates index.ts files for clean module organization
|
|
31
25
|
- **🌐 Remote Spec Support**: Load OpenAPI specs directly from HTTP/HTTPS URLs
|
|
32
26
|
- **🎭 Event Streaming**: Generates both regular and event-stream command clients
|
|
27
|
+
- **🏗️ Domain-Driven Design Support**: Specialized support for Wow framework with aggregates, commands, queries, and events (CQRS patterns)
|
|
33
28
|
|
|
34
29
|
## 🚀 Quick Start
|
|
35
30
|
|
package/README.zh-CN.md
CHANGED
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
[](https://www.npmjs.com/package/@ahoo-wang/fetcher-generator)
|
|
8
8
|
[](https://www.npmjs.com/package/@ahoo-wang/fetcher-generator)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
一个功能强大的 TypeScript 代码生成工具,能够基于 OpenAPI 规范自动生成类型安全的 API 客户端代码。不仅适用于通用场景,还专门为 [Wow](https://github.com/Ahoo-Wang/Wow) 领域驱动设计框架 深度优化,原生支持 CQRS 架构模式。
|
|
11
11
|
|
|
12
|
-
**[Wow](https://github.com/Ahoo-Wang/Wow) 框架**:一个领域驱动设计框架,提供事件溯源、CQRS
|
|
12
|
+
**[Wow](https://github.com/Ahoo-Wang/Wow) 框架**:一个领域驱动设计框架,提供事件溯源、CQRS(命令查询责任分离)和聚合模式,用于构建可扩展的分布式系统。此生成器为 Wow 的 CQRS 架构提供增强支持,同时保持与标准 REST API 的兼容性。
|
|
13
13
|
|
|
14
14
|
## 🌟 特性
|
|
15
15
|
|
|
16
16
|
- **🎯 OpenAPI 3.0+ 支持**:完整支持 OpenAPI 3.0+ 规范(JSON/YAML)
|
|
17
17
|
- **📦 TypeScript 代码生成**:生成类型安全的 TypeScript 接口、枚举和类
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
- **🔧 CLI 工具**:易用的命令行界面,用于代码生成
|
|
20
20
|
- **🎨 装饰器式 API**:生成装饰器式的客户端类,实现清晰的 API 交互
|
|
21
21
|
- **📋 全面的模型**:处理复杂的模式,包括联合、交集、枚举和引用
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
- **📁 自动索引生成**:自动生成 index.ts 文件,实现清晰的模块组织
|
|
25
25
|
- **🌐 远程规范支持**:直接从 HTTP/HTTPS URL 加载 OpenAPI 规范
|
|
26
26
|
- **🎭 事件流**:生成常规和事件流命令客户端
|
|
27
|
+
- **🏗️ 领域驱动设计支持**:为 Wow 框架提供专门支持,支持聚合、命令、查询和领域事件(CQRS 模式)
|
|
27
28
|
|
|
28
29
|
## 🚀 快速开始
|
|
29
30
|
|
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.10.
|
|
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.10.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;
|
|
3
3
|
//# sourceMappingURL=cli.cjs.map
|
package/dist/cli.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahoo-wang/fetcher-generator",
|
|
3
|
-
"version": "2.10.
|
|
4
|
-
"description": "TypeScript code
|
|
3
|
+
"version": "2.10.5",
|
|
4
|
+
"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.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fetch",
|
|
7
7
|
"http",
|