@mastra/deployer 1.82.0 → 1.83.0-alpha.0

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 (52) hide show
  1. package/dist/{analyze-DNnGuzqf.cjs → analyze-DJ-g40iE.cjs} +2 -2
  2. package/dist/{analyze-DNnGuzqf.cjs.map → analyze-DJ-g40iE.cjs.map} +1 -1
  3. package/dist/{analyze-CW9fEusV.js → analyze-fYsu753O.js} +3 -24
  4. package/dist/{analyze-CW9fEusV.js.map → analyze-fYsu753O.js.map} +1 -1
  5. package/dist/build/analyze.cjs +1 -1
  6. package/dist/build/analyze.js +1 -1
  7. package/dist/build/index.cjs +4 -4
  8. package/dist/build/index.js +4 -4
  9. package/dist/build/shared/extract-mastra-option.d.ts.map +1 -1
  10. package/dist/{build-Cc9X11g7.cjs → build-DJrBURvF.cjs} +5 -5
  11. package/dist/{build-Cc9X11g7.cjs.map → build-DJrBURvF.cjs.map} +1 -1
  12. package/dist/{build-PqRB5M-E.js → build-dIfHk6xF.js} +5 -5
  13. package/dist/{build-PqRB5M-E.js.map → build-dIfHk6xF.js.map} +1 -1
  14. package/dist/bundler/index.cjs +1 -1
  15. package/dist/bundler/index.d.ts.map +1 -1
  16. package/dist/bundler/index.js +1 -1
  17. package/dist/{bundler-DRlNM9-F.js → bundler-DBj7Xv0j.js} +7 -6
  18. package/dist/bundler-DBj7Xv0j.js.map +1 -0
  19. package/dist/{bundler-8GO8sXwa.cjs → bundler-gVxl78M9.cjs} +7 -6
  20. package/dist/bundler-gVxl78M9.cjs.map +1 -0
  21. package/dist/{bundlerOptions-ScfCrul-.js → bundlerOptions-CklrCRoZ.js} +4 -3
  22. package/dist/{bundlerOptions-ScfCrul-.js.map → bundlerOptions-CklrCRoZ.js.map} +1 -1
  23. package/dist/{bundlerOptions-CPMQkWfY.cjs → bundlerOptions-DxMLiEfQ.cjs} +4 -3
  24. package/dist/{bundlerOptions-CPMQkWfY.cjs.map → bundlerOptions-DxMLiEfQ.cjs.map} +1 -1
  25. package/dist/docs/SKILL.md +1 -1
  26. package/dist/docs/assets/SOURCE_MAP.json +33 -2
  27. package/dist/index.cjs +4 -4
  28. package/dist/index.js +4 -4
  29. package/dist/rolldown-runtime-CO0Nlsmt.js +23 -0
  30. package/dist/server/index.cjs +37 -12
  31. package/dist/server/index.cjs.map +1 -1
  32. package/dist/server/index.d.ts +2 -2
  33. package/dist/server/index.js +37 -12
  34. package/dist/server/index.js.map +1 -1
  35. package/dist/services/deps.d.ts.map +1 -1
  36. package/dist/services/index.cjs +1 -1
  37. package/dist/services/index.js +1 -1
  38. package/dist/{services-DbgqQ_yI.cjs → services-B8neClCI.cjs} +52 -5
  39. package/dist/services-B8neClCI.cjs.map +1 -0
  40. package/dist/{services-PA2YqqQJ.js → services-BKh9M2E5.js} +51 -5
  41. package/dist/services-BKh9M2E5.js.map +1 -0
  42. package/package.json +9 -6
  43. package/dist/bundler-8GO8sXwa.cjs.map +0 -1
  44. package/dist/bundler-DRlNM9-F.js.map +0 -1
  45. package/dist/services-DbgqQ_yI.cjs.map +0 -1
  46. package/dist/services-PA2YqqQJ.js.map +0 -1
  47. /package/dist/_types/{@hono_node-server@2.1.5 → @hono_node-server@2.1.6}/dist/index.d.mts +0 -0
  48. /package/dist/_types/{@hono_node-server@2.1.5 → @hono_node-server@2.1.6}/package.json +0 -0
  49. /package/dist/_types/{@mastra_hono@1.7.24 → @mastra_hono@1.7.25-alpha.0}/dist/auth-middleware.d.ts +0 -0
  50. /package/dist/_types/{@mastra_hono@1.7.24 → @mastra_hono@1.7.25-alpha.0}/dist/browser-stream/index.d.ts +0 -0
  51. /package/dist/_types/{@mastra_hono@1.7.24 → @mastra_hono@1.7.25-alpha.0}/dist/index.d.ts +0 -0
  52. /package/dist/_types/{@mastra_hono@1.7.24 → @mastra_hono@1.7.25-alpha.0}/package.json +0 -0
@@ -1,5 +1,5 @@
1
1
  import type { Mastra } from '@mastra/core/mastra';
2
- import type { HonoBindings, HonoVariables } from '../_types/@mastra_hono@1.7.24/dist/index.js';
2
+ import type { HonoBindings, HonoVariables } from '../_types/@mastra_hono@1.7.25-alpha.0/dist/index.js';
3
3
  import { Hono } from 'hono';
4
4
  import type { ServerBundleOptions } from './types.js';
5
5
  type Bindings = HonoBindings;
@@ -13,6 +13,6 @@ export declare function createHonoServer(mastra: Mastra, options?: ServerBundleO
13
13
  Bindings: Bindings;
14
14
  Variables: Variables;
15
15
  }, import("hono/types").BlankSchema, "/">>;
16
- export declare function createNodeServer(mastra: Mastra, options?: ServerBundleOptions): Promise<import("../_types/@hono_node-server@2.1.5/dist/index.mjs").ServerType>;
16
+ export declare function createNodeServer(mastra: Mastra, options?: ServerBundleOptions): Promise<import("../_types/@hono_node-server@2.1.6/dist/index.mjs").ServerType>;
17
17
  export {};
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- import { d as normalizeStudioBase, n as escapeStudioHtmlValue, o as injectStudioHtmlConfig } from "../utils-C8gwr-ur.js";
2
1
  import "../index-CLddUTqr-FaVhUOQu.js";
2
+ import { d as normalizeStudioBase, n as escapeStudioHtmlValue, o as injectStudioHtmlConfig } from "../utils-C8gwr-ur.js";
3
3
  import { createReadStream, existsSync, statSync } from "fs";
4
4
  import { readFile } from "fs/promises";
5
5
  import { dirname, join } from "path";
@@ -31,7 +31,7 @@ import "hono/utils/handler";
31
31
  import "hono/utils/url";
32
32
  import "hono/validator";
33
33
  import { HTTPException } from "hono/http-exception";
34
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.1.5/c64acaa22e289f28d8358ed7eb315e04e16f012a2b67390803ba774efd774a1e/node_modules/@hono/node-server/dist/index.mjs
34
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.1.6/fdc2ef0c1fce27248082afaacb1b446b5df0c539a71d22f10b0596ee5aa343f0/node_modules/@hono/node-server/dist/index.mjs
35
35
  var RequestError = class extends Error {
36
36
  constructor(message, options) {
37
37
  super(message, options);
@@ -189,16 +189,27 @@ const newHeadersFromIncoming = (incoming) => globalThis.Headers === GlobalHeader
189
189
  const reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
190
190
  const reDotSegment = /\/\.\.?(?:[/?#]|$)/;
191
191
  const reValidHost = /^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/;
192
+ const validateRequestTarget = (target) => {
193
+ const backslash = target.indexOf("\\");
194
+ if (backslash !== -1) {
195
+ const query = target.indexOf("?");
196
+ if (query === -1 || backslash < query) throw new RequestError("Backslash in request path");
197
+ }
198
+ };
192
199
  const buildUrl = (scheme, host, incomingUrl) => {
193
200
  const url = `${scheme}://${host}${incomingUrl}`;
194
201
  if (!reValidHost.test(host)) {
202
+ validateRequestTarget(incomingUrl);
195
203
  const urlObj = new URL(url);
196
204
  if (urlObj.hostname.length !== host.length && urlObj.hostname !== (host.includes(":") ? host.replace(/:\d+$/, "") : host).toLowerCase()) throw new RequestError("Invalid host header");
197
205
  return urlObj.href;
198
206
  } else if (incomingUrl.length === 0) return url + "/";
199
207
  else {
200
208
  if (incomingUrl.charCodeAt(0) !== 47) throw new RequestError("Invalid URL");
201
- if (!reValidRequestUrl.test(incomingUrl) || reDotSegment.test(incomingUrl)) return new URL(url).href;
209
+ if (!reValidRequestUrl.test(incomingUrl) || reDotSegment.test(incomingUrl)) {
210
+ validateRequestTarget(incomingUrl);
211
+ return new URL(url).href;
212
+ }
202
213
  return url;
203
214
  }
204
215
  };
@@ -607,6 +618,7 @@ const newRequest = (incoming, defaultHostname) => {
607
618
  if (incomingUrl[0] !== "/" && (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
608
619
  if (incoming instanceof Http2ServerRequest) throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
609
620
  try {
621
+ validateRequestTarget(incomingUrl);
610
622
  req[urlKey] = new URL(incomingUrl).href;
611
623
  } catch (e) {
612
624
  throw new RequestError("Invalid absolute URL", { cause: e });
@@ -1147,6 +1159,7 @@ const appendResponseHeaders = (headers, responseHeaders) => {
1147
1159
  });
1148
1160
  };
1149
1161
  const rejectUpgradeRequest = (socket, status, responseHeaders) => {
1162
+ if (socket.destroyed) return;
1150
1163
  const responseLines = ["Connection: close", "Content-Length: 0"];
1151
1164
  appendResponseHeaders(responseLines, responseHeaders);
1152
1165
  socket.end(`HTTP/1.1 ${status.toString()} ${STATUS_CODES[status] ?? ""}\r\n${responseLines.join("\r\n")}\r\n\r
@@ -1154,7 +1167,12 @@ const rejectUpgradeRequest = (socket, status, responseHeaders) => {
1154
1167
  };
1155
1168
  const createUpgradeRequest = (request) => {
1156
1169
  const protocol = request.socket.encrypted ? "https" : "http";
1157
- const url = new URL(request.url ?? "/", `${protocol}://${request.headers.host ?? "localhost"}`);
1170
+ const incomingUrl = request.url ?? "/";
1171
+ let url;
1172
+ if (incomingUrl[0] !== "/" && (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
1173
+ validateRequestTarget(incomingUrl);
1174
+ url = new URL(incomingUrl).href;
1175
+ } else url = buildUrl(protocol, request.headers.host ?? "localhost", incomingUrl);
1158
1176
  const headers = new Headers();
1159
1177
  for (const key in request.headers) {
1160
1178
  const value = request.headers[key];
@@ -1191,6 +1209,10 @@ const setupWebSocket = (options) => {
1191
1209
  };
1192
1210
  server.on("upgrade", async (request, socket, head) => {
1193
1211
  if (request.headers.upgrade?.toLowerCase() !== "websocket") return;
1212
+ const ignoreSocketError = () => {};
1213
+ const reclaimWaiterOnClose = () => rejectWaiter(request);
1214
+ socket.on("error", ignoreSocketError);
1215
+ socket.once("close", reclaimWaiterOnClose);
1194
1216
  const env = {
1195
1217
  incoming: request,
1196
1218
  outgoing: void 0,
@@ -1205,8 +1227,12 @@ const setupWebSocket = (options) => {
1205
1227
  status = response.status;
1206
1228
  responseHeaders = response.headers;
1207
1229
  }
1208
- } catch {
1209
- if (server.listenerCount("upgrade") === 1) rejectUpgradeRequest(socket, 500);
1230
+ } catch (error) {
1231
+ if (server.listenerCount("upgrade") === 1) rejectUpgradeRequest(socket, error instanceof RequestError ? 400 : 500);
1232
+ return;
1233
+ }
1234
+ if (socket.destroyed) {
1235
+ rejectWaiter(request);
1210
1236
  return;
1211
1237
  }
1212
1238
  const waiter = waiterMap.get(request);
@@ -1218,12 +1244,11 @@ const setupWebSocket = (options) => {
1218
1244
  const addResponseHeaders = (headers) => {
1219
1245
  appendResponseHeaders(headers, responseHeaders);
1220
1246
  };
1221
- const reclaimWaiterOnClose = () => rejectWaiter(request);
1222
- socket.once("close", reclaimWaiterOnClose);
1223
1247
  wss.on("headers", addResponseHeaders);
1224
1248
  try {
1225
1249
  wss.handleUpgrade(request, socket, head, (ws) => {
1226
1250
  socket.off("close", reclaimWaiterOnClose);
1251
+ socket.off("error", ignoreSocketError);
1227
1252
  wss.emit("connection", ws, request);
1228
1253
  });
1229
1254
  } finally {
@@ -1332,7 +1357,7 @@ const serve = (options, listeningListener) => {
1332
1357
  });
1333
1358
  return server;
1334
1359
  };
1335
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.1.5/c64acaa22e289f28d8358ed7eb315e04e16f012a2b67390803ba774efd774a1e/node_modules/@hono/node-server/dist/utils/stream.mjs
1360
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.1.6/fdc2ef0c1fce27248082afaacb1b446b5df0c539a71d22f10b0596ee5aa343f0/node_modules/@hono/node-server/dist/utils/stream.mjs
1336
1361
  const pr54206Applied = () => {
1337
1362
  const [major, minor] = versions.node.split(".").map((component) => parseInt(component));
1338
1363
  return major >= 23 || major === 22 && minor >= 7 || major === 20 && minor >= 18;
@@ -1390,7 +1415,7 @@ const createStreamBody = (stream, useNativeReadableToWeb = useReadableToWeb) =>
1390
1415
  }
1391
1416
  });
1392
1417
  };
1393
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.1.5/c64acaa22e289f28d8358ed7eb315e04e16f012a2b67390803ba774efd774a1e/node_modules/@hono/node-server/dist/serve-static.mjs
1418
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.1.6/fdc2ef0c1fce27248082afaacb1b446b5df0c539a71d22f10b0596ee5aa343f0/node_modules/@hono/node-server/dist/serve-static.mjs
1394
1419
  const COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
1395
1420
  const ENCODINGS = {
1396
1421
  br: ".br",
@@ -1534,7 +1559,7 @@ const serveStatic = (options = { root: "" }) => {
1534
1559
  return result;
1535
1560
  };
1536
1561
  };
1537
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/swagger-ui/0.5.3/fe1b4a78fef400a9bb4ccec4e91cddbbd9b43706afe50dd3266b2297c015e5bf/node_modules/@hono/swagger-ui/dist/index.js
1562
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/swagger-ui/0.5.3/2d64a3444a8e781b9d0909ff286ca728dbe5419d9721688c851938b2e50a9382/node_modules/@hono/swagger-ui/dist/index.js
1538
1563
  const RENDER_TYPE = {
1539
1564
  STRING_ARRAY: "string_array",
1540
1565
  STRING: "string",
@@ -4109,7 +4134,7 @@ var MastraServer$2 = class extends MastraServer {
4109
4134
  });
4110
4135
  }
4111
4136
  };
4112
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono-openapi/1.5.0/aba075f9c000905a9976a3be5624e02cbca659679195a7801fa8cc48a73fcf35/node_modules/hono-openapi/dist/index.js
4137
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono-openapi/1.5.0/6ca93514d06afdfd0d7befe948e629b04e66fbf3f0241f2ac71dd8ec9b8121b7/node_modules/hono-openapi/dist/index.js
4113
4138
  const uniqueSymbol = Symbol.for("hono-openapi");
4114
4139
  function describeRoute(spec) {
4115
4140
  const middleware = async (_c, next) => {