@hedystia/swagger 1.2.8 → 1.2.10

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/package.json +2 -2
  3. package/readme.md +167 -167
package/dist/index.d.ts CHANGED
@@ -32,6 +32,11 @@ declare class Swagger {
32
32
  generateHTML(): string;
33
33
  }
34
34
 
35
+ /**
36
+ * Create Swagger plugin
37
+ * @param {SwaggerOptions} [options] - Swagger options
38
+ * @returns Plugin instance
39
+ */
35
40
  declare function swagger(options?: SwaggerOptions): {
36
41
  plugin: Hedystia<[{
37
42
  method: "GET";
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@hedystia/swagger",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "devDependencies": {
5
5
  "@types/bun": "latest",
6
6
  "tsup": "^8.3.5"
7
7
  },
8
8
  "dependencies": {
9
9
  "@apidevtools/swagger-parser": "^10.1.1",
10
- "hedystia": "^1.2.8",
10
+ "hedystia": "^1.2.10",
11
11
  "openapi-types": "^12.1.3"
12
12
  },
13
13
  "peerDependencies": {
package/readme.md CHANGED
@@ -1,167 +1,167 @@
1
- <div align="center">
2
- <p>
3
- <strong>🚀 Hedystia Framework</strong>
4
- </p>
5
-
6
- <p>
7
- <strong>Next-gen TypeScript framework for building type-safe APIs at lightspeed! ⚡</strong>
8
- </p>
9
-
10
- <p>
11
- <a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/v/hedystia.svg?style=flat-square" alt="npm version"></a>
12
- <a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/dm/hedystia.svg?style=flat-square" alt="npm downloads"></a>
13
- <a href="LICENSE"><img src="https://img.shields.io/github/license/Hedystia/Framework.svg?style=flat-square" alt="license"></a>
14
- <img src="https://img.shields.io/badge/Bun-powered-FFD43B?style=flat-square&logo=bun" alt="Bun powered">
15
- </p>
16
- </div>
17
-
18
- ## 🚨 Early Access Notice
19
- > **Warning**
20
- > Framework is in active development. Core features are stable but some advanced functionality still being implemented.
21
-
22
- ## 🌟 Superpowers
23
-
24
- - 🌐 **Multi-runtime support** - Bun (default), Deno, Node.js, Vercel, Cloudflare Workers, Fastly Compute, Lambda, etc.
25
- - 🔒 **End-to-end type safety** - From params to response, full TypeScript integration
26
- - ⚡ **Bun-native performance** - Built for Bun runtime with native validation
27
- - 🧩 **Client integration** - Auto-generated type-safe HTTP client
28
- - 🛡️ **Validation built-in** - Zod integration for runtime safety
29
- - 🔌 **Extensible architecture** - Middleware, hooks and macros system
30
- - 📝 **Standard Schema** - Compatibility with the standard schema so you can use it with Zod, Arktype, etc.
31
-
32
- ## 🚀 Launch in 30 Seconds
33
-
34
- 1. Install with Bun:
35
- ```bash
36
- bun add hedystia
37
- ```
38
-
39
- 2. Create your first API:
40
- ```typescript
41
- import { Hedystia, h } from "hedystia";
42
-
43
- const app = new Hedystia()
44
- .get("/hello/:name", (ctx) => `Hello ${ctx.params.name}!`, {
45
- params: h.object({ name: h.string() }),
46
- response: h.string()
47
- })
48
- .listen(3000);
49
- ```
50
-
51
- 3. Generate client and consume API:
52
- ```typescript
53
- import { createClient } from "@hedystia/client";
54
-
55
- const client = createClient<typeof app>("http://localhost:3000");
56
-
57
- // Fully typed request!
58
- const { data } = await client.hello.name("World").get();
59
- console.log(data); // "Hello World!"
60
- ```
61
-
62
- ## 💡 Why Developers Love Hedystia
63
-
64
- ### 🔄 Full-stack Type Safety
65
- ```typescript
66
- // Server-side validation
67
- .post("/users", (ctx) => {...}, {
68
- body: h.object({
69
- email: h.email(),
70
- age: h.number()
71
- })
72
- })
73
-
74
- // Client-side types
75
- await client.users.post({
76
- email: "user@example.com", // Autocompletes!
77
- age: 25 // Type-checked
78
- });
79
- ```
80
-
81
- ### 📖 Swagger Integration
82
-
83
- ```typescript
84
- import { swagger } from "@hedystia/swagger";
85
-
86
- const swaggerPlugin = swagger({
87
- title: "My API",
88
- description: "An example API with Swagger",
89
- version: "1.0.0",
90
- tags: [
91
- { name: "users", description: "User operations" },
92
- ],
93
- });
94
-
95
- swaggerPlugin.captureRoutes(app);
96
-
97
- app.use("/swagger", swaggerPlugin.plugin).listen(3000);
98
- ```
99
-
100
- ### ⚡ Performance First
101
- - Bun runtime optimized
102
- - Faster by default
103
- - Own type validation system
104
- - Faster than Express
105
- - Built-in response compression
106
-
107
- ### 🧩 Modern Feature Set
108
- ```typescript
109
- // File uploads
110
- .post("/upload", async (ctx) => {
111
- const formData = await ctx.body; // FormData type
112
- })
113
-
114
- // Binary responses
115
- .get("/pdf", () => new Blob([...]), {
116
- response: h.instanceof(Blob)
117
- })
118
-
119
- // Nested routing
120
- .group("/api/v1", (v1) => v1
121
- .group("/users", (users) => users
122
- .get("/:id", ...)
123
- )
124
- )
125
- ```
126
-
127
- ## 🛠️ Development Roadmap
128
-
129
- ### Core Features
130
- - ✅ HTTP Methods: GET, POST, PUT, PATCH, DELETE
131
- - ✅ Response Types: JSON, Text, FormData, Blob, ArrayBuffer
132
- - ✅ Router Groups & Middleware
133
- - ✅ Type-safe Client Generation
134
- - ✅ WebSocket Support
135
- - ✅ Adapter System to work with other frameworks
136
-
137
- ### Advanced Capabilities
138
- - ✅ Standard Schema Compatibility
139
- - ✅ Hooks System (onRequest, onError, etc)
140
- - ✅ Macro System for Auth/Rate Limiting
141
- - ✅ OpenAPI - Swagger Integration
142
-
143
- ## 💼 Production Ready
144
- ```typescript
145
- // Error handling
146
- .onError((err) => {
147
- return Response.json({
148
- error: err.message
149
- }, { status: 500 })
150
- })
151
-
152
- // Rate limiting macro
153
- .macro({
154
- rateLimit: () => ({
155
- resolve: async (ctx) => {
156
- // Implement your logic
157
- }
158
- })
159
- })
160
- ```
161
-
162
- ## 📜 License
163
- MIT License © 2025 Hedystia
164
-
165
- ## 🗣️ Community
166
- - [GitHub Issues](https://github.com/Hedystia/Framework/issues)
167
- - [Discord Server](https://hedystia.com/support)
1
+ <div align="center">
2
+ <p>
3
+ <strong>🚀 Hedystia Framework</strong>
4
+ </p>
5
+
6
+ <p>
7
+ <strong>Next-gen TypeScript framework for building type-safe APIs at lightspeed! ⚡</strong>
8
+ </p>
9
+
10
+ <p>
11
+ <a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/v/hedystia.svg?style=flat-square" alt="npm version"></a>
12
+ <a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/dm/hedystia.svg?style=flat-square" alt="npm downloads"></a>
13
+ <a href="LICENSE"><img src="https://img.shields.io/github/license/Hedystia/Framework.svg?style=flat-square" alt="license"></a>
14
+ <img src="https://img.shields.io/badge/Bun-powered-FFD43B?style=flat-square&logo=bun" alt="Bun powered">
15
+ </p>
16
+ </div>
17
+
18
+ ## 🚨 Early Access Notice
19
+ > **Warning**
20
+ > Framework is in active development. Core features are stable but some advanced functionality still being implemented.
21
+
22
+ ## 🌟 Superpowers
23
+
24
+ - 🌐 **Multi-runtime support** - Bun (default), Deno, Node.js, Vercel, Cloudflare Workers, Fastly Compute, Lambda, etc.
25
+ - 🔒 **End-to-end type safety** - From params to response, full TypeScript integration
26
+ - ⚡ **Bun-native performance** - Built for Bun runtime with native validation
27
+ - 🧩 **Client integration** - Auto-generated type-safe HTTP client
28
+ - 🛡️ **Validation built-in** - Zod integration for runtime safety
29
+ - 🔌 **Extensible architecture** - Middleware, hooks and macros system
30
+ - 📝 **Standard Schema** - Compatibility with the standard schema so you can use it with Zod, Arktype, etc.
31
+
32
+ ## 🚀 Launch in 30 Seconds
33
+
34
+ 1. Install with Bun:
35
+ ```bash
36
+ bun add hedystia
37
+ ```
38
+
39
+ 2. Create your first API:
40
+ ```typescript
41
+ import { Hedystia, h } from "hedystia";
42
+
43
+ const app = new Hedystia()
44
+ .get("/hello/:name", (ctx) => `Hello ${ctx.params.name}!`, {
45
+ params: h.object({ name: h.string() }),
46
+ response: h.string()
47
+ })
48
+ .listen(3000);
49
+ ```
50
+
51
+ 3. Generate client and consume API:
52
+ ```typescript
53
+ import { createClient } from "@hedystia/client";
54
+
55
+ const client = createClient<typeof app>("http://localhost:3000");
56
+
57
+ // Fully typed request!
58
+ const { data } = await client.hello.name("World").get();
59
+ console.log(data); // "Hello World!"
60
+ ```
61
+
62
+ ## 💡 Why Developers Love Hedystia
63
+
64
+ ### 🔄 Full-stack Type Safety
65
+ ```typescript
66
+ // Server-side validation
67
+ .post("/users", (ctx) => {...}, {
68
+ body: h.object({
69
+ email: h.email(),
70
+ age: h.number()
71
+ })
72
+ })
73
+
74
+ // Client-side types
75
+ await client.users.post({
76
+ email: "user@example.com", // Autocompletes!
77
+ age: 25 // Type-checked
78
+ });
79
+ ```
80
+
81
+ ### 📖 Swagger Integration
82
+
83
+ ```typescript
84
+ import { swagger } from "@hedystia/swagger";
85
+
86
+ const swaggerPlugin = swagger({
87
+ title: "My API",
88
+ description: "An example API with Swagger",
89
+ version: "1.0.0",
90
+ tags: [
91
+ { name: "users", description: "User operations" },
92
+ ],
93
+ });
94
+
95
+ swaggerPlugin.captureRoutes(app);
96
+
97
+ app.use("/swagger", swaggerPlugin.plugin).listen(3000);
98
+ ```
99
+
100
+ ### ⚡ Performance First
101
+ - Bun runtime optimized
102
+ - Faster by default
103
+ - Own type validation system
104
+ - Faster than Express
105
+ - Built-in response compression
106
+
107
+ ### 🧩 Modern Feature Set
108
+ ```typescript
109
+ // File uploads
110
+ .post("/upload", async (ctx) => {
111
+ const formData = await ctx.body; // FormData type
112
+ })
113
+
114
+ // Binary responses
115
+ .get("/pdf", () => new Blob([...]), {
116
+ response: h.instanceof(Blob)
117
+ })
118
+
119
+ // Nested routing
120
+ .group("/api/v1", (v1) => v1
121
+ .group("/users", (users) => users
122
+ .get("/:id", ...)
123
+ )
124
+ )
125
+ ```
126
+
127
+ ## 🛠️ Development Roadmap
128
+
129
+ ### Core Features
130
+ - ✅ HTTP Methods: GET, POST, PUT, PATCH, DELETE
131
+ - ✅ Response Types: JSON, Text, FormData, Blob, ArrayBuffer
132
+ - ✅ Router Groups & Middleware
133
+ - ✅ Type-safe Client Generation
134
+ - ✅ WebSocket Support
135
+ - ✅ Adapter System to work with other frameworks
136
+
137
+ ### Advanced Capabilities
138
+ - ✅ Standard Schema Compatibility
139
+ - ✅ Hooks System (onRequest, onError, etc)
140
+ - ✅ Macro System for Auth/Rate Limiting
141
+ - ✅ OpenAPI - Swagger Integration
142
+
143
+ ## 💼 Production Ready
144
+ ```typescript
145
+ // Error handling
146
+ .onError((err) => {
147
+ return Response.json({
148
+ error: err.message
149
+ }, { status: 500 })
150
+ })
151
+
152
+ // Rate limiting macro
153
+ .macro({
154
+ rateLimit: () => ({
155
+ resolve: async (ctx) => {
156
+ // Implement your logic
157
+ }
158
+ })
159
+ })
160
+ ```
161
+
162
+ ## 📜 License
163
+ MIT License © 2025 Hedystia
164
+
165
+ ## 🗣️ Community
166
+ - [GitHub Issues](https://github.com/Hedystia/Framework/issues)
167
+ - [Discord Server](https://hedystia.com/support)