@mastra/nestjs 0.1.14-alpha.3 → 0.1.14

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/index.js CHANGED
@@ -11814,7 +11814,8 @@ var RouteHandlerService = class _RouteHandlerService {
11814
11814
  registeredTools: this.options.tools,
11815
11815
  taskStore: this.options.taskStore,
11816
11816
  abortSignal: params.abortSignal,
11817
- routePrefix: this.options.prefix
11817
+ routePrefix: this.options.prefix,
11818
+ request: params.request
11818
11819
  };
11819
11820
  const handlerParams = {
11820
11821
  ...this.omitReservedKeys(validatedPathParams),
@@ -13318,6 +13319,26 @@ function _ts_param10(paramIndex, decorator) {
13318
13319
  };
13319
13320
  }
13320
13321
  __name(_ts_param10, "_ts_param");
13322
+ function toWebRequest(req) {
13323
+ const protocol = req.protocol || "http";
13324
+ const host = req.get("host") || "localhost";
13325
+ const url = `${protocol}://${host}${req.originalUrl || req.url}`;
13326
+ const headers = new Headers();
13327
+ for (const [key, value] of Object.entries(req.headers)) {
13328
+ if (value) {
13329
+ if (Array.isArray(value)) {
13330
+ value.forEach((v) => headers.append(key, v));
13331
+ } else {
13332
+ headers.set(key, value);
13333
+ }
13334
+ }
13335
+ }
13336
+ return new globalThis.Request(url, {
13337
+ method: req.method,
13338
+ headers
13339
+ });
13340
+ }
13341
+ __name(toWebRequest, "toWebRequest");
13321
13342
  var MastraController = class {
13322
13343
  static {
13323
13344
  __name(this, "MastraController");
@@ -13355,7 +13376,8 @@ var MastraController = class {
13355
13376
  queryParams,
13356
13377
  body,
13357
13378
  requestContext: this.requestContext.requestContext,
13358
- abortSignal: this.requestContext.abortSignal
13379
+ abortSignal: this.requestContext.abortSignal,
13380
+ request: toWebRequest(req)
13359
13381
  });
13360
13382
  }
13361
13383
  /**