@mastra/deployer 1.76.0-alpha.0 → 1.76.0-alpha.1
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/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/server/index.cjs +203 -37
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +204 -38
- package/dist/server/index.js.map +1 -1
- package/package.json +8 -8
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-deployer
|
|
|
3
3
|
description: Documentation for @mastra/deployer. Use when working with @mastra/deployer APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/deployer"
|
|
6
|
-
version: "1.76.0-alpha.
|
|
6
|
+
version: "1.76.0-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
package/dist/server/index.cjs
CHANGED
|
@@ -36,13 +36,161 @@ require("hono/utils/handler");
|
|
|
36
36
|
require("hono/validator");
|
|
37
37
|
let hono_http_exception = require("hono/http-exception");
|
|
38
38
|
//#endregion
|
|
39
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.
|
|
39
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.1.3/19d7f8738ee0bdda5c921e6b78e7282a61a457f5cbca86ce0e563f0efa4986d3/node_modules/@hono/node-server/dist/index.mjs
|
|
40
40
|
var RequestError = class extends Error {
|
|
41
41
|
constructor(message, options) {
|
|
42
42
|
super(message, options);
|
|
43
43
|
this.name = "RequestError";
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
+
const nonJoinedHeaders = /* @__PURE__ */ new Set([
|
|
47
|
+
"age",
|
|
48
|
+
"authorization",
|
|
49
|
+
"content-length",
|
|
50
|
+
"content-type",
|
|
51
|
+
"etag",
|
|
52
|
+
"expires",
|
|
53
|
+
"from",
|
|
54
|
+
"host",
|
|
55
|
+
"if-modified-since",
|
|
56
|
+
"if-unmodified-since",
|
|
57
|
+
"last-modified",
|
|
58
|
+
"location",
|
|
59
|
+
"max-forwards",
|
|
60
|
+
"proxy-authorization",
|
|
61
|
+
"referer",
|
|
62
|
+
"retry-after",
|
|
63
|
+
"server",
|
|
64
|
+
"user-agent"
|
|
65
|
+
]);
|
|
66
|
+
const validHeaderName = /^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/;
|
|
67
|
+
const isHttpWhitespace = (code) => code === 9 || code === 10 || code === 13 || code === 32;
|
|
68
|
+
const normalizeHeaderValue = (value) => {
|
|
69
|
+
if (!isHttpWhitespace(value.charCodeAt(0)) && !isHttpWhitespace(value.charCodeAt(value.length - 1))) return value;
|
|
70
|
+
let start = 0;
|
|
71
|
+
let end = value.length;
|
|
72
|
+
while (start < end && isHttpWhitespace(value.charCodeAt(start))) start++;
|
|
73
|
+
while (end > start && isHttpWhitespace(value.charCodeAt(end - 1))) end--;
|
|
74
|
+
return value.slice(start, end);
|
|
75
|
+
};
|
|
76
|
+
const forbiddenHeaderValue = /[\0\r\n]/;
|
|
77
|
+
const GlobalHeaders = globalThis.Headers;
|
|
78
|
+
const materializeHeaders = (rawHeaders, HeadersCtor = GlobalHeaders) => {
|
|
79
|
+
const headers = new HeadersCtor();
|
|
80
|
+
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
81
|
+
const name = rawHeaders[i];
|
|
82
|
+
if (!name.startsWith(":")) headers.append(name, rawHeaders[i + 1]);
|
|
83
|
+
}
|
|
84
|
+
return headers;
|
|
85
|
+
};
|
|
86
|
+
var RequestHeaders = class {
|
|
87
|
+
#incoming;
|
|
88
|
+
#rawHeaders;
|
|
89
|
+
#headers;
|
|
90
|
+
#invalidValue;
|
|
91
|
+
constructor(incoming) {
|
|
92
|
+
this.#incoming = incoming;
|
|
93
|
+
if (incoming instanceof http2.Http2ServerRequest) this.#rawHeaders = incoming.rawHeaders.slice();
|
|
94
|
+
}
|
|
95
|
+
get #lazyRawHeaders() {
|
|
96
|
+
return this.#rawHeaders ??= this.#incoming.rawHeaders.slice();
|
|
97
|
+
}
|
|
98
|
+
get #native() {
|
|
99
|
+
if (!this.#headers) {
|
|
100
|
+
this.#headers = materializeHeaders(this.#lazyRawHeaders);
|
|
101
|
+
this.#rawHeaders = void 0;
|
|
102
|
+
}
|
|
103
|
+
return this.#headers;
|
|
104
|
+
}
|
|
105
|
+
#normalizedName(name) {
|
|
106
|
+
if (typeof name !== "string") return;
|
|
107
|
+
if (!validHeaderName.test(name)) throw new TypeError(`Invalid header name: ${name}`);
|
|
108
|
+
return name.toLowerCase();
|
|
109
|
+
}
|
|
110
|
+
#lookupHttp1(lowerName) {
|
|
111
|
+
const headers = this.#incoming instanceof http2.Http2ServerRequest ? void 0 : this.#incoming.headers;
|
|
112
|
+
if (!headers || nonJoinedHeaders.has(lowerName) || lowerName === "set-cookie" || lowerName === "__proto__") return;
|
|
113
|
+
if (!Object.hasOwn(headers, lowerName)) return null;
|
|
114
|
+
const rawValue = headers[lowerName];
|
|
115
|
+
if (typeof rawValue === "string") {
|
|
116
|
+
const value = normalizeHeaderValue(rawValue);
|
|
117
|
+
return forbiddenHeaderValue.test(value) ? void 0 : value;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
#lookup(rawHeaders, lowerName) {
|
|
121
|
+
const separator = lowerName === "cookie" ? "; " : ", ";
|
|
122
|
+
let value = null;
|
|
123
|
+
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
124
|
+
const rawName = rawHeaders[i];
|
|
125
|
+
if (rawName.length === lowerName.length && rawName.toLowerCase() === lowerName) {
|
|
126
|
+
const rawValue = normalizeHeaderValue(rawHeaders[i + 1]);
|
|
127
|
+
if (forbiddenHeaderValue.test(rawValue)) {
|
|
128
|
+
this.#invalidValue = true;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
value = value === null ? rawValue : value + separator + rawValue;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return value;
|
|
135
|
+
}
|
|
136
|
+
append(name, value) {
|
|
137
|
+
this.#native.append(name, value);
|
|
138
|
+
}
|
|
139
|
+
delete(name) {
|
|
140
|
+
this.#native.delete(name);
|
|
141
|
+
}
|
|
142
|
+
get(name) {
|
|
143
|
+
const lowerName = this.#normalizedName(name);
|
|
144
|
+
if (lowerName && !this.#headers && !this.#invalidValue) {
|
|
145
|
+
const http1Value = this.#lookupHttp1(lowerName);
|
|
146
|
+
if (http1Value !== void 0) return http1Value;
|
|
147
|
+
const value = this.#lookup(this.#lazyRawHeaders, lowerName);
|
|
148
|
+
if (value !== void 0) return value;
|
|
149
|
+
}
|
|
150
|
+
return this.#native.get(name);
|
|
151
|
+
}
|
|
152
|
+
has(name) {
|
|
153
|
+
const lowerName = this.#normalizedName(name);
|
|
154
|
+
if (lowerName && !this.#headers && !this.#invalidValue) {
|
|
155
|
+
const http1Value = this.#lookupHttp1(lowerName);
|
|
156
|
+
if (http1Value !== void 0) return http1Value !== null;
|
|
157
|
+
const value = this.#lookup(this.#lazyRawHeaders, lowerName);
|
|
158
|
+
if (value !== void 0) return value !== null;
|
|
159
|
+
}
|
|
160
|
+
return this.#native.has(name);
|
|
161
|
+
}
|
|
162
|
+
set(name, value) {
|
|
163
|
+
this.#native.set(name, value);
|
|
164
|
+
}
|
|
165
|
+
getSetCookie() {
|
|
166
|
+
return this.#native.getSetCookie();
|
|
167
|
+
}
|
|
168
|
+
keys() {
|
|
169
|
+
return this.#native.keys();
|
|
170
|
+
}
|
|
171
|
+
values() {
|
|
172
|
+
return this.#native.values();
|
|
173
|
+
}
|
|
174
|
+
entries() {
|
|
175
|
+
return this.#native.entries();
|
|
176
|
+
}
|
|
177
|
+
forEach(callback, thisArg) {
|
|
178
|
+
this.#native.forEach((value, key) => {
|
|
179
|
+
callback.call(thisArg, value, key, this);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
[Symbol.iterator]() {
|
|
183
|
+
return this.entries();
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
Object.defineProperty(RequestHeaders.prototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
|
|
187
|
+
return `Headers (lightweight) ${inspectFn(Object.fromEntries(this), {
|
|
188
|
+
...options,
|
|
189
|
+
depth: depth == null ? null : depth - 1
|
|
190
|
+
})}`;
|
|
191
|
+
} });
|
|
192
|
+
Object.setPrototypeOf(RequestHeaders.prototype, GlobalHeaders.prototype);
|
|
193
|
+
const newHeadersFromIncoming = (incoming) => globalThis.Headers === GlobalHeaders ? new RequestHeaders(incoming) : materializeHeaders(incoming.rawHeaders, globalThis.Headers);
|
|
46
194
|
const reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
|
|
47
195
|
const reDotSegment = /\/\.\.?(?:[/?#]|$)/;
|
|
48
196
|
const reValidHost = /^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/;
|
|
@@ -75,15 +223,6 @@ var Request$1 = class extends GlobalRequest {
|
|
|
75
223
|
super(input, options);
|
|
76
224
|
}
|
|
77
225
|
};
|
|
78
|
-
const newHeadersFromIncoming = (incoming) => {
|
|
79
|
-
const headerRecord = [];
|
|
80
|
-
const rawHeaders = incoming.rawHeaders;
|
|
81
|
-
for (let i = 0, len = rawHeaders.length; i < len; i += 2) {
|
|
82
|
-
const key = rawHeaders[i];
|
|
83
|
-
if (key.charCodeAt(0) !== 58) headerRecord.push([key, rawHeaders[i + 1]]);
|
|
84
|
-
}
|
|
85
|
-
return new Headers(headerRecord);
|
|
86
|
-
};
|
|
87
226
|
const wrapBodyStream = Symbol("wrapBodyStream");
|
|
88
227
|
const byteExactEncodings = /* @__PURE__ */ new Set([
|
|
89
228
|
"latin1",
|
|
@@ -218,8 +357,10 @@ const normalizeIncomingMethod = (method) => {
|
|
|
218
357
|
case "GET":
|
|
219
358
|
case "HEAD":
|
|
220
359
|
case "OPTIONS":
|
|
360
|
+
case "PATCH":
|
|
221
361
|
case "POST":
|
|
222
|
-
case "PUT":
|
|
362
|
+
case "PUT":
|
|
363
|
+
case "QUERY": return method;
|
|
223
364
|
}
|
|
224
365
|
const upper = method.toUpperCase();
|
|
225
366
|
switch (upper) {
|
|
@@ -513,16 +654,15 @@ var Response$1 = class Response$1 {
|
|
|
513
654
|
constructor(body, init) {
|
|
514
655
|
let headers;
|
|
515
656
|
this.#body = body;
|
|
516
|
-
if (init instanceof
|
|
657
|
+
if (init instanceof GlobalResponse) {
|
|
517
658
|
const cachedGlobalResponse = init[responseCache];
|
|
518
659
|
if (cachedGlobalResponse) {
|
|
519
660
|
this.#init = cachedGlobalResponse;
|
|
520
661
|
this[getResponseCache]();
|
|
521
662
|
return;
|
|
522
|
-
} else {
|
|
523
|
-
this.#init = init.#init;
|
|
524
|
-
headers = new Headers(init.headers);
|
|
525
663
|
}
|
|
664
|
+
this.#init = init instanceof Response$1 ? init.#init : init;
|
|
665
|
+
headers = new Headers(init.headers);
|
|
526
666
|
} else this.#init = init;
|
|
527
667
|
if (body == null || typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) this[cacheKey] = [
|
|
528
668
|
init?.status || 200,
|
|
@@ -698,7 +838,10 @@ const drainIncoming = (incoming) => {
|
|
|
698
838
|
const forceClose = () => {
|
|
699
839
|
cleanup();
|
|
700
840
|
const socket = incoming.socket;
|
|
701
|
-
if (socket && !socket.destroyed)
|
|
841
|
+
if (socket && !socket.destroyed) {
|
|
842
|
+
if (typeof socket.destroySoon === "function") socket.destroySoon();
|
|
843
|
+
else if (typeof socket.destroy === "function") socket.destroy();
|
|
844
|
+
}
|
|
702
845
|
};
|
|
703
846
|
const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS);
|
|
704
847
|
timer.unref?.();
|
|
@@ -737,7 +880,10 @@ const handleResponseError = (e, outgoing) => {
|
|
|
737
880
|
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") console.info("The user aborted a request.");
|
|
738
881
|
else {
|
|
739
882
|
console.error(e);
|
|
740
|
-
if (!outgoing.headersSent)
|
|
883
|
+
if (!outgoing.headersSent) {
|
|
884
|
+
if (outgoing instanceof http.ServerResponse) outgoing._contentLength = null;
|
|
885
|
+
outgoing.writeHead(500, { "Content-Type": "text/plain" });
|
|
886
|
+
}
|
|
741
887
|
outgoing.end(`Error: ${err.message}`);
|
|
742
888
|
outgoing.destroy(err);
|
|
743
889
|
}
|
|
@@ -745,6 +891,21 @@ const handleResponseError = (e, outgoing) => {
|
|
|
745
891
|
const flushHeaders = (outgoing) => {
|
|
746
892
|
if ("flushHeaders" in outgoing && outgoing.writable) outgoing.flushHeaders();
|
|
747
893
|
};
|
|
894
|
+
const trySetContentLength = (outgoing, status, length) => {
|
|
895
|
+
const http1 = outgoing;
|
|
896
|
+
if (http1._contentLength === null && http1._hasBody && http1.useChunkedEncodingByDefault && !http1._removedContLen && status >= 200 && status !== 204 && status !== 304 && !outgoing.hasHeader("content-length") && !outgoing.hasHeader("transfer-encoding") && !outgoing.hasHeader("trailer")) {
|
|
897
|
+
http1._contentLength = length;
|
|
898
|
+
return true;
|
|
899
|
+
}
|
|
900
|
+
return false;
|
|
901
|
+
};
|
|
902
|
+
const writeDefaultHeaders = (outgoing, status, length) => {
|
|
903
|
+
if (trySetContentLength(outgoing, status, length)) outgoing.writeHead(status, { "Content-Type": defaultContentType });
|
|
904
|
+
else outgoing.writeHead(status, {
|
|
905
|
+
"Content-Type": defaultContentType,
|
|
906
|
+
"Content-Length": length
|
|
907
|
+
});
|
|
908
|
+
};
|
|
748
909
|
const responseViaCache = async (res, outgoing) => {
|
|
749
910
|
let [status, body, header] = res[cacheKey];
|
|
750
911
|
if (!header) {
|
|
@@ -752,22 +913,13 @@ const responseViaCache = async (res, outgoing) => {
|
|
|
752
913
|
outgoing.writeHead(status);
|
|
753
914
|
outgoing.end();
|
|
754
915
|
} else if (typeof body === "string") {
|
|
755
|
-
outgoing
|
|
756
|
-
"Content-Type": defaultContentType,
|
|
757
|
-
"Content-Length": Buffer.byteLength(body)
|
|
758
|
-
});
|
|
916
|
+
writeDefaultHeaders(outgoing, status, Buffer.byteLength(body));
|
|
759
917
|
outgoing.end(body);
|
|
760
918
|
} else if (body instanceof Uint8Array) {
|
|
761
|
-
outgoing
|
|
762
|
-
"Content-Type": defaultContentType,
|
|
763
|
-
"Content-Length": body.byteLength
|
|
764
|
-
});
|
|
919
|
+
writeDefaultHeaders(outgoing, status, body.byteLength);
|
|
765
920
|
outgoing.end(body);
|
|
766
921
|
} else if (body instanceof Blob) {
|
|
767
|
-
outgoing
|
|
768
|
-
"Content-Type": defaultContentType,
|
|
769
|
-
"Content-Length": body.size
|
|
770
|
-
});
|
|
922
|
+
writeDefaultHeaders(outgoing, status, body.size);
|
|
771
923
|
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
|
772
924
|
} else {
|
|
773
925
|
outgoing.writeHead(status, { "Content-Type": defaultContentType });
|
|
@@ -778,6 +930,8 @@ const responseViaCache = async (res, outgoing) => {
|
|
|
778
930
|
return;
|
|
779
931
|
}
|
|
780
932
|
let hasContentLength = false;
|
|
933
|
+
let plainHeaders = false;
|
|
934
|
+
let canAutoLength = true;
|
|
781
935
|
if (header instanceof Headers) {
|
|
782
936
|
hasContentLength = header.has("content-length");
|
|
783
937
|
header = buildOutgoingHttpHeaders(header, body === null ? void 0 : defaultContentType);
|
|
@@ -785,14 +939,25 @@ const responseViaCache = async (res, outgoing) => {
|
|
|
785
939
|
const headerObj = new Headers(header);
|
|
786
940
|
hasContentLength = headerObj.has("content-length");
|
|
787
941
|
header = buildOutgoingHttpHeaders(headerObj, body === null ? void 0 : defaultContentType);
|
|
788
|
-
} else
|
|
789
|
-
|
|
790
|
-
|
|
942
|
+
} else {
|
|
943
|
+
plainHeaders = true;
|
|
944
|
+
for (const key in header) {
|
|
945
|
+
if (key.length === 14 && key.toLowerCase() === "content-length") {
|
|
946
|
+
hasContentLength = true;
|
|
947
|
+
break;
|
|
948
|
+
}
|
|
949
|
+
if (key.length === 17 && key.toLowerCase() === "transfer-encoding" || key.length === 7 && key.toLowerCase() === "trailer") canAutoLength = false;
|
|
950
|
+
}
|
|
791
951
|
}
|
|
792
952
|
if (!hasContentLength) {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
else if (body instanceof
|
|
953
|
+
let length;
|
|
954
|
+
if (typeof body === "string") length = Buffer.byteLength(body);
|
|
955
|
+
else if (body instanceof Uint8Array) length = body.byteLength;
|
|
956
|
+
else if (body instanceof Blob) length = body.size;
|
|
957
|
+
if (length !== void 0 && (!plainHeaders || !canAutoLength || !trySetContentLength(outgoing, status, length))) {
|
|
958
|
+
if (plainHeaders) header = { ...header };
|
|
959
|
+
header["Content-Length"] = length;
|
|
960
|
+
}
|
|
796
961
|
}
|
|
797
962
|
outgoing.writeHead(status, header);
|
|
798
963
|
if (body == null) outgoing.end();
|
|
@@ -1173,7 +1338,7 @@ const serve = (options, listeningListener) => {
|
|
|
1173
1338
|
return server;
|
|
1174
1339
|
};
|
|
1175
1340
|
//#endregion
|
|
1176
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.
|
|
1341
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.1.3/19d7f8738ee0bdda5c921e6b78e7282a61a457f5cbca86ce0e563f0efa4986d3/node_modules/@hono/node-server/dist/utils/stream.mjs
|
|
1177
1342
|
const pr54206Applied = () => {
|
|
1178
1343
|
const [major, minor] = process$1.versions.node.split(".").map((component) => parseInt(component));
|
|
1179
1344
|
return major >= 23 || major === 22 && minor >= 7 || major === 20 && minor >= 18;
|
|
@@ -1232,7 +1397,7 @@ const createStreamBody = (stream$2, useNativeReadableToWeb = useReadableToWeb) =
|
|
|
1232
1397
|
});
|
|
1233
1398
|
};
|
|
1234
1399
|
//#endregion
|
|
1235
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.
|
|
1400
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@hono/node-server/2.1.3/19d7f8738ee0bdda5c921e6b78e7282a61a457f5cbca86ce0e563f0efa4986d3/node_modules/@hono/node-server/dist/serve-static.mjs
|
|
1236
1401
|
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;
|
|
1237
1402
|
const ENCODINGS = {
|
|
1238
1403
|
br: ".br",
|
|
@@ -1305,6 +1470,7 @@ const serveStatic = (options = { root: "" }) => {
|
|
|
1305
1470
|
let filename;
|
|
1306
1471
|
if (optionPath) filename = optionPath;
|
|
1307
1472
|
else try {
|
|
1473
|
+
if (!options.allowPercentInPath && c.req.path.includes("%")) throw new Error();
|
|
1308
1474
|
filename = tryDecodeURI(c.req.path);
|
|
1309
1475
|
if (/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}|\\/.test(filename)) throw new Error();
|
|
1310
1476
|
} catch {
|