@mastra/deployer 1.25.0-alpha.2 → 1.25.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.
@@ -4,7 +4,7 @@ import * as https from 'https';
4
4
  import { join, dirname } from 'path';
5
5
  import { fileURLToPath } from 'url';
6
6
  import { createServer } from 'http';
7
- import { Http2ServerRequest } from 'http2';
7
+ import { Http2ServerRequest, constants } from 'http2';
8
8
  import { Writable, Readable } from 'stream';
9
9
  import crypto from 'crypto';
10
10
  import { getMimeType } from 'hono/utils/mime';
@@ -167,6 +167,17 @@ var requestPrototype = {
167
167
  }
168
168
  });
169
169
  });
170
+ Object.defineProperty(requestPrototype, /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), {
171
+ value: function(depth, options, inspectFn) {
172
+ const props = {
173
+ method: this.method,
174
+ url: this.url,
175
+ headers: this.headers,
176
+ nativeRequest: this[requestCache]
177
+ };
178
+ return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`;
179
+ }
180
+ });
170
181
  Object.setPrototypeOf(requestPrototype, Request2.prototype);
171
182
  var newRequest = (incoming, defaultHostname) => {
172
183
  const req = Object.create(requestPrototype);
@@ -270,6 +281,17 @@ var Response2 = class _Response {
270
281
  }
271
282
  });
272
283
  });
284
+ Object.defineProperty(Response2.prototype, /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), {
285
+ value: function(depth, options, inspectFn) {
286
+ const props = {
287
+ status: this.status,
288
+ headers: this.headers,
289
+ ok: this.ok,
290
+ nativeResponse: this[responseCache]
291
+ };
292
+ return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`;
293
+ }
294
+ });
273
295
  Object.setPrototypeOf(Response2, GlobalResponse);
274
296
  Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
275
297
  async function readWithoutBlocking(readPromise) {
@@ -341,6 +363,49 @@ if (typeof global.crypto === "undefined") {
341
363
  global.crypto = crypto;
342
364
  }
343
365
  var outgoingEnded = /* @__PURE__ */ Symbol("outgoingEnded");
366
+ var incomingDraining = /* @__PURE__ */ Symbol("incomingDraining");
367
+ var DRAIN_TIMEOUT_MS = 500;
368
+ var MAX_DRAIN_BYTES = 64 * 1024 * 1024;
369
+ var drainIncoming = (incoming) => {
370
+ const incomingWithDrainState = incoming;
371
+ if (incoming.destroyed || incomingWithDrainState[incomingDraining]) {
372
+ return;
373
+ }
374
+ incomingWithDrainState[incomingDraining] = true;
375
+ if (incoming instanceof Http2ServerRequest) {
376
+ try {
377
+ incoming.stream?.close?.(constants.NGHTTP2_NO_ERROR);
378
+ } catch {
379
+ }
380
+ return;
381
+ }
382
+ let bytesRead = 0;
383
+ const cleanup = () => {
384
+ clearTimeout(timer);
385
+ incoming.off("data", onData);
386
+ incoming.off("end", cleanup);
387
+ incoming.off("error", cleanup);
388
+ };
389
+ const forceClose = () => {
390
+ cleanup();
391
+ const socket = incoming.socket;
392
+ if (socket && !socket.destroyed) {
393
+ socket.destroySoon();
394
+ }
395
+ };
396
+ const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS);
397
+ timer.unref?.();
398
+ const onData = (chunk) => {
399
+ bytesRead += chunk.length;
400
+ if (bytesRead > MAX_DRAIN_BYTES) {
401
+ forceClose();
402
+ }
403
+ };
404
+ incoming.on("data", onData);
405
+ incoming.on("end", cleanup);
406
+ incoming.on("error", cleanup);
407
+ incoming.resume();
408
+ };
344
409
  var handleRequestError = () => new Response(null, {
345
410
  status: 400
346
411
  });
@@ -506,14 +571,18 @@ var getRequestListener = (fetchCallback, options = {}) => {
506
571
  setTimeout(() => {
507
572
  if (!incomingEnded) {
508
573
  setTimeout(() => {
509
- incoming.destroy();
510
- outgoing.destroy();
574
+ drainIncoming(incoming);
511
575
  });
512
576
  }
513
577
  });
514
578
  }
515
579
  };
516
580
  }
581
+ outgoing.on("finish", () => {
582
+ if (!incomingEnded) {
583
+ drainIncoming(incoming);
584
+ }
585
+ });
517
586
  }
518
587
  outgoing.on("close", () => {
519
588
  const abortController = req[abortControllerKey];
@@ -528,7 +597,7 @@ var getRequestListener = (fetchCallback, options = {}) => {
528
597
  setTimeout(() => {
529
598
  if (!incomingEnded) {
530
599
  setTimeout(() => {
531
- incoming.destroy();
600
+ drainIncoming(incoming);
532
601
  });
533
602
  }
534
603
  });
@@ -652,7 +721,7 @@ var serveStatic = (options = { root: "" }) => {
652
721
  } else {
653
722
  try {
654
723
  filename = tryDecodeURI(c.req.path);
655
- if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) {
724
+ if (/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}/.test(filename)) {
656
725
  throw new Error();
657
726
  }
658
727
  } catch {
@@ -3668,7 +3737,7 @@ var MastraServer = class extends MastraServer$1 {
3668
3737
  }
3669
3738
  };
3670
3739
 
3671
- // ../../node_modules/.pnpm/hono-openapi@1.3.0_@hono+standard-validator@0.2.2_@standard-schema+spec@1.1.0_hono@4.12_3cea370b44be5a00a417afcc8ad0e5f2/node_modules/hono-openapi/dist/index.js
3740
+ // ../../node_modules/.pnpm/hono-openapi@1.3.0_@hono+standard-validator@0.2.2_@standard-schema+spec@1.1.0_hono@4.12_7583f8b2d2d3db741ec7b85bcfad020d/node_modules/hono-openapi/dist/index.js
3672
3741
  var uniqueSymbol = /* @__PURE__ */ Symbol("openapi");
3673
3742
  function describeRoute(spec) {
3674
3743
  const middleware2 = async (_c, next) => {