hono-adapter-aws-lambda 1.3.3 → 1.3.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 +0 -2
- package/dist/index.mjs +9 -8
- package/package.json +13 -23
package/README.md
CHANGED
|
@@ -58,8 +58,6 @@ See some more examples in the test file: [test/index.test.ts](test/index.test.ts
|
|
|
58
58
|
[npm-downloads-href]: https://npmjs.com/package/hono-adapter-aws-lambda
|
|
59
59
|
[codecov-src]: https://img.shields.io/codecov/c/gh/namesmt/hono-adapter-aws-lambda/main?labelColor=18181B&color=F0DB4F
|
|
60
60
|
[codecov-href]: https://codecov.io/gh/namesmt/hono-adapter-aws-lambda
|
|
61
|
-
[license-src]: https://img.shields.io/github/license/namesmt/hono-adapter-aws-lambda.svg?labelColor=18181B&color=F0DB4F
|
|
62
|
-
[license-href]: https://github.com/namesmt/hono-adapter-aws-lambda/blob/main/LICENSE
|
|
63
61
|
[bundlejs-src]: https://img.shields.io/bundlejs/size/hono-adapter-aws-lambda?labelColor=18181B&color=F0DB4F
|
|
64
62
|
[bundlejs-href]: https://bundlejs.com/?q=hono-adapter-aws-lambda
|
|
65
63
|
[jsDocs-src]: https://img.shields.io/badge/Check_out-jsDocs.io---?labelColor=18181B&color=F0DB4F
|
package/dist/index.mjs
CHANGED
|
@@ -189,6 +189,7 @@ function isProxyEventV2(event) {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
const METHOD = "TRIGGER";
|
|
192
|
+
const JSON_CONTENT_TYPE_REGEX = /^application\/json/;
|
|
192
193
|
class TriggerFactory {
|
|
193
194
|
simpleRouter = {};
|
|
194
195
|
honoApp;
|
|
@@ -202,17 +203,17 @@ class TriggerFactory {
|
|
|
202
203
|
this.simpleRouter[eventSource] = thisEventSource = {};
|
|
203
204
|
this.honoApp.on(METHOD, getTriggerPath(eventSource), async (c) => {
|
|
204
205
|
if (thisEventSource["$!"]) {
|
|
205
|
-
return this.internalApp.fetch(makeLocalRequest(METHOD, `/${eventSource}/$!`));
|
|
206
|
+
return this.internalApp.fetch(makeLocalRequest(METHOD, `/${eventSource}/$!`), c.env);
|
|
206
207
|
}
|
|
207
208
|
const resObj = {};
|
|
208
209
|
for (const route in thisEventSource) {
|
|
209
210
|
if (route[0] === "$")
|
|
210
211
|
continue;
|
|
211
|
-
const res = await this.internalApp.fetch(makeLocalRequest(METHOD, `/${eventSource}/${route}`));
|
|
212
|
-
resObj[route] =
|
|
212
|
+
const res = await this.internalApp.fetch(makeLocalRequest(METHOD, `/${eventSource}/${route}`), c.env);
|
|
213
|
+
resObj[route] = JSON_CONTENT_TYPE_REGEX.test(res.headers.get("content-type") || "") ? await res.json() : await res.text();
|
|
213
214
|
}
|
|
214
215
|
if (thisEventSource["$="]) {
|
|
215
|
-
return this.internalApp.fetch(makeLocalRequest(METHOD, `/${eventSource}/$=`));
|
|
216
|
+
return this.internalApp.fetch(makeLocalRequest(METHOD, `/${eventSource}/$=`), c.env);
|
|
216
217
|
}
|
|
217
218
|
return c.json(resObj);
|
|
218
219
|
});
|
|
@@ -274,16 +275,16 @@ function makeLocalRequest(method, path) {
|
|
|
274
275
|
return new Request(`http://127.0.0.1${path}`, { method });
|
|
275
276
|
}
|
|
276
277
|
|
|
278
|
+
const CONTENT_TYPE_TEXT_REGEX = /^(?:text\/(?:plain|html|css|javascript|csv).*|application\/(?:.*json|.*xml).*|image\/svg\+xml.*)$/;
|
|
279
|
+
const CONTENT_ENCODING_BINARY_REGEX = /^(?:gzip|deflate|compress|br)/;
|
|
277
280
|
function isContentTypeBinary(contentType) {
|
|
278
|
-
return
|
|
279
|
-
contentType
|
|
280
|
-
);
|
|
281
|
+
return !CONTENT_TYPE_TEXT_REGEX.test(contentType);
|
|
281
282
|
}
|
|
282
283
|
function isContentEncodingBinary(contentEncoding) {
|
|
283
284
|
if (contentEncoding === null) {
|
|
284
285
|
return false;
|
|
285
286
|
}
|
|
286
|
-
return
|
|
287
|
+
return CONTENT_ENCODING_BINARY_REGEX.test(contentEncoding);
|
|
287
288
|
}
|
|
288
289
|
function getProcessor(event) {
|
|
289
290
|
if (isTriggerEvent(event))
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono-adapter-aws-lambda",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
5
|
-
"packageManager": "pnpm@
|
|
4
|
+
"version": "1.3.5",
|
|
5
|
+
"packageManager": "pnpm@12.4.1",
|
|
6
6
|
"description": "",
|
|
7
7
|
"author": "NamesMT <dangquoctrung123@gmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -62,30 +62,20 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@namesmt/utils-lambda": "^0.1.4",
|
|
65
|
-
"@types/aws-lambda": "^8.10.
|
|
65
|
+
"@types/aws-lambda": "^8.10.163"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@antfu/eslint-config": "^
|
|
69
|
-
"@types/node": "^
|
|
70
|
-
"@vitest/coverage-v8": "^3.
|
|
71
|
-
"eslint": "^9.
|
|
68
|
+
"@antfu/eslint-config": "^7.7.3",
|
|
69
|
+
"@types/node": "^24.13.4",
|
|
70
|
+
"@vitest/coverage-v8": "^3.2.7",
|
|
71
|
+
"eslint": "^9.39.2",
|
|
72
72
|
"klona": "^2.0.6",
|
|
73
|
-
"lint-staged": "^16.
|
|
74
|
-
"simple-git-hooks": "^2.
|
|
75
|
-
"tsx": "^4.
|
|
76
|
-
"typescript": "^5.
|
|
77
|
-
"unbuild": "^3.
|
|
78
|
-
"vitest": "^3.
|
|
79
|
-
},
|
|
80
|
-
"pnpm": {
|
|
81
|
-
"overrides": {
|
|
82
|
-
"is-core-module": "npm:@nolyfill/is-core-module@^1.0.39"
|
|
83
|
-
},
|
|
84
|
-
"onlyBuiltDependencies": [
|
|
85
|
-
"esbuild",
|
|
86
|
-
"simple-git-hooks",
|
|
87
|
-
"unrs-resolver"
|
|
88
|
-
]
|
|
73
|
+
"lint-staged": "^16.4.0",
|
|
74
|
+
"simple-git-hooks": "^2.14.0",
|
|
75
|
+
"tsx": "^4.23.13",
|
|
76
|
+
"typescript": "^5.9.3",
|
|
77
|
+
"unbuild": "^3.6.1",
|
|
78
|
+
"vitest": "^3.2.7"
|
|
89
79
|
},
|
|
90
80
|
"simple-git-hooks": {
|
|
91
81
|
"pre-commit": "pnpm lint-staged"
|