@funcd-dev/shim 0.4.1 → 0.4.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/blob.js CHANGED
@@ -16,6 +16,8 @@ function request(method, path, body) {
16
16
  headers['content-length'] = body.byteLength;
17
17
  const req = http.request({ socketPath, path, method, headers }, (res) => {
18
18
  const chunks = [];
19
+ // A connection that drops mid-body errors the response, not the request, and never ends it.
20
+ res.on('error', (err) => reject(new Error(`context.blob ${method} ${path} failed: connection closed before the reply ended`, { cause: err })));
19
21
  res.on('data', (c) => chunks.push(c));
20
22
  res.on('end', () => resolve({ status: res.statusCode ?? 0, body: Buffer.concat(chunks) }));
21
23
  });
package/dist/kv.js CHANGED
@@ -14,6 +14,8 @@ function request(method, path, body) {
14
14
  headers['content-length'] = body.byteLength;
15
15
  const req = http.request({ socketPath, path, method, headers }, (res) => {
16
16
  const chunks = [];
17
+ // A connection that drops mid-body errors the response, not the request, and never ends it.
18
+ res.on('error', (err) => reject(new Error(`context.kv ${method} ${path} failed: connection closed before the reply ended`, { cause: err })));
17
19
  res.on('data', (c) => chunks.push(c));
18
20
  res.on('end', () => resolve({ status: res.statusCode ?? 0, body: Buffer.concat(chunks) }));
19
21
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funcd-dev/shim",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "description": "Types and the contract build for writing funcd functions in TypeScript",
6
6
  "license": "Apache-2.0",