@middy/core 5.3.0 → 5.3.1
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/index.js +16 -10
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -68,16 +68,12 @@ const middy = (lambdaHandler = defaultLambdaHandler, plugin = {}) => {
|
|
|
68
68
|
if (handlerBody._readableState) {
|
|
69
69
|
handlerStream = handlerBody
|
|
70
70
|
} else if (typeof handlerBody === 'string') {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
position += size
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
handlerStream = Readable.from(iterator(handlerBody))
|
|
71
|
+
// #1189
|
|
72
|
+
handlerStream = Readable.from(
|
|
73
|
+
handlerBody.length < stringIteratorSize
|
|
74
|
+
? handlerBody
|
|
75
|
+
: stringIterator(handlerBody)
|
|
76
|
+
)
|
|
81
77
|
}
|
|
82
78
|
|
|
83
79
|
if (!handlerStream) {
|
|
@@ -129,6 +125,16 @@ const middy = (lambdaHandler = defaultLambdaHandler, plugin = {}) => {
|
|
|
129
125
|
return middy
|
|
130
126
|
}
|
|
131
127
|
|
|
128
|
+
const stringIteratorSize = 16384 // 16 * 1024 // Node.js default
|
|
129
|
+
function * stringIterator (input) {
|
|
130
|
+
let position = 0
|
|
131
|
+
const length = input.length
|
|
132
|
+
while (position < length) {
|
|
133
|
+
yield input.substring(position, position + stringIteratorSize)
|
|
134
|
+
position += stringIteratorSize
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
132
138
|
// shared AbortController, because it's slow
|
|
133
139
|
let handlerAbort = new AbortController()
|
|
134
140
|
const runRequest = async (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/core",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda (core package)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@types/aws-lambda": "^8.10.76",
|
|
61
61
|
"@types/node": "^20.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "d25628bf7ebf0c4f00ed2e789d0b3edae2be4dae",
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@datastream/core": "0.0.35"
|
|
66
66
|
}
|