@better-agent/adapters 0.1.0-canary.6 → 0.2.0-beta.2
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/dist/fastify.mjs +1 -1
- package/dist/fastify.mjs.map +1 -1
- package/package.json +11 -7
package/dist/fastify.mjs
CHANGED
|
@@ -8,7 +8,7 @@ const toFastifyHandler = (app, options) => {
|
|
|
8
8
|
const body = request.body === void 0 || request.body === null ? void 0 : typeof request.body === "string" || request.body instanceof Uint8Array ? request.body : JSON.stringify(request.body);
|
|
9
9
|
const webRequest = createNodeRequest(request.raw, reply.raw, {
|
|
10
10
|
...options,
|
|
11
|
-
body,
|
|
11
|
+
body: options?.body ?? body,
|
|
12
12
|
origin: options?.origin ?? (request.protocol ? `${request.protocol}://${request.raw.headers.host ?? "localhost"}` : void 0)
|
|
13
13
|
});
|
|
14
14
|
const webResponse = await app.handler(webRequest);
|
package/dist/fastify.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastify.mjs","names":[],"sources":["../src/fastify.ts"],"sourcesContent":["import type { BetterAgentApp } from \"@better-agent/core\";\nimport { sendNodeResponse } from \"./shared/from-node-response\";\nimport { createNodeRequest } from \"./shared/to-node-request\";\nimport type {\n FastifyLikeReply,\n FastifyLikeRequest,\n NodeRequestAdapterOptions,\n} from \"./shared/types\";\n\nexport type FastifyHandler = (\n request: FastifyLikeRequest,\n reply: FastifyLikeReply,\n) => Promise<void>;\n\nexport const toFastifyHandler = (\n app: BetterAgentApp,\n options?: NodeRequestAdapterOptions,\n): FastifyHandler => {\n return async (request, reply) => {\n reply.hijack?.();\n\n const body =\n request.body === undefined || request.body === null\n ? undefined\n : typeof request.body === \"string\" || request.body instanceof Uint8Array\n ? request.body\n : JSON.stringify(request.body);\n\n const webRequest = createNodeRequest(request.raw, reply.raw, {\n ...options,\n body,\n origin:\n options?.origin ??\n (request.protocol\n ? `${request.protocol}://${request.raw.headers.host ?? \"localhost\"}`\n : undefined),\n });\n const webResponse = await app.handler(webRequest);\n await sendNodeResponse(reply.raw, webResponse);\n };\n};\n"],"mappings":";;;;AAcA,MAAa,oBACT,KACA,YACiB;AACjB,QAAO,OAAO,SAAS,UAAU;AAC7B,QAAM,UAAU;EAEhB,MAAM,OACF,QAAQ,SAAS,UAAa,QAAQ,SAAS,OACzC,SACA,OAAO,QAAQ,SAAS,YAAY,QAAQ,gBAAgB,aAC1D,QAAQ,OACR,KAAK,UAAU,QAAQ,KAAK;EAExC,MAAM,aAAa,kBAAkB,QAAQ,KAAK,MAAM,KAAK;GACzD,GAAG;GACH;
|
|
1
|
+
{"version":3,"file":"fastify.mjs","names":[],"sources":["../src/fastify.ts"],"sourcesContent":["import type { BetterAgentApp } from \"@better-agent/core\";\nimport { sendNodeResponse } from \"./shared/from-node-response\";\nimport { createNodeRequest } from \"./shared/to-node-request\";\nimport type {\n FastifyLikeReply,\n FastifyLikeRequest,\n NodeRequestAdapterOptions,\n} from \"./shared/types\";\n\nexport type FastifyHandler = (\n request: FastifyLikeRequest,\n reply: FastifyLikeReply,\n) => Promise<void>;\n\nexport const toFastifyHandler = (\n app: BetterAgentApp,\n options?: NodeRequestAdapterOptions,\n): FastifyHandler => {\n return async (request, reply) => {\n reply.hijack?.();\n\n const body =\n request.body === undefined || request.body === null\n ? undefined\n : typeof request.body === \"string\" || request.body instanceof Uint8Array\n ? request.body\n : JSON.stringify(request.body);\n\n const webRequest = createNodeRequest(request.raw, reply.raw, {\n ...options,\n body: options?.body ?? body,\n origin:\n options?.origin ??\n (request.protocol\n ? `${request.protocol}://${request.raw.headers.host ?? \"localhost\"}`\n : undefined),\n });\n const webResponse = await app.handler(webRequest);\n await sendNodeResponse(reply.raw, webResponse);\n };\n};\n"],"mappings":";;;;AAcA,MAAa,oBACT,KACA,YACiB;AACjB,QAAO,OAAO,SAAS,UAAU;AAC7B,QAAM,UAAU;EAEhB,MAAM,OACF,QAAQ,SAAS,UAAa,QAAQ,SAAS,OACzC,SACA,OAAO,QAAQ,SAAS,YAAY,QAAQ,gBAAgB,aAC1D,QAAQ,OACR,KAAK,UAAU,QAAQ,KAAK;EAExC,MAAM,aAAa,kBAAkB,QAAQ,KAAK,MAAM,KAAK;GACzD,GAAG;GACH,MAAM,SAAS,QAAQ;GACvB,QACI,SAAS,WACR,QAAQ,WACH,GAAG,QAAQ,SAAS,KAAK,QAAQ,IAAI,QAAQ,QAAQ,gBACrD;GACb,CAAC;EACF,MAAM,cAAc,MAAM,IAAI,QAAQ,WAAW;AACjD,QAAM,iBAAiB,MAAM,KAAK,YAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-agent/adapters",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-beta.2",
|
|
4
4
|
"description": "Better Agent framework adapters",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/better-agent/better-agent/issues"
|
|
14
14
|
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"bun": ">=1.3.3",
|
|
17
|
+
"node": ">=20"
|
|
18
|
+
},
|
|
15
19
|
"type": "module",
|
|
16
20
|
"types": "./dist/index.d.mts",
|
|
17
21
|
"sideEffects": false,
|
|
@@ -39,6 +43,7 @@
|
|
|
39
43
|
"scripts": {
|
|
40
44
|
"build": "bunx tsdown",
|
|
41
45
|
"dev": "bunx tsdown --watch --no-clean",
|
|
46
|
+
"test": "bun test __tests__",
|
|
42
47
|
"lint:package": "bunx publint run --strict",
|
|
43
48
|
"lint:types": "npm_config_cache=../../.npm-cache bunx attw --profile esm-only --pack .",
|
|
44
49
|
"lint": "bunx biome check .",
|
|
@@ -51,15 +56,14 @@
|
|
|
51
56
|
"access": "public"
|
|
52
57
|
},
|
|
53
58
|
"devDependencies": {
|
|
54
|
-
"@better-agent/core": "0.
|
|
55
|
-
"@types/bun": "^1.
|
|
59
|
+
"@better-agent/core": "0.2.0-beta.2",
|
|
60
|
+
"@types/bun": "^1.3.12",
|
|
56
61
|
"@types/express": "^5.0.3",
|
|
57
|
-
"@types/node": "^22.
|
|
62
|
+
"@types/node": "^22.19.17",
|
|
58
63
|
"express": "^5.1.0",
|
|
59
|
-
"fastify": "^5.6.1"
|
|
60
|
-
"neverthrow": "^8.2.0"
|
|
64
|
+
"fastify": "^5.6.1"
|
|
61
65
|
},
|
|
62
66
|
"peerDependencies": {
|
|
63
|
-
"@better-agent/core": "0.
|
|
67
|
+
"@better-agent/core": "0.2.0-beta.2"
|
|
64
68
|
}
|
|
65
69
|
}
|