@inflector/aura 0.7.0 → 0.7.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/bin.d.ts.map +1 -1
- package/dist/bin.js +17 -9
- package/package.json +1 -1
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;AAwJD,wBAAsB,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAmLA,wBAAgB,KAAK,CAAC,MAAM,UAAQ,QAgDnC;AAwJD,wBAAsB,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,iBAoL/C;AAmRD,wBAAsB,GAAG,kBAiFxB"}
|
package/dist/bin.js
CHANGED
|
@@ -391,22 +391,26 @@ export async function serve(mode) {
|
|
|
391
391
|
proxy: {
|
|
392
392
|
"/api": {
|
|
393
393
|
target: upstreamUrl,
|
|
394
|
-
changeOrigin: false,
|
|
394
|
+
changeOrigin: false,
|
|
395
395
|
secure: false,
|
|
396
|
+
ws: true,
|
|
397
|
+
rewrite: (path) => path, // identity — no rewrite, keep as-is
|
|
396
398
|
configure(proxy) {
|
|
397
399
|
proxy.on("proxyReq", (proxyReq, req) => {
|
|
398
400
|
proxyReq.setHeader("connection", "close");
|
|
399
401
|
if (AURA_KEY)
|
|
400
402
|
proxyReq.setHeader("Authorization", `Bearer ${AURA_KEY}`);
|
|
401
|
-
// preserve cookies
|
|
402
403
|
if (req.headers.cookie)
|
|
403
404
|
proxyReq.setHeader("cookie", req.headers.cookie);
|
|
404
405
|
});
|
|
405
|
-
proxy.on("
|
|
406
|
-
|
|
407
|
-
if (
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
proxy.on("error", (err, req, res) => {
|
|
407
|
+
console.error("[proxy error]", err.message, req.url);
|
|
408
|
+
if (!res.headersSent) {
|
|
409
|
+
res.writeHead(502, { "Content-Type": "application/json" });
|
|
410
|
+
res.end(JSON.stringify({
|
|
411
|
+
error: "Proxy error",
|
|
412
|
+
detail: err.message,
|
|
413
|
+
}));
|
|
410
414
|
}
|
|
411
415
|
});
|
|
412
416
|
},
|
|
@@ -452,11 +456,15 @@ export async function serve(mode) {
|
|
|
452
456
|
const filePath = `./dist${url.pathname}`;
|
|
453
457
|
const file = Bun.file(filePath);
|
|
454
458
|
if (await file.exists()) {
|
|
455
|
-
return new Response(file, {
|
|
459
|
+
return new Response(file, {
|
|
460
|
+
headers: { "Content-Type": getMimeType(filePath) },
|
|
461
|
+
});
|
|
456
462
|
}
|
|
457
463
|
const index = Bun.file("./dist/index.html");
|
|
458
464
|
if (await index.exists()) {
|
|
459
|
-
return new Response(index, {
|
|
465
|
+
return new Response(index, {
|
|
466
|
+
headers: { "Content-Type": "text/html" },
|
|
467
|
+
});
|
|
460
468
|
}
|
|
461
469
|
return new Response("Not Found", { status: 404 });
|
|
462
470
|
},
|