@asterflow/adapter 1.0.3 → 1.0.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 +12 -50
- package/dist/cjs/index.cjs +72 -72
- package/dist/mjs/index.js +69 -68
- package/dist/types/controllers/Adapter.d.ts +1 -1
- package/dist/types/types/adapter.d.ts +2 -2
- package/dist/types/utils/errorHandler.d.ts +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
# @asterflow/adapter
|
|
4
4
|
|
|
5
|
-

|
|
6
|
+

|
|
7
7
|
|
|
8
|
-

|
|
9
|
+

|
|
10
|
+

|
|
11
11
|
|
|
12
|
-

|
|
13
13
|

|
|
14
14
|
|
|
15
15
|
</div>
|
|
@@ -177,52 +177,14 @@ interface ErrorPayload {
|
|
|
177
177
|
}
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
## 📚 API Reference
|
|
181
|
-
|
|
182
|
-
### Main Types
|
|
183
|
-
|
|
184
|
-
```typescript
|
|
185
|
-
enum Runtime {
|
|
186
|
-
Bun = 'bun',
|
|
187
|
-
Express = 'express',
|
|
188
|
-
Node = 'node',
|
|
189
|
-
Fastify = 'fastify'
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
interface OptionsDriver<Type extends Runtime> {
|
|
193
|
-
runtime: Type
|
|
194
|
-
listen: (...params: ListenParams<Type>) => void
|
|
195
|
-
onRequest?: (request: Request, response?: Response) => Response | Promise<Response>
|
|
196
|
-
}
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### Configuration Options
|
|
200
|
-
|
|
201
|
-
Each adapter accepts runtime-specific options while maintaining proper typing:
|
|
202
|
-
|
|
203
|
-
```typescript
|
|
204
|
-
// Node/Bun
|
|
205
|
-
interface ListenOptions {
|
|
206
|
-
port: number
|
|
207
|
-
host?: string
|
|
208
|
-
backlog?: number
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Fastify
|
|
212
|
-
interface FastifyOptions extends FastifyListenOptions {
|
|
213
|
-
// Fastify-specific options
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Express
|
|
217
|
-
type ExpressOptions = Express.Application
|
|
218
|
-
```
|
|
219
|
-
|
|
220
180
|
## 🔗 Related Packages
|
|
221
181
|
|
|
222
|
-
- [@asterflow/core](https://
|
|
223
|
-
- [@asterflow/router](https://
|
|
224
|
-
- [@asterflow/request](https://
|
|
182
|
+
- [@asterflow/core](https://www.npmjs.com/package/@asterflow/core) - Core framework
|
|
183
|
+
- [@asterflow/router](https://www.npmjs.com/package/@asterflow/router) - Type-safe routing system
|
|
184
|
+
- [@asterflow/request](https://www.npmjs.com/package/@asterflow/request) - Unified HTTP request system
|
|
185
|
+
- [@asterflow/response](https://www.npmjs.com/package/@asterflow/response) - Type-safe HTTP response system
|
|
186
|
+
- [@asterflow/plugin](https://www.npmjs.com/package/@asterflow/plugin) - A modular and typed plugin system
|
|
225
187
|
|
|
226
188
|
## 📄 License
|
|
227
189
|
|
|
228
|
-
MIT - See [LICENSE](https://github.com/
|
|
190
|
+
MIT - See [LICENSE](https://github.com/AsterFlow/AsterFlow/blob/main/LICENSE) for more details.
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var a = Object.defineProperty;
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var F = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var O = Object.getOwnPropertyNames;
|
|
5
|
+
var C = Object.prototype.hasOwnProperty;
|
|
6
|
+
var L = (e, t) => {
|
|
7
7
|
for (var r in t)
|
|
8
8
|
a(e, r, { get: t[r], enumerable: !0 });
|
|
9
|
-
},
|
|
9
|
+
}, A = (e, t, r, o) => {
|
|
10
10
|
if (t && typeof t == "object" || typeof t == "function")
|
|
11
|
-
for (let s of
|
|
12
|
-
!
|
|
11
|
+
for (let s of O(t))
|
|
12
|
+
!C.call(e, s) && s !== r && a(e, s, { get: () => t[s], enumerable: !(o = F(t, s)) || o.enumerable });
|
|
13
13
|
return e;
|
|
14
14
|
};
|
|
15
|
-
var
|
|
16
|
-
|
|
15
|
+
var S = (e) => A(a({}, "__esModule", { value: !0 }), e);
|
|
17
16
|
// packages/adapter/src/index.ts
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
Adapter: () =>
|
|
21
|
-
Runtime: () =>
|
|
22
|
-
adapters: () =>
|
|
17
|
+
var I = {};
|
|
18
|
+
L(I, {
|
|
19
|
+
Adapter: () => n,
|
|
20
|
+
Runtime: () => p,
|
|
21
|
+
adapters: () => B
|
|
23
22
|
});
|
|
24
|
-
module.exports =
|
|
25
|
-
|
|
23
|
+
module.exports = S(I);
|
|
24
|
+
// packages/adapter/src/controllers/Adapter.ts
|
|
25
|
+
var N = require("@asterflow/response");
|
|
26
26
|
// packages/adapter/src/types/adapter.ts
|
|
27
|
-
var
|
|
28
|
-
|
|
27
|
+
var p = ((s) => (s.Bun = "bun", s.Express = "express", s.Node = "node", s.Fastify = "fastify", s))(p || {});
|
|
29
28
|
// packages/adapter/src/controllers/Adapter.ts
|
|
30
|
-
var
|
|
29
|
+
var n = class {
|
|
31
30
|
runtime;
|
|
32
31
|
listen;
|
|
33
32
|
onRequest = void 0;
|
|
@@ -35,16 +34,15 @@ var U = require("@asterflow/router"), o = class {
|
|
|
35
34
|
this.runtime = t, this.listen = r;
|
|
36
35
|
}
|
|
37
36
|
};
|
|
38
|
-
|
|
39
37
|
// packages/adapter/src/adapters/bun.ts
|
|
40
|
-
var
|
|
41
|
-
var
|
|
38
|
+
var f = require("@asterflow/request"), d = require("@asterflow/response");
|
|
39
|
+
var l = new n({
|
|
42
40
|
runtime: "bun",
|
|
43
41
|
listen(e, t) {
|
|
44
42
|
try {
|
|
45
43
|
Bun.serve({
|
|
46
44
|
...e,
|
|
47
|
-
fetch: async (r) => this.onRequest ? (await this.onRequest(new
|
|
45
|
+
fetch: async (r) => this.onRequest ? (await this.onRequest(new f.BunRequest(r))).toResponse() : new d.Response().notFound({
|
|
48
46
|
statusCode: 500,
|
|
49
47
|
error: "Internal Server Error",
|
|
50
48
|
message: "The onRequest() function must be defined before the listen() function."
|
|
@@ -55,33 +53,56 @@ var f = require("@asterflow/router"), d = new o({
|
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
55
|
});
|
|
58
|
-
|
|
56
|
+
// packages/adapter/src/adapters/express.ts
|
|
57
|
+
var y = require("@asterflow/request"), R = require("@asterflow/response"), H = require("express");
|
|
58
|
+
var c = new n({
|
|
59
|
+
runtime: "express",
|
|
60
|
+
listen(e, ...t) {
|
|
61
|
+
return e.all("/{*path}", async (r, o) => {
|
|
62
|
+
if (!this.onRequest) {
|
|
63
|
+
let i = new R.Response().notFound({
|
|
64
|
+
statusCode: 500,
|
|
65
|
+
error: "Internal Server Error",
|
|
66
|
+
message: "The onRequest() function must be defined before the listen() function."
|
|
67
|
+
}).toResponse();
|
|
68
|
+
o.status(i.status).set(Object.fromEntries(i.headers)).send(await i.text());
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
let s = (await this.onRequest(new y.ExpressRequest(r))).toResponse();
|
|
72
|
+
o.status(s.status).set(Object.fromEntries(s.headers)).send(await s.text());
|
|
73
|
+
}), new Promise((r, o) => {
|
|
74
|
+
e.listen(...t, () => r()).on("error", (i) => o(i));
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
59
78
|
// packages/adapter/src/adapters/fastify.ts
|
|
60
|
-
var
|
|
61
|
-
var
|
|
79
|
+
var x = require("@asterflow/request"), E = require("@asterflow/response");
|
|
80
|
+
var q = new n({
|
|
62
81
|
runtime: "fastify",
|
|
63
|
-
listen(e, t, r) {
|
|
64
|
-
e.all("*", async (
|
|
82
|
+
async listen(e, t, r) {
|
|
83
|
+
e.all("*", async (o) => this.onRequest ? (await this.onRequest(new x.FastifyRequest(o))).toResponse() : new E.Response().notFound({
|
|
65
84
|
statusCode: 500,
|
|
66
85
|
error: "Internal Server Error",
|
|
67
86
|
message: "The onRequest() function must be defined before the listen() function."
|
|
68
|
-
}))
|
|
87
|
+
}));
|
|
88
|
+
try {
|
|
89
|
+
let o = await e.listen(t);
|
|
90
|
+
r?.(null, o);
|
|
91
|
+
} catch (o) {
|
|
92
|
+
r?.(o, "");
|
|
93
|
+
}
|
|
69
94
|
}
|
|
70
95
|
});
|
|
71
|
-
|
|
72
96
|
// packages/adapter/src/adapters/node.ts
|
|
73
|
-
var
|
|
74
|
-
var q = require("@asterflow/request");
|
|
75
|
-
|
|
97
|
+
var v = require("@asterflow/request"), w = require("@asterflow/response"), g = require("http");
|
|
76
98
|
// packages/adapter/src/utils/errorHandler.ts
|
|
77
|
-
var u = require("@asterflow/
|
|
78
|
-
function
|
|
99
|
+
var u = require("@asterflow/response");
|
|
100
|
+
function h(e) {
|
|
79
101
|
let t;
|
|
80
102
|
return e instanceof u.Response ? e : (e instanceof Error ? t = {
|
|
81
103
|
statusCode: 500,
|
|
82
104
|
error: e.name,
|
|
83
105
|
message: e.message,
|
|
84
|
-
// Optionally attach stack in non-prod
|
|
85
106
|
details: process.env.NODE_ENV !== "production" ? e.stack : void 0
|
|
86
107
|
} : t = {
|
|
87
108
|
statusCode: 500,
|
|
@@ -94,54 +115,33 @@ function c(e) {
|
|
|
94
115
|
...t.details ? { details: t.details } : {}
|
|
95
116
|
}));
|
|
96
117
|
}
|
|
97
|
-
|
|
98
118
|
// packages/adapter/src/adapters/node.ts
|
|
99
|
-
var
|
|
119
|
+
var b = new n({
|
|
100
120
|
runtime: "node",
|
|
101
121
|
listen(e, t) {
|
|
102
|
-
|
|
103
|
-
(0,
|
|
104
|
-
if (!this.onRequest) return new
|
|
122
|
+
return new Promise((r, o) => {
|
|
123
|
+
let s = (0, g.createServer)(async (i, m) => {
|
|
124
|
+
if (!this.onRequest) return new w.Response().notFound({
|
|
105
125
|
statusCode: 500,
|
|
106
126
|
error: "Internal Server Error",
|
|
107
127
|
message: "The onRequest() function must be defined before the listen() function."
|
|
108
128
|
});
|
|
109
129
|
try {
|
|
110
|
-
return (await this.onRequest(new
|
|
111
|
-
} catch (
|
|
112
|
-
return
|
|
130
|
+
return (await this.onRequest(new v.NodeRequest(i))).toServerResponse(m);
|
|
131
|
+
} catch (T) {
|
|
132
|
+
return h(T).toServerResponse(m);
|
|
113
133
|
}
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
// packages/adapter/src/adapters/express.ts
|
|
122
|
-
var $ = require("express"), g = require("@asterflow/router");
|
|
123
|
-
var v = require("@asterflow/request"), b = new o({
|
|
124
|
-
runtime: "express",
|
|
125
|
-
listen(e, ...t) {
|
|
126
|
-
return e.all("/{*path}", async (r, n) => {
|
|
127
|
-
if (!this.onRequest) {
|
|
128
|
-
let p = new g.Response().notFound({
|
|
129
|
-
statusCode: 500,
|
|
130
|
-
error: "Internal Server Error",
|
|
131
|
-
message: "The onRequest() function must be defined before the listen() function."
|
|
132
|
-
}).toResponse();
|
|
133
|
-
n.status(p.status).set(Object.fromEntries(p.headers)).send(await p.text());
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
let s = (await this.onRequest(new v.ExpressRequest(r))).toResponse();
|
|
137
|
-
n.status(s.status).set(Object.fromEntries(s.headers)).send(await s.text());
|
|
138
|
-
}), e.listen(...t), e;
|
|
134
|
+
});
|
|
135
|
+
s.on("error", (i) => {
|
|
136
|
+
t?.(i), o(i);
|
|
137
|
+
}), s.listen(e, () => {
|
|
138
|
+
t?.(null), r();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
139
141
|
}
|
|
140
142
|
});
|
|
141
|
-
|
|
142
143
|
// packages/adapter/src/index.ts
|
|
143
|
-
var
|
|
144
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
144
|
+
var B = { bun: l, fastify: q, node: b, express: c };
|
|
145
145
|
0 && (module.exports = {
|
|
146
146
|
Adapter,
|
|
147
147
|
Runtime,
|
package/dist/mjs/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
// packages/adapter/src/controllers/Adapter.ts
|
|
2
|
+
import "@asterflow/response";
|
|
1
3
|
// packages/adapter/src/types/adapter.ts
|
|
2
|
-
|
|
3
|
-
import "express";
|
|
4
|
-
var i = /* @__PURE__ */ ((s) => (s.Bun = "bun", s.Express = "express", s.Node = "node", s.Fastify = "fastify", s))(i || {});
|
|
5
|
-
|
|
4
|
+
var p = ((o) => (o.Bun = "bun", o.Express = "express", o.Node = "node", o.Fastify = "fastify", o))(p || {});
|
|
6
5
|
// packages/adapter/src/controllers/Adapter.ts
|
|
7
|
-
|
|
8
|
-
var o = class {
|
|
6
|
+
var i = class {
|
|
9
7
|
runtime;
|
|
10
8
|
listen;
|
|
11
9
|
onRequest = void 0;
|
|
@@ -13,17 +11,16 @@ var o = class {
|
|
|
13
11
|
this.runtime = t, this.listen = r;
|
|
14
12
|
}
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
// packages/adapter/src/adapters/bun.ts
|
|
18
|
-
import { BunRequest as
|
|
19
|
-
import { Response as
|
|
20
|
-
var
|
|
15
|
+
import { BunRequest as c } from "@asterflow/request";
|
|
16
|
+
import { Response as x } from "@asterflow/response";
|
|
17
|
+
var u = new i({
|
|
21
18
|
runtime: "bun",
|
|
22
19
|
listen(e, t) {
|
|
23
20
|
try {
|
|
24
21
|
Bun.serve({
|
|
25
22
|
...e,
|
|
26
|
-
fetch: async (r) => this.onRequest ? (await this.onRequest(new
|
|
23
|
+
fetch: async (r) => this.onRequest ? (await this.onRequest(new c(r))).toResponse() : new x().notFound({
|
|
27
24
|
statusCode: 500,
|
|
28
25
|
error: "Internal Server Error",
|
|
29
26
|
message: "The onRequest() function must be defined before the listen() function."
|
|
@@ -34,98 +31,102 @@ var a = new o({
|
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
});
|
|
37
|
-
|
|
34
|
+
// packages/adapter/src/adapters/express.ts
|
|
35
|
+
import { ExpressRequest as E } from "@asterflow/request";
|
|
36
|
+
import { Response as q } from "@asterflow/response";
|
|
37
|
+
import "express";
|
|
38
|
+
var m = new i({
|
|
39
|
+
runtime: "express",
|
|
40
|
+
listen(e, ...t) {
|
|
41
|
+
return e.all("/{*path}", async (r, s) => {
|
|
42
|
+
if (!this.onRequest) {
|
|
43
|
+
let n = new q().notFound({
|
|
44
|
+
statusCode: 500,
|
|
45
|
+
error: "Internal Server Error",
|
|
46
|
+
message: "The onRequest() function must be defined before the listen() function."
|
|
47
|
+
}).toResponse();
|
|
48
|
+
s.status(n.status).set(Object.fromEntries(n.headers)).send(await n.text());
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
let o = (await this.onRequest(new E(r))).toResponse();
|
|
52
|
+
s.status(o.status).set(Object.fromEntries(o.headers)).send(await o.text());
|
|
53
|
+
}), new Promise((r, s) => {
|
|
54
|
+
e.listen(...t, () => r()).on("error", (n) => s(n));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
38
58
|
// packages/adapter/src/adapters/fastify.ts
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
var
|
|
59
|
+
import { FastifyRequest as h } from "@asterflow/request";
|
|
60
|
+
import { Response as v } from "@asterflow/response";
|
|
61
|
+
var f = new i({
|
|
42
62
|
runtime: "fastify",
|
|
43
|
-
listen(e, t, r) {
|
|
44
|
-
e.all("*", async (
|
|
63
|
+
async listen(e, t, r) {
|
|
64
|
+
e.all("*", async (s) => this.onRequest ? (await this.onRequest(new h(s))).toResponse() : new v().notFound({
|
|
45
65
|
statusCode: 500,
|
|
46
66
|
error: "Internal Server Error",
|
|
47
67
|
message: "The onRequest() function must be defined before the listen() function."
|
|
48
|
-
}))
|
|
68
|
+
}));
|
|
69
|
+
try {
|
|
70
|
+
let s = await e.listen(t);
|
|
71
|
+
r?.(null, s);
|
|
72
|
+
} catch (s) {
|
|
73
|
+
r?.(s, "");
|
|
74
|
+
}
|
|
49
75
|
}
|
|
50
76
|
});
|
|
51
|
-
|
|
52
77
|
// packages/adapter/src/adapters/node.ts
|
|
53
|
-
import {
|
|
54
|
-
import { Response as
|
|
55
|
-
import {
|
|
56
|
-
|
|
78
|
+
import { NodeRequest as w } from "@asterflow/request";
|
|
79
|
+
import { Response as g } from "@asterflow/response";
|
|
80
|
+
import { createServer as b } from "http";
|
|
57
81
|
// packages/adapter/src/utils/errorHandler.ts
|
|
58
|
-
import { Response as
|
|
59
|
-
function
|
|
82
|
+
import { Response as d } from "@asterflow/response";
|
|
83
|
+
function l(e) {
|
|
60
84
|
let t;
|
|
61
|
-
return e instanceof
|
|
85
|
+
return e instanceof d ? e : (e instanceof Error ? t = {
|
|
62
86
|
statusCode: 500,
|
|
63
87
|
error: e.name,
|
|
64
88
|
message: e.message,
|
|
65
|
-
// Optionally attach stack in non-prod
|
|
66
89
|
details: process.env.NODE_ENV !== "production" ? e.stack : void 0
|
|
67
90
|
} : t = {
|
|
68
91
|
statusCode: 500,
|
|
69
92
|
error: "InternalServerError",
|
|
70
93
|
message: typeof e == "string" ? e : "An unexpected error occurred.",
|
|
71
94
|
details: e
|
|
72
|
-
}, console.error("Unhandled exception in adapter:", e), new
|
|
95
|
+
}, console.error("Unhandled exception in adapter:", e), new d().status(t.statusCode).json({
|
|
73
96
|
error: t.error,
|
|
74
97
|
message: t.message,
|
|
75
98
|
...t.details ? { details: t.details } : {}
|
|
76
99
|
}));
|
|
77
100
|
}
|
|
78
|
-
|
|
79
101
|
// packages/adapter/src/adapters/node.ts
|
|
80
|
-
var
|
|
102
|
+
var y = new i({
|
|
81
103
|
runtime: "node",
|
|
82
104
|
listen(e, t) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (!this.onRequest) return new
|
|
105
|
+
return new Promise((r, s) => {
|
|
106
|
+
let o = b(async (n, a) => {
|
|
107
|
+
if (!this.onRequest) return new g().notFound({
|
|
86
108
|
statusCode: 500,
|
|
87
109
|
error: "Internal Server Error",
|
|
88
110
|
message: "The onRequest() function must be defined before the listen() function."
|
|
89
111
|
});
|
|
90
112
|
try {
|
|
91
|
-
return (await this.onRequest(new
|
|
92
|
-
} catch (
|
|
93
|
-
return
|
|
113
|
+
return (await this.onRequest(new w(n))).toServerResponse(a);
|
|
114
|
+
} catch (R) {
|
|
115
|
+
return l(R).toServerResponse(a);
|
|
94
116
|
}
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// packages/adapter/src/adapters/express.ts
|
|
103
|
-
import "express";
|
|
104
|
-
import { Response as g } from "@asterflow/router";
|
|
105
|
-
import { ExpressRequest as v } from "@asterflow/request";
|
|
106
|
-
var l = new o({
|
|
107
|
-
runtime: "express",
|
|
108
|
-
listen(e, ...t) {
|
|
109
|
-
return e.all("/{*path}", async (r, n) => {
|
|
110
|
-
if (!this.onRequest) {
|
|
111
|
-
let p = new g().notFound({
|
|
112
|
-
statusCode: 500,
|
|
113
|
-
error: "Internal Server Error",
|
|
114
|
-
message: "The onRequest() function must be defined before the listen() function."
|
|
115
|
-
}).toResponse();
|
|
116
|
-
n.status(p.status).set(Object.fromEntries(p.headers)).send(await p.text());
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
let s = (await this.onRequest(new v(r))).toResponse();
|
|
120
|
-
n.status(s.status).set(Object.fromEntries(s.headers)).send(await s.text());
|
|
121
|
-
}), e.listen(...t), e;
|
|
117
|
+
});
|
|
118
|
+
o.on("error", (n) => {
|
|
119
|
+
t?.(n), s(n);
|
|
120
|
+
}), o.listen(e, () => {
|
|
121
|
+
t?.(null), r();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
122
124
|
}
|
|
123
125
|
});
|
|
124
|
-
|
|
125
126
|
// packages/adapter/src/index.ts
|
|
126
|
-
var
|
|
127
|
+
var ie = { bun: u, fastify: f, node: y, express: m };
|
|
127
128
|
export {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
i as Adapter,
|
|
130
|
+
p as Runtime,
|
|
131
|
+
ie as adapters
|
|
131
132
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Request } from '@asterflow/request';
|
|
2
|
+
import { Response as ResponseCustom } from '@asterflow/response';
|
|
2
3
|
import { Runtime, type OptionsDriver } from '../types/adapter';
|
|
3
|
-
import { Response as ResponseCustom } from '@asterflow/router';
|
|
4
4
|
export declare class Adapter<Type extends Runtime> {
|
|
5
5
|
readonly runtime: Type;
|
|
6
6
|
readonly listen: OptionsDriver<Type>['listen'];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Request } from '@asterflow/request';
|
|
2
|
-
import { Response as ResponseCustom } from '@asterflow/
|
|
2
|
+
import type { Response as ResponseCustom } from '@asterflow/response';
|
|
3
3
|
import type { ServeOptions as BunServeOptions } from 'bun';
|
|
4
|
-
import {
|
|
4
|
+
import type { Express } from 'express';
|
|
5
5
|
import type { FastifyInstance, FastifyListenOptions } from 'fastify';
|
|
6
6
|
import type { ListenOptions } from 'net';
|
|
7
7
|
export declare enum Runtime {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asterflow/adapter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"main": "dist/cjs/index.cjs",
|
|
5
5
|
"module": "dist/mjs/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"author": "Ashu11-A",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/
|
|
13
|
+
"url": "git+https://github.com/AsterFlow/AsterFlow.git"
|
|
14
14
|
},
|
|
15
15
|
"bugs": {
|
|
16
|
-
"url": "https://github.com/
|
|
16
|
+
"url": "https://github.com/AsterFlow/AsterFlow/issues"
|
|
17
17
|
},
|
|
18
|
-
"homepage": "https://github.com/
|
|
18
|
+
"homepage": "https://github.com/AsterFlow/AsterFlow",
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
21
|
"types": "./dist/types/index.d.ts",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"node": ">=20"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@types/
|
|
31
|
-
"
|
|
32
|
-
"@asterflow/router": "1.0.3",
|
|
33
|
-
"@asterflow/request": "1.0.3"
|
|
30
|
+
"@types/express": "^5.0.3",
|
|
31
|
+
"@asterflow/router": "1.0.5"
|
|
34
32
|
},
|
|
35
33
|
"peerDependencies": {
|
|
34
|
+
"fastify": "^5.3.3",
|
|
35
|
+
"express": "^5.1.0",
|
|
36
36
|
"typescript": "^5.8.3"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"
|
|
39
|
+
"@asterflow/response": "1.0.2",
|
|
40
|
+
"@asterflow/request": "1.0.5"
|
|
41
41
|
}
|
|
42
42
|
}
|