@inflector/aura 0.6.6 → 0.6.8

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/bin.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAmLA,wBAAgB,KAAK,CAAC,MAAM,UAAQ,QAgDnC;AA0aD,wBAAsB,GAAG,kBA2ExB"}
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAmLA,wBAAgB,KAAK,CAAC,MAAM,UAAQ,QAgDnC;AA0aD,wBAAsB,GAAG,kBAiFxB"}
package/dist/bin.js CHANGED
@@ -581,16 +581,18 @@ export async function dev() {
581
581
  target: Config.Url,
582
582
  changeOrigin: true,
583
583
  secure: false,
584
- agent: new (await import("node:http")).Agent({
585
- keepAlive: false, // fresh socket every time, no lazy pool
586
- }),
587
- ws: false, // disable websocket proxying if unused
588
584
  configure(proxy, _options) {
589
585
  proxy.on("proxyReq", (proxyReq, req, res) => {
590
586
  proxyReq.setHeader("Connection", "close");
591
587
  if (AURA_KEY) {
592
588
  proxyReq.setHeader("Authorization", `Bearer ${AURA_KEY}`);
593
589
  }
590
+ // Abort upstream request if client disconnects
591
+ req.on("close", () => {
592
+ if (!res.writableEnded) {
593
+ proxyReq.destroy();
594
+ }
595
+ });
594
596
  });
595
597
  },
596
598
  },
@@ -647,6 +649,7 @@ async function start() {
647
649
  body: req.method === "GET" || req.method === "HEAD"
648
650
  ? undefined
649
651
  : req.body,
652
+ signal: req.signal,
650
653
  });
651
654
  const proxyHeaders = new Headers(proxiedResp.headers);
652
655
  proxyHeaders.delete("content-encoding");
@@ -657,7 +660,11 @@ async function start() {
657
660
  headers: proxyHeaders,
658
661
  });
659
662
  }
660
- catch {
663
+ catch (err) {
664
+ // Client disconnected — no point sending a response
665
+ if (err.name === "AbortError" || req.signal.aborted) {
666
+ return new Response(null, { status: 499 });
667
+ }
661
668
  return new Response(JSON.stringify({ error: "Upstream Proxy Failed" }), { status: 502, headers: { "Content-Type": "application/json" } });
662
669
  }
663
670
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inflector/aura",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",