@worktango/ai-assistant 0.0.50 → 0.0.51-ryantest1

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.
Files changed (2) hide show
  1. package/dist/express.js +13 -2
  2. package/package.json +1 -1
package/dist/express.js CHANGED
@@ -11193,7 +11193,9 @@ function setupAiAssistantRoutes(args) {
11193
11193
  const protocol = args.targetProtocol ?? "http";
11194
11194
  const bearerTokenMiddleware = (req, res, next) => {
11195
11195
  args.getBearerToken(req.headers).then((bearerToken) => {
11196
- req.headers.Authorization = `Bearer ${bearerToken}`;
11196
+ getRequestWithNewAuthHeader(
11197
+ req
11198
+ ).newAuthHeader = `Bearer ${bearerToken}`;
11197
11199
  next();
11198
11200
  }).catch((error) => {
11199
11201
  logger.error("Error getting bearer token:", error);
@@ -11210,7 +11212,13 @@ function setupAiAssistantRoutes(args) {
11210
11212
  return args.getTargetPath(expressRequest.originalUrl || path);
11211
11213
  },
11212
11214
  on: {
11213
- proxyReq: import_http_proxy_middleware.fixRequestBody,
11215
+ proxyReq: (proxyReq, req) => {
11216
+ const newAuthHeader = getRequestWithNewAuthHeader(req).newAuthHeader;
11217
+ if (newAuthHeader) {
11218
+ proxyReq.setHeader("Authorization", newAuthHeader);
11219
+ }
11220
+ (0, import_http_proxy_middleware.fixRequestBody)(proxyReq, req);
11221
+ },
11214
11222
  proxyRes: (proxyRes, req, res) => {
11215
11223
  if (req.headers.accept === "text/event-stream") {
11216
11224
  res.writeHead(res.statusCode, {
@@ -11239,6 +11247,9 @@ function setupAiAssistantRoutes(args) {
11239
11247
  proxy
11240
11248
  );
11241
11249
  }
11250
+ function getRequestWithNewAuthHeader(req) {
11251
+ return req;
11252
+ }
11242
11253
  // Annotate the CommonJS export names for ESM import in node:
11243
11254
  0 && (module.exports = {
11244
11255
  setupAiAssistantRoutes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worktango/ai-assistant",
3
- "version": "0.0.50",
3
+ "version": "0.0.51-ryantest1",
4
4
  "files": [
5
5
  "dist",
6
6
  "express.d.ts",