staklink 0.3.22 → 0.3.23
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/proxy-server.cjs +1943 -967
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +2 -1
package/dist/proxy-server.cjs
CHANGED
|
@@ -1289,8 +1289,8 @@ var require_node = __commonJS({
|
|
|
1289
1289
|
}
|
|
1290
1290
|
break;
|
|
1291
1291
|
case "FILE":
|
|
1292
|
-
var
|
|
1293
|
-
stream3 = new
|
|
1292
|
+
var fs12 = require("fs");
|
|
1293
|
+
stream3 = new fs12.SyncWriteStream(fd2, { autoClose: false });
|
|
1294
1294
|
stream3._type = "fs";
|
|
1295
1295
|
break;
|
|
1296
1296
|
case "PIPE":
|
|
@@ -14077,11 +14077,11 @@ var require_mime_types = __commonJS({
|
|
|
14077
14077
|
}
|
|
14078
14078
|
return exts[0];
|
|
14079
14079
|
}
|
|
14080
|
-
function lookup(
|
|
14081
|
-
if (!
|
|
14080
|
+
function lookup(path11) {
|
|
14081
|
+
if (!path11 || typeof path11 !== "string") {
|
|
14082
14082
|
return false;
|
|
14083
14083
|
}
|
|
14084
|
-
var extension2 = extname("x." +
|
|
14084
|
+
var extension2 = extname("x." + path11).toLowerCase().substr(1);
|
|
14085
14085
|
if (!extension2) {
|
|
14086
14086
|
return false;
|
|
14087
14087
|
}
|
|
@@ -17508,8 +17508,8 @@ var require_node2 = __commonJS({
|
|
|
17508
17508
|
}
|
|
17509
17509
|
break;
|
|
17510
17510
|
case "FILE":
|
|
17511
|
-
var
|
|
17512
|
-
stream3 = new
|
|
17511
|
+
var fs12 = require("fs");
|
|
17512
|
+
stream3 = new fs12.SyncWriteStream(fd2, { autoClose: false });
|
|
17513
17513
|
stream3._type = "fs";
|
|
17514
17514
|
break;
|
|
17515
17515
|
case "PIPE":
|
|
@@ -18227,8 +18227,8 @@ var require_node3 = __commonJS({
|
|
|
18227
18227
|
}
|
|
18228
18228
|
break;
|
|
18229
18229
|
case "FILE":
|
|
18230
|
-
var
|
|
18231
|
-
stream3 = new
|
|
18230
|
+
var fs12 = require("fs");
|
|
18231
|
+
stream3 = new fs12.SyncWriteStream(fd2, { autoClose: false });
|
|
18232
18232
|
stream3._type = "fs";
|
|
18233
18233
|
break;
|
|
18234
18234
|
case "PIPE":
|
|
@@ -18316,7 +18316,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18316
18316
|
"node_modules/path-to-regexp/index.js"(exports2, module2) {
|
|
18317
18317
|
module2.exports = pathToRegexp;
|
|
18318
18318
|
var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
|
|
18319
|
-
function pathToRegexp(
|
|
18319
|
+
function pathToRegexp(path11, keys, options) {
|
|
18320
18320
|
options = options || {};
|
|
18321
18321
|
keys = keys || [];
|
|
18322
18322
|
var strict = options.strict;
|
|
@@ -18330,8 +18330,8 @@ var require_path_to_regexp = __commonJS({
|
|
|
18330
18330
|
var pos = 0;
|
|
18331
18331
|
var backtrack = "";
|
|
18332
18332
|
var m;
|
|
18333
|
-
if (
|
|
18334
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
18333
|
+
if (path11 instanceof RegExp) {
|
|
18334
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path11.source)) {
|
|
18335
18335
|
if (m[0][0] === "\\") continue;
|
|
18336
18336
|
keys.push({
|
|
18337
18337
|
name: m[1] || name18++,
|
|
@@ -18339,18 +18339,18 @@ var require_path_to_regexp = __commonJS({
|
|
|
18339
18339
|
offset: m.index
|
|
18340
18340
|
});
|
|
18341
18341
|
}
|
|
18342
|
-
return
|
|
18342
|
+
return path11;
|
|
18343
18343
|
}
|
|
18344
|
-
if (Array.isArray(
|
|
18345
|
-
|
|
18344
|
+
if (Array.isArray(path11)) {
|
|
18345
|
+
path11 = path11.map(function(value) {
|
|
18346
18346
|
return pathToRegexp(value, keys, options).source;
|
|
18347
18347
|
});
|
|
18348
|
-
return new RegExp(
|
|
18348
|
+
return new RegExp(path11.join("|"), flags);
|
|
18349
18349
|
}
|
|
18350
|
-
if (typeof
|
|
18350
|
+
if (typeof path11 !== "string") {
|
|
18351
18351
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
18352
18352
|
}
|
|
18353
|
-
|
|
18353
|
+
path11 = path11.replace(
|
|
18354
18354
|
/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
|
|
18355
18355
|
function(match2, slash, format2, key, capture, star3, optional3, offset) {
|
|
18356
18356
|
if (match2[0] === "\\") {
|
|
@@ -18367,7 +18367,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18367
18367
|
if (slash || format2) {
|
|
18368
18368
|
backtrack = "";
|
|
18369
18369
|
} else {
|
|
18370
|
-
backtrack +=
|
|
18370
|
+
backtrack += path11.slice(pos, offset);
|
|
18371
18371
|
}
|
|
18372
18372
|
pos = offset + match2.length;
|
|
18373
18373
|
if (match2 === "*") {
|
|
@@ -18395,7 +18395,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18395
18395
|
return result;
|
|
18396
18396
|
}
|
|
18397
18397
|
);
|
|
18398
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
18398
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path11)) {
|
|
18399
18399
|
if (m[0][0] === "\\") continue;
|
|
18400
18400
|
if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
|
|
18401
18401
|
keys.splice(keysOffset + i, 0, {
|
|
@@ -18407,13 +18407,13 @@ var require_path_to_regexp = __commonJS({
|
|
|
18407
18407
|
}
|
|
18408
18408
|
i++;
|
|
18409
18409
|
}
|
|
18410
|
-
|
|
18410
|
+
path11 += strict ? "" : path11[path11.length - 1] === "/" ? "?" : "/?";
|
|
18411
18411
|
if (end) {
|
|
18412
|
-
|
|
18413
|
-
} else if (
|
|
18414
|
-
|
|
18412
|
+
path11 += "$";
|
|
18413
|
+
} else if (path11[path11.length - 1] !== "/") {
|
|
18414
|
+
path11 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
18415
18415
|
}
|
|
18416
|
-
return new RegExp("^" +
|
|
18416
|
+
return new RegExp("^" + path11, flags);
|
|
18417
18417
|
}
|
|
18418
18418
|
}
|
|
18419
18419
|
});
|
|
@@ -18426,19 +18426,19 @@ var require_layer = __commonJS({
|
|
|
18426
18426
|
var debug = require_src3()("express:router:layer");
|
|
18427
18427
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
18428
18428
|
module2.exports = Layer;
|
|
18429
|
-
function Layer(
|
|
18429
|
+
function Layer(path11, options, fn) {
|
|
18430
18430
|
if (!(this instanceof Layer)) {
|
|
18431
|
-
return new Layer(
|
|
18431
|
+
return new Layer(path11, options, fn);
|
|
18432
18432
|
}
|
|
18433
|
-
debug("new %o",
|
|
18433
|
+
debug("new %o", path11);
|
|
18434
18434
|
var opts = options || {};
|
|
18435
18435
|
this.handle = fn;
|
|
18436
18436
|
this.name = fn.name || "<anonymous>";
|
|
18437
18437
|
this.params = void 0;
|
|
18438
18438
|
this.path = void 0;
|
|
18439
|
-
this.regexp = pathRegexp(
|
|
18440
|
-
this.regexp.fast_star =
|
|
18441
|
-
this.regexp.fast_slash =
|
|
18439
|
+
this.regexp = pathRegexp(path11, this.keys = [], opts);
|
|
18440
|
+
this.regexp.fast_star = path11 === "*";
|
|
18441
|
+
this.regexp.fast_slash = path11 === "/" && opts.end === false;
|
|
18442
18442
|
}
|
|
18443
18443
|
Layer.prototype.handle_error = function handle_error(error82, req, res, next) {
|
|
18444
18444
|
var fn = this.handle;
|
|
@@ -18462,20 +18462,20 @@ var require_layer = __commonJS({
|
|
|
18462
18462
|
next(err);
|
|
18463
18463
|
}
|
|
18464
18464
|
};
|
|
18465
|
-
Layer.prototype.match = function match2(
|
|
18465
|
+
Layer.prototype.match = function match2(path11) {
|
|
18466
18466
|
var match3;
|
|
18467
|
-
if (
|
|
18467
|
+
if (path11 != null) {
|
|
18468
18468
|
if (this.regexp.fast_slash) {
|
|
18469
18469
|
this.params = {};
|
|
18470
18470
|
this.path = "";
|
|
18471
18471
|
return true;
|
|
18472
18472
|
}
|
|
18473
18473
|
if (this.regexp.fast_star) {
|
|
18474
|
-
this.params = { "0": decode_param(
|
|
18475
|
-
this.path =
|
|
18474
|
+
this.params = { "0": decode_param(path11) };
|
|
18475
|
+
this.path = path11;
|
|
18476
18476
|
return true;
|
|
18477
18477
|
}
|
|
18478
|
-
match3 = this.regexp.exec(
|
|
18478
|
+
match3 = this.regexp.exec(path11);
|
|
18479
18479
|
}
|
|
18480
18480
|
if (!match3) {
|
|
18481
18481
|
this.params = void 0;
|
|
@@ -18568,10 +18568,10 @@ var require_route = __commonJS({
|
|
|
18568
18568
|
var slice = Array.prototype.slice;
|
|
18569
18569
|
var toString = Object.prototype.toString;
|
|
18570
18570
|
module2.exports = Route;
|
|
18571
|
-
function Route(
|
|
18572
|
-
this.path =
|
|
18571
|
+
function Route(path11) {
|
|
18572
|
+
this.path = path11;
|
|
18573
18573
|
this.stack = [];
|
|
18574
|
-
debug("new %o",
|
|
18574
|
+
debug("new %o", path11);
|
|
18575
18575
|
this.methods = {};
|
|
18576
18576
|
}
|
|
18577
18577
|
Route.prototype._handles_method = function _handles_method(method) {
|
|
@@ -18783,8 +18783,8 @@ var require_router = __commonJS({
|
|
|
18783
18783
|
if (++sync2 > 100) {
|
|
18784
18784
|
return setImmediate(next, err);
|
|
18785
18785
|
}
|
|
18786
|
-
var
|
|
18787
|
-
if (
|
|
18786
|
+
var path11 = getPathname(req);
|
|
18787
|
+
if (path11 == null) {
|
|
18788
18788
|
return done(layerError);
|
|
18789
18789
|
}
|
|
18790
18790
|
var layer;
|
|
@@ -18792,7 +18792,7 @@ var require_router = __commonJS({
|
|
|
18792
18792
|
var route;
|
|
18793
18793
|
while (match2 !== true && idx < stack.length) {
|
|
18794
18794
|
layer = stack[idx++];
|
|
18795
|
-
match2 = matchLayer(layer,
|
|
18795
|
+
match2 = matchLayer(layer, path11);
|
|
18796
18796
|
route = layer.route;
|
|
18797
18797
|
if (typeof match2 !== "boolean") {
|
|
18798
18798
|
layerError = layerError || match2;
|
|
@@ -18830,18 +18830,18 @@ var require_router = __commonJS({
|
|
|
18830
18830
|
} else if (route) {
|
|
18831
18831
|
layer.handle_request(req, res, next);
|
|
18832
18832
|
} else {
|
|
18833
|
-
trim_prefix(layer, layerError, layerPath,
|
|
18833
|
+
trim_prefix(layer, layerError, layerPath, path11);
|
|
18834
18834
|
}
|
|
18835
18835
|
sync2 = 0;
|
|
18836
18836
|
});
|
|
18837
18837
|
}
|
|
18838
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
18838
|
+
function trim_prefix(layer, layerError, layerPath, path11) {
|
|
18839
18839
|
if (layerPath.length !== 0) {
|
|
18840
|
-
if (layerPath !==
|
|
18840
|
+
if (layerPath !== path11.slice(0, layerPath.length)) {
|
|
18841
18841
|
next(layerError);
|
|
18842
18842
|
return;
|
|
18843
18843
|
}
|
|
18844
|
-
var c =
|
|
18844
|
+
var c = path11[layerPath.length];
|
|
18845
18845
|
if (c && c !== "/" && c !== ".") return next(layerError);
|
|
18846
18846
|
debug("trim prefix (%s) from url %s", layerPath, req.url);
|
|
18847
18847
|
removed = layerPath;
|
|
@@ -18919,7 +18919,7 @@ var require_router = __commonJS({
|
|
|
18919
18919
|
};
|
|
18920
18920
|
proto.use = function use(fn) {
|
|
18921
18921
|
var offset = 0;
|
|
18922
|
-
var
|
|
18922
|
+
var path11 = "/";
|
|
18923
18923
|
if (typeof fn !== "function") {
|
|
18924
18924
|
var arg = fn;
|
|
18925
18925
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -18927,7 +18927,7 @@ var require_router = __commonJS({
|
|
|
18927
18927
|
}
|
|
18928
18928
|
if (typeof arg !== "function") {
|
|
18929
18929
|
offset = 1;
|
|
18930
|
-
|
|
18930
|
+
path11 = fn;
|
|
18931
18931
|
}
|
|
18932
18932
|
}
|
|
18933
18933
|
var callbacks = flatten(slice.call(arguments, offset));
|
|
@@ -18939,8 +18939,8 @@ var require_router = __commonJS({
|
|
|
18939
18939
|
if (typeof fn !== "function") {
|
|
18940
18940
|
throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
|
|
18941
18941
|
}
|
|
18942
|
-
debug("use %o %s",
|
|
18943
|
-
var layer = new Layer(
|
|
18942
|
+
debug("use %o %s", path11, fn.name || "<anonymous>");
|
|
18943
|
+
var layer = new Layer(path11, {
|
|
18944
18944
|
sensitive: this.caseSensitive,
|
|
18945
18945
|
strict: false,
|
|
18946
18946
|
end: false
|
|
@@ -18950,9 +18950,9 @@ var require_router = __commonJS({
|
|
|
18950
18950
|
}
|
|
18951
18951
|
return this;
|
|
18952
18952
|
};
|
|
18953
|
-
proto.route = function route(
|
|
18954
|
-
var route2 = new Route(
|
|
18955
|
-
var layer = new Layer(
|
|
18953
|
+
proto.route = function route(path11) {
|
|
18954
|
+
var route2 = new Route(path11);
|
|
18955
|
+
var layer = new Layer(path11, {
|
|
18956
18956
|
sensitive: this.caseSensitive,
|
|
18957
18957
|
strict: this.strict,
|
|
18958
18958
|
end: true
|
|
@@ -18962,8 +18962,8 @@ var require_router = __commonJS({
|
|
|
18962
18962
|
return route2;
|
|
18963
18963
|
};
|
|
18964
18964
|
methods.concat("all").forEach(function(method) {
|
|
18965
|
-
proto[method] = function(
|
|
18966
|
-
var route = this.route(
|
|
18965
|
+
proto[method] = function(path11) {
|
|
18966
|
+
var route = this.route(path11);
|
|
18967
18967
|
route[method].apply(route, slice.call(arguments, 1));
|
|
18968
18968
|
return this;
|
|
18969
18969
|
};
|
|
@@ -18999,9 +18999,9 @@ var require_router = __commonJS({
|
|
|
18999
18999
|
}
|
|
19000
19000
|
return toString.call(obj).replace(objectRegExp, "$1");
|
|
19001
19001
|
}
|
|
19002
|
-
function matchLayer(layer,
|
|
19002
|
+
function matchLayer(layer, path11) {
|
|
19003
19003
|
try {
|
|
19004
|
-
return layer.match(
|
|
19004
|
+
return layer.match(path11);
|
|
19005
19005
|
} catch (err) {
|
|
19006
19006
|
return err;
|
|
19007
19007
|
}
|
|
@@ -19119,13 +19119,13 @@ var require_view = __commonJS({
|
|
|
19119
19119
|
"node_modules/express/lib/view.js"(exports2, module2) {
|
|
19120
19120
|
"use strict";
|
|
19121
19121
|
var debug = require_src3()("express:view");
|
|
19122
|
-
var
|
|
19123
|
-
var
|
|
19124
|
-
var dirname2 =
|
|
19125
|
-
var
|
|
19126
|
-
var extname =
|
|
19127
|
-
var
|
|
19128
|
-
var resolve3 =
|
|
19122
|
+
var path11 = require("path");
|
|
19123
|
+
var fs12 = require("fs");
|
|
19124
|
+
var dirname2 = path11.dirname;
|
|
19125
|
+
var basename2 = path11.basename;
|
|
19126
|
+
var extname = path11.extname;
|
|
19127
|
+
var join8 = path11.join;
|
|
19128
|
+
var resolve3 = path11.resolve;
|
|
19129
19129
|
module2.exports = View;
|
|
19130
19130
|
function View(name18, options) {
|
|
19131
19131
|
var opts = options || {};
|
|
@@ -19154,17 +19154,17 @@ var require_view = __commonJS({
|
|
|
19154
19154
|
this.path = this.lookup(fileName);
|
|
19155
19155
|
}
|
|
19156
19156
|
View.prototype.lookup = function lookup(name18) {
|
|
19157
|
-
var
|
|
19157
|
+
var path12;
|
|
19158
19158
|
var roots = [].concat(this.root);
|
|
19159
19159
|
debug('lookup "%s"', name18);
|
|
19160
|
-
for (var i = 0; i < roots.length && !
|
|
19160
|
+
for (var i = 0; i < roots.length && !path12; i++) {
|
|
19161
19161
|
var root = roots[i];
|
|
19162
19162
|
var loc = resolve3(root, name18);
|
|
19163
19163
|
var dir = dirname2(loc);
|
|
19164
|
-
var file3 =
|
|
19165
|
-
|
|
19164
|
+
var file3 = basename2(loc);
|
|
19165
|
+
path12 = this.resolve(dir, file3);
|
|
19166
19166
|
}
|
|
19167
|
-
return
|
|
19167
|
+
return path12;
|
|
19168
19168
|
};
|
|
19169
19169
|
View.prototype.render = function render(options, callback) {
|
|
19170
19170
|
debug('render "%s"', this.path);
|
|
@@ -19172,21 +19172,21 @@ var require_view = __commonJS({
|
|
|
19172
19172
|
};
|
|
19173
19173
|
View.prototype.resolve = function resolve4(dir, file3) {
|
|
19174
19174
|
var ext2 = this.ext;
|
|
19175
|
-
var
|
|
19176
|
-
var
|
|
19177
|
-
if (
|
|
19178
|
-
return
|
|
19175
|
+
var path12 = join8(dir, file3);
|
|
19176
|
+
var stat4 = tryStat(path12);
|
|
19177
|
+
if (stat4 && stat4.isFile()) {
|
|
19178
|
+
return path12;
|
|
19179
19179
|
}
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
if (
|
|
19183
|
-
return
|
|
19180
|
+
path12 = join8(dir, basename2(file3, ext2), "index" + ext2);
|
|
19181
|
+
stat4 = tryStat(path12);
|
|
19182
|
+
if (stat4 && stat4.isFile()) {
|
|
19183
|
+
return path12;
|
|
19184
19184
|
}
|
|
19185
19185
|
};
|
|
19186
|
-
function tryStat(
|
|
19187
|
-
debug('stat "%s"',
|
|
19186
|
+
function tryStat(path12) {
|
|
19187
|
+
debug('stat "%s"', path12);
|
|
19188
19188
|
try {
|
|
19189
|
-
return
|
|
19189
|
+
return fs12.statSync(path12);
|
|
19190
19190
|
} catch (e) {
|
|
19191
19191
|
return void 0;
|
|
19192
19192
|
}
|
|
@@ -19258,7 +19258,7 @@ var require_content_disposition = __commonJS({
|
|
|
19258
19258
|
"use strict";
|
|
19259
19259
|
module2.exports = contentDisposition;
|
|
19260
19260
|
module2.exports.parse = parse7;
|
|
19261
|
-
var
|
|
19261
|
+
var basename2 = require("path").basename;
|
|
19262
19262
|
var Buffer2 = require_safe_buffer().Buffer;
|
|
19263
19263
|
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
|
|
19264
19264
|
var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/;
|
|
@@ -19294,9 +19294,9 @@ var require_content_disposition = __commonJS({
|
|
|
19294
19294
|
if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
|
|
19295
19295
|
throw new TypeError("fallback must be ISO-8859-1 string");
|
|
19296
19296
|
}
|
|
19297
|
-
var name18 =
|
|
19297
|
+
var name18 = basename2(filename);
|
|
19298
19298
|
var isQuotedString = TEXT_REGEXP.test(name18);
|
|
19299
|
-
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name18) :
|
|
19299
|
+
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name18) : basename2(fallback);
|
|
19300
19300
|
var hasFallback = typeof fallbackName === "string" && fallbackName !== name18;
|
|
19301
19301
|
if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name18)) {
|
|
19302
19302
|
params["filename*"] = name18;
|
|
@@ -19791,8 +19791,8 @@ var require_node4 = __commonJS({
|
|
|
19791
19791
|
}
|
|
19792
19792
|
break;
|
|
19793
19793
|
case "FILE":
|
|
19794
|
-
var
|
|
19795
|
-
stream3 = new
|
|
19794
|
+
var fs12 = require("fs");
|
|
19795
|
+
stream3 = new fs12.SyncWriteStream(fd2, { autoClose: false });
|
|
19796
19796
|
stream3._type = "fs";
|
|
19797
19797
|
break;
|
|
19798
19798
|
case "PIPE":
|
|
@@ -19887,9 +19887,9 @@ var require_etag = __commonJS({
|
|
|
19887
19887
|
}
|
|
19888
19888
|
return obj && typeof obj === "object" && "ctime" in obj && toString.call(obj.ctime) === "[object Date]" && "mtime" in obj && toString.call(obj.mtime) === "[object Date]" && "ino" in obj && typeof obj.ino === "number" && "size" in obj && typeof obj.size === "number";
|
|
19889
19889
|
}
|
|
19890
|
-
function stattag(
|
|
19891
|
-
var mtime =
|
|
19892
|
-
var size =
|
|
19890
|
+
function stattag(stat4) {
|
|
19891
|
+
var mtime = stat4.mtime.getTime().toString(16);
|
|
19892
|
+
var size = stat4.size.toString(16);
|
|
19893
19893
|
return '"' + size + "-" + mtime + '"';
|
|
19894
19894
|
}
|
|
19895
19895
|
}
|
|
@@ -19978,8 +19978,8 @@ var require_types = __commonJS({
|
|
|
19978
19978
|
// node_modules/mime/mime.js
|
|
19979
19979
|
var require_mime = __commonJS({
|
|
19980
19980
|
"node_modules/mime/mime.js"(exports2, module2) {
|
|
19981
|
-
var
|
|
19982
|
-
var
|
|
19981
|
+
var path11 = require("path");
|
|
19982
|
+
var fs12 = require("fs");
|
|
19983
19983
|
function Mime() {
|
|
19984
19984
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
19985
19985
|
this.extensions = /* @__PURE__ */ Object.create(null);
|
|
@@ -20000,7 +20000,7 @@ var require_mime = __commonJS({
|
|
|
20000
20000
|
};
|
|
20001
20001
|
Mime.prototype.load = function(file3) {
|
|
20002
20002
|
this._loading = file3;
|
|
20003
|
-
var map3 = {}, content =
|
|
20003
|
+
var map3 = {}, content = fs12.readFileSync(file3, "ascii"), lines = content.split(/[\r\n]+/);
|
|
20004
20004
|
lines.forEach(function(line) {
|
|
20005
20005
|
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
|
|
20006
20006
|
map3[fields.shift()] = fields;
|
|
@@ -20008,8 +20008,8 @@ var require_mime = __commonJS({
|
|
|
20008
20008
|
this.define(map3);
|
|
20009
20009
|
this._loading = null;
|
|
20010
20010
|
};
|
|
20011
|
-
Mime.prototype.lookup = function(
|
|
20012
|
-
var ext2 =
|
|
20011
|
+
Mime.prototype.lookup = function(path12, fallback) {
|
|
20012
|
+
var ext2 = path12.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
20013
20013
|
return this.types[ext2] || fallback || this.default_type;
|
|
20014
20014
|
};
|
|
20015
20015
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -20238,33 +20238,33 @@ var require_send = __commonJS({
|
|
|
20238
20238
|
var escapeHtml = require_escape_html();
|
|
20239
20239
|
var etag = require_etag();
|
|
20240
20240
|
var fresh = require_fresh();
|
|
20241
|
-
var
|
|
20241
|
+
var fs12 = require("fs");
|
|
20242
20242
|
var mime = require_mime();
|
|
20243
20243
|
var ms = require_ms5();
|
|
20244
20244
|
var onFinished = require_on_finished();
|
|
20245
20245
|
var parseRange = require_range_parser();
|
|
20246
|
-
var
|
|
20246
|
+
var path11 = require("path");
|
|
20247
20247
|
var statuses = require_statuses();
|
|
20248
20248
|
var Stream3 = require("stream");
|
|
20249
20249
|
var util2 = require("util");
|
|
20250
|
-
var extname =
|
|
20251
|
-
var
|
|
20252
|
-
var normalize2 =
|
|
20253
|
-
var resolve3 =
|
|
20254
|
-
var sep2 =
|
|
20250
|
+
var extname = path11.extname;
|
|
20251
|
+
var join8 = path11.join;
|
|
20252
|
+
var normalize2 = path11.normalize;
|
|
20253
|
+
var resolve3 = path11.resolve;
|
|
20254
|
+
var sep2 = path11.sep;
|
|
20255
20255
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
20256
20256
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
20257
20257
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
20258
20258
|
module2.exports = send;
|
|
20259
20259
|
module2.exports.mime = mime;
|
|
20260
|
-
function send(req,
|
|
20261
|
-
return new SendStream(req,
|
|
20260
|
+
function send(req, path12, options) {
|
|
20261
|
+
return new SendStream(req, path12, options);
|
|
20262
20262
|
}
|
|
20263
|
-
function SendStream(req,
|
|
20263
|
+
function SendStream(req, path12, options) {
|
|
20264
20264
|
Stream3.call(this);
|
|
20265
20265
|
var opts = options || {};
|
|
20266
20266
|
this.options = opts;
|
|
20267
|
-
this.path =
|
|
20267
|
+
this.path = path12;
|
|
20268
20268
|
this.req = req;
|
|
20269
20269
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
20270
20270
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -20310,8 +20310,8 @@ var require_send = __commonJS({
|
|
|
20310
20310
|
this._index = index2;
|
|
20311
20311
|
return this;
|
|
20312
20312
|
}, "send.index: pass index as option");
|
|
20313
|
-
SendStream.prototype.root = function root(
|
|
20314
|
-
this._root = resolve3(String(
|
|
20313
|
+
SendStream.prototype.root = function root(path12) {
|
|
20314
|
+
this._root = resolve3(String(path12));
|
|
20315
20315
|
debug("root %s", this._root);
|
|
20316
20316
|
return this;
|
|
20317
20317
|
};
|
|
@@ -20424,10 +20424,10 @@ var require_send = __commonJS({
|
|
|
20424
20424
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
20425
20425
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
20426
20426
|
};
|
|
20427
|
-
SendStream.prototype.redirect = function redirect(
|
|
20427
|
+
SendStream.prototype.redirect = function redirect(path12) {
|
|
20428
20428
|
var res = this.res;
|
|
20429
20429
|
if (hasListeners(this, "directory")) {
|
|
20430
|
-
this.emit("directory", res,
|
|
20430
|
+
this.emit("directory", res, path12);
|
|
20431
20431
|
return;
|
|
20432
20432
|
}
|
|
20433
20433
|
if (this.hasTrailingSlash()) {
|
|
@@ -20447,43 +20447,43 @@ var require_send = __commonJS({
|
|
|
20447
20447
|
SendStream.prototype.pipe = function pipe3(res) {
|
|
20448
20448
|
var root = this._root;
|
|
20449
20449
|
this.res = res;
|
|
20450
|
-
var
|
|
20451
|
-
if (
|
|
20450
|
+
var path12 = decode3(this.path);
|
|
20451
|
+
if (path12 === -1) {
|
|
20452
20452
|
this.error(400);
|
|
20453
20453
|
return res;
|
|
20454
20454
|
}
|
|
20455
|
-
if (~
|
|
20455
|
+
if (~path12.indexOf("\0")) {
|
|
20456
20456
|
this.error(400);
|
|
20457
20457
|
return res;
|
|
20458
20458
|
}
|
|
20459
20459
|
var parts;
|
|
20460
20460
|
if (root !== null) {
|
|
20461
|
-
if (
|
|
20462
|
-
|
|
20461
|
+
if (path12) {
|
|
20462
|
+
path12 = normalize2("." + sep2 + path12);
|
|
20463
20463
|
}
|
|
20464
|
-
if (UP_PATH_REGEXP.test(
|
|
20465
|
-
debug('malicious path "%s"',
|
|
20464
|
+
if (UP_PATH_REGEXP.test(path12)) {
|
|
20465
|
+
debug('malicious path "%s"', path12);
|
|
20466
20466
|
this.error(403);
|
|
20467
20467
|
return res;
|
|
20468
20468
|
}
|
|
20469
|
-
parts =
|
|
20470
|
-
|
|
20469
|
+
parts = path12.split(sep2);
|
|
20470
|
+
path12 = normalize2(join8(root, path12));
|
|
20471
20471
|
} else {
|
|
20472
|
-
if (UP_PATH_REGEXP.test(
|
|
20473
|
-
debug('malicious path "%s"',
|
|
20472
|
+
if (UP_PATH_REGEXP.test(path12)) {
|
|
20473
|
+
debug('malicious path "%s"', path12);
|
|
20474
20474
|
this.error(403);
|
|
20475
20475
|
return res;
|
|
20476
20476
|
}
|
|
20477
|
-
parts = normalize2(
|
|
20478
|
-
|
|
20477
|
+
parts = normalize2(path12).split(sep2);
|
|
20478
|
+
path12 = resolve3(path12);
|
|
20479
20479
|
}
|
|
20480
20480
|
if (containsDotFile(parts)) {
|
|
20481
|
-
var
|
|
20482
|
-
if (
|
|
20483
|
-
|
|
20481
|
+
var access4 = this._dotfiles;
|
|
20482
|
+
if (access4 === void 0) {
|
|
20483
|
+
access4 = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
|
|
20484
20484
|
}
|
|
20485
|
-
debug('%s dotfile "%s"',
|
|
20486
|
-
switch (
|
|
20485
|
+
debug('%s dotfile "%s"', access4, path12);
|
|
20486
|
+
switch (access4) {
|
|
20487
20487
|
case "allow":
|
|
20488
20488
|
break;
|
|
20489
20489
|
case "deny":
|
|
@@ -20496,14 +20496,14 @@ var require_send = __commonJS({
|
|
|
20496
20496
|
}
|
|
20497
20497
|
}
|
|
20498
20498
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
20499
|
-
this.sendIndex(
|
|
20499
|
+
this.sendIndex(path12);
|
|
20500
20500
|
return res;
|
|
20501
20501
|
}
|
|
20502
|
-
this.sendFile(
|
|
20502
|
+
this.sendFile(path12);
|
|
20503
20503
|
return res;
|
|
20504
20504
|
};
|
|
20505
|
-
SendStream.prototype.send = function send2(
|
|
20506
|
-
var len =
|
|
20505
|
+
SendStream.prototype.send = function send2(path12, stat4) {
|
|
20506
|
+
var len = stat4.size;
|
|
20507
20507
|
var options = this.options;
|
|
20508
20508
|
var opts = {};
|
|
20509
20509
|
var res = this.res;
|
|
@@ -20514,9 +20514,9 @@ var require_send = __commonJS({
|
|
|
20514
20514
|
this.headersAlreadySent();
|
|
20515
20515
|
return;
|
|
20516
20516
|
}
|
|
20517
|
-
debug('pipe "%s"',
|
|
20518
|
-
this.setHeader(
|
|
20519
|
-
this.type(
|
|
20517
|
+
debug('pipe "%s"', path12);
|
|
20518
|
+
this.setHeader(path12, stat4);
|
|
20519
|
+
this.type(path12);
|
|
20520
20520
|
if (this.isConditionalGET()) {
|
|
20521
20521
|
if (this.isPreconditionFailure()) {
|
|
20522
20522
|
this.error(412);
|
|
@@ -20565,36 +20565,36 @@ var require_send = __commonJS({
|
|
|
20565
20565
|
res.end();
|
|
20566
20566
|
return;
|
|
20567
20567
|
}
|
|
20568
|
-
this.stream(
|
|
20568
|
+
this.stream(path12, opts);
|
|
20569
20569
|
};
|
|
20570
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
20570
|
+
SendStream.prototype.sendFile = function sendFile(path12) {
|
|
20571
20571
|
var i = 0;
|
|
20572
20572
|
var self = this;
|
|
20573
|
-
debug('stat "%s"',
|
|
20574
|
-
|
|
20575
|
-
if (err && err.code === "ENOENT" && !extname(
|
|
20573
|
+
debug('stat "%s"', path12);
|
|
20574
|
+
fs12.stat(path12, function onstat(err, stat4) {
|
|
20575
|
+
if (err && err.code === "ENOENT" && !extname(path12) && path12[path12.length - 1] !== sep2) {
|
|
20576
20576
|
return next(err);
|
|
20577
20577
|
}
|
|
20578
20578
|
if (err) return self.onStatError(err);
|
|
20579
|
-
if (
|
|
20580
|
-
self.emit("file",
|
|
20581
|
-
self.send(
|
|
20579
|
+
if (stat4.isDirectory()) return self.redirect(path12);
|
|
20580
|
+
self.emit("file", path12, stat4);
|
|
20581
|
+
self.send(path12, stat4);
|
|
20582
20582
|
});
|
|
20583
20583
|
function next(err) {
|
|
20584
20584
|
if (self._extensions.length <= i) {
|
|
20585
20585
|
return err ? self.onStatError(err) : self.error(404);
|
|
20586
20586
|
}
|
|
20587
|
-
var p =
|
|
20587
|
+
var p = path12 + "." + self._extensions[i++];
|
|
20588
20588
|
debug('stat "%s"', p);
|
|
20589
|
-
|
|
20589
|
+
fs12.stat(p, function(err2, stat4) {
|
|
20590
20590
|
if (err2) return next(err2);
|
|
20591
|
-
if (
|
|
20592
|
-
self.emit("file", p,
|
|
20593
|
-
self.send(p,
|
|
20591
|
+
if (stat4.isDirectory()) return next();
|
|
20592
|
+
self.emit("file", p, stat4);
|
|
20593
|
+
self.send(p, stat4);
|
|
20594
20594
|
});
|
|
20595
20595
|
}
|
|
20596
20596
|
};
|
|
20597
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
20597
|
+
SendStream.prototype.sendIndex = function sendIndex(path12) {
|
|
20598
20598
|
var i = -1;
|
|
20599
20599
|
var self = this;
|
|
20600
20600
|
function next(err) {
|
|
@@ -20602,21 +20602,21 @@ var require_send = __commonJS({
|
|
|
20602
20602
|
if (err) return self.onStatError(err);
|
|
20603
20603
|
return self.error(404);
|
|
20604
20604
|
}
|
|
20605
|
-
var p =
|
|
20605
|
+
var p = join8(path12, self._index[i]);
|
|
20606
20606
|
debug('stat "%s"', p);
|
|
20607
|
-
|
|
20607
|
+
fs12.stat(p, function(err2, stat4) {
|
|
20608
20608
|
if (err2) return next(err2);
|
|
20609
|
-
if (
|
|
20610
|
-
self.emit("file", p,
|
|
20611
|
-
self.send(p,
|
|
20609
|
+
if (stat4.isDirectory()) return next();
|
|
20610
|
+
self.emit("file", p, stat4);
|
|
20611
|
+
self.send(p, stat4);
|
|
20612
20612
|
});
|
|
20613
20613
|
}
|
|
20614
20614
|
next();
|
|
20615
20615
|
};
|
|
20616
|
-
SendStream.prototype.stream = function stream2(
|
|
20616
|
+
SendStream.prototype.stream = function stream2(path12, options) {
|
|
20617
20617
|
var self = this;
|
|
20618
20618
|
var res = this.res;
|
|
20619
|
-
var stream3 =
|
|
20619
|
+
var stream3 = fs12.createReadStream(path12, options);
|
|
20620
20620
|
this.emit("stream", stream3);
|
|
20621
20621
|
stream3.pipe(res);
|
|
20622
20622
|
function cleanup() {
|
|
@@ -20631,10 +20631,10 @@ var require_send = __commonJS({
|
|
|
20631
20631
|
self.emit("end");
|
|
20632
20632
|
});
|
|
20633
20633
|
};
|
|
20634
|
-
SendStream.prototype.type = function type(
|
|
20634
|
+
SendStream.prototype.type = function type(path12) {
|
|
20635
20635
|
var res = this.res;
|
|
20636
20636
|
if (res.getHeader("Content-Type")) return;
|
|
20637
|
-
var type2 = mime.lookup(
|
|
20637
|
+
var type2 = mime.lookup(path12);
|
|
20638
20638
|
if (!type2) {
|
|
20639
20639
|
debug("no content-type");
|
|
20640
20640
|
return;
|
|
@@ -20643,9 +20643,9 @@ var require_send = __commonJS({
|
|
|
20643
20643
|
debug("content-type %s", type2);
|
|
20644
20644
|
res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
|
|
20645
20645
|
};
|
|
20646
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
20646
|
+
SendStream.prototype.setHeader = function setHeader(path12, stat4) {
|
|
20647
20647
|
var res = this.res;
|
|
20648
|
-
this.emit("headers", res,
|
|
20648
|
+
this.emit("headers", res, path12, stat4);
|
|
20649
20649
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
20650
20650
|
debug("accept ranges");
|
|
20651
20651
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -20659,12 +20659,12 @@ var require_send = __commonJS({
|
|
|
20659
20659
|
res.setHeader("Cache-Control", cacheControl);
|
|
20660
20660
|
}
|
|
20661
20661
|
if (this._lastModified && !res.getHeader("Last-Modified")) {
|
|
20662
|
-
var modified =
|
|
20662
|
+
var modified = stat4.mtime.toUTCString();
|
|
20663
20663
|
debug("modified %s", modified);
|
|
20664
20664
|
res.setHeader("Last-Modified", modified);
|
|
20665
20665
|
}
|
|
20666
20666
|
if (this._etag && !res.getHeader("ETag")) {
|
|
20667
|
-
var val = etag(
|
|
20667
|
+
var val = etag(stat4);
|
|
20668
20668
|
debug("etag %s", val);
|
|
20669
20669
|
res.setHeader("ETag", val);
|
|
20670
20670
|
}
|
|
@@ -20704,9 +20704,9 @@ var require_send = __commonJS({
|
|
|
20704
20704
|
}
|
|
20705
20705
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
20706
20706
|
}
|
|
20707
|
-
function decode3(
|
|
20707
|
+
function decode3(path12) {
|
|
20708
20708
|
try {
|
|
20709
|
-
return decodeURIComponent(
|
|
20709
|
+
return decodeURIComponent(path12);
|
|
20710
20710
|
} catch (err) {
|
|
20711
20711
|
return -1;
|
|
20712
20712
|
}
|
|
@@ -21615,10 +21615,10 @@ var require_utils2 = __commonJS({
|
|
|
21615
21615
|
var querystring = require("querystring");
|
|
21616
21616
|
exports2.etag = createETagGenerator({ weak: false });
|
|
21617
21617
|
exports2.wetag = createETagGenerator({ weak: true });
|
|
21618
|
-
exports2.isAbsolute = function(
|
|
21619
|
-
if ("/" ===
|
|
21620
|
-
if (":" ===
|
|
21621
|
-
if ("\\\\" ===
|
|
21618
|
+
exports2.isAbsolute = function(path11) {
|
|
21619
|
+
if ("/" === path11[0]) return true;
|
|
21620
|
+
if (":" === path11[1] && ("\\" === path11[2] || "/" === path11[2])) return true;
|
|
21621
|
+
if ("\\\\" === path11.substring(0, 2)) return true;
|
|
21622
21622
|
};
|
|
21623
21623
|
exports2.flatten = deprecate.function(
|
|
21624
21624
|
flatten,
|
|
@@ -21829,7 +21829,7 @@ var require_application = __commonJS({
|
|
|
21829
21829
|
};
|
|
21830
21830
|
app.use = function use(fn) {
|
|
21831
21831
|
var offset = 0;
|
|
21832
|
-
var
|
|
21832
|
+
var path11 = "/";
|
|
21833
21833
|
if (typeof fn !== "function") {
|
|
21834
21834
|
var arg = fn;
|
|
21835
21835
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -21837,7 +21837,7 @@ var require_application = __commonJS({
|
|
|
21837
21837
|
}
|
|
21838
21838
|
if (typeof arg !== "function") {
|
|
21839
21839
|
offset = 1;
|
|
21840
|
-
|
|
21840
|
+
path11 = fn;
|
|
21841
21841
|
}
|
|
21842
21842
|
}
|
|
21843
21843
|
var fns = flatten(slice.call(arguments, offset));
|
|
@@ -21848,12 +21848,12 @@ var require_application = __commonJS({
|
|
|
21848
21848
|
var router = this._router;
|
|
21849
21849
|
fns.forEach(function(fn2) {
|
|
21850
21850
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
21851
|
-
return router.use(
|
|
21851
|
+
return router.use(path11, fn2);
|
|
21852
21852
|
}
|
|
21853
|
-
debug(".use app under %s",
|
|
21854
|
-
fn2.mountpath =
|
|
21853
|
+
debug(".use app under %s", path11);
|
|
21854
|
+
fn2.mountpath = path11;
|
|
21855
21855
|
fn2.parent = this;
|
|
21856
|
-
router.use(
|
|
21856
|
+
router.use(path11, function mounted_app(req, res, next) {
|
|
21857
21857
|
var orig = req.app;
|
|
21858
21858
|
fn2.handle(req, res, function(err) {
|
|
21859
21859
|
setPrototypeOf(req, orig.request);
|
|
@@ -21865,9 +21865,9 @@ var require_application = __commonJS({
|
|
|
21865
21865
|
}, this);
|
|
21866
21866
|
return this;
|
|
21867
21867
|
};
|
|
21868
|
-
app.route = function route(
|
|
21868
|
+
app.route = function route(path11) {
|
|
21869
21869
|
this.lazyrouter();
|
|
21870
|
-
return this._router.route(
|
|
21870
|
+
return this._router.route(path11);
|
|
21871
21871
|
};
|
|
21872
21872
|
app.engine = function engine(ext2, fn) {
|
|
21873
21873
|
if (typeof fn !== "function") {
|
|
@@ -21918,7 +21918,7 @@ var require_application = __commonJS({
|
|
|
21918
21918
|
}
|
|
21919
21919
|
return this;
|
|
21920
21920
|
};
|
|
21921
|
-
app.path = function
|
|
21921
|
+
app.path = function path11() {
|
|
21922
21922
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
21923
21923
|
};
|
|
21924
21924
|
app.enabled = function enabled(setting) {
|
|
@@ -21934,19 +21934,19 @@ var require_application = __commonJS({
|
|
|
21934
21934
|
return this.set(setting, false);
|
|
21935
21935
|
};
|
|
21936
21936
|
methods.forEach(function(method) {
|
|
21937
|
-
app[method] = function(
|
|
21937
|
+
app[method] = function(path11) {
|
|
21938
21938
|
if (method === "get" && arguments.length === 1) {
|
|
21939
|
-
return this.set(
|
|
21939
|
+
return this.set(path11);
|
|
21940
21940
|
}
|
|
21941
21941
|
this.lazyrouter();
|
|
21942
|
-
var route = this._router.route(
|
|
21942
|
+
var route = this._router.route(path11);
|
|
21943
21943
|
route[method].apply(route, slice.call(arguments, 1));
|
|
21944
21944
|
return this;
|
|
21945
21945
|
};
|
|
21946
21946
|
});
|
|
21947
|
-
app.all = function all(
|
|
21947
|
+
app.all = function all(path11) {
|
|
21948
21948
|
this.lazyrouter();
|
|
21949
|
-
var route = this._router.route(
|
|
21949
|
+
var route = this._router.route(path11);
|
|
21950
21950
|
var args = slice.call(arguments, 1);
|
|
21951
21951
|
for (var i = 0; i < methods.length; i++) {
|
|
21952
21952
|
route[methods[i]].apply(route, args);
|
|
@@ -22705,7 +22705,7 @@ var require_request = __commonJS({
|
|
|
22705
22705
|
var subdomains2 = !isIP(hostname4) ? hostname4.split(".").reverse() : [hostname4];
|
|
22706
22706
|
return subdomains2.slice(offset);
|
|
22707
22707
|
});
|
|
22708
|
-
defineGetter(req, "path", function
|
|
22708
|
+
defineGetter(req, "path", function path11() {
|
|
22709
22709
|
return parse7(this).pathname;
|
|
22710
22710
|
});
|
|
22711
22711
|
defineGetter(req, "hostname", function hostname4() {
|
|
@@ -23026,7 +23026,7 @@ var require_response = __commonJS({
|
|
|
23026
23026
|
var http = require("http");
|
|
23027
23027
|
var isAbsolute = require_utils2().isAbsolute;
|
|
23028
23028
|
var onFinished = require_on_finished();
|
|
23029
|
-
var
|
|
23029
|
+
var path11 = require("path");
|
|
23030
23030
|
var statuses = require_statuses();
|
|
23031
23031
|
var merge3 = require_utils_merge();
|
|
23032
23032
|
var sign = require_cookie_signature().sign;
|
|
@@ -23035,9 +23035,9 @@ var require_response = __commonJS({
|
|
|
23035
23035
|
var setCharset = require_utils2().setCharset;
|
|
23036
23036
|
var cookie = require_cookie();
|
|
23037
23037
|
var send = require_send();
|
|
23038
|
-
var extname =
|
|
23038
|
+
var extname = path11.extname;
|
|
23039
23039
|
var mime = send.mime;
|
|
23040
|
-
var resolve3 =
|
|
23040
|
+
var resolve3 = path11.resolve;
|
|
23041
23041
|
var vary = require_vary();
|
|
23042
23042
|
var res = Object.create(http.ServerResponse.prototype);
|
|
23043
23043
|
module2.exports = res;
|
|
@@ -23214,26 +23214,26 @@ var require_response = __commonJS({
|
|
|
23214
23214
|
this.type("txt");
|
|
23215
23215
|
return this.send(body);
|
|
23216
23216
|
};
|
|
23217
|
-
res.sendFile = function sendFile(
|
|
23217
|
+
res.sendFile = function sendFile(path12, options, callback) {
|
|
23218
23218
|
var done = callback;
|
|
23219
23219
|
var req = this.req;
|
|
23220
23220
|
var res2 = this;
|
|
23221
23221
|
var next = req.next;
|
|
23222
23222
|
var opts = options || {};
|
|
23223
|
-
if (!
|
|
23223
|
+
if (!path12) {
|
|
23224
23224
|
throw new TypeError("path argument is required to res.sendFile");
|
|
23225
23225
|
}
|
|
23226
|
-
if (typeof
|
|
23226
|
+
if (typeof path12 !== "string") {
|
|
23227
23227
|
throw new TypeError("path must be a string to res.sendFile");
|
|
23228
23228
|
}
|
|
23229
23229
|
if (typeof options === "function") {
|
|
23230
23230
|
done = options;
|
|
23231
23231
|
opts = {};
|
|
23232
23232
|
}
|
|
23233
|
-
if (!opts.root && !isAbsolute(
|
|
23233
|
+
if (!opts.root && !isAbsolute(path12)) {
|
|
23234
23234
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
23235
23235
|
}
|
|
23236
|
-
var pathname = encodeURI(
|
|
23236
|
+
var pathname = encodeURI(path12);
|
|
23237
23237
|
var file3 = send(req, pathname, opts);
|
|
23238
23238
|
sendfile(res2, file3, opts, function(err) {
|
|
23239
23239
|
if (done) return done(err);
|
|
@@ -23243,7 +23243,7 @@ var require_response = __commonJS({
|
|
|
23243
23243
|
}
|
|
23244
23244
|
});
|
|
23245
23245
|
};
|
|
23246
|
-
res.sendfile = function(
|
|
23246
|
+
res.sendfile = function(path12, options, callback) {
|
|
23247
23247
|
var done = callback;
|
|
23248
23248
|
var req = this.req;
|
|
23249
23249
|
var res2 = this;
|
|
@@ -23253,7 +23253,7 @@ var require_response = __commonJS({
|
|
|
23253
23253
|
done = options;
|
|
23254
23254
|
opts = {};
|
|
23255
23255
|
}
|
|
23256
|
-
var file3 = send(req,
|
|
23256
|
+
var file3 = send(req, path12, opts);
|
|
23257
23257
|
sendfile(res2, file3, opts, function(err) {
|
|
23258
23258
|
if (done) return done(err);
|
|
23259
23259
|
if (err && err.code === "EISDIR") return next();
|
|
@@ -23266,7 +23266,7 @@ var require_response = __commonJS({
|
|
|
23266
23266
|
res.sendfile,
|
|
23267
23267
|
"res.sendfile: Use res.sendFile instead"
|
|
23268
23268
|
);
|
|
23269
|
-
res.download = function download2(
|
|
23269
|
+
res.download = function download2(path12, filename, options, callback) {
|
|
23270
23270
|
var done = callback;
|
|
23271
23271
|
var name18 = filename;
|
|
23272
23272
|
var opts = options || null;
|
|
@@ -23283,7 +23283,7 @@ var require_response = __commonJS({
|
|
|
23283
23283
|
opts = filename;
|
|
23284
23284
|
}
|
|
23285
23285
|
var headers = {
|
|
23286
|
-
"Content-Disposition": contentDisposition(name18 ||
|
|
23286
|
+
"Content-Disposition": contentDisposition(name18 || path12)
|
|
23287
23287
|
};
|
|
23288
23288
|
if (opts && opts.headers) {
|
|
23289
23289
|
var keys = Object.keys(opts.headers);
|
|
@@ -23296,7 +23296,7 @@ var require_response = __commonJS({
|
|
|
23296
23296
|
}
|
|
23297
23297
|
opts = Object.create(opts);
|
|
23298
23298
|
opts.headers = headers;
|
|
23299
|
-
var fullPath = !opts.root ? resolve3(
|
|
23299
|
+
var fullPath = !opts.root ? resolve3(path12) : path12;
|
|
23300
23300
|
return this.sendFile(fullPath, opts, done);
|
|
23301
23301
|
};
|
|
23302
23302
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -23597,11 +23597,11 @@ var require_serve_static = __commonJS({
|
|
|
23597
23597
|
}
|
|
23598
23598
|
var forwardError = !fallthrough;
|
|
23599
23599
|
var originalUrl = parseUrl.original(req);
|
|
23600
|
-
var
|
|
23601
|
-
if (
|
|
23602
|
-
|
|
23600
|
+
var path11 = parseUrl(req).pathname;
|
|
23601
|
+
if (path11 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
23602
|
+
path11 = "";
|
|
23603
23603
|
}
|
|
23604
|
-
var stream2 = send(req,
|
|
23604
|
+
var stream2 = send(req, path11, opts);
|
|
23605
23605
|
stream2.on("directory", onDirectory);
|
|
23606
23606
|
if (setHeaders) {
|
|
23607
23607
|
stream2.on("headers", setHeaders);
|
|
@@ -24094,8 +24094,8 @@ var require_global_utils = __commonJS({
|
|
|
24094
24094
|
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`);
|
|
24095
24095
|
var _global = platform_1._globalThis;
|
|
24096
24096
|
function registerGlobal(type, instance, diag, allowOverride = false) {
|
|
24097
|
-
var
|
|
24098
|
-
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (
|
|
24097
|
+
var _a18;
|
|
24098
|
+
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a18 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a18 !== void 0 ? _a18 : {
|
|
24099
24099
|
version: version_1.VERSION
|
|
24100
24100
|
};
|
|
24101
24101
|
if (!allowOverride && api[type]) {
|
|
@@ -24114,8 +24114,8 @@ var require_global_utils = __commonJS({
|
|
|
24114
24114
|
}
|
|
24115
24115
|
exports2.registerGlobal = registerGlobal;
|
|
24116
24116
|
function getGlobal(type) {
|
|
24117
|
-
var
|
|
24118
|
-
const globalVersion = (
|
|
24117
|
+
var _a18, _b8;
|
|
24118
|
+
const globalVersion = (_a18 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a18 === void 0 ? void 0 : _a18.version;
|
|
24119
24119
|
if (!globalVersion || !(0, semver_1.isCompatible)(globalVersion)) {
|
|
24120
24120
|
return;
|
|
24121
24121
|
}
|
|
@@ -24252,10 +24252,10 @@ var require_diag = __commonJS({
|
|
|
24252
24252
|
}
|
|
24253
24253
|
const self = this;
|
|
24254
24254
|
const setLogger = (logger, optionsOrLogLevel = { logLevel: types_1.DiagLogLevel.INFO }) => {
|
|
24255
|
-
var
|
|
24255
|
+
var _a18, _b8, _c;
|
|
24256
24256
|
if (logger === self) {
|
|
24257
24257
|
const err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
24258
|
-
self.error((
|
|
24258
|
+
self.error((_a18 = err.stack) !== null && _a18 !== void 0 ? _a18 : err.message);
|
|
24259
24259
|
return false;
|
|
24260
24260
|
}
|
|
24261
24261
|
if (typeof optionsOrLogLevel === "number") {
|
|
@@ -24832,8 +24832,8 @@ var require_context_utils = __commonJS({
|
|
|
24832
24832
|
}
|
|
24833
24833
|
exports2.setSpanContext = setSpanContext;
|
|
24834
24834
|
function getSpanContext(context) {
|
|
24835
|
-
var
|
|
24836
|
-
return (
|
|
24835
|
+
var _a18;
|
|
24836
|
+
return (_a18 = getSpan(context)) === null || _a18 === void 0 ? void 0 : _a18.spanContext();
|
|
24837
24837
|
}
|
|
24838
24838
|
exports2.getSpanContext = getSpanContext;
|
|
24839
24839
|
}
|
|
@@ -24994,12 +24994,12 @@ var require_ProxyTracerProvider = __commonJS({
|
|
|
24994
24994
|
* Get a {@link ProxyTracer}
|
|
24995
24995
|
*/
|
|
24996
24996
|
getTracer(name18, version3, options) {
|
|
24997
|
-
var
|
|
24998
|
-
return (
|
|
24997
|
+
var _a18;
|
|
24998
|
+
return (_a18 = this.getDelegateTracer(name18, version3, options)) !== null && _a18 !== void 0 ? _a18 : new ProxyTracer_1.ProxyTracer(this, name18, version3, options);
|
|
24999
24999
|
}
|
|
25000
25000
|
getDelegate() {
|
|
25001
|
-
var
|
|
25002
|
-
return (
|
|
25001
|
+
var _a18;
|
|
25002
|
+
return (_a18 = this._delegate) !== null && _a18 !== void 0 ? _a18 : NOOP_TRACER_PROVIDER;
|
|
25003
25003
|
}
|
|
25004
25004
|
/**
|
|
25005
25005
|
* Set the delegate tracer provider
|
|
@@ -25008,8 +25008,8 @@ var require_ProxyTracerProvider = __commonJS({
|
|
|
25008
25008
|
this._delegate = delegate;
|
|
25009
25009
|
}
|
|
25010
25010
|
getDelegateTracer(name18, version3, options) {
|
|
25011
|
-
var
|
|
25012
|
-
return (
|
|
25011
|
+
var _a18;
|
|
25012
|
+
return (_a18 = this._delegate) === null || _a18 === void 0 ? void 0 : _a18.getTracer(name18, version3, options);
|
|
25013
25013
|
}
|
|
25014
25014
|
};
|
|
25015
25015
|
exports2.ProxyTracerProvider = ProxyTracerProvider;
|
|
@@ -25603,6 +25603,847 @@ var require_src5 = __commonJS({
|
|
|
25603
25603
|
}
|
|
25604
25604
|
});
|
|
25605
25605
|
|
|
25606
|
+
// node_modules/delayed-stream/lib/delayed_stream.js
|
|
25607
|
+
var require_delayed_stream = __commonJS({
|
|
25608
|
+
"node_modules/delayed-stream/lib/delayed_stream.js"(exports2, module2) {
|
|
25609
|
+
var Stream3 = require("stream").Stream;
|
|
25610
|
+
var util2 = require("util");
|
|
25611
|
+
module2.exports = DelayedStream;
|
|
25612
|
+
function DelayedStream() {
|
|
25613
|
+
this.source = null;
|
|
25614
|
+
this.dataSize = 0;
|
|
25615
|
+
this.maxDataSize = 1024 * 1024;
|
|
25616
|
+
this.pauseStream = true;
|
|
25617
|
+
this._maxDataSizeExceeded = false;
|
|
25618
|
+
this._released = false;
|
|
25619
|
+
this._bufferedEvents = [];
|
|
25620
|
+
}
|
|
25621
|
+
util2.inherits(DelayedStream, Stream3);
|
|
25622
|
+
DelayedStream.create = function(source, options) {
|
|
25623
|
+
var delayedStream = new this();
|
|
25624
|
+
options = options || {};
|
|
25625
|
+
for (var option in options) {
|
|
25626
|
+
delayedStream[option] = options[option];
|
|
25627
|
+
}
|
|
25628
|
+
delayedStream.source = source;
|
|
25629
|
+
var realEmit = source.emit;
|
|
25630
|
+
source.emit = function() {
|
|
25631
|
+
delayedStream._handleEmit(arguments);
|
|
25632
|
+
return realEmit.apply(source, arguments);
|
|
25633
|
+
};
|
|
25634
|
+
source.on("error", function() {
|
|
25635
|
+
});
|
|
25636
|
+
if (delayedStream.pauseStream) {
|
|
25637
|
+
source.pause();
|
|
25638
|
+
}
|
|
25639
|
+
return delayedStream;
|
|
25640
|
+
};
|
|
25641
|
+
Object.defineProperty(DelayedStream.prototype, "readable", {
|
|
25642
|
+
configurable: true,
|
|
25643
|
+
enumerable: true,
|
|
25644
|
+
get: function() {
|
|
25645
|
+
return this.source.readable;
|
|
25646
|
+
}
|
|
25647
|
+
});
|
|
25648
|
+
DelayedStream.prototype.setEncoding = function() {
|
|
25649
|
+
return this.source.setEncoding.apply(this.source, arguments);
|
|
25650
|
+
};
|
|
25651
|
+
DelayedStream.prototype.resume = function() {
|
|
25652
|
+
if (!this._released) {
|
|
25653
|
+
this.release();
|
|
25654
|
+
}
|
|
25655
|
+
this.source.resume();
|
|
25656
|
+
};
|
|
25657
|
+
DelayedStream.prototype.pause = function() {
|
|
25658
|
+
this.source.pause();
|
|
25659
|
+
};
|
|
25660
|
+
DelayedStream.prototype.release = function() {
|
|
25661
|
+
this._released = true;
|
|
25662
|
+
this._bufferedEvents.forEach(function(args) {
|
|
25663
|
+
this.emit.apply(this, args);
|
|
25664
|
+
}.bind(this));
|
|
25665
|
+
this._bufferedEvents = [];
|
|
25666
|
+
};
|
|
25667
|
+
DelayedStream.prototype.pipe = function() {
|
|
25668
|
+
var r = Stream3.prototype.pipe.apply(this, arguments);
|
|
25669
|
+
this.resume();
|
|
25670
|
+
return r;
|
|
25671
|
+
};
|
|
25672
|
+
DelayedStream.prototype._handleEmit = function(args) {
|
|
25673
|
+
if (this._released) {
|
|
25674
|
+
this.emit.apply(this, args);
|
|
25675
|
+
return;
|
|
25676
|
+
}
|
|
25677
|
+
if (args[0] === "data") {
|
|
25678
|
+
this.dataSize += args[1].length;
|
|
25679
|
+
this._checkIfMaxDataSizeExceeded();
|
|
25680
|
+
}
|
|
25681
|
+
this._bufferedEvents.push(args);
|
|
25682
|
+
};
|
|
25683
|
+
DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
|
|
25684
|
+
if (this._maxDataSizeExceeded) {
|
|
25685
|
+
return;
|
|
25686
|
+
}
|
|
25687
|
+
if (this.dataSize <= this.maxDataSize) {
|
|
25688
|
+
return;
|
|
25689
|
+
}
|
|
25690
|
+
this._maxDataSizeExceeded = true;
|
|
25691
|
+
var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded.";
|
|
25692
|
+
this.emit("error", new Error(message));
|
|
25693
|
+
};
|
|
25694
|
+
}
|
|
25695
|
+
});
|
|
25696
|
+
|
|
25697
|
+
// node_modules/combined-stream/lib/combined_stream.js
|
|
25698
|
+
var require_combined_stream = __commonJS({
|
|
25699
|
+
"node_modules/combined-stream/lib/combined_stream.js"(exports2, module2) {
|
|
25700
|
+
var util2 = require("util");
|
|
25701
|
+
var Stream3 = require("stream").Stream;
|
|
25702
|
+
var DelayedStream = require_delayed_stream();
|
|
25703
|
+
module2.exports = CombinedStream;
|
|
25704
|
+
function CombinedStream() {
|
|
25705
|
+
this.writable = false;
|
|
25706
|
+
this.readable = true;
|
|
25707
|
+
this.dataSize = 0;
|
|
25708
|
+
this.maxDataSize = 2 * 1024 * 1024;
|
|
25709
|
+
this.pauseStreams = true;
|
|
25710
|
+
this._released = false;
|
|
25711
|
+
this._streams = [];
|
|
25712
|
+
this._currentStream = null;
|
|
25713
|
+
this._insideLoop = false;
|
|
25714
|
+
this._pendingNext = false;
|
|
25715
|
+
}
|
|
25716
|
+
util2.inherits(CombinedStream, Stream3);
|
|
25717
|
+
CombinedStream.create = function(options) {
|
|
25718
|
+
var combinedStream = new this();
|
|
25719
|
+
options = options || {};
|
|
25720
|
+
for (var option in options) {
|
|
25721
|
+
combinedStream[option] = options[option];
|
|
25722
|
+
}
|
|
25723
|
+
return combinedStream;
|
|
25724
|
+
};
|
|
25725
|
+
CombinedStream.isStreamLike = function(stream2) {
|
|
25726
|
+
return typeof stream2 !== "function" && typeof stream2 !== "string" && typeof stream2 !== "boolean" && typeof stream2 !== "number" && !Buffer.isBuffer(stream2);
|
|
25727
|
+
};
|
|
25728
|
+
CombinedStream.prototype.append = function(stream2) {
|
|
25729
|
+
var isStreamLike = CombinedStream.isStreamLike(stream2);
|
|
25730
|
+
if (isStreamLike) {
|
|
25731
|
+
if (!(stream2 instanceof DelayedStream)) {
|
|
25732
|
+
var newStream = DelayedStream.create(stream2, {
|
|
25733
|
+
maxDataSize: Infinity,
|
|
25734
|
+
pauseStream: this.pauseStreams
|
|
25735
|
+
});
|
|
25736
|
+
stream2.on("data", this._checkDataSize.bind(this));
|
|
25737
|
+
stream2 = newStream;
|
|
25738
|
+
}
|
|
25739
|
+
this._handleErrors(stream2);
|
|
25740
|
+
if (this.pauseStreams) {
|
|
25741
|
+
stream2.pause();
|
|
25742
|
+
}
|
|
25743
|
+
}
|
|
25744
|
+
this._streams.push(stream2);
|
|
25745
|
+
return this;
|
|
25746
|
+
};
|
|
25747
|
+
CombinedStream.prototype.pipe = function(dest, options) {
|
|
25748
|
+
Stream3.prototype.pipe.call(this, dest, options);
|
|
25749
|
+
this.resume();
|
|
25750
|
+
return dest;
|
|
25751
|
+
};
|
|
25752
|
+
CombinedStream.prototype._getNext = function() {
|
|
25753
|
+
this._currentStream = null;
|
|
25754
|
+
if (this._insideLoop) {
|
|
25755
|
+
this._pendingNext = true;
|
|
25756
|
+
return;
|
|
25757
|
+
}
|
|
25758
|
+
this._insideLoop = true;
|
|
25759
|
+
try {
|
|
25760
|
+
do {
|
|
25761
|
+
this._pendingNext = false;
|
|
25762
|
+
this._realGetNext();
|
|
25763
|
+
} while (this._pendingNext);
|
|
25764
|
+
} finally {
|
|
25765
|
+
this._insideLoop = false;
|
|
25766
|
+
}
|
|
25767
|
+
};
|
|
25768
|
+
CombinedStream.prototype._realGetNext = function() {
|
|
25769
|
+
var stream2 = this._streams.shift();
|
|
25770
|
+
if (typeof stream2 == "undefined") {
|
|
25771
|
+
this.end();
|
|
25772
|
+
return;
|
|
25773
|
+
}
|
|
25774
|
+
if (typeof stream2 !== "function") {
|
|
25775
|
+
this._pipeNext(stream2);
|
|
25776
|
+
return;
|
|
25777
|
+
}
|
|
25778
|
+
var getStream = stream2;
|
|
25779
|
+
getStream(function(stream3) {
|
|
25780
|
+
var isStreamLike = CombinedStream.isStreamLike(stream3);
|
|
25781
|
+
if (isStreamLike) {
|
|
25782
|
+
stream3.on("data", this._checkDataSize.bind(this));
|
|
25783
|
+
this._handleErrors(stream3);
|
|
25784
|
+
}
|
|
25785
|
+
this._pipeNext(stream3);
|
|
25786
|
+
}.bind(this));
|
|
25787
|
+
};
|
|
25788
|
+
CombinedStream.prototype._pipeNext = function(stream2) {
|
|
25789
|
+
this._currentStream = stream2;
|
|
25790
|
+
var isStreamLike = CombinedStream.isStreamLike(stream2);
|
|
25791
|
+
if (isStreamLike) {
|
|
25792
|
+
stream2.on("end", this._getNext.bind(this));
|
|
25793
|
+
stream2.pipe(this, { end: false });
|
|
25794
|
+
return;
|
|
25795
|
+
}
|
|
25796
|
+
var value = stream2;
|
|
25797
|
+
this.write(value);
|
|
25798
|
+
this._getNext();
|
|
25799
|
+
};
|
|
25800
|
+
CombinedStream.prototype._handleErrors = function(stream2) {
|
|
25801
|
+
var self = this;
|
|
25802
|
+
stream2.on("error", function(err) {
|
|
25803
|
+
self._emitError(err);
|
|
25804
|
+
});
|
|
25805
|
+
};
|
|
25806
|
+
CombinedStream.prototype.write = function(data) {
|
|
25807
|
+
this.emit("data", data);
|
|
25808
|
+
};
|
|
25809
|
+
CombinedStream.prototype.pause = function() {
|
|
25810
|
+
if (!this.pauseStreams) {
|
|
25811
|
+
return;
|
|
25812
|
+
}
|
|
25813
|
+
if (this.pauseStreams && this._currentStream && typeof this._currentStream.pause == "function") this._currentStream.pause();
|
|
25814
|
+
this.emit("pause");
|
|
25815
|
+
};
|
|
25816
|
+
CombinedStream.prototype.resume = function() {
|
|
25817
|
+
if (!this._released) {
|
|
25818
|
+
this._released = true;
|
|
25819
|
+
this.writable = true;
|
|
25820
|
+
this._getNext();
|
|
25821
|
+
}
|
|
25822
|
+
if (this.pauseStreams && this._currentStream && typeof this._currentStream.resume == "function") this._currentStream.resume();
|
|
25823
|
+
this.emit("resume");
|
|
25824
|
+
};
|
|
25825
|
+
CombinedStream.prototype.end = function() {
|
|
25826
|
+
this._reset();
|
|
25827
|
+
this.emit("end");
|
|
25828
|
+
};
|
|
25829
|
+
CombinedStream.prototype.destroy = function() {
|
|
25830
|
+
this._reset();
|
|
25831
|
+
this.emit("close");
|
|
25832
|
+
};
|
|
25833
|
+
CombinedStream.prototype._reset = function() {
|
|
25834
|
+
this.writable = false;
|
|
25835
|
+
this._streams = [];
|
|
25836
|
+
this._currentStream = null;
|
|
25837
|
+
};
|
|
25838
|
+
CombinedStream.prototype._checkDataSize = function() {
|
|
25839
|
+
this._updateDataSize();
|
|
25840
|
+
if (this.dataSize <= this.maxDataSize) {
|
|
25841
|
+
return;
|
|
25842
|
+
}
|
|
25843
|
+
var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded.";
|
|
25844
|
+
this._emitError(new Error(message));
|
|
25845
|
+
};
|
|
25846
|
+
CombinedStream.prototype._updateDataSize = function() {
|
|
25847
|
+
this.dataSize = 0;
|
|
25848
|
+
var self = this;
|
|
25849
|
+
this._streams.forEach(function(stream2) {
|
|
25850
|
+
if (!stream2.dataSize) {
|
|
25851
|
+
return;
|
|
25852
|
+
}
|
|
25853
|
+
self.dataSize += stream2.dataSize;
|
|
25854
|
+
});
|
|
25855
|
+
if (this._currentStream && this._currentStream.dataSize) {
|
|
25856
|
+
this.dataSize += this._currentStream.dataSize;
|
|
25857
|
+
}
|
|
25858
|
+
};
|
|
25859
|
+
CombinedStream.prototype._emitError = function(err) {
|
|
25860
|
+
this._reset();
|
|
25861
|
+
this.emit("error", err);
|
|
25862
|
+
};
|
|
25863
|
+
}
|
|
25864
|
+
});
|
|
25865
|
+
|
|
25866
|
+
// node_modules/asynckit/lib/defer.js
|
|
25867
|
+
var require_defer = __commonJS({
|
|
25868
|
+
"node_modules/asynckit/lib/defer.js"(exports2, module2) {
|
|
25869
|
+
module2.exports = defer2;
|
|
25870
|
+
function defer2(fn) {
|
|
25871
|
+
var nextTick = typeof setImmediate == "function" ? setImmediate : typeof process == "object" && typeof process.nextTick == "function" ? process.nextTick : null;
|
|
25872
|
+
if (nextTick) {
|
|
25873
|
+
nextTick(fn);
|
|
25874
|
+
} else {
|
|
25875
|
+
setTimeout(fn, 0);
|
|
25876
|
+
}
|
|
25877
|
+
}
|
|
25878
|
+
}
|
|
25879
|
+
});
|
|
25880
|
+
|
|
25881
|
+
// node_modules/asynckit/lib/async.js
|
|
25882
|
+
var require_async = __commonJS({
|
|
25883
|
+
"node_modules/asynckit/lib/async.js"(exports2, module2) {
|
|
25884
|
+
var defer2 = require_defer();
|
|
25885
|
+
module2.exports = async;
|
|
25886
|
+
function async(callback) {
|
|
25887
|
+
var isAsync2 = false;
|
|
25888
|
+
defer2(function() {
|
|
25889
|
+
isAsync2 = true;
|
|
25890
|
+
});
|
|
25891
|
+
return function async_callback(err, result) {
|
|
25892
|
+
if (isAsync2) {
|
|
25893
|
+
callback(err, result);
|
|
25894
|
+
} else {
|
|
25895
|
+
defer2(function nextTick_callback() {
|
|
25896
|
+
callback(err, result);
|
|
25897
|
+
});
|
|
25898
|
+
}
|
|
25899
|
+
};
|
|
25900
|
+
}
|
|
25901
|
+
}
|
|
25902
|
+
});
|
|
25903
|
+
|
|
25904
|
+
// node_modules/asynckit/lib/abort.js
|
|
25905
|
+
var require_abort = __commonJS({
|
|
25906
|
+
"node_modules/asynckit/lib/abort.js"(exports2, module2) {
|
|
25907
|
+
module2.exports = abort;
|
|
25908
|
+
function abort(state) {
|
|
25909
|
+
Object.keys(state.jobs).forEach(clean.bind(state));
|
|
25910
|
+
state.jobs = {};
|
|
25911
|
+
}
|
|
25912
|
+
function clean(key) {
|
|
25913
|
+
if (typeof this.jobs[key] == "function") {
|
|
25914
|
+
this.jobs[key]();
|
|
25915
|
+
}
|
|
25916
|
+
}
|
|
25917
|
+
}
|
|
25918
|
+
});
|
|
25919
|
+
|
|
25920
|
+
// node_modules/asynckit/lib/iterate.js
|
|
25921
|
+
var require_iterate = __commonJS({
|
|
25922
|
+
"node_modules/asynckit/lib/iterate.js"(exports2, module2) {
|
|
25923
|
+
var async = require_async();
|
|
25924
|
+
var abort = require_abort();
|
|
25925
|
+
module2.exports = iterate2;
|
|
25926
|
+
function iterate2(list, iterator, state, callback) {
|
|
25927
|
+
var key = state["keyedList"] ? state["keyedList"][state.index] : state.index;
|
|
25928
|
+
state.jobs[key] = runJob(iterator, key, list[key], function(error82, output) {
|
|
25929
|
+
if (!(key in state.jobs)) {
|
|
25930
|
+
return;
|
|
25931
|
+
}
|
|
25932
|
+
delete state.jobs[key];
|
|
25933
|
+
if (error82) {
|
|
25934
|
+
abort(state);
|
|
25935
|
+
} else {
|
|
25936
|
+
state.results[key] = output;
|
|
25937
|
+
}
|
|
25938
|
+
callback(error82, state.results);
|
|
25939
|
+
});
|
|
25940
|
+
}
|
|
25941
|
+
function runJob(iterator, key, item, callback) {
|
|
25942
|
+
var aborter;
|
|
25943
|
+
if (iterator.length == 2) {
|
|
25944
|
+
aborter = iterator(item, async(callback));
|
|
25945
|
+
} else {
|
|
25946
|
+
aborter = iterator(item, key, async(callback));
|
|
25947
|
+
}
|
|
25948
|
+
return aborter;
|
|
25949
|
+
}
|
|
25950
|
+
}
|
|
25951
|
+
});
|
|
25952
|
+
|
|
25953
|
+
// node_modules/asynckit/lib/state.js
|
|
25954
|
+
var require_state = __commonJS({
|
|
25955
|
+
"node_modules/asynckit/lib/state.js"(exports2, module2) {
|
|
25956
|
+
module2.exports = state;
|
|
25957
|
+
function state(list, sortMethod) {
|
|
25958
|
+
var isNamedList = !Array.isArray(list), initState = {
|
|
25959
|
+
index: 0,
|
|
25960
|
+
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
|
|
25961
|
+
jobs: {},
|
|
25962
|
+
results: isNamedList ? {} : [],
|
|
25963
|
+
size: isNamedList ? Object.keys(list).length : list.length
|
|
25964
|
+
};
|
|
25965
|
+
if (sortMethod) {
|
|
25966
|
+
initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) {
|
|
25967
|
+
return sortMethod(list[a], list[b]);
|
|
25968
|
+
});
|
|
25969
|
+
}
|
|
25970
|
+
return initState;
|
|
25971
|
+
}
|
|
25972
|
+
}
|
|
25973
|
+
});
|
|
25974
|
+
|
|
25975
|
+
// node_modules/asynckit/lib/terminator.js
|
|
25976
|
+
var require_terminator = __commonJS({
|
|
25977
|
+
"node_modules/asynckit/lib/terminator.js"(exports2, module2) {
|
|
25978
|
+
var abort = require_abort();
|
|
25979
|
+
var async = require_async();
|
|
25980
|
+
module2.exports = terminator;
|
|
25981
|
+
function terminator(callback) {
|
|
25982
|
+
if (!Object.keys(this.jobs).length) {
|
|
25983
|
+
return;
|
|
25984
|
+
}
|
|
25985
|
+
this.index = this.size;
|
|
25986
|
+
abort(this);
|
|
25987
|
+
async(callback)(null, this.results);
|
|
25988
|
+
}
|
|
25989
|
+
}
|
|
25990
|
+
});
|
|
25991
|
+
|
|
25992
|
+
// node_modules/asynckit/parallel.js
|
|
25993
|
+
var require_parallel = __commonJS({
|
|
25994
|
+
"node_modules/asynckit/parallel.js"(exports2, module2) {
|
|
25995
|
+
var iterate2 = require_iterate();
|
|
25996
|
+
var initState = require_state();
|
|
25997
|
+
var terminator = require_terminator();
|
|
25998
|
+
module2.exports = parallel;
|
|
25999
|
+
function parallel(list, iterator, callback) {
|
|
26000
|
+
var state = initState(list);
|
|
26001
|
+
while (state.index < (state["keyedList"] || list).length) {
|
|
26002
|
+
iterate2(list, iterator, state, function(error82, result) {
|
|
26003
|
+
if (error82) {
|
|
26004
|
+
callback(error82, result);
|
|
26005
|
+
return;
|
|
26006
|
+
}
|
|
26007
|
+
if (Object.keys(state.jobs).length === 0) {
|
|
26008
|
+
callback(null, state.results);
|
|
26009
|
+
return;
|
|
26010
|
+
}
|
|
26011
|
+
});
|
|
26012
|
+
state.index++;
|
|
26013
|
+
}
|
|
26014
|
+
return terminator.bind(state, callback);
|
|
26015
|
+
}
|
|
26016
|
+
}
|
|
26017
|
+
});
|
|
26018
|
+
|
|
26019
|
+
// node_modules/asynckit/serialOrdered.js
|
|
26020
|
+
var require_serialOrdered = __commonJS({
|
|
26021
|
+
"node_modules/asynckit/serialOrdered.js"(exports2, module2) {
|
|
26022
|
+
var iterate2 = require_iterate();
|
|
26023
|
+
var initState = require_state();
|
|
26024
|
+
var terminator = require_terminator();
|
|
26025
|
+
module2.exports = serialOrdered;
|
|
26026
|
+
module2.exports.ascending = ascending;
|
|
26027
|
+
module2.exports.descending = descending;
|
|
26028
|
+
function serialOrdered(list, iterator, sortMethod, callback) {
|
|
26029
|
+
var state = initState(list, sortMethod);
|
|
26030
|
+
iterate2(list, iterator, state, function iteratorHandler(error82, result) {
|
|
26031
|
+
if (error82) {
|
|
26032
|
+
callback(error82, result);
|
|
26033
|
+
return;
|
|
26034
|
+
}
|
|
26035
|
+
state.index++;
|
|
26036
|
+
if (state.index < (state["keyedList"] || list).length) {
|
|
26037
|
+
iterate2(list, iterator, state, iteratorHandler);
|
|
26038
|
+
return;
|
|
26039
|
+
}
|
|
26040
|
+
callback(null, state.results);
|
|
26041
|
+
});
|
|
26042
|
+
return terminator.bind(state, callback);
|
|
26043
|
+
}
|
|
26044
|
+
function ascending(a, b) {
|
|
26045
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
26046
|
+
}
|
|
26047
|
+
function descending(a, b) {
|
|
26048
|
+
return -1 * ascending(a, b);
|
|
26049
|
+
}
|
|
26050
|
+
}
|
|
26051
|
+
});
|
|
26052
|
+
|
|
26053
|
+
// node_modules/asynckit/serial.js
|
|
26054
|
+
var require_serial = __commonJS({
|
|
26055
|
+
"node_modules/asynckit/serial.js"(exports2, module2) {
|
|
26056
|
+
var serialOrdered = require_serialOrdered();
|
|
26057
|
+
module2.exports = serial;
|
|
26058
|
+
function serial(list, iterator, callback) {
|
|
26059
|
+
return serialOrdered(list, iterator, null, callback);
|
|
26060
|
+
}
|
|
26061
|
+
}
|
|
26062
|
+
});
|
|
26063
|
+
|
|
26064
|
+
// node_modules/asynckit/index.js
|
|
26065
|
+
var require_asynckit = __commonJS({
|
|
26066
|
+
"node_modules/asynckit/index.js"(exports2, module2) {
|
|
26067
|
+
module2.exports = {
|
|
26068
|
+
parallel: require_parallel(),
|
|
26069
|
+
serial: require_serial(),
|
|
26070
|
+
serialOrdered: require_serialOrdered()
|
|
26071
|
+
};
|
|
26072
|
+
}
|
|
26073
|
+
});
|
|
26074
|
+
|
|
26075
|
+
// node_modules/has-tostringtag/shams.js
|
|
26076
|
+
var require_shams2 = __commonJS({
|
|
26077
|
+
"node_modules/has-tostringtag/shams.js"(exports2, module2) {
|
|
26078
|
+
"use strict";
|
|
26079
|
+
var hasSymbols = require_shams();
|
|
26080
|
+
module2.exports = function hasToStringTagShams() {
|
|
26081
|
+
return hasSymbols() && !!Symbol.toStringTag;
|
|
26082
|
+
};
|
|
26083
|
+
}
|
|
26084
|
+
});
|
|
26085
|
+
|
|
26086
|
+
// node_modules/es-set-tostringtag/index.js
|
|
26087
|
+
var require_es_set_tostringtag = __commonJS({
|
|
26088
|
+
"node_modules/es-set-tostringtag/index.js"(exports2, module2) {
|
|
26089
|
+
"use strict";
|
|
26090
|
+
var GetIntrinsic = require_get_intrinsic();
|
|
26091
|
+
var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
|
|
26092
|
+
var hasToStringTag = require_shams2()();
|
|
26093
|
+
var hasOwn = require_hasown();
|
|
26094
|
+
var $TypeError = require_type();
|
|
26095
|
+
var toStringTag = hasToStringTag ? Symbol.toStringTag : null;
|
|
26096
|
+
module2.exports = function setToStringTag(object4, value) {
|
|
26097
|
+
var overrideIfSet = arguments.length > 2 && !!arguments[2] && arguments[2].force;
|
|
26098
|
+
var nonConfigurable = arguments.length > 2 && !!arguments[2] && arguments[2].nonConfigurable;
|
|
26099
|
+
if (typeof overrideIfSet !== "undefined" && typeof overrideIfSet !== "boolean" || typeof nonConfigurable !== "undefined" && typeof nonConfigurable !== "boolean") {
|
|
26100
|
+
throw new $TypeError("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");
|
|
26101
|
+
}
|
|
26102
|
+
if (toStringTag && (overrideIfSet || !hasOwn(object4, toStringTag))) {
|
|
26103
|
+
if ($defineProperty) {
|
|
26104
|
+
$defineProperty(object4, toStringTag, {
|
|
26105
|
+
configurable: !nonConfigurable,
|
|
26106
|
+
enumerable: false,
|
|
26107
|
+
value,
|
|
26108
|
+
writable: false
|
|
26109
|
+
});
|
|
26110
|
+
} else {
|
|
26111
|
+
object4[toStringTag] = value;
|
|
26112
|
+
}
|
|
26113
|
+
}
|
|
26114
|
+
};
|
|
26115
|
+
}
|
|
26116
|
+
});
|
|
26117
|
+
|
|
26118
|
+
// node_modules/form-data/lib/populate.js
|
|
26119
|
+
var require_populate = __commonJS({
|
|
26120
|
+
"node_modules/form-data/lib/populate.js"(exports2, module2) {
|
|
26121
|
+
module2.exports = function(dst, src) {
|
|
26122
|
+
Object.keys(src).forEach(function(prop) {
|
|
26123
|
+
dst[prop] = dst[prop] || src[prop];
|
|
26124
|
+
});
|
|
26125
|
+
return dst;
|
|
26126
|
+
};
|
|
26127
|
+
}
|
|
26128
|
+
});
|
|
26129
|
+
|
|
26130
|
+
// node_modules/form-data/lib/form_data.js
|
|
26131
|
+
var require_form_data = __commonJS({
|
|
26132
|
+
"node_modules/form-data/lib/form_data.js"(exports2, module2) {
|
|
26133
|
+
var CombinedStream = require_combined_stream();
|
|
26134
|
+
var util2 = require("util");
|
|
26135
|
+
var path11 = require("path");
|
|
26136
|
+
var http = require("http");
|
|
26137
|
+
var https = require("https");
|
|
26138
|
+
var parseUrl = require("url").parse;
|
|
26139
|
+
var fs12 = require("fs");
|
|
26140
|
+
var Stream3 = require("stream").Stream;
|
|
26141
|
+
var mime = require_mime_types();
|
|
26142
|
+
var asynckit = require_asynckit();
|
|
26143
|
+
var setToStringTag = require_es_set_tostringtag();
|
|
26144
|
+
var populate = require_populate();
|
|
26145
|
+
module2.exports = FormData2;
|
|
26146
|
+
util2.inherits(FormData2, CombinedStream);
|
|
26147
|
+
function FormData2(options) {
|
|
26148
|
+
if (!(this instanceof FormData2)) {
|
|
26149
|
+
return new FormData2(options);
|
|
26150
|
+
}
|
|
26151
|
+
this._overheadLength = 0;
|
|
26152
|
+
this._valueLength = 0;
|
|
26153
|
+
this._valuesToMeasure = [];
|
|
26154
|
+
CombinedStream.call(this);
|
|
26155
|
+
options = options || {};
|
|
26156
|
+
for (var option in options) {
|
|
26157
|
+
this[option] = options[option];
|
|
26158
|
+
}
|
|
26159
|
+
}
|
|
26160
|
+
FormData2.LINE_BREAK = "\r\n";
|
|
26161
|
+
FormData2.DEFAULT_CONTENT_TYPE = "application/octet-stream";
|
|
26162
|
+
FormData2.prototype.append = function(field, value, options) {
|
|
26163
|
+
options = options || {};
|
|
26164
|
+
if (typeof options == "string") {
|
|
26165
|
+
options = { filename: options };
|
|
26166
|
+
}
|
|
26167
|
+
var append = CombinedStream.prototype.append.bind(this);
|
|
26168
|
+
if (typeof value == "number") {
|
|
26169
|
+
value = "" + value;
|
|
26170
|
+
}
|
|
26171
|
+
if (Array.isArray(value)) {
|
|
26172
|
+
this._error(new Error("Arrays are not supported."));
|
|
26173
|
+
return;
|
|
26174
|
+
}
|
|
26175
|
+
var header = this._multiPartHeader(field, value, options);
|
|
26176
|
+
var footer = this._multiPartFooter();
|
|
26177
|
+
append(header);
|
|
26178
|
+
append(value);
|
|
26179
|
+
append(footer);
|
|
26180
|
+
this._trackLength(header, value, options);
|
|
26181
|
+
};
|
|
26182
|
+
FormData2.prototype._trackLength = function(header, value, options) {
|
|
26183
|
+
var valueLength = 0;
|
|
26184
|
+
if (options.knownLength != null) {
|
|
26185
|
+
valueLength += +options.knownLength;
|
|
26186
|
+
} else if (Buffer.isBuffer(value)) {
|
|
26187
|
+
valueLength = value.length;
|
|
26188
|
+
} else if (typeof value === "string") {
|
|
26189
|
+
valueLength = Buffer.byteLength(value);
|
|
26190
|
+
}
|
|
26191
|
+
this._valueLength += valueLength;
|
|
26192
|
+
this._overheadLength += Buffer.byteLength(header) + FormData2.LINE_BREAK.length;
|
|
26193
|
+
if (!value || !value.path && !(value.readable && Object.prototype.hasOwnProperty.call(value, "httpVersion")) && !(value instanceof Stream3)) {
|
|
26194
|
+
return;
|
|
26195
|
+
}
|
|
26196
|
+
if (!options.knownLength) {
|
|
26197
|
+
this._valuesToMeasure.push(value);
|
|
26198
|
+
}
|
|
26199
|
+
};
|
|
26200
|
+
FormData2.prototype._lengthRetriever = function(value, callback) {
|
|
26201
|
+
if (Object.prototype.hasOwnProperty.call(value, "fd")) {
|
|
26202
|
+
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
26203
|
+
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
26204
|
+
} else {
|
|
26205
|
+
fs12.stat(value.path, function(err, stat4) {
|
|
26206
|
+
var fileSize;
|
|
26207
|
+
if (err) {
|
|
26208
|
+
callback(err);
|
|
26209
|
+
return;
|
|
26210
|
+
}
|
|
26211
|
+
fileSize = stat4.size - (value.start ? value.start : 0);
|
|
26212
|
+
callback(null, fileSize);
|
|
26213
|
+
});
|
|
26214
|
+
}
|
|
26215
|
+
} else if (Object.prototype.hasOwnProperty.call(value, "httpVersion")) {
|
|
26216
|
+
callback(null, +value.headers["content-length"]);
|
|
26217
|
+
} else if (Object.prototype.hasOwnProperty.call(value, "httpModule")) {
|
|
26218
|
+
value.on("response", function(response) {
|
|
26219
|
+
value.pause();
|
|
26220
|
+
callback(null, +response.headers["content-length"]);
|
|
26221
|
+
});
|
|
26222
|
+
value.resume();
|
|
26223
|
+
} else {
|
|
26224
|
+
callback("Unknown stream");
|
|
26225
|
+
}
|
|
26226
|
+
};
|
|
26227
|
+
FormData2.prototype._multiPartHeader = function(field, value, options) {
|
|
26228
|
+
if (typeof options.header == "string") {
|
|
26229
|
+
return options.header;
|
|
26230
|
+
}
|
|
26231
|
+
var contentDisposition = this._getContentDisposition(value, options);
|
|
26232
|
+
var contentType = this._getContentType(value, options);
|
|
26233
|
+
var contents = "";
|
|
26234
|
+
var headers = {
|
|
26235
|
+
// add custom disposition as third element or keep it two elements if not
|
|
26236
|
+
"Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []),
|
|
26237
|
+
// if no content type. allow it to be empty array
|
|
26238
|
+
"Content-Type": [].concat(contentType || [])
|
|
26239
|
+
};
|
|
26240
|
+
if (typeof options.header == "object") {
|
|
26241
|
+
populate(headers, options.header);
|
|
26242
|
+
}
|
|
26243
|
+
var header;
|
|
26244
|
+
for (var prop in headers) {
|
|
26245
|
+
if (Object.prototype.hasOwnProperty.call(headers, prop)) {
|
|
26246
|
+
header = headers[prop];
|
|
26247
|
+
if (header == null) {
|
|
26248
|
+
continue;
|
|
26249
|
+
}
|
|
26250
|
+
if (!Array.isArray(header)) {
|
|
26251
|
+
header = [header];
|
|
26252
|
+
}
|
|
26253
|
+
if (header.length) {
|
|
26254
|
+
contents += prop + ": " + header.join("; ") + FormData2.LINE_BREAK;
|
|
26255
|
+
}
|
|
26256
|
+
}
|
|
26257
|
+
}
|
|
26258
|
+
return "--" + this.getBoundary() + FormData2.LINE_BREAK + contents + FormData2.LINE_BREAK;
|
|
26259
|
+
};
|
|
26260
|
+
FormData2.prototype._getContentDisposition = function(value, options) {
|
|
26261
|
+
var filename, contentDisposition;
|
|
26262
|
+
if (typeof options.filepath === "string") {
|
|
26263
|
+
filename = path11.normalize(options.filepath).replace(/\\/g, "/");
|
|
26264
|
+
} else if (options.filename || value.name || value.path) {
|
|
26265
|
+
filename = path11.basename(options.filename || value.name || value.path);
|
|
26266
|
+
} else if (value.readable && Object.prototype.hasOwnProperty.call(value, "httpVersion")) {
|
|
26267
|
+
filename = path11.basename(value.client._httpMessage.path || "");
|
|
26268
|
+
}
|
|
26269
|
+
if (filename) {
|
|
26270
|
+
contentDisposition = 'filename="' + filename + '"';
|
|
26271
|
+
}
|
|
26272
|
+
return contentDisposition;
|
|
26273
|
+
};
|
|
26274
|
+
FormData2.prototype._getContentType = function(value, options) {
|
|
26275
|
+
var contentType = options.contentType;
|
|
26276
|
+
if (!contentType && value.name) {
|
|
26277
|
+
contentType = mime.lookup(value.name);
|
|
26278
|
+
}
|
|
26279
|
+
if (!contentType && value.path) {
|
|
26280
|
+
contentType = mime.lookup(value.path);
|
|
26281
|
+
}
|
|
26282
|
+
if (!contentType && value.readable && Object.prototype.hasOwnProperty.call(value, "httpVersion")) {
|
|
26283
|
+
contentType = value.headers["content-type"];
|
|
26284
|
+
}
|
|
26285
|
+
if (!contentType && (options.filepath || options.filename)) {
|
|
26286
|
+
contentType = mime.lookup(options.filepath || options.filename);
|
|
26287
|
+
}
|
|
26288
|
+
if (!contentType && typeof value == "object") {
|
|
26289
|
+
contentType = FormData2.DEFAULT_CONTENT_TYPE;
|
|
26290
|
+
}
|
|
26291
|
+
return contentType;
|
|
26292
|
+
};
|
|
26293
|
+
FormData2.prototype._multiPartFooter = function() {
|
|
26294
|
+
return function(next) {
|
|
26295
|
+
var footer = FormData2.LINE_BREAK;
|
|
26296
|
+
var lastPart = this._streams.length === 0;
|
|
26297
|
+
if (lastPart) {
|
|
26298
|
+
footer += this._lastBoundary();
|
|
26299
|
+
}
|
|
26300
|
+
next(footer);
|
|
26301
|
+
}.bind(this);
|
|
26302
|
+
};
|
|
26303
|
+
FormData2.prototype._lastBoundary = function() {
|
|
26304
|
+
return "--" + this.getBoundary() + "--" + FormData2.LINE_BREAK;
|
|
26305
|
+
};
|
|
26306
|
+
FormData2.prototype.getHeaders = function(userHeaders) {
|
|
26307
|
+
var header;
|
|
26308
|
+
var formHeaders = {
|
|
26309
|
+
"content-type": "multipart/form-data; boundary=" + this.getBoundary()
|
|
26310
|
+
};
|
|
26311
|
+
for (header in userHeaders) {
|
|
26312
|
+
if (Object.prototype.hasOwnProperty.call(userHeaders, header)) {
|
|
26313
|
+
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
26314
|
+
}
|
|
26315
|
+
}
|
|
26316
|
+
return formHeaders;
|
|
26317
|
+
};
|
|
26318
|
+
FormData2.prototype.setBoundary = function(boundary) {
|
|
26319
|
+
this._boundary = boundary;
|
|
26320
|
+
};
|
|
26321
|
+
FormData2.prototype.getBoundary = function() {
|
|
26322
|
+
if (!this._boundary) {
|
|
26323
|
+
this._generateBoundary();
|
|
26324
|
+
}
|
|
26325
|
+
return this._boundary;
|
|
26326
|
+
};
|
|
26327
|
+
FormData2.prototype.getBuffer = function() {
|
|
26328
|
+
var dataBuffer = new Buffer.alloc(0);
|
|
26329
|
+
var boundary = this.getBoundary();
|
|
26330
|
+
for (var i = 0, len = this._streams.length; i < len; i++) {
|
|
26331
|
+
if (typeof this._streams[i] !== "function") {
|
|
26332
|
+
if (Buffer.isBuffer(this._streams[i])) {
|
|
26333
|
+
dataBuffer = Buffer.concat([dataBuffer, this._streams[i]]);
|
|
26334
|
+
} else {
|
|
26335
|
+
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]);
|
|
26336
|
+
}
|
|
26337
|
+
if (typeof this._streams[i] !== "string" || this._streams[i].substring(2, boundary.length + 2) !== boundary) {
|
|
26338
|
+
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData2.LINE_BREAK)]);
|
|
26339
|
+
}
|
|
26340
|
+
}
|
|
26341
|
+
}
|
|
26342
|
+
return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
|
|
26343
|
+
};
|
|
26344
|
+
FormData2.prototype._generateBoundary = function() {
|
|
26345
|
+
var boundary = "--------------------------";
|
|
26346
|
+
for (var i = 0; i < 24; i++) {
|
|
26347
|
+
boundary += Math.floor(Math.random() * 10).toString(16);
|
|
26348
|
+
}
|
|
26349
|
+
this._boundary = boundary;
|
|
26350
|
+
};
|
|
26351
|
+
FormData2.prototype.getLengthSync = function() {
|
|
26352
|
+
var knownLength = this._overheadLength + this._valueLength;
|
|
26353
|
+
if (this._streams.length) {
|
|
26354
|
+
knownLength += this._lastBoundary().length;
|
|
26355
|
+
}
|
|
26356
|
+
if (!this.hasKnownLength()) {
|
|
26357
|
+
this._error(new Error("Cannot calculate proper length in synchronous way."));
|
|
26358
|
+
}
|
|
26359
|
+
return knownLength;
|
|
26360
|
+
};
|
|
26361
|
+
FormData2.prototype.hasKnownLength = function() {
|
|
26362
|
+
var hasKnownLength = true;
|
|
26363
|
+
if (this._valuesToMeasure.length) {
|
|
26364
|
+
hasKnownLength = false;
|
|
26365
|
+
}
|
|
26366
|
+
return hasKnownLength;
|
|
26367
|
+
};
|
|
26368
|
+
FormData2.prototype.getLength = function(cb) {
|
|
26369
|
+
var knownLength = this._overheadLength + this._valueLength;
|
|
26370
|
+
if (this._streams.length) {
|
|
26371
|
+
knownLength += this._lastBoundary().length;
|
|
26372
|
+
}
|
|
26373
|
+
if (!this._valuesToMeasure.length) {
|
|
26374
|
+
process.nextTick(cb.bind(this, null, knownLength));
|
|
26375
|
+
return;
|
|
26376
|
+
}
|
|
26377
|
+
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
|
26378
|
+
if (err) {
|
|
26379
|
+
cb(err);
|
|
26380
|
+
return;
|
|
26381
|
+
}
|
|
26382
|
+
values.forEach(function(length) {
|
|
26383
|
+
knownLength += length;
|
|
26384
|
+
});
|
|
26385
|
+
cb(null, knownLength);
|
|
26386
|
+
});
|
|
26387
|
+
};
|
|
26388
|
+
FormData2.prototype.submit = function(params, cb) {
|
|
26389
|
+
var request, options, defaults2 = { method: "post" };
|
|
26390
|
+
if (typeof params == "string") {
|
|
26391
|
+
params = parseUrl(params);
|
|
26392
|
+
options = populate({
|
|
26393
|
+
port: params.port,
|
|
26394
|
+
path: params.pathname,
|
|
26395
|
+
host: params.hostname,
|
|
26396
|
+
protocol: params.protocol
|
|
26397
|
+
}, defaults2);
|
|
26398
|
+
} else {
|
|
26399
|
+
options = populate(params, defaults2);
|
|
26400
|
+
if (!options.port) {
|
|
26401
|
+
options.port = options.protocol == "https:" ? 443 : 80;
|
|
26402
|
+
}
|
|
26403
|
+
}
|
|
26404
|
+
options.headers = this.getHeaders(params.headers);
|
|
26405
|
+
if (options.protocol == "https:") {
|
|
26406
|
+
request = https.request(options);
|
|
26407
|
+
} else {
|
|
26408
|
+
request = http.request(options);
|
|
26409
|
+
}
|
|
26410
|
+
this.getLength(function(err, length) {
|
|
26411
|
+
if (err && err !== "Unknown stream") {
|
|
26412
|
+
this._error(err);
|
|
26413
|
+
return;
|
|
26414
|
+
}
|
|
26415
|
+
if (length) {
|
|
26416
|
+
request.setHeader("Content-Length", length);
|
|
26417
|
+
}
|
|
26418
|
+
this.pipe(request);
|
|
26419
|
+
if (cb) {
|
|
26420
|
+
var onResponse;
|
|
26421
|
+
var callback = function(error82, responce) {
|
|
26422
|
+
request.removeListener("error", callback);
|
|
26423
|
+
request.removeListener("response", onResponse);
|
|
26424
|
+
return cb.call(this, error82, responce);
|
|
26425
|
+
};
|
|
26426
|
+
onResponse = callback.bind(this, null);
|
|
26427
|
+
request.on("error", callback);
|
|
26428
|
+
request.on("response", onResponse);
|
|
26429
|
+
}
|
|
26430
|
+
}.bind(this));
|
|
26431
|
+
return request;
|
|
26432
|
+
};
|
|
26433
|
+
FormData2.prototype._error = function(err) {
|
|
26434
|
+
if (!this.error) {
|
|
26435
|
+
this.error = err;
|
|
26436
|
+
this.pause();
|
|
26437
|
+
this.emit("error", err);
|
|
26438
|
+
}
|
|
26439
|
+
};
|
|
26440
|
+
FormData2.prototype.toString = function() {
|
|
26441
|
+
return "[object FormData]";
|
|
26442
|
+
};
|
|
26443
|
+
setToStringTag(FormData2, "FormData");
|
|
26444
|
+
}
|
|
26445
|
+
});
|
|
26446
|
+
|
|
25606
26447
|
// src/proxy/server.ts
|
|
25607
26448
|
var import_express = __toESM(require_express2(), 1);
|
|
25608
26449
|
|
|
@@ -25631,7 +26472,7 @@ function parseXmlResponse(xmlString) {
|
|
|
25631
26472
|
const fileXml = remainingXml.slice(fileStart, fileEnd);
|
|
25632
26473
|
const pathMatch = fileXml.match(/path="([^"]*)"/);
|
|
25633
26474
|
const actionMatch = fileXml.match(/action="([^"]*)"/);
|
|
25634
|
-
const
|
|
26475
|
+
const path11 = pathMatch ? pathMatch[1] : "";
|
|
25635
26476
|
const action = actionMatch ? actionMatch[1] : "modify";
|
|
25636
26477
|
const changes = [];
|
|
25637
26478
|
let changeXml = fileXml;
|
|
@@ -25680,7 +26521,7 @@ function parseXmlResponse(xmlString) {
|
|
|
25680
26521
|
changeXml = changeXml.slice(changeEnd);
|
|
25681
26522
|
}
|
|
25682
26523
|
if (changes.length > 0) {
|
|
25683
|
-
files2.push({ path:
|
|
26524
|
+
files2.push({ path: path11, action, changes });
|
|
25684
26525
|
}
|
|
25685
26526
|
remainingXml = remainingXml.slice(fileEnd);
|
|
25686
26527
|
}
|
|
@@ -25691,16 +26532,16 @@ function parseXmlResponse(xmlString) {
|
|
|
25691
26532
|
return { plan, files };
|
|
25692
26533
|
}
|
|
25693
26534
|
function extractContent(text2) {
|
|
25694
|
-
const
|
|
25695
|
-
const firstIndex = text2.indexOf(
|
|
25696
|
-
const lastIndex = text2.lastIndexOf(
|
|
26535
|
+
const marker18 = "\n===\n";
|
|
26536
|
+
const firstIndex = text2.indexOf(marker18);
|
|
26537
|
+
const lastIndex = text2.lastIndexOf(marker18);
|
|
25697
26538
|
if (firstIndex === -1 || lastIndex === -1 || firstIndex === lastIndex) {
|
|
25698
26539
|
console.log("==============> ERROR no \\n===\\n", JSON.stringify(text2));
|
|
25699
26540
|
throw new Error(
|
|
25700
26541
|
"Input string must include at least two '\\n===\\n' markers"
|
|
25701
26542
|
);
|
|
25702
26543
|
}
|
|
25703
|
-
return text2.substring(firstIndex +
|
|
26544
|
+
return text2.substring(firstIndex + marker18.length, lastIndex);
|
|
25704
26545
|
}
|
|
25705
26546
|
|
|
25706
26547
|
// src/proxy/utils.ts
|
|
@@ -30736,12 +31577,12 @@ var PathBase = class {
|
|
|
30736
31577
|
/**
|
|
30737
31578
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
30738
31579
|
*/
|
|
30739
|
-
resolve(
|
|
30740
|
-
if (!
|
|
31580
|
+
resolve(path11) {
|
|
31581
|
+
if (!path11) {
|
|
30741
31582
|
return this;
|
|
30742
31583
|
}
|
|
30743
|
-
const rootPath = this.getRootString(
|
|
30744
|
-
const dir =
|
|
31584
|
+
const rootPath = this.getRootString(path11);
|
|
31585
|
+
const dir = path11.substring(rootPath.length);
|
|
30745
31586
|
const dirParts = dir.split(this.splitSep);
|
|
30746
31587
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
30747
31588
|
return result;
|
|
@@ -31493,8 +32334,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
|
|
|
31493
32334
|
/**
|
|
31494
32335
|
* @internal
|
|
31495
32336
|
*/
|
|
31496
|
-
getRootString(
|
|
31497
|
-
return import_node_path.win32.parse(
|
|
32337
|
+
getRootString(path11) {
|
|
32338
|
+
return import_node_path.win32.parse(path11).root;
|
|
31498
32339
|
}
|
|
31499
32340
|
/**
|
|
31500
32341
|
* @internal
|
|
@@ -31540,8 +32381,8 @@ var PathPosix = class _PathPosix extends PathBase {
|
|
|
31540
32381
|
/**
|
|
31541
32382
|
* @internal
|
|
31542
32383
|
*/
|
|
31543
|
-
getRootString(
|
|
31544
|
-
return
|
|
32384
|
+
getRootString(path11) {
|
|
32385
|
+
return path11.startsWith("/") ? "/" : "";
|
|
31545
32386
|
}
|
|
31546
32387
|
/**
|
|
31547
32388
|
* @internal
|
|
@@ -31590,8 +32431,8 @@ var PathScurryBase = class {
|
|
|
31590
32431
|
*
|
|
31591
32432
|
* @internal
|
|
31592
32433
|
*/
|
|
31593
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
31594
|
-
this.#fs = fsFromOption(
|
|
32434
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs12 = defaultFS } = {}) {
|
|
32435
|
+
this.#fs = fsFromOption(fs12);
|
|
31595
32436
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
31596
32437
|
cwd = (0, import_node_url.fileURLToPath)(cwd);
|
|
31597
32438
|
}
|
|
@@ -31630,11 +32471,11 @@ var PathScurryBase = class {
|
|
|
31630
32471
|
/**
|
|
31631
32472
|
* Get the depth of a provided path, string, or the cwd
|
|
31632
32473
|
*/
|
|
31633
|
-
depth(
|
|
31634
|
-
if (typeof
|
|
31635
|
-
|
|
32474
|
+
depth(path11 = this.cwd) {
|
|
32475
|
+
if (typeof path11 === "string") {
|
|
32476
|
+
path11 = this.cwd.resolve(path11);
|
|
31636
32477
|
}
|
|
31637
|
-
return
|
|
32478
|
+
return path11.depth();
|
|
31638
32479
|
}
|
|
31639
32480
|
/**
|
|
31640
32481
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -32121,9 +32962,9 @@ var PathScurryBase = class {
|
|
|
32121
32962
|
process2();
|
|
32122
32963
|
return results;
|
|
32123
32964
|
}
|
|
32124
|
-
chdir(
|
|
32965
|
+
chdir(path11 = this.cwd) {
|
|
32125
32966
|
const oldCwd = this.cwd;
|
|
32126
|
-
this.cwd = typeof
|
|
32967
|
+
this.cwd = typeof path11 === "string" ? this.cwd.resolve(path11) : path11;
|
|
32127
32968
|
this.cwd[setAsCwd](oldCwd);
|
|
32128
32969
|
}
|
|
32129
32970
|
};
|
|
@@ -32149,8 +32990,8 @@ var PathScurryWin32 = class extends PathScurryBase {
|
|
|
32149
32990
|
/**
|
|
32150
32991
|
* @internal
|
|
32151
32992
|
*/
|
|
32152
|
-
newRoot(
|
|
32153
|
-
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
32993
|
+
newRoot(fs12) {
|
|
32994
|
+
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs12 });
|
|
32154
32995
|
}
|
|
32155
32996
|
/**
|
|
32156
32997
|
* Return true if the provided path string is an absolute path
|
|
@@ -32178,8 +33019,8 @@ var PathScurryPosix = class extends PathScurryBase {
|
|
|
32178
33019
|
/**
|
|
32179
33020
|
* @internal
|
|
32180
33021
|
*/
|
|
32181
|
-
newRoot(
|
|
32182
|
-
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
33022
|
+
newRoot(fs12) {
|
|
33023
|
+
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs12 });
|
|
32183
33024
|
}
|
|
32184
33025
|
/**
|
|
32185
33026
|
* Return true if the provided path string is an absolute path
|
|
@@ -32479,8 +33320,8 @@ var MatchRecord = class {
|
|
|
32479
33320
|
}
|
|
32480
33321
|
// match, absolute, ifdir
|
|
32481
33322
|
entries() {
|
|
32482
|
-
return [...this.store.entries()].map(([
|
|
32483
|
-
|
|
33323
|
+
return [...this.store.entries()].map(([path11, n]) => [
|
|
33324
|
+
path11,
|
|
32484
33325
|
!!(n & 2),
|
|
32485
33326
|
!!(n & 1)
|
|
32486
33327
|
]);
|
|
@@ -32685,9 +33526,9 @@ var GlobUtil = class {
|
|
|
32685
33526
|
signal;
|
|
32686
33527
|
maxDepth;
|
|
32687
33528
|
includeChildMatches;
|
|
32688
|
-
constructor(patterns,
|
|
33529
|
+
constructor(patterns, path11, opts) {
|
|
32689
33530
|
this.patterns = patterns;
|
|
32690
|
-
this.path =
|
|
33531
|
+
this.path = path11;
|
|
32691
33532
|
this.opts = opts;
|
|
32692
33533
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
32693
33534
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -32706,11 +33547,11 @@ var GlobUtil = class {
|
|
|
32706
33547
|
});
|
|
32707
33548
|
}
|
|
32708
33549
|
}
|
|
32709
|
-
#ignored(
|
|
32710
|
-
return this.seen.has(
|
|
33550
|
+
#ignored(path11) {
|
|
33551
|
+
return this.seen.has(path11) || !!this.#ignore?.ignored?.(path11);
|
|
32711
33552
|
}
|
|
32712
|
-
#childrenIgnored(
|
|
32713
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
33553
|
+
#childrenIgnored(path11) {
|
|
33554
|
+
return !!this.#ignore?.childrenIgnored?.(path11);
|
|
32714
33555
|
}
|
|
32715
33556
|
// backpressure mechanism
|
|
32716
33557
|
pause() {
|
|
@@ -32925,8 +33766,8 @@ var GlobUtil = class {
|
|
|
32925
33766
|
};
|
|
32926
33767
|
var GlobWalker = class extends GlobUtil {
|
|
32927
33768
|
matches = /* @__PURE__ */ new Set();
|
|
32928
|
-
constructor(patterns,
|
|
32929
|
-
super(patterns,
|
|
33769
|
+
constructor(patterns, path11, opts) {
|
|
33770
|
+
super(patterns, path11, opts);
|
|
32930
33771
|
}
|
|
32931
33772
|
matchEmit(e) {
|
|
32932
33773
|
this.matches.add(e);
|
|
@@ -32963,8 +33804,8 @@ var GlobWalker = class extends GlobUtil {
|
|
|
32963
33804
|
};
|
|
32964
33805
|
var GlobStream = class extends GlobUtil {
|
|
32965
33806
|
results;
|
|
32966
|
-
constructor(patterns,
|
|
32967
|
-
super(patterns,
|
|
33807
|
+
constructor(patterns, path11, opts) {
|
|
33808
|
+
super(patterns, path11, opts);
|
|
32968
33809
|
this.results = new Minipass({
|
|
32969
33810
|
signal: this.signal,
|
|
32970
33811
|
objectMode: true
|
|
@@ -33527,6 +34368,27 @@ var Mutex = class {
|
|
|
33527
34368
|
|
|
33528
34369
|
// src/proxy/git.ts
|
|
33529
34370
|
var exec4 = (0, import_util2.promisify)(proc4.exec);
|
|
34371
|
+
function sanitizeCommitMessage(message) {
|
|
34372
|
+
return message.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "\\`").replace(/\$/g, "\\$").replace(/\n/g, " ").replace(/\r/g, "");
|
|
34373
|
+
}
|
|
34374
|
+
function processCommitMessage(message, maxTitleLength = 72) {
|
|
34375
|
+
const splitRegex = /\.|\n|\r/;
|
|
34376
|
+
const match2 = message.match(splitRegex);
|
|
34377
|
+
let title;
|
|
34378
|
+
if (match2 && match2.index !== void 0) {
|
|
34379
|
+
title = message.substring(0, match2.index + (match2[0] === "." ? 1 : 0));
|
|
34380
|
+
} else {
|
|
34381
|
+
title = message;
|
|
34382
|
+
}
|
|
34383
|
+
title = title.trim();
|
|
34384
|
+
if (title.length > maxTitleLength) {
|
|
34385
|
+
title = title.substring(0, maxTitleLength).trim();
|
|
34386
|
+
}
|
|
34387
|
+
return {
|
|
34388
|
+
title,
|
|
34389
|
+
body: message.trim()
|
|
34390
|
+
};
|
|
34391
|
+
}
|
|
33530
34392
|
var Repo = class {
|
|
33531
34393
|
gitMutex = new Mutex();
|
|
33532
34394
|
cwd;
|
|
@@ -33671,7 +34533,8 @@ var Repo = class {
|
|
|
33671
34533
|
}
|
|
33672
34534
|
// FIXEME: add --no-verify ???
|
|
33673
34535
|
async commit(message) {
|
|
33674
|
-
|
|
34536
|
+
const sanitized = sanitizeCommitMessage(message);
|
|
34537
|
+
return this.execCommand(`git commit -m "${sanitized}"`);
|
|
33675
34538
|
}
|
|
33676
34539
|
async push(branch = "master") {
|
|
33677
34540
|
return this.execCommand(`git push origin ${branch}`);
|
|
@@ -33710,7 +34573,6 @@ var Repo = class {
|
|
|
33710
34573
|
await fs8.rename(devcontainerPath, backupPath);
|
|
33711
34574
|
return true;
|
|
33712
34575
|
} catch (error82) {
|
|
33713
|
-
console.warn("Failed to backup .devcontainer:", error82);
|
|
33714
34576
|
return false;
|
|
33715
34577
|
}
|
|
33716
34578
|
}
|
|
@@ -33962,7 +34824,7 @@ var SSEManager = class {
|
|
|
33962
34824
|
var sseManager = new SSEManager();
|
|
33963
34825
|
|
|
33964
34826
|
// src/proxy/version.ts
|
|
33965
|
-
var VERSION = "0.3.
|
|
34827
|
+
var VERSION = "0.3.23";
|
|
33966
34828
|
|
|
33967
34829
|
// node_modules/uuid/dist/esm/stringify.js
|
|
33968
34830
|
var byteToHex = [];
|
|
@@ -34727,12 +35589,12 @@ var NEVER = Object.freeze({
|
|
|
34727
35589
|
// @__NO_SIDE_EFFECTS__
|
|
34728
35590
|
function $constructor(name18, initializer5, params) {
|
|
34729
35591
|
function init(inst, def) {
|
|
34730
|
-
var
|
|
35592
|
+
var _a18;
|
|
34731
35593
|
Object.defineProperty(inst, "_zod", {
|
|
34732
35594
|
value: inst._zod ?? {},
|
|
34733
35595
|
enumerable: false
|
|
34734
35596
|
});
|
|
34735
|
-
(
|
|
35597
|
+
(_a18 = inst._zod).traits ?? (_a18.traits = /* @__PURE__ */ new Set());
|
|
34736
35598
|
inst._zod.traits.add(name18);
|
|
34737
35599
|
initializer5(inst, def);
|
|
34738
35600
|
for (const k in _.prototype) {
|
|
@@ -34747,10 +35609,10 @@ function $constructor(name18, initializer5, params) {
|
|
|
34747
35609
|
}
|
|
34748
35610
|
Object.defineProperty(Definition, "name", { value: name18 });
|
|
34749
35611
|
function _(def) {
|
|
34750
|
-
var
|
|
35612
|
+
var _a18;
|
|
34751
35613
|
const inst = params?.Parent ? new Definition() : this;
|
|
34752
35614
|
init(inst, def);
|
|
34753
|
-
(
|
|
35615
|
+
(_a18 = inst._zod).deferred ?? (_a18.deferred = []);
|
|
34754
35616
|
for (const fn of inst._zod.deferred) {
|
|
34755
35617
|
fn();
|
|
34756
35618
|
}
|
|
@@ -34957,10 +35819,10 @@ function mergeDefs(...defs) {
|
|
|
34957
35819
|
function cloneDef(schema) {
|
|
34958
35820
|
return mergeDefs(schema._zod.def);
|
|
34959
35821
|
}
|
|
34960
|
-
function getElementAtPath(obj,
|
|
34961
|
-
if (!
|
|
35822
|
+
function getElementAtPath(obj, path11) {
|
|
35823
|
+
if (!path11)
|
|
34962
35824
|
return obj;
|
|
34963
|
-
return
|
|
35825
|
+
return path11.reduce((acc, key) => acc?.[key], obj);
|
|
34964
35826
|
}
|
|
34965
35827
|
function promiseAllObject(promisesObj) {
|
|
34966
35828
|
const keys = Object.keys(promisesObj);
|
|
@@ -35319,11 +36181,11 @@ function aborted(x, startIndex = 0) {
|
|
|
35319
36181
|
}
|
|
35320
36182
|
return false;
|
|
35321
36183
|
}
|
|
35322
|
-
function prefixIssues(
|
|
36184
|
+
function prefixIssues(path11, issues) {
|
|
35323
36185
|
return issues.map((iss) => {
|
|
35324
|
-
var
|
|
35325
|
-
(
|
|
35326
|
-
iss.path.unshift(
|
|
36186
|
+
var _a18;
|
|
36187
|
+
(_a18 = iss).path ?? (_a18.path = []);
|
|
36188
|
+
iss.path.unshift(path11);
|
|
35327
36189
|
return iss;
|
|
35328
36190
|
});
|
|
35329
36191
|
}
|
|
@@ -35491,8 +36353,8 @@ function treeifyError(error82, _mapper) {
|
|
|
35491
36353
|
return issue3.message;
|
|
35492
36354
|
};
|
|
35493
36355
|
const result = { errors: [] };
|
|
35494
|
-
const processError = (error83,
|
|
35495
|
-
var
|
|
36356
|
+
const processError = (error83, path11 = []) => {
|
|
36357
|
+
var _a18, _b8;
|
|
35496
36358
|
for (const issue3 of error83.issues) {
|
|
35497
36359
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
35498
36360
|
issue3.errors.map((issues) => processError({ issues }, issue3.path));
|
|
@@ -35501,7 +36363,7 @@ function treeifyError(error82, _mapper) {
|
|
|
35501
36363
|
} else if (issue3.code === "invalid_element") {
|
|
35502
36364
|
processError({ issues: issue3.issues }, issue3.path);
|
|
35503
36365
|
} else {
|
|
35504
|
-
const fullpath = [...
|
|
36366
|
+
const fullpath = [...path11, ...issue3.path];
|
|
35505
36367
|
if (fullpath.length === 0) {
|
|
35506
36368
|
result.errors.push(mapper(issue3));
|
|
35507
36369
|
continue;
|
|
@@ -35513,7 +36375,7 @@ function treeifyError(error82, _mapper) {
|
|
|
35513
36375
|
const terminal = i === fullpath.length - 1;
|
|
35514
36376
|
if (typeof el === "string") {
|
|
35515
36377
|
curr.properties ?? (curr.properties = {});
|
|
35516
|
-
(
|
|
36378
|
+
(_a18 = curr.properties)[el] ?? (_a18[el] = { errors: [] });
|
|
35517
36379
|
curr = curr.properties[el];
|
|
35518
36380
|
} else {
|
|
35519
36381
|
curr.items ?? (curr.items = []);
|
|
@@ -35533,8 +36395,8 @@ function treeifyError(error82, _mapper) {
|
|
|
35533
36395
|
}
|
|
35534
36396
|
function toDotPath(_path) {
|
|
35535
36397
|
const segs = [];
|
|
35536
|
-
const
|
|
35537
|
-
for (const seg of
|
|
36398
|
+
const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
36399
|
+
for (const seg of path11) {
|
|
35538
36400
|
if (typeof seg === "number")
|
|
35539
36401
|
segs.push(`[${seg}]`);
|
|
35540
36402
|
else if (typeof seg === "symbol")
|
|
@@ -35802,10 +36664,10 @@ var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
|
|
|
35802
36664
|
|
|
35803
36665
|
// node_modules/aieo/node_modules/zod/v4/core/checks.js
|
|
35804
36666
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
35805
|
-
var
|
|
36667
|
+
var _a18;
|
|
35806
36668
|
inst._zod ?? (inst._zod = {});
|
|
35807
36669
|
inst._zod.def = def;
|
|
35808
|
-
(
|
|
36670
|
+
(_a18 = inst._zod).onattach ?? (_a18.onattach = []);
|
|
35809
36671
|
});
|
|
35810
36672
|
var numericOriginMap = {
|
|
35811
36673
|
number: "number",
|
|
@@ -35871,8 +36733,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
35871
36733
|
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
35872
36734
|
$ZodCheck.init(inst, def);
|
|
35873
36735
|
inst._zod.onattach.push((inst2) => {
|
|
35874
|
-
var
|
|
35875
|
-
(
|
|
36736
|
+
var _a18;
|
|
36737
|
+
(_a18 = inst2._zod.bag).multipleOf ?? (_a18.multipleOf = def.value);
|
|
35876
36738
|
});
|
|
35877
36739
|
inst._zod.check = (payload) => {
|
|
35878
36740
|
if (typeof payload.value !== typeof def.value)
|
|
@@ -35999,9 +36861,9 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
35999
36861
|
};
|
|
36000
36862
|
});
|
|
36001
36863
|
var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => {
|
|
36002
|
-
var
|
|
36864
|
+
var _a18;
|
|
36003
36865
|
$ZodCheck.init(inst, def);
|
|
36004
|
-
(
|
|
36866
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
36005
36867
|
const val = payload.value;
|
|
36006
36868
|
return !nullish(val) && val.size !== void 0;
|
|
36007
36869
|
});
|
|
@@ -36027,9 +36889,9 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
36027
36889
|
};
|
|
36028
36890
|
});
|
|
36029
36891
|
var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {
|
|
36030
|
-
var
|
|
36892
|
+
var _a18;
|
|
36031
36893
|
$ZodCheck.init(inst, def);
|
|
36032
|
-
(
|
|
36894
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
36033
36895
|
const val = payload.value;
|
|
36034
36896
|
return !nullish(val) && val.size !== void 0;
|
|
36035
36897
|
});
|
|
@@ -36055,9 +36917,9 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
36055
36917
|
};
|
|
36056
36918
|
});
|
|
36057
36919
|
var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => {
|
|
36058
|
-
var
|
|
36920
|
+
var _a18;
|
|
36059
36921
|
$ZodCheck.init(inst, def);
|
|
36060
|
-
(
|
|
36922
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
36061
36923
|
const val = payload.value;
|
|
36062
36924
|
return !nullish(val) && val.size !== void 0;
|
|
36063
36925
|
});
|
|
@@ -36085,9 +36947,9 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
36085
36947
|
};
|
|
36086
36948
|
});
|
|
36087
36949
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
36088
|
-
var
|
|
36950
|
+
var _a18;
|
|
36089
36951
|
$ZodCheck.init(inst, def);
|
|
36090
|
-
(
|
|
36952
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
36091
36953
|
const val = payload.value;
|
|
36092
36954
|
return !nullish(val) && val.length !== void 0;
|
|
36093
36955
|
});
|
|
@@ -36114,9 +36976,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
36114
36976
|
};
|
|
36115
36977
|
});
|
|
36116
36978
|
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
36117
|
-
var
|
|
36979
|
+
var _a18;
|
|
36118
36980
|
$ZodCheck.init(inst, def);
|
|
36119
|
-
(
|
|
36981
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
36120
36982
|
const val = payload.value;
|
|
36121
36983
|
return !nullish(val) && val.length !== void 0;
|
|
36122
36984
|
});
|
|
@@ -36143,9 +37005,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
36143
37005
|
};
|
|
36144
37006
|
});
|
|
36145
37007
|
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
36146
|
-
var
|
|
37008
|
+
var _a18;
|
|
36147
37009
|
$ZodCheck.init(inst, def);
|
|
36148
|
-
(
|
|
37010
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
36149
37011
|
const val = payload.value;
|
|
36150
37012
|
return !nullish(val) && val.length !== void 0;
|
|
36151
37013
|
});
|
|
@@ -36174,7 +37036,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
36174
37036
|
};
|
|
36175
37037
|
});
|
|
36176
37038
|
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
36177
|
-
var
|
|
37039
|
+
var _a18, _b8;
|
|
36178
37040
|
$ZodCheck.init(inst, def);
|
|
36179
37041
|
inst._zod.onattach.push((inst2) => {
|
|
36180
37042
|
const bag = inst2._zod.bag;
|
|
@@ -36185,7 +37047,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
|
|
|
36185
37047
|
}
|
|
36186
37048
|
});
|
|
36187
37049
|
if (def.pattern)
|
|
36188
|
-
(
|
|
37050
|
+
(_a18 = inst._zod).check ?? (_a18.check = (payload) => {
|
|
36189
37051
|
def.pattern.lastIndex = 0;
|
|
36190
37052
|
if (def.pattern.test(payload.value))
|
|
36191
37053
|
return;
|
|
@@ -36387,7 +37249,7 @@ var version = {
|
|
|
36387
37249
|
|
|
36388
37250
|
// node_modules/aieo/node_modules/zod/v4/core/schemas.js
|
|
36389
37251
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
36390
|
-
var
|
|
37252
|
+
var _a18;
|
|
36391
37253
|
inst ?? (inst = {});
|
|
36392
37254
|
inst._zod.def = def;
|
|
36393
37255
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -36402,7 +37264,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
36402
37264
|
}
|
|
36403
37265
|
}
|
|
36404
37266
|
if (checks.length === 0) {
|
|
36405
|
-
(
|
|
37267
|
+
(_a18 = inst._zod).deferred ?? (_a18.deferred = []);
|
|
36406
37268
|
inst._zod.deferred?.push(() => {
|
|
36407
37269
|
inst._zod.run = inst._zod.parse;
|
|
36408
37270
|
});
|
|
@@ -44292,7 +45154,7 @@ var JSONSchemaGenerator = class {
|
|
|
44292
45154
|
this.seen = /* @__PURE__ */ new Map();
|
|
44293
45155
|
}
|
|
44294
45156
|
process(schema, _params = { path: [], schemaPath: [] }) {
|
|
44295
|
-
var
|
|
45157
|
+
var _a18;
|
|
44296
45158
|
const def = schema._zod.def;
|
|
44297
45159
|
const formatMap = {
|
|
44298
45160
|
guid: "uuid",
|
|
@@ -44809,7 +45671,7 @@ var JSONSchemaGenerator = class {
|
|
|
44809
45671
|
delete result.schema.default;
|
|
44810
45672
|
}
|
|
44811
45673
|
if (this.io === "input" && result.schema._prefault)
|
|
44812
|
-
(
|
|
45674
|
+
(_a18 = result.schema).default ?? (_a18.default = result.schema._prefault);
|
|
44813
45675
|
delete result.schema._prefault;
|
|
44814
45676
|
const _result = this.seen.get(schema);
|
|
44815
45677
|
return _result.schema;
|
|
@@ -46246,7 +47108,7 @@ var classic_default = external_exports;
|
|
|
46246
47108
|
// node_modules/aieo/node_modules/zod/v4/index.js
|
|
46247
47109
|
var v4_default2 = classic_default;
|
|
46248
47110
|
|
|
46249
|
-
// node_modules
|
|
47111
|
+
// node_modules/@ai-sdk/provider/dist/index.mjs
|
|
46250
47112
|
var marker = "vercel.ai.error";
|
|
46251
47113
|
var symbol2 = Symbol.for(marker);
|
|
46252
47114
|
var _a;
|
|
@@ -46323,7 +47185,29 @@ var name2 = "AI_EmptyResponseBodyError";
|
|
|
46323
47185
|
var marker3 = `vercel.ai.error.${name2}`;
|
|
46324
47186
|
var symbol3 = Symbol.for(marker3);
|
|
46325
47187
|
var _a3;
|
|
47188
|
+
var EmptyResponseBodyError = class extends AISDKError {
|
|
47189
|
+
// used in isInstance
|
|
47190
|
+
constructor({ message = "Empty response body" } = {}) {
|
|
47191
|
+
super({ name: name2, message });
|
|
47192
|
+
this[_a3] = true;
|
|
47193
|
+
}
|
|
47194
|
+
static isInstance(error82) {
|
|
47195
|
+
return AISDKError.hasMarker(error82, marker3);
|
|
47196
|
+
}
|
|
47197
|
+
};
|
|
46326
47198
|
_a3 = symbol3;
|
|
47199
|
+
function getErrorMessage(error82) {
|
|
47200
|
+
if (error82 == null) {
|
|
47201
|
+
return "unknown error";
|
|
47202
|
+
}
|
|
47203
|
+
if (typeof error82 === "string") {
|
|
47204
|
+
return error82;
|
|
47205
|
+
}
|
|
47206
|
+
if (error82 instanceof Error) {
|
|
47207
|
+
return error82.message;
|
|
47208
|
+
}
|
|
47209
|
+
return JSON.stringify(error82);
|
|
47210
|
+
}
|
|
46327
47211
|
var name3 = "AI_InvalidArgumentError";
|
|
46328
47212
|
var marker4 = `vercel.ai.error.${name3}`;
|
|
46329
47213
|
var symbol4 = Symbol.for(marker4);
|
|
@@ -46347,6 +47231,20 @@ var name4 = "AI_InvalidPromptError";
|
|
|
46347
47231
|
var marker5 = `vercel.ai.error.${name4}`;
|
|
46348
47232
|
var symbol5 = Symbol.for(marker5);
|
|
46349
47233
|
var _a5;
|
|
47234
|
+
var InvalidPromptError = class extends AISDKError {
|
|
47235
|
+
constructor({
|
|
47236
|
+
prompt,
|
|
47237
|
+
message,
|
|
47238
|
+
cause
|
|
47239
|
+
}) {
|
|
47240
|
+
super({ name: name4, message: `Invalid prompt: ${message}`, cause });
|
|
47241
|
+
this[_a5] = true;
|
|
47242
|
+
this.prompt = prompt;
|
|
47243
|
+
}
|
|
47244
|
+
static isInstance(error82) {
|
|
47245
|
+
return AISDKError.hasMarker(error82, marker5);
|
|
47246
|
+
}
|
|
47247
|
+
};
|
|
46350
47248
|
_a5 = symbol5;
|
|
46351
47249
|
var name5 = "AI_InvalidResponseDataError";
|
|
46352
47250
|
var marker6 = `vercel.ai.error.${name5}`;
|
|
@@ -46357,6 +47255,21 @@ var name6 = "AI_JSONParseError";
|
|
|
46357
47255
|
var marker7 = `vercel.ai.error.${name6}`;
|
|
46358
47256
|
var symbol7 = Symbol.for(marker7);
|
|
46359
47257
|
var _a7;
|
|
47258
|
+
var JSONParseError = class extends AISDKError {
|
|
47259
|
+
constructor({ text: text2, cause }) {
|
|
47260
|
+
super({
|
|
47261
|
+
name: name6,
|
|
47262
|
+
message: `JSON parsing failed: Text: ${text2}.
|
|
47263
|
+
Error message: ${getErrorMessage(cause)}`,
|
|
47264
|
+
cause
|
|
47265
|
+
});
|
|
47266
|
+
this[_a7] = true;
|
|
47267
|
+
this.text = text2;
|
|
47268
|
+
}
|
|
47269
|
+
static isInstance(error82) {
|
|
47270
|
+
return AISDKError.hasMarker(error82, marker7);
|
|
47271
|
+
}
|
|
47272
|
+
};
|
|
46360
47273
|
_a7 = symbol7;
|
|
46361
47274
|
var name7 = "AI_LoadAPIKeyError";
|
|
46362
47275
|
var marker8 = `vercel.ai.error.${name7}`;
|
|
@@ -46413,7 +47326,39 @@ var name12 = "AI_TypeValidationError";
|
|
|
46413
47326
|
var marker13 = `vercel.ai.error.${name12}`;
|
|
46414
47327
|
var symbol13 = Symbol.for(marker13);
|
|
46415
47328
|
var _a13;
|
|
47329
|
+
var _TypeValidationError = class _TypeValidationError2 extends AISDKError {
|
|
47330
|
+
constructor({ value, cause }) {
|
|
47331
|
+
super({
|
|
47332
|
+
name: name12,
|
|
47333
|
+
message: `Type validation failed: Value: ${JSON.stringify(value)}.
|
|
47334
|
+
Error message: ${getErrorMessage(cause)}`,
|
|
47335
|
+
cause
|
|
47336
|
+
});
|
|
47337
|
+
this[_a13] = true;
|
|
47338
|
+
this.value = value;
|
|
47339
|
+
}
|
|
47340
|
+
static isInstance(error82) {
|
|
47341
|
+
return AISDKError.hasMarker(error82, marker13);
|
|
47342
|
+
}
|
|
47343
|
+
/**
|
|
47344
|
+
* Wraps an error into a TypeValidationError.
|
|
47345
|
+
* If the cause is already a TypeValidationError with the same value, it returns the cause.
|
|
47346
|
+
* Otherwise, it creates a new TypeValidationError.
|
|
47347
|
+
*
|
|
47348
|
+
* @param {Object} params - The parameters for wrapping the error.
|
|
47349
|
+
* @param {unknown} params.value - The value that failed validation.
|
|
47350
|
+
* @param {unknown} params.cause - The original error or cause of the validation failure.
|
|
47351
|
+
* @returns {TypeValidationError} A TypeValidationError instance.
|
|
47352
|
+
*/
|
|
47353
|
+
static wrap({
|
|
47354
|
+
value,
|
|
47355
|
+
cause
|
|
47356
|
+
}) {
|
|
47357
|
+
return _TypeValidationError2.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError2({ value, cause });
|
|
47358
|
+
}
|
|
47359
|
+
};
|
|
46416
47360
|
_a13 = symbol13;
|
|
47361
|
+
var TypeValidationError = _TypeValidationError;
|
|
46417
47362
|
var name13 = "AI_UnsupportedFunctionalityError";
|
|
46418
47363
|
var marker14 = `vercel.ai.error.${name13}`;
|
|
46419
47364
|
var symbol14 = Symbol.for(marker14);
|
|
@@ -47010,12 +47955,12 @@ var NEVER2 = Object.freeze({
|
|
|
47010
47955
|
// @__NO_SIDE_EFFECTS__
|
|
47011
47956
|
function $constructor2(name18, initializer5, params) {
|
|
47012
47957
|
function init(inst, def) {
|
|
47013
|
-
var
|
|
47958
|
+
var _a18;
|
|
47014
47959
|
Object.defineProperty(inst, "_zod", {
|
|
47015
47960
|
value: inst._zod ?? {},
|
|
47016
47961
|
enumerable: false
|
|
47017
47962
|
});
|
|
47018
|
-
(
|
|
47963
|
+
(_a18 = inst._zod).traits ?? (_a18.traits = /* @__PURE__ */ new Set());
|
|
47019
47964
|
inst._zod.traits.add(name18);
|
|
47020
47965
|
initializer5(inst, def);
|
|
47021
47966
|
for (const k in _.prototype) {
|
|
@@ -47030,10 +47975,10 @@ function $constructor2(name18, initializer5, params) {
|
|
|
47030
47975
|
}
|
|
47031
47976
|
Object.defineProperty(Definition, "name", { value: name18 });
|
|
47032
47977
|
function _(def) {
|
|
47033
|
-
var
|
|
47978
|
+
var _a18;
|
|
47034
47979
|
const inst = params?.Parent ? new Definition() : this;
|
|
47035
47980
|
init(inst, def);
|
|
47036
|
-
(
|
|
47981
|
+
(_a18 = inst._zod).deferred ?? (_a18.deferred = []);
|
|
47037
47982
|
for (const fn of inst._zod.deferred) {
|
|
47038
47983
|
fn();
|
|
47039
47984
|
}
|
|
@@ -47199,10 +48144,10 @@ function assignProp2(target, prop, value) {
|
|
|
47199
48144
|
configurable: true
|
|
47200
48145
|
});
|
|
47201
48146
|
}
|
|
47202
|
-
function getElementAtPath2(obj,
|
|
47203
|
-
if (!
|
|
48147
|
+
function getElementAtPath2(obj, path11) {
|
|
48148
|
+
if (!path11)
|
|
47204
48149
|
return obj;
|
|
47205
|
-
return
|
|
48150
|
+
return path11.reduce((acc, key) => acc?.[key], obj);
|
|
47206
48151
|
}
|
|
47207
48152
|
function promiseAllObject2(promisesObj) {
|
|
47208
48153
|
const keys = Object.keys(promisesObj);
|
|
@@ -47522,11 +48467,11 @@ function aborted2(x, startIndex = 0) {
|
|
|
47522
48467
|
}
|
|
47523
48468
|
return false;
|
|
47524
48469
|
}
|
|
47525
|
-
function prefixIssues2(
|
|
48470
|
+
function prefixIssues2(path11, issues) {
|
|
47526
48471
|
return issues.map((iss) => {
|
|
47527
|
-
var
|
|
47528
|
-
(
|
|
47529
|
-
iss.path.unshift(
|
|
48472
|
+
var _a18;
|
|
48473
|
+
(_a18 = iss).path ?? (_a18.path = []);
|
|
48474
|
+
iss.path.unshift(path11);
|
|
47530
48475
|
return iss;
|
|
47531
48476
|
});
|
|
47532
48477
|
}
|
|
@@ -47663,8 +48608,8 @@ function treeifyError2(error82, _mapper) {
|
|
|
47663
48608
|
return issue3.message;
|
|
47664
48609
|
};
|
|
47665
48610
|
const result = { errors: [] };
|
|
47666
|
-
const processError = (error83,
|
|
47667
|
-
var
|
|
48611
|
+
const processError = (error83, path11 = []) => {
|
|
48612
|
+
var _a18, _b8;
|
|
47668
48613
|
for (const issue3 of error83.issues) {
|
|
47669
48614
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
47670
48615
|
issue3.errors.map((issues) => processError({ issues }, issue3.path));
|
|
@@ -47673,7 +48618,7 @@ function treeifyError2(error82, _mapper) {
|
|
|
47673
48618
|
} else if (issue3.code === "invalid_element") {
|
|
47674
48619
|
processError({ issues: issue3.issues }, issue3.path);
|
|
47675
48620
|
} else {
|
|
47676
|
-
const fullpath = [...
|
|
48621
|
+
const fullpath = [...path11, ...issue3.path];
|
|
47677
48622
|
if (fullpath.length === 0) {
|
|
47678
48623
|
result.errors.push(mapper(issue3));
|
|
47679
48624
|
continue;
|
|
@@ -47685,7 +48630,7 @@ function treeifyError2(error82, _mapper) {
|
|
|
47685
48630
|
const terminal = i === fullpath.length - 1;
|
|
47686
48631
|
if (typeof el === "string") {
|
|
47687
48632
|
curr.properties ?? (curr.properties = {});
|
|
47688
|
-
(
|
|
48633
|
+
(_a18 = curr.properties)[el] ?? (_a18[el] = { errors: [] });
|
|
47689
48634
|
curr = curr.properties[el];
|
|
47690
48635
|
} else {
|
|
47691
48636
|
curr.items ?? (curr.items = []);
|
|
@@ -47703,9 +48648,9 @@ function treeifyError2(error82, _mapper) {
|
|
|
47703
48648
|
processError(error82);
|
|
47704
48649
|
return result;
|
|
47705
48650
|
}
|
|
47706
|
-
function toDotPath2(
|
|
48651
|
+
function toDotPath2(path11) {
|
|
47707
48652
|
const segs = [];
|
|
47708
|
-
for (const seg of
|
|
48653
|
+
for (const seg of path11) {
|
|
47709
48654
|
if (typeof seg === "number")
|
|
47710
48655
|
segs.push(`[${seg}]`);
|
|
47711
48656
|
else if (typeof seg === "symbol")
|
|
@@ -47898,10 +48843,10 @@ var uppercase2 = /^[^a-z]*$/;
|
|
|
47898
48843
|
|
|
47899
48844
|
// node_modules/zod/v4/core/checks.js
|
|
47900
48845
|
var $ZodCheck2 = /* @__PURE__ */ $constructor2("$ZodCheck", (inst, def) => {
|
|
47901
|
-
var
|
|
48846
|
+
var _a18;
|
|
47902
48847
|
inst._zod ?? (inst._zod = {});
|
|
47903
48848
|
inst._zod.def = def;
|
|
47904
|
-
(
|
|
48849
|
+
(_a18 = inst._zod).onattach ?? (_a18.onattach = []);
|
|
47905
48850
|
});
|
|
47906
48851
|
var numericOriginMap2 = {
|
|
47907
48852
|
number: "number",
|
|
@@ -47967,8 +48912,8 @@ var $ZodCheckGreaterThan2 = /* @__PURE__ */ $constructor2("$ZodCheckGreaterThan"
|
|
|
47967
48912
|
var $ZodCheckMultipleOf2 = /* @__PURE__ */ $constructor2("$ZodCheckMultipleOf", (inst, def) => {
|
|
47968
48913
|
$ZodCheck2.init(inst, def);
|
|
47969
48914
|
inst._zod.onattach.push((inst2) => {
|
|
47970
|
-
var
|
|
47971
|
-
(
|
|
48915
|
+
var _a18;
|
|
48916
|
+
(_a18 = inst2._zod.bag).multipleOf ?? (_a18.multipleOf = def.value);
|
|
47972
48917
|
});
|
|
47973
48918
|
inst._zod.check = (payload) => {
|
|
47974
48919
|
if (typeof payload.value !== typeof def.value)
|
|
@@ -48094,9 +49039,9 @@ var $ZodCheckBigIntFormat2 = /* @__PURE__ */ $constructor2("$ZodCheckBigIntForma
|
|
|
48094
49039
|
};
|
|
48095
49040
|
});
|
|
48096
49041
|
var $ZodCheckMaxSize2 = /* @__PURE__ */ $constructor2("$ZodCheckMaxSize", (inst, def) => {
|
|
48097
|
-
var
|
|
49042
|
+
var _a18;
|
|
48098
49043
|
$ZodCheck2.init(inst, def);
|
|
48099
|
-
(
|
|
49044
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
48100
49045
|
const val = payload.value;
|
|
48101
49046
|
return !nullish3(val) && val.size !== void 0;
|
|
48102
49047
|
});
|
|
@@ -48121,9 +49066,9 @@ var $ZodCheckMaxSize2 = /* @__PURE__ */ $constructor2("$ZodCheckMaxSize", (inst,
|
|
|
48121
49066
|
};
|
|
48122
49067
|
});
|
|
48123
49068
|
var $ZodCheckMinSize2 = /* @__PURE__ */ $constructor2("$ZodCheckMinSize", (inst, def) => {
|
|
48124
|
-
var
|
|
49069
|
+
var _a18;
|
|
48125
49070
|
$ZodCheck2.init(inst, def);
|
|
48126
|
-
(
|
|
49071
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
48127
49072
|
const val = payload.value;
|
|
48128
49073
|
return !nullish3(val) && val.size !== void 0;
|
|
48129
49074
|
});
|
|
@@ -48148,9 +49093,9 @@ var $ZodCheckMinSize2 = /* @__PURE__ */ $constructor2("$ZodCheckMinSize", (inst,
|
|
|
48148
49093
|
};
|
|
48149
49094
|
});
|
|
48150
49095
|
var $ZodCheckSizeEquals2 = /* @__PURE__ */ $constructor2("$ZodCheckSizeEquals", (inst, def) => {
|
|
48151
|
-
var
|
|
49096
|
+
var _a18;
|
|
48152
49097
|
$ZodCheck2.init(inst, def);
|
|
48153
|
-
(
|
|
49098
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
48154
49099
|
const val = payload.value;
|
|
48155
49100
|
return !nullish3(val) && val.size !== void 0;
|
|
48156
49101
|
});
|
|
@@ -48178,9 +49123,9 @@ var $ZodCheckSizeEquals2 = /* @__PURE__ */ $constructor2("$ZodCheckSizeEquals",
|
|
|
48178
49123
|
};
|
|
48179
49124
|
});
|
|
48180
49125
|
var $ZodCheckMaxLength2 = /* @__PURE__ */ $constructor2("$ZodCheckMaxLength", (inst, def) => {
|
|
48181
|
-
var
|
|
49126
|
+
var _a18;
|
|
48182
49127
|
$ZodCheck2.init(inst, def);
|
|
48183
|
-
(
|
|
49128
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
48184
49129
|
const val = payload.value;
|
|
48185
49130
|
return !nullish3(val) && val.length !== void 0;
|
|
48186
49131
|
});
|
|
@@ -48207,9 +49152,9 @@ var $ZodCheckMaxLength2 = /* @__PURE__ */ $constructor2("$ZodCheckMaxLength", (i
|
|
|
48207
49152
|
};
|
|
48208
49153
|
});
|
|
48209
49154
|
var $ZodCheckMinLength2 = /* @__PURE__ */ $constructor2("$ZodCheckMinLength", (inst, def) => {
|
|
48210
|
-
var
|
|
49155
|
+
var _a18;
|
|
48211
49156
|
$ZodCheck2.init(inst, def);
|
|
48212
|
-
(
|
|
49157
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
48213
49158
|
const val = payload.value;
|
|
48214
49159
|
return !nullish3(val) && val.length !== void 0;
|
|
48215
49160
|
});
|
|
@@ -48236,9 +49181,9 @@ var $ZodCheckMinLength2 = /* @__PURE__ */ $constructor2("$ZodCheckMinLength", (i
|
|
|
48236
49181
|
};
|
|
48237
49182
|
});
|
|
48238
49183
|
var $ZodCheckLengthEquals2 = /* @__PURE__ */ $constructor2("$ZodCheckLengthEquals", (inst, def) => {
|
|
48239
|
-
var
|
|
49184
|
+
var _a18;
|
|
48240
49185
|
$ZodCheck2.init(inst, def);
|
|
48241
|
-
(
|
|
49186
|
+
(_a18 = inst._zod.def).when ?? (_a18.when = (payload) => {
|
|
48242
49187
|
const val = payload.value;
|
|
48243
49188
|
return !nullish3(val) && val.length !== void 0;
|
|
48244
49189
|
});
|
|
@@ -48267,7 +49212,7 @@ var $ZodCheckLengthEquals2 = /* @__PURE__ */ $constructor2("$ZodCheckLengthEqual
|
|
|
48267
49212
|
};
|
|
48268
49213
|
});
|
|
48269
49214
|
var $ZodCheckStringFormat2 = /* @__PURE__ */ $constructor2("$ZodCheckStringFormat", (inst, def) => {
|
|
48270
|
-
var
|
|
49215
|
+
var _a18, _b8;
|
|
48271
49216
|
$ZodCheck2.init(inst, def);
|
|
48272
49217
|
inst._zod.onattach.push((inst2) => {
|
|
48273
49218
|
const bag = inst2._zod.bag;
|
|
@@ -48278,7 +49223,7 @@ var $ZodCheckStringFormat2 = /* @__PURE__ */ $constructor2("$ZodCheckStringForma
|
|
|
48278
49223
|
}
|
|
48279
49224
|
});
|
|
48280
49225
|
if (def.pattern)
|
|
48281
|
-
(
|
|
49226
|
+
(_a18 = inst._zod).check ?? (_a18.check = (payload) => {
|
|
48282
49227
|
def.pattern.lastIndex = 0;
|
|
48283
49228
|
if (def.pattern.test(payload.value))
|
|
48284
49229
|
return;
|
|
@@ -48479,7 +49424,7 @@ var version2 = {
|
|
|
48479
49424
|
|
|
48480
49425
|
// node_modules/zod/v4/core/schemas.js
|
|
48481
49426
|
var $ZodType2 = /* @__PURE__ */ $constructor2("$ZodType", (inst, def) => {
|
|
48482
|
-
var
|
|
49427
|
+
var _a18;
|
|
48483
49428
|
inst ?? (inst = {});
|
|
48484
49429
|
inst._zod.def = def;
|
|
48485
49430
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -48494,7 +49439,7 @@ var $ZodType2 = /* @__PURE__ */ $constructor2("$ZodType", (inst, def) => {
|
|
|
48494
49439
|
}
|
|
48495
49440
|
}
|
|
48496
49441
|
if (checks.length === 0) {
|
|
48497
|
-
(
|
|
49442
|
+
(_a18 = inst._zod).deferred ?? (_a18.deferred = []);
|
|
48498
49443
|
inst._zod.deferred?.push(() => {
|
|
48499
49444
|
inst._zod.run = inst._zod.parse;
|
|
48500
49445
|
});
|
|
@@ -55860,7 +56805,7 @@ var JSONSchemaGenerator2 = class {
|
|
|
55860
56805
|
this.seen = /* @__PURE__ */ new Map();
|
|
55861
56806
|
}
|
|
55862
56807
|
process(schema, _params = { path: [], schemaPath: [] }) {
|
|
55863
|
-
var
|
|
56808
|
+
var _a18;
|
|
55864
56809
|
const def = schema._zod.def;
|
|
55865
56810
|
const formatMap = {
|
|
55866
56811
|
guid: "uuid",
|
|
@@ -56322,7 +57267,7 @@ var JSONSchemaGenerator2 = class {
|
|
|
56322
57267
|
delete result.schema.default;
|
|
56323
57268
|
}
|
|
56324
57269
|
if (this.io === "input" && result.schema._prefault)
|
|
56325
|
-
(
|
|
57270
|
+
(_a18 = result.schema).default ?? (_a18.default = result.schema._prefault);
|
|
56326
57271
|
delete result.schema._prefault;
|
|
56327
57272
|
const _result = this.seen.get(schema);
|
|
56328
57273
|
return _result.schema;
|
|
@@ -58167,8 +59112,8 @@ function getErrorMap3() {
|
|
|
58167
59112
|
|
|
58168
59113
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
58169
59114
|
var makeIssue = (params) => {
|
|
58170
|
-
const { data, path:
|
|
58171
|
-
const fullPath = [...
|
|
59115
|
+
const { data, path: path11, errorMaps, issueData } = params;
|
|
59116
|
+
const fullPath = [...path11, ...issueData.path || []];
|
|
58172
59117
|
const fullIssue = {
|
|
58173
59118
|
...issueData,
|
|
58174
59119
|
path: fullPath
|
|
@@ -58284,11 +59229,11 @@ var errorUtil;
|
|
|
58284
59229
|
|
|
58285
59230
|
// node_modules/zod/v3/types.js
|
|
58286
59231
|
var ParseInputLazyPath = class {
|
|
58287
|
-
constructor(parent, value,
|
|
59232
|
+
constructor(parent, value, path11, key) {
|
|
58288
59233
|
this._cachedPath = [];
|
|
58289
59234
|
this.parent = parent;
|
|
58290
59235
|
this.data = value;
|
|
58291
|
-
this._path =
|
|
59236
|
+
this._path = path11;
|
|
58292
59237
|
this._key = key;
|
|
58293
59238
|
}
|
|
58294
59239
|
get path() {
|
|
@@ -63342,8 +64287,8 @@ function validateSettings(settings) {
|
|
|
63342
64287
|
const errorObject = result.error;
|
|
63343
64288
|
const issues = errorObject.errors || errorObject.issues || [];
|
|
63344
64289
|
issues.forEach((err) => {
|
|
63345
|
-
const
|
|
63346
|
-
errors.push(`${
|
|
64290
|
+
const path11 = err.path.join(".");
|
|
64291
|
+
errors.push(`${path11 ? `${path11}: ` : ""}${err.message}`);
|
|
63347
64292
|
});
|
|
63348
64293
|
return { valid: false, warnings, errors };
|
|
63349
64294
|
}
|
|
@@ -63877,253 +64822,6 @@ function createClaudeCode(options = {}) {
|
|
|
63877
64822
|
}
|
|
63878
64823
|
var claudeCode = createClaudeCode();
|
|
63879
64824
|
|
|
63880
|
-
// node_modules/@ai-sdk/provider/dist/index.mjs
|
|
63881
|
-
var marker15 = "vercel.ai.error";
|
|
63882
|
-
var symbol16 = Symbol.for(marker15);
|
|
63883
|
-
var _a15;
|
|
63884
|
-
var _AISDKError3 = class _AISDKError4 extends Error {
|
|
63885
|
-
/**
|
|
63886
|
-
* Creates an AI SDK Error.
|
|
63887
|
-
*
|
|
63888
|
-
* @param {Object} params - The parameters for creating the error.
|
|
63889
|
-
* @param {string} params.name - The name of the error.
|
|
63890
|
-
* @param {string} params.message - The error message.
|
|
63891
|
-
* @param {unknown} [params.cause] - The underlying cause of the error.
|
|
63892
|
-
*/
|
|
63893
|
-
constructor({
|
|
63894
|
-
name: name143,
|
|
63895
|
-
message,
|
|
63896
|
-
cause
|
|
63897
|
-
}) {
|
|
63898
|
-
super(message);
|
|
63899
|
-
this[_a15] = true;
|
|
63900
|
-
this.name = name143;
|
|
63901
|
-
this.cause = cause;
|
|
63902
|
-
}
|
|
63903
|
-
/**
|
|
63904
|
-
* Checks if the given error is an AI SDK Error.
|
|
63905
|
-
* @param {unknown} error - The error to check.
|
|
63906
|
-
* @returns {boolean} True if the error is an AI SDK Error, false otherwise.
|
|
63907
|
-
*/
|
|
63908
|
-
static isInstance(error82) {
|
|
63909
|
-
return _AISDKError4.hasMarker(error82, marker15);
|
|
63910
|
-
}
|
|
63911
|
-
static hasMarker(error82, marker153) {
|
|
63912
|
-
const markerSymbol = Symbol.for(marker153);
|
|
63913
|
-
return error82 != null && typeof error82 === "object" && markerSymbol in error82 && typeof error82[markerSymbol] === "boolean" && error82[markerSymbol] === true;
|
|
63914
|
-
}
|
|
63915
|
-
};
|
|
63916
|
-
_a15 = symbol16;
|
|
63917
|
-
var AISDKError2 = _AISDKError3;
|
|
63918
|
-
var name14 = "AI_APICallError";
|
|
63919
|
-
var marker22 = `vercel.ai.error.${name14}`;
|
|
63920
|
-
var symbol23 = Symbol.for(marker22);
|
|
63921
|
-
var _a22;
|
|
63922
|
-
var APICallError2 = class extends AISDKError2 {
|
|
63923
|
-
constructor({
|
|
63924
|
-
message,
|
|
63925
|
-
url: url3,
|
|
63926
|
-
requestBodyValues,
|
|
63927
|
-
statusCode,
|
|
63928
|
-
responseHeaders,
|
|
63929
|
-
responseBody,
|
|
63930
|
-
cause,
|
|
63931
|
-
isRetryable = statusCode != null && (statusCode === 408 || // request timeout
|
|
63932
|
-
statusCode === 409 || // conflict
|
|
63933
|
-
statusCode === 429 || // too many requests
|
|
63934
|
-
statusCode >= 500),
|
|
63935
|
-
// server error
|
|
63936
|
-
data
|
|
63937
|
-
}) {
|
|
63938
|
-
super({ name: name14, message, cause });
|
|
63939
|
-
this[_a22] = true;
|
|
63940
|
-
this.url = url3;
|
|
63941
|
-
this.requestBodyValues = requestBodyValues;
|
|
63942
|
-
this.statusCode = statusCode;
|
|
63943
|
-
this.responseHeaders = responseHeaders;
|
|
63944
|
-
this.responseBody = responseBody;
|
|
63945
|
-
this.isRetryable = isRetryable;
|
|
63946
|
-
this.data = data;
|
|
63947
|
-
}
|
|
63948
|
-
static isInstance(error82) {
|
|
63949
|
-
return AISDKError2.hasMarker(error82, marker22);
|
|
63950
|
-
}
|
|
63951
|
-
};
|
|
63952
|
-
_a22 = symbol23;
|
|
63953
|
-
var name22 = "AI_EmptyResponseBodyError";
|
|
63954
|
-
var marker32 = `vercel.ai.error.${name22}`;
|
|
63955
|
-
var symbol32 = Symbol.for(marker32);
|
|
63956
|
-
var _a32;
|
|
63957
|
-
var EmptyResponseBodyError = class extends AISDKError2 {
|
|
63958
|
-
// used in isInstance
|
|
63959
|
-
constructor({ message = "Empty response body" } = {}) {
|
|
63960
|
-
super({ name: name22, message });
|
|
63961
|
-
this[_a32] = true;
|
|
63962
|
-
}
|
|
63963
|
-
static isInstance(error82) {
|
|
63964
|
-
return AISDKError2.hasMarker(error82, marker32);
|
|
63965
|
-
}
|
|
63966
|
-
};
|
|
63967
|
-
_a32 = symbol32;
|
|
63968
|
-
function getErrorMessage(error82) {
|
|
63969
|
-
if (error82 == null) {
|
|
63970
|
-
return "unknown error";
|
|
63971
|
-
}
|
|
63972
|
-
if (typeof error82 === "string") {
|
|
63973
|
-
return error82;
|
|
63974
|
-
}
|
|
63975
|
-
if (error82 instanceof Error) {
|
|
63976
|
-
return error82.message;
|
|
63977
|
-
}
|
|
63978
|
-
return JSON.stringify(error82);
|
|
63979
|
-
}
|
|
63980
|
-
var name32 = "AI_InvalidArgumentError";
|
|
63981
|
-
var marker42 = `vercel.ai.error.${name32}`;
|
|
63982
|
-
var symbol42 = Symbol.for(marker42);
|
|
63983
|
-
var _a42;
|
|
63984
|
-
var InvalidArgumentError2 = class extends AISDKError2 {
|
|
63985
|
-
constructor({
|
|
63986
|
-
message,
|
|
63987
|
-
cause,
|
|
63988
|
-
argument
|
|
63989
|
-
}) {
|
|
63990
|
-
super({ name: name32, message, cause });
|
|
63991
|
-
this[_a42] = true;
|
|
63992
|
-
this.argument = argument;
|
|
63993
|
-
}
|
|
63994
|
-
static isInstance(error82) {
|
|
63995
|
-
return AISDKError2.hasMarker(error82, marker42);
|
|
63996
|
-
}
|
|
63997
|
-
};
|
|
63998
|
-
_a42 = symbol42;
|
|
63999
|
-
var name42 = "AI_InvalidPromptError";
|
|
64000
|
-
var marker52 = `vercel.ai.error.${name42}`;
|
|
64001
|
-
var symbol52 = Symbol.for(marker52);
|
|
64002
|
-
var _a52;
|
|
64003
|
-
var InvalidPromptError = class extends AISDKError2 {
|
|
64004
|
-
constructor({
|
|
64005
|
-
prompt,
|
|
64006
|
-
message,
|
|
64007
|
-
cause
|
|
64008
|
-
}) {
|
|
64009
|
-
super({ name: name42, message: `Invalid prompt: ${message}`, cause });
|
|
64010
|
-
this[_a52] = true;
|
|
64011
|
-
this.prompt = prompt;
|
|
64012
|
-
}
|
|
64013
|
-
static isInstance(error82) {
|
|
64014
|
-
return AISDKError2.hasMarker(error82, marker52);
|
|
64015
|
-
}
|
|
64016
|
-
};
|
|
64017
|
-
_a52 = symbol52;
|
|
64018
|
-
var name52 = "AI_InvalidResponseDataError";
|
|
64019
|
-
var marker62 = `vercel.ai.error.${name52}`;
|
|
64020
|
-
var symbol62 = Symbol.for(marker62);
|
|
64021
|
-
var _a62;
|
|
64022
|
-
_a62 = symbol62;
|
|
64023
|
-
var name62 = "AI_JSONParseError";
|
|
64024
|
-
var marker72 = `vercel.ai.error.${name62}`;
|
|
64025
|
-
var symbol72 = Symbol.for(marker72);
|
|
64026
|
-
var _a72;
|
|
64027
|
-
var JSONParseError = class extends AISDKError2 {
|
|
64028
|
-
constructor({ text: text2, cause }) {
|
|
64029
|
-
super({
|
|
64030
|
-
name: name62,
|
|
64031
|
-
message: `JSON parsing failed: Text: ${text2}.
|
|
64032
|
-
Error message: ${getErrorMessage(cause)}`,
|
|
64033
|
-
cause
|
|
64034
|
-
});
|
|
64035
|
-
this[_a72] = true;
|
|
64036
|
-
this.text = text2;
|
|
64037
|
-
}
|
|
64038
|
-
static isInstance(error82) {
|
|
64039
|
-
return AISDKError2.hasMarker(error82, marker72);
|
|
64040
|
-
}
|
|
64041
|
-
};
|
|
64042
|
-
_a72 = symbol72;
|
|
64043
|
-
var name72 = "AI_LoadAPIKeyError";
|
|
64044
|
-
var marker82 = `vercel.ai.error.${name72}`;
|
|
64045
|
-
var symbol82 = Symbol.for(marker82);
|
|
64046
|
-
var _a82;
|
|
64047
|
-
_a82 = symbol82;
|
|
64048
|
-
var name82 = "AI_LoadSettingError";
|
|
64049
|
-
var marker92 = `vercel.ai.error.${name82}`;
|
|
64050
|
-
var symbol92 = Symbol.for(marker92);
|
|
64051
|
-
var _a92;
|
|
64052
|
-
_a92 = symbol92;
|
|
64053
|
-
var name92 = "AI_NoContentGeneratedError";
|
|
64054
|
-
var marker102 = `vercel.ai.error.${name92}`;
|
|
64055
|
-
var symbol102 = Symbol.for(marker102);
|
|
64056
|
-
var _a102;
|
|
64057
|
-
_a102 = symbol102;
|
|
64058
|
-
var name102 = "AI_NoSuchModelError";
|
|
64059
|
-
var marker112 = `vercel.ai.error.${name102}`;
|
|
64060
|
-
var symbol112 = Symbol.for(marker112);
|
|
64061
|
-
var _a112;
|
|
64062
|
-
var NoSuchModelError2 = class extends AISDKError2 {
|
|
64063
|
-
constructor({
|
|
64064
|
-
errorName = name102,
|
|
64065
|
-
modelId,
|
|
64066
|
-
modelType,
|
|
64067
|
-
message = `No such ${modelType}: ${modelId}`
|
|
64068
|
-
}) {
|
|
64069
|
-
super({ name: errorName, message });
|
|
64070
|
-
this[_a112] = true;
|
|
64071
|
-
this.modelId = modelId;
|
|
64072
|
-
this.modelType = modelType;
|
|
64073
|
-
}
|
|
64074
|
-
static isInstance(error82) {
|
|
64075
|
-
return AISDKError2.hasMarker(error82, marker112);
|
|
64076
|
-
}
|
|
64077
|
-
};
|
|
64078
|
-
_a112 = symbol112;
|
|
64079
|
-
var name112 = "AI_TooManyEmbeddingValuesForCallError";
|
|
64080
|
-
var marker122 = `vercel.ai.error.${name112}`;
|
|
64081
|
-
var symbol122 = Symbol.for(marker122);
|
|
64082
|
-
var _a122;
|
|
64083
|
-
_a122 = symbol122;
|
|
64084
|
-
var name122 = "AI_TypeValidationError";
|
|
64085
|
-
var marker132 = `vercel.ai.error.${name122}`;
|
|
64086
|
-
var symbol132 = Symbol.for(marker132);
|
|
64087
|
-
var _a132;
|
|
64088
|
-
var _TypeValidationError = class _TypeValidationError2 extends AISDKError2 {
|
|
64089
|
-
constructor({ value, cause }) {
|
|
64090
|
-
super({
|
|
64091
|
-
name: name122,
|
|
64092
|
-
message: `Type validation failed: Value: ${JSON.stringify(value)}.
|
|
64093
|
-
Error message: ${getErrorMessage(cause)}`,
|
|
64094
|
-
cause
|
|
64095
|
-
});
|
|
64096
|
-
this[_a132] = true;
|
|
64097
|
-
this.value = value;
|
|
64098
|
-
}
|
|
64099
|
-
static isInstance(error82) {
|
|
64100
|
-
return AISDKError2.hasMarker(error82, marker132);
|
|
64101
|
-
}
|
|
64102
|
-
/**
|
|
64103
|
-
* Wraps an error into a TypeValidationError.
|
|
64104
|
-
* If the cause is already a TypeValidationError with the same value, it returns the cause.
|
|
64105
|
-
* Otherwise, it creates a new TypeValidationError.
|
|
64106
|
-
*
|
|
64107
|
-
* @param {Object} params - The parameters for wrapping the error.
|
|
64108
|
-
* @param {unknown} params.value - The value that failed validation.
|
|
64109
|
-
* @param {unknown} params.cause - The original error or cause of the validation failure.
|
|
64110
|
-
* @returns {TypeValidationError} A TypeValidationError instance.
|
|
64111
|
-
*/
|
|
64112
|
-
static wrap({
|
|
64113
|
-
value,
|
|
64114
|
-
cause
|
|
64115
|
-
}) {
|
|
64116
|
-
return _TypeValidationError2.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError2({ value, cause });
|
|
64117
|
-
}
|
|
64118
|
-
};
|
|
64119
|
-
_a132 = symbol132;
|
|
64120
|
-
var TypeValidationError = _TypeValidationError;
|
|
64121
|
-
var name132 = "AI_UnsupportedFunctionalityError";
|
|
64122
|
-
var marker142 = `vercel.ai.error.${name132}`;
|
|
64123
|
-
var symbol142 = Symbol.for(marker142);
|
|
64124
|
-
var _a142;
|
|
64125
|
-
_a142 = symbol142;
|
|
64126
|
-
|
|
64127
64825
|
// node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
64128
64826
|
function combineHeaders(...headers) {
|
|
64129
64827
|
return headers.reduce(
|
|
@@ -64183,7 +64881,7 @@ var createIdGenerator2 = ({
|
|
|
64183
64881
|
return generator;
|
|
64184
64882
|
}
|
|
64185
64883
|
if (alphabet.includes(separator)) {
|
|
64186
|
-
throw new
|
|
64884
|
+
throw new InvalidArgumentError({
|
|
64187
64885
|
argument: "separator",
|
|
64188
64886
|
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
|
|
64189
64887
|
});
|
|
@@ -64219,7 +64917,7 @@ function handleFetchError({
|
|
|
64219
64917
|
if (error82 instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error82.message.toLowerCase())) {
|
|
64220
64918
|
const cause = error82.cause;
|
|
64221
64919
|
if (cause != null) {
|
|
64222
|
-
return new
|
|
64920
|
+
return new APICallError({
|
|
64223
64921
|
message: `Cannot connect to API: ${cause.message}`,
|
|
64224
64922
|
cause,
|
|
64225
64923
|
url: url3,
|
|
@@ -64261,10 +64959,10 @@ var getFromApi = async ({
|
|
|
64261
64959
|
requestBodyValues: {}
|
|
64262
64960
|
});
|
|
64263
64961
|
} catch (error82) {
|
|
64264
|
-
if (isAbortError(error82) ||
|
|
64962
|
+
if (isAbortError(error82) || APICallError.isInstance(error82)) {
|
|
64265
64963
|
throw error82;
|
|
64266
64964
|
}
|
|
64267
|
-
throw new
|
|
64965
|
+
throw new APICallError({
|
|
64268
64966
|
message: "Failed to process error response",
|
|
64269
64967
|
cause: error82,
|
|
64270
64968
|
statusCode: response.status,
|
|
@@ -64283,11 +64981,11 @@ var getFromApi = async ({
|
|
|
64283
64981
|
});
|
|
64284
64982
|
} catch (error82) {
|
|
64285
64983
|
if (error82 instanceof Error) {
|
|
64286
|
-
if (isAbortError(error82) ||
|
|
64984
|
+
if (isAbortError(error82) || APICallError.isInstance(error82)) {
|
|
64287
64985
|
throw error82;
|
|
64288
64986
|
}
|
|
64289
64987
|
}
|
|
64290
|
-
throw new
|
|
64988
|
+
throw new APICallError({
|
|
64291
64989
|
message: "Failed to process successful response",
|
|
64292
64990
|
cause: error82,
|
|
64293
64991
|
statusCode: response.status,
|
|
@@ -64529,10 +65227,10 @@ var postToApi = async ({
|
|
|
64529
65227
|
requestBodyValues: body.values
|
|
64530
65228
|
});
|
|
64531
65229
|
} catch (error82) {
|
|
64532
|
-
if (isAbortError(error82) ||
|
|
65230
|
+
if (isAbortError(error82) || APICallError.isInstance(error82)) {
|
|
64533
65231
|
throw error82;
|
|
64534
65232
|
}
|
|
64535
|
-
throw new
|
|
65233
|
+
throw new APICallError({
|
|
64536
65234
|
message: "Failed to process error response",
|
|
64537
65235
|
cause: error82,
|
|
64538
65236
|
statusCode: response.status,
|
|
@@ -64551,11 +65249,11 @@ var postToApi = async ({
|
|
|
64551
65249
|
});
|
|
64552
65250
|
} catch (error82) {
|
|
64553
65251
|
if (error82 instanceof Error) {
|
|
64554
|
-
if (isAbortError(error82) ||
|
|
65252
|
+
if (isAbortError(error82) || APICallError.isInstance(error82)) {
|
|
64555
65253
|
throw error82;
|
|
64556
65254
|
}
|
|
64557
65255
|
}
|
|
64558
|
-
throw new
|
|
65256
|
+
throw new APICallError({
|
|
64559
65257
|
message: "Failed to process successful response",
|
|
64560
65258
|
cause: error82,
|
|
64561
65259
|
statusCode: response.status,
|
|
@@ -64584,7 +65282,7 @@ var createJsonErrorResponseHandler = ({
|
|
|
64584
65282
|
if (responseBody.trim() === "") {
|
|
64585
65283
|
return {
|
|
64586
65284
|
responseHeaders,
|
|
64587
|
-
value: new
|
|
65285
|
+
value: new APICallError({
|
|
64588
65286
|
message: response.statusText,
|
|
64589
65287
|
url: url3,
|
|
64590
65288
|
requestBodyValues,
|
|
@@ -64602,7 +65300,7 @@ var createJsonErrorResponseHandler = ({
|
|
|
64602
65300
|
});
|
|
64603
65301
|
return {
|
|
64604
65302
|
responseHeaders,
|
|
64605
|
-
value: new
|
|
65303
|
+
value: new APICallError({
|
|
64606
65304
|
message: errorToMessage(parsedError),
|
|
64607
65305
|
url: url3,
|
|
64608
65306
|
requestBodyValues,
|
|
@@ -64616,7 +65314,7 @@ var createJsonErrorResponseHandler = ({
|
|
|
64616
65314
|
} catch (parseError) {
|
|
64617
65315
|
return {
|
|
64618
65316
|
responseHeaders,
|
|
64619
|
-
value: new
|
|
65317
|
+
value: new APICallError({
|
|
64620
65318
|
message: response.statusText,
|
|
64621
65319
|
url: url3,
|
|
64622
65320
|
requestBodyValues,
|
|
@@ -64649,7 +65347,7 @@ var createJsonResponseHandler = (responseSchema2) => async ({ response, url: url
|
|
|
64649
65347
|
});
|
|
64650
65348
|
const responseHeaders = extractResponseHeaders(response);
|
|
64651
65349
|
if (!parsedResult.success) {
|
|
64652
|
-
throw new
|
|
65350
|
+
throw new APICallError({
|
|
64653
65351
|
message: "Invalid JSON response",
|
|
64654
65352
|
cause: parsedResult.error,
|
|
64655
65353
|
statusCode: response.status,
|
|
@@ -64708,11 +65406,11 @@ function parseAnyDef2() {
|
|
|
64708
65406
|
return {};
|
|
64709
65407
|
}
|
|
64710
65408
|
function parseArrayDef2(def, refs) {
|
|
64711
|
-
var
|
|
65409
|
+
var _a18, _b8, _c;
|
|
64712
65410
|
const res = {
|
|
64713
65411
|
type: "array"
|
|
64714
65412
|
};
|
|
64715
|
-
if (((
|
|
65413
|
+
if (((_a18 = def.type) == null ? void 0 : _a18._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== ZodFirstPartyTypeKind2.ZodAny) {
|
|
64716
65414
|
res.items = parseDef2(def.type._def, {
|
|
64717
65415
|
...refs,
|
|
64718
65416
|
currentPath: [...refs.currentPath, "items"]
|
|
@@ -65080,8 +65778,8 @@ function escapeNonAlphaNumeric(source) {
|
|
|
65080
65778
|
return result;
|
|
65081
65779
|
}
|
|
65082
65780
|
function addFormat(schema, value, message, refs) {
|
|
65083
|
-
var
|
|
65084
|
-
if (schema.format || ((
|
|
65781
|
+
var _a18;
|
|
65782
|
+
if (schema.format || ((_a18 = schema.anyOf) == null ? void 0 : _a18.some((x) => x.format))) {
|
|
65085
65783
|
if (!schema.anyOf) {
|
|
65086
65784
|
schema.anyOf = [];
|
|
65087
65785
|
}
|
|
@@ -65100,8 +65798,8 @@ function addFormat(schema, value, message, refs) {
|
|
|
65100
65798
|
}
|
|
65101
65799
|
}
|
|
65102
65800
|
function addPattern(schema, regex, message, refs) {
|
|
65103
|
-
var
|
|
65104
|
-
if (schema.pattern || ((
|
|
65801
|
+
var _a18;
|
|
65802
|
+
if (schema.pattern || ((_a18 = schema.allOf) == null ? void 0 : _a18.some((x) => x.pattern))) {
|
|
65105
65803
|
if (!schema.allOf) {
|
|
65106
65804
|
schema.allOf = [];
|
|
65107
65805
|
}
|
|
@@ -65120,7 +65818,7 @@ function addPattern(schema, regex, message, refs) {
|
|
|
65120
65818
|
}
|
|
65121
65819
|
}
|
|
65122
65820
|
function stringifyRegExpWithFlags(regex, refs) {
|
|
65123
|
-
var
|
|
65821
|
+
var _a18;
|
|
65124
65822
|
if (!refs.applyRegexFlags || !regex.flags) {
|
|
65125
65823
|
return regex.source;
|
|
65126
65824
|
}
|
|
@@ -65150,7 +65848,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
65150
65848
|
pattern += source[i];
|
|
65151
65849
|
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
65152
65850
|
inCharRange = false;
|
|
65153
|
-
} else if (source[i + 1] === "-" && ((
|
|
65851
|
+
} else if (source[i + 1] === "-" && ((_a18 = source[i + 2]) == null ? void 0 : _a18.match(/[a-z]/))) {
|
|
65154
65852
|
pattern += source[i];
|
|
65155
65853
|
inCharRange = true;
|
|
65156
65854
|
} else {
|
|
@@ -65202,13 +65900,13 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
65202
65900
|
return pattern;
|
|
65203
65901
|
}
|
|
65204
65902
|
function parseRecordDef2(def, refs) {
|
|
65205
|
-
var
|
|
65903
|
+
var _a18, _b8, _c, _d, _e, _f;
|
|
65206
65904
|
const schema = {
|
|
65207
65905
|
type: "object",
|
|
65208
|
-
additionalProperties: (
|
|
65906
|
+
additionalProperties: (_a18 = parseDef2(def.valueType._def, {
|
|
65209
65907
|
...refs,
|
|
65210
65908
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
65211
|
-
})) != null ?
|
|
65909
|
+
})) != null ? _a18 : refs.allowedAdditionalProperties
|
|
65212
65910
|
};
|
|
65213
65911
|
if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === ZodFirstPartyTypeKind2.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
65214
65912
|
const { type, ...keyType } = parseStringDef2(def.keyType._def, refs);
|
|
@@ -65467,8 +66165,8 @@ function safeIsOptional(schema) {
|
|
|
65467
66165
|
}
|
|
65468
66166
|
}
|
|
65469
66167
|
var parseOptionalDef2 = (def, refs) => {
|
|
65470
|
-
var
|
|
65471
|
-
if (refs.currentPath.toString() === ((
|
|
66168
|
+
var _a18;
|
|
66169
|
+
if (refs.currentPath.toString() === ((_a18 = refs.propertyPath) == null ? void 0 : _a18.toString())) {
|
|
65472
66170
|
return parseDef2(def.innerType._def, refs);
|
|
65473
66171
|
}
|
|
65474
66172
|
const innerSchema = parseDef2(def.innerType._def, {
|
|
@@ -65638,10 +66336,10 @@ var selectParser2 = (def, typeName, refs) => {
|
|
|
65638
66336
|
}
|
|
65639
66337
|
};
|
|
65640
66338
|
function parseDef2(def, refs, forceResolution = false) {
|
|
65641
|
-
var
|
|
66339
|
+
var _a18;
|
|
65642
66340
|
const seenItem = refs.seen.get(def);
|
|
65643
66341
|
if (refs.override) {
|
|
65644
|
-
const overrideResult = (
|
|
66342
|
+
const overrideResult = (_a18 = refs.override) == null ? void 0 : _a18.call(
|
|
65645
66343
|
refs,
|
|
65646
66344
|
def,
|
|
65647
66345
|
refs,
|
|
@@ -65720,34 +66418,34 @@ var getRefs2 = (options) => {
|
|
|
65720
66418
|
};
|
|
65721
66419
|
};
|
|
65722
66420
|
var zodToJsonSchema2 = (schema, options) => {
|
|
65723
|
-
var
|
|
66421
|
+
var _a18;
|
|
65724
66422
|
const refs = getRefs2(options);
|
|
65725
66423
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
65726
|
-
(acc, [
|
|
65727
|
-
var
|
|
66424
|
+
(acc, [name25, schema2]) => {
|
|
66425
|
+
var _a25;
|
|
65728
66426
|
return {
|
|
65729
66427
|
...acc,
|
|
65730
|
-
[
|
|
66428
|
+
[name25]: (_a25 = parseDef2(
|
|
65731
66429
|
schema2._def,
|
|
65732
66430
|
{
|
|
65733
66431
|
...refs,
|
|
65734
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
66432
|
+
currentPath: [...refs.basePath, refs.definitionPath, name25]
|
|
65735
66433
|
},
|
|
65736
66434
|
true
|
|
65737
|
-
)) != null ?
|
|
66435
|
+
)) != null ? _a25 : parseAnyDef2()
|
|
65738
66436
|
};
|
|
65739
66437
|
},
|
|
65740
66438
|
{}
|
|
65741
66439
|
) : void 0;
|
|
65742
66440
|
const name18 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
65743
|
-
const main = (
|
|
66441
|
+
const main = (_a18 = parseDef2(
|
|
65744
66442
|
schema._def,
|
|
65745
66443
|
name18 === void 0 ? refs : {
|
|
65746
66444
|
...refs,
|
|
65747
66445
|
currentPath: [...refs.basePath, refs.definitionPath, name18]
|
|
65748
66446
|
},
|
|
65749
66447
|
false
|
|
65750
|
-
)) != null ?
|
|
66448
|
+
)) != null ? _a18 : parseAnyDef2();
|
|
65751
66449
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
65752
66450
|
if (title !== void 0) {
|
|
65753
66451
|
main.title = title;
|
|
@@ -65771,8 +66469,8 @@ var zodToJsonSchema2 = (schema, options) => {
|
|
|
65771
66469
|
};
|
|
65772
66470
|
var zod_to_json_schema_default = zodToJsonSchema2;
|
|
65773
66471
|
function zod3Schema(zodSchema2, options) {
|
|
65774
|
-
var
|
|
65775
|
-
const useReferences = (
|
|
66472
|
+
var _a18;
|
|
66473
|
+
const useReferences = (_a18 = options == null ? void 0 : options.useReferences) != null ? _a18 : false;
|
|
65776
66474
|
return jsonSchema(
|
|
65777
66475
|
zod_to_json_schema_default(zodSchema2, {
|
|
65778
66476
|
$refStrategy: useReferences ? "root" : "none"
|
|
@@ -65786,8 +66484,8 @@ function zod3Schema(zodSchema2, options) {
|
|
|
65786
66484
|
);
|
|
65787
66485
|
}
|
|
65788
66486
|
function zod4Schema(zodSchema2, options) {
|
|
65789
|
-
var
|
|
65790
|
-
const useReferences = (
|
|
66487
|
+
var _a18;
|
|
66488
|
+
const useReferences = (_a18 = options == null ? void 0 : options.useReferences) != null ? _a18 : false;
|
|
65791
66489
|
const z4JSONSchema = toJSONSchema2(zodSchema2, {
|
|
65792
66490
|
target: "draft-7",
|
|
65793
66491
|
io: "output",
|
|
@@ -65870,18 +66568,18 @@ async function* executeTool({
|
|
|
65870
66568
|
}
|
|
65871
66569
|
|
|
65872
66570
|
// node_modules/@ai-sdk/gateway/dist/index.mjs
|
|
65873
|
-
var
|
|
65874
|
-
var
|
|
65875
|
-
var
|
|
66571
|
+
var marker15 = "vercel.ai.gateway.error";
|
|
66572
|
+
var symbol16 = Symbol.for(marker15);
|
|
66573
|
+
var _a15;
|
|
65876
66574
|
var _b;
|
|
65877
|
-
var GatewayError = class _GatewayError extends (_b = Error,
|
|
66575
|
+
var GatewayError = class _GatewayError extends (_b = Error, _a15 = symbol16, _b) {
|
|
65878
66576
|
constructor({
|
|
65879
66577
|
message,
|
|
65880
66578
|
statusCode = 500,
|
|
65881
66579
|
cause
|
|
65882
66580
|
}) {
|
|
65883
66581
|
super(message);
|
|
65884
|
-
this[
|
|
66582
|
+
this[_a15] = true;
|
|
65885
66583
|
this.statusCode = statusCode;
|
|
65886
66584
|
this.cause = cause;
|
|
65887
66585
|
}
|
|
@@ -65894,27 +66592,27 @@ var GatewayError = class _GatewayError extends (_b = Error, _a16 = symbol17, _b)
|
|
|
65894
66592
|
return _GatewayError.hasMarker(error82);
|
|
65895
66593
|
}
|
|
65896
66594
|
static hasMarker(error82) {
|
|
65897
|
-
return typeof error82 === "object" && error82 !== null &&
|
|
66595
|
+
return typeof error82 === "object" && error82 !== null && symbol16 in error82 && error82[symbol16] === true;
|
|
65898
66596
|
}
|
|
65899
66597
|
};
|
|
65900
|
-
var
|
|
65901
|
-
var
|
|
65902
|
-
var
|
|
65903
|
-
var
|
|
66598
|
+
var name14 = "GatewayAuthenticationError";
|
|
66599
|
+
var marker22 = `vercel.ai.gateway.error.${name14}`;
|
|
66600
|
+
var symbol23 = Symbol.for(marker22);
|
|
66601
|
+
var _a22;
|
|
65904
66602
|
var _b2;
|
|
65905
|
-
var GatewayAuthenticationError = class _GatewayAuthenticationError extends (_b2 = GatewayError,
|
|
66603
|
+
var GatewayAuthenticationError = class _GatewayAuthenticationError extends (_b2 = GatewayError, _a22 = symbol23, _b2) {
|
|
65906
66604
|
constructor({
|
|
65907
66605
|
message = "Authentication failed",
|
|
65908
66606
|
statusCode = 401,
|
|
65909
66607
|
cause
|
|
65910
66608
|
} = {}) {
|
|
65911
66609
|
super({ message, statusCode, cause });
|
|
65912
|
-
this[
|
|
65913
|
-
this.name =
|
|
66610
|
+
this[_a22] = true;
|
|
66611
|
+
this.name = name14;
|
|
65914
66612
|
this.type = "authentication_error";
|
|
65915
66613
|
}
|
|
65916
66614
|
static isInstance(error82) {
|
|
65917
|
-
return GatewayError.hasMarker(error82) &&
|
|
66615
|
+
return GatewayError.hasMarker(error82) && symbol23 in error82;
|
|
65918
66616
|
}
|
|
65919
66617
|
/**
|
|
65920
66618
|
* Creates a contextual error message when authentication fails
|
|
@@ -65965,55 +66663,55 @@ The token is expected to be provided via the 'VERCEL_OIDC_TOKEN' environment var
|
|
|
65965
66663
|
});
|
|
65966
66664
|
}
|
|
65967
66665
|
};
|
|
65968
|
-
var
|
|
65969
|
-
var
|
|
65970
|
-
var
|
|
65971
|
-
var
|
|
66666
|
+
var name22 = "GatewayInvalidRequestError";
|
|
66667
|
+
var marker32 = `vercel.ai.gateway.error.${name22}`;
|
|
66668
|
+
var symbol32 = Symbol.for(marker32);
|
|
66669
|
+
var _a32;
|
|
65972
66670
|
var _b3;
|
|
65973
|
-
var GatewayInvalidRequestError = class extends (_b3 = GatewayError,
|
|
66671
|
+
var GatewayInvalidRequestError = class extends (_b3 = GatewayError, _a32 = symbol32, _b3) {
|
|
65974
66672
|
constructor({
|
|
65975
66673
|
message = "Invalid request",
|
|
65976
66674
|
statusCode = 400,
|
|
65977
66675
|
cause
|
|
65978
66676
|
} = {}) {
|
|
65979
66677
|
super({ message, statusCode, cause });
|
|
65980
|
-
this[
|
|
65981
|
-
this.name =
|
|
66678
|
+
this[_a32] = true;
|
|
66679
|
+
this.name = name22;
|
|
65982
66680
|
this.type = "invalid_request_error";
|
|
65983
66681
|
}
|
|
65984
66682
|
static isInstance(error82) {
|
|
65985
|
-
return GatewayError.hasMarker(error82) &&
|
|
66683
|
+
return GatewayError.hasMarker(error82) && symbol32 in error82;
|
|
65986
66684
|
}
|
|
65987
66685
|
};
|
|
65988
|
-
var
|
|
65989
|
-
var
|
|
65990
|
-
var
|
|
65991
|
-
var
|
|
66686
|
+
var name32 = "GatewayRateLimitError";
|
|
66687
|
+
var marker42 = `vercel.ai.gateway.error.${name32}`;
|
|
66688
|
+
var symbol42 = Symbol.for(marker42);
|
|
66689
|
+
var _a42;
|
|
65992
66690
|
var _b4;
|
|
65993
|
-
var GatewayRateLimitError = class extends (_b4 = GatewayError,
|
|
66691
|
+
var GatewayRateLimitError = class extends (_b4 = GatewayError, _a42 = symbol42, _b4) {
|
|
65994
66692
|
constructor({
|
|
65995
66693
|
message = "Rate limit exceeded",
|
|
65996
66694
|
statusCode = 429,
|
|
65997
66695
|
cause
|
|
65998
66696
|
} = {}) {
|
|
65999
66697
|
super({ message, statusCode, cause });
|
|
66000
|
-
this[
|
|
66001
|
-
this.name =
|
|
66698
|
+
this[_a42] = true;
|
|
66699
|
+
this.name = name32;
|
|
66002
66700
|
this.type = "rate_limit_exceeded";
|
|
66003
66701
|
}
|
|
66004
66702
|
static isInstance(error82) {
|
|
66005
|
-
return GatewayError.hasMarker(error82) &&
|
|
66703
|
+
return GatewayError.hasMarker(error82) && symbol42 in error82;
|
|
66006
66704
|
}
|
|
66007
66705
|
};
|
|
66008
|
-
var
|
|
66009
|
-
var
|
|
66010
|
-
var
|
|
66706
|
+
var name42 = "GatewayModelNotFoundError";
|
|
66707
|
+
var marker52 = `vercel.ai.gateway.error.${name42}`;
|
|
66708
|
+
var symbol52 = Symbol.for(marker52);
|
|
66011
66709
|
var modelNotFoundParamSchema = external_exports2.object({
|
|
66012
66710
|
modelId: external_exports2.string()
|
|
66013
66711
|
});
|
|
66014
|
-
var
|
|
66712
|
+
var _a52;
|
|
66015
66713
|
var _b5;
|
|
66016
|
-
var GatewayModelNotFoundError = class extends (_b5 = GatewayError,
|
|
66714
|
+
var GatewayModelNotFoundError = class extends (_b5 = GatewayError, _a52 = symbol52, _b5) {
|
|
66017
66715
|
constructor({
|
|
66018
66716
|
message = "Model not found",
|
|
66019
66717
|
statusCode = 404,
|
|
@@ -66021,41 +66719,41 @@ var GatewayModelNotFoundError = class extends (_b5 = GatewayError, _a53 = symbol
|
|
|
66021
66719
|
cause
|
|
66022
66720
|
} = {}) {
|
|
66023
66721
|
super({ message, statusCode, cause });
|
|
66024
|
-
this[
|
|
66025
|
-
this.name =
|
|
66722
|
+
this[_a52] = true;
|
|
66723
|
+
this.name = name42;
|
|
66026
66724
|
this.type = "model_not_found";
|
|
66027
66725
|
this.modelId = modelId;
|
|
66028
66726
|
}
|
|
66029
66727
|
static isInstance(error82) {
|
|
66030
|
-
return GatewayError.hasMarker(error82) &&
|
|
66728
|
+
return GatewayError.hasMarker(error82) && symbol52 in error82;
|
|
66031
66729
|
}
|
|
66032
66730
|
};
|
|
66033
|
-
var
|
|
66034
|
-
var
|
|
66035
|
-
var
|
|
66036
|
-
var
|
|
66731
|
+
var name52 = "GatewayInternalServerError";
|
|
66732
|
+
var marker62 = `vercel.ai.gateway.error.${name52}`;
|
|
66733
|
+
var symbol62 = Symbol.for(marker62);
|
|
66734
|
+
var _a62;
|
|
66037
66735
|
var _b6;
|
|
66038
|
-
var GatewayInternalServerError = class extends (_b6 = GatewayError,
|
|
66736
|
+
var GatewayInternalServerError = class extends (_b6 = GatewayError, _a62 = symbol62, _b6) {
|
|
66039
66737
|
constructor({
|
|
66040
66738
|
message = "Internal server error",
|
|
66041
66739
|
statusCode = 500,
|
|
66042
66740
|
cause
|
|
66043
66741
|
} = {}) {
|
|
66044
66742
|
super({ message, statusCode, cause });
|
|
66045
|
-
this[
|
|
66046
|
-
this.name =
|
|
66743
|
+
this[_a62] = true;
|
|
66744
|
+
this.name = name52;
|
|
66047
66745
|
this.type = "internal_server_error";
|
|
66048
66746
|
}
|
|
66049
66747
|
static isInstance(error82) {
|
|
66050
|
-
return GatewayError.hasMarker(error82) &&
|
|
66748
|
+
return GatewayError.hasMarker(error82) && symbol62 in error82;
|
|
66051
66749
|
}
|
|
66052
66750
|
};
|
|
66053
|
-
var
|
|
66054
|
-
var
|
|
66055
|
-
var
|
|
66056
|
-
var
|
|
66751
|
+
var name62 = "GatewayResponseError";
|
|
66752
|
+
var marker72 = `vercel.ai.gateway.error.${name62}`;
|
|
66753
|
+
var symbol72 = Symbol.for(marker72);
|
|
66754
|
+
var _a72;
|
|
66057
66755
|
var _b7;
|
|
66058
|
-
var GatewayResponseError = class extends (_b7 = GatewayError,
|
|
66756
|
+
var GatewayResponseError = class extends (_b7 = GatewayError, _a72 = symbol72, _b7) {
|
|
66059
66757
|
constructor({
|
|
66060
66758
|
message = "Invalid response from Gateway",
|
|
66061
66759
|
statusCode = 502,
|
|
@@ -66064,14 +66762,14 @@ var GatewayResponseError = class extends (_b7 = GatewayError, _a73 = symbol73, _
|
|
|
66064
66762
|
cause
|
|
66065
66763
|
} = {}) {
|
|
66066
66764
|
super({ message, statusCode, cause });
|
|
66067
|
-
this[
|
|
66068
|
-
this.name =
|
|
66765
|
+
this[_a72] = true;
|
|
66766
|
+
this.name = name62;
|
|
66069
66767
|
this.type = "response_error";
|
|
66070
66768
|
this.response = response;
|
|
66071
66769
|
this.validationError = validationError;
|
|
66072
66770
|
}
|
|
66073
66771
|
static isInstance(error82) {
|
|
66074
|
-
return GatewayError.hasMarker(error82) &&
|
|
66772
|
+
return GatewayError.hasMarker(error82) && symbol72 in error82;
|
|
66075
66773
|
}
|
|
66076
66774
|
};
|
|
66077
66775
|
function createGatewayErrorFromResponse({
|
|
@@ -66132,14 +66830,14 @@ var gatewayErrorResponseSchema = external_exports2.object({
|
|
|
66132
66830
|
})
|
|
66133
66831
|
});
|
|
66134
66832
|
function asGatewayError(error82, authMethod) {
|
|
66135
|
-
var
|
|
66833
|
+
var _a84;
|
|
66136
66834
|
if (GatewayError.isInstance(error82)) {
|
|
66137
66835
|
return error82;
|
|
66138
66836
|
}
|
|
66139
|
-
if (
|
|
66837
|
+
if (APICallError.isInstance(error82)) {
|
|
66140
66838
|
return createGatewayErrorFromResponse({
|
|
66141
66839
|
response: extractApiCallResponse(error82),
|
|
66142
|
-
statusCode: (
|
|
66840
|
+
statusCode: (_a84 = error82.statusCode) != null ? _a84 : 500,
|
|
66143
66841
|
defaultMessage: "Gateway request failed",
|
|
66144
66842
|
cause: error82,
|
|
66145
66843
|
authMethod
|
|
@@ -66390,7 +67088,7 @@ var GatewayEmbeddingModel = class {
|
|
|
66390
67088
|
abortSignal,
|
|
66391
67089
|
providerOptions
|
|
66392
67090
|
}) {
|
|
66393
|
-
var
|
|
67091
|
+
var _a84;
|
|
66394
67092
|
const resolvedHeaders = await resolve(this.config.headers());
|
|
66395
67093
|
try {
|
|
66396
67094
|
const {
|
|
@@ -66421,7 +67119,7 @@ var GatewayEmbeddingModel = class {
|
|
|
66421
67119
|
});
|
|
66422
67120
|
return {
|
|
66423
67121
|
embeddings: responseBody.embeddings,
|
|
66424
|
-
usage: (
|
|
67122
|
+
usage: (_a84 = responseBody.usage) != null ? _a84 : void 0,
|
|
66425
67123
|
providerMetadata: responseBody.providerMetadata,
|
|
66426
67124
|
response: { headers: responseHeaders, body: rawValue }
|
|
66427
67125
|
};
|
|
@@ -66445,8 +67143,8 @@ var gatewayEmbeddingResponseSchema = external_exports2.object({
|
|
|
66445
67143
|
providerMetadata: external_exports2.record(external_exports2.string(), external_exports2.record(external_exports2.string(), external_exports2.unknown())).optional()
|
|
66446
67144
|
});
|
|
66447
67145
|
async function getVercelOidcToken() {
|
|
66448
|
-
var
|
|
66449
|
-
const token = (_b8 = (
|
|
67146
|
+
var _a84, _b8;
|
|
67147
|
+
const token = (_b8 = (_a84 = getContext().headers) == null ? void 0 : _a84["x-vercel-oidc-token"]) != null ? _b8 : process.env.VERCEL_OIDC_TOKEN;
|
|
66450
67148
|
if (!token) {
|
|
66451
67149
|
throw new GatewayAuthenticationError({
|
|
66452
67150
|
message: "OIDC token not available",
|
|
@@ -66456,21 +67154,21 @@ async function getVercelOidcToken() {
|
|
|
66456
67154
|
return token;
|
|
66457
67155
|
}
|
|
66458
67156
|
async function getVercelRequestId() {
|
|
66459
|
-
var
|
|
66460
|
-
return (
|
|
67157
|
+
var _a84;
|
|
67158
|
+
return (_a84 = getContext().headers) == null ? void 0 : _a84["x-vercel-id"];
|
|
66461
67159
|
}
|
|
66462
67160
|
var SYMBOL_FOR_REQ_CONTEXT = Symbol.for("@vercel/request-context");
|
|
66463
67161
|
function getContext() {
|
|
66464
|
-
var
|
|
67162
|
+
var _a84, _b8, _c;
|
|
66465
67163
|
const fromSymbol = globalThis;
|
|
66466
|
-
return (_c = (_b8 = (
|
|
67164
|
+
return (_c = (_b8 = (_a84 = fromSymbol[SYMBOL_FOR_REQ_CONTEXT]) == null ? void 0 : _a84.get) == null ? void 0 : _b8.call(_a84)) != null ? _c : {};
|
|
66467
67165
|
}
|
|
66468
67166
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
66469
67167
|
function createGatewayProvider(options = {}) {
|
|
66470
|
-
var
|
|
67168
|
+
var _a84, _b8;
|
|
66471
67169
|
let pendingMetadata = null;
|
|
66472
67170
|
let metadataCache = null;
|
|
66473
|
-
const cacheRefreshMillis = (
|
|
67171
|
+
const cacheRefreshMillis = (_a84 = options.metadataCacheRefreshMillis) != null ? _a84 : 1e3 * 60 * 5;
|
|
66474
67172
|
let lastFetchTime = 0;
|
|
66475
67173
|
const baseURL = (_b8 = withoutTrailingSlash(options.baseURL)) != null ? _b8 : "https://ai-gateway.vercel.sh/v1/ai";
|
|
66476
67174
|
const getHeaders = async () => {
|
|
@@ -66522,8 +67220,8 @@ function createGatewayProvider(options = {}) {
|
|
|
66522
67220
|
});
|
|
66523
67221
|
};
|
|
66524
67222
|
const getAvailableModels = async () => {
|
|
66525
|
-
var
|
|
66526
|
-
const now2 = (_c = (_b9 = (
|
|
67223
|
+
var _a94, _b9, _c;
|
|
67224
|
+
const now2 = (_c = (_b9 = (_a94 = options._internal) == null ? void 0 : _a94.currentDate) == null ? void 0 : _b9.call(_a94).getTime()) != null ? _c : Date.now();
|
|
66527
67225
|
if (!pendingMetadata || now2 - lastFetchTime > cacheRefreshMillis) {
|
|
66528
67226
|
lastFetchTime = now2;
|
|
66529
67227
|
pendingMetadata = new GatewayFetchMetadata({
|
|
@@ -66549,7 +67247,7 @@ function createGatewayProvider(options = {}) {
|
|
|
66549
67247
|
};
|
|
66550
67248
|
provider.getAvailableModels = getAvailableModels;
|
|
66551
67249
|
provider.imageModel = (modelId) => {
|
|
66552
|
-
throw new
|
|
67250
|
+
throw new NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
66553
67251
|
};
|
|
66554
67252
|
provider.languageModel = createLanguageModel;
|
|
66555
67253
|
provider.textEmbeddingModel = (modelId) => {
|
|
@@ -66594,85 +67292,85 @@ var __export2 = (target, all) => {
|
|
|
66594
67292
|
for (var name172 in all)
|
|
66595
67293
|
__defProp2(target, name172, { get: all[name172], enumerable: true });
|
|
66596
67294
|
};
|
|
66597
|
-
var
|
|
66598
|
-
var
|
|
66599
|
-
var
|
|
66600
|
-
var
|
|
66601
|
-
var NoOutputSpecifiedError = class extends
|
|
67295
|
+
var name15 = "AI_NoOutputSpecifiedError";
|
|
67296
|
+
var marker16 = `vercel.ai.error.${name15}`;
|
|
67297
|
+
var symbol17 = Symbol.for(marker16);
|
|
67298
|
+
var _a16;
|
|
67299
|
+
var NoOutputSpecifiedError = class extends AISDKError {
|
|
66602
67300
|
// used in isInstance
|
|
66603
67301
|
constructor({ message = "No output specified." } = {}) {
|
|
66604
|
-
super({ name:
|
|
66605
|
-
this[
|
|
67302
|
+
super({ name: name15, message });
|
|
67303
|
+
this[_a16] = true;
|
|
66606
67304
|
}
|
|
66607
67305
|
static isInstance(error82) {
|
|
66608
|
-
return
|
|
67306
|
+
return AISDKError.hasMarker(error82, marker16);
|
|
66609
67307
|
}
|
|
66610
67308
|
};
|
|
66611
|
-
|
|
66612
|
-
var
|
|
66613
|
-
var
|
|
66614
|
-
var
|
|
66615
|
-
var
|
|
66616
|
-
var
|
|
67309
|
+
_a16 = symbol17;
|
|
67310
|
+
var name23 = "AI_InvalidArgumentError";
|
|
67311
|
+
var marker23 = `vercel.ai.error.${name23}`;
|
|
67312
|
+
var symbol24 = Symbol.for(marker23);
|
|
67313
|
+
var _a23;
|
|
67314
|
+
var InvalidArgumentError2 = class extends AISDKError {
|
|
66617
67315
|
constructor({
|
|
66618
67316
|
parameter,
|
|
66619
67317
|
value,
|
|
66620
67318
|
message
|
|
66621
67319
|
}) {
|
|
66622
67320
|
super({
|
|
66623
|
-
name:
|
|
67321
|
+
name: name23,
|
|
66624
67322
|
message: `Invalid argument for parameter ${parameter}: ${message}`
|
|
66625
67323
|
});
|
|
66626
|
-
this[
|
|
67324
|
+
this[_a23] = true;
|
|
66627
67325
|
this.parameter = parameter;
|
|
66628
67326
|
this.value = value;
|
|
66629
67327
|
}
|
|
66630
67328
|
static isInstance(error82) {
|
|
66631
|
-
return
|
|
67329
|
+
return AISDKError.hasMarker(error82, marker23);
|
|
66632
67330
|
}
|
|
66633
67331
|
};
|
|
66634
|
-
|
|
66635
|
-
var
|
|
66636
|
-
var
|
|
66637
|
-
var
|
|
66638
|
-
var
|
|
66639
|
-
|
|
66640
|
-
var
|
|
66641
|
-
var
|
|
66642
|
-
var
|
|
66643
|
-
var
|
|
66644
|
-
var InvalidToolInputError = class extends
|
|
67332
|
+
_a23 = symbol24;
|
|
67333
|
+
var name33 = "AI_InvalidStreamPartError";
|
|
67334
|
+
var marker33 = `vercel.ai.error.${name33}`;
|
|
67335
|
+
var symbol33 = Symbol.for(marker33);
|
|
67336
|
+
var _a33;
|
|
67337
|
+
_a33 = symbol33;
|
|
67338
|
+
var name43 = "AI_InvalidToolInputError";
|
|
67339
|
+
var marker43 = `vercel.ai.error.${name43}`;
|
|
67340
|
+
var symbol43 = Symbol.for(marker43);
|
|
67341
|
+
var _a43;
|
|
67342
|
+
var InvalidToolInputError = class extends AISDKError {
|
|
66645
67343
|
constructor({
|
|
66646
67344
|
toolInput,
|
|
66647
67345
|
toolName,
|
|
66648
67346
|
cause,
|
|
66649
67347
|
message = `Invalid input for tool ${toolName}: ${getErrorMessage(cause)}`
|
|
66650
67348
|
}) {
|
|
66651
|
-
super({ name:
|
|
66652
|
-
this[
|
|
67349
|
+
super({ name: name43, message, cause });
|
|
67350
|
+
this[_a43] = true;
|
|
66653
67351
|
this.toolInput = toolInput;
|
|
66654
67352
|
this.toolName = toolName;
|
|
66655
67353
|
}
|
|
66656
67354
|
static isInstance(error82) {
|
|
66657
|
-
return
|
|
67355
|
+
return AISDKError.hasMarker(error82, marker43);
|
|
66658
67356
|
}
|
|
66659
67357
|
};
|
|
66660
|
-
|
|
66661
|
-
var
|
|
66662
|
-
var
|
|
66663
|
-
var
|
|
66664
|
-
var
|
|
66665
|
-
|
|
66666
|
-
var
|
|
66667
|
-
var
|
|
66668
|
-
var
|
|
66669
|
-
var
|
|
66670
|
-
|
|
66671
|
-
var
|
|
66672
|
-
var
|
|
66673
|
-
var
|
|
66674
|
-
var
|
|
66675
|
-
var NoObjectGeneratedError = class extends
|
|
67358
|
+
_a43 = symbol43;
|
|
67359
|
+
var name53 = "AI_MCPClientError";
|
|
67360
|
+
var marker53 = `vercel.ai.error.${name53}`;
|
|
67361
|
+
var symbol53 = Symbol.for(marker53);
|
|
67362
|
+
var _a53;
|
|
67363
|
+
_a53 = symbol53;
|
|
67364
|
+
var name63 = "AI_NoImageGeneratedError";
|
|
67365
|
+
var marker63 = `vercel.ai.error.${name63}`;
|
|
67366
|
+
var symbol63 = Symbol.for(marker63);
|
|
67367
|
+
var _a63;
|
|
67368
|
+
_a63 = symbol63;
|
|
67369
|
+
var name72 = "AI_NoObjectGeneratedError";
|
|
67370
|
+
var marker73 = `vercel.ai.error.${name72}`;
|
|
67371
|
+
var symbol73 = Symbol.for(marker73);
|
|
67372
|
+
var _a73;
|
|
67373
|
+
var NoObjectGeneratedError = class extends AISDKError {
|
|
66676
67374
|
constructor({
|
|
66677
67375
|
message = "No object generated.",
|
|
66678
67376
|
cause,
|
|
@@ -66681,76 +67379,76 @@ var NoObjectGeneratedError = class extends AISDKError2 {
|
|
|
66681
67379
|
usage,
|
|
66682
67380
|
finishReason
|
|
66683
67381
|
}) {
|
|
66684
|
-
super({ name:
|
|
66685
|
-
this[
|
|
67382
|
+
super({ name: name72, message, cause });
|
|
67383
|
+
this[_a73] = true;
|
|
66686
67384
|
this.text = text2;
|
|
66687
67385
|
this.response = response;
|
|
66688
67386
|
this.usage = usage;
|
|
66689
67387
|
this.finishReason = finishReason;
|
|
66690
67388
|
}
|
|
66691
67389
|
static isInstance(error82) {
|
|
66692
|
-
return
|
|
67390
|
+
return AISDKError.hasMarker(error82, marker73);
|
|
66693
67391
|
}
|
|
66694
67392
|
};
|
|
66695
|
-
|
|
66696
|
-
var
|
|
66697
|
-
var
|
|
66698
|
-
var
|
|
66699
|
-
var
|
|
66700
|
-
var NoOutputGeneratedError = class extends
|
|
67393
|
+
_a73 = symbol73;
|
|
67394
|
+
var name82 = "AI_NoOutputGeneratedError";
|
|
67395
|
+
var marker82 = `vercel.ai.error.${name82}`;
|
|
67396
|
+
var symbol82 = Symbol.for(marker82);
|
|
67397
|
+
var _a82;
|
|
67398
|
+
var NoOutputGeneratedError = class extends AISDKError {
|
|
66701
67399
|
// used in isInstance
|
|
66702
67400
|
constructor({
|
|
66703
67401
|
message = "No output generated.",
|
|
66704
67402
|
cause
|
|
66705
67403
|
} = {}) {
|
|
66706
|
-
super({ name:
|
|
66707
|
-
this[
|
|
67404
|
+
super({ name: name82, message, cause });
|
|
67405
|
+
this[_a82] = true;
|
|
66708
67406
|
}
|
|
66709
67407
|
static isInstance(error82) {
|
|
66710
|
-
return
|
|
67408
|
+
return AISDKError.hasMarker(error82, marker82);
|
|
66711
67409
|
}
|
|
66712
67410
|
};
|
|
66713
|
-
|
|
66714
|
-
var
|
|
66715
|
-
var
|
|
66716
|
-
var
|
|
66717
|
-
var
|
|
66718
|
-
var NoSuchToolError = class extends
|
|
67411
|
+
_a82 = symbol82;
|
|
67412
|
+
var name92 = "AI_NoSuchToolError";
|
|
67413
|
+
var marker92 = `vercel.ai.error.${name92}`;
|
|
67414
|
+
var symbol92 = Symbol.for(marker92);
|
|
67415
|
+
var _a92;
|
|
67416
|
+
var NoSuchToolError = class extends AISDKError {
|
|
66719
67417
|
constructor({
|
|
66720
67418
|
toolName,
|
|
66721
67419
|
availableTools = void 0,
|
|
66722
67420
|
message = `Model tried to call unavailable tool '${toolName}'. ${availableTools === void 0 ? "No tools are available." : `Available tools: ${availableTools.join(", ")}.`}`
|
|
66723
67421
|
}) {
|
|
66724
|
-
super({ name:
|
|
66725
|
-
this[
|
|
67422
|
+
super({ name: name92, message });
|
|
67423
|
+
this[_a92] = true;
|
|
66726
67424
|
this.toolName = toolName;
|
|
66727
67425
|
this.availableTools = availableTools;
|
|
66728
67426
|
}
|
|
66729
67427
|
static isInstance(error82) {
|
|
66730
|
-
return
|
|
67428
|
+
return AISDKError.hasMarker(error82, marker92);
|
|
66731
67429
|
}
|
|
66732
67430
|
};
|
|
66733
|
-
|
|
66734
|
-
var
|
|
66735
|
-
var
|
|
66736
|
-
var
|
|
66737
|
-
var
|
|
66738
|
-
var ToolCallRepairError = class extends
|
|
67431
|
+
_a92 = symbol92;
|
|
67432
|
+
var name102 = "AI_ToolCallRepairError";
|
|
67433
|
+
var marker102 = `vercel.ai.error.${name102}`;
|
|
67434
|
+
var symbol102 = Symbol.for(marker102);
|
|
67435
|
+
var _a102;
|
|
67436
|
+
var ToolCallRepairError = class extends AISDKError {
|
|
66739
67437
|
constructor({
|
|
66740
67438
|
cause,
|
|
66741
67439
|
originalError,
|
|
66742
67440
|
message = `Error repairing tool call: ${getErrorMessage(cause)}`
|
|
66743
67441
|
}) {
|
|
66744
|
-
super({ name:
|
|
66745
|
-
this[
|
|
67442
|
+
super({ name: name102, message, cause });
|
|
67443
|
+
this[_a102] = true;
|
|
66746
67444
|
this.originalError = originalError;
|
|
66747
67445
|
}
|
|
66748
67446
|
static isInstance(error82) {
|
|
66749
|
-
return
|
|
67447
|
+
return AISDKError.hasMarker(error82, marker102);
|
|
66750
67448
|
}
|
|
66751
67449
|
};
|
|
66752
|
-
|
|
66753
|
-
var UnsupportedModelVersionError = class extends
|
|
67450
|
+
_a102 = symbol102;
|
|
67451
|
+
var UnsupportedModelVersionError = class extends AISDKError {
|
|
66754
67452
|
constructor(options) {
|
|
66755
67453
|
super({
|
|
66756
67454
|
name: "AI_UnsupportedModelVersionError",
|
|
@@ -66761,39 +67459,39 @@ var UnsupportedModelVersionError = class extends AISDKError2 {
|
|
|
66761
67459
|
this.modelId = options.modelId;
|
|
66762
67460
|
}
|
|
66763
67461
|
};
|
|
66764
|
-
var
|
|
66765
|
-
var
|
|
66766
|
-
var
|
|
66767
|
-
var
|
|
66768
|
-
|
|
66769
|
-
var
|
|
66770
|
-
var
|
|
66771
|
-
var
|
|
66772
|
-
var
|
|
66773
|
-
var InvalidMessageRoleError = class extends
|
|
67462
|
+
var name112 = "AI_InvalidDataContentError";
|
|
67463
|
+
var marker112 = `vercel.ai.error.${name112}`;
|
|
67464
|
+
var symbol112 = Symbol.for(marker112);
|
|
67465
|
+
var _a112;
|
|
67466
|
+
_a112 = symbol112;
|
|
67467
|
+
var name122 = "AI_InvalidMessageRoleError";
|
|
67468
|
+
var marker122 = `vercel.ai.error.${name122}`;
|
|
67469
|
+
var symbol122 = Symbol.for(marker122);
|
|
67470
|
+
var _a122;
|
|
67471
|
+
var InvalidMessageRoleError = class extends AISDKError {
|
|
66774
67472
|
constructor({
|
|
66775
67473
|
role,
|
|
66776
67474
|
message = `Invalid message role: '${role}'. Must be one of: "system", "user", "assistant", "tool".`
|
|
66777
67475
|
}) {
|
|
66778
|
-
super({ name:
|
|
66779
|
-
this[
|
|
67476
|
+
super({ name: name122, message });
|
|
67477
|
+
this[_a122] = true;
|
|
66780
67478
|
this.role = role;
|
|
66781
67479
|
}
|
|
66782
67480
|
static isInstance(error82) {
|
|
66783
|
-
return
|
|
67481
|
+
return AISDKError.hasMarker(error82, marker122);
|
|
66784
67482
|
}
|
|
66785
67483
|
};
|
|
66786
|
-
|
|
66787
|
-
var
|
|
66788
|
-
var
|
|
66789
|
-
var
|
|
66790
|
-
var
|
|
66791
|
-
|
|
67484
|
+
_a122 = symbol122;
|
|
67485
|
+
var name132 = "AI_MessageConversionError";
|
|
67486
|
+
var marker132 = `vercel.ai.error.${name132}`;
|
|
67487
|
+
var symbol132 = Symbol.for(marker132);
|
|
67488
|
+
var _a132;
|
|
67489
|
+
_a132 = symbol132;
|
|
66792
67490
|
var name142 = "AI_DownloadError";
|
|
66793
|
-
var
|
|
66794
|
-
var
|
|
66795
|
-
var
|
|
66796
|
-
var DownloadError = class extends
|
|
67491
|
+
var marker142 = `vercel.ai.error.${name142}`;
|
|
67492
|
+
var symbol142 = Symbol.for(marker142);
|
|
67493
|
+
var _a142;
|
|
67494
|
+
var DownloadError = class extends AISDKError {
|
|
66797
67495
|
constructor({
|
|
66798
67496
|
url: url3,
|
|
66799
67497
|
statusCode,
|
|
@@ -66802,21 +67500,21 @@ var DownloadError = class extends AISDKError2 {
|
|
|
66802
67500
|
message = cause == null ? `Failed to download ${url3}: ${statusCode} ${statusText}` : `Failed to download ${url3}: ${cause}`
|
|
66803
67501
|
}) {
|
|
66804
67502
|
super({ name: name142, message, cause });
|
|
66805
|
-
this[
|
|
67503
|
+
this[_a142] = true;
|
|
66806
67504
|
this.url = url3;
|
|
66807
67505
|
this.statusCode = statusCode;
|
|
66808
67506
|
this.statusText = statusText;
|
|
66809
67507
|
}
|
|
66810
67508
|
static isInstance(error82) {
|
|
66811
|
-
return
|
|
67509
|
+
return AISDKError.hasMarker(error82, marker142);
|
|
66812
67510
|
}
|
|
66813
67511
|
};
|
|
66814
|
-
|
|
67512
|
+
_a142 = symbol142;
|
|
66815
67513
|
var name152 = "AI_RetryError";
|
|
66816
67514
|
var marker152 = `vercel.ai.error.${name152}`;
|
|
66817
67515
|
var symbol152 = Symbol.for(marker152);
|
|
66818
67516
|
var _a152;
|
|
66819
|
-
var RetryError = class extends
|
|
67517
|
+
var RetryError = class extends AISDKError {
|
|
66820
67518
|
constructor({
|
|
66821
67519
|
message,
|
|
66822
67520
|
reason,
|
|
@@ -66829,7 +67527,7 @@ var RetryError = class extends AISDKError2 {
|
|
|
66829
67527
|
this.lastError = errors[errors.length - 1];
|
|
66830
67528
|
}
|
|
66831
67529
|
static isInstance(error82) {
|
|
66832
|
-
return
|
|
67530
|
+
return AISDKError.hasMarker(error82, marker152);
|
|
66833
67531
|
}
|
|
66834
67532
|
};
|
|
66835
67533
|
_a152 = symbol152;
|
|
@@ -67016,7 +67714,7 @@ function convertToLanguageModelV2DataContent(content) {
|
|
|
67016
67714
|
content.toString()
|
|
67017
67715
|
);
|
|
67018
67716
|
if (dataUrlMediaType == null || base64Content == null) {
|
|
67019
|
-
throw new
|
|
67717
|
+
throw new AISDKError({
|
|
67020
67718
|
name: "InvalidDataContentError",
|
|
67021
67719
|
message: `Invalid data URL format in content ${content.toString()}`
|
|
67022
67720
|
});
|
|
@@ -67267,14 +67965,14 @@ function prepareCallSettings({
|
|
|
67267
67965
|
}) {
|
|
67268
67966
|
if (maxOutputTokens != null) {
|
|
67269
67967
|
if (!Number.isInteger(maxOutputTokens)) {
|
|
67270
|
-
throw new
|
|
67968
|
+
throw new InvalidArgumentError2({
|
|
67271
67969
|
parameter: "maxOutputTokens",
|
|
67272
67970
|
value: maxOutputTokens,
|
|
67273
67971
|
message: "maxOutputTokens must be an integer"
|
|
67274
67972
|
});
|
|
67275
67973
|
}
|
|
67276
67974
|
if (maxOutputTokens < 1) {
|
|
67277
|
-
throw new
|
|
67975
|
+
throw new InvalidArgumentError2({
|
|
67278
67976
|
parameter: "maxOutputTokens",
|
|
67279
67977
|
value: maxOutputTokens,
|
|
67280
67978
|
message: "maxOutputTokens must be >= 1"
|
|
@@ -67283,7 +67981,7 @@ function prepareCallSettings({
|
|
|
67283
67981
|
}
|
|
67284
67982
|
if (temperature != null) {
|
|
67285
67983
|
if (typeof temperature !== "number") {
|
|
67286
|
-
throw new
|
|
67984
|
+
throw new InvalidArgumentError2({
|
|
67287
67985
|
parameter: "temperature",
|
|
67288
67986
|
value: temperature,
|
|
67289
67987
|
message: "temperature must be a number"
|
|
@@ -67292,7 +67990,7 @@ function prepareCallSettings({
|
|
|
67292
67990
|
}
|
|
67293
67991
|
if (topP != null) {
|
|
67294
67992
|
if (typeof topP !== "number") {
|
|
67295
|
-
throw new
|
|
67993
|
+
throw new InvalidArgumentError2({
|
|
67296
67994
|
parameter: "topP",
|
|
67297
67995
|
value: topP,
|
|
67298
67996
|
message: "topP must be a number"
|
|
@@ -67301,7 +67999,7 @@ function prepareCallSettings({
|
|
|
67301
67999
|
}
|
|
67302
68000
|
if (topK != null) {
|
|
67303
68001
|
if (typeof topK !== "number") {
|
|
67304
|
-
throw new
|
|
68002
|
+
throw new InvalidArgumentError2({
|
|
67305
68003
|
parameter: "topK",
|
|
67306
68004
|
value: topK,
|
|
67307
68005
|
message: "topK must be a number"
|
|
@@ -67310,7 +68008,7 @@ function prepareCallSettings({
|
|
|
67310
68008
|
}
|
|
67311
68009
|
if (presencePenalty != null) {
|
|
67312
68010
|
if (typeof presencePenalty !== "number") {
|
|
67313
|
-
throw new
|
|
68011
|
+
throw new InvalidArgumentError2({
|
|
67314
68012
|
parameter: "presencePenalty",
|
|
67315
68013
|
value: presencePenalty,
|
|
67316
68014
|
message: "presencePenalty must be a number"
|
|
@@ -67319,7 +68017,7 @@ function prepareCallSettings({
|
|
|
67319
68017
|
}
|
|
67320
68018
|
if (frequencyPenalty != null) {
|
|
67321
68019
|
if (typeof frequencyPenalty !== "number") {
|
|
67322
|
-
throw new
|
|
68020
|
+
throw new InvalidArgumentError2({
|
|
67323
68021
|
parameter: "frequencyPenalty",
|
|
67324
68022
|
value: frequencyPenalty,
|
|
67325
68023
|
message: "frequencyPenalty must be a number"
|
|
@@ -67328,7 +68026,7 @@ function prepareCallSettings({
|
|
|
67328
68026
|
}
|
|
67329
68027
|
if (seed != null) {
|
|
67330
68028
|
if (!Number.isInteger(seed)) {
|
|
67331
|
-
throw new
|
|
68029
|
+
throw new InvalidArgumentError2({
|
|
67332
68030
|
parameter: "seed",
|
|
67333
68031
|
value: seed,
|
|
67334
68032
|
message: "seed must be an integer"
|
|
@@ -67577,7 +68275,7 @@ async function standardizePrompt(prompt) {
|
|
|
67577
68275
|
}
|
|
67578
68276
|
function wrapGatewayError(error82) {
|
|
67579
68277
|
if (GatewayAuthenticationError.isInstance(error82) || GatewayModelNotFoundError.isInstance(error82)) {
|
|
67580
|
-
return new
|
|
68278
|
+
return new AISDKError({
|
|
67581
68279
|
name: "GatewayError",
|
|
67582
68280
|
message: "Vercel AI Gateway access failed. If you want to use AI SDK providers directly, use the providers, e.g. @ai-sdk/openai, or register a different global default provider.",
|
|
67583
68281
|
cause: error82
|
|
@@ -67864,7 +68562,7 @@ async function _retryWithExponentialBackoff(f, {
|
|
|
67864
68562
|
errors: newErrors
|
|
67865
68563
|
});
|
|
67866
68564
|
}
|
|
67867
|
-
if (error82 instanceof Error &&
|
|
68565
|
+
if (error82 instanceof Error && APICallError.isInstance(error82) && error82.isRetryable === true && tryNumber <= maxRetries) {
|
|
67868
68566
|
await delay(
|
|
67869
68567
|
getRetryDelayInMs({
|
|
67870
68568
|
error: error82,
|
|
@@ -67899,14 +68597,14 @@ function prepareRetries({
|
|
|
67899
68597
|
}) {
|
|
67900
68598
|
if (maxRetries != null) {
|
|
67901
68599
|
if (!Number.isInteger(maxRetries)) {
|
|
67902
|
-
throw new
|
|
68600
|
+
throw new InvalidArgumentError2({
|
|
67903
68601
|
parameter: "maxRetries",
|
|
67904
68602
|
value: maxRetries,
|
|
67905
68603
|
message: "maxRetries must be an integer"
|
|
67906
68604
|
});
|
|
67907
68605
|
}
|
|
67908
68606
|
if (maxRetries < 0) {
|
|
67909
|
-
throw new
|
|
68607
|
+
throw new InvalidArgumentError2({
|
|
67910
68608
|
parameter: "maxRetries",
|
|
67911
68609
|
value: maxRetries,
|
|
67912
68610
|
message: "maxRetries must be >= 0"
|
|
@@ -68911,7 +69609,7 @@ function processUIMessageStream({
|
|
|
68911
69609
|
return toolInvocation;
|
|
68912
69610
|
}
|
|
68913
69611
|
function updateToolPart(options) {
|
|
68914
|
-
var
|
|
69612
|
+
var _a18;
|
|
68915
69613
|
const part = state.message.parts.find(
|
|
68916
69614
|
(part2) => isToolUIPart(part2) && part2.toolCallId === options.toolCallId
|
|
68917
69615
|
);
|
|
@@ -68924,7 +69622,7 @@ function processUIMessageStream({
|
|
|
68924
69622
|
anyPart.errorText = anyOptions.errorText;
|
|
68925
69623
|
anyPart.rawInput = anyOptions.rawInput;
|
|
68926
69624
|
anyPart.preliminary = anyOptions.preliminary;
|
|
68927
|
-
anyPart.providerExecuted = (
|
|
69625
|
+
anyPart.providerExecuted = (_a18 = anyOptions.providerExecuted) != null ? _a18 : part.providerExecuted;
|
|
68928
69626
|
if (anyOptions.providerMetadata != null && part.state === "input-available") {
|
|
68929
69627
|
part.callProviderMetadata = anyOptions.providerMetadata;
|
|
68930
69628
|
}
|
|
@@ -68944,7 +69642,7 @@ function processUIMessageStream({
|
|
|
68944
69642
|
}
|
|
68945
69643
|
}
|
|
68946
69644
|
function updateDynamicToolPart(options) {
|
|
68947
|
-
var
|
|
69645
|
+
var _a18;
|
|
68948
69646
|
const part = state.message.parts.find(
|
|
68949
69647
|
(part2) => part2.type === "dynamic-tool" && part2.toolCallId === options.toolCallId
|
|
68950
69648
|
);
|
|
@@ -68956,7 +69654,7 @@ function processUIMessageStream({
|
|
|
68956
69654
|
anyPart.input = anyOptions.input;
|
|
68957
69655
|
anyPart.output = anyOptions.output;
|
|
68958
69656
|
anyPart.errorText = anyOptions.errorText;
|
|
68959
|
-
anyPart.rawInput = (
|
|
69657
|
+
anyPart.rawInput = (_a18 = anyOptions.rawInput) != null ? _a18 : anyPart.rawInput;
|
|
68960
69658
|
anyPart.preliminary = anyOptions.preliminary;
|
|
68961
69659
|
if (anyOptions.providerMetadata != null && part.state === "input-available") {
|
|
68962
69660
|
part.callProviderMetadata = anyOptions.providerMetadata;
|
|
@@ -70443,7 +71141,7 @@ var DefaultStreamTextResult = class {
|
|
|
70443
71141
|
streamWithToolResults.pipeThrough(
|
|
70444
71142
|
new TransformStream({
|
|
70445
71143
|
async transform(chunk, controller) {
|
|
70446
|
-
var
|
|
71144
|
+
var _a18, _b22, _c2, _d2;
|
|
70447
71145
|
if (chunk.type === "stream-start") {
|
|
70448
71146
|
warnings = chunk.warnings;
|
|
70449
71147
|
return;
|
|
@@ -70515,7 +71213,7 @@ var DefaultStreamTextResult = class {
|
|
|
70515
71213
|
}
|
|
70516
71214
|
case "response-metadata": {
|
|
70517
71215
|
stepResponse = {
|
|
70518
|
-
id: (
|
|
71216
|
+
id: (_a18 = chunk.id) != null ? _a18 : stepResponse.id,
|
|
70519
71217
|
timestamp: (_b22 = chunk.timestamp) != null ? _b22 : stepResponse.timestamp,
|
|
70520
71218
|
modelId: (_c2 = chunk.modelId) != null ? _c2 : stepResponse.modelId
|
|
70521
71219
|
};
|
|
@@ -71235,8 +71933,8 @@ var object3 = ({
|
|
|
71235
71933
|
}
|
|
71236
71934
|
};
|
|
71237
71935
|
};
|
|
71238
|
-
var
|
|
71239
|
-
var marker162 = `vercel.ai.error.${
|
|
71936
|
+
var name16 = "AI_NoSuchProviderError";
|
|
71937
|
+
var marker162 = `vercel.ai.error.${name16}`;
|
|
71240
71938
|
var symbol162 = Symbol.for(marker162);
|
|
71241
71939
|
var _a162;
|
|
71242
71940
|
_a162 = symbol162;
|
|
@@ -71512,10 +72210,10 @@ for (let i = 0; i < 256; ++i) {
|
|
|
71512
72210
|
}
|
|
71513
72211
|
var rnds8Pool2 = new Uint8Array(256);
|
|
71514
72212
|
var poolPtr2 = rnds8Pool2.length;
|
|
71515
|
-
var
|
|
71516
|
-
var
|
|
71517
|
-
var
|
|
71518
|
-
var
|
|
72213
|
+
var marker17 = "vercel.ai.error";
|
|
72214
|
+
var symbol18 = Symbol.for(marker17);
|
|
72215
|
+
var _a17;
|
|
72216
|
+
var _AISDKError3 = class _AISDKError22 extends Error {
|
|
71519
72217
|
/**
|
|
71520
72218
|
* Creates an AI SDK Error.
|
|
71521
72219
|
*
|
|
@@ -71530,7 +72228,7 @@ var _AISDKError5 = class _AISDKError22 extends Error {
|
|
|
71530
72228
|
cause
|
|
71531
72229
|
}) {
|
|
71532
72230
|
super(message);
|
|
71533
|
-
this[
|
|
72231
|
+
this[_a17] = true;
|
|
71534
72232
|
this.name = name143;
|
|
71535
72233
|
this.cause = cause;
|
|
71536
72234
|
}
|
|
@@ -71540,20 +72238,20 @@ var _AISDKError5 = class _AISDKError22 extends Error {
|
|
|
71540
72238
|
* @returns {boolean} True if the error is an AI SDK Error, false otherwise.
|
|
71541
72239
|
*/
|
|
71542
72240
|
static isInstance(error82) {
|
|
71543
|
-
return _AISDKError22.hasMarker(error82,
|
|
72241
|
+
return _AISDKError22.hasMarker(error82, marker17);
|
|
71544
72242
|
}
|
|
71545
72243
|
static hasMarker(error82, marker153) {
|
|
71546
72244
|
const markerSymbol = Symbol.for(marker153);
|
|
71547
72245
|
return error82 != null && typeof error82 === "object" && markerSymbol in error82 && typeof error82[markerSymbol] === "boolean" && error82[markerSymbol] === true;
|
|
71548
72246
|
}
|
|
71549
72247
|
};
|
|
71550
|
-
|
|
71551
|
-
var
|
|
72248
|
+
_a17 = symbol18;
|
|
72249
|
+
var AISDKError2 = _AISDKError3;
|
|
71552
72250
|
var name17 = "AI_APICallError";
|
|
71553
|
-
var
|
|
71554
|
-
var
|
|
71555
|
-
var
|
|
71556
|
-
var
|
|
72251
|
+
var marker24 = `vercel.ai.error.${name17}`;
|
|
72252
|
+
var symbol25 = Symbol.for(marker24);
|
|
72253
|
+
var _a24;
|
|
72254
|
+
var APICallError2 = class extends AISDKError2 {
|
|
71557
72255
|
constructor({
|
|
71558
72256
|
message,
|
|
71559
72257
|
url: url3,
|
|
@@ -71570,7 +72268,7 @@ var APICallError3 = class extends AISDKError3 {
|
|
|
71570
72268
|
data
|
|
71571
72269
|
}) {
|
|
71572
72270
|
super({ name: name17, message, cause });
|
|
71573
|
-
this[
|
|
72271
|
+
this[_a24] = true;
|
|
71574
72272
|
this.url = url3;
|
|
71575
72273
|
this.requestBodyValues = requestBodyValues;
|
|
71576
72274
|
this.statusCode = statusCode;
|
|
@@ -71580,25 +72278,25 @@ var APICallError3 = class extends AISDKError3 {
|
|
|
71580
72278
|
this.data = data;
|
|
71581
72279
|
}
|
|
71582
72280
|
static isInstance(error82) {
|
|
71583
|
-
return
|
|
72281
|
+
return AISDKError2.hasMarker(error82, marker24);
|
|
71584
72282
|
}
|
|
71585
72283
|
};
|
|
71586
|
-
|
|
71587
|
-
var
|
|
71588
|
-
var
|
|
71589
|
-
var
|
|
71590
|
-
var
|
|
71591
|
-
var EmptyResponseBodyError2 = class extends
|
|
72284
|
+
_a24 = symbol25;
|
|
72285
|
+
var name24 = "AI_EmptyResponseBodyError";
|
|
72286
|
+
var marker34 = `vercel.ai.error.${name24}`;
|
|
72287
|
+
var symbol34 = Symbol.for(marker34);
|
|
72288
|
+
var _a34;
|
|
72289
|
+
var EmptyResponseBodyError2 = class extends AISDKError2 {
|
|
71592
72290
|
// used in isInstance
|
|
71593
72291
|
constructor({ message = "Empty response body" } = {}) {
|
|
71594
|
-
super({ name:
|
|
71595
|
-
this[
|
|
72292
|
+
super({ name: name24, message });
|
|
72293
|
+
this[_a34] = true;
|
|
71596
72294
|
}
|
|
71597
72295
|
static isInstance(error82) {
|
|
71598
|
-
return
|
|
72296
|
+
return AISDKError2.hasMarker(error82, marker34);
|
|
71599
72297
|
}
|
|
71600
72298
|
};
|
|
71601
|
-
|
|
72299
|
+
_a34 = symbol34;
|
|
71602
72300
|
function getErrorMessage3(error82) {
|
|
71603
72301
|
if (error82 == null) {
|
|
71604
72302
|
return "unknown error";
|
|
@@ -71611,166 +72309,166 @@ function getErrorMessage3(error82) {
|
|
|
71611
72309
|
}
|
|
71612
72310
|
return JSON.stringify(error82);
|
|
71613
72311
|
}
|
|
71614
|
-
var
|
|
71615
|
-
var
|
|
71616
|
-
var
|
|
71617
|
-
var
|
|
71618
|
-
var
|
|
72312
|
+
var name34 = "AI_InvalidArgumentError";
|
|
72313
|
+
var marker44 = `vercel.ai.error.${name34}`;
|
|
72314
|
+
var symbol44 = Symbol.for(marker44);
|
|
72315
|
+
var _a44;
|
|
72316
|
+
var InvalidArgumentError3 = class extends AISDKError2 {
|
|
71619
72317
|
constructor({
|
|
71620
72318
|
message,
|
|
71621
72319
|
cause,
|
|
71622
72320
|
argument
|
|
71623
72321
|
}) {
|
|
71624
|
-
super({ name:
|
|
71625
|
-
this[
|
|
72322
|
+
super({ name: name34, message, cause });
|
|
72323
|
+
this[_a44] = true;
|
|
71626
72324
|
this.argument = argument;
|
|
71627
72325
|
}
|
|
71628
72326
|
static isInstance(error82) {
|
|
71629
|
-
return
|
|
72327
|
+
return AISDKError2.hasMarker(error82, marker44);
|
|
71630
72328
|
}
|
|
71631
72329
|
};
|
|
71632
|
-
|
|
71633
|
-
var
|
|
71634
|
-
var
|
|
71635
|
-
var
|
|
71636
|
-
var
|
|
71637
|
-
var InvalidPromptError2 = class extends
|
|
72330
|
+
_a44 = symbol44;
|
|
72331
|
+
var name44 = "AI_InvalidPromptError";
|
|
72332
|
+
var marker54 = `vercel.ai.error.${name44}`;
|
|
72333
|
+
var symbol54 = Symbol.for(marker54);
|
|
72334
|
+
var _a54;
|
|
72335
|
+
var InvalidPromptError2 = class extends AISDKError2 {
|
|
71638
72336
|
constructor({
|
|
71639
72337
|
prompt,
|
|
71640
72338
|
message,
|
|
71641
72339
|
cause
|
|
71642
72340
|
}) {
|
|
71643
|
-
super({ name:
|
|
71644
|
-
this[
|
|
72341
|
+
super({ name: name44, message: `Invalid prompt: ${message}`, cause });
|
|
72342
|
+
this[_a54] = true;
|
|
71645
72343
|
this.prompt = prompt;
|
|
71646
72344
|
}
|
|
71647
72345
|
static isInstance(error82) {
|
|
71648
|
-
return
|
|
72346
|
+
return AISDKError2.hasMarker(error82, marker54);
|
|
71649
72347
|
}
|
|
71650
72348
|
};
|
|
71651
|
-
|
|
71652
|
-
var
|
|
71653
|
-
var
|
|
71654
|
-
var
|
|
71655
|
-
var
|
|
71656
|
-
var InvalidResponseDataError = class extends
|
|
72349
|
+
_a54 = symbol54;
|
|
72350
|
+
var name54 = "AI_InvalidResponseDataError";
|
|
72351
|
+
var marker64 = `vercel.ai.error.${name54}`;
|
|
72352
|
+
var symbol64 = Symbol.for(marker64);
|
|
72353
|
+
var _a64;
|
|
72354
|
+
var InvalidResponseDataError = class extends AISDKError2 {
|
|
71657
72355
|
constructor({
|
|
71658
72356
|
data,
|
|
71659
72357
|
message = `Invalid response data: ${JSON.stringify(data)}.`
|
|
71660
72358
|
}) {
|
|
71661
|
-
super({ name:
|
|
71662
|
-
this[
|
|
72359
|
+
super({ name: name54, message });
|
|
72360
|
+
this[_a64] = true;
|
|
71663
72361
|
this.data = data;
|
|
71664
72362
|
}
|
|
71665
72363
|
static isInstance(error82) {
|
|
71666
|
-
return
|
|
72364
|
+
return AISDKError2.hasMarker(error82, marker64);
|
|
71667
72365
|
}
|
|
71668
72366
|
};
|
|
71669
|
-
|
|
71670
|
-
var
|
|
71671
|
-
var
|
|
71672
|
-
var
|
|
71673
|
-
var
|
|
71674
|
-
var JSONParseError2 = class extends
|
|
72367
|
+
_a64 = symbol64;
|
|
72368
|
+
var name64 = "AI_JSONParseError";
|
|
72369
|
+
var marker74 = `vercel.ai.error.${name64}`;
|
|
72370
|
+
var symbol74 = Symbol.for(marker74);
|
|
72371
|
+
var _a74;
|
|
72372
|
+
var JSONParseError2 = class extends AISDKError2 {
|
|
71675
72373
|
constructor({ text: text2, cause }) {
|
|
71676
72374
|
super({
|
|
71677
|
-
name:
|
|
72375
|
+
name: name64,
|
|
71678
72376
|
message: `JSON parsing failed: Text: ${text2}.
|
|
71679
72377
|
Error message: ${getErrorMessage3(cause)}`,
|
|
71680
72378
|
cause
|
|
71681
72379
|
});
|
|
71682
|
-
this[
|
|
72380
|
+
this[_a74] = true;
|
|
71683
72381
|
this.text = text2;
|
|
71684
72382
|
}
|
|
71685
72383
|
static isInstance(error82) {
|
|
71686
|
-
return
|
|
72384
|
+
return AISDKError2.hasMarker(error82, marker74);
|
|
71687
72385
|
}
|
|
71688
72386
|
};
|
|
71689
|
-
|
|
71690
|
-
var
|
|
71691
|
-
var
|
|
71692
|
-
var
|
|
71693
|
-
var
|
|
71694
|
-
var LoadAPIKeyError2 = class extends
|
|
72387
|
+
_a74 = symbol74;
|
|
72388
|
+
var name73 = "AI_LoadAPIKeyError";
|
|
72389
|
+
var marker83 = `vercel.ai.error.${name73}`;
|
|
72390
|
+
var symbol83 = Symbol.for(marker83);
|
|
72391
|
+
var _a83;
|
|
72392
|
+
var LoadAPIKeyError2 = class extends AISDKError2 {
|
|
71695
72393
|
// used in isInstance
|
|
71696
72394
|
constructor({ message }) {
|
|
71697
|
-
super({ name:
|
|
71698
|
-
this[
|
|
72395
|
+
super({ name: name73, message });
|
|
72396
|
+
this[_a83] = true;
|
|
71699
72397
|
}
|
|
71700
72398
|
static isInstance(error82) {
|
|
71701
|
-
return
|
|
72399
|
+
return AISDKError2.hasMarker(error82, marker83);
|
|
71702
72400
|
}
|
|
71703
72401
|
};
|
|
71704
|
-
|
|
71705
|
-
var
|
|
71706
|
-
var
|
|
71707
|
-
var
|
|
71708
|
-
var
|
|
71709
|
-
|
|
71710
|
-
var
|
|
71711
|
-
var
|
|
71712
|
-
var
|
|
71713
|
-
var
|
|
71714
|
-
|
|
71715
|
-
var
|
|
71716
|
-
var
|
|
71717
|
-
var
|
|
71718
|
-
var
|
|
71719
|
-
var
|
|
72402
|
+
_a83 = symbol83;
|
|
72403
|
+
var name83 = "AI_LoadSettingError";
|
|
72404
|
+
var marker93 = `vercel.ai.error.${name83}`;
|
|
72405
|
+
var symbol93 = Symbol.for(marker93);
|
|
72406
|
+
var _a93;
|
|
72407
|
+
_a93 = symbol93;
|
|
72408
|
+
var name93 = "AI_NoContentGeneratedError";
|
|
72409
|
+
var marker103 = `vercel.ai.error.${name93}`;
|
|
72410
|
+
var symbol103 = Symbol.for(marker103);
|
|
72411
|
+
var _a103;
|
|
72412
|
+
_a103 = symbol103;
|
|
72413
|
+
var name103 = "AI_NoSuchModelError";
|
|
72414
|
+
var marker113 = `vercel.ai.error.${name103}`;
|
|
72415
|
+
var symbol113 = Symbol.for(marker113);
|
|
72416
|
+
var _a113;
|
|
72417
|
+
var NoSuchModelError2 = class extends AISDKError2 {
|
|
71720
72418
|
constructor({
|
|
71721
|
-
errorName =
|
|
72419
|
+
errorName = name103,
|
|
71722
72420
|
modelId,
|
|
71723
72421
|
modelType,
|
|
71724
72422
|
message = `No such ${modelType}: ${modelId}`
|
|
71725
72423
|
}) {
|
|
71726
72424
|
super({ name: errorName, message });
|
|
71727
|
-
this[
|
|
72425
|
+
this[_a113] = true;
|
|
71728
72426
|
this.modelId = modelId;
|
|
71729
72427
|
this.modelType = modelType;
|
|
71730
72428
|
}
|
|
71731
72429
|
static isInstance(error82) {
|
|
71732
|
-
return
|
|
72430
|
+
return AISDKError2.hasMarker(error82, marker113);
|
|
71733
72431
|
}
|
|
71734
72432
|
};
|
|
71735
|
-
|
|
71736
|
-
var
|
|
71737
|
-
var
|
|
71738
|
-
var
|
|
71739
|
-
var
|
|
71740
|
-
var TooManyEmbeddingValuesForCallError = class extends
|
|
72433
|
+
_a113 = symbol113;
|
|
72434
|
+
var name113 = "AI_TooManyEmbeddingValuesForCallError";
|
|
72435
|
+
var marker123 = `vercel.ai.error.${name113}`;
|
|
72436
|
+
var symbol123 = Symbol.for(marker123);
|
|
72437
|
+
var _a123;
|
|
72438
|
+
var TooManyEmbeddingValuesForCallError = class extends AISDKError2 {
|
|
71741
72439
|
constructor(options) {
|
|
71742
72440
|
super({
|
|
71743
|
-
name:
|
|
72441
|
+
name: name113,
|
|
71744
72442
|
message: `Too many values for a single embedding call. The ${options.provider} model "${options.modelId}" can only embed up to ${options.maxEmbeddingsPerCall} values per call, but ${options.values.length} values were provided.`
|
|
71745
72443
|
});
|
|
71746
|
-
this[
|
|
72444
|
+
this[_a123] = true;
|
|
71747
72445
|
this.provider = options.provider;
|
|
71748
72446
|
this.modelId = options.modelId;
|
|
71749
72447
|
this.maxEmbeddingsPerCall = options.maxEmbeddingsPerCall;
|
|
71750
72448
|
this.values = options.values;
|
|
71751
72449
|
}
|
|
71752
72450
|
static isInstance(error82) {
|
|
71753
|
-
return
|
|
72451
|
+
return AISDKError2.hasMarker(error82, marker123);
|
|
71754
72452
|
}
|
|
71755
72453
|
};
|
|
71756
|
-
|
|
71757
|
-
var
|
|
71758
|
-
var
|
|
71759
|
-
var
|
|
71760
|
-
var
|
|
71761
|
-
var _TypeValidationError3 = class _TypeValidationError22 extends
|
|
72454
|
+
_a123 = symbol123;
|
|
72455
|
+
var name123 = "AI_TypeValidationError";
|
|
72456
|
+
var marker133 = `vercel.ai.error.${name123}`;
|
|
72457
|
+
var symbol133 = Symbol.for(marker133);
|
|
72458
|
+
var _a133;
|
|
72459
|
+
var _TypeValidationError3 = class _TypeValidationError22 extends AISDKError2 {
|
|
71762
72460
|
constructor({ value, cause }) {
|
|
71763
72461
|
super({
|
|
71764
|
-
name:
|
|
72462
|
+
name: name123,
|
|
71765
72463
|
message: `Type validation failed: Value: ${JSON.stringify(value)}.
|
|
71766
72464
|
Error message: ${getErrorMessage3(cause)}`,
|
|
71767
72465
|
cause
|
|
71768
72466
|
});
|
|
71769
|
-
this[
|
|
72467
|
+
this[_a133] = true;
|
|
71770
72468
|
this.value = value;
|
|
71771
72469
|
}
|
|
71772
72470
|
static isInstance(error82) {
|
|
71773
|
-
return
|
|
72471
|
+
return AISDKError2.hasMarker(error82, marker133);
|
|
71774
72472
|
}
|
|
71775
72473
|
/**
|
|
71776
72474
|
* Wraps an error into a TypeValidationError.
|
|
@@ -71789,26 +72487,26 @@ Error message: ${getErrorMessage3(cause)}`,
|
|
|
71789
72487
|
return _TypeValidationError22.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError22({ value, cause });
|
|
71790
72488
|
}
|
|
71791
72489
|
};
|
|
71792
|
-
|
|
72490
|
+
_a133 = symbol133;
|
|
71793
72491
|
var TypeValidationError2 = _TypeValidationError3;
|
|
71794
|
-
var
|
|
71795
|
-
var
|
|
71796
|
-
var
|
|
71797
|
-
var
|
|
71798
|
-
var UnsupportedFunctionalityError = class extends
|
|
72492
|
+
var name133 = "AI_UnsupportedFunctionalityError";
|
|
72493
|
+
var marker143 = `vercel.ai.error.${name133}`;
|
|
72494
|
+
var symbol143 = Symbol.for(marker143);
|
|
72495
|
+
var _a143;
|
|
72496
|
+
var UnsupportedFunctionalityError = class extends AISDKError2 {
|
|
71799
72497
|
constructor({
|
|
71800
72498
|
functionality,
|
|
71801
72499
|
message = `'${functionality}' functionality not supported.`
|
|
71802
72500
|
}) {
|
|
71803
|
-
super({ name:
|
|
71804
|
-
this[
|
|
72501
|
+
super({ name: name133, message });
|
|
72502
|
+
this[_a143] = true;
|
|
71805
72503
|
this.functionality = functionality;
|
|
71806
72504
|
}
|
|
71807
72505
|
static isInstance(error82) {
|
|
71808
|
-
return
|
|
72506
|
+
return AISDKError2.hasMarker(error82, marker143);
|
|
71809
72507
|
}
|
|
71810
72508
|
};
|
|
71811
|
-
|
|
72509
|
+
_a143 = symbol143;
|
|
71812
72510
|
var ParseError2 = class extends Error {
|
|
71813
72511
|
constructor(message, options) {
|
|
71814
72512
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
@@ -71964,7 +72662,7 @@ var createIdGenerator3 = ({
|
|
|
71964
72662
|
return generator;
|
|
71965
72663
|
}
|
|
71966
72664
|
if (alphabet.includes(separator)) {
|
|
71967
|
-
throw new
|
|
72665
|
+
throw new InvalidArgumentError3({
|
|
71968
72666
|
argument: "separator",
|
|
71969
72667
|
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
|
|
71970
72668
|
});
|
|
@@ -71988,7 +72686,7 @@ function handleFetchError2({
|
|
|
71988
72686
|
if (error82 instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES2.includes(error82.message.toLowerCase())) {
|
|
71989
72687
|
const cause = error82.cause;
|
|
71990
72688
|
if (cause != null) {
|
|
71991
|
-
return new
|
|
72689
|
+
return new APICallError2({
|
|
71992
72690
|
message: `Cannot connect to API: ${cause.message}`,
|
|
71993
72691
|
cause,
|
|
71994
72692
|
url: url3,
|
|
@@ -72209,7 +72907,7 @@ async function parseProviderOptions({
|
|
|
72209
72907
|
schema
|
|
72210
72908
|
});
|
|
72211
72909
|
if (!parsedProviderOptions.success) {
|
|
72212
|
-
throw new
|
|
72910
|
+
throw new InvalidArgumentError3({
|
|
72213
72911
|
argument: "providerOptions",
|
|
72214
72912
|
message: `invalid ${provider} provider options`,
|
|
72215
72913
|
cause: parsedProviderOptions.error
|
|
@@ -72287,10 +72985,10 @@ var postToApi2 = async ({
|
|
|
72287
72985
|
requestBodyValues: body.values
|
|
72288
72986
|
});
|
|
72289
72987
|
} catch (error82) {
|
|
72290
|
-
if (isAbortError2(error82) ||
|
|
72988
|
+
if (isAbortError2(error82) || APICallError2.isInstance(error82)) {
|
|
72291
72989
|
throw error82;
|
|
72292
72990
|
}
|
|
72293
|
-
throw new
|
|
72991
|
+
throw new APICallError2({
|
|
72294
72992
|
message: "Failed to process error response",
|
|
72295
72993
|
cause: error82,
|
|
72296
72994
|
statusCode: response.status,
|
|
@@ -72309,11 +73007,11 @@ var postToApi2 = async ({
|
|
|
72309
73007
|
});
|
|
72310
73008
|
} catch (error82) {
|
|
72311
73009
|
if (error82 instanceof Error) {
|
|
72312
|
-
if (isAbortError2(error82) ||
|
|
73010
|
+
if (isAbortError2(error82) || APICallError2.isInstance(error82)) {
|
|
72313
73011
|
throw error82;
|
|
72314
73012
|
}
|
|
72315
73013
|
}
|
|
72316
|
-
throw new
|
|
73014
|
+
throw new APICallError2({
|
|
72317
73015
|
message: "Failed to process successful response",
|
|
72318
73016
|
cause: error82,
|
|
72319
73017
|
statusCode: response.status,
|
|
@@ -72399,7 +73097,7 @@ var createJsonErrorResponseHandler2 = ({
|
|
|
72399
73097
|
if (responseBody.trim() === "") {
|
|
72400
73098
|
return {
|
|
72401
73099
|
responseHeaders,
|
|
72402
|
-
value: new
|
|
73100
|
+
value: new APICallError2({
|
|
72403
73101
|
message: response.statusText,
|
|
72404
73102
|
url: url3,
|
|
72405
73103
|
requestBodyValues,
|
|
@@ -72417,7 +73115,7 @@ var createJsonErrorResponseHandler2 = ({
|
|
|
72417
73115
|
});
|
|
72418
73116
|
return {
|
|
72419
73117
|
responseHeaders,
|
|
72420
|
-
value: new
|
|
73118
|
+
value: new APICallError2({
|
|
72421
73119
|
message: errorToMessage(parsedError),
|
|
72422
73120
|
url: url3,
|
|
72423
73121
|
requestBodyValues,
|
|
@@ -72431,7 +73129,7 @@ var createJsonErrorResponseHandler2 = ({
|
|
|
72431
73129
|
} catch (parseError) {
|
|
72432
73130
|
return {
|
|
72433
73131
|
responseHeaders,
|
|
72434
|
-
value: new
|
|
73132
|
+
value: new APICallError2({
|
|
72435
73133
|
message: response.statusText,
|
|
72436
73134
|
url: url3,
|
|
72437
73135
|
requestBodyValues,
|
|
@@ -72464,7 +73162,7 @@ var createJsonResponseHandler2 = (responseSchema2) => async ({ response, url: ur
|
|
|
72464
73162
|
});
|
|
72465
73163
|
const responseHeaders = extractResponseHeaders2(response);
|
|
72466
73164
|
if (!parsedResult.success) {
|
|
72467
|
-
throw new
|
|
73165
|
+
throw new APICallError2({
|
|
72468
73166
|
message: "Invalid JSON response",
|
|
72469
73167
|
cause: parsedResult.error,
|
|
72470
73168
|
statusCode: response.status,
|
|
@@ -72483,7 +73181,7 @@ var createJsonResponseHandler2 = (responseSchema2) => async ({ response, url: ur
|
|
|
72483
73181
|
var createBinaryResponseHandler = () => async ({ response, url: url3, requestBodyValues }) => {
|
|
72484
73182
|
const responseHeaders = extractResponseHeaders2(response);
|
|
72485
73183
|
if (!response.body) {
|
|
72486
|
-
throw new
|
|
73184
|
+
throw new APICallError2({
|
|
72487
73185
|
message: "Response body is empty",
|
|
72488
73186
|
url: url3,
|
|
72489
73187
|
requestBodyValues,
|
|
@@ -72499,7 +73197,7 @@ var createBinaryResponseHandler = () => async ({ response, url: url3, requestBod
|
|
|
72499
73197
|
value: new Uint8Array(buffer)
|
|
72500
73198
|
};
|
|
72501
73199
|
} catch (error82) {
|
|
72502
|
-
throw new
|
|
73200
|
+
throw new APICallError2({
|
|
72503
73201
|
message: "Failed to read response as array buffer",
|
|
72504
73202
|
url: url3,
|
|
72505
73203
|
requestBodyValues,
|
|
@@ -74520,10 +75218,10 @@ function createAnthropic(options = {}) {
|
|
|
74520
75218
|
provider.chat = createChatModel;
|
|
74521
75219
|
provider.messages = createChatModel;
|
|
74522
75220
|
provider.textEmbeddingModel = (modelId) => {
|
|
74523
|
-
throw new
|
|
75221
|
+
throw new NoSuchModelError2({ modelId, modelType: "textEmbeddingModel" });
|
|
74524
75222
|
};
|
|
74525
75223
|
provider.imageModel = (modelId) => {
|
|
74526
|
-
throw new
|
|
75224
|
+
throw new NoSuchModelError2({ modelId, modelType: "imageModel" });
|
|
74527
75225
|
};
|
|
74528
75226
|
provider.tools = anthropicTools;
|
|
74529
75227
|
return provider;
|
|
@@ -78276,7 +78974,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
78276
78974
|
fetch: this.config.fetch
|
|
78277
78975
|
});
|
|
78278
78976
|
if (response.error) {
|
|
78279
|
-
throw new
|
|
78977
|
+
throw new APICallError2({
|
|
78280
78978
|
message: response.error.message,
|
|
78281
78979
|
url: url3,
|
|
78282
78980
|
requestBodyValues: body,
|
|
@@ -79387,37 +80085,37 @@ function createOpenAI(options = {}) {
|
|
|
79387
80085
|
});
|
|
79388
80086
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
79389
80087
|
provider: `${providerName}.chat`,
|
|
79390
|
-
url: ({ path:
|
|
80088
|
+
url: ({ path: path11 }) => `${baseURL}${path11}`,
|
|
79391
80089
|
headers: getHeaders,
|
|
79392
80090
|
fetch: options.fetch
|
|
79393
80091
|
});
|
|
79394
80092
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
79395
80093
|
provider: `${providerName}.completion`,
|
|
79396
|
-
url: ({ path:
|
|
80094
|
+
url: ({ path: path11 }) => `${baseURL}${path11}`,
|
|
79397
80095
|
headers: getHeaders,
|
|
79398
80096
|
fetch: options.fetch
|
|
79399
80097
|
});
|
|
79400
80098
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
79401
80099
|
provider: `${providerName}.embedding`,
|
|
79402
|
-
url: ({ path:
|
|
80100
|
+
url: ({ path: path11 }) => `${baseURL}${path11}`,
|
|
79403
80101
|
headers: getHeaders,
|
|
79404
80102
|
fetch: options.fetch
|
|
79405
80103
|
});
|
|
79406
80104
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
79407
80105
|
provider: `${providerName}.image`,
|
|
79408
|
-
url: ({ path:
|
|
80106
|
+
url: ({ path: path11 }) => `${baseURL}${path11}`,
|
|
79409
80107
|
headers: getHeaders,
|
|
79410
80108
|
fetch: options.fetch
|
|
79411
80109
|
});
|
|
79412
80110
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
79413
80111
|
provider: `${providerName}.transcription`,
|
|
79414
|
-
url: ({ path:
|
|
80112
|
+
url: ({ path: path11 }) => `${baseURL}${path11}`,
|
|
79415
80113
|
headers: getHeaders,
|
|
79416
80114
|
fetch: options.fetch
|
|
79417
80115
|
});
|
|
79418
80116
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
79419
80117
|
provider: `${providerName}.speech`,
|
|
79420
|
-
url: ({ path:
|
|
80118
|
+
url: ({ path: path11 }) => `${baseURL}${path11}`,
|
|
79421
80119
|
headers: getHeaders,
|
|
79422
80120
|
fetch: options.fetch
|
|
79423
80121
|
});
|
|
@@ -79432,7 +80130,7 @@ function createOpenAI(options = {}) {
|
|
|
79432
80130
|
const createResponsesModel = (modelId) => {
|
|
79433
80131
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
79434
80132
|
provider: `${providerName}.responses`,
|
|
79435
|
-
url: ({ path:
|
|
80133
|
+
url: ({ path: path11 }) => `${baseURL}${path11}`,
|
|
79436
80134
|
headers: getHeaders,
|
|
79437
80135
|
fetch: options.fetch,
|
|
79438
80136
|
fileIdPrefixes: ["file-"]
|
|
@@ -80050,6 +80748,240 @@ Stderr: ${error82.stderr}`
|
|
|
80050
80748
|
}
|
|
80051
80749
|
};
|
|
80052
80750
|
|
|
80751
|
+
// src/proxy/playwright.ts
|
|
80752
|
+
var fs10 = __toESM(require("fs/promises"), 1);
|
|
80753
|
+
var path9 = __toESM(require("path"), 1);
|
|
80754
|
+
async function findRepositoryLocation(repoName) {
|
|
80755
|
+
const repoLocation = await findRepoLocation(repoName);
|
|
80756
|
+
if (!repoLocation) {
|
|
80757
|
+
throw new Error(`Repository ${repoName} not found`);
|
|
80758
|
+
}
|
|
80759
|
+
return repoLocation;
|
|
80760
|
+
}
|
|
80761
|
+
async function verifyTestFileExists(repoLocation, testFilePath) {
|
|
80762
|
+
const testFullPath = path9.join(repoLocation, testFilePath);
|
|
80763
|
+
try {
|
|
80764
|
+
await fs10.access(testFullPath);
|
|
80765
|
+
return testFullPath;
|
|
80766
|
+
} catch {
|
|
80767
|
+
throw new Error(`Test file not found: ${testFilePath}`);
|
|
80768
|
+
}
|
|
80769
|
+
}
|
|
80770
|
+
async function findPlaywrightConfig(repoLocation) {
|
|
80771
|
+
const configFiles = [
|
|
80772
|
+
"playwright.config.ts",
|
|
80773
|
+
"playwright.config.js",
|
|
80774
|
+
"playwright.config.mjs"
|
|
80775
|
+
];
|
|
80776
|
+
for (const configFile of configFiles) {
|
|
80777
|
+
const fullConfigPath = path9.join(repoLocation, configFile);
|
|
80778
|
+
try {
|
|
80779
|
+
await fs10.access(fullConfigPath);
|
|
80780
|
+
return fullConfigPath;
|
|
80781
|
+
} catch {
|
|
80782
|
+
}
|
|
80783
|
+
}
|
|
80784
|
+
return null;
|
|
80785
|
+
}
|
|
80786
|
+
async function createPlaywrightConfig(repoLocation) {
|
|
80787
|
+
const configPath = path9.join(repoLocation, "playwright.config.ts");
|
|
80788
|
+
const defaultConfig = `import { defineConfig } from "@playwright/test";
|
|
80789
|
+
|
|
80790
|
+
export default defineConfig({
|
|
80791
|
+
timeout: 60000,
|
|
80792
|
+
workers: 1,
|
|
80793
|
+
fullyParallel: false,
|
|
80794
|
+
use: {
|
|
80795
|
+
video: "on",
|
|
80796
|
+
headless: true,
|
|
80797
|
+
browserName: "chromium",
|
|
80798
|
+
trace: "on-first-retry",
|
|
80799
|
+
},
|
|
80800
|
+
});
|
|
80801
|
+
`;
|
|
80802
|
+
await fs10.writeFile(configPath, defaultConfig);
|
|
80803
|
+
console.log(`Created playwright config at ${configPath}`);
|
|
80804
|
+
return configPath;
|
|
80805
|
+
}
|
|
80806
|
+
async function ensureVideoEnabled(configPath) {
|
|
80807
|
+
const configContent = await fs10.readFile(configPath, "utf-8");
|
|
80808
|
+
if (configContent.match(/video:\s*["']on["']/)) {
|
|
80809
|
+
console.log("Video already enabled in config");
|
|
80810
|
+
return null;
|
|
80811
|
+
}
|
|
80812
|
+
console.log("Updating config to enable video recording");
|
|
80813
|
+
let updatedConfig = configContent;
|
|
80814
|
+
const useBlockRegex = /use:\s*\{([^}]*)\}/s;
|
|
80815
|
+
const match2 = configContent.match(useBlockRegex);
|
|
80816
|
+
if (match2) {
|
|
80817
|
+
const useBlockContent = match2[1];
|
|
80818
|
+
if (useBlockContent.includes("video:")) {
|
|
80819
|
+
updatedConfig = configContent.replace(
|
|
80820
|
+
/video:\s*["'][^"']*["']/,
|
|
80821
|
+
'video: "on"'
|
|
80822
|
+
);
|
|
80823
|
+
} else {
|
|
80824
|
+
const updatedUseBlock = `use: {
|
|
80825
|
+
video: "on",${useBlockContent}}`;
|
|
80826
|
+
updatedConfig = configContent.replace(useBlockRegex, updatedUseBlock);
|
|
80827
|
+
}
|
|
80828
|
+
} else {
|
|
80829
|
+
const configObjectRegex = /export\s+default\s+defineConfig\(\s*\{/;
|
|
80830
|
+
updatedConfig = configContent.replace(
|
|
80831
|
+
configObjectRegex,
|
|
80832
|
+
`export default defineConfig({
|
|
80833
|
+
use: {
|
|
80834
|
+
video: "on",
|
|
80835
|
+
},`
|
|
80836
|
+
);
|
|
80837
|
+
}
|
|
80838
|
+
await fs10.writeFile(configPath, updatedConfig);
|
|
80839
|
+
console.log("Config updated to enable video recording");
|
|
80840
|
+
return configContent;
|
|
80841
|
+
}
|
|
80842
|
+
async function setupPlaywrightConfig(repoLocation) {
|
|
80843
|
+
let configPath = await findPlaywrightConfig(repoLocation);
|
|
80844
|
+
let wasCreated = false;
|
|
80845
|
+
let originalContent = null;
|
|
80846
|
+
let wasModified = false;
|
|
80847
|
+
if (!configPath) {
|
|
80848
|
+
configPath = await createPlaywrightConfig(repoLocation);
|
|
80849
|
+
wasCreated = true;
|
|
80850
|
+
} else {
|
|
80851
|
+
originalContent = await ensureVideoEnabled(configPath);
|
|
80852
|
+
wasModified = originalContent !== null;
|
|
80853
|
+
}
|
|
80854
|
+
return {
|
|
80855
|
+
configPath,
|
|
80856
|
+
wasCreated,
|
|
80857
|
+
originalContent,
|
|
80858
|
+
wasModified
|
|
80859
|
+
};
|
|
80860
|
+
}
|
|
80861
|
+
async function runPlaywrightTest(repoLocation, testFilePath) {
|
|
80862
|
+
const runner = new Runner(repoLocation, console.log);
|
|
80863
|
+
const testCommand = `npx playwright test ${testFilePath}`;
|
|
80864
|
+
console.log(`Running: ${testCommand}`);
|
|
80865
|
+
try {
|
|
80866
|
+
const result = await runner.executeCommand(
|
|
80867
|
+
testCommand,
|
|
80868
|
+
repoLocation,
|
|
80869
|
+
"Playwright test"
|
|
80870
|
+
);
|
|
80871
|
+
return result;
|
|
80872
|
+
} catch (error82) {
|
|
80873
|
+
console.log("Test execution completed with errors:", error82);
|
|
80874
|
+
return { stdout: "", stderr: String(error82) };
|
|
80875
|
+
}
|
|
80876
|
+
}
|
|
80877
|
+
async function findVideoFile(repoLocation) {
|
|
80878
|
+
const testResultsDir = path9.join(repoLocation, "test-results");
|
|
80879
|
+
const walkDir = async (dir) => {
|
|
80880
|
+
try {
|
|
80881
|
+
const files = await fs10.readdir(dir);
|
|
80882
|
+
for (const file3 of files) {
|
|
80883
|
+
const fullPath = path9.join(dir, file3);
|
|
80884
|
+
const stat4 = await fs10.stat(fullPath);
|
|
80885
|
+
if (stat4.isDirectory()) {
|
|
80886
|
+
const result = await walkDir(fullPath);
|
|
80887
|
+
if (result) {
|
|
80888
|
+
return result;
|
|
80889
|
+
}
|
|
80890
|
+
} else if (file3.endsWith(".webm")) {
|
|
80891
|
+
return fullPath;
|
|
80892
|
+
}
|
|
80893
|
+
}
|
|
80894
|
+
} catch (error82) {
|
|
80895
|
+
console.error(`Error walking directory ${dir}:`, error82);
|
|
80896
|
+
}
|
|
80897
|
+
return null;
|
|
80898
|
+
};
|
|
80899
|
+
const videoPath = await walkDir(testResultsDir);
|
|
80900
|
+
if (!videoPath) {
|
|
80901
|
+
throw new Error("No video file found in test-results directory");
|
|
80902
|
+
}
|
|
80903
|
+
console.log(`Found video at: ${videoPath}`);
|
|
80904
|
+
return videoPath;
|
|
80905
|
+
}
|
|
80906
|
+
async function uploadVideo(videoPath, responseUrl) {
|
|
80907
|
+
const videoBuffer = await fs10.readFile(videoPath);
|
|
80908
|
+
const FormData2 = (await Promise.resolve().then(() => __toESM(require_form_data(), 1))).default;
|
|
80909
|
+
const formData = new FormData2();
|
|
80910
|
+
formData.append("video", videoBuffer, {
|
|
80911
|
+
filename: path9.basename(videoPath),
|
|
80912
|
+
contentType: "video/webm"
|
|
80913
|
+
});
|
|
80914
|
+
const uploadResponse = await fetch(responseUrl, {
|
|
80915
|
+
method: "POST",
|
|
80916
|
+
body: formData,
|
|
80917
|
+
headers: formData.getHeaders()
|
|
80918
|
+
});
|
|
80919
|
+
if (!uploadResponse.ok) {
|
|
80920
|
+
throw new Error(
|
|
80921
|
+
`Failed to upload video: ${uploadResponse.status} ${uploadResponse.statusText}`
|
|
80922
|
+
);
|
|
80923
|
+
}
|
|
80924
|
+
console.log(`Video uploaded successfully to ${responseUrl}`);
|
|
80925
|
+
return uploadResponse.status;
|
|
80926
|
+
}
|
|
80927
|
+
async function deleteVideo(videoPath) {
|
|
80928
|
+
try {
|
|
80929
|
+
await fs10.unlink(videoPath);
|
|
80930
|
+
console.log(`Deleted video file: ${videoPath}`);
|
|
80931
|
+
} catch (error82) {
|
|
80932
|
+
console.error(`Error deleting video file ${videoPath}:`, error82);
|
|
80933
|
+
}
|
|
80934
|
+
}
|
|
80935
|
+
async function cleanupConfig(configState) {
|
|
80936
|
+
if (!configState.configPath) {
|
|
80937
|
+
return;
|
|
80938
|
+
}
|
|
80939
|
+
try {
|
|
80940
|
+
if (configState.wasCreated) {
|
|
80941
|
+
await fs10.unlink(configState.configPath);
|
|
80942
|
+
console.log(`Cleaned up created config file: ${configState.configPath}`);
|
|
80943
|
+
} else if (configState.wasModified && configState.originalContent) {
|
|
80944
|
+
await fs10.writeFile(configState.configPath, configState.originalContent);
|
|
80945
|
+
console.log(`Restored original config: ${configState.configPath}`);
|
|
80946
|
+
}
|
|
80947
|
+
} catch (error82) {
|
|
80948
|
+
console.error("Error cleaning up config:", error82);
|
|
80949
|
+
}
|
|
80950
|
+
}
|
|
80951
|
+
async function runPlaywrightTestWithVideo(options) {
|
|
80952
|
+
const { repoName, testFilePath, responseUrl } = options;
|
|
80953
|
+
let configState = null;
|
|
80954
|
+
try {
|
|
80955
|
+
const repoLocation = await findRepositoryLocation(repoName);
|
|
80956
|
+
await verifyTestFileExists(repoLocation, testFilePath);
|
|
80957
|
+
configState = await setupPlaywrightConfig(repoLocation);
|
|
80958
|
+
const testResult = await runPlaywrightTest(repoLocation, testFilePath);
|
|
80959
|
+
const videoPath = await findVideoFile(repoLocation);
|
|
80960
|
+
let uploadStatus;
|
|
80961
|
+
if (responseUrl) {
|
|
80962
|
+
uploadStatus = await uploadVideo(videoPath, responseUrl);
|
|
80963
|
+
await deleteVideo(videoPath);
|
|
80964
|
+
} else {
|
|
80965
|
+
console.log("No responseUrl provided, keeping video file locally");
|
|
80966
|
+
}
|
|
80967
|
+
await cleanupConfig(configState);
|
|
80968
|
+
return {
|
|
80969
|
+
success: true,
|
|
80970
|
+
videoPath,
|
|
80971
|
+
testResult,
|
|
80972
|
+
uploadStatus
|
|
80973
|
+
};
|
|
80974
|
+
} catch (error82) {
|
|
80975
|
+
if (configState) {
|
|
80976
|
+
await cleanupConfig(configState);
|
|
80977
|
+
}
|
|
80978
|
+
return {
|
|
80979
|
+
success: false,
|
|
80980
|
+
error: error82 instanceof Error ? error82.message : String(error82)
|
|
80981
|
+
};
|
|
80982
|
+
}
|
|
80983
|
+
}
|
|
80984
|
+
|
|
80053
80985
|
// src/proxy/server.ts
|
|
80054
80986
|
var PORT = parseInt(process.env.STAKLINK_PORT || "15552") || 15552;
|
|
80055
80987
|
var VSCODE_EXTENSION_URL = `http://localhost:${PORT + 1}`;
|
|
@@ -80128,6 +81060,19 @@ async function startProxyServer() {
|
|
|
80128
81060
|
res.status(401).json({ error: "Unauthorized" });
|
|
80129
81061
|
}
|
|
80130
81062
|
const app = (0, import_express.default)();
|
|
81063
|
+
app.use((req, res, next) => {
|
|
81064
|
+
res.header("Access-Control-Allow-Origin", "*");
|
|
81065
|
+
res.header(
|
|
81066
|
+
"Access-Control-Allow-Methods",
|
|
81067
|
+
"GET, POST, PUT, DELETE, OPTIONS"
|
|
81068
|
+
);
|
|
81069
|
+
res.header("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
|
81070
|
+
if (req.method === "OPTIONS") {
|
|
81071
|
+
res.sendStatus(200);
|
|
81072
|
+
} else {
|
|
81073
|
+
next();
|
|
81074
|
+
}
|
|
81075
|
+
});
|
|
80131
81076
|
app.use(import_express.default.json({ limit: "50mb" }));
|
|
80132
81077
|
app.use(import_express.default.urlencoded({ extended: true }));
|
|
80133
81078
|
app.get("/health", (req, res) => {
|
|
@@ -80445,7 +81390,7 @@ ${lines2.map((line) => "+" + line).join("\n")}`;
|
|
|
80445
81390
|
currentBranch = (await repo.printCurrentBranch()).trim();
|
|
80446
81391
|
console.log(`=> COMMIT to ${r.url} on branch: ${currentBranch}`);
|
|
80447
81392
|
await repo.commitWithCredentials(
|
|
80448
|
-
r.commit_name
|
|
81393
|
+
r.commit_name || `Changes from ${currentBranch}`,
|
|
80449
81394
|
code.git_credentials
|
|
80450
81395
|
);
|
|
80451
81396
|
console.log(`=> Commit successful`);
|
|
@@ -80522,9 +81467,11 @@ ${diff.trim()}`);
|
|
|
80522
81467
|
prs[repoName] = existingPR.url;
|
|
80523
81468
|
prNumber = existingPR.number;
|
|
80524
81469
|
} else {
|
|
81470
|
+
const commitMsg = r.commit_name || `Changes from ${currentBranch2}`;
|
|
81471
|
+
const { title, body } = processCommitMessage(commitMsg);
|
|
80525
81472
|
const pr = await gh.createPR({
|
|
80526
|
-
title
|
|
80527
|
-
body
|
|
81473
|
+
title,
|
|
81474
|
+
body,
|
|
80528
81475
|
base: baseBranch,
|
|
80529
81476
|
draft: false
|
|
80530
81477
|
});
|
|
@@ -80874,8 +81821,8 @@ ${diff.trim()}`);
|
|
|
80874
81821
|
if (repoName) {
|
|
80875
81822
|
const candidate = import_path3.default.join(workspaceRoot2, repoName);
|
|
80876
81823
|
try {
|
|
80877
|
-
const
|
|
80878
|
-
if (
|
|
81824
|
+
const stat4 = await import_promises2.default.stat(candidate);
|
|
81825
|
+
if (stat4.isDirectory()) {
|
|
80879
81826
|
repoPath = candidate;
|
|
80880
81827
|
}
|
|
80881
81828
|
} catch {
|
|
@@ -80922,6 +81869,35 @@ ${diff.trim()}`);
|
|
|
80922
81869
|
fail(res, e);
|
|
80923
81870
|
}
|
|
80924
81871
|
});
|
|
81872
|
+
app.post(
|
|
81873
|
+
"/playwright_test",
|
|
81874
|
+
async (req, res) => {
|
|
81875
|
+
console.log(`===> POST /playwright_test`);
|
|
81876
|
+
const request_id = startReq();
|
|
81877
|
+
try {
|
|
81878
|
+
const { repoName, testFilePath, responseUrl } = req.body;
|
|
81879
|
+
if (!repoName || !testFilePath) {
|
|
81880
|
+
res.status(400).json({
|
|
81881
|
+
error: "Missing required parameters: repoName, testFilePath"
|
|
81882
|
+
});
|
|
81883
|
+
return;
|
|
81884
|
+
}
|
|
81885
|
+
runPlaywrightTestWithVideo({ repoName, testFilePath, responseUrl }).then((result) => {
|
|
81886
|
+
if (result.success) {
|
|
81887
|
+
finishReq(request_id, result);
|
|
81888
|
+
} else {
|
|
81889
|
+
failReq(request_id, new Error(result.error));
|
|
81890
|
+
}
|
|
81891
|
+
}).catch((error82) => {
|
|
81892
|
+
failReq(request_id, error82);
|
|
81893
|
+
});
|
|
81894
|
+
res.json({ request_id, status: "pending" });
|
|
81895
|
+
} catch (e) {
|
|
81896
|
+
console.error("Error starting playwright test:", e);
|
|
81897
|
+
fail(res, e);
|
|
81898
|
+
}
|
|
81899
|
+
}
|
|
81900
|
+
);
|
|
80925
81901
|
const server = app.listen(PORT, () => {
|
|
80926
81902
|
console.log(`Staklink proxy server running on port ${PORT}`);
|
|
80927
81903
|
});
|