@mastra/deployer 1.0.0-beta.10 → 1.0.0-beta.11

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 (54) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
  3. package/dist/build/analyze/bundleExternals.d.ts.map +1 -1
  4. package/dist/build/analyze.cjs +2 -2
  5. package/dist/build/analyze.js +1 -1
  6. package/dist/build/bundler.cjs +3 -3
  7. package/dist/build/bundler.js +1 -1
  8. package/dist/build/index.cjs +15 -10
  9. package/dist/build/index.d.ts +1 -0
  10. package/dist/build/index.d.ts.map +1 -1
  11. package/dist/build/index.js +4 -3
  12. package/dist/build/package-info.d.ts +9 -0
  13. package/dist/build/package-info.d.ts.map +1 -0
  14. package/dist/build/utils.d.ts +12 -4
  15. package/dist/build/utils.d.ts.map +1 -1
  16. package/dist/bundler/index.cjs +2 -2
  17. package/dist/bundler/index.d.ts.map +1 -1
  18. package/dist/bundler/index.js +1 -1
  19. package/dist/{chunk-TK2CCU7I.js → chunk-3KATYU33.js} +25 -6
  20. package/dist/chunk-3KATYU33.js.map +1 -0
  21. package/dist/{chunk-RBPCXFN7.js → chunk-5OGQ7IFB.js} +5 -5
  22. package/dist/chunk-5OGQ7IFB.js.map +1 -0
  23. package/dist/{chunk-MUWNMVNL.cjs → chunk-EHZKDGGA.cjs} +45 -25
  24. package/dist/chunk-EHZKDGGA.cjs.map +1 -0
  25. package/dist/{chunk-2OTEFUER.cjs → chunk-F2LCS2DV.cjs} +19 -24
  26. package/dist/chunk-F2LCS2DV.cjs.map +1 -0
  27. package/dist/{chunk-X5QU7B2W.js → chunk-HFP6WWM5.js} +5 -5
  28. package/dist/{chunk-X5QU7B2W.js.map → chunk-HFP6WWM5.js.map} +1 -1
  29. package/dist/{chunk-5CWPEG6R.js → chunk-NM6R77PX.js} +19 -24
  30. package/dist/chunk-NM6R77PX.js.map +1 -0
  31. package/dist/{chunk-SS22TD6R.cjs → chunk-PK3AX3KO.cjs} +13 -13
  32. package/dist/chunk-PK3AX3KO.cjs.map +1 -0
  33. package/dist/{chunk-UQZGTSBF.js → chunk-UG72ONP7.js} +4 -4
  34. package/dist/{chunk-UQZGTSBF.js.map → chunk-UG72ONP7.js.map} +1 -1
  35. package/dist/{chunk-X4TNUYQL.cjs → chunk-Z33LQHGJ.cjs} +15 -15
  36. package/dist/{chunk-X4TNUYQL.cjs.map → chunk-Z33LQHGJ.cjs.map} +1 -1
  37. package/dist/{chunk-BFQ2S5UD.cjs → chunk-ZPUTJSEC.cjs} +12 -12
  38. package/dist/{chunk-BFQ2S5UD.cjs.map → chunk-ZPUTJSEC.cjs.map} +1 -1
  39. package/dist/index.cjs +5 -5
  40. package/dist/index.js +2 -2
  41. package/dist/server/index.cjs +39 -22
  42. package/dist/server/index.cjs.map +1 -1
  43. package/dist/server/index.d.ts.map +1 -1
  44. package/dist/server/index.js +39 -22
  45. package/dist/server/index.js.map +1 -1
  46. package/dist/validator/custom-resolver.cjs +2 -2
  47. package/dist/validator/custom-resolver.js +1 -1
  48. package/package.json +5 -5
  49. package/dist/chunk-2OTEFUER.cjs.map +0 -1
  50. package/dist/chunk-5CWPEG6R.js.map +0 -1
  51. package/dist/chunk-MUWNMVNL.cjs.map +0 -1
  52. package/dist/chunk-RBPCXFN7.js.map +0 -1
  53. package/dist/chunk-SS22TD6R.cjs.map +0 -1
  54. package/dist/chunk-TK2CCU7I.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAS5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS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normalizeStudioBase } from '../chunk-NM6R77PX.js';
1
2
  import { readFile } from 'fs/promises';
2
3
  import * as https from 'https';
3
4
  import { join } from 'path/posix';
@@ -3515,23 +3516,25 @@ async function createHonoServer(mastra, options = {
3515
3516
  restartAllActiveWorkflowRunsHandler
3516
3517
  );
3517
3518
  }
3519
+ const serverOptions = mastra.getServer();
3520
+ const studioBasePath = normalizeStudioBase(serverOptions?.studioBase ?? "/");
3518
3521
  if (options?.playground) {
3519
3522
  app.get(
3520
- "/refresh-events",
3523
+ `${studioBasePath}/refresh-events`,
3521
3524
  describeRoute({
3522
3525
  hide: true
3523
3526
  }),
3524
3527
  handleClientsRefresh
3525
3528
  );
3526
3529
  app.post(
3527
- "/__refresh",
3530
+ `${studioBasePath}/__refresh`,
3528
3531
  describeRoute({
3529
3532
  hide: true
3530
3533
  }),
3531
3534
  handleTriggerClientsRefresh
3532
3535
  );
3533
3536
  app.get(
3534
- "/__hot-reload-status",
3537
+ `${studioBasePath}/__hot-reload-status`,
3535
3538
  describeRoute({
3536
3539
  hide: true
3537
3540
  }),
@@ -3542,48 +3545,61 @@ async function createHonoServer(mastra, options = {
3542
3545
  });
3543
3546
  }
3544
3547
  );
3545
- app.use("/assets/*", async (c, next) => {
3546
- const path = c.req.path;
3547
- if (path.endsWith(".js")) {
3548
- c.header("Content-Type", "application/javascript");
3549
- } else if (path.endsWith(".css")) {
3550
- c.header("Content-Type", "text/css");
3551
- }
3552
- await next();
3553
- });
3554
3548
  app.use(
3555
- "/assets/*",
3549
+ `${studioBasePath}/assets/*`,
3556
3550
  serveStatic({
3557
- root: "./playground/assets"
3551
+ root: "./playground/assets",
3552
+ rewriteRequestPath: (path) => {
3553
+ let rewritten = path;
3554
+ if (studioBasePath && rewritten.startsWith(studioBasePath)) {
3555
+ rewritten = rewritten.slice(studioBasePath.length);
3556
+ }
3557
+ if (rewritten.startsWith("/assets")) {
3558
+ rewritten = rewritten.slice("/assets".length);
3559
+ }
3560
+ return rewritten;
3561
+ }
3558
3562
  })
3559
3563
  );
3560
3564
  }
3561
3565
  app.get("*", async (c, next) => {
3562
- if (c.req.path.startsWith("/api/") || c.req.path.startsWith("/swagger-ui") || c.req.path.startsWith("/openapi.json")) {
3566
+ const requestPath = c.req.path;
3567
+ if (requestPath.startsWith("/api/") || requestPath.startsWith("/swagger-ui") || requestPath.startsWith("/openapi.json")) {
3563
3568
  return await next();
3564
3569
  }
3565
- const path = c.req.path;
3566
- if (path.includes(".") && !path.endsWith(".html")) {
3570
+ if (requestPath.includes(".") && !requestPath.endsWith(".html")) {
3567
3571
  return await next();
3568
3572
  }
3569
- if (options?.playground) {
3573
+ const isPlaygroundRoute = studioBasePath === "" || requestPath === studioBasePath || requestPath.startsWith(`${studioBasePath}/`);
3574
+ if (options?.playground && isPlaygroundRoute) {
3570
3575
  let indexHtml = await readFile(join(process.cwd(), "./playground/index.html"), "utf-8");
3571
- const serverOptions = mastra.getServer();
3572
3576
  const port = serverOptions?.port ?? (Number(process.env.PORT) || 4111);
3573
3577
  const hideCloudCta = process.env.MASTRA_HIDE_CLOUD_CTA === "true";
3574
3578
  const host = serverOptions?.host ?? "localhost";
3579
+ const key = serverOptions?.https?.key ?? (process.env.MASTRA_HTTPS_KEY ? Buffer.from(process.env.MASTRA_HTTPS_KEY, "base64") : void 0);
3580
+ const cert = serverOptions?.https?.cert ?? (process.env.MASTRA_HTTPS_CERT ? Buffer.from(process.env.MASTRA_HTTPS_CERT, "base64") : void 0);
3581
+ const protocol = key && cert ? "https" : "http";
3575
3582
  indexHtml = indexHtml.replace(`'%%MASTRA_SERVER_HOST%%'`, `'${host}'`);
3576
3583
  indexHtml = indexHtml.replace(`'%%MASTRA_SERVER_PORT%%'`, `'${port}'`);
3577
3584
  indexHtml = indexHtml.replace(`'%%MASTRA_HIDE_CLOUD_CTA%%'`, `'${hideCloudCta}'`);
3585
+ indexHtml = indexHtml.replace(`'%%MASTRA_SERVER_PROTOCOL%%'`, `'${protocol}'`);
3586
+ indexHtml = indexHtml.replaceAll("%%MASTRA_STUDIO_BASE_PATH%%", studioBasePath);
3578
3587
  return c.newResponse(indexHtml, 200, { "Content-Type": "text/html" });
3579
3588
  }
3580
3589
  return c.newResponse(html2, 200, { "Content-Type": "text/html" });
3581
3590
  });
3582
3591
  if (options?.playground) {
3592
+ const playgroundPath = studioBasePath ? `${studioBasePath}/*` : "*";
3583
3593
  app.use(
3584
- "*",
3594
+ playgroundPath,
3585
3595
  serveStatic({
3586
- root: "./playground"
3596
+ root: "./playground",
3597
+ rewriteRequestPath: (path) => {
3598
+ if (studioBasePath && path.startsWith(studioBasePath)) {
3599
+ return path.slice(studioBasePath.length);
3600
+ }
3601
+ return path;
3602
+ }
3587
3603
  })
3588
3604
  );
3589
3605
  }
@@ -3615,7 +3631,8 @@ async function createNodeServer(mastra, options = { tools: {} }) {
3615
3631
  const logger2 = mastra.getLogger();
3616
3632
  logger2.info(` Mastra API running on port ${protocol}://${host}:${port}/api`);
3617
3633
  if (options?.playground) {
3618
- const studioUrl = `${protocol}://${host}:${port}`;
3634
+ const studioBasePath = normalizeStudioBase(serverOptions?.studioBase ?? "/");
3635
+ const studioUrl = `${protocol}://${host}:${port}${studioBasePath}`;
3619
3636
  logger2.info(`\u{1F468}\u200D\u{1F4BB} Studio available at ${studioUrl}`);
3620
3637
  }
3621
3638
  if (process.send) {