staklink 0.5.4 → 0.5.6
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 +614 -493
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +1 -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 fs17 = require("fs");
|
|
1293
|
+
stream3 = new fs17.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(path14) {
|
|
14081
|
+
if (!path14 || typeof path14 !== "string") {
|
|
14082
14082
|
return false;
|
|
14083
14083
|
}
|
|
14084
|
-
var extension2 = extname("x." +
|
|
14084
|
+
var extension2 = extname("x." + path14).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 fs17 = require("fs");
|
|
17512
|
+
stream3 = new fs17.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 fs17 = require("fs");
|
|
18231
|
+
stream3 = new fs17.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(path14, 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 (path14 instanceof RegExp) {
|
|
18334
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path14.source)) {
|
|
18335
18335
|
if (m[0][0] === "\\") continue;
|
|
18336
18336
|
keys.push({
|
|
18337
18337
|
name: m[1] || name25++,
|
|
@@ -18339,18 +18339,18 @@ var require_path_to_regexp = __commonJS({
|
|
|
18339
18339
|
offset: m.index
|
|
18340
18340
|
});
|
|
18341
18341
|
}
|
|
18342
|
-
return
|
|
18342
|
+
return path14;
|
|
18343
18343
|
}
|
|
18344
|
-
if (Array.isArray(
|
|
18345
|
-
|
|
18344
|
+
if (Array.isArray(path14)) {
|
|
18345
|
+
path14 = path14.map(function(value) {
|
|
18346
18346
|
return pathToRegexp(value, keys, options).source;
|
|
18347
18347
|
});
|
|
18348
|
-
return new RegExp(
|
|
18348
|
+
return new RegExp(path14.join("|"), flags);
|
|
18349
18349
|
}
|
|
18350
|
-
if (typeof
|
|
18350
|
+
if (typeof path14 !== "string") {
|
|
18351
18351
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
18352
18352
|
}
|
|
18353
|
-
|
|
18353
|
+
path14 = path14.replace(
|
|
18354
18354
|
/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
|
|
18355
18355
|
function(match3, slash, format, key, capture, star3, optional3, offset) {
|
|
18356
18356
|
if (match3[0] === "\\") {
|
|
@@ -18367,7 +18367,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18367
18367
|
if (slash || format) {
|
|
18368
18368
|
backtrack = "";
|
|
18369
18369
|
} else {
|
|
18370
|
-
backtrack +=
|
|
18370
|
+
backtrack += path14.slice(pos, offset);
|
|
18371
18371
|
}
|
|
18372
18372
|
pos = offset + match3.length;
|
|
18373
18373
|
if (match3 === "*") {
|
|
@@ -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(path14)) {
|
|
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
|
+
path14 += strict ? "" : path14[path14.length - 1] === "/" ? "?" : "/?";
|
|
18411
18411
|
if (end) {
|
|
18412
|
-
|
|
18413
|
-
} else if (
|
|
18414
|
-
|
|
18412
|
+
path14 += "$";
|
|
18413
|
+
} else if (path14[path14.length - 1] !== "/") {
|
|
18414
|
+
path14 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
18415
18415
|
}
|
|
18416
|
-
return new RegExp("^" +
|
|
18416
|
+
return new RegExp("^" + path14, 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(path14, options, fn) {
|
|
18430
18430
|
if (!(this instanceof Layer)) {
|
|
18431
|
-
return new Layer(
|
|
18431
|
+
return new Layer(path14, options, fn);
|
|
18432
18432
|
}
|
|
18433
|
-
debug("new %o",
|
|
18433
|
+
debug("new %o", path14);
|
|
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(path14, this.keys = [], opts);
|
|
18440
|
+
this.regexp.fast_star = path14 === "*";
|
|
18441
|
+
this.regexp.fast_slash = path14 === "/" && opts.end === false;
|
|
18442
18442
|
}
|
|
18443
18443
|
Layer.prototype.handle_error = function handle_error(error88, 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 match3(
|
|
18465
|
+
Layer.prototype.match = function match3(path14) {
|
|
18466
18466
|
var match4;
|
|
18467
|
-
if (
|
|
18467
|
+
if (path14 != 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(path14) };
|
|
18475
|
+
this.path = path14;
|
|
18476
18476
|
return true;
|
|
18477
18477
|
}
|
|
18478
|
-
match4 = this.regexp.exec(
|
|
18478
|
+
match4 = this.regexp.exec(path14);
|
|
18479
18479
|
}
|
|
18480
18480
|
if (!match4) {
|
|
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 = Route2;
|
|
18571
|
-
function Route2(
|
|
18572
|
-
this.path =
|
|
18571
|
+
function Route2(path14) {
|
|
18572
|
+
this.path = path14;
|
|
18573
18573
|
this.stack = [];
|
|
18574
|
-
debug("new %o",
|
|
18574
|
+
debug("new %o", path14);
|
|
18575
18575
|
this.methods = {};
|
|
18576
18576
|
}
|
|
18577
18577
|
Route2.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 path14 = getPathname(req);
|
|
18787
|
+
if (path14 == 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 (match3 !== true && idx < stack.length) {
|
|
18794
18794
|
layer = stack[idx++];
|
|
18795
|
-
match3 = matchLayer(layer,
|
|
18795
|
+
match3 = matchLayer(layer, path14);
|
|
18796
18796
|
route = layer.route;
|
|
18797
18797
|
if (typeof match3 !== "boolean") {
|
|
18798
18798
|
layerError = layerError || match3;
|
|
@@ -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, path14);
|
|
18834
18834
|
}
|
|
18835
18835
|
sync2 = 0;
|
|
18836
18836
|
});
|
|
18837
18837
|
}
|
|
18838
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
18838
|
+
function trim_prefix(layer, layerError, layerPath, path14) {
|
|
18839
18839
|
if (layerPath.length !== 0) {
|
|
18840
|
-
if (layerPath !==
|
|
18840
|
+
if (layerPath !== path14.slice(0, layerPath.length)) {
|
|
18841
18841
|
next(layerError);
|
|
18842
18842
|
return;
|
|
18843
18843
|
}
|
|
18844
|
-
var c =
|
|
18844
|
+
var c = path14[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 path14 = "/";
|
|
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
|
+
path14 = 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", path14, fn.name || "<anonymous>");
|
|
18943
|
+
var layer = new Layer(path14, {
|
|
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 Route2(
|
|
18955
|
-
var layer = new Layer(
|
|
18953
|
+
proto.route = function route(path14) {
|
|
18954
|
+
var route2 = new Route2(path14);
|
|
18955
|
+
var layer = new Layer(path14, {
|
|
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(path14) {
|
|
18966
|
+
var route = this.route(path14);
|
|
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, path14) {
|
|
19003
19003
|
try {
|
|
19004
|
-
return layer.match(
|
|
19004
|
+
return layer.match(path14);
|
|
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 dirname4 =
|
|
19125
|
-
var basename2 =
|
|
19126
|
-
var extname =
|
|
19127
|
-
var
|
|
19128
|
-
var resolve3 =
|
|
19122
|
+
var path14 = require("path");
|
|
19123
|
+
var fs17 = require("fs");
|
|
19124
|
+
var dirname4 = path14.dirname;
|
|
19125
|
+
var basename2 = path14.basename;
|
|
19126
|
+
var extname = path14.extname;
|
|
19127
|
+
var join10 = path14.join;
|
|
19128
|
+
var resolve3 = path14.resolve;
|
|
19129
19129
|
module2.exports = View;
|
|
19130
19130
|
function View(name25, 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(name25) {
|
|
19157
|
-
var
|
|
19157
|
+
var path15;
|
|
19158
19158
|
var roots = [].concat(this.root);
|
|
19159
19159
|
debug('lookup "%s"', name25);
|
|
19160
|
-
for (var i = 0; i < roots.length && !
|
|
19160
|
+
for (var i = 0; i < roots.length && !path15; i++) {
|
|
19161
19161
|
var root = roots[i];
|
|
19162
19162
|
var loc = resolve3(root, name25);
|
|
19163
19163
|
var dir = dirname4(loc);
|
|
19164
19164
|
var file3 = basename2(loc);
|
|
19165
|
-
|
|
19165
|
+
path15 = this.resolve(dir, file3);
|
|
19166
19166
|
}
|
|
19167
|
-
return
|
|
19167
|
+
return path15;
|
|
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 stat4 = tryStat(
|
|
19175
|
+
var path15 = join10(dir, file3);
|
|
19176
|
+
var stat4 = tryStat(path15);
|
|
19177
19177
|
if (stat4 && stat4.isFile()) {
|
|
19178
|
-
return
|
|
19178
|
+
return path15;
|
|
19179
19179
|
}
|
|
19180
|
-
|
|
19181
|
-
stat4 = tryStat(
|
|
19180
|
+
path15 = join10(dir, basename2(file3, ext2), "index" + ext2);
|
|
19181
|
+
stat4 = tryStat(path15);
|
|
19182
19182
|
if (stat4 && stat4.isFile()) {
|
|
19183
|
-
return
|
|
19183
|
+
return path15;
|
|
19184
19184
|
}
|
|
19185
19185
|
};
|
|
19186
|
-
function tryStat(
|
|
19187
|
-
debug('stat "%s"',
|
|
19186
|
+
function tryStat(path15) {
|
|
19187
|
+
debug('stat "%s"', path15);
|
|
19188
19188
|
try {
|
|
19189
|
-
return
|
|
19189
|
+
return fs17.statSync(path15);
|
|
19190
19190
|
} catch (e) {
|
|
19191
19191
|
return void 0;
|
|
19192
19192
|
}
|
|
@@ -19791,8 +19791,8 @@ var require_node4 = __commonJS({
|
|
|
19791
19791
|
}
|
|
19792
19792
|
break;
|
|
19793
19793
|
case "FILE":
|
|
19794
|
-
var
|
|
19795
|
-
stream3 = new
|
|
19794
|
+
var fs17 = require("fs");
|
|
19795
|
+
stream3 = new fs17.SyncWriteStream(fd2, { autoClose: false });
|
|
19796
19796
|
stream3._type = "fs";
|
|
19797
19797
|
break;
|
|
19798
19798
|
case "PIPE":
|
|
@@ -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 path14 = require("path");
|
|
19982
|
+
var fs17 = 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 = fs17.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(path15, fallback) {
|
|
20012
|
+
var ext2 = path15.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 fs17 = 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 path14 = require("path");
|
|
20247
20247
|
var statuses = require_statuses();
|
|
20248
20248
|
var Stream2 = require("stream");
|
|
20249
20249
|
var util3 = require("util");
|
|
20250
|
-
var extname =
|
|
20251
|
-
var
|
|
20252
|
-
var normalize2 =
|
|
20253
|
-
var resolve3 =
|
|
20254
|
-
var sep2 =
|
|
20250
|
+
var extname = path14.extname;
|
|
20251
|
+
var join10 = path14.join;
|
|
20252
|
+
var normalize2 = path14.normalize;
|
|
20253
|
+
var resolve3 = path14.resolve;
|
|
20254
|
+
var sep2 = path14.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, path15, options) {
|
|
20261
|
+
return new SendStream(req, path15, options);
|
|
20262
20262
|
}
|
|
20263
|
-
function SendStream(req,
|
|
20263
|
+
function SendStream(req, path15, options) {
|
|
20264
20264
|
Stream2.call(this);
|
|
20265
20265
|
var opts = options || {};
|
|
20266
20266
|
this.options = opts;
|
|
20267
|
-
this.path =
|
|
20267
|
+
this.path = path15;
|
|
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(path15) {
|
|
20314
|
+
this._root = resolve3(String(path15));
|
|
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(path15) {
|
|
20428
20428
|
var res = this.res;
|
|
20429
20429
|
if (hasListeners(this, "directory")) {
|
|
20430
|
-
this.emit("directory", res,
|
|
20430
|
+
this.emit("directory", res, path15);
|
|
20431
20431
|
return;
|
|
20432
20432
|
}
|
|
20433
20433
|
if (this.hasTrailingSlash()) {
|
|
@@ -20447,42 +20447,42 @@ 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 path15 = decode3(this.path);
|
|
20451
|
+
if (path15 === -1) {
|
|
20452
20452
|
this.error(400);
|
|
20453
20453
|
return res;
|
|
20454
20454
|
}
|
|
20455
|
-
if (~
|
|
20455
|
+
if (~path15.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 (path15) {
|
|
20462
|
+
path15 = normalize2("." + sep2 + path15);
|
|
20463
20463
|
}
|
|
20464
|
-
if (UP_PATH_REGEXP.test(
|
|
20465
|
-
debug('malicious path "%s"',
|
|
20464
|
+
if (UP_PATH_REGEXP.test(path15)) {
|
|
20465
|
+
debug('malicious path "%s"', path15);
|
|
20466
20466
|
this.error(403);
|
|
20467
20467
|
return res;
|
|
20468
20468
|
}
|
|
20469
|
-
parts =
|
|
20470
|
-
|
|
20469
|
+
parts = path15.split(sep2);
|
|
20470
|
+
path15 = normalize2(join10(root, path15));
|
|
20471
20471
|
} else {
|
|
20472
|
-
if (UP_PATH_REGEXP.test(
|
|
20473
|
-
debug('malicious path "%s"',
|
|
20472
|
+
if (UP_PATH_REGEXP.test(path15)) {
|
|
20473
|
+
debug('malicious path "%s"', path15);
|
|
20474
20474
|
this.error(403);
|
|
20475
20475
|
return res;
|
|
20476
20476
|
}
|
|
20477
|
-
parts = normalize2(
|
|
20478
|
-
|
|
20477
|
+
parts = normalize2(path15).split(sep2);
|
|
20478
|
+
path15 = resolve3(path15);
|
|
20479
20479
|
}
|
|
20480
20480
|
if (containsDotFile(parts)) {
|
|
20481
20481
|
var access4 = this._dotfiles;
|
|
20482
20482
|
if (access4 === void 0) {
|
|
20483
20483
|
access4 = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
|
|
20484
20484
|
}
|
|
20485
|
-
debug('%s dotfile "%s"', access4,
|
|
20485
|
+
debug('%s dotfile "%s"', access4, path15);
|
|
20486
20486
|
switch (access4) {
|
|
20487
20487
|
case "allow":
|
|
20488
20488
|
break;
|
|
@@ -20496,13 +20496,13 @@ var require_send = __commonJS({
|
|
|
20496
20496
|
}
|
|
20497
20497
|
}
|
|
20498
20498
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
20499
|
-
this.sendIndex(
|
|
20499
|
+
this.sendIndex(path15);
|
|
20500
20500
|
return res;
|
|
20501
20501
|
}
|
|
20502
|
-
this.sendFile(
|
|
20502
|
+
this.sendFile(path15);
|
|
20503
20503
|
return res;
|
|
20504
20504
|
};
|
|
20505
|
-
SendStream.prototype.send = function send2(
|
|
20505
|
+
SendStream.prototype.send = function send2(path15, stat4) {
|
|
20506
20506
|
var len = stat4.size;
|
|
20507
20507
|
var options = this.options;
|
|
20508
20508
|
var opts = {};
|
|
@@ -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"', path15);
|
|
20518
|
+
this.setHeader(path15, stat4);
|
|
20519
|
+
this.type(path15);
|
|
20520
20520
|
if (this.isConditionalGET()) {
|
|
20521
20521
|
if (this.isPreconditionFailure()) {
|
|
20522
20522
|
this.error(412);
|
|
@@ -20565,28 +20565,28 @@ var require_send = __commonJS({
|
|
|
20565
20565
|
res.end();
|
|
20566
20566
|
return;
|
|
20567
20567
|
}
|
|
20568
|
-
this.stream(
|
|
20568
|
+
this.stream(path15, opts);
|
|
20569
20569
|
};
|
|
20570
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
20570
|
+
SendStream.prototype.sendFile = function sendFile(path15) {
|
|
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"', path15);
|
|
20574
|
+
fs17.stat(path15, function onstat(err, stat4) {
|
|
20575
|
+
if (err && err.code === "ENOENT" && !extname(path15) && path15[path15.length - 1] !== sep2) {
|
|
20576
20576
|
return next(err);
|
|
20577
20577
|
}
|
|
20578
20578
|
if (err) return self.onStatError(err);
|
|
20579
|
-
if (stat4.isDirectory()) return self.redirect(
|
|
20580
|
-
self.emit("file",
|
|
20581
|
-
self.send(
|
|
20579
|
+
if (stat4.isDirectory()) return self.redirect(path15);
|
|
20580
|
+
self.emit("file", path15, stat4);
|
|
20581
|
+
self.send(path15, 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 = path15 + "." + self._extensions[i++];
|
|
20588
20588
|
debug('stat "%s"', p);
|
|
20589
|
-
|
|
20589
|
+
fs17.stat(p, function(err2, stat4) {
|
|
20590
20590
|
if (err2) return next(err2);
|
|
20591
20591
|
if (stat4.isDirectory()) return next();
|
|
20592
20592
|
self.emit("file", p, stat4);
|
|
@@ -20594,7 +20594,7 @@ var require_send = __commonJS({
|
|
|
20594
20594
|
});
|
|
20595
20595
|
}
|
|
20596
20596
|
};
|
|
20597
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
20597
|
+
SendStream.prototype.sendIndex = function sendIndex(path15) {
|
|
20598
20598
|
var i = -1;
|
|
20599
20599
|
var self = this;
|
|
20600
20600
|
function next(err) {
|
|
@@ -20602,9 +20602,9 @@ 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 = join10(path15, self._index[i]);
|
|
20606
20606
|
debug('stat "%s"', p);
|
|
20607
|
-
|
|
20607
|
+
fs17.stat(p, function(err2, stat4) {
|
|
20608
20608
|
if (err2) return next(err2);
|
|
20609
20609
|
if (stat4.isDirectory()) return next();
|
|
20610
20610
|
self.emit("file", p, stat4);
|
|
@@ -20613,10 +20613,10 @@ var require_send = __commonJS({
|
|
|
20613
20613
|
}
|
|
20614
20614
|
next();
|
|
20615
20615
|
};
|
|
20616
|
-
SendStream.prototype.stream = function stream2(
|
|
20616
|
+
SendStream.prototype.stream = function stream2(path15, options) {
|
|
20617
20617
|
var self = this;
|
|
20618
20618
|
var res = this.res;
|
|
20619
|
-
var stream3 =
|
|
20619
|
+
var stream3 = fs17.createReadStream(path15, options);
|
|
20620
20620
|
this.emit("stream", stream3);
|
|
20621
20621
|
stream3.pipe(res);
|
|
20622
20622
|
function cleanup2() {
|
|
@@ -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(path15) {
|
|
20635
20635
|
var res = this.res;
|
|
20636
20636
|
if (res.getHeader("Content-Type")) return;
|
|
20637
|
-
var type2 = mime.lookup(
|
|
20637
|
+
var type2 = mime.lookup(path15);
|
|
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(path15, stat4) {
|
|
20647
20647
|
var res = this.res;
|
|
20648
|
-
this.emit("headers", res,
|
|
20648
|
+
this.emit("headers", res, path15, stat4);
|
|
20649
20649
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
20650
20650
|
debug("accept ranges");
|
|
20651
20651
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -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(path15) {
|
|
20708
20708
|
try {
|
|
20709
|
-
return decodeURIComponent(
|
|
20709
|
+
return decodeURIComponent(path15);
|
|
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(path14) {
|
|
21619
|
+
if ("/" === path14[0]) return true;
|
|
21620
|
+
if (":" === path14[1] && ("\\" === path14[2] || "/" === path14[2])) return true;
|
|
21621
|
+
if ("\\\\" === path14.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 path14 = "/";
|
|
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
|
+
path14 = 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(path14, fn2);
|
|
21852
21852
|
}
|
|
21853
|
-
debug(".use app under %s",
|
|
21854
|
-
fn2.mountpath =
|
|
21853
|
+
debug(".use app under %s", path14);
|
|
21854
|
+
fn2.mountpath = path14;
|
|
21855
21855
|
fn2.parent = this;
|
|
21856
|
-
router.use(
|
|
21856
|
+
router.use(path14, 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(path14) {
|
|
21869
21869
|
this.lazyrouter();
|
|
21870
|
-
return this._router.route(
|
|
21870
|
+
return this._router.route(path14);
|
|
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 path14() {
|
|
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(path14) {
|
|
21938
21938
|
if (method === "get" && arguments.length === 1) {
|
|
21939
|
-
return this.set(
|
|
21939
|
+
return this.set(path14);
|
|
21940
21940
|
}
|
|
21941
21941
|
this.lazyrouter();
|
|
21942
|
-
var route = this._router.route(
|
|
21942
|
+
var route = this._router.route(path14);
|
|
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(path14) {
|
|
21948
21948
|
this.lazyrouter();
|
|
21949
|
-
var route = this._router.route(
|
|
21949
|
+
var route = this._router.route(path14);
|
|
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 path14() {
|
|
22709
22709
|
return parse5(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 path14 = 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 = path14.extname;
|
|
23039
23039
|
var mime = send.mime;
|
|
23040
|
-
var resolve3 =
|
|
23040
|
+
var resolve3 = path14.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(path15, 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 (!path15) {
|
|
23224
23224
|
throw new TypeError("path argument is required to res.sendFile");
|
|
23225
23225
|
}
|
|
23226
|
-
if (typeof
|
|
23226
|
+
if (typeof path15 !== "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(path15)) {
|
|
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(path15);
|
|
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(path15, 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, path15, 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(path15, filename, options, callback) {
|
|
23270
23270
|
var done = callback;
|
|
23271
23271
|
var name25 = 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(name25 ||
|
|
23286
|
+
"Content-Disposition": contentDisposition(name25 || path15)
|
|
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(path15) : path15;
|
|
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 path14 = parseUrl(req).pathname;
|
|
23601
|
+
if (path14 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
23602
|
+
path14 = "";
|
|
23603
23603
|
}
|
|
23604
|
-
var stream2 = send(req,
|
|
23604
|
+
var stream2 = send(req, path14, opts);
|
|
23605
23605
|
stream2.on("directory", onDirectory);
|
|
23606
23606
|
if (setHeaders) {
|
|
23607
23607
|
stream2.on("headers", setHeaders);
|
|
@@ -24139,8 +24139,8 @@ var require_auth_config = __commonJS({
|
|
|
24139
24139
|
writeAuthConfig: () => writeAuthConfig
|
|
24140
24140
|
});
|
|
24141
24141
|
module2.exports = __toCommonJS(auth_config_exports);
|
|
24142
|
-
var
|
|
24143
|
-
var
|
|
24142
|
+
var fs17 = __toESM2(require("fs"));
|
|
24143
|
+
var path14 = __toESM2(require("path"));
|
|
24144
24144
|
var import_token_util = require_token_util();
|
|
24145
24145
|
function getAuthConfigPath() {
|
|
24146
24146
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
@@ -24149,15 +24149,15 @@ var require_auth_config = __commonJS({
|
|
|
24149
24149
|
`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`
|
|
24150
24150
|
);
|
|
24151
24151
|
}
|
|
24152
|
-
return
|
|
24152
|
+
return path14.join(dataDir, "auth.json");
|
|
24153
24153
|
}
|
|
24154
24154
|
function readAuthConfig() {
|
|
24155
24155
|
try {
|
|
24156
24156
|
const authPath = getAuthConfigPath();
|
|
24157
|
-
if (!
|
|
24157
|
+
if (!fs17.existsSync(authPath)) {
|
|
24158
24158
|
return null;
|
|
24159
24159
|
}
|
|
24160
|
-
const content =
|
|
24160
|
+
const content = fs17.readFileSync(authPath, "utf8");
|
|
24161
24161
|
if (!content) {
|
|
24162
24162
|
return null;
|
|
24163
24163
|
}
|
|
@@ -24168,11 +24168,11 @@ var require_auth_config = __commonJS({
|
|
|
24168
24168
|
}
|
|
24169
24169
|
function writeAuthConfig(config3) {
|
|
24170
24170
|
const authPath = getAuthConfigPath();
|
|
24171
|
-
const authDir =
|
|
24172
|
-
if (!
|
|
24173
|
-
|
|
24171
|
+
const authDir = path14.dirname(authPath);
|
|
24172
|
+
if (!fs17.existsSync(authDir)) {
|
|
24173
|
+
fs17.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
24174
24174
|
}
|
|
24175
|
-
|
|
24175
|
+
fs17.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
|
|
24176
24176
|
}
|
|
24177
24177
|
function isValidAccessToken(authConfig, expirationBufferMs = 0) {
|
|
24178
24178
|
if (!authConfig.token)
|
|
@@ -24363,8 +24363,8 @@ var require_token_util = __commonJS({
|
|
|
24363
24363
|
saveToken: () => saveToken
|
|
24364
24364
|
});
|
|
24365
24365
|
module2.exports = __toCommonJS(token_util_exports);
|
|
24366
|
-
var
|
|
24367
|
-
var
|
|
24366
|
+
var path14 = __toESM2(require("path"));
|
|
24367
|
+
var fs17 = __toESM2(require("fs"));
|
|
24368
24368
|
var import_token_error = require_token_error();
|
|
24369
24369
|
var import_token_io = require_token_io();
|
|
24370
24370
|
var import_auth_config = require_auth_config();
|
|
@@ -24376,7 +24376,7 @@ var require_token_util = __commonJS({
|
|
|
24376
24376
|
if (!dataDir) {
|
|
24377
24377
|
return null;
|
|
24378
24378
|
}
|
|
24379
|
-
return
|
|
24379
|
+
return path14.join(dataDir, vercelFolder);
|
|
24380
24380
|
}
|
|
24381
24381
|
async function getVercelToken2(options) {
|
|
24382
24382
|
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
@@ -24452,13 +24452,13 @@ var require_token_util = __commonJS({
|
|
|
24452
24452
|
"Unable to find project root directory. Have you linked your project with `vc link?`"
|
|
24453
24453
|
);
|
|
24454
24454
|
}
|
|
24455
|
-
const prjPath =
|
|
24456
|
-
if (!
|
|
24455
|
+
const prjPath = path14.join(dir, ".vercel", "project.json");
|
|
24456
|
+
if (!fs17.existsSync(prjPath)) {
|
|
24457
24457
|
throw new import_token_error.VercelOidcTokenError(
|
|
24458
24458
|
"project.json not found, have you linked your project with `vc link?`"
|
|
24459
24459
|
);
|
|
24460
24460
|
}
|
|
24461
|
-
const prj = JSON.parse(
|
|
24461
|
+
const prj = JSON.parse(fs17.readFileSync(prjPath, "utf8"));
|
|
24462
24462
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
24463
24463
|
throw new TypeError(
|
|
24464
24464
|
"Expected a string-valued projectId property. Try running `vc link` to re-link your project."
|
|
@@ -24473,11 +24473,11 @@ var require_token_util = __commonJS({
|
|
|
24473
24473
|
"Unable to find user data directory. Please reach out to Vercel support."
|
|
24474
24474
|
);
|
|
24475
24475
|
}
|
|
24476
|
-
const tokenPath =
|
|
24476
|
+
const tokenPath = path14.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
24477
24477
|
const tokenJson = JSON.stringify(token);
|
|
24478
|
-
|
|
24479
|
-
|
|
24480
|
-
|
|
24478
|
+
fs17.mkdirSync(path14.dirname(tokenPath), { mode: 504, recursive: true });
|
|
24479
|
+
fs17.writeFileSync(tokenPath, tokenJson);
|
|
24480
|
+
fs17.chmodSync(tokenPath, 432);
|
|
24481
24481
|
return;
|
|
24482
24482
|
}
|
|
24483
24483
|
function loadToken(projectId) {
|
|
@@ -24487,11 +24487,11 @@ var require_token_util = __commonJS({
|
|
|
24487
24487
|
"Unable to find user data directory. Please reach out to Vercel support."
|
|
24488
24488
|
);
|
|
24489
24489
|
}
|
|
24490
|
-
const tokenPath =
|
|
24491
|
-
if (!
|
|
24490
|
+
const tokenPath = path14.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
24491
|
+
if (!fs17.existsSync(tokenPath)) {
|
|
24492
24492
|
return null;
|
|
24493
24493
|
}
|
|
24494
|
-
const token = JSON.parse(
|
|
24494
|
+
const token = JSON.parse(fs17.readFileSync(tokenPath, "utf8"));
|
|
24495
24495
|
assertVercelOidcTokenResponse(token);
|
|
24496
24496
|
return token;
|
|
24497
24497
|
}
|
|
@@ -31043,14 +31043,14 @@ var require_util = __commonJS({
|
|
|
31043
31043
|
}
|
|
31044
31044
|
const port = url3.port != null ? url3.port : url3.protocol === "https:" ? 443 : 80;
|
|
31045
31045
|
let origin = url3.origin != null ? url3.origin : `${url3.protocol || ""}//${url3.hostname || ""}:${port}`;
|
|
31046
|
-
let
|
|
31046
|
+
let path14 = url3.path != null ? url3.path : `${url3.pathname || ""}${url3.search || ""}`;
|
|
31047
31047
|
if (origin[origin.length - 1] === "/") {
|
|
31048
31048
|
origin = origin.slice(0, origin.length - 1);
|
|
31049
31049
|
}
|
|
31050
|
-
if (
|
|
31051
|
-
|
|
31050
|
+
if (path14 && path14[0] !== "/") {
|
|
31051
|
+
path14 = `/${path14}`;
|
|
31052
31052
|
}
|
|
31053
|
-
return new URL(`${origin}${
|
|
31053
|
+
return new URL(`${origin}${path14}`);
|
|
31054
31054
|
}
|
|
31055
31055
|
if (!isHttpOrHttpsPrefixed(url3.origin || url3.protocol)) {
|
|
31056
31056
|
throw new InvalidArgumentError4("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -31611,9 +31611,9 @@ var require_diagnostics = __commonJS({
|
|
|
31611
31611
|
"undici:client:sendHeaders",
|
|
31612
31612
|
(evt) => {
|
|
31613
31613
|
const {
|
|
31614
|
-
request: { method, path:
|
|
31614
|
+
request: { method, path: path14, origin }
|
|
31615
31615
|
} = evt;
|
|
31616
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
31616
|
+
debugLog("sending request to %s %s%s", method, origin, path14);
|
|
31617
31617
|
}
|
|
31618
31618
|
);
|
|
31619
31619
|
}
|
|
@@ -31627,14 +31627,14 @@ var require_diagnostics = __commonJS({
|
|
|
31627
31627
|
"undici:request:headers",
|
|
31628
31628
|
(evt) => {
|
|
31629
31629
|
const {
|
|
31630
|
-
request: { method, path:
|
|
31630
|
+
request: { method, path: path14, origin },
|
|
31631
31631
|
response: { statusCode }
|
|
31632
31632
|
} = evt;
|
|
31633
31633
|
debugLog(
|
|
31634
31634
|
"received response to %s %s%s - HTTP %d",
|
|
31635
31635
|
method,
|
|
31636
31636
|
origin,
|
|
31637
|
-
|
|
31637
|
+
path14,
|
|
31638
31638
|
statusCode
|
|
31639
31639
|
);
|
|
31640
31640
|
}
|
|
@@ -31643,23 +31643,23 @@ var require_diagnostics = __commonJS({
|
|
|
31643
31643
|
"undici:request:trailers",
|
|
31644
31644
|
(evt) => {
|
|
31645
31645
|
const {
|
|
31646
|
-
request: { method, path:
|
|
31646
|
+
request: { method, path: path14, origin }
|
|
31647
31647
|
} = evt;
|
|
31648
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
31648
|
+
debugLog("trailers received from %s %s%s", method, origin, path14);
|
|
31649
31649
|
}
|
|
31650
31650
|
);
|
|
31651
31651
|
diagnosticsChannel.subscribe(
|
|
31652
31652
|
"undici:request:error",
|
|
31653
31653
|
(evt) => {
|
|
31654
31654
|
const {
|
|
31655
|
-
request: { method, path:
|
|
31655
|
+
request: { method, path: path14, origin },
|
|
31656
31656
|
error: error88
|
|
31657
31657
|
} = evt;
|
|
31658
31658
|
debugLog(
|
|
31659
31659
|
"request to %s %s%s errored - %s",
|
|
31660
31660
|
method,
|
|
31661
31661
|
origin,
|
|
31662
|
-
|
|
31662
|
+
path14,
|
|
31663
31663
|
error88.message
|
|
31664
31664
|
);
|
|
31665
31665
|
}
|
|
@@ -31755,7 +31755,7 @@ var require_request2 = __commonJS({
|
|
|
31755
31755
|
var kHandler = Symbol("handler");
|
|
31756
31756
|
var Request2 = class {
|
|
31757
31757
|
constructor(origin, {
|
|
31758
|
-
path:
|
|
31758
|
+
path: path14,
|
|
31759
31759
|
method,
|
|
31760
31760
|
body,
|
|
31761
31761
|
headers,
|
|
@@ -31771,11 +31771,11 @@ var require_request2 = __commonJS({
|
|
|
31771
31771
|
throwOnError,
|
|
31772
31772
|
maxRedirections
|
|
31773
31773
|
}, handler) {
|
|
31774
|
-
if (typeof
|
|
31774
|
+
if (typeof path14 !== "string") {
|
|
31775
31775
|
throw new InvalidArgumentError4("path must be a string");
|
|
31776
|
-
} else if (
|
|
31776
|
+
} else if (path14[0] !== "/" && !(path14.startsWith("http://") || path14.startsWith("https://")) && method !== "CONNECT") {
|
|
31777
31777
|
throw new InvalidArgumentError4("path must be an absolute URL or start with a slash");
|
|
31778
|
-
} else if (invalidPathRegex.test(
|
|
31778
|
+
} else if (invalidPathRegex.test(path14)) {
|
|
31779
31779
|
throw new InvalidArgumentError4("invalid request path");
|
|
31780
31780
|
}
|
|
31781
31781
|
if (typeof method !== "string") {
|
|
@@ -31843,7 +31843,7 @@ var require_request2 = __commonJS({
|
|
|
31843
31843
|
this.completed = false;
|
|
31844
31844
|
this.aborted = false;
|
|
31845
31845
|
this.upgrade = upgrade || null;
|
|
31846
|
-
this.path = query ? serializePathWithQuery(
|
|
31846
|
+
this.path = query ? serializePathWithQuery(path14, query) : path14;
|
|
31847
31847
|
this.origin = origin;
|
|
31848
31848
|
this.protocol = getProtocolFromUrlString(origin);
|
|
31849
31849
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -36650,7 +36650,7 @@ var require_client_h1 = __commonJS({
|
|
|
36650
36650
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
36651
36651
|
}
|
|
36652
36652
|
function writeH1(client, request) {
|
|
36653
|
-
const { method, path:
|
|
36653
|
+
const { method, path: path14, host, upgrade, blocking, reset } = request;
|
|
36654
36654
|
let { body, headers, contentLength } = request;
|
|
36655
36655
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
36656
36656
|
if (util3.isFormDataLike(body)) {
|
|
@@ -36716,7 +36716,7 @@ var require_client_h1 = __commonJS({
|
|
|
36716
36716
|
if (blocking) {
|
|
36717
36717
|
socket[kBlocking] = true;
|
|
36718
36718
|
}
|
|
36719
|
-
let header = `${method} ${
|
|
36719
|
+
let header = `${method} ${path14} HTTP/1.1\r
|
|
36720
36720
|
`;
|
|
36721
36721
|
if (typeof host === "string") {
|
|
36722
36722
|
header += `host: ${host}\r
|
|
@@ -37273,7 +37273,7 @@ var require_client_h2 = __commonJS({
|
|
|
37273
37273
|
function writeH2(client, request) {
|
|
37274
37274
|
const requestTimeout = request.bodyTimeout ?? client[kBodyTimeout];
|
|
37275
37275
|
const session = client[kHTTP2Session];
|
|
37276
|
-
const { method, path:
|
|
37276
|
+
const { method, path: path14, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request;
|
|
37277
37277
|
let { body } = request;
|
|
37278
37278
|
if (upgrade) {
|
|
37279
37279
|
util3.errorRequest(client, request, new Error("Upgrade not supported for H2"));
|
|
@@ -37352,7 +37352,7 @@ var require_client_h2 = __commonJS({
|
|
|
37352
37352
|
stream2.setTimeout(requestTimeout);
|
|
37353
37353
|
return true;
|
|
37354
37354
|
}
|
|
37355
|
-
headers[HTTP2_HEADER_PATH] =
|
|
37355
|
+
headers[HTTP2_HEADER_PATH] = path14;
|
|
37356
37356
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
37357
37357
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
37358
37358
|
if (body && typeof body.read === "function") {
|
|
@@ -38824,10 +38824,10 @@ var require_proxy_agent = __commonJS({
|
|
|
38824
38824
|
};
|
|
38825
38825
|
const {
|
|
38826
38826
|
origin,
|
|
38827
|
-
path:
|
|
38827
|
+
path: path14 = "/",
|
|
38828
38828
|
headers = {}
|
|
38829
38829
|
} = opts;
|
|
38830
|
-
opts.path = origin +
|
|
38830
|
+
opts.path = origin + path14;
|
|
38831
38831
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
38832
38832
|
const { host } = new URL(origin);
|
|
38833
38833
|
headers.host = host;
|
|
@@ -40913,20 +40913,20 @@ var require_mock_utils = __commonJS({
|
|
|
40913
40913
|
}
|
|
40914
40914
|
return normalizedQp;
|
|
40915
40915
|
}
|
|
40916
|
-
function safeUrl(
|
|
40917
|
-
if (typeof
|
|
40918
|
-
return
|
|
40916
|
+
function safeUrl(path14) {
|
|
40917
|
+
if (typeof path14 !== "string") {
|
|
40918
|
+
return path14;
|
|
40919
40919
|
}
|
|
40920
|
-
const pathSegments =
|
|
40920
|
+
const pathSegments = path14.split("?", 3);
|
|
40921
40921
|
if (pathSegments.length !== 2) {
|
|
40922
|
-
return
|
|
40922
|
+
return path14;
|
|
40923
40923
|
}
|
|
40924
40924
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
40925
40925
|
qp.sort();
|
|
40926
40926
|
return [...pathSegments, qp.toString()].join("?");
|
|
40927
40927
|
}
|
|
40928
|
-
function matchKey(mockDispatch2, { path:
|
|
40929
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
40928
|
+
function matchKey(mockDispatch2, { path: path14, method, body, headers }) {
|
|
40929
|
+
const pathMatch = matchValue(mockDispatch2.path, path14);
|
|
40930
40930
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
40931
40931
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
40932
40932
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -40951,8 +40951,8 @@ var require_mock_utils = __commonJS({
|
|
|
40951
40951
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
40952
40952
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
40953
40953
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
40954
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
40955
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
40954
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path14, ignoreTrailingSlash }) => {
|
|
40955
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path14)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path14), resolvedPath);
|
|
40956
40956
|
});
|
|
40957
40957
|
if (matchedMockDispatches.length === 0) {
|
|
40958
40958
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -40990,19 +40990,19 @@ var require_mock_utils = __commonJS({
|
|
|
40990
40990
|
mockDispatches.splice(index, 1);
|
|
40991
40991
|
}
|
|
40992
40992
|
}
|
|
40993
|
-
function removeTrailingSlash(
|
|
40994
|
-
while (
|
|
40995
|
-
|
|
40993
|
+
function removeTrailingSlash(path14) {
|
|
40994
|
+
while (path14.endsWith("/")) {
|
|
40995
|
+
path14 = path14.slice(0, -1);
|
|
40996
40996
|
}
|
|
40997
|
-
if (
|
|
40998
|
-
|
|
40997
|
+
if (path14.length === 0) {
|
|
40998
|
+
path14 = "/";
|
|
40999
40999
|
}
|
|
41000
|
-
return
|
|
41000
|
+
return path14;
|
|
41001
41001
|
}
|
|
41002
41002
|
function buildKey(opts) {
|
|
41003
|
-
const { path:
|
|
41003
|
+
const { path: path14, method, body, headers, query } = opts;
|
|
41004
41004
|
return {
|
|
41005
|
-
path:
|
|
41005
|
+
path: path14,
|
|
41006
41006
|
method,
|
|
41007
41007
|
body,
|
|
41008
41008
|
headers,
|
|
@@ -41660,10 +41660,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
41660
41660
|
}
|
|
41661
41661
|
format(pendingInterceptors) {
|
|
41662
41662
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
41663
|
-
({ method, path:
|
|
41663
|
+
({ method, path: path14, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
41664
41664
|
Method: method,
|
|
41665
41665
|
Origin: origin,
|
|
41666
|
-
Path:
|
|
41666
|
+
Path: path14,
|
|
41667
41667
|
"Status code": statusCode,
|
|
41668
41668
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
41669
41669
|
Invocations: timesInvoked,
|
|
@@ -41743,9 +41743,9 @@ var require_mock_agent = __commonJS({
|
|
|
41743
41743
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
41744
41744
|
const dispatchOpts = { ...opts };
|
|
41745
41745
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
41746
|
-
const [
|
|
41746
|
+
const [path14, searchParams] = dispatchOpts.path.split("?");
|
|
41747
41747
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
41748
|
-
dispatchOpts.path = `${
|
|
41748
|
+
dispatchOpts.path = `${path14}?${normalizedSearchParams}`;
|
|
41749
41749
|
}
|
|
41750
41750
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
41751
41751
|
}
|
|
@@ -42142,12 +42142,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
42142
42142
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
42143
42143
|
*/
|
|
42144
42144
|
async loadSnapshots(filePath) {
|
|
42145
|
-
const
|
|
42146
|
-
if (!
|
|
42145
|
+
const path14 = filePath || this.#snapshotPath;
|
|
42146
|
+
if (!path14) {
|
|
42147
42147
|
throw new InvalidArgumentError4("Snapshot path is required");
|
|
42148
42148
|
}
|
|
42149
42149
|
try {
|
|
42150
|
-
const data = await readFile6(resolve3(
|
|
42150
|
+
const data = await readFile6(resolve3(path14), "utf8");
|
|
42151
42151
|
const parsed = JSON.parse(data);
|
|
42152
42152
|
if (Array.isArray(parsed)) {
|
|
42153
42153
|
this.#snapshots.clear();
|
|
@@ -42161,7 +42161,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
42161
42161
|
if (error88.code === "ENOENT") {
|
|
42162
42162
|
this.#snapshots.clear();
|
|
42163
42163
|
} else {
|
|
42164
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
42164
|
+
throw new UndiciError(`Failed to load snapshots from ${path14}`, { cause: error88 });
|
|
42165
42165
|
}
|
|
42166
42166
|
}
|
|
42167
42167
|
}
|
|
@@ -42172,11 +42172,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
42172
42172
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
42173
42173
|
*/
|
|
42174
42174
|
async saveSnapshots(filePath) {
|
|
42175
|
-
const
|
|
42176
|
-
if (!
|
|
42175
|
+
const path14 = filePath || this.#snapshotPath;
|
|
42176
|
+
if (!path14) {
|
|
42177
42177
|
throw new InvalidArgumentError4("Snapshot path is required");
|
|
42178
42178
|
}
|
|
42179
|
-
const resolvedPath = resolve3(
|
|
42179
|
+
const resolvedPath = resolve3(path14);
|
|
42180
42180
|
await mkdir2(dirname4(resolvedPath), { recursive: true });
|
|
42181
42181
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
42182
42182
|
hash: hash2,
|
|
@@ -42802,15 +42802,15 @@ var require_redirect_handler = __commonJS({
|
|
|
42802
42802
|
return;
|
|
42803
42803
|
}
|
|
42804
42804
|
const { origin, pathname, search } = util3.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
42805
|
-
const
|
|
42806
|
-
const redirectUrlString = `${origin}${
|
|
42805
|
+
const path14 = search ? `${pathname}${search}` : pathname;
|
|
42806
|
+
const redirectUrlString = `${origin}${path14}`;
|
|
42807
42807
|
for (const historyUrl of this.history) {
|
|
42808
42808
|
if (historyUrl.toString() === redirectUrlString) {
|
|
42809
42809
|
throw new InvalidArgumentError4(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
|
|
42810
42810
|
}
|
|
42811
42811
|
}
|
|
42812
42812
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
42813
|
-
this.opts.path =
|
|
42813
|
+
this.opts.path = path14;
|
|
42814
42814
|
this.opts.origin = origin;
|
|
42815
42815
|
this.opts.query = null;
|
|
42816
42816
|
}
|
|
@@ -49201,9 +49201,9 @@ var require_util4 = __commonJS({
|
|
|
49201
49201
|
}
|
|
49202
49202
|
}
|
|
49203
49203
|
}
|
|
49204
|
-
function validateCookiePath(
|
|
49205
|
-
for (let i = 0; i <
|
|
49206
|
-
const code =
|
|
49204
|
+
function validateCookiePath(path14) {
|
|
49205
|
+
for (let i = 0; i < path14.length; ++i) {
|
|
49206
|
+
const code = path14.charCodeAt(i);
|
|
49207
49207
|
if (code < 32 || // exclude CTLs (0-31)
|
|
49208
49208
|
code === 127 || // DEL
|
|
49209
49209
|
code === 59) {
|
|
@@ -52311,11 +52311,11 @@ var require_undici = __commonJS({
|
|
|
52311
52311
|
if (typeof opts.path !== "string") {
|
|
52312
52312
|
throw new InvalidArgumentError4("invalid opts.path");
|
|
52313
52313
|
}
|
|
52314
|
-
let
|
|
52314
|
+
let path14 = opts.path;
|
|
52315
52315
|
if (!opts.path.startsWith("/")) {
|
|
52316
|
-
|
|
52316
|
+
path14 = `/${path14}`;
|
|
52317
52317
|
}
|
|
52318
|
-
url3 = new URL(util3.parseOrigin(url3).origin +
|
|
52318
|
+
url3 = new URL(util3.parseOrigin(url3).origin + path14);
|
|
52319
52319
|
} else {
|
|
52320
52320
|
if (!opts) {
|
|
52321
52321
|
opts = typeof url3 === "object" ? url3 : {};
|
|
@@ -52665,12 +52665,12 @@ async function startup() {
|
|
|
52665
52665
|
const workspaceRoot2 = await workspaceRoot();
|
|
52666
52666
|
log("Starting PM2 in workspace:", workspaceRoot2);
|
|
52667
52667
|
const runner = new Runner(workspaceRoot2, log);
|
|
52668
|
-
const
|
|
52669
|
-
if (!
|
|
52668
|
+
const configPath2 = await findPm2Config(workspaceRoot2, log);
|
|
52669
|
+
if (!configPath2) {
|
|
52670
52670
|
log("No PM2 config found");
|
|
52671
52671
|
return;
|
|
52672
52672
|
}
|
|
52673
|
-
let config3 =
|
|
52673
|
+
let config3 = configPath2 ? await loadPm2Config(configPath2) : { apps: [] };
|
|
52674
52674
|
try {
|
|
52675
52675
|
await runner.runRebuildCommands(config3);
|
|
52676
52676
|
await runner.runInstallCommands(config3);
|
|
@@ -52684,10 +52684,10 @@ async function startup() {
|
|
|
52684
52684
|
} catch (error88) {
|
|
52685
52685
|
log(`\u274C Failed to run pre-run commands: ${error88}`);
|
|
52686
52686
|
}
|
|
52687
|
-
if (
|
|
52687
|
+
if (configPath2) {
|
|
52688
52688
|
try {
|
|
52689
|
-
await runner.startEco(
|
|
52690
|
-
log(`\u2705 PM2 started successfully from ${
|
|
52689
|
+
await runner.startEco(configPath2);
|
|
52690
|
+
log(`\u2705 PM2 started successfully from ${configPath2}`);
|
|
52691
52691
|
await runner.printPm2ProcessStatus();
|
|
52692
52692
|
} catch (error88) {
|
|
52693
52693
|
log(`\u274C Failed to start PM2: ${error88}`);
|
|
@@ -52737,19 +52737,19 @@ async function findPm2Config(workspaceRoot2, log_cb) {
|
|
|
52737
52737
|
} catch (error88) {
|
|
52738
52738
|
log("Error reading workspace directories:", error88);
|
|
52739
52739
|
}
|
|
52740
|
-
for (const
|
|
52740
|
+
for (const configPath2 of configPaths) {
|
|
52741
52741
|
try {
|
|
52742
|
-
await fs2.access(
|
|
52743
|
-
return
|
|
52742
|
+
await fs2.access(configPath2);
|
|
52743
|
+
return configPath2;
|
|
52744
52744
|
} catch {
|
|
52745
52745
|
}
|
|
52746
52746
|
}
|
|
52747
52747
|
log_cb?.("No PM2 config found in any location");
|
|
52748
52748
|
return null;
|
|
52749
52749
|
}
|
|
52750
|
-
async function loadPm2Config(
|
|
52750
|
+
async function loadPm2Config(configPath2) {
|
|
52751
52751
|
try {
|
|
52752
|
-
let configContent = await fs2.readFile(
|
|
52752
|
+
let configContent = await fs2.readFile(configPath2, "utf8");
|
|
52753
52753
|
configContent = configContent.replace(
|
|
52754
52754
|
/export\s+default\s+/g,
|
|
52755
52755
|
"module.exports = "
|
|
@@ -53487,7 +53487,7 @@ function parseXmlResponse(xmlString) {
|
|
|
53487
53487
|
const fileXml = remainingXml.slice(fileStart, fileEnd);
|
|
53488
53488
|
const pathMatch = fileXml.match(/path="([^"]*)"/);
|
|
53489
53489
|
const actionMatch = fileXml.match(/action="([^"]*)"/);
|
|
53490
|
-
const
|
|
53490
|
+
const path14 = pathMatch ? pathMatch[1] : "";
|
|
53491
53491
|
const action = actionMatch ? actionMatch[1] : "modify";
|
|
53492
53492
|
const changes = [];
|
|
53493
53493
|
let changeXml = fileXml;
|
|
@@ -53536,7 +53536,7 @@ function parseXmlResponse(xmlString) {
|
|
|
53536
53536
|
changeXml = changeXml.slice(changeEnd);
|
|
53537
53537
|
}
|
|
53538
53538
|
if (changes.length > 0) {
|
|
53539
|
-
files2.push({ path:
|
|
53539
|
+
files2.push({ path: path14, action, changes });
|
|
53540
53540
|
}
|
|
53541
53541
|
remainingXml = remainingXml.slice(fileEnd);
|
|
53542
53542
|
}
|
|
@@ -57595,12 +57595,12 @@ var PathBase = class {
|
|
|
57595
57595
|
/**
|
|
57596
57596
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
57597
57597
|
*/
|
|
57598
|
-
resolve(
|
|
57599
|
-
if (!
|
|
57598
|
+
resolve(path14) {
|
|
57599
|
+
if (!path14) {
|
|
57600
57600
|
return this;
|
|
57601
57601
|
}
|
|
57602
|
-
const rootPath = this.getRootString(
|
|
57603
|
-
const dir =
|
|
57602
|
+
const rootPath = this.getRootString(path14);
|
|
57603
|
+
const dir = path14.substring(rootPath.length);
|
|
57604
57604
|
const dirParts = dir.split(this.splitSep);
|
|
57605
57605
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
57606
57606
|
return result;
|
|
@@ -58352,8 +58352,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
|
|
|
58352
58352
|
/**
|
|
58353
58353
|
* @internal
|
|
58354
58354
|
*/
|
|
58355
|
-
getRootString(
|
|
58356
|
-
return import_node_path.win32.parse(
|
|
58355
|
+
getRootString(path14) {
|
|
58356
|
+
return import_node_path.win32.parse(path14).root;
|
|
58357
58357
|
}
|
|
58358
58358
|
/**
|
|
58359
58359
|
* @internal
|
|
@@ -58399,8 +58399,8 @@ var PathPosix = class _PathPosix extends PathBase {
|
|
|
58399
58399
|
/**
|
|
58400
58400
|
* @internal
|
|
58401
58401
|
*/
|
|
58402
|
-
getRootString(
|
|
58403
|
-
return
|
|
58402
|
+
getRootString(path14) {
|
|
58403
|
+
return path14.startsWith("/") ? "/" : "";
|
|
58404
58404
|
}
|
|
58405
58405
|
/**
|
|
58406
58406
|
* @internal
|
|
@@ -58449,8 +58449,8 @@ var PathScurryBase = class {
|
|
|
58449
58449
|
*
|
|
58450
58450
|
* @internal
|
|
58451
58451
|
*/
|
|
58452
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
58453
|
-
this.#fs = fsFromOption(
|
|
58452
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs17 = defaultFS } = {}) {
|
|
58453
|
+
this.#fs = fsFromOption(fs17);
|
|
58454
58454
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
58455
58455
|
cwd = (0, import_node_url.fileURLToPath)(cwd);
|
|
58456
58456
|
}
|
|
@@ -58489,11 +58489,11 @@ var PathScurryBase = class {
|
|
|
58489
58489
|
/**
|
|
58490
58490
|
* Get the depth of a provided path, string, or the cwd
|
|
58491
58491
|
*/
|
|
58492
|
-
depth(
|
|
58493
|
-
if (typeof
|
|
58494
|
-
|
|
58492
|
+
depth(path14 = this.cwd) {
|
|
58493
|
+
if (typeof path14 === "string") {
|
|
58494
|
+
path14 = this.cwd.resolve(path14);
|
|
58495
58495
|
}
|
|
58496
|
-
return
|
|
58496
|
+
return path14.depth();
|
|
58497
58497
|
}
|
|
58498
58498
|
/**
|
|
58499
58499
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -58980,9 +58980,9 @@ var PathScurryBase = class {
|
|
|
58980
58980
|
process3();
|
|
58981
58981
|
return results;
|
|
58982
58982
|
}
|
|
58983
|
-
chdir(
|
|
58983
|
+
chdir(path14 = this.cwd) {
|
|
58984
58984
|
const oldCwd = this.cwd;
|
|
58985
|
-
this.cwd = typeof
|
|
58985
|
+
this.cwd = typeof path14 === "string" ? this.cwd.resolve(path14) : path14;
|
|
58986
58986
|
this.cwd[setAsCwd](oldCwd);
|
|
58987
58987
|
}
|
|
58988
58988
|
};
|
|
@@ -59008,8 +59008,8 @@ var PathScurryWin32 = class extends PathScurryBase {
|
|
|
59008
59008
|
/**
|
|
59009
59009
|
* @internal
|
|
59010
59010
|
*/
|
|
59011
|
-
newRoot(
|
|
59012
|
-
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
59011
|
+
newRoot(fs17) {
|
|
59012
|
+
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs17 });
|
|
59013
59013
|
}
|
|
59014
59014
|
/**
|
|
59015
59015
|
* Return true if the provided path string is an absolute path
|
|
@@ -59037,8 +59037,8 @@ var PathScurryPosix = class extends PathScurryBase {
|
|
|
59037
59037
|
/**
|
|
59038
59038
|
* @internal
|
|
59039
59039
|
*/
|
|
59040
|
-
newRoot(
|
|
59041
|
-
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
59040
|
+
newRoot(fs17) {
|
|
59041
|
+
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs17 });
|
|
59042
59042
|
}
|
|
59043
59043
|
/**
|
|
59044
59044
|
* Return true if the provided path string is an absolute path
|
|
@@ -59338,8 +59338,8 @@ var MatchRecord = class {
|
|
|
59338
59338
|
}
|
|
59339
59339
|
// match, absolute, ifdir
|
|
59340
59340
|
entries() {
|
|
59341
|
-
return [...this.store.entries()].map(([
|
|
59342
|
-
|
|
59341
|
+
return [...this.store.entries()].map(([path14, n]) => [
|
|
59342
|
+
path14,
|
|
59343
59343
|
!!(n & 2),
|
|
59344
59344
|
!!(n & 1)
|
|
59345
59345
|
]);
|
|
@@ -59544,9 +59544,9 @@ var GlobUtil = class {
|
|
|
59544
59544
|
signal;
|
|
59545
59545
|
maxDepth;
|
|
59546
59546
|
includeChildMatches;
|
|
59547
|
-
constructor(patterns,
|
|
59547
|
+
constructor(patterns, path14, opts) {
|
|
59548
59548
|
this.patterns = patterns;
|
|
59549
|
-
this.path =
|
|
59549
|
+
this.path = path14;
|
|
59550
59550
|
this.opts = opts;
|
|
59551
59551
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
59552
59552
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -59565,11 +59565,11 @@ var GlobUtil = class {
|
|
|
59565
59565
|
});
|
|
59566
59566
|
}
|
|
59567
59567
|
}
|
|
59568
|
-
#ignored(
|
|
59569
|
-
return this.seen.has(
|
|
59568
|
+
#ignored(path14) {
|
|
59569
|
+
return this.seen.has(path14) || !!this.#ignore?.ignored?.(path14);
|
|
59570
59570
|
}
|
|
59571
|
-
#childrenIgnored(
|
|
59572
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
59571
|
+
#childrenIgnored(path14) {
|
|
59572
|
+
return !!this.#ignore?.childrenIgnored?.(path14);
|
|
59573
59573
|
}
|
|
59574
59574
|
// backpressure mechanism
|
|
59575
59575
|
pause() {
|
|
@@ -59784,8 +59784,8 @@ var GlobUtil = class {
|
|
|
59784
59784
|
};
|
|
59785
59785
|
var GlobWalker = class extends GlobUtil {
|
|
59786
59786
|
matches = /* @__PURE__ */ new Set();
|
|
59787
|
-
constructor(patterns,
|
|
59788
|
-
super(patterns,
|
|
59787
|
+
constructor(patterns, path14, opts) {
|
|
59788
|
+
super(patterns, path14, opts);
|
|
59789
59789
|
}
|
|
59790
59790
|
matchEmit(e) {
|
|
59791
59791
|
this.matches.add(e);
|
|
@@ -59822,8 +59822,8 @@ var GlobWalker = class extends GlobUtil {
|
|
|
59822
59822
|
};
|
|
59823
59823
|
var GlobStream = class extends GlobUtil {
|
|
59824
59824
|
results;
|
|
59825
|
-
constructor(patterns,
|
|
59826
|
-
super(patterns,
|
|
59825
|
+
constructor(patterns, path14, opts) {
|
|
59826
|
+
super(patterns, path14, opts);
|
|
59827
59827
|
this.results = new Minipass({
|
|
59828
59828
|
signal: this.signal,
|
|
59829
59829
|
objectMode: true
|
|
@@ -60991,7 +60991,7 @@ var SSEManager = class {
|
|
|
60991
60991
|
var sseManager = new SSEManager();
|
|
60992
60992
|
|
|
60993
60993
|
// src/proxy/version.ts
|
|
60994
|
-
var VERSION = "0.5.
|
|
60994
|
+
var VERSION = "0.5.6";
|
|
60995
60995
|
|
|
60996
60996
|
// node_modules/uuid/dist/esm/stringify.js
|
|
60997
60997
|
var byteToHex = [];
|
|
@@ -61110,7 +61110,7 @@ function isReqTypeBusy(req_type) {
|
|
|
61110
61110
|
|
|
61111
61111
|
// src/agent/utils.ts
|
|
61112
61112
|
var proc5 = __toESM(require("child_process"), 1);
|
|
61113
|
-
var COMMAND_TIMEOUT_MS =
|
|
61113
|
+
var COMMAND_TIMEOUT_MS = 90 * 60 * 1e3;
|
|
61114
61114
|
async function executeCommand(command, cwd, env2, log_cb) {
|
|
61115
61115
|
return new Promise((resolve3, reject) => {
|
|
61116
61116
|
const child = proc5.spawn("sh", ["-c", command], {
|
|
@@ -61973,10 +61973,10 @@ function mergeDefs(...defs) {
|
|
|
61973
61973
|
function cloneDef(schema) {
|
|
61974
61974
|
return mergeDefs(schema._zod.def);
|
|
61975
61975
|
}
|
|
61976
|
-
function getElementAtPath(obj,
|
|
61977
|
-
if (!
|
|
61976
|
+
function getElementAtPath(obj, path14) {
|
|
61977
|
+
if (!path14)
|
|
61978
61978
|
return obj;
|
|
61979
|
-
return
|
|
61979
|
+
return path14.reduce((acc, key) => acc?.[key], obj);
|
|
61980
61980
|
}
|
|
61981
61981
|
function promiseAllObject(promisesObj) {
|
|
61982
61982
|
const keys = Object.keys(promisesObj);
|
|
@@ -62359,11 +62359,11 @@ function aborted(x, startIndex = 0) {
|
|
|
62359
62359
|
}
|
|
62360
62360
|
return false;
|
|
62361
62361
|
}
|
|
62362
|
-
function prefixIssues(
|
|
62362
|
+
function prefixIssues(path14, issues) {
|
|
62363
62363
|
return issues.map((iss) => {
|
|
62364
62364
|
var _a26;
|
|
62365
62365
|
(_a26 = iss).path ?? (_a26.path = []);
|
|
62366
|
-
iss.path.unshift(
|
|
62366
|
+
iss.path.unshift(path14);
|
|
62367
62367
|
return iss;
|
|
62368
62368
|
});
|
|
62369
62369
|
}
|
|
@@ -62546,7 +62546,7 @@ function formatError(error88, mapper = (issue3) => issue3.message) {
|
|
|
62546
62546
|
}
|
|
62547
62547
|
function treeifyError(error88, mapper = (issue3) => issue3.message) {
|
|
62548
62548
|
const result = { errors: [] };
|
|
62549
|
-
const processError = (error89,
|
|
62549
|
+
const processError = (error89, path14 = []) => {
|
|
62550
62550
|
var _a26, _b20;
|
|
62551
62551
|
for (const issue3 of error89.issues) {
|
|
62552
62552
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
@@ -62556,7 +62556,7 @@ function treeifyError(error88, mapper = (issue3) => issue3.message) {
|
|
|
62556
62556
|
} else if (issue3.code === "invalid_element") {
|
|
62557
62557
|
processError({ issues: issue3.issues }, issue3.path);
|
|
62558
62558
|
} else {
|
|
62559
|
-
const fullpath = [...
|
|
62559
|
+
const fullpath = [...path14, ...issue3.path];
|
|
62560
62560
|
if (fullpath.length === 0) {
|
|
62561
62561
|
result.errors.push(mapper(issue3));
|
|
62562
62562
|
continue;
|
|
@@ -62588,8 +62588,8 @@ function treeifyError(error88, mapper = (issue3) => issue3.message) {
|
|
|
62588
62588
|
}
|
|
62589
62589
|
function toDotPath(_path) {
|
|
62590
62590
|
const segs = [];
|
|
62591
|
-
const
|
|
62592
|
-
for (const seg of
|
|
62591
|
+
const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
62592
|
+
for (const seg of path14) {
|
|
62593
62593
|
if (typeof seg === "number")
|
|
62594
62594
|
segs.push(`[${seg}]`);
|
|
62595
62595
|
else if (typeof seg === "symbol")
|
|
@@ -74566,13 +74566,13 @@ function resolveRef(ref, ctx) {
|
|
|
74566
74566
|
if (!ref.startsWith("#")) {
|
|
74567
74567
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
74568
74568
|
}
|
|
74569
|
-
const
|
|
74570
|
-
if (
|
|
74569
|
+
const path14 = ref.slice(1).split("/").filter(Boolean);
|
|
74570
|
+
if (path14.length === 0) {
|
|
74571
74571
|
return ctx.rootSchema;
|
|
74572
74572
|
}
|
|
74573
74573
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
74574
|
-
if (
|
|
74575
|
-
const key =
|
|
74574
|
+
if (path14[0] === defsKey) {
|
|
74575
|
+
const key = path14[1];
|
|
74576
74576
|
if (!key || !ctx.defs[key]) {
|
|
74577
74577
|
throw new Error(`Reference not found: ${ref}`);
|
|
74578
74578
|
}
|
|
@@ -75333,8 +75333,8 @@ function getErrorMap2() {
|
|
|
75333
75333
|
|
|
75334
75334
|
// node_modules/aieo/node_modules/zod/v3/helpers/parseUtil.js
|
|
75335
75335
|
var makeIssue = (params) => {
|
|
75336
|
-
const { data, path:
|
|
75337
|
-
const fullPath = [...
|
|
75336
|
+
const { data, path: path14, errorMaps, issueData } = params;
|
|
75337
|
+
const fullPath = [...path14, ...issueData.path || []];
|
|
75338
75338
|
const fullIssue = {
|
|
75339
75339
|
...issueData,
|
|
75340
75340
|
path: fullPath
|
|
@@ -75449,11 +75449,11 @@ var errorUtil;
|
|
|
75449
75449
|
|
|
75450
75450
|
// node_modules/aieo/node_modules/zod/v3/types.js
|
|
75451
75451
|
var ParseInputLazyPath = class {
|
|
75452
|
-
constructor(parent, value,
|
|
75452
|
+
constructor(parent, value, path14, key) {
|
|
75453
75453
|
this._cachedPath = [];
|
|
75454
75454
|
this.parent = parent;
|
|
75455
75455
|
this.data = value;
|
|
75456
|
-
this._path =
|
|
75456
|
+
this._path = path14;
|
|
75457
75457
|
this._key = key;
|
|
75458
75458
|
}
|
|
75459
75459
|
get path() {
|
|
@@ -79849,10 +79849,10 @@ function assignProp2(target, prop, value) {
|
|
|
79849
79849
|
configurable: true
|
|
79850
79850
|
});
|
|
79851
79851
|
}
|
|
79852
|
-
function getElementAtPath2(obj,
|
|
79853
|
-
if (!
|
|
79852
|
+
function getElementAtPath2(obj, path14) {
|
|
79853
|
+
if (!path14)
|
|
79854
79854
|
return obj;
|
|
79855
|
-
return
|
|
79855
|
+
return path14.reduce((acc, key) => acc?.[key], obj);
|
|
79856
79856
|
}
|
|
79857
79857
|
function promiseAllObject2(promisesObj) {
|
|
79858
79858
|
const keys = Object.keys(promisesObj);
|
|
@@ -80172,11 +80172,11 @@ function aborted2(x, startIndex = 0) {
|
|
|
80172
80172
|
}
|
|
80173
80173
|
return false;
|
|
80174
80174
|
}
|
|
80175
|
-
function prefixIssues2(
|
|
80175
|
+
function prefixIssues2(path14, issues) {
|
|
80176
80176
|
return issues.map((iss) => {
|
|
80177
80177
|
var _a26;
|
|
80178
80178
|
(_a26 = iss).path ?? (_a26.path = []);
|
|
80179
|
-
iss.path.unshift(
|
|
80179
|
+
iss.path.unshift(path14);
|
|
80180
80180
|
return iss;
|
|
80181
80181
|
});
|
|
80182
80182
|
}
|
|
@@ -80313,7 +80313,7 @@ function treeifyError2(error88, _mapper) {
|
|
|
80313
80313
|
return issue3.message;
|
|
80314
80314
|
};
|
|
80315
80315
|
const result = { errors: [] };
|
|
80316
|
-
const processError = (error89,
|
|
80316
|
+
const processError = (error89, path14 = []) => {
|
|
80317
80317
|
var _a26, _b20;
|
|
80318
80318
|
for (const issue3 of error89.issues) {
|
|
80319
80319
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
@@ -80323,7 +80323,7 @@ function treeifyError2(error88, _mapper) {
|
|
|
80323
80323
|
} else if (issue3.code === "invalid_element") {
|
|
80324
80324
|
processError({ issues: issue3.issues }, issue3.path);
|
|
80325
80325
|
} else {
|
|
80326
|
-
const fullpath = [...
|
|
80326
|
+
const fullpath = [...path14, ...issue3.path];
|
|
80327
80327
|
if (fullpath.length === 0) {
|
|
80328
80328
|
result.errors.push(mapper(issue3));
|
|
80329
80329
|
continue;
|
|
@@ -80353,9 +80353,9 @@ function treeifyError2(error88, _mapper) {
|
|
|
80353
80353
|
processError(error88);
|
|
80354
80354
|
return result;
|
|
80355
80355
|
}
|
|
80356
|
-
function toDotPath2(
|
|
80356
|
+
function toDotPath2(path14) {
|
|
80357
80357
|
const segs = [];
|
|
80358
|
-
for (const seg of
|
|
80358
|
+
for (const seg of path14) {
|
|
80359
80359
|
if (typeof seg === "number")
|
|
80360
80360
|
segs.push(`[${seg}]`);
|
|
80361
80361
|
else if (typeof seg === "symbol")
|
|
@@ -90814,8 +90814,8 @@ function getErrorMap4() {
|
|
|
90814
90814
|
|
|
90815
90815
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
90816
90816
|
var makeIssue2 = (params) => {
|
|
90817
|
-
const { data, path:
|
|
90818
|
-
const fullPath = [...
|
|
90817
|
+
const { data, path: path14, errorMaps, issueData } = params;
|
|
90818
|
+
const fullPath = [...path14, ...issueData.path || []];
|
|
90819
90819
|
const fullIssue = {
|
|
90820
90820
|
...issueData,
|
|
90821
90821
|
path: fullPath
|
|
@@ -90931,11 +90931,11 @@ var errorUtil2;
|
|
|
90931
90931
|
|
|
90932
90932
|
// node_modules/zod/v3/types.js
|
|
90933
90933
|
var ParseInputLazyPath2 = class {
|
|
90934
|
-
constructor(parent, value,
|
|
90934
|
+
constructor(parent, value, path14, key) {
|
|
90935
90935
|
this._cachedPath = [];
|
|
90936
90936
|
this.parent = parent;
|
|
90937
90937
|
this.data = value;
|
|
90938
|
-
this._path =
|
|
90938
|
+
this._path = path14;
|
|
90939
90939
|
this._key = key;
|
|
90940
90940
|
}
|
|
90941
90941
|
get path() {
|
|
@@ -102425,14 +102425,14 @@ var ClientSDK = class {
|
|
|
102425
102425
|
}
|
|
102426
102426
|
}
|
|
102427
102427
|
_createRequest(context2, conf, options) {
|
|
102428
|
-
const { method, path:
|
|
102428
|
+
const { method, path: path14, query, headers: opHeaders, security } = conf;
|
|
102429
102429
|
const base = conf.baseURL ?? this._baseURL;
|
|
102430
102430
|
if (!base) {
|
|
102431
102431
|
return ERR(new InvalidRequestError("No base URL provided for operation"));
|
|
102432
102432
|
}
|
|
102433
102433
|
const reqURL = new URL(base);
|
|
102434
|
-
const inputURL = new URL(
|
|
102435
|
-
if (
|
|
102434
|
+
const inputURL = new URL(path14, reqURL);
|
|
102435
|
+
if (path14) {
|
|
102436
102436
|
reqURL.pathname += reqURL.pathname.endsWith("/") ? "" : "/";
|
|
102437
102437
|
reqURL.pathname += inputURL.pathname.replace(/^\/+/, "");
|
|
102438
102438
|
}
|
|
@@ -104688,7 +104688,7 @@ async function $do(client, request, options) {
|
|
|
104688
104688
|
}
|
|
104689
104689
|
const payload = parsed.value;
|
|
104690
104690
|
const body = null;
|
|
104691
|
-
const
|
|
104691
|
+
const path14 = pathToFunc("/activity")();
|
|
104692
104692
|
const query = encodeFormQuery({
|
|
104693
104693
|
"date": payload?.date
|
|
104694
104694
|
});
|
|
@@ -104712,7 +104712,7 @@ async function $do(client, request, options) {
|
|
|
104712
104712
|
security: requestSecurity,
|
|
104713
104713
|
method: "GET",
|
|
104714
104714
|
baseURL: options?.serverURL,
|
|
104715
|
-
path:
|
|
104715
|
+
path: path14,
|
|
104716
104716
|
headers,
|
|
104717
104717
|
query,
|
|
104718
104718
|
body,
|
|
@@ -104767,7 +104767,7 @@ async function $do2(client, request, options) {
|
|
|
104767
104767
|
}
|
|
104768
104768
|
const payload = parsed.value;
|
|
104769
104769
|
const body = encodeJSON("body", payload, { explode: true });
|
|
104770
|
-
const
|
|
104770
|
+
const path14 = pathToFunc("/keys")();
|
|
104771
104771
|
const headers = new Headers(compactMap({
|
|
104772
104772
|
"Content-Type": "application/json",
|
|
104773
104773
|
Accept: "application/json"
|
|
@@ -104789,7 +104789,7 @@ async function $do2(client, request, options) {
|
|
|
104789
104789
|
security: requestSecurity,
|
|
104790
104790
|
method: "POST",
|
|
104791
104791
|
baseURL: options?.serverURL,
|
|
104792
|
-
path:
|
|
104792
|
+
path: path14,
|
|
104793
104793
|
headers,
|
|
104794
104794
|
body,
|
|
104795
104795
|
userAgent: client._options.userAgent,
|
|
@@ -104836,7 +104836,7 @@ async function $do3(client, request, options) {
|
|
|
104836
104836
|
charEncoding: "percent"
|
|
104837
104837
|
})
|
|
104838
104838
|
};
|
|
104839
|
-
const
|
|
104839
|
+
const path14 = pathToFunc("/keys/{hash}")(pathParams);
|
|
104840
104840
|
const headers = new Headers(compactMap({
|
|
104841
104841
|
Accept: "application/json"
|
|
104842
104842
|
}));
|
|
@@ -104857,7 +104857,7 @@ async function $do3(client, request, options) {
|
|
|
104857
104857
|
security: requestSecurity,
|
|
104858
104858
|
method: "DELETE",
|
|
104859
104859
|
baseURL: options?.serverURL,
|
|
104860
|
-
path:
|
|
104860
|
+
path: path14,
|
|
104861
104861
|
headers,
|
|
104862
104862
|
body,
|
|
104863
104863
|
userAgent: client._options.userAgent,
|
|
@@ -104904,7 +104904,7 @@ async function $do4(client, request, options) {
|
|
|
104904
104904
|
charEncoding: "percent"
|
|
104905
104905
|
})
|
|
104906
104906
|
};
|
|
104907
|
-
const
|
|
104907
|
+
const path14 = pathToFunc("/keys/{hash}")(pathParams);
|
|
104908
104908
|
const headers = new Headers(compactMap({
|
|
104909
104909
|
Accept: "application/json"
|
|
104910
104910
|
}));
|
|
@@ -104925,7 +104925,7 @@ async function $do4(client, request, options) {
|
|
|
104925
104925
|
security: requestSecurity,
|
|
104926
104926
|
method: "GET",
|
|
104927
104927
|
baseURL: options?.serverURL,
|
|
104928
|
-
path:
|
|
104928
|
+
path: path14,
|
|
104929
104929
|
headers,
|
|
104930
104930
|
body,
|
|
104931
104931
|
userAgent: client._options.userAgent,
|
|
@@ -104960,7 +104960,7 @@ function apiKeysGetCurrentKeyMetadata(client, options) {
|
|
|
104960
104960
|
return new APIPromise($do5(client, options));
|
|
104961
104961
|
}
|
|
104962
104962
|
async function $do5(client, options) {
|
|
104963
|
-
const
|
|
104963
|
+
const path14 = pathToFunc("/key")();
|
|
104964
104964
|
const headers = new Headers(compactMap({
|
|
104965
104965
|
Accept: "application/json"
|
|
104966
104966
|
}));
|
|
@@ -104981,7 +104981,7 @@ async function $do5(client, options) {
|
|
|
104981
104981
|
security: requestSecurity,
|
|
104982
104982
|
method: "GET",
|
|
104983
104983
|
baseURL: options?.serverURL,
|
|
104984
|
-
path:
|
|
104984
|
+
path: path14,
|
|
104985
104985
|
headers,
|
|
104986
104986
|
userAgent: client._options.userAgent,
|
|
104987
104987
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -105021,7 +105021,7 @@ async function $do6(client, request, options) {
|
|
|
105021
105021
|
}
|
|
105022
105022
|
const payload = parsed.value;
|
|
105023
105023
|
const body = null;
|
|
105024
|
-
const
|
|
105024
|
+
const path14 = pathToFunc("/keys")();
|
|
105025
105025
|
const query = encodeFormQuery({
|
|
105026
105026
|
"include_disabled": payload?.include_disabled,
|
|
105027
105027
|
"offset": payload?.offset
|
|
@@ -105046,7 +105046,7 @@ async function $do6(client, request, options) {
|
|
|
105046
105046
|
security: requestSecurity,
|
|
105047
105047
|
method: "GET",
|
|
105048
105048
|
baseURL: options?.serverURL,
|
|
105049
|
-
path:
|
|
105049
|
+
path: path14,
|
|
105050
105050
|
headers,
|
|
105051
105051
|
query,
|
|
105052
105052
|
body,
|
|
@@ -105094,7 +105094,7 @@ async function $do7(client, request, options) {
|
|
|
105094
105094
|
charEncoding: "percent"
|
|
105095
105095
|
})
|
|
105096
105096
|
};
|
|
105097
|
-
const
|
|
105097
|
+
const path14 = pathToFunc("/keys/{hash}")(pathParams);
|
|
105098
105098
|
const headers = new Headers(compactMap({
|
|
105099
105099
|
"Content-Type": "application/json",
|
|
105100
105100
|
Accept: "application/json"
|
|
@@ -105116,7 +105116,7 @@ async function $do7(client, request, options) {
|
|
|
105116
105116
|
security: requestSecurity,
|
|
105117
105117
|
method: "PATCH",
|
|
105118
105118
|
baseURL: options?.serverURL,
|
|
105119
|
-
path:
|
|
105119
|
+
path: path14,
|
|
105120
105120
|
headers,
|
|
105121
105121
|
body,
|
|
105122
105122
|
userAgent: client._options.userAgent,
|
|
@@ -105215,7 +105215,7 @@ async function $do8(client, request, options) {
|
|
|
105215
105215
|
}
|
|
105216
105216
|
const payload = parsed.value;
|
|
105217
105217
|
const body = encodeJSON("body", payload, { explode: true });
|
|
105218
|
-
const
|
|
105218
|
+
const path14 = pathToFunc("/responses")();
|
|
105219
105219
|
const headers = new Headers(compactMap({
|
|
105220
105220
|
"Content-Type": "application/json",
|
|
105221
105221
|
Accept: request?.stream ? "text/event-stream" : "application/json"
|
|
@@ -105237,7 +105237,7 @@ async function $do8(client, request, options) {
|
|
|
105237
105237
|
security: requestSecurity,
|
|
105238
105238
|
method: "POST",
|
|
105239
105239
|
baseURL: options?.serverURL,
|
|
105240
|
-
path:
|
|
105240
|
+
path: path14,
|
|
105241
105241
|
headers,
|
|
105242
105242
|
body,
|
|
105243
105243
|
userAgent: client._options.userAgent,
|
|
@@ -105308,7 +105308,7 @@ async function $do9(client, request, options) {
|
|
|
105308
105308
|
}
|
|
105309
105309
|
const payload = parsed.value;
|
|
105310
105310
|
const body = encodeJSON("body", payload, { explode: true });
|
|
105311
|
-
const
|
|
105311
|
+
const path14 = pathToFunc("/chat/completions")();
|
|
105312
105312
|
const headers = new Headers(compactMap({
|
|
105313
105313
|
"Content-Type": "application/json",
|
|
105314
105314
|
Accept: request?.stream ? "text/event-stream" : "application/json"
|
|
@@ -105330,7 +105330,7 @@ async function $do9(client, request, options) {
|
|
|
105330
105330
|
security: requestSecurity,
|
|
105331
105331
|
method: "POST",
|
|
105332
105332
|
baseURL: options?.serverURL,
|
|
105333
|
-
path:
|
|
105333
|
+
path: path14,
|
|
105334
105334
|
headers,
|
|
105335
105335
|
body,
|
|
105336
105336
|
userAgent: client._options.userAgent,
|
|
@@ -105378,7 +105378,7 @@ async function $do10(client, request, options) {
|
|
|
105378
105378
|
}
|
|
105379
105379
|
const payload = parsed.value;
|
|
105380
105380
|
const body = encodeJSON("body", payload, { explode: true });
|
|
105381
|
-
const
|
|
105381
|
+
const path14 = pathToFunc("/completions")();
|
|
105382
105382
|
const headers = new Headers(compactMap({
|
|
105383
105383
|
"Content-Type": "application/json",
|
|
105384
105384
|
Accept: "application/json"
|
|
@@ -105400,7 +105400,7 @@ async function $do10(client, request, options) {
|
|
|
105400
105400
|
security: requestSecurity,
|
|
105401
105401
|
method: "POST",
|
|
105402
105402
|
baseURL: options?.serverURL,
|
|
105403
|
-
path:
|
|
105403
|
+
path: path14,
|
|
105404
105404
|
headers,
|
|
105405
105405
|
body,
|
|
105406
105406
|
userAgent: client._options.userAgent,
|
|
@@ -105454,7 +105454,7 @@ async function $do11(client, security, request, options) {
|
|
|
105454
105454
|
}
|
|
105455
105455
|
const payload = parsed.value;
|
|
105456
105456
|
const body = encodeJSON("body", payload, { explode: true });
|
|
105457
|
-
const
|
|
105457
|
+
const path14 = pathToFunc("/credits/coinbase")();
|
|
105458
105458
|
const headers = new Headers(compactMap({
|
|
105459
105459
|
"Content-Type": "application/json",
|
|
105460
105460
|
Accept: "application/json"
|
|
@@ -105480,7 +105480,7 @@ async function $do11(client, security, request, options) {
|
|
|
105480
105480
|
security: requestSecurity,
|
|
105481
105481
|
method: "POST",
|
|
105482
105482
|
baseURL: options?.serverURL,
|
|
105483
|
-
path:
|
|
105483
|
+
path: path14,
|
|
105484
105484
|
headers,
|
|
105485
105485
|
body,
|
|
105486
105486
|
userAgent: client._options.userAgent,
|
|
@@ -105515,7 +105515,7 @@ function creditsGetCredits(client, options) {
|
|
|
105515
105515
|
return new APIPromise($do12(client, options));
|
|
105516
105516
|
}
|
|
105517
105517
|
async function $do12(client, options) {
|
|
105518
|
-
const
|
|
105518
|
+
const path14 = pathToFunc("/credits")();
|
|
105519
105519
|
const headers = new Headers(compactMap({
|
|
105520
105520
|
Accept: "application/json"
|
|
105521
105521
|
}));
|
|
@@ -105536,7 +105536,7 @@ async function $do12(client, options) {
|
|
|
105536
105536
|
security: requestSecurity,
|
|
105537
105537
|
method: "GET",
|
|
105538
105538
|
baseURL: options?.serverURL,
|
|
105539
|
-
path:
|
|
105539
|
+
path: path14,
|
|
105540
105540
|
headers,
|
|
105541
105541
|
userAgent: client._options.userAgent,
|
|
105542
105542
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -105598,7 +105598,7 @@ async function $do13(client, request, options) {
|
|
|
105598
105598
|
}
|
|
105599
105599
|
const payload = parsed.value;
|
|
105600
105600
|
const body = encodeJSON("body", payload, { explode: true });
|
|
105601
|
-
const
|
|
105601
|
+
const path14 = pathToFunc("/embeddings")();
|
|
105602
105602
|
const headers = new Headers(compactMap({
|
|
105603
105603
|
"Content-Type": "application/json",
|
|
105604
105604
|
Accept: "application/json;q=1, text/event-stream;q=0"
|
|
@@ -105620,7 +105620,7 @@ async function $do13(client, request, options) {
|
|
|
105620
105620
|
security: requestSecurity,
|
|
105621
105621
|
method: "POST",
|
|
105622
105622
|
baseURL: options?.serverURL,
|
|
105623
|
-
path:
|
|
105623
|
+
path: path14,
|
|
105624
105624
|
headers,
|
|
105625
105625
|
body,
|
|
105626
105626
|
userAgent: client._options.userAgent,
|
|
@@ -105670,7 +105670,7 @@ function embeddingsListModels(client, options) {
|
|
|
105670
105670
|
return new APIPromise($do14(client, options));
|
|
105671
105671
|
}
|
|
105672
105672
|
async function $do14(client, options) {
|
|
105673
|
-
const
|
|
105673
|
+
const path14 = pathToFunc("/embeddings/models")();
|
|
105674
105674
|
const headers = new Headers(compactMap({
|
|
105675
105675
|
Accept: "application/json"
|
|
105676
105676
|
}));
|
|
@@ -105691,7 +105691,7 @@ async function $do14(client, options) {
|
|
|
105691
105691
|
security: requestSecurity,
|
|
105692
105692
|
method: "GET",
|
|
105693
105693
|
baseURL: options?.serverURL,
|
|
105694
|
-
path:
|
|
105694
|
+
path: path14,
|
|
105695
105695
|
headers,
|
|
105696
105696
|
userAgent: client._options.userAgent,
|
|
105697
105697
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -105763,7 +105763,7 @@ async function $do15(client, request, options) {
|
|
|
105763
105763
|
charEncoding: "percent"
|
|
105764
105764
|
})
|
|
105765
105765
|
};
|
|
105766
|
-
const
|
|
105766
|
+
const path14 = pathToFunc("/models/{author}/{slug}/endpoints")(pathParams);
|
|
105767
105767
|
const headers = new Headers(compactMap({
|
|
105768
105768
|
Accept: "application/json"
|
|
105769
105769
|
}));
|
|
@@ -105784,7 +105784,7 @@ async function $do15(client, request, options) {
|
|
|
105784
105784
|
security: requestSecurity,
|
|
105785
105785
|
method: "GET",
|
|
105786
105786
|
baseURL: options?.serverURL,
|
|
105787
|
-
path:
|
|
105787
|
+
path: path14,
|
|
105788
105788
|
headers,
|
|
105789
105789
|
body,
|
|
105790
105790
|
userAgent: client._options.userAgent,
|
|
@@ -105819,7 +105819,7 @@ function endpointsListZdrEndpoints(client, options) {
|
|
|
105819
105819
|
return new APIPromise($do16(client, options));
|
|
105820
105820
|
}
|
|
105821
105821
|
async function $do16(client, options) {
|
|
105822
|
-
const
|
|
105822
|
+
const path14 = pathToFunc("/endpoints/zdr")();
|
|
105823
105823
|
const headers = new Headers(compactMap({
|
|
105824
105824
|
Accept: "application/json"
|
|
105825
105825
|
}));
|
|
@@ -105840,7 +105840,7 @@ async function $do16(client, options) {
|
|
|
105840
105840
|
security: requestSecurity,
|
|
105841
105841
|
method: "GET",
|
|
105842
105842
|
baseURL: options?.serverURL,
|
|
105843
|
-
path:
|
|
105843
|
+
path: path14,
|
|
105844
105844
|
headers,
|
|
105845
105845
|
userAgent: client._options.userAgent,
|
|
105846
105846
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -105896,7 +105896,7 @@ async function $do17(client, request, options) {
|
|
|
105896
105896
|
}
|
|
105897
105897
|
const payload = parsed.value;
|
|
105898
105898
|
const body = null;
|
|
105899
|
-
const
|
|
105899
|
+
const path14 = pathToFunc("/generation")();
|
|
105900
105900
|
const query = encodeFormQuery({
|
|
105901
105901
|
"id": payload.id
|
|
105902
105902
|
});
|
|
@@ -105920,7 +105920,7 @@ async function $do17(client, request, options) {
|
|
|
105920
105920
|
security: requestSecurity,
|
|
105921
105921
|
method: "GET",
|
|
105922
105922
|
baseURL: options?.serverURL,
|
|
105923
|
-
path:
|
|
105923
|
+
path: path14,
|
|
105924
105924
|
headers,
|
|
105925
105925
|
query,
|
|
105926
105926
|
body,
|
|
@@ -105989,7 +105989,7 @@ async function $do18(client, request, options) {
|
|
|
105989
105989
|
charEncoding: "percent"
|
|
105990
105990
|
})
|
|
105991
105991
|
};
|
|
105992
|
-
const
|
|
105992
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/keys")(pathParams);
|
|
105993
105993
|
const headers = new Headers(compactMap({
|
|
105994
105994
|
"Content-Type": "application/json",
|
|
105995
105995
|
Accept: "application/json"
|
|
@@ -106011,7 +106011,7 @@ async function $do18(client, request, options) {
|
|
|
106011
106011
|
security: requestSecurity,
|
|
106012
106012
|
method: "POST",
|
|
106013
106013
|
baseURL: options?.serverURL,
|
|
106014
|
-
path:
|
|
106014
|
+
path: path14,
|
|
106015
106015
|
headers,
|
|
106016
106016
|
body,
|
|
106017
106017
|
userAgent: client._options.userAgent,
|
|
@@ -106058,7 +106058,7 @@ async function $do19(client, request, options) {
|
|
|
106058
106058
|
charEncoding: "percent"
|
|
106059
106059
|
})
|
|
106060
106060
|
};
|
|
106061
|
-
const
|
|
106061
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/members")(pathParams);
|
|
106062
106062
|
const headers = new Headers(compactMap({
|
|
106063
106063
|
"Content-Type": "application/json",
|
|
106064
106064
|
Accept: "application/json"
|
|
@@ -106080,7 +106080,7 @@ async function $do19(client, request, options) {
|
|
|
106080
106080
|
security: requestSecurity,
|
|
106081
106081
|
method: "POST",
|
|
106082
106082
|
baseURL: options?.serverURL,
|
|
106083
|
-
path:
|
|
106083
|
+
path: path14,
|
|
106084
106084
|
headers,
|
|
106085
106085
|
body,
|
|
106086
106086
|
userAgent: client._options.userAgent,
|
|
@@ -106127,7 +106127,7 @@ async function $do20(client, request, options) {
|
|
|
106127
106127
|
charEncoding: "percent"
|
|
106128
106128
|
})
|
|
106129
106129
|
};
|
|
106130
|
-
const
|
|
106130
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/keys/remove")(pathParams);
|
|
106131
106131
|
const headers = new Headers(compactMap({
|
|
106132
106132
|
"Content-Type": "application/json",
|
|
106133
106133
|
Accept: "application/json"
|
|
@@ -106149,7 +106149,7 @@ async function $do20(client, request, options) {
|
|
|
106149
106149
|
security: requestSecurity,
|
|
106150
106150
|
method: "POST",
|
|
106151
106151
|
baseURL: options?.serverURL,
|
|
106152
|
-
path:
|
|
106152
|
+
path: path14,
|
|
106153
106153
|
headers,
|
|
106154
106154
|
body,
|
|
106155
106155
|
userAgent: client._options.userAgent,
|
|
@@ -106196,7 +106196,7 @@ async function $do21(client, request, options) {
|
|
|
106196
106196
|
charEncoding: "percent"
|
|
106197
106197
|
})
|
|
106198
106198
|
};
|
|
106199
|
-
const
|
|
106199
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/members/remove")(pathParams);
|
|
106200
106200
|
const headers = new Headers(compactMap({
|
|
106201
106201
|
"Content-Type": "application/json",
|
|
106202
106202
|
Accept: "application/json"
|
|
@@ -106218,7 +106218,7 @@ async function $do21(client, request, options) {
|
|
|
106218
106218
|
security: requestSecurity,
|
|
106219
106219
|
method: "POST",
|
|
106220
106220
|
baseURL: options?.serverURL,
|
|
106221
|
-
path:
|
|
106221
|
+
path: path14,
|
|
106222
106222
|
headers,
|
|
106223
106223
|
body,
|
|
106224
106224
|
userAgent: client._options.userAgent,
|
|
@@ -106259,7 +106259,7 @@ async function $do22(client, request, options) {
|
|
|
106259
106259
|
}
|
|
106260
106260
|
const payload = parsed.value;
|
|
106261
106261
|
const body = encodeJSON("body", payload, { explode: true });
|
|
106262
|
-
const
|
|
106262
|
+
const path14 = pathToFunc("/guardrails")();
|
|
106263
106263
|
const headers = new Headers(compactMap({
|
|
106264
106264
|
"Content-Type": "application/json",
|
|
106265
106265
|
Accept: "application/json"
|
|
@@ -106281,7 +106281,7 @@ async function $do22(client, request, options) {
|
|
|
106281
106281
|
security: requestSecurity,
|
|
106282
106282
|
method: "POST",
|
|
106283
106283
|
baseURL: options?.serverURL,
|
|
106284
|
-
path:
|
|
106284
|
+
path: path14,
|
|
106285
106285
|
headers,
|
|
106286
106286
|
body,
|
|
106287
106287
|
userAgent: client._options.userAgent,
|
|
@@ -106328,7 +106328,7 @@ async function $do23(client, request, options) {
|
|
|
106328
106328
|
charEncoding: "percent"
|
|
106329
106329
|
})
|
|
106330
106330
|
};
|
|
106331
|
-
const
|
|
106331
|
+
const path14 = pathToFunc("/guardrails/{id}")(pathParams);
|
|
106332
106332
|
const headers = new Headers(compactMap({
|
|
106333
106333
|
Accept: "application/json"
|
|
106334
106334
|
}));
|
|
@@ -106349,7 +106349,7 @@ async function $do23(client, request, options) {
|
|
|
106349
106349
|
security: requestSecurity,
|
|
106350
106350
|
method: "DELETE",
|
|
106351
106351
|
baseURL: options?.serverURL,
|
|
106352
|
-
path:
|
|
106352
|
+
path: path14,
|
|
106353
106353
|
headers,
|
|
106354
106354
|
body,
|
|
106355
106355
|
userAgent: client._options.userAgent,
|
|
@@ -106396,7 +106396,7 @@ async function $do24(client, request, options) {
|
|
|
106396
106396
|
charEncoding: "percent"
|
|
106397
106397
|
})
|
|
106398
106398
|
};
|
|
106399
|
-
const
|
|
106399
|
+
const path14 = pathToFunc("/guardrails/{id}")(pathParams);
|
|
106400
106400
|
const headers = new Headers(compactMap({
|
|
106401
106401
|
Accept: "application/json"
|
|
106402
106402
|
}));
|
|
@@ -106417,7 +106417,7 @@ async function $do24(client, request, options) {
|
|
|
106417
106417
|
security: requestSecurity,
|
|
106418
106418
|
method: "GET",
|
|
106419
106419
|
baseURL: options?.serverURL,
|
|
106420
|
-
path:
|
|
106420
|
+
path: path14,
|
|
106421
106421
|
headers,
|
|
106422
106422
|
body,
|
|
106423
106423
|
userAgent: client._options.userAgent,
|
|
@@ -106458,7 +106458,7 @@ async function $do25(client, request, options) {
|
|
|
106458
106458
|
}
|
|
106459
106459
|
const payload = parsed.value;
|
|
106460
106460
|
const body = null;
|
|
106461
|
-
const
|
|
106461
|
+
const path14 = pathToFunc("/guardrails")();
|
|
106462
106462
|
const query = encodeFormQuery({
|
|
106463
106463
|
"limit": payload?.limit,
|
|
106464
106464
|
"offset": payload?.offset
|
|
@@ -106483,7 +106483,7 @@ async function $do25(client, request, options) {
|
|
|
106483
106483
|
security: requestSecurity,
|
|
106484
106484
|
method: "GET",
|
|
106485
106485
|
baseURL: options?.serverURL,
|
|
106486
|
-
path:
|
|
106486
|
+
path: path14,
|
|
106487
106487
|
headers,
|
|
106488
106488
|
query,
|
|
106489
106489
|
body,
|
|
@@ -106531,7 +106531,7 @@ async function $do26(client, request, options) {
|
|
|
106531
106531
|
charEncoding: "percent"
|
|
106532
106532
|
})
|
|
106533
106533
|
};
|
|
106534
|
-
const
|
|
106534
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/keys")(pathParams);
|
|
106535
106535
|
const query = encodeFormQuery({
|
|
106536
106536
|
"limit": payload.limit,
|
|
106537
106537
|
"offset": payload.offset
|
|
@@ -106556,7 +106556,7 @@ async function $do26(client, request, options) {
|
|
|
106556
106556
|
security: requestSecurity,
|
|
106557
106557
|
method: "GET",
|
|
106558
106558
|
baseURL: options?.serverURL,
|
|
106559
|
-
path:
|
|
106559
|
+
path: path14,
|
|
106560
106560
|
headers,
|
|
106561
106561
|
query,
|
|
106562
106562
|
body,
|
|
@@ -106604,7 +106604,7 @@ async function $do27(client, request, options) {
|
|
|
106604
106604
|
charEncoding: "percent"
|
|
106605
106605
|
})
|
|
106606
106606
|
};
|
|
106607
|
-
const
|
|
106607
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/members")(pathParams);
|
|
106608
106608
|
const query = encodeFormQuery({
|
|
106609
106609
|
"limit": payload.limit,
|
|
106610
106610
|
"offset": payload.offset
|
|
@@ -106629,7 +106629,7 @@ async function $do27(client, request, options) {
|
|
|
106629
106629
|
security: requestSecurity,
|
|
106630
106630
|
method: "GET",
|
|
106631
106631
|
baseURL: options?.serverURL,
|
|
106632
|
-
path:
|
|
106632
|
+
path: path14,
|
|
106633
106633
|
headers,
|
|
106634
106634
|
query,
|
|
106635
106635
|
body,
|
|
@@ -106671,7 +106671,7 @@ async function $do28(client, request, options) {
|
|
|
106671
106671
|
}
|
|
106672
106672
|
const payload = parsed.value;
|
|
106673
106673
|
const body = null;
|
|
106674
|
-
const
|
|
106674
|
+
const path14 = pathToFunc("/guardrails/assignments/keys")();
|
|
106675
106675
|
const query = encodeFormQuery({
|
|
106676
106676
|
"limit": payload?.limit,
|
|
106677
106677
|
"offset": payload?.offset
|
|
@@ -106696,7 +106696,7 @@ async function $do28(client, request, options) {
|
|
|
106696
106696
|
security: requestSecurity,
|
|
106697
106697
|
method: "GET",
|
|
106698
106698
|
baseURL: options?.serverURL,
|
|
106699
|
-
path:
|
|
106699
|
+
path: path14,
|
|
106700
106700
|
headers,
|
|
106701
106701
|
query,
|
|
106702
106702
|
body,
|
|
@@ -106738,7 +106738,7 @@ async function $do29(client, request, options) {
|
|
|
106738
106738
|
}
|
|
106739
106739
|
const payload = parsed.value;
|
|
106740
106740
|
const body = null;
|
|
106741
|
-
const
|
|
106741
|
+
const path14 = pathToFunc("/guardrails/assignments/members")();
|
|
106742
106742
|
const query = encodeFormQuery({
|
|
106743
106743
|
"limit": payload?.limit,
|
|
106744
106744
|
"offset": payload?.offset
|
|
@@ -106763,7 +106763,7 @@ async function $do29(client, request, options) {
|
|
|
106763
106763
|
security: requestSecurity,
|
|
106764
106764
|
method: "GET",
|
|
106765
106765
|
baseURL: options?.serverURL,
|
|
106766
|
-
path:
|
|
106766
|
+
path: path14,
|
|
106767
106767
|
headers,
|
|
106768
106768
|
query,
|
|
106769
106769
|
body,
|
|
@@ -106811,7 +106811,7 @@ async function $do30(client, request, options) {
|
|
|
106811
106811
|
charEncoding: "percent"
|
|
106812
106812
|
})
|
|
106813
106813
|
};
|
|
106814
|
-
const
|
|
106814
|
+
const path14 = pathToFunc("/guardrails/{id}")(pathParams);
|
|
106815
106815
|
const headers = new Headers(compactMap({
|
|
106816
106816
|
"Content-Type": "application/json",
|
|
106817
106817
|
Accept: "application/json"
|
|
@@ -106833,7 +106833,7 @@ async function $do30(client, request, options) {
|
|
|
106833
106833
|
security: requestSecurity,
|
|
106834
106834
|
method: "PATCH",
|
|
106835
106835
|
baseURL: options?.serverURL,
|
|
106836
|
-
path:
|
|
106836
|
+
path: path14,
|
|
106837
106837
|
headers,
|
|
106838
106838
|
body,
|
|
106839
106839
|
userAgent: client._options.userAgent,
|
|
@@ -106989,7 +106989,7 @@ function modelsCount(client, options) {
|
|
|
106989
106989
|
return new APIPromise($do31(client, options));
|
|
106990
106990
|
}
|
|
106991
106991
|
async function $do31(client, options) {
|
|
106992
|
-
const
|
|
106992
|
+
const path14 = pathToFunc("/models/count")();
|
|
106993
106993
|
const headers = new Headers(compactMap({
|
|
106994
106994
|
Accept: "application/json"
|
|
106995
106995
|
}));
|
|
@@ -107010,7 +107010,7 @@ async function $do31(client, options) {
|
|
|
107010
107010
|
security: requestSecurity,
|
|
107011
107011
|
method: "GET",
|
|
107012
107012
|
baseURL: options?.serverURL,
|
|
107013
|
-
path:
|
|
107013
|
+
path: path14,
|
|
107014
107014
|
headers,
|
|
107015
107015
|
userAgent: client._options.userAgent,
|
|
107016
107016
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -107050,7 +107050,7 @@ async function $do32(client, request, options) {
|
|
|
107050
107050
|
}
|
|
107051
107051
|
const payload = parsed.value;
|
|
107052
107052
|
const body = null;
|
|
107053
|
-
const
|
|
107053
|
+
const path14 = pathToFunc("/models")();
|
|
107054
107054
|
const query = encodeFormQuery({
|
|
107055
107055
|
"category": payload?.category,
|
|
107056
107056
|
"supported_parameters": payload?.supported_parameters
|
|
@@ -107075,7 +107075,7 @@ async function $do32(client, request, options) {
|
|
|
107075
107075
|
security: requestSecurity,
|
|
107076
107076
|
method: "GET",
|
|
107077
107077
|
baseURL: options?.serverURL,
|
|
107078
|
-
path:
|
|
107078
|
+
path: path14,
|
|
107079
107079
|
headers,
|
|
107080
107080
|
query,
|
|
107081
107081
|
body,
|
|
@@ -107111,7 +107111,7 @@ function modelsListForUser(client, security, options) {
|
|
|
107111
107111
|
return new APIPromise($do33(client, security, options));
|
|
107112
107112
|
}
|
|
107113
107113
|
async function $do33(client, security, options) {
|
|
107114
|
-
const
|
|
107114
|
+
const path14 = pathToFunc("/models/user")();
|
|
107115
107115
|
const headers = new Headers(compactMap({
|
|
107116
107116
|
Accept: "application/json"
|
|
107117
107117
|
}));
|
|
@@ -107136,7 +107136,7 @@ async function $do33(client, security, options) {
|
|
|
107136
107136
|
security: requestSecurity,
|
|
107137
107137
|
method: "GET",
|
|
107138
107138
|
baseURL: options?.serverURL,
|
|
107139
|
-
path:
|
|
107139
|
+
path: path14,
|
|
107140
107140
|
headers,
|
|
107141
107141
|
userAgent: client._options.userAgent,
|
|
107142
107142
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -107198,7 +107198,7 @@ async function $do34(client, request, options) {
|
|
|
107198
107198
|
}
|
|
107199
107199
|
const payload = parsed.value;
|
|
107200
107200
|
const body = encodeJSON("body", payload, { explode: true });
|
|
107201
|
-
const
|
|
107201
|
+
const path14 = pathToFunc("/auth/keys/code")();
|
|
107202
107202
|
const headers = new Headers(compactMap({
|
|
107203
107203
|
"Content-Type": "application/json",
|
|
107204
107204
|
Accept: "application/json"
|
|
@@ -107220,7 +107220,7 @@ async function $do34(client, request, options) {
|
|
|
107220
107220
|
security: requestSecurity,
|
|
107221
107221
|
method: "POST",
|
|
107222
107222
|
baseURL: options?.serverURL,
|
|
107223
|
-
path:
|
|
107223
|
+
path: path14,
|
|
107224
107224
|
headers,
|
|
107225
107225
|
body,
|
|
107226
107226
|
userAgent: client._options.userAgent,
|
|
@@ -107261,7 +107261,7 @@ async function $do35(client, request, options) {
|
|
|
107261
107261
|
}
|
|
107262
107262
|
const payload = parsed.value;
|
|
107263
107263
|
const body = encodeJSON("body", payload, { explode: true });
|
|
107264
|
-
const
|
|
107264
|
+
const path14 = pathToFunc("/auth/keys")();
|
|
107265
107265
|
const headers = new Headers(compactMap({
|
|
107266
107266
|
"Content-Type": "application/json",
|
|
107267
107267
|
Accept: "application/json"
|
|
@@ -107283,7 +107283,7 @@ async function $do35(client, request, options) {
|
|
|
107283
107283
|
security: requestSecurity,
|
|
107284
107284
|
method: "POST",
|
|
107285
107285
|
baseURL: options?.serverURL,
|
|
107286
|
-
path:
|
|
107286
|
+
path: path14,
|
|
107287
107287
|
headers,
|
|
107288
107288
|
body,
|
|
107289
107289
|
userAgent: client._options.userAgent,
|
|
@@ -107466,7 +107466,7 @@ function providersList(client, options) {
|
|
|
107466
107466
|
return new APIPromise($do36(client, options));
|
|
107467
107467
|
}
|
|
107468
107468
|
async function $do36(client, options) {
|
|
107469
|
-
const
|
|
107469
|
+
const path14 = pathToFunc("/providers")();
|
|
107470
107470
|
const headers = new Headers(compactMap({
|
|
107471
107471
|
Accept: "application/json"
|
|
107472
107472
|
}));
|
|
@@ -107487,7 +107487,7 @@ async function $do36(client, options) {
|
|
|
107487
107487
|
security: requestSecurity,
|
|
107488
107488
|
method: "GET",
|
|
107489
107489
|
baseURL: options?.serverURL,
|
|
107490
|
-
path:
|
|
107490
|
+
path: path14,
|
|
107491
107491
|
headers,
|
|
107492
107492
|
userAgent: client._options.userAgent,
|
|
107493
107493
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -141614,37 +141614,37 @@ function createOpenAI(options = {}) {
|
|
|
141614
141614
|
);
|
|
141615
141615
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
141616
141616
|
provider: `${providerName}.chat`,
|
|
141617
|
-
url: ({ path:
|
|
141617
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141618
141618
|
headers: getHeaders,
|
|
141619
141619
|
fetch: options.fetch
|
|
141620
141620
|
});
|
|
141621
141621
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
141622
141622
|
provider: `${providerName}.completion`,
|
|
141623
|
-
url: ({ path:
|
|
141623
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141624
141624
|
headers: getHeaders,
|
|
141625
141625
|
fetch: options.fetch
|
|
141626
141626
|
});
|
|
141627
141627
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
141628
141628
|
provider: `${providerName}.embedding`,
|
|
141629
|
-
url: ({ path:
|
|
141629
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141630
141630
|
headers: getHeaders,
|
|
141631
141631
|
fetch: options.fetch
|
|
141632
141632
|
});
|
|
141633
141633
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
141634
141634
|
provider: `${providerName}.image`,
|
|
141635
|
-
url: ({ path:
|
|
141635
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141636
141636
|
headers: getHeaders,
|
|
141637
141637
|
fetch: options.fetch
|
|
141638
141638
|
});
|
|
141639
141639
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
141640
141640
|
provider: `${providerName}.transcription`,
|
|
141641
|
-
url: ({ path:
|
|
141641
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141642
141642
|
headers: getHeaders,
|
|
141643
141643
|
fetch: options.fetch
|
|
141644
141644
|
});
|
|
141645
141645
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
141646
141646
|
provider: `${providerName}.speech`,
|
|
141647
|
-
url: ({ path:
|
|
141647
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141648
141648
|
headers: getHeaders,
|
|
141649
141649
|
fetch: options.fetch
|
|
141650
141650
|
});
|
|
@@ -141659,7 +141659,7 @@ function createOpenAI(options = {}) {
|
|
|
141659
141659
|
const createResponsesModel = (modelId) => {
|
|
141660
141660
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
141661
141661
|
provider: `${providerName}.responses`,
|
|
141662
|
-
url: ({ path:
|
|
141662
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141663
141663
|
headers: getHeaders,
|
|
141664
141664
|
fetch: options.fetch,
|
|
141665
141665
|
fileIdPrefixes: ["file-"]
|
|
@@ -143007,7 +143007,7 @@ ${prompt}` : prompt;
|
|
|
143007
143007
|
}
|
|
143008
143008
|
function createGooseConfig(exaApiKey, mcpServers) {
|
|
143009
143009
|
const configDir = path7.join(os.homedir(), ".config", "goose");
|
|
143010
|
-
const
|
|
143010
|
+
const configPath2 = path7.join(configDir, "config.yaml");
|
|
143011
143011
|
let configContent = `extensions:
|
|
143012
143012
|
extension_name:
|
|
143013
143013
|
bundled: true
|
|
@@ -143056,8 +143056,8 @@ function createGooseConfig(exaApiKey, mcpServers) {
|
|
|
143056
143056
|
if (!fs8.existsSync(configDir)) {
|
|
143057
143057
|
fs8.mkdirSync(configDir, { recursive: true });
|
|
143058
143058
|
}
|
|
143059
|
-
fs8.writeFileSync(
|
|
143060
|
-
log(`Created goose config at ${
|
|
143059
|
+
fs8.writeFileSync(configPath2, configContent, "utf-8");
|
|
143060
|
+
log(`Created goose config at ${configPath2}`);
|
|
143061
143061
|
} catch (error88) {
|
|
143062
143062
|
warn("Error creating goose config:", error88);
|
|
143063
143063
|
}
|
|
@@ -143293,9 +143293,9 @@ function validateSettings(settings) {
|
|
|
143293
143293
|
else if (Array.isArray(v3)) issues = v3;
|
|
143294
143294
|
}
|
|
143295
143295
|
for (const i of issues) {
|
|
143296
|
-
const
|
|
143296
|
+
const path14 = Array.isArray(i?.path) ? i.path.join(".") : "";
|
|
143297
143297
|
const message = i?.message || "Invalid value";
|
|
143298
|
-
errors.push(`${
|
|
143298
|
+
errors.push(`${path14 ? path14 + ": " : ""}${message}`);
|
|
143299
143299
|
}
|
|
143300
143300
|
return { valid: false, warnings, errors };
|
|
143301
143301
|
}
|
|
@@ -145123,6 +145123,10 @@ async function streamCodexToSSE(sessionId, prompt, apiKey, res, options) {
|
|
|
145123
145123
|
// src/agent/goose-session-manager.ts
|
|
145124
145124
|
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
145125
145125
|
var crypto2 = __toESM(require("crypto"), 1);
|
|
145126
|
+
var fs11 = __toESM(require("fs"), 1);
|
|
145127
|
+
var os3 = __toESM(require("os"), 1);
|
|
145128
|
+
var path9 = __toESM(require("path"), 1);
|
|
145129
|
+
var import_child_process5 = require("child_process");
|
|
145126
145130
|
var JWT_SECRET = process.env.JWT_SECRET || crypto2.randomBytes(32).toString("hex");
|
|
145127
145131
|
var TOKEN_EXPIRY = "10m";
|
|
145128
145132
|
var SESSION_INACTIVITY_TTL = 24 * 60 * 60 * 1e3;
|
|
@@ -145130,11 +145134,56 @@ var SESSIONS = /* @__PURE__ */ new Map();
|
|
|
145130
145134
|
function issueToken(sessionId) {
|
|
145131
145135
|
return import_jsonwebtoken.default.sign({ sessionId }, JWT_SECRET, { expiresIn: TOKEN_EXPIRY });
|
|
145132
145136
|
}
|
|
145133
|
-
|
|
145137
|
+
var gooseVersionCache;
|
|
145138
|
+
var gooseVersionResolved = false;
|
|
145139
|
+
function getGooseVersion() {
|
|
145140
|
+
if (gooseVersionResolved) return gooseVersionCache;
|
|
145141
|
+
gooseVersionResolved = true;
|
|
145142
|
+
try {
|
|
145143
|
+
gooseVersionCache = (0, import_child_process5.execSync)("goose --version", { encoding: "utf-8" }).trim().replace(/^goose\s+/i, "");
|
|
145144
|
+
} catch {
|
|
145145
|
+
gooseVersionCache = void 0;
|
|
145146
|
+
}
|
|
145147
|
+
return gooseVersionCache;
|
|
145148
|
+
}
|
|
145149
|
+
var SESSIONS_DIR2 = path9.join(
|
|
145150
|
+
process.env.XDG_DATA_HOME || path9.join(os3.homedir(), ".local", "share"),
|
|
145151
|
+
"goose",
|
|
145152
|
+
"sessions"
|
|
145153
|
+
);
|
|
145154
|
+
function configPath(sessionId) {
|
|
145155
|
+
const safe = sessionId.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
145156
|
+
return path9.join(SESSIONS_DIR2, `${safe}.config.json`);
|
|
145157
|
+
}
|
|
145158
|
+
function toPublic(session) {
|
|
145159
|
+
const { apiKey: _a26, summaryApiKey: _s, searchApiKey: _k, ...safe } = session;
|
|
145160
|
+
return safe;
|
|
145161
|
+
}
|
|
145162
|
+
function persistConfig(session) {
|
|
145163
|
+
try {
|
|
145164
|
+
fs11.mkdirSync(SESSIONS_DIR2, { recursive: true });
|
|
145165
|
+
fs11.writeFileSync(
|
|
145166
|
+
configPath(session.sessionId),
|
|
145167
|
+
JSON.stringify(toPublic(session)),
|
|
145168
|
+
"utf-8"
|
|
145169
|
+
);
|
|
145170
|
+
} catch {
|
|
145171
|
+
}
|
|
145172
|
+
}
|
|
145173
|
+
function readPersistedConfig(sessionId) {
|
|
145174
|
+
try {
|
|
145175
|
+
const raw = fs11.readFileSync(configPath(sessionId), "utf-8");
|
|
145176
|
+
return JSON.parse(raw);
|
|
145177
|
+
} catch {
|
|
145178
|
+
return null;
|
|
145179
|
+
}
|
|
145180
|
+
}
|
|
145181
|
+
function createSession(sessionId, webhookUrl, apiKey, searchApiKey, model, agent, system, temperature, jsonMode, summaryApiKey, mcpServers, baseUrl, headers, repoName, _metadata) {
|
|
145134
145182
|
const now2 = Date.now();
|
|
145135
145183
|
const existing = SESSIONS.get(sessionId);
|
|
145136
145184
|
if (existing) {
|
|
145137
145185
|
existing.lastActivity = now2;
|
|
145186
|
+
existing.gooseVersion = getGooseVersion();
|
|
145138
145187
|
if (webhookUrl !== void 0) existing.webhookUrl = webhookUrl;
|
|
145139
145188
|
if (apiKey !== void 0) existing.apiKey = apiKey;
|
|
145140
145189
|
if (searchApiKey !== void 0) existing.searchApiKey = searchApiKey;
|
|
@@ -145148,12 +145197,15 @@ function createSession(sessionId, webhookUrl, apiKey, searchApiKey, model, agent
|
|
|
145148
145197
|
if (baseUrl !== void 0) existing.baseUrl = baseUrl;
|
|
145149
145198
|
if (headers !== void 0) existing.headers = headers;
|
|
145150
145199
|
if (repoName !== void 0) existing.repoName = repoName;
|
|
145200
|
+
if (_metadata !== void 0) existing._metadata = _metadata;
|
|
145201
|
+
persistConfig(existing);
|
|
145151
145202
|
return { token: issueToken(sessionId), created: false };
|
|
145152
145203
|
}
|
|
145153
|
-
|
|
145204
|
+
const created = {
|
|
145154
145205
|
sessionId,
|
|
145155
145206
|
createdAt: now2,
|
|
145156
145207
|
lastActivity: now2,
|
|
145208
|
+
gooseVersion: getGooseVersion(),
|
|
145157
145209
|
webhookUrl,
|
|
145158
145210
|
apiKey,
|
|
145159
145211
|
searchApiKey,
|
|
@@ -145166,10 +145218,18 @@ function createSession(sessionId, webhookUrl, apiKey, searchApiKey, model, agent
|
|
|
145166
145218
|
mcpServers,
|
|
145167
145219
|
baseUrl,
|
|
145168
145220
|
headers,
|
|
145169
|
-
repoName
|
|
145170
|
-
|
|
145221
|
+
repoName,
|
|
145222
|
+
_metadata
|
|
145223
|
+
};
|
|
145224
|
+
SESSIONS.set(sessionId, created);
|
|
145225
|
+
persistConfig(created);
|
|
145171
145226
|
return { token: issueToken(sessionId), created: true };
|
|
145172
145227
|
}
|
|
145228
|
+
function getSession(sessionId) {
|
|
145229
|
+
const session = SESSIONS.get(sessionId);
|
|
145230
|
+
if (session) return toPublic(session);
|
|
145231
|
+
return readPersistedConfig(sessionId);
|
|
145232
|
+
}
|
|
145173
145233
|
function validateAndGetSession(sessionId, token) {
|
|
145174
145234
|
try {
|
|
145175
145235
|
const decoded = import_jsonwebtoken.default.verify(token, JWT_SECRET);
|
|
@@ -145290,7 +145350,7 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
145290
145350
|
return async (req, res) => {
|
|
145291
145351
|
const request_id = startReq();
|
|
145292
145352
|
try {
|
|
145293
|
-
const { repoName, apiKey, agent_name, session, summarize, model, searchApiKey, summaryApiKey, mcpServers, baseUrl, headers } = req.body;
|
|
145353
|
+
const { repoName, apiKey, agent_name, session, summarize, model, searchApiKey, summaryApiKey, mcpServers, baseUrl, headers, _metadata } = req.body;
|
|
145294
145354
|
const params = getParams(req);
|
|
145295
145355
|
const workspaceRoot2 = await workspaceRoot();
|
|
145296
145356
|
let repoPath = workspaceRoot2;
|
|
@@ -145305,6 +145365,28 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
145305
145365
|
}
|
|
145306
145366
|
}
|
|
145307
145367
|
const agentFn = chooseAgent(agent_name || "goose");
|
|
145368
|
+
if (session) {
|
|
145369
|
+
createSession(
|
|
145370
|
+
session,
|
|
145371
|
+
void 0,
|
|
145372
|
+
// webhookUrl
|
|
145373
|
+
apiKey,
|
|
145374
|
+
searchApiKey,
|
|
145375
|
+
model,
|
|
145376
|
+
agent_name,
|
|
145377
|
+
params.system,
|
|
145378
|
+
void 0,
|
|
145379
|
+
// temperature
|
|
145380
|
+
void 0,
|
|
145381
|
+
// jsonMode
|
|
145382
|
+
summaryApiKey,
|
|
145383
|
+
mcpServers,
|
|
145384
|
+
baseUrl,
|
|
145385
|
+
headers,
|
|
145386
|
+
repoName,
|
|
145387
|
+
_metadata
|
|
145388
|
+
);
|
|
145389
|
+
}
|
|
145308
145390
|
const defaultApiKey = agent_name === "codex" ? process.env.OPENAI_API_KEY || "" : process.env.ANTHROPIC_API_KEY || "";
|
|
145309
145391
|
const startTime = Date.now();
|
|
145310
145392
|
agentFn({
|
|
@@ -145354,12 +145436,12 @@ var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
|
145354
145436
|
var import_fs5 = require("fs");
|
|
145355
145437
|
|
|
145356
145438
|
// src/proxy/gitleaks.ts
|
|
145357
|
-
var
|
|
145439
|
+
var import_child_process6 = require("child_process");
|
|
145358
145440
|
var CMD_END = "--no-banner --no-color --log-level=fatal --report-format=json --report-path=-";
|
|
145359
145441
|
function gitleaksDetect() {
|
|
145360
145442
|
const cmd = "gitleaks detect " + CMD_END;
|
|
145361
145443
|
try {
|
|
145362
|
-
const result = (0,
|
|
145444
|
+
const result = (0, import_child_process6.execSync)(cmd, { encoding: "utf-8" });
|
|
145363
145445
|
return JSON.parse(result);
|
|
145364
145446
|
} catch (error88) {
|
|
145365
145447
|
if (error88.status === 1 && error88.stdout) {
|
|
@@ -145371,7 +145453,7 @@ function gitleaksDetect() {
|
|
|
145371
145453
|
function gitleaksProtect() {
|
|
145372
145454
|
const cmd = "gitleaks protect " + CMD_END;
|
|
145373
145455
|
try {
|
|
145374
|
-
const result = (0,
|
|
145456
|
+
const result = (0, import_child_process6.execSync)(cmd, { encoding: "utf-8" });
|
|
145375
145457
|
return JSON.parse(result);
|
|
145376
145458
|
} catch (error88) {
|
|
145377
145459
|
if (error88.status === 1 && error88.stdout) {
|
|
@@ -145382,8 +145464,8 @@ function gitleaksProtect() {
|
|
|
145382
145464
|
}
|
|
145383
145465
|
|
|
145384
145466
|
// src/proxy/playwright.ts
|
|
145385
|
-
var
|
|
145386
|
-
var
|
|
145467
|
+
var fs13 = __toESM(require("fs/promises"), 1);
|
|
145468
|
+
var path11 = __toESM(require("path"), 1);
|
|
145387
145469
|
var DEFAULT_CONFIG = `import { defineConfig } from "@playwright/test";
|
|
145388
145470
|
export default defineConfig({
|
|
145389
145471
|
timeout: 60000,
|
|
@@ -145569,7 +145651,7 @@ export default TimestampReporter;
|
|
|
145569
145651
|
`;
|
|
145570
145652
|
async function findRepositoryLocation(repoName) {
|
|
145571
145653
|
const currentDir = process.cwd();
|
|
145572
|
-
const currentDirName =
|
|
145654
|
+
const currentDirName = path11.basename(currentDir);
|
|
145573
145655
|
if (currentDirName === repoName) {
|
|
145574
145656
|
return currentDir;
|
|
145575
145657
|
}
|
|
@@ -145582,15 +145664,15 @@ async function findRepositoryLocation(repoName) {
|
|
|
145582
145664
|
async function verifyTestFileExists(repoLocation, testFilePath) {
|
|
145583
145665
|
if (testFilePath.startsWith("/")) {
|
|
145584
145666
|
try {
|
|
145585
|
-
await
|
|
145667
|
+
await fs13.access(testFilePath);
|
|
145586
145668
|
return testFilePath;
|
|
145587
145669
|
} catch {
|
|
145588
145670
|
throw new Error(`Test file not found: ${testFilePath}`);
|
|
145589
145671
|
}
|
|
145590
145672
|
}
|
|
145591
|
-
const testFullPath =
|
|
145673
|
+
const testFullPath = path11.join(repoLocation, testFilePath);
|
|
145592
145674
|
try {
|
|
145593
|
-
await
|
|
145675
|
+
await fs13.access(testFullPath);
|
|
145594
145676
|
return testFullPath;
|
|
145595
145677
|
} catch {
|
|
145596
145678
|
throw new Error(`Test file not found: ${testFilePath}`);
|
|
@@ -145603,9 +145685,9 @@ async function findPlaywrightConfig(repoLocation) {
|
|
|
145603
145685
|
"playwright.config.mjs"
|
|
145604
145686
|
];
|
|
145605
145687
|
for (const configFile of configFiles) {
|
|
145606
|
-
const fullConfigPath =
|
|
145688
|
+
const fullConfigPath = path11.join(repoLocation, configFile);
|
|
145607
145689
|
try {
|
|
145608
|
-
await
|
|
145690
|
+
await fs13.access(fullConfigPath);
|
|
145609
145691
|
return fullConfigPath;
|
|
145610
145692
|
} catch {
|
|
145611
145693
|
}
|
|
@@ -145613,29 +145695,29 @@ async function findPlaywrightConfig(repoLocation) {
|
|
|
145613
145695
|
return null;
|
|
145614
145696
|
}
|
|
145615
145697
|
async function createPlaywrightConfig(repoLocation) {
|
|
145616
|
-
const
|
|
145617
|
-
await
|
|
145618
|
-
log(`Created playwright config at ${
|
|
145619
|
-
return
|
|
145698
|
+
const configPath2 = path11.join(repoLocation, "playwright.config.ts");
|
|
145699
|
+
await fs13.writeFile(configPath2, DEFAULT_CONFIG);
|
|
145700
|
+
log(`Created playwright config at ${configPath2}`);
|
|
145701
|
+
return configPath2;
|
|
145620
145702
|
}
|
|
145621
145703
|
async function createTimestampReporter(repoLocation) {
|
|
145622
|
-
const reporterPath =
|
|
145623
|
-
await
|
|
145704
|
+
const reporterPath = path11.join(repoLocation, "timestamp-reporter.ts");
|
|
145705
|
+
await fs13.writeFile(reporterPath, TIMESTAMP_REPORTER_CODE);
|
|
145624
145706
|
log(`Created timestamp reporter at ${reporterPath}`);
|
|
145625
145707
|
return reporterPath;
|
|
145626
145708
|
}
|
|
145627
145709
|
async function setupPlaywrightConfig(repoLocation) {
|
|
145628
|
-
let
|
|
145710
|
+
let configPath2 = await findPlaywrightConfig(repoLocation);
|
|
145629
145711
|
let wasCreated = false;
|
|
145630
145712
|
let originalContent = null;
|
|
145631
145713
|
let wasModified = false;
|
|
145632
145714
|
const reporterPath = await createTimestampReporter(repoLocation);
|
|
145633
|
-
if (!
|
|
145634
|
-
|
|
145715
|
+
if (!configPath2) {
|
|
145716
|
+
configPath2 = await createPlaywrightConfig(repoLocation);
|
|
145635
145717
|
wasCreated = true;
|
|
145636
145718
|
log("Created new playwright config");
|
|
145637
145719
|
} else {
|
|
145638
|
-
originalContent = await
|
|
145720
|
+
originalContent = await fs13.readFile(configPath2, "utf-8");
|
|
145639
145721
|
wasModified = true;
|
|
145640
145722
|
const newConfig = `import { defineConfig } from "@playwright/test";
|
|
145641
145723
|
|
|
@@ -145655,13 +145737,13 @@ export default defineConfig({
|
|
|
145655
145737
|
},
|
|
145656
145738
|
});
|
|
145657
145739
|
`;
|
|
145658
|
-
await
|
|
145740
|
+
await fs13.writeFile(configPath2, newConfig);
|
|
145659
145741
|
log(
|
|
145660
|
-
`Overwrote existing config at ${
|
|
145742
|
+
`Overwrote existing config at ${configPath2} (backed up for cleanup)`
|
|
145661
145743
|
);
|
|
145662
145744
|
}
|
|
145663
145745
|
return {
|
|
145664
|
-
configPath,
|
|
145746
|
+
configPath: configPath2,
|
|
145665
145747
|
wasCreated,
|
|
145666
145748
|
originalContent,
|
|
145667
145749
|
wasModified,
|
|
@@ -145670,10 +145752,10 @@ export default defineConfig({
|
|
|
145670
145752
|
};
|
|
145671
145753
|
}
|
|
145672
145754
|
async function ensureTestResultsInGitignore(repoLocation) {
|
|
145673
|
-
const gitignorePath =
|
|
145755
|
+
const gitignorePath = path11.join(repoLocation, ".gitignore");
|
|
145674
145756
|
const testResultsEntry = "test-results";
|
|
145675
145757
|
try {
|
|
145676
|
-
const gitignoreContent = await
|
|
145758
|
+
const gitignoreContent = await fs13.readFile(gitignorePath, "utf-8");
|
|
145677
145759
|
const lines = gitignoreContent.split("\n");
|
|
145678
145760
|
const hasTestResults = lines.some(
|
|
145679
145761
|
(line) => line.trim() === testResultsEntry
|
|
@@ -145686,10 +145768,10 @@ async function ensureTestResultsInGitignore(repoLocation) {
|
|
|
145686
145768
|
` : `${gitignoreContent}
|
|
145687
145769
|
${testResultsEntry}
|
|
145688
145770
|
`;
|
|
145689
|
-
await
|
|
145771
|
+
await fs13.writeFile(gitignorePath, updatedContent);
|
|
145690
145772
|
log("Added test-results to .gitignore");
|
|
145691
145773
|
} catch (error88) {
|
|
145692
|
-
await
|
|
145774
|
+
await fs13.writeFile(gitignorePath, `${testResultsEntry}
|
|
145693
145775
|
`);
|
|
145694
145776
|
log("Created .gitignore with test-results");
|
|
145695
145777
|
}
|
|
@@ -145711,13 +145793,13 @@ async function runPlaywrightTest(repoLocation, testFilePath) {
|
|
|
145711
145793
|
}
|
|
145712
145794
|
}
|
|
145713
145795
|
async function findVideoFile(repoLocation) {
|
|
145714
|
-
const testResultsDir =
|
|
145796
|
+
const testResultsDir = path11.join(repoLocation, "test-results");
|
|
145715
145797
|
const walkDir = async (dir) => {
|
|
145716
145798
|
try {
|
|
145717
|
-
const files = await
|
|
145799
|
+
const files = await fs13.readdir(dir);
|
|
145718
145800
|
for (const file3 of files) {
|
|
145719
|
-
const fullPath =
|
|
145720
|
-
const stat4 = await
|
|
145801
|
+
const fullPath = path11.join(dir, file3);
|
|
145802
|
+
const stat4 = await fs13.stat(fullPath);
|
|
145721
145803
|
if (stat4.isDirectory()) {
|
|
145722
145804
|
const result = await walkDir(fullPath);
|
|
145723
145805
|
if (result) {
|
|
@@ -145740,13 +145822,13 @@ async function findVideoFile(repoLocation) {
|
|
|
145740
145822
|
return videoPath;
|
|
145741
145823
|
}
|
|
145742
145824
|
async function findTimestampJsonFile(repoLocation) {
|
|
145743
|
-
const testResultsDir =
|
|
145825
|
+
const testResultsDir = path11.join(repoLocation, "test-results");
|
|
145744
145826
|
const walkDir = async (dir) => {
|
|
145745
145827
|
try {
|
|
145746
|
-
const files = await
|
|
145828
|
+
const files = await fs13.readdir(dir);
|
|
145747
145829
|
for (const file3 of files) {
|
|
145748
|
-
const fullPath =
|
|
145749
|
-
const stat4 = await
|
|
145830
|
+
const fullPath = path11.join(dir, file3);
|
|
145831
|
+
const stat4 = await fs13.stat(fullPath);
|
|
145750
145832
|
if (stat4.isDirectory()) {
|
|
145751
145833
|
const result = await walkDir(fullPath);
|
|
145752
145834
|
if (result) {
|
|
@@ -145769,18 +145851,18 @@ async function findTimestampJsonFile(repoLocation) {
|
|
|
145769
145851
|
return jsonPath;
|
|
145770
145852
|
}
|
|
145771
145853
|
async function uploadVideo(videoPath, timestampJsonPath, responseUrl, apiKey) {
|
|
145772
|
-
const videoBuffer = await
|
|
145854
|
+
const videoBuffer = await fs13.readFile(videoPath);
|
|
145773
145855
|
log(`Read video file: ${videoBuffer.length} bytes`);
|
|
145774
|
-
const jsonBuffer = await
|
|
145856
|
+
const jsonBuffer = await fs13.readFile(timestampJsonPath);
|
|
145775
145857
|
log(`Read timestamp JSON file: ${jsonBuffer.length} bytes`);
|
|
145776
145858
|
const { FormData: FormData2, fetch: undiciFetch } = await Promise.resolve().then(() => __toESM(require_undici(), 1));
|
|
145777
145859
|
const formData = new FormData2();
|
|
145778
|
-
const videoFile = new File([videoBuffer],
|
|
145860
|
+
const videoFile = new File([videoBuffer], path11.basename(videoPath), {
|
|
145779
145861
|
type: "video/webm"
|
|
145780
145862
|
});
|
|
145781
145863
|
const timestampsFile = new File(
|
|
145782
145864
|
[jsonBuffer],
|
|
145783
|
-
|
|
145865
|
+
path11.basename(timestampJsonPath),
|
|
145784
145866
|
{
|
|
145785
145867
|
type: "application/json"
|
|
145786
145868
|
}
|
|
@@ -145806,13 +145888,13 @@ async function uploadVideo(videoPath, timestampJsonPath, responseUrl, apiKey) {
|
|
|
145806
145888
|
}
|
|
145807
145889
|
async function deleteTestFiles(videoPath, timestampJsonPath) {
|
|
145808
145890
|
try {
|
|
145809
|
-
await
|
|
145891
|
+
await fs13.unlink(videoPath);
|
|
145810
145892
|
log(`Deleted video file: ${videoPath}`);
|
|
145811
145893
|
} catch (error88) {
|
|
145812
145894
|
error(`Error deleting video file ${videoPath}:`, error88);
|
|
145813
145895
|
}
|
|
145814
145896
|
try {
|
|
145815
|
-
await
|
|
145897
|
+
await fs13.unlink(timestampJsonPath);
|
|
145816
145898
|
log(`Deleted timestamp JSON: ${timestampJsonPath}`);
|
|
145817
145899
|
} catch (error88) {
|
|
145818
145900
|
error(`Error deleting timestamp JSON ${timestampJsonPath}:`, error88);
|
|
@@ -145822,10 +145904,10 @@ async function cleanupConfig(configState) {
|
|
|
145822
145904
|
if (configState.configPath) {
|
|
145823
145905
|
try {
|
|
145824
145906
|
if (configState.wasCreated) {
|
|
145825
|
-
await
|
|
145907
|
+
await fs13.unlink(configState.configPath);
|
|
145826
145908
|
log(`Cleaned up created config file: ${configState.configPath}`);
|
|
145827
145909
|
} else if (configState.wasModified && configState.originalContent) {
|
|
145828
|
-
await
|
|
145910
|
+
await fs13.writeFile(configState.configPath, configState.originalContent);
|
|
145829
145911
|
log(`Restored original config: ${configState.configPath}`);
|
|
145830
145912
|
}
|
|
145831
145913
|
} catch (error88) {
|
|
@@ -145834,7 +145916,7 @@ async function cleanupConfig(configState) {
|
|
|
145834
145916
|
}
|
|
145835
145917
|
if (configState.reporterPath && configState.reporterWasCreated) {
|
|
145836
145918
|
try {
|
|
145837
|
-
await
|
|
145919
|
+
await fs13.unlink(configState.reporterPath);
|
|
145838
145920
|
log(`Cleaned up reporter file: ${configState.reporterPath}`);
|
|
145839
145921
|
} catch (error88) {
|
|
145840
145922
|
error("Error cleaning up reporter:", error88);
|
|
@@ -145922,12 +146004,12 @@ async function takeScreenshot(port) {
|
|
|
145922
146004
|
// src/proxy/git_actions.ts
|
|
145923
146005
|
var import_path4 = __toESM(require("path"), 1);
|
|
145924
146006
|
var import_fs4 = __toESM(require("fs"), 1);
|
|
145925
|
-
var
|
|
146007
|
+
var import_child_process8 = require("child_process");
|
|
145926
146008
|
|
|
145927
146009
|
// src/proxy/gh.ts
|
|
145928
|
-
var
|
|
146010
|
+
var import_child_process7 = require("child_process");
|
|
145929
146011
|
var import_util13 = require("util");
|
|
145930
|
-
var execAsync = (0, import_util13.promisify)(
|
|
146012
|
+
var execAsync = (0, import_util13.promisify)(import_child_process7.exec);
|
|
145931
146013
|
function sanitizeGitHubText(text3) {
|
|
145932
146014
|
return text3.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
145933
146015
|
}
|
|
@@ -145982,7 +146064,7 @@ Stderr: ${error88.stderr}`
|
|
|
145982
146064
|
execGHSync(command) {
|
|
145983
146065
|
const fullCommand = `gh ${command}`;
|
|
145984
146066
|
try {
|
|
145985
|
-
return (0,
|
|
146067
|
+
return (0, import_child_process7.execSync)(fullCommand, {
|
|
145986
146068
|
cwd: this.cwd,
|
|
145987
146069
|
encoding: "utf-8",
|
|
145988
146070
|
env: {
|
|
@@ -146995,9 +147077,9 @@ async function handleCreateRepo(req, res) {
|
|
|
146995
147077
|
}
|
|
146996
147078
|
if (!import_fs4.default.existsSync(import_path4.default.join(sourceDir, ".git"))) {
|
|
146997
147079
|
log(`=> Initializing git repository in ${sourceDir}`);
|
|
146998
|
-
(0,
|
|
146999
|
-
(0,
|
|
147000
|
-
(0,
|
|
147080
|
+
(0, import_child_process8.execSync)("git init", { cwd: sourceDir });
|
|
147081
|
+
(0, import_child_process8.execSync)("git add -A", { cwd: sourceDir });
|
|
147082
|
+
(0, import_child_process8.execSync)('git commit -m "Initial commit"', { cwd: sourceDir });
|
|
147001
147083
|
}
|
|
147002
147084
|
const gh = new GitHubCLI(body.token, "main", sourceDir);
|
|
147003
147085
|
const { repoUrl } = await gh.createRepository({
|
|
@@ -147189,8 +147271,8 @@ ${prompt}`);
|
|
|
147189
147271
|
}
|
|
147190
147272
|
|
|
147191
147273
|
// src/proxy/code_actions.ts
|
|
147192
|
-
var
|
|
147193
|
-
var
|
|
147274
|
+
var fs15 = __toESM(require("fs/promises"), 1);
|
|
147275
|
+
var path13 = __toESM(require("path"), 1);
|
|
147194
147276
|
async function processCode(code) {
|
|
147195
147277
|
const results = [];
|
|
147196
147278
|
const workspaceHasOneRepo = await hasOnlyOneRepo();
|
|
@@ -147264,24 +147346,24 @@ async function applyFileAction(file3, filePath) {
|
|
|
147264
147346
|
}
|
|
147265
147347
|
async function createFile(filePath, content) {
|
|
147266
147348
|
try {
|
|
147267
|
-
await
|
|
147349
|
+
await fs15.stat(filePath);
|
|
147268
147350
|
throw new Error(`File ${filePath} already exists`);
|
|
147269
147351
|
} catch (e) {
|
|
147270
147352
|
if (e.code !== "ENOENT") {
|
|
147271
147353
|
throw e;
|
|
147272
147354
|
}
|
|
147273
147355
|
}
|
|
147274
|
-
const dirPath =
|
|
147356
|
+
const dirPath = path13.dirname(filePath);
|
|
147275
147357
|
try {
|
|
147276
|
-
await
|
|
147358
|
+
await fs15.mkdir(dirPath, { recursive: true });
|
|
147277
147359
|
} catch (e) {
|
|
147278
147360
|
}
|
|
147279
|
-
await
|
|
147361
|
+
await fs15.writeFile(filePath, content, "utf8");
|
|
147280
147362
|
}
|
|
147281
147363
|
async function rewriteFile(filePath, content) {
|
|
147282
147364
|
try {
|
|
147283
|
-
await
|
|
147284
|
-
await
|
|
147365
|
+
await fs15.stat(filePath);
|
|
147366
|
+
await fs15.writeFile(filePath, content, "utf8");
|
|
147285
147367
|
} catch (e) {
|
|
147286
147368
|
if (e.code === "ENOENT") {
|
|
147287
147369
|
await createFile(filePath, content);
|
|
@@ -147292,7 +147374,7 @@ async function rewriteFile(filePath, content) {
|
|
|
147292
147374
|
}
|
|
147293
147375
|
async function modifyFile(filePath, changes) {
|
|
147294
147376
|
try {
|
|
147295
|
-
const originalContent = await
|
|
147377
|
+
const originalContent = await fs15.readFile(filePath, "utf8");
|
|
147296
147378
|
let newContent = originalContent.replace(/\r\n/g, "\n");
|
|
147297
147379
|
const finalChange = changes[changes.length - 1];
|
|
147298
147380
|
if (finalChange && finalChange.search) {
|
|
@@ -147317,7 +147399,7 @@ async function modifyFile(filePath, changes) {
|
|
|
147317
147399
|
}
|
|
147318
147400
|
}
|
|
147319
147401
|
if (originalContent !== newContent) {
|
|
147320
|
-
await
|
|
147402
|
+
await fs15.writeFile(filePath, newContent, "utf8");
|
|
147321
147403
|
} else {
|
|
147322
147404
|
log(`=> NO CHANGES to file ${filePath}`);
|
|
147323
147405
|
}
|
|
@@ -147326,7 +147408,7 @@ async function modifyFile(filePath, changes) {
|
|
|
147326
147408
|
}
|
|
147327
147409
|
}
|
|
147328
147410
|
async function deleteFile(filePath) {
|
|
147329
|
-
await
|
|
147411
|
+
await fs15.unlink(filePath);
|
|
147330
147412
|
}
|
|
147331
147413
|
|
|
147332
147414
|
// src/proxy/server.ts
|
|
@@ -147956,14 +148038,46 @@ async function startProxyServer() {
|
|
|
147956
148038
|
});
|
|
147957
148039
|
app.use(requireAuth);
|
|
147958
148040
|
app.post("/session", async (req, res) => {
|
|
147959
|
-
const {
|
|
148041
|
+
const {
|
|
148042
|
+
sessionId,
|
|
148043
|
+
webhookUrl,
|
|
148044
|
+
apiKey,
|
|
148045
|
+
searchApiKey,
|
|
148046
|
+
model,
|
|
148047
|
+
agent,
|
|
148048
|
+
system,
|
|
148049
|
+
temperature,
|
|
148050
|
+
jsonMode,
|
|
148051
|
+
summaryApiKey,
|
|
148052
|
+
mcpServers,
|
|
148053
|
+
baseUrl,
|
|
148054
|
+
headers,
|
|
148055
|
+
repoName,
|
|
148056
|
+
_metadata
|
|
148057
|
+
} = req.body;
|
|
147960
148058
|
if (!sessionId) {
|
|
147961
148059
|
res.status(400).json({
|
|
147962
148060
|
error: "Missing required fields: sessionId, webhookUrl"
|
|
147963
148061
|
});
|
|
147964
148062
|
return;
|
|
147965
148063
|
}
|
|
147966
|
-
const { token, created } = createSession(
|
|
148064
|
+
const { token, created } = createSession(
|
|
148065
|
+
sessionId,
|
|
148066
|
+
webhookUrl,
|
|
148067
|
+
apiKey,
|
|
148068
|
+
searchApiKey,
|
|
148069
|
+
model,
|
|
148070
|
+
agent,
|
|
148071
|
+
system,
|
|
148072
|
+
temperature,
|
|
148073
|
+
jsonMode,
|
|
148074
|
+
summaryApiKey,
|
|
148075
|
+
mcpServers,
|
|
148076
|
+
baseUrl,
|
|
148077
|
+
headers,
|
|
148078
|
+
repoName,
|
|
148079
|
+
_metadata
|
|
148080
|
+
);
|
|
147967
148081
|
res.json({
|
|
147968
148082
|
sessionId,
|
|
147969
148083
|
token,
|
|
@@ -147994,7 +148108,14 @@ async function startProxyServer() {
|
|
|
147994
148108
|
}
|
|
147995
148109
|
try {
|
|
147996
148110
|
const messages = exportSession(sessionId, "assistant");
|
|
147997
|
-
|
|
148111
|
+
const session = getSession(sessionId);
|
|
148112
|
+
const { _metadata = null, ...config3 } = session ?? {};
|
|
148113
|
+
res.json({
|
|
148114
|
+
success: true,
|
|
148115
|
+
messages,
|
|
148116
|
+
config: session ? config3 : null,
|
|
148117
|
+
_metadata
|
|
148118
|
+
});
|
|
147998
148119
|
} catch (error88) {
|
|
147999
148120
|
error("Error exporting session:", error88);
|
|
148000
148121
|
res.status(404).json({
|