staklink 0.5.5 → 0.5.7
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 +639 -506
- package/dist/staklink-cli.cjs +27 -15
- 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 = "
|
|
@@ -52882,7 +52882,8 @@ var Runner = class {
|
|
|
52882
52882
|
rebuildCommand: env2.REBUILD_COMMAND,
|
|
52883
52883
|
port: env2.PORT,
|
|
52884
52884
|
label: env2.LABEL,
|
|
52885
|
-
cwd: proc6.cwd || this.cwd
|
|
52885
|
+
cwd: proc6.cwd || this.cwd,
|
|
52886
|
+
env: proc6.env
|
|
52886
52887
|
};
|
|
52887
52888
|
}
|
|
52888
52889
|
parseProcessConfig(proc6) {
|
|
@@ -52900,7 +52901,8 @@ var Runner = class {
|
|
|
52900
52901
|
resetCommand: env2.RESET_COMMAND,
|
|
52901
52902
|
port: env2.PORT,
|
|
52902
52903
|
label: env2.LABEL,
|
|
52903
|
-
cwd: proc6.pm2_env.pm_cwd || this.cwd
|
|
52904
|
+
cwd: proc6.pm2_env.pm_cwd || this.cwd,
|
|
52905
|
+
env: proc6.pm2_env.env
|
|
52904
52906
|
};
|
|
52905
52907
|
}
|
|
52906
52908
|
/**
|
|
@@ -52919,7 +52921,8 @@ var Runner = class {
|
|
|
52919
52921
|
const { stdout, stderr } = await this.executeCommand(
|
|
52920
52922
|
processConfig.rebuildCommand,
|
|
52921
52923
|
processConfig.cwd,
|
|
52922
|
-
`Rebuilding ${processConfig.name}
|
|
52924
|
+
`Rebuilding ${processConfig.name}`,
|
|
52925
|
+
processConfig.env
|
|
52923
52926
|
);
|
|
52924
52927
|
results[processConfig.name] = stdout || stderr;
|
|
52925
52928
|
} catch (error88) {
|
|
@@ -52945,7 +52948,8 @@ var Runner = class {
|
|
|
52945
52948
|
const { stdout, stderr } = await this.executeCommand(
|
|
52946
52949
|
processConfig.installCommand,
|
|
52947
52950
|
processConfig.cwd,
|
|
52948
|
-
`Installing ${processConfig.name}
|
|
52951
|
+
`Installing ${processConfig.name}`,
|
|
52952
|
+
processConfig.env
|
|
52949
52953
|
);
|
|
52950
52954
|
results[processConfig.name] = stdout || stderr;
|
|
52951
52955
|
} catch (error88) {
|
|
@@ -52966,7 +52970,8 @@ var Runner = class {
|
|
|
52966
52970
|
await this.executeCommand(
|
|
52967
52971
|
processConfig.preRunCommand,
|
|
52968
52972
|
processConfig.cwd,
|
|
52969
|
-
`Pre-run command for ${processConfig.name}
|
|
52973
|
+
`Pre-run command for ${processConfig.name}`,
|
|
52974
|
+
processConfig.env
|
|
52970
52975
|
);
|
|
52971
52976
|
this.log_cb(`\u2705 Pre-run command completed for ${processConfig.name}`);
|
|
52972
52977
|
} catch (error88) {
|
|
@@ -52988,7 +52993,8 @@ var Runner = class {
|
|
|
52988
52993
|
await this.executeCommand(
|
|
52989
52994
|
processConfig.postRunCommand,
|
|
52990
52995
|
processConfig.cwd,
|
|
52991
|
-
`Post-run command for ${processConfig.name}
|
|
52996
|
+
`Post-run command for ${processConfig.name}`,
|
|
52997
|
+
processConfig.env
|
|
52992
52998
|
);
|
|
52993
52999
|
this.log_cb(
|
|
52994
53000
|
`\u2705 Post-run command completed for ${processConfig.name}`
|
|
@@ -53012,7 +53018,8 @@ var Runner = class {
|
|
|
53012
53018
|
await this.executeCommand(
|
|
53013
53019
|
processConfig.resetCommand,
|
|
53014
53020
|
processConfig.cwd,
|
|
53015
|
-
`Reset command for ${processConfig.name}
|
|
53021
|
+
`Reset command for ${processConfig.name}`,
|
|
53022
|
+
processConfig.env
|
|
53016
53023
|
);
|
|
53017
53024
|
this.log_cb(`\u2705 Reset command completed for ${processConfig.name}`);
|
|
53018
53025
|
} catch (error88) {
|
|
@@ -53044,7 +53051,8 @@ var Runner = class {
|
|
|
53044
53051
|
const { stdout, stderr } = await this.executeCommand(
|
|
53045
53052
|
processConfig.buildCommand,
|
|
53046
53053
|
processConfig.cwd,
|
|
53047
|
-
`Build command for ${processConfig.name}
|
|
53054
|
+
`Build command for ${processConfig.name}`,
|
|
53055
|
+
processConfig.env
|
|
53048
53056
|
);
|
|
53049
53057
|
results[processConfig.name] = { stdout, stderr };
|
|
53050
53058
|
this.log_cb(`\u2705 Build command completed for ${processConfig.name}`);
|
|
@@ -53075,7 +53083,8 @@ var Runner = class {
|
|
|
53075
53083
|
const { stdout, stderr } = await this.executeCommand(
|
|
53076
53084
|
processConfig.testCommand,
|
|
53077
53085
|
processConfig.cwd,
|
|
53078
|
-
`Test command for ${processConfig.name}
|
|
53086
|
+
`Test command for ${processConfig.name}`,
|
|
53087
|
+
processConfig.env
|
|
53079
53088
|
);
|
|
53080
53089
|
results[processConfig.name] = { stdout, stderr };
|
|
53081
53090
|
this.log_cb(`\u2705 Test command completed for ${processConfig.name}`);
|
|
@@ -53105,7 +53114,8 @@ var Runner = class {
|
|
|
53105
53114
|
const { stdout, stderr } = await this.executeCommand(
|
|
53106
53115
|
cmd,
|
|
53107
53116
|
processConfig.cwd,
|
|
53108
|
-
`E2E test command for ${processConfig.name}
|
|
53117
|
+
`E2E test command for ${processConfig.name}`,
|
|
53118
|
+
processConfig.env
|
|
53109
53119
|
);
|
|
53110
53120
|
results[processConfig.name] = { stdout, stderr };
|
|
53111
53121
|
this.log_cb(
|
|
@@ -53150,7 +53160,8 @@ var Runner = class {
|
|
|
53150
53160
|
await this.executeCommand(
|
|
53151
53161
|
processConfig.postRunCommand,
|
|
53152
53162
|
processConfig.cwd,
|
|
53153
|
-
`Post-run command for ${processConfig.name}
|
|
53163
|
+
`Post-run command for ${processConfig.name}`,
|
|
53164
|
+
processConfig.env
|
|
53154
53165
|
);
|
|
53155
53166
|
this.log_cb(
|
|
53156
53167
|
`\u2705 Post-run command completed for ${processConfig.name}`
|
|
@@ -53180,7 +53191,8 @@ var Runner = class {
|
|
|
53180
53191
|
await this.executeCommand(
|
|
53181
53192
|
config3.rebuildCommand,
|
|
53182
53193
|
config3.cwd,
|
|
53183
|
-
`Rebuilding ${config3.name}
|
|
53194
|
+
`Rebuilding ${config3.name}`,
|
|
53195
|
+
config3.env
|
|
53184
53196
|
);
|
|
53185
53197
|
} catch (error88) {
|
|
53186
53198
|
this.log_cb(`\u274C Rebuild before Restart failed for ${config3.name}`);
|
|
@@ -53304,14 +53316,14 @@ var Runner = class {
|
|
|
53304
53316
|
/**
|
|
53305
53317
|
* Execute a command with proper logging
|
|
53306
53318
|
*/
|
|
53307
|
-
async executeCommand(command, cwd = this.cwd, description = "Command", timeoutMs = 20 * 60 * 1e3) {
|
|
53319
|
+
async executeCommand(command, cwd = this.cwd, description = "Command", appEnv, timeoutMs = 20 * 60 * 1e3) {
|
|
53308
53320
|
this.log_cb(`\u26A1 ${description}: ${command}`);
|
|
53309
53321
|
this.log_cb(`\u{1F4C1} Working directory: ${cwd}`);
|
|
53310
53322
|
return new Promise((resolve3, reject) => {
|
|
53311
53323
|
const child = proc2.spawn("sh", ["-c", command], {
|
|
53312
53324
|
cwd,
|
|
53313
53325
|
stdio: ["pipe", "pipe", "pipe"],
|
|
53314
|
-
env: { ...process.env, CI: "1", DEBIAN_FRONTEND: "noninteractive" }
|
|
53326
|
+
env: { ...process.env, ...appEnv, CI: "1", DEBIAN_FRONTEND: "noninteractive" }
|
|
53315
53327
|
});
|
|
53316
53328
|
child.stdin?.end();
|
|
53317
53329
|
let stdout = "";
|
|
@@ -53487,7 +53499,7 @@ function parseXmlResponse(xmlString) {
|
|
|
53487
53499
|
const fileXml = remainingXml.slice(fileStart, fileEnd);
|
|
53488
53500
|
const pathMatch = fileXml.match(/path="([^"]*)"/);
|
|
53489
53501
|
const actionMatch = fileXml.match(/action="([^"]*)"/);
|
|
53490
|
-
const
|
|
53502
|
+
const path14 = pathMatch ? pathMatch[1] : "";
|
|
53491
53503
|
const action = actionMatch ? actionMatch[1] : "modify";
|
|
53492
53504
|
const changes = [];
|
|
53493
53505
|
let changeXml = fileXml;
|
|
@@ -53536,7 +53548,7 @@ function parseXmlResponse(xmlString) {
|
|
|
53536
53548
|
changeXml = changeXml.slice(changeEnd);
|
|
53537
53549
|
}
|
|
53538
53550
|
if (changes.length > 0) {
|
|
53539
|
-
files2.push({ path:
|
|
53551
|
+
files2.push({ path: path14, action, changes });
|
|
53540
53552
|
}
|
|
53541
53553
|
remainingXml = remainingXml.slice(fileEnd);
|
|
53542
53554
|
}
|
|
@@ -57595,12 +57607,12 @@ var PathBase = class {
|
|
|
57595
57607
|
/**
|
|
57596
57608
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
57597
57609
|
*/
|
|
57598
|
-
resolve(
|
|
57599
|
-
if (!
|
|
57610
|
+
resolve(path14) {
|
|
57611
|
+
if (!path14) {
|
|
57600
57612
|
return this;
|
|
57601
57613
|
}
|
|
57602
|
-
const rootPath = this.getRootString(
|
|
57603
|
-
const dir =
|
|
57614
|
+
const rootPath = this.getRootString(path14);
|
|
57615
|
+
const dir = path14.substring(rootPath.length);
|
|
57604
57616
|
const dirParts = dir.split(this.splitSep);
|
|
57605
57617
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
57606
57618
|
return result;
|
|
@@ -58352,8 +58364,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
|
|
|
58352
58364
|
/**
|
|
58353
58365
|
* @internal
|
|
58354
58366
|
*/
|
|
58355
|
-
getRootString(
|
|
58356
|
-
return import_node_path.win32.parse(
|
|
58367
|
+
getRootString(path14) {
|
|
58368
|
+
return import_node_path.win32.parse(path14).root;
|
|
58357
58369
|
}
|
|
58358
58370
|
/**
|
|
58359
58371
|
* @internal
|
|
@@ -58399,8 +58411,8 @@ var PathPosix = class _PathPosix extends PathBase {
|
|
|
58399
58411
|
/**
|
|
58400
58412
|
* @internal
|
|
58401
58413
|
*/
|
|
58402
|
-
getRootString(
|
|
58403
|
-
return
|
|
58414
|
+
getRootString(path14) {
|
|
58415
|
+
return path14.startsWith("/") ? "/" : "";
|
|
58404
58416
|
}
|
|
58405
58417
|
/**
|
|
58406
58418
|
* @internal
|
|
@@ -58449,8 +58461,8 @@ var PathScurryBase = class {
|
|
|
58449
58461
|
*
|
|
58450
58462
|
* @internal
|
|
58451
58463
|
*/
|
|
58452
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
58453
|
-
this.#fs = fsFromOption(
|
|
58464
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs17 = defaultFS } = {}) {
|
|
58465
|
+
this.#fs = fsFromOption(fs17);
|
|
58454
58466
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
58455
58467
|
cwd = (0, import_node_url.fileURLToPath)(cwd);
|
|
58456
58468
|
}
|
|
@@ -58489,11 +58501,11 @@ var PathScurryBase = class {
|
|
|
58489
58501
|
/**
|
|
58490
58502
|
* Get the depth of a provided path, string, or the cwd
|
|
58491
58503
|
*/
|
|
58492
|
-
depth(
|
|
58493
|
-
if (typeof
|
|
58494
|
-
|
|
58504
|
+
depth(path14 = this.cwd) {
|
|
58505
|
+
if (typeof path14 === "string") {
|
|
58506
|
+
path14 = this.cwd.resolve(path14);
|
|
58495
58507
|
}
|
|
58496
|
-
return
|
|
58508
|
+
return path14.depth();
|
|
58497
58509
|
}
|
|
58498
58510
|
/**
|
|
58499
58511
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -58980,9 +58992,9 @@ var PathScurryBase = class {
|
|
|
58980
58992
|
process3();
|
|
58981
58993
|
return results;
|
|
58982
58994
|
}
|
|
58983
|
-
chdir(
|
|
58995
|
+
chdir(path14 = this.cwd) {
|
|
58984
58996
|
const oldCwd = this.cwd;
|
|
58985
|
-
this.cwd = typeof
|
|
58997
|
+
this.cwd = typeof path14 === "string" ? this.cwd.resolve(path14) : path14;
|
|
58986
58998
|
this.cwd[setAsCwd](oldCwd);
|
|
58987
58999
|
}
|
|
58988
59000
|
};
|
|
@@ -59008,8 +59020,8 @@ var PathScurryWin32 = class extends PathScurryBase {
|
|
|
59008
59020
|
/**
|
|
59009
59021
|
* @internal
|
|
59010
59022
|
*/
|
|
59011
|
-
newRoot(
|
|
59012
|
-
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
59023
|
+
newRoot(fs17) {
|
|
59024
|
+
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs17 });
|
|
59013
59025
|
}
|
|
59014
59026
|
/**
|
|
59015
59027
|
* Return true if the provided path string is an absolute path
|
|
@@ -59037,8 +59049,8 @@ var PathScurryPosix = class extends PathScurryBase {
|
|
|
59037
59049
|
/**
|
|
59038
59050
|
* @internal
|
|
59039
59051
|
*/
|
|
59040
|
-
newRoot(
|
|
59041
|
-
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
59052
|
+
newRoot(fs17) {
|
|
59053
|
+
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs17 });
|
|
59042
59054
|
}
|
|
59043
59055
|
/**
|
|
59044
59056
|
* Return true if the provided path string is an absolute path
|
|
@@ -59338,8 +59350,8 @@ var MatchRecord = class {
|
|
|
59338
59350
|
}
|
|
59339
59351
|
// match, absolute, ifdir
|
|
59340
59352
|
entries() {
|
|
59341
|
-
return [...this.store.entries()].map(([
|
|
59342
|
-
|
|
59353
|
+
return [...this.store.entries()].map(([path14, n]) => [
|
|
59354
|
+
path14,
|
|
59343
59355
|
!!(n & 2),
|
|
59344
59356
|
!!(n & 1)
|
|
59345
59357
|
]);
|
|
@@ -59544,9 +59556,9 @@ var GlobUtil = class {
|
|
|
59544
59556
|
signal;
|
|
59545
59557
|
maxDepth;
|
|
59546
59558
|
includeChildMatches;
|
|
59547
|
-
constructor(patterns,
|
|
59559
|
+
constructor(patterns, path14, opts) {
|
|
59548
59560
|
this.patterns = patterns;
|
|
59549
|
-
this.path =
|
|
59561
|
+
this.path = path14;
|
|
59550
59562
|
this.opts = opts;
|
|
59551
59563
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
59552
59564
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -59565,11 +59577,11 @@ var GlobUtil = class {
|
|
|
59565
59577
|
});
|
|
59566
59578
|
}
|
|
59567
59579
|
}
|
|
59568
|
-
#ignored(
|
|
59569
|
-
return this.seen.has(
|
|
59580
|
+
#ignored(path14) {
|
|
59581
|
+
return this.seen.has(path14) || !!this.#ignore?.ignored?.(path14);
|
|
59570
59582
|
}
|
|
59571
|
-
#childrenIgnored(
|
|
59572
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
59583
|
+
#childrenIgnored(path14) {
|
|
59584
|
+
return !!this.#ignore?.childrenIgnored?.(path14);
|
|
59573
59585
|
}
|
|
59574
59586
|
// backpressure mechanism
|
|
59575
59587
|
pause() {
|
|
@@ -59784,8 +59796,8 @@ var GlobUtil = class {
|
|
|
59784
59796
|
};
|
|
59785
59797
|
var GlobWalker = class extends GlobUtil {
|
|
59786
59798
|
matches = /* @__PURE__ */ new Set();
|
|
59787
|
-
constructor(patterns,
|
|
59788
|
-
super(patterns,
|
|
59799
|
+
constructor(patterns, path14, opts) {
|
|
59800
|
+
super(patterns, path14, opts);
|
|
59789
59801
|
}
|
|
59790
59802
|
matchEmit(e) {
|
|
59791
59803
|
this.matches.add(e);
|
|
@@ -59822,8 +59834,8 @@ var GlobWalker = class extends GlobUtil {
|
|
|
59822
59834
|
};
|
|
59823
59835
|
var GlobStream = class extends GlobUtil {
|
|
59824
59836
|
results;
|
|
59825
|
-
constructor(patterns,
|
|
59826
|
-
super(patterns,
|
|
59837
|
+
constructor(patterns, path14, opts) {
|
|
59838
|
+
super(patterns, path14, opts);
|
|
59827
59839
|
this.results = new Minipass({
|
|
59828
59840
|
signal: this.signal,
|
|
59829
59841
|
objectMode: true
|
|
@@ -60991,7 +61003,7 @@ var SSEManager = class {
|
|
|
60991
61003
|
var sseManager = new SSEManager();
|
|
60992
61004
|
|
|
60993
61005
|
// src/proxy/version.ts
|
|
60994
|
-
var VERSION = "0.5.
|
|
61006
|
+
var VERSION = "0.5.7";
|
|
60995
61007
|
|
|
60996
61008
|
// node_modules/uuid/dist/esm/stringify.js
|
|
60997
61009
|
var byteToHex = [];
|
|
@@ -61973,10 +61985,10 @@ function mergeDefs(...defs) {
|
|
|
61973
61985
|
function cloneDef(schema) {
|
|
61974
61986
|
return mergeDefs(schema._zod.def);
|
|
61975
61987
|
}
|
|
61976
|
-
function getElementAtPath(obj,
|
|
61977
|
-
if (!
|
|
61988
|
+
function getElementAtPath(obj, path14) {
|
|
61989
|
+
if (!path14)
|
|
61978
61990
|
return obj;
|
|
61979
|
-
return
|
|
61991
|
+
return path14.reduce((acc, key) => acc?.[key], obj);
|
|
61980
61992
|
}
|
|
61981
61993
|
function promiseAllObject(promisesObj) {
|
|
61982
61994
|
const keys = Object.keys(promisesObj);
|
|
@@ -62359,11 +62371,11 @@ function aborted(x, startIndex = 0) {
|
|
|
62359
62371
|
}
|
|
62360
62372
|
return false;
|
|
62361
62373
|
}
|
|
62362
|
-
function prefixIssues(
|
|
62374
|
+
function prefixIssues(path14, issues) {
|
|
62363
62375
|
return issues.map((iss) => {
|
|
62364
62376
|
var _a26;
|
|
62365
62377
|
(_a26 = iss).path ?? (_a26.path = []);
|
|
62366
|
-
iss.path.unshift(
|
|
62378
|
+
iss.path.unshift(path14);
|
|
62367
62379
|
return iss;
|
|
62368
62380
|
});
|
|
62369
62381
|
}
|
|
@@ -62546,7 +62558,7 @@ function formatError(error88, mapper = (issue3) => issue3.message) {
|
|
|
62546
62558
|
}
|
|
62547
62559
|
function treeifyError(error88, mapper = (issue3) => issue3.message) {
|
|
62548
62560
|
const result = { errors: [] };
|
|
62549
|
-
const processError = (error89,
|
|
62561
|
+
const processError = (error89, path14 = []) => {
|
|
62550
62562
|
var _a26, _b20;
|
|
62551
62563
|
for (const issue3 of error89.issues) {
|
|
62552
62564
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
@@ -62556,7 +62568,7 @@ function treeifyError(error88, mapper = (issue3) => issue3.message) {
|
|
|
62556
62568
|
} else if (issue3.code === "invalid_element") {
|
|
62557
62569
|
processError({ issues: issue3.issues }, issue3.path);
|
|
62558
62570
|
} else {
|
|
62559
|
-
const fullpath = [...
|
|
62571
|
+
const fullpath = [...path14, ...issue3.path];
|
|
62560
62572
|
if (fullpath.length === 0) {
|
|
62561
62573
|
result.errors.push(mapper(issue3));
|
|
62562
62574
|
continue;
|
|
@@ -62588,8 +62600,8 @@ function treeifyError(error88, mapper = (issue3) => issue3.message) {
|
|
|
62588
62600
|
}
|
|
62589
62601
|
function toDotPath(_path) {
|
|
62590
62602
|
const segs = [];
|
|
62591
|
-
const
|
|
62592
|
-
for (const seg of
|
|
62603
|
+
const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
62604
|
+
for (const seg of path14) {
|
|
62593
62605
|
if (typeof seg === "number")
|
|
62594
62606
|
segs.push(`[${seg}]`);
|
|
62595
62607
|
else if (typeof seg === "symbol")
|
|
@@ -74566,13 +74578,13 @@ function resolveRef(ref, ctx) {
|
|
|
74566
74578
|
if (!ref.startsWith("#")) {
|
|
74567
74579
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
74568
74580
|
}
|
|
74569
|
-
const
|
|
74570
|
-
if (
|
|
74581
|
+
const path14 = ref.slice(1).split("/").filter(Boolean);
|
|
74582
|
+
if (path14.length === 0) {
|
|
74571
74583
|
return ctx.rootSchema;
|
|
74572
74584
|
}
|
|
74573
74585
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
74574
|
-
if (
|
|
74575
|
-
const key =
|
|
74586
|
+
if (path14[0] === defsKey) {
|
|
74587
|
+
const key = path14[1];
|
|
74576
74588
|
if (!key || !ctx.defs[key]) {
|
|
74577
74589
|
throw new Error(`Reference not found: ${ref}`);
|
|
74578
74590
|
}
|
|
@@ -75333,8 +75345,8 @@ function getErrorMap2() {
|
|
|
75333
75345
|
|
|
75334
75346
|
// node_modules/aieo/node_modules/zod/v3/helpers/parseUtil.js
|
|
75335
75347
|
var makeIssue = (params) => {
|
|
75336
|
-
const { data, path:
|
|
75337
|
-
const fullPath = [...
|
|
75348
|
+
const { data, path: path14, errorMaps, issueData } = params;
|
|
75349
|
+
const fullPath = [...path14, ...issueData.path || []];
|
|
75338
75350
|
const fullIssue = {
|
|
75339
75351
|
...issueData,
|
|
75340
75352
|
path: fullPath
|
|
@@ -75449,11 +75461,11 @@ var errorUtil;
|
|
|
75449
75461
|
|
|
75450
75462
|
// node_modules/aieo/node_modules/zod/v3/types.js
|
|
75451
75463
|
var ParseInputLazyPath = class {
|
|
75452
|
-
constructor(parent, value,
|
|
75464
|
+
constructor(parent, value, path14, key) {
|
|
75453
75465
|
this._cachedPath = [];
|
|
75454
75466
|
this.parent = parent;
|
|
75455
75467
|
this.data = value;
|
|
75456
|
-
this._path =
|
|
75468
|
+
this._path = path14;
|
|
75457
75469
|
this._key = key;
|
|
75458
75470
|
}
|
|
75459
75471
|
get path() {
|
|
@@ -79849,10 +79861,10 @@ function assignProp2(target, prop, value) {
|
|
|
79849
79861
|
configurable: true
|
|
79850
79862
|
});
|
|
79851
79863
|
}
|
|
79852
|
-
function getElementAtPath2(obj,
|
|
79853
|
-
if (!
|
|
79864
|
+
function getElementAtPath2(obj, path14) {
|
|
79865
|
+
if (!path14)
|
|
79854
79866
|
return obj;
|
|
79855
|
-
return
|
|
79867
|
+
return path14.reduce((acc, key) => acc?.[key], obj);
|
|
79856
79868
|
}
|
|
79857
79869
|
function promiseAllObject2(promisesObj) {
|
|
79858
79870
|
const keys = Object.keys(promisesObj);
|
|
@@ -80172,11 +80184,11 @@ function aborted2(x, startIndex = 0) {
|
|
|
80172
80184
|
}
|
|
80173
80185
|
return false;
|
|
80174
80186
|
}
|
|
80175
|
-
function prefixIssues2(
|
|
80187
|
+
function prefixIssues2(path14, issues) {
|
|
80176
80188
|
return issues.map((iss) => {
|
|
80177
80189
|
var _a26;
|
|
80178
80190
|
(_a26 = iss).path ?? (_a26.path = []);
|
|
80179
|
-
iss.path.unshift(
|
|
80191
|
+
iss.path.unshift(path14);
|
|
80180
80192
|
return iss;
|
|
80181
80193
|
});
|
|
80182
80194
|
}
|
|
@@ -80313,7 +80325,7 @@ function treeifyError2(error88, _mapper) {
|
|
|
80313
80325
|
return issue3.message;
|
|
80314
80326
|
};
|
|
80315
80327
|
const result = { errors: [] };
|
|
80316
|
-
const processError = (error89,
|
|
80328
|
+
const processError = (error89, path14 = []) => {
|
|
80317
80329
|
var _a26, _b20;
|
|
80318
80330
|
for (const issue3 of error89.issues) {
|
|
80319
80331
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
@@ -80323,7 +80335,7 @@ function treeifyError2(error88, _mapper) {
|
|
|
80323
80335
|
} else if (issue3.code === "invalid_element") {
|
|
80324
80336
|
processError({ issues: issue3.issues }, issue3.path);
|
|
80325
80337
|
} else {
|
|
80326
|
-
const fullpath = [...
|
|
80338
|
+
const fullpath = [...path14, ...issue3.path];
|
|
80327
80339
|
if (fullpath.length === 0) {
|
|
80328
80340
|
result.errors.push(mapper(issue3));
|
|
80329
80341
|
continue;
|
|
@@ -80353,9 +80365,9 @@ function treeifyError2(error88, _mapper) {
|
|
|
80353
80365
|
processError(error88);
|
|
80354
80366
|
return result;
|
|
80355
80367
|
}
|
|
80356
|
-
function toDotPath2(
|
|
80368
|
+
function toDotPath2(path14) {
|
|
80357
80369
|
const segs = [];
|
|
80358
|
-
for (const seg of
|
|
80370
|
+
for (const seg of path14) {
|
|
80359
80371
|
if (typeof seg === "number")
|
|
80360
80372
|
segs.push(`[${seg}]`);
|
|
80361
80373
|
else if (typeof seg === "symbol")
|
|
@@ -90814,8 +90826,8 @@ function getErrorMap4() {
|
|
|
90814
90826
|
|
|
90815
90827
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
90816
90828
|
var makeIssue2 = (params) => {
|
|
90817
|
-
const { data, path:
|
|
90818
|
-
const fullPath = [...
|
|
90829
|
+
const { data, path: path14, errorMaps, issueData } = params;
|
|
90830
|
+
const fullPath = [...path14, ...issueData.path || []];
|
|
90819
90831
|
const fullIssue = {
|
|
90820
90832
|
...issueData,
|
|
90821
90833
|
path: fullPath
|
|
@@ -90931,11 +90943,11 @@ var errorUtil2;
|
|
|
90931
90943
|
|
|
90932
90944
|
// node_modules/zod/v3/types.js
|
|
90933
90945
|
var ParseInputLazyPath2 = class {
|
|
90934
|
-
constructor(parent, value,
|
|
90946
|
+
constructor(parent, value, path14, key) {
|
|
90935
90947
|
this._cachedPath = [];
|
|
90936
90948
|
this.parent = parent;
|
|
90937
90949
|
this.data = value;
|
|
90938
|
-
this._path =
|
|
90950
|
+
this._path = path14;
|
|
90939
90951
|
this._key = key;
|
|
90940
90952
|
}
|
|
90941
90953
|
get path() {
|
|
@@ -102425,14 +102437,14 @@ var ClientSDK = class {
|
|
|
102425
102437
|
}
|
|
102426
102438
|
}
|
|
102427
102439
|
_createRequest(context2, conf, options) {
|
|
102428
|
-
const { method, path:
|
|
102440
|
+
const { method, path: path14, query, headers: opHeaders, security } = conf;
|
|
102429
102441
|
const base = conf.baseURL ?? this._baseURL;
|
|
102430
102442
|
if (!base) {
|
|
102431
102443
|
return ERR(new InvalidRequestError("No base URL provided for operation"));
|
|
102432
102444
|
}
|
|
102433
102445
|
const reqURL = new URL(base);
|
|
102434
|
-
const inputURL = new URL(
|
|
102435
|
-
if (
|
|
102446
|
+
const inputURL = new URL(path14, reqURL);
|
|
102447
|
+
if (path14) {
|
|
102436
102448
|
reqURL.pathname += reqURL.pathname.endsWith("/") ? "" : "/";
|
|
102437
102449
|
reqURL.pathname += inputURL.pathname.replace(/^\/+/, "");
|
|
102438
102450
|
}
|
|
@@ -104688,7 +104700,7 @@ async function $do(client, request, options) {
|
|
|
104688
104700
|
}
|
|
104689
104701
|
const payload = parsed.value;
|
|
104690
104702
|
const body = null;
|
|
104691
|
-
const
|
|
104703
|
+
const path14 = pathToFunc("/activity")();
|
|
104692
104704
|
const query = encodeFormQuery({
|
|
104693
104705
|
"date": payload?.date
|
|
104694
104706
|
});
|
|
@@ -104712,7 +104724,7 @@ async function $do(client, request, options) {
|
|
|
104712
104724
|
security: requestSecurity,
|
|
104713
104725
|
method: "GET",
|
|
104714
104726
|
baseURL: options?.serverURL,
|
|
104715
|
-
path:
|
|
104727
|
+
path: path14,
|
|
104716
104728
|
headers,
|
|
104717
104729
|
query,
|
|
104718
104730
|
body,
|
|
@@ -104767,7 +104779,7 @@ async function $do2(client, request, options) {
|
|
|
104767
104779
|
}
|
|
104768
104780
|
const payload = parsed.value;
|
|
104769
104781
|
const body = encodeJSON("body", payload, { explode: true });
|
|
104770
|
-
const
|
|
104782
|
+
const path14 = pathToFunc("/keys")();
|
|
104771
104783
|
const headers = new Headers(compactMap({
|
|
104772
104784
|
"Content-Type": "application/json",
|
|
104773
104785
|
Accept: "application/json"
|
|
@@ -104789,7 +104801,7 @@ async function $do2(client, request, options) {
|
|
|
104789
104801
|
security: requestSecurity,
|
|
104790
104802
|
method: "POST",
|
|
104791
104803
|
baseURL: options?.serverURL,
|
|
104792
|
-
path:
|
|
104804
|
+
path: path14,
|
|
104793
104805
|
headers,
|
|
104794
104806
|
body,
|
|
104795
104807
|
userAgent: client._options.userAgent,
|
|
@@ -104836,7 +104848,7 @@ async function $do3(client, request, options) {
|
|
|
104836
104848
|
charEncoding: "percent"
|
|
104837
104849
|
})
|
|
104838
104850
|
};
|
|
104839
|
-
const
|
|
104851
|
+
const path14 = pathToFunc("/keys/{hash}")(pathParams);
|
|
104840
104852
|
const headers = new Headers(compactMap({
|
|
104841
104853
|
Accept: "application/json"
|
|
104842
104854
|
}));
|
|
@@ -104857,7 +104869,7 @@ async function $do3(client, request, options) {
|
|
|
104857
104869
|
security: requestSecurity,
|
|
104858
104870
|
method: "DELETE",
|
|
104859
104871
|
baseURL: options?.serverURL,
|
|
104860
|
-
path:
|
|
104872
|
+
path: path14,
|
|
104861
104873
|
headers,
|
|
104862
104874
|
body,
|
|
104863
104875
|
userAgent: client._options.userAgent,
|
|
@@ -104904,7 +104916,7 @@ async function $do4(client, request, options) {
|
|
|
104904
104916
|
charEncoding: "percent"
|
|
104905
104917
|
})
|
|
104906
104918
|
};
|
|
104907
|
-
const
|
|
104919
|
+
const path14 = pathToFunc("/keys/{hash}")(pathParams);
|
|
104908
104920
|
const headers = new Headers(compactMap({
|
|
104909
104921
|
Accept: "application/json"
|
|
104910
104922
|
}));
|
|
@@ -104925,7 +104937,7 @@ async function $do4(client, request, options) {
|
|
|
104925
104937
|
security: requestSecurity,
|
|
104926
104938
|
method: "GET",
|
|
104927
104939
|
baseURL: options?.serverURL,
|
|
104928
|
-
path:
|
|
104940
|
+
path: path14,
|
|
104929
104941
|
headers,
|
|
104930
104942
|
body,
|
|
104931
104943
|
userAgent: client._options.userAgent,
|
|
@@ -104960,7 +104972,7 @@ function apiKeysGetCurrentKeyMetadata(client, options) {
|
|
|
104960
104972
|
return new APIPromise($do5(client, options));
|
|
104961
104973
|
}
|
|
104962
104974
|
async function $do5(client, options) {
|
|
104963
|
-
const
|
|
104975
|
+
const path14 = pathToFunc("/key")();
|
|
104964
104976
|
const headers = new Headers(compactMap({
|
|
104965
104977
|
Accept: "application/json"
|
|
104966
104978
|
}));
|
|
@@ -104981,7 +104993,7 @@ async function $do5(client, options) {
|
|
|
104981
104993
|
security: requestSecurity,
|
|
104982
104994
|
method: "GET",
|
|
104983
104995
|
baseURL: options?.serverURL,
|
|
104984
|
-
path:
|
|
104996
|
+
path: path14,
|
|
104985
104997
|
headers,
|
|
104986
104998
|
userAgent: client._options.userAgent,
|
|
104987
104999
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -105021,7 +105033,7 @@ async function $do6(client, request, options) {
|
|
|
105021
105033
|
}
|
|
105022
105034
|
const payload = parsed.value;
|
|
105023
105035
|
const body = null;
|
|
105024
|
-
const
|
|
105036
|
+
const path14 = pathToFunc("/keys")();
|
|
105025
105037
|
const query = encodeFormQuery({
|
|
105026
105038
|
"include_disabled": payload?.include_disabled,
|
|
105027
105039
|
"offset": payload?.offset
|
|
@@ -105046,7 +105058,7 @@ async function $do6(client, request, options) {
|
|
|
105046
105058
|
security: requestSecurity,
|
|
105047
105059
|
method: "GET",
|
|
105048
105060
|
baseURL: options?.serverURL,
|
|
105049
|
-
path:
|
|
105061
|
+
path: path14,
|
|
105050
105062
|
headers,
|
|
105051
105063
|
query,
|
|
105052
105064
|
body,
|
|
@@ -105094,7 +105106,7 @@ async function $do7(client, request, options) {
|
|
|
105094
105106
|
charEncoding: "percent"
|
|
105095
105107
|
})
|
|
105096
105108
|
};
|
|
105097
|
-
const
|
|
105109
|
+
const path14 = pathToFunc("/keys/{hash}")(pathParams);
|
|
105098
105110
|
const headers = new Headers(compactMap({
|
|
105099
105111
|
"Content-Type": "application/json",
|
|
105100
105112
|
Accept: "application/json"
|
|
@@ -105116,7 +105128,7 @@ async function $do7(client, request, options) {
|
|
|
105116
105128
|
security: requestSecurity,
|
|
105117
105129
|
method: "PATCH",
|
|
105118
105130
|
baseURL: options?.serverURL,
|
|
105119
|
-
path:
|
|
105131
|
+
path: path14,
|
|
105120
105132
|
headers,
|
|
105121
105133
|
body,
|
|
105122
105134
|
userAgent: client._options.userAgent,
|
|
@@ -105215,7 +105227,7 @@ async function $do8(client, request, options) {
|
|
|
105215
105227
|
}
|
|
105216
105228
|
const payload = parsed.value;
|
|
105217
105229
|
const body = encodeJSON("body", payload, { explode: true });
|
|
105218
|
-
const
|
|
105230
|
+
const path14 = pathToFunc("/responses")();
|
|
105219
105231
|
const headers = new Headers(compactMap({
|
|
105220
105232
|
"Content-Type": "application/json",
|
|
105221
105233
|
Accept: request?.stream ? "text/event-stream" : "application/json"
|
|
@@ -105237,7 +105249,7 @@ async function $do8(client, request, options) {
|
|
|
105237
105249
|
security: requestSecurity,
|
|
105238
105250
|
method: "POST",
|
|
105239
105251
|
baseURL: options?.serverURL,
|
|
105240
|
-
path:
|
|
105252
|
+
path: path14,
|
|
105241
105253
|
headers,
|
|
105242
105254
|
body,
|
|
105243
105255
|
userAgent: client._options.userAgent,
|
|
@@ -105308,7 +105320,7 @@ async function $do9(client, request, options) {
|
|
|
105308
105320
|
}
|
|
105309
105321
|
const payload = parsed.value;
|
|
105310
105322
|
const body = encodeJSON("body", payload, { explode: true });
|
|
105311
|
-
const
|
|
105323
|
+
const path14 = pathToFunc("/chat/completions")();
|
|
105312
105324
|
const headers = new Headers(compactMap({
|
|
105313
105325
|
"Content-Type": "application/json",
|
|
105314
105326
|
Accept: request?.stream ? "text/event-stream" : "application/json"
|
|
@@ -105330,7 +105342,7 @@ async function $do9(client, request, options) {
|
|
|
105330
105342
|
security: requestSecurity,
|
|
105331
105343
|
method: "POST",
|
|
105332
105344
|
baseURL: options?.serverURL,
|
|
105333
|
-
path:
|
|
105345
|
+
path: path14,
|
|
105334
105346
|
headers,
|
|
105335
105347
|
body,
|
|
105336
105348
|
userAgent: client._options.userAgent,
|
|
@@ -105378,7 +105390,7 @@ async function $do10(client, request, options) {
|
|
|
105378
105390
|
}
|
|
105379
105391
|
const payload = parsed.value;
|
|
105380
105392
|
const body = encodeJSON("body", payload, { explode: true });
|
|
105381
|
-
const
|
|
105393
|
+
const path14 = pathToFunc("/completions")();
|
|
105382
105394
|
const headers = new Headers(compactMap({
|
|
105383
105395
|
"Content-Type": "application/json",
|
|
105384
105396
|
Accept: "application/json"
|
|
@@ -105400,7 +105412,7 @@ async function $do10(client, request, options) {
|
|
|
105400
105412
|
security: requestSecurity,
|
|
105401
105413
|
method: "POST",
|
|
105402
105414
|
baseURL: options?.serverURL,
|
|
105403
|
-
path:
|
|
105415
|
+
path: path14,
|
|
105404
105416
|
headers,
|
|
105405
105417
|
body,
|
|
105406
105418
|
userAgent: client._options.userAgent,
|
|
@@ -105454,7 +105466,7 @@ async function $do11(client, security, request, options) {
|
|
|
105454
105466
|
}
|
|
105455
105467
|
const payload = parsed.value;
|
|
105456
105468
|
const body = encodeJSON("body", payload, { explode: true });
|
|
105457
|
-
const
|
|
105469
|
+
const path14 = pathToFunc("/credits/coinbase")();
|
|
105458
105470
|
const headers = new Headers(compactMap({
|
|
105459
105471
|
"Content-Type": "application/json",
|
|
105460
105472
|
Accept: "application/json"
|
|
@@ -105480,7 +105492,7 @@ async function $do11(client, security, request, options) {
|
|
|
105480
105492
|
security: requestSecurity,
|
|
105481
105493
|
method: "POST",
|
|
105482
105494
|
baseURL: options?.serverURL,
|
|
105483
|
-
path:
|
|
105495
|
+
path: path14,
|
|
105484
105496
|
headers,
|
|
105485
105497
|
body,
|
|
105486
105498
|
userAgent: client._options.userAgent,
|
|
@@ -105515,7 +105527,7 @@ function creditsGetCredits(client, options) {
|
|
|
105515
105527
|
return new APIPromise($do12(client, options));
|
|
105516
105528
|
}
|
|
105517
105529
|
async function $do12(client, options) {
|
|
105518
|
-
const
|
|
105530
|
+
const path14 = pathToFunc("/credits")();
|
|
105519
105531
|
const headers = new Headers(compactMap({
|
|
105520
105532
|
Accept: "application/json"
|
|
105521
105533
|
}));
|
|
@@ -105536,7 +105548,7 @@ async function $do12(client, options) {
|
|
|
105536
105548
|
security: requestSecurity,
|
|
105537
105549
|
method: "GET",
|
|
105538
105550
|
baseURL: options?.serverURL,
|
|
105539
|
-
path:
|
|
105551
|
+
path: path14,
|
|
105540
105552
|
headers,
|
|
105541
105553
|
userAgent: client._options.userAgent,
|
|
105542
105554
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -105598,7 +105610,7 @@ async function $do13(client, request, options) {
|
|
|
105598
105610
|
}
|
|
105599
105611
|
const payload = parsed.value;
|
|
105600
105612
|
const body = encodeJSON("body", payload, { explode: true });
|
|
105601
|
-
const
|
|
105613
|
+
const path14 = pathToFunc("/embeddings")();
|
|
105602
105614
|
const headers = new Headers(compactMap({
|
|
105603
105615
|
"Content-Type": "application/json",
|
|
105604
105616
|
Accept: "application/json;q=1, text/event-stream;q=0"
|
|
@@ -105620,7 +105632,7 @@ async function $do13(client, request, options) {
|
|
|
105620
105632
|
security: requestSecurity,
|
|
105621
105633
|
method: "POST",
|
|
105622
105634
|
baseURL: options?.serverURL,
|
|
105623
|
-
path:
|
|
105635
|
+
path: path14,
|
|
105624
105636
|
headers,
|
|
105625
105637
|
body,
|
|
105626
105638
|
userAgent: client._options.userAgent,
|
|
@@ -105670,7 +105682,7 @@ function embeddingsListModels(client, options) {
|
|
|
105670
105682
|
return new APIPromise($do14(client, options));
|
|
105671
105683
|
}
|
|
105672
105684
|
async function $do14(client, options) {
|
|
105673
|
-
const
|
|
105685
|
+
const path14 = pathToFunc("/embeddings/models")();
|
|
105674
105686
|
const headers = new Headers(compactMap({
|
|
105675
105687
|
Accept: "application/json"
|
|
105676
105688
|
}));
|
|
@@ -105691,7 +105703,7 @@ async function $do14(client, options) {
|
|
|
105691
105703
|
security: requestSecurity,
|
|
105692
105704
|
method: "GET",
|
|
105693
105705
|
baseURL: options?.serverURL,
|
|
105694
|
-
path:
|
|
105706
|
+
path: path14,
|
|
105695
105707
|
headers,
|
|
105696
105708
|
userAgent: client._options.userAgent,
|
|
105697
105709
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -105763,7 +105775,7 @@ async function $do15(client, request, options) {
|
|
|
105763
105775
|
charEncoding: "percent"
|
|
105764
105776
|
})
|
|
105765
105777
|
};
|
|
105766
|
-
const
|
|
105778
|
+
const path14 = pathToFunc("/models/{author}/{slug}/endpoints")(pathParams);
|
|
105767
105779
|
const headers = new Headers(compactMap({
|
|
105768
105780
|
Accept: "application/json"
|
|
105769
105781
|
}));
|
|
@@ -105784,7 +105796,7 @@ async function $do15(client, request, options) {
|
|
|
105784
105796
|
security: requestSecurity,
|
|
105785
105797
|
method: "GET",
|
|
105786
105798
|
baseURL: options?.serverURL,
|
|
105787
|
-
path:
|
|
105799
|
+
path: path14,
|
|
105788
105800
|
headers,
|
|
105789
105801
|
body,
|
|
105790
105802
|
userAgent: client._options.userAgent,
|
|
@@ -105819,7 +105831,7 @@ function endpointsListZdrEndpoints(client, options) {
|
|
|
105819
105831
|
return new APIPromise($do16(client, options));
|
|
105820
105832
|
}
|
|
105821
105833
|
async function $do16(client, options) {
|
|
105822
|
-
const
|
|
105834
|
+
const path14 = pathToFunc("/endpoints/zdr")();
|
|
105823
105835
|
const headers = new Headers(compactMap({
|
|
105824
105836
|
Accept: "application/json"
|
|
105825
105837
|
}));
|
|
@@ -105840,7 +105852,7 @@ async function $do16(client, options) {
|
|
|
105840
105852
|
security: requestSecurity,
|
|
105841
105853
|
method: "GET",
|
|
105842
105854
|
baseURL: options?.serverURL,
|
|
105843
|
-
path:
|
|
105855
|
+
path: path14,
|
|
105844
105856
|
headers,
|
|
105845
105857
|
userAgent: client._options.userAgent,
|
|
105846
105858
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -105896,7 +105908,7 @@ async function $do17(client, request, options) {
|
|
|
105896
105908
|
}
|
|
105897
105909
|
const payload = parsed.value;
|
|
105898
105910
|
const body = null;
|
|
105899
|
-
const
|
|
105911
|
+
const path14 = pathToFunc("/generation")();
|
|
105900
105912
|
const query = encodeFormQuery({
|
|
105901
105913
|
"id": payload.id
|
|
105902
105914
|
});
|
|
@@ -105920,7 +105932,7 @@ async function $do17(client, request, options) {
|
|
|
105920
105932
|
security: requestSecurity,
|
|
105921
105933
|
method: "GET",
|
|
105922
105934
|
baseURL: options?.serverURL,
|
|
105923
|
-
path:
|
|
105935
|
+
path: path14,
|
|
105924
105936
|
headers,
|
|
105925
105937
|
query,
|
|
105926
105938
|
body,
|
|
@@ -105989,7 +106001,7 @@ async function $do18(client, request, options) {
|
|
|
105989
106001
|
charEncoding: "percent"
|
|
105990
106002
|
})
|
|
105991
106003
|
};
|
|
105992
|
-
const
|
|
106004
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/keys")(pathParams);
|
|
105993
106005
|
const headers = new Headers(compactMap({
|
|
105994
106006
|
"Content-Type": "application/json",
|
|
105995
106007
|
Accept: "application/json"
|
|
@@ -106011,7 +106023,7 @@ async function $do18(client, request, options) {
|
|
|
106011
106023
|
security: requestSecurity,
|
|
106012
106024
|
method: "POST",
|
|
106013
106025
|
baseURL: options?.serverURL,
|
|
106014
|
-
path:
|
|
106026
|
+
path: path14,
|
|
106015
106027
|
headers,
|
|
106016
106028
|
body,
|
|
106017
106029
|
userAgent: client._options.userAgent,
|
|
@@ -106058,7 +106070,7 @@ async function $do19(client, request, options) {
|
|
|
106058
106070
|
charEncoding: "percent"
|
|
106059
106071
|
})
|
|
106060
106072
|
};
|
|
106061
|
-
const
|
|
106073
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/members")(pathParams);
|
|
106062
106074
|
const headers = new Headers(compactMap({
|
|
106063
106075
|
"Content-Type": "application/json",
|
|
106064
106076
|
Accept: "application/json"
|
|
@@ -106080,7 +106092,7 @@ async function $do19(client, request, options) {
|
|
|
106080
106092
|
security: requestSecurity,
|
|
106081
106093
|
method: "POST",
|
|
106082
106094
|
baseURL: options?.serverURL,
|
|
106083
|
-
path:
|
|
106095
|
+
path: path14,
|
|
106084
106096
|
headers,
|
|
106085
106097
|
body,
|
|
106086
106098
|
userAgent: client._options.userAgent,
|
|
@@ -106127,7 +106139,7 @@ async function $do20(client, request, options) {
|
|
|
106127
106139
|
charEncoding: "percent"
|
|
106128
106140
|
})
|
|
106129
106141
|
};
|
|
106130
|
-
const
|
|
106142
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/keys/remove")(pathParams);
|
|
106131
106143
|
const headers = new Headers(compactMap({
|
|
106132
106144
|
"Content-Type": "application/json",
|
|
106133
106145
|
Accept: "application/json"
|
|
@@ -106149,7 +106161,7 @@ async function $do20(client, request, options) {
|
|
|
106149
106161
|
security: requestSecurity,
|
|
106150
106162
|
method: "POST",
|
|
106151
106163
|
baseURL: options?.serverURL,
|
|
106152
|
-
path:
|
|
106164
|
+
path: path14,
|
|
106153
106165
|
headers,
|
|
106154
106166
|
body,
|
|
106155
106167
|
userAgent: client._options.userAgent,
|
|
@@ -106196,7 +106208,7 @@ async function $do21(client, request, options) {
|
|
|
106196
106208
|
charEncoding: "percent"
|
|
106197
106209
|
})
|
|
106198
106210
|
};
|
|
106199
|
-
const
|
|
106211
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/members/remove")(pathParams);
|
|
106200
106212
|
const headers = new Headers(compactMap({
|
|
106201
106213
|
"Content-Type": "application/json",
|
|
106202
106214
|
Accept: "application/json"
|
|
@@ -106218,7 +106230,7 @@ async function $do21(client, request, options) {
|
|
|
106218
106230
|
security: requestSecurity,
|
|
106219
106231
|
method: "POST",
|
|
106220
106232
|
baseURL: options?.serverURL,
|
|
106221
|
-
path:
|
|
106233
|
+
path: path14,
|
|
106222
106234
|
headers,
|
|
106223
106235
|
body,
|
|
106224
106236
|
userAgent: client._options.userAgent,
|
|
@@ -106259,7 +106271,7 @@ async function $do22(client, request, options) {
|
|
|
106259
106271
|
}
|
|
106260
106272
|
const payload = parsed.value;
|
|
106261
106273
|
const body = encodeJSON("body", payload, { explode: true });
|
|
106262
|
-
const
|
|
106274
|
+
const path14 = pathToFunc("/guardrails")();
|
|
106263
106275
|
const headers = new Headers(compactMap({
|
|
106264
106276
|
"Content-Type": "application/json",
|
|
106265
106277
|
Accept: "application/json"
|
|
@@ -106281,7 +106293,7 @@ async function $do22(client, request, options) {
|
|
|
106281
106293
|
security: requestSecurity,
|
|
106282
106294
|
method: "POST",
|
|
106283
106295
|
baseURL: options?.serverURL,
|
|
106284
|
-
path:
|
|
106296
|
+
path: path14,
|
|
106285
106297
|
headers,
|
|
106286
106298
|
body,
|
|
106287
106299
|
userAgent: client._options.userAgent,
|
|
@@ -106328,7 +106340,7 @@ async function $do23(client, request, options) {
|
|
|
106328
106340
|
charEncoding: "percent"
|
|
106329
106341
|
})
|
|
106330
106342
|
};
|
|
106331
|
-
const
|
|
106343
|
+
const path14 = pathToFunc("/guardrails/{id}")(pathParams);
|
|
106332
106344
|
const headers = new Headers(compactMap({
|
|
106333
106345
|
Accept: "application/json"
|
|
106334
106346
|
}));
|
|
@@ -106349,7 +106361,7 @@ async function $do23(client, request, options) {
|
|
|
106349
106361
|
security: requestSecurity,
|
|
106350
106362
|
method: "DELETE",
|
|
106351
106363
|
baseURL: options?.serverURL,
|
|
106352
|
-
path:
|
|
106364
|
+
path: path14,
|
|
106353
106365
|
headers,
|
|
106354
106366
|
body,
|
|
106355
106367
|
userAgent: client._options.userAgent,
|
|
@@ -106396,7 +106408,7 @@ async function $do24(client, request, options) {
|
|
|
106396
106408
|
charEncoding: "percent"
|
|
106397
106409
|
})
|
|
106398
106410
|
};
|
|
106399
|
-
const
|
|
106411
|
+
const path14 = pathToFunc("/guardrails/{id}")(pathParams);
|
|
106400
106412
|
const headers = new Headers(compactMap({
|
|
106401
106413
|
Accept: "application/json"
|
|
106402
106414
|
}));
|
|
@@ -106417,7 +106429,7 @@ async function $do24(client, request, options) {
|
|
|
106417
106429
|
security: requestSecurity,
|
|
106418
106430
|
method: "GET",
|
|
106419
106431
|
baseURL: options?.serverURL,
|
|
106420
|
-
path:
|
|
106432
|
+
path: path14,
|
|
106421
106433
|
headers,
|
|
106422
106434
|
body,
|
|
106423
106435
|
userAgent: client._options.userAgent,
|
|
@@ -106458,7 +106470,7 @@ async function $do25(client, request, options) {
|
|
|
106458
106470
|
}
|
|
106459
106471
|
const payload = parsed.value;
|
|
106460
106472
|
const body = null;
|
|
106461
|
-
const
|
|
106473
|
+
const path14 = pathToFunc("/guardrails")();
|
|
106462
106474
|
const query = encodeFormQuery({
|
|
106463
106475
|
"limit": payload?.limit,
|
|
106464
106476
|
"offset": payload?.offset
|
|
@@ -106483,7 +106495,7 @@ async function $do25(client, request, options) {
|
|
|
106483
106495
|
security: requestSecurity,
|
|
106484
106496
|
method: "GET",
|
|
106485
106497
|
baseURL: options?.serverURL,
|
|
106486
|
-
path:
|
|
106498
|
+
path: path14,
|
|
106487
106499
|
headers,
|
|
106488
106500
|
query,
|
|
106489
106501
|
body,
|
|
@@ -106531,7 +106543,7 @@ async function $do26(client, request, options) {
|
|
|
106531
106543
|
charEncoding: "percent"
|
|
106532
106544
|
})
|
|
106533
106545
|
};
|
|
106534
|
-
const
|
|
106546
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/keys")(pathParams);
|
|
106535
106547
|
const query = encodeFormQuery({
|
|
106536
106548
|
"limit": payload.limit,
|
|
106537
106549
|
"offset": payload.offset
|
|
@@ -106556,7 +106568,7 @@ async function $do26(client, request, options) {
|
|
|
106556
106568
|
security: requestSecurity,
|
|
106557
106569
|
method: "GET",
|
|
106558
106570
|
baseURL: options?.serverURL,
|
|
106559
|
-
path:
|
|
106571
|
+
path: path14,
|
|
106560
106572
|
headers,
|
|
106561
106573
|
query,
|
|
106562
106574
|
body,
|
|
@@ -106604,7 +106616,7 @@ async function $do27(client, request, options) {
|
|
|
106604
106616
|
charEncoding: "percent"
|
|
106605
106617
|
})
|
|
106606
106618
|
};
|
|
106607
|
-
const
|
|
106619
|
+
const path14 = pathToFunc("/guardrails/{id}/assignments/members")(pathParams);
|
|
106608
106620
|
const query = encodeFormQuery({
|
|
106609
106621
|
"limit": payload.limit,
|
|
106610
106622
|
"offset": payload.offset
|
|
@@ -106629,7 +106641,7 @@ async function $do27(client, request, options) {
|
|
|
106629
106641
|
security: requestSecurity,
|
|
106630
106642
|
method: "GET",
|
|
106631
106643
|
baseURL: options?.serverURL,
|
|
106632
|
-
path:
|
|
106644
|
+
path: path14,
|
|
106633
106645
|
headers,
|
|
106634
106646
|
query,
|
|
106635
106647
|
body,
|
|
@@ -106671,7 +106683,7 @@ async function $do28(client, request, options) {
|
|
|
106671
106683
|
}
|
|
106672
106684
|
const payload = parsed.value;
|
|
106673
106685
|
const body = null;
|
|
106674
|
-
const
|
|
106686
|
+
const path14 = pathToFunc("/guardrails/assignments/keys")();
|
|
106675
106687
|
const query = encodeFormQuery({
|
|
106676
106688
|
"limit": payload?.limit,
|
|
106677
106689
|
"offset": payload?.offset
|
|
@@ -106696,7 +106708,7 @@ async function $do28(client, request, options) {
|
|
|
106696
106708
|
security: requestSecurity,
|
|
106697
106709
|
method: "GET",
|
|
106698
106710
|
baseURL: options?.serverURL,
|
|
106699
|
-
path:
|
|
106711
|
+
path: path14,
|
|
106700
106712
|
headers,
|
|
106701
106713
|
query,
|
|
106702
106714
|
body,
|
|
@@ -106738,7 +106750,7 @@ async function $do29(client, request, options) {
|
|
|
106738
106750
|
}
|
|
106739
106751
|
const payload = parsed.value;
|
|
106740
106752
|
const body = null;
|
|
106741
|
-
const
|
|
106753
|
+
const path14 = pathToFunc("/guardrails/assignments/members")();
|
|
106742
106754
|
const query = encodeFormQuery({
|
|
106743
106755
|
"limit": payload?.limit,
|
|
106744
106756
|
"offset": payload?.offset
|
|
@@ -106763,7 +106775,7 @@ async function $do29(client, request, options) {
|
|
|
106763
106775
|
security: requestSecurity,
|
|
106764
106776
|
method: "GET",
|
|
106765
106777
|
baseURL: options?.serverURL,
|
|
106766
|
-
path:
|
|
106778
|
+
path: path14,
|
|
106767
106779
|
headers,
|
|
106768
106780
|
query,
|
|
106769
106781
|
body,
|
|
@@ -106811,7 +106823,7 @@ async function $do30(client, request, options) {
|
|
|
106811
106823
|
charEncoding: "percent"
|
|
106812
106824
|
})
|
|
106813
106825
|
};
|
|
106814
|
-
const
|
|
106826
|
+
const path14 = pathToFunc("/guardrails/{id}")(pathParams);
|
|
106815
106827
|
const headers = new Headers(compactMap({
|
|
106816
106828
|
"Content-Type": "application/json",
|
|
106817
106829
|
Accept: "application/json"
|
|
@@ -106833,7 +106845,7 @@ async function $do30(client, request, options) {
|
|
|
106833
106845
|
security: requestSecurity,
|
|
106834
106846
|
method: "PATCH",
|
|
106835
106847
|
baseURL: options?.serverURL,
|
|
106836
|
-
path:
|
|
106848
|
+
path: path14,
|
|
106837
106849
|
headers,
|
|
106838
106850
|
body,
|
|
106839
106851
|
userAgent: client._options.userAgent,
|
|
@@ -106989,7 +107001,7 @@ function modelsCount(client, options) {
|
|
|
106989
107001
|
return new APIPromise($do31(client, options));
|
|
106990
107002
|
}
|
|
106991
107003
|
async function $do31(client, options) {
|
|
106992
|
-
const
|
|
107004
|
+
const path14 = pathToFunc("/models/count")();
|
|
106993
107005
|
const headers = new Headers(compactMap({
|
|
106994
107006
|
Accept: "application/json"
|
|
106995
107007
|
}));
|
|
@@ -107010,7 +107022,7 @@ async function $do31(client, options) {
|
|
|
107010
107022
|
security: requestSecurity,
|
|
107011
107023
|
method: "GET",
|
|
107012
107024
|
baseURL: options?.serverURL,
|
|
107013
|
-
path:
|
|
107025
|
+
path: path14,
|
|
107014
107026
|
headers,
|
|
107015
107027
|
userAgent: client._options.userAgent,
|
|
107016
107028
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -107050,7 +107062,7 @@ async function $do32(client, request, options) {
|
|
|
107050
107062
|
}
|
|
107051
107063
|
const payload = parsed.value;
|
|
107052
107064
|
const body = null;
|
|
107053
|
-
const
|
|
107065
|
+
const path14 = pathToFunc("/models")();
|
|
107054
107066
|
const query = encodeFormQuery({
|
|
107055
107067
|
"category": payload?.category,
|
|
107056
107068
|
"supported_parameters": payload?.supported_parameters
|
|
@@ -107075,7 +107087,7 @@ async function $do32(client, request, options) {
|
|
|
107075
107087
|
security: requestSecurity,
|
|
107076
107088
|
method: "GET",
|
|
107077
107089
|
baseURL: options?.serverURL,
|
|
107078
|
-
path:
|
|
107090
|
+
path: path14,
|
|
107079
107091
|
headers,
|
|
107080
107092
|
query,
|
|
107081
107093
|
body,
|
|
@@ -107111,7 +107123,7 @@ function modelsListForUser(client, security, options) {
|
|
|
107111
107123
|
return new APIPromise($do33(client, security, options));
|
|
107112
107124
|
}
|
|
107113
107125
|
async function $do33(client, security, options) {
|
|
107114
|
-
const
|
|
107126
|
+
const path14 = pathToFunc("/models/user")();
|
|
107115
107127
|
const headers = new Headers(compactMap({
|
|
107116
107128
|
Accept: "application/json"
|
|
107117
107129
|
}));
|
|
@@ -107136,7 +107148,7 @@ async function $do33(client, security, options) {
|
|
|
107136
107148
|
security: requestSecurity,
|
|
107137
107149
|
method: "GET",
|
|
107138
107150
|
baseURL: options?.serverURL,
|
|
107139
|
-
path:
|
|
107151
|
+
path: path14,
|
|
107140
107152
|
headers,
|
|
107141
107153
|
userAgent: client._options.userAgent,
|
|
107142
107154
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -107198,7 +107210,7 @@ async function $do34(client, request, options) {
|
|
|
107198
107210
|
}
|
|
107199
107211
|
const payload = parsed.value;
|
|
107200
107212
|
const body = encodeJSON("body", payload, { explode: true });
|
|
107201
|
-
const
|
|
107213
|
+
const path14 = pathToFunc("/auth/keys/code")();
|
|
107202
107214
|
const headers = new Headers(compactMap({
|
|
107203
107215
|
"Content-Type": "application/json",
|
|
107204
107216
|
Accept: "application/json"
|
|
@@ -107220,7 +107232,7 @@ async function $do34(client, request, options) {
|
|
|
107220
107232
|
security: requestSecurity,
|
|
107221
107233
|
method: "POST",
|
|
107222
107234
|
baseURL: options?.serverURL,
|
|
107223
|
-
path:
|
|
107235
|
+
path: path14,
|
|
107224
107236
|
headers,
|
|
107225
107237
|
body,
|
|
107226
107238
|
userAgent: client._options.userAgent,
|
|
@@ -107261,7 +107273,7 @@ async function $do35(client, request, options) {
|
|
|
107261
107273
|
}
|
|
107262
107274
|
const payload = parsed.value;
|
|
107263
107275
|
const body = encodeJSON("body", payload, { explode: true });
|
|
107264
|
-
const
|
|
107276
|
+
const path14 = pathToFunc("/auth/keys")();
|
|
107265
107277
|
const headers = new Headers(compactMap({
|
|
107266
107278
|
"Content-Type": "application/json",
|
|
107267
107279
|
Accept: "application/json"
|
|
@@ -107283,7 +107295,7 @@ async function $do35(client, request, options) {
|
|
|
107283
107295
|
security: requestSecurity,
|
|
107284
107296
|
method: "POST",
|
|
107285
107297
|
baseURL: options?.serverURL,
|
|
107286
|
-
path:
|
|
107298
|
+
path: path14,
|
|
107287
107299
|
headers,
|
|
107288
107300
|
body,
|
|
107289
107301
|
userAgent: client._options.userAgent,
|
|
@@ -107466,7 +107478,7 @@ function providersList(client, options) {
|
|
|
107466
107478
|
return new APIPromise($do36(client, options));
|
|
107467
107479
|
}
|
|
107468
107480
|
async function $do36(client, options) {
|
|
107469
|
-
const
|
|
107481
|
+
const path14 = pathToFunc("/providers")();
|
|
107470
107482
|
const headers = new Headers(compactMap({
|
|
107471
107483
|
Accept: "application/json"
|
|
107472
107484
|
}));
|
|
@@ -107487,7 +107499,7 @@ async function $do36(client, options) {
|
|
|
107487
107499
|
security: requestSecurity,
|
|
107488
107500
|
method: "GET",
|
|
107489
107501
|
baseURL: options?.serverURL,
|
|
107490
|
-
path:
|
|
107502
|
+
path: path14,
|
|
107491
107503
|
headers,
|
|
107492
107504
|
userAgent: client._options.userAgent,
|
|
107493
107505
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -141614,37 +141626,37 @@ function createOpenAI(options = {}) {
|
|
|
141614
141626
|
);
|
|
141615
141627
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
141616
141628
|
provider: `${providerName}.chat`,
|
|
141617
|
-
url: ({ path:
|
|
141629
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141618
141630
|
headers: getHeaders,
|
|
141619
141631
|
fetch: options.fetch
|
|
141620
141632
|
});
|
|
141621
141633
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
141622
141634
|
provider: `${providerName}.completion`,
|
|
141623
|
-
url: ({ path:
|
|
141635
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141624
141636
|
headers: getHeaders,
|
|
141625
141637
|
fetch: options.fetch
|
|
141626
141638
|
});
|
|
141627
141639
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
141628
141640
|
provider: `${providerName}.embedding`,
|
|
141629
|
-
url: ({ path:
|
|
141641
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141630
141642
|
headers: getHeaders,
|
|
141631
141643
|
fetch: options.fetch
|
|
141632
141644
|
});
|
|
141633
141645
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
141634
141646
|
provider: `${providerName}.image`,
|
|
141635
|
-
url: ({ path:
|
|
141647
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141636
141648
|
headers: getHeaders,
|
|
141637
141649
|
fetch: options.fetch
|
|
141638
141650
|
});
|
|
141639
141651
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
141640
141652
|
provider: `${providerName}.transcription`,
|
|
141641
|
-
url: ({ path:
|
|
141653
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141642
141654
|
headers: getHeaders,
|
|
141643
141655
|
fetch: options.fetch
|
|
141644
141656
|
});
|
|
141645
141657
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
141646
141658
|
provider: `${providerName}.speech`,
|
|
141647
|
-
url: ({ path:
|
|
141659
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141648
141660
|
headers: getHeaders,
|
|
141649
141661
|
fetch: options.fetch
|
|
141650
141662
|
});
|
|
@@ -141659,7 +141671,7 @@ function createOpenAI(options = {}) {
|
|
|
141659
141671
|
const createResponsesModel = (modelId) => {
|
|
141660
141672
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
141661
141673
|
provider: `${providerName}.responses`,
|
|
141662
|
-
url: ({ path:
|
|
141674
|
+
url: ({ path: path14 }) => `${baseURL}${path14}`,
|
|
141663
141675
|
headers: getHeaders,
|
|
141664
141676
|
fetch: options.fetch,
|
|
141665
141677
|
fileIdPrefixes: ["file-"]
|
|
@@ -143007,7 +143019,7 @@ ${prompt}` : prompt;
|
|
|
143007
143019
|
}
|
|
143008
143020
|
function createGooseConfig(exaApiKey, mcpServers) {
|
|
143009
143021
|
const configDir = path7.join(os.homedir(), ".config", "goose");
|
|
143010
|
-
const
|
|
143022
|
+
const configPath2 = path7.join(configDir, "config.yaml");
|
|
143011
143023
|
let configContent = `extensions:
|
|
143012
143024
|
extension_name:
|
|
143013
143025
|
bundled: true
|
|
@@ -143056,8 +143068,8 @@ function createGooseConfig(exaApiKey, mcpServers) {
|
|
|
143056
143068
|
if (!fs8.existsSync(configDir)) {
|
|
143057
143069
|
fs8.mkdirSync(configDir, { recursive: true });
|
|
143058
143070
|
}
|
|
143059
|
-
fs8.writeFileSync(
|
|
143060
|
-
log(`Created goose config at ${
|
|
143071
|
+
fs8.writeFileSync(configPath2, configContent, "utf-8");
|
|
143072
|
+
log(`Created goose config at ${configPath2}`);
|
|
143061
143073
|
} catch (error88) {
|
|
143062
143074
|
warn("Error creating goose config:", error88);
|
|
143063
143075
|
}
|
|
@@ -143293,9 +143305,9 @@ function validateSettings(settings) {
|
|
|
143293
143305
|
else if (Array.isArray(v3)) issues = v3;
|
|
143294
143306
|
}
|
|
143295
143307
|
for (const i of issues) {
|
|
143296
|
-
const
|
|
143308
|
+
const path14 = Array.isArray(i?.path) ? i.path.join(".") : "";
|
|
143297
143309
|
const message = i?.message || "Invalid value";
|
|
143298
|
-
errors.push(`${
|
|
143310
|
+
errors.push(`${path14 ? path14 + ": " : ""}${message}`);
|
|
143299
143311
|
}
|
|
143300
143312
|
return { valid: false, warnings, errors };
|
|
143301
143313
|
}
|
|
@@ -145123,6 +145135,10 @@ async function streamCodexToSSE(sessionId, prompt, apiKey, res, options) {
|
|
|
145123
145135
|
// src/agent/goose-session-manager.ts
|
|
145124
145136
|
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
145125
145137
|
var crypto2 = __toESM(require("crypto"), 1);
|
|
145138
|
+
var fs11 = __toESM(require("fs"), 1);
|
|
145139
|
+
var os3 = __toESM(require("os"), 1);
|
|
145140
|
+
var path9 = __toESM(require("path"), 1);
|
|
145141
|
+
var import_child_process5 = require("child_process");
|
|
145126
145142
|
var JWT_SECRET = process.env.JWT_SECRET || crypto2.randomBytes(32).toString("hex");
|
|
145127
145143
|
var TOKEN_EXPIRY = "10m";
|
|
145128
145144
|
var SESSION_INACTIVITY_TTL = 24 * 60 * 60 * 1e3;
|
|
@@ -145130,11 +145146,56 @@ var SESSIONS = /* @__PURE__ */ new Map();
|
|
|
145130
145146
|
function issueToken(sessionId) {
|
|
145131
145147
|
return import_jsonwebtoken.default.sign({ sessionId }, JWT_SECRET, { expiresIn: TOKEN_EXPIRY });
|
|
145132
145148
|
}
|
|
145133
|
-
|
|
145149
|
+
var gooseVersionCache;
|
|
145150
|
+
var gooseVersionResolved = false;
|
|
145151
|
+
function getGooseVersion() {
|
|
145152
|
+
if (gooseVersionResolved) return gooseVersionCache;
|
|
145153
|
+
gooseVersionResolved = true;
|
|
145154
|
+
try {
|
|
145155
|
+
gooseVersionCache = (0, import_child_process5.execSync)("goose --version", { encoding: "utf-8" }).trim().replace(/^goose\s+/i, "");
|
|
145156
|
+
} catch {
|
|
145157
|
+
gooseVersionCache = void 0;
|
|
145158
|
+
}
|
|
145159
|
+
return gooseVersionCache;
|
|
145160
|
+
}
|
|
145161
|
+
var SESSIONS_DIR2 = path9.join(
|
|
145162
|
+
process.env.XDG_DATA_HOME || path9.join(os3.homedir(), ".local", "share"),
|
|
145163
|
+
"goose",
|
|
145164
|
+
"sessions"
|
|
145165
|
+
);
|
|
145166
|
+
function configPath(sessionId) {
|
|
145167
|
+
const safe = sessionId.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
145168
|
+
return path9.join(SESSIONS_DIR2, `${safe}.config.json`);
|
|
145169
|
+
}
|
|
145170
|
+
function toPublic(session) {
|
|
145171
|
+
const { apiKey: _a26, summaryApiKey: _s, searchApiKey: _k, ...safe } = session;
|
|
145172
|
+
return safe;
|
|
145173
|
+
}
|
|
145174
|
+
function persistConfig(session) {
|
|
145175
|
+
try {
|
|
145176
|
+
fs11.mkdirSync(SESSIONS_DIR2, { recursive: true });
|
|
145177
|
+
fs11.writeFileSync(
|
|
145178
|
+
configPath(session.sessionId),
|
|
145179
|
+
JSON.stringify(toPublic(session)),
|
|
145180
|
+
"utf-8"
|
|
145181
|
+
);
|
|
145182
|
+
} catch {
|
|
145183
|
+
}
|
|
145184
|
+
}
|
|
145185
|
+
function readPersistedConfig(sessionId) {
|
|
145186
|
+
try {
|
|
145187
|
+
const raw = fs11.readFileSync(configPath(sessionId), "utf-8");
|
|
145188
|
+
return JSON.parse(raw);
|
|
145189
|
+
} catch {
|
|
145190
|
+
return null;
|
|
145191
|
+
}
|
|
145192
|
+
}
|
|
145193
|
+
function createSession(sessionId, webhookUrl, apiKey, searchApiKey, model, agent, system, temperature, jsonMode, summaryApiKey, mcpServers, baseUrl, headers, repoName, _metadata) {
|
|
145134
145194
|
const now2 = Date.now();
|
|
145135
145195
|
const existing = SESSIONS.get(sessionId);
|
|
145136
145196
|
if (existing) {
|
|
145137
145197
|
existing.lastActivity = now2;
|
|
145198
|
+
existing.gooseVersion = getGooseVersion();
|
|
145138
145199
|
if (webhookUrl !== void 0) existing.webhookUrl = webhookUrl;
|
|
145139
145200
|
if (apiKey !== void 0) existing.apiKey = apiKey;
|
|
145140
145201
|
if (searchApiKey !== void 0) existing.searchApiKey = searchApiKey;
|
|
@@ -145148,12 +145209,15 @@ function createSession(sessionId, webhookUrl, apiKey, searchApiKey, model, agent
|
|
|
145148
145209
|
if (baseUrl !== void 0) existing.baseUrl = baseUrl;
|
|
145149
145210
|
if (headers !== void 0) existing.headers = headers;
|
|
145150
145211
|
if (repoName !== void 0) existing.repoName = repoName;
|
|
145212
|
+
if (_metadata !== void 0) existing._metadata = _metadata;
|
|
145213
|
+
persistConfig(existing);
|
|
145151
145214
|
return { token: issueToken(sessionId), created: false };
|
|
145152
145215
|
}
|
|
145153
|
-
|
|
145216
|
+
const created = {
|
|
145154
145217
|
sessionId,
|
|
145155
145218
|
createdAt: now2,
|
|
145156
145219
|
lastActivity: now2,
|
|
145220
|
+
gooseVersion: getGooseVersion(),
|
|
145157
145221
|
webhookUrl,
|
|
145158
145222
|
apiKey,
|
|
145159
145223
|
searchApiKey,
|
|
@@ -145166,10 +145230,18 @@ function createSession(sessionId, webhookUrl, apiKey, searchApiKey, model, agent
|
|
|
145166
145230
|
mcpServers,
|
|
145167
145231
|
baseUrl,
|
|
145168
145232
|
headers,
|
|
145169
|
-
repoName
|
|
145170
|
-
|
|
145233
|
+
repoName,
|
|
145234
|
+
_metadata
|
|
145235
|
+
};
|
|
145236
|
+
SESSIONS.set(sessionId, created);
|
|
145237
|
+
persistConfig(created);
|
|
145171
145238
|
return { token: issueToken(sessionId), created: true };
|
|
145172
145239
|
}
|
|
145240
|
+
function getSession(sessionId) {
|
|
145241
|
+
const session = SESSIONS.get(sessionId);
|
|
145242
|
+
if (session) return toPublic(session);
|
|
145243
|
+
return readPersistedConfig(sessionId);
|
|
145244
|
+
}
|
|
145173
145245
|
function validateAndGetSession(sessionId, token) {
|
|
145174
145246
|
try {
|
|
145175
145247
|
const decoded = import_jsonwebtoken.default.verify(token, JWT_SECRET);
|
|
@@ -145290,7 +145362,7 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
145290
145362
|
return async (req, res) => {
|
|
145291
145363
|
const request_id = startReq();
|
|
145292
145364
|
try {
|
|
145293
|
-
const { repoName, apiKey, agent_name, session, summarize, model, searchApiKey, summaryApiKey, mcpServers, baseUrl, headers } = req.body;
|
|
145365
|
+
const { repoName, apiKey, agent_name, session, summarize, model, searchApiKey, summaryApiKey, mcpServers, baseUrl, headers, _metadata } = req.body;
|
|
145294
145366
|
const params = getParams(req);
|
|
145295
145367
|
const workspaceRoot2 = await workspaceRoot();
|
|
145296
145368
|
let repoPath = workspaceRoot2;
|
|
@@ -145305,6 +145377,28 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
145305
145377
|
}
|
|
145306
145378
|
}
|
|
145307
145379
|
const agentFn = chooseAgent(agent_name || "goose");
|
|
145380
|
+
if (session) {
|
|
145381
|
+
createSession(
|
|
145382
|
+
session,
|
|
145383
|
+
void 0,
|
|
145384
|
+
// webhookUrl
|
|
145385
|
+
apiKey,
|
|
145386
|
+
searchApiKey,
|
|
145387
|
+
model,
|
|
145388
|
+
agent_name,
|
|
145389
|
+
params.system,
|
|
145390
|
+
void 0,
|
|
145391
|
+
// temperature
|
|
145392
|
+
void 0,
|
|
145393
|
+
// jsonMode
|
|
145394
|
+
summaryApiKey,
|
|
145395
|
+
mcpServers,
|
|
145396
|
+
baseUrl,
|
|
145397
|
+
headers,
|
|
145398
|
+
repoName,
|
|
145399
|
+
_metadata
|
|
145400
|
+
);
|
|
145401
|
+
}
|
|
145308
145402
|
const defaultApiKey = agent_name === "codex" ? process.env.OPENAI_API_KEY || "" : process.env.ANTHROPIC_API_KEY || "";
|
|
145309
145403
|
const startTime = Date.now();
|
|
145310
145404
|
agentFn({
|
|
@@ -145354,12 +145448,12 @@ var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
|
145354
145448
|
var import_fs5 = require("fs");
|
|
145355
145449
|
|
|
145356
145450
|
// src/proxy/gitleaks.ts
|
|
145357
|
-
var
|
|
145451
|
+
var import_child_process6 = require("child_process");
|
|
145358
145452
|
var CMD_END = "--no-banner --no-color --log-level=fatal --report-format=json --report-path=-";
|
|
145359
145453
|
function gitleaksDetect() {
|
|
145360
145454
|
const cmd = "gitleaks detect " + CMD_END;
|
|
145361
145455
|
try {
|
|
145362
|
-
const result = (0,
|
|
145456
|
+
const result = (0, import_child_process6.execSync)(cmd, { encoding: "utf-8" });
|
|
145363
145457
|
return JSON.parse(result);
|
|
145364
145458
|
} catch (error88) {
|
|
145365
145459
|
if (error88.status === 1 && error88.stdout) {
|
|
@@ -145371,7 +145465,7 @@ function gitleaksDetect() {
|
|
|
145371
145465
|
function gitleaksProtect() {
|
|
145372
145466
|
const cmd = "gitleaks protect " + CMD_END;
|
|
145373
145467
|
try {
|
|
145374
|
-
const result = (0,
|
|
145468
|
+
const result = (0, import_child_process6.execSync)(cmd, { encoding: "utf-8" });
|
|
145375
145469
|
return JSON.parse(result);
|
|
145376
145470
|
} catch (error88) {
|
|
145377
145471
|
if (error88.status === 1 && error88.stdout) {
|
|
@@ -145382,8 +145476,8 @@ function gitleaksProtect() {
|
|
|
145382
145476
|
}
|
|
145383
145477
|
|
|
145384
145478
|
// src/proxy/playwright.ts
|
|
145385
|
-
var
|
|
145386
|
-
var
|
|
145479
|
+
var fs13 = __toESM(require("fs/promises"), 1);
|
|
145480
|
+
var path11 = __toESM(require("path"), 1);
|
|
145387
145481
|
var DEFAULT_CONFIG = `import { defineConfig } from "@playwright/test";
|
|
145388
145482
|
export default defineConfig({
|
|
145389
145483
|
timeout: 60000,
|
|
@@ -145569,7 +145663,7 @@ export default TimestampReporter;
|
|
|
145569
145663
|
`;
|
|
145570
145664
|
async function findRepositoryLocation(repoName) {
|
|
145571
145665
|
const currentDir = process.cwd();
|
|
145572
|
-
const currentDirName =
|
|
145666
|
+
const currentDirName = path11.basename(currentDir);
|
|
145573
145667
|
if (currentDirName === repoName) {
|
|
145574
145668
|
return currentDir;
|
|
145575
145669
|
}
|
|
@@ -145582,15 +145676,15 @@ async function findRepositoryLocation(repoName) {
|
|
|
145582
145676
|
async function verifyTestFileExists(repoLocation, testFilePath) {
|
|
145583
145677
|
if (testFilePath.startsWith("/")) {
|
|
145584
145678
|
try {
|
|
145585
|
-
await
|
|
145679
|
+
await fs13.access(testFilePath);
|
|
145586
145680
|
return testFilePath;
|
|
145587
145681
|
} catch {
|
|
145588
145682
|
throw new Error(`Test file not found: ${testFilePath}`);
|
|
145589
145683
|
}
|
|
145590
145684
|
}
|
|
145591
|
-
const testFullPath =
|
|
145685
|
+
const testFullPath = path11.join(repoLocation, testFilePath);
|
|
145592
145686
|
try {
|
|
145593
|
-
await
|
|
145687
|
+
await fs13.access(testFullPath);
|
|
145594
145688
|
return testFullPath;
|
|
145595
145689
|
} catch {
|
|
145596
145690
|
throw new Error(`Test file not found: ${testFilePath}`);
|
|
@@ -145603,9 +145697,9 @@ async function findPlaywrightConfig(repoLocation) {
|
|
|
145603
145697
|
"playwright.config.mjs"
|
|
145604
145698
|
];
|
|
145605
145699
|
for (const configFile of configFiles) {
|
|
145606
|
-
const fullConfigPath =
|
|
145700
|
+
const fullConfigPath = path11.join(repoLocation, configFile);
|
|
145607
145701
|
try {
|
|
145608
|
-
await
|
|
145702
|
+
await fs13.access(fullConfigPath);
|
|
145609
145703
|
return fullConfigPath;
|
|
145610
145704
|
} catch {
|
|
145611
145705
|
}
|
|
@@ -145613,29 +145707,29 @@ async function findPlaywrightConfig(repoLocation) {
|
|
|
145613
145707
|
return null;
|
|
145614
145708
|
}
|
|
145615
145709
|
async function createPlaywrightConfig(repoLocation) {
|
|
145616
|
-
const
|
|
145617
|
-
await
|
|
145618
|
-
log(`Created playwright config at ${
|
|
145619
|
-
return
|
|
145710
|
+
const configPath2 = path11.join(repoLocation, "playwright.config.ts");
|
|
145711
|
+
await fs13.writeFile(configPath2, DEFAULT_CONFIG);
|
|
145712
|
+
log(`Created playwright config at ${configPath2}`);
|
|
145713
|
+
return configPath2;
|
|
145620
145714
|
}
|
|
145621
145715
|
async function createTimestampReporter(repoLocation) {
|
|
145622
|
-
const reporterPath =
|
|
145623
|
-
await
|
|
145716
|
+
const reporterPath = path11.join(repoLocation, "timestamp-reporter.ts");
|
|
145717
|
+
await fs13.writeFile(reporterPath, TIMESTAMP_REPORTER_CODE);
|
|
145624
145718
|
log(`Created timestamp reporter at ${reporterPath}`);
|
|
145625
145719
|
return reporterPath;
|
|
145626
145720
|
}
|
|
145627
145721
|
async function setupPlaywrightConfig(repoLocation) {
|
|
145628
|
-
let
|
|
145722
|
+
let configPath2 = await findPlaywrightConfig(repoLocation);
|
|
145629
145723
|
let wasCreated = false;
|
|
145630
145724
|
let originalContent = null;
|
|
145631
145725
|
let wasModified = false;
|
|
145632
145726
|
const reporterPath = await createTimestampReporter(repoLocation);
|
|
145633
|
-
if (!
|
|
145634
|
-
|
|
145727
|
+
if (!configPath2) {
|
|
145728
|
+
configPath2 = await createPlaywrightConfig(repoLocation);
|
|
145635
145729
|
wasCreated = true;
|
|
145636
145730
|
log("Created new playwright config");
|
|
145637
145731
|
} else {
|
|
145638
|
-
originalContent = await
|
|
145732
|
+
originalContent = await fs13.readFile(configPath2, "utf-8");
|
|
145639
145733
|
wasModified = true;
|
|
145640
145734
|
const newConfig = `import { defineConfig } from "@playwright/test";
|
|
145641
145735
|
|
|
@@ -145655,13 +145749,13 @@ export default defineConfig({
|
|
|
145655
145749
|
},
|
|
145656
145750
|
});
|
|
145657
145751
|
`;
|
|
145658
|
-
await
|
|
145752
|
+
await fs13.writeFile(configPath2, newConfig);
|
|
145659
145753
|
log(
|
|
145660
|
-
`Overwrote existing config at ${
|
|
145754
|
+
`Overwrote existing config at ${configPath2} (backed up for cleanup)`
|
|
145661
145755
|
);
|
|
145662
145756
|
}
|
|
145663
145757
|
return {
|
|
145664
|
-
configPath,
|
|
145758
|
+
configPath: configPath2,
|
|
145665
145759
|
wasCreated,
|
|
145666
145760
|
originalContent,
|
|
145667
145761
|
wasModified,
|
|
@@ -145670,10 +145764,10 @@ export default defineConfig({
|
|
|
145670
145764
|
};
|
|
145671
145765
|
}
|
|
145672
145766
|
async function ensureTestResultsInGitignore(repoLocation) {
|
|
145673
|
-
const gitignorePath =
|
|
145767
|
+
const gitignorePath = path11.join(repoLocation, ".gitignore");
|
|
145674
145768
|
const testResultsEntry = "test-results";
|
|
145675
145769
|
try {
|
|
145676
|
-
const gitignoreContent = await
|
|
145770
|
+
const gitignoreContent = await fs13.readFile(gitignorePath, "utf-8");
|
|
145677
145771
|
const lines = gitignoreContent.split("\n");
|
|
145678
145772
|
const hasTestResults = lines.some(
|
|
145679
145773
|
(line) => line.trim() === testResultsEntry
|
|
@@ -145686,10 +145780,10 @@ async function ensureTestResultsInGitignore(repoLocation) {
|
|
|
145686
145780
|
` : `${gitignoreContent}
|
|
145687
145781
|
${testResultsEntry}
|
|
145688
145782
|
`;
|
|
145689
|
-
await
|
|
145783
|
+
await fs13.writeFile(gitignorePath, updatedContent);
|
|
145690
145784
|
log("Added test-results to .gitignore");
|
|
145691
145785
|
} catch (error88) {
|
|
145692
|
-
await
|
|
145786
|
+
await fs13.writeFile(gitignorePath, `${testResultsEntry}
|
|
145693
145787
|
`);
|
|
145694
145788
|
log("Created .gitignore with test-results");
|
|
145695
145789
|
}
|
|
@@ -145711,13 +145805,13 @@ async function runPlaywrightTest(repoLocation, testFilePath) {
|
|
|
145711
145805
|
}
|
|
145712
145806
|
}
|
|
145713
145807
|
async function findVideoFile(repoLocation) {
|
|
145714
|
-
const testResultsDir =
|
|
145808
|
+
const testResultsDir = path11.join(repoLocation, "test-results");
|
|
145715
145809
|
const walkDir = async (dir) => {
|
|
145716
145810
|
try {
|
|
145717
|
-
const files = await
|
|
145811
|
+
const files = await fs13.readdir(dir);
|
|
145718
145812
|
for (const file3 of files) {
|
|
145719
|
-
const fullPath =
|
|
145720
|
-
const stat4 = await
|
|
145813
|
+
const fullPath = path11.join(dir, file3);
|
|
145814
|
+
const stat4 = await fs13.stat(fullPath);
|
|
145721
145815
|
if (stat4.isDirectory()) {
|
|
145722
145816
|
const result = await walkDir(fullPath);
|
|
145723
145817
|
if (result) {
|
|
@@ -145740,13 +145834,13 @@ async function findVideoFile(repoLocation) {
|
|
|
145740
145834
|
return videoPath;
|
|
145741
145835
|
}
|
|
145742
145836
|
async function findTimestampJsonFile(repoLocation) {
|
|
145743
|
-
const testResultsDir =
|
|
145837
|
+
const testResultsDir = path11.join(repoLocation, "test-results");
|
|
145744
145838
|
const walkDir = async (dir) => {
|
|
145745
145839
|
try {
|
|
145746
|
-
const files = await
|
|
145840
|
+
const files = await fs13.readdir(dir);
|
|
145747
145841
|
for (const file3 of files) {
|
|
145748
|
-
const fullPath =
|
|
145749
|
-
const stat4 = await
|
|
145842
|
+
const fullPath = path11.join(dir, file3);
|
|
145843
|
+
const stat4 = await fs13.stat(fullPath);
|
|
145750
145844
|
if (stat4.isDirectory()) {
|
|
145751
145845
|
const result = await walkDir(fullPath);
|
|
145752
145846
|
if (result) {
|
|
@@ -145769,18 +145863,18 @@ async function findTimestampJsonFile(repoLocation) {
|
|
|
145769
145863
|
return jsonPath;
|
|
145770
145864
|
}
|
|
145771
145865
|
async function uploadVideo(videoPath, timestampJsonPath, responseUrl, apiKey) {
|
|
145772
|
-
const videoBuffer = await
|
|
145866
|
+
const videoBuffer = await fs13.readFile(videoPath);
|
|
145773
145867
|
log(`Read video file: ${videoBuffer.length} bytes`);
|
|
145774
|
-
const jsonBuffer = await
|
|
145868
|
+
const jsonBuffer = await fs13.readFile(timestampJsonPath);
|
|
145775
145869
|
log(`Read timestamp JSON file: ${jsonBuffer.length} bytes`);
|
|
145776
145870
|
const { FormData: FormData2, fetch: undiciFetch } = await Promise.resolve().then(() => __toESM(require_undici(), 1));
|
|
145777
145871
|
const formData = new FormData2();
|
|
145778
|
-
const videoFile = new File([videoBuffer],
|
|
145872
|
+
const videoFile = new File([videoBuffer], path11.basename(videoPath), {
|
|
145779
145873
|
type: "video/webm"
|
|
145780
145874
|
});
|
|
145781
145875
|
const timestampsFile = new File(
|
|
145782
145876
|
[jsonBuffer],
|
|
145783
|
-
|
|
145877
|
+
path11.basename(timestampJsonPath),
|
|
145784
145878
|
{
|
|
145785
145879
|
type: "application/json"
|
|
145786
145880
|
}
|
|
@@ -145806,13 +145900,13 @@ async function uploadVideo(videoPath, timestampJsonPath, responseUrl, apiKey) {
|
|
|
145806
145900
|
}
|
|
145807
145901
|
async function deleteTestFiles(videoPath, timestampJsonPath) {
|
|
145808
145902
|
try {
|
|
145809
|
-
await
|
|
145903
|
+
await fs13.unlink(videoPath);
|
|
145810
145904
|
log(`Deleted video file: ${videoPath}`);
|
|
145811
145905
|
} catch (error88) {
|
|
145812
145906
|
error(`Error deleting video file ${videoPath}:`, error88);
|
|
145813
145907
|
}
|
|
145814
145908
|
try {
|
|
145815
|
-
await
|
|
145909
|
+
await fs13.unlink(timestampJsonPath);
|
|
145816
145910
|
log(`Deleted timestamp JSON: ${timestampJsonPath}`);
|
|
145817
145911
|
} catch (error88) {
|
|
145818
145912
|
error(`Error deleting timestamp JSON ${timestampJsonPath}:`, error88);
|
|
@@ -145822,10 +145916,10 @@ async function cleanupConfig(configState) {
|
|
|
145822
145916
|
if (configState.configPath) {
|
|
145823
145917
|
try {
|
|
145824
145918
|
if (configState.wasCreated) {
|
|
145825
|
-
await
|
|
145919
|
+
await fs13.unlink(configState.configPath);
|
|
145826
145920
|
log(`Cleaned up created config file: ${configState.configPath}`);
|
|
145827
145921
|
} else if (configState.wasModified && configState.originalContent) {
|
|
145828
|
-
await
|
|
145922
|
+
await fs13.writeFile(configState.configPath, configState.originalContent);
|
|
145829
145923
|
log(`Restored original config: ${configState.configPath}`);
|
|
145830
145924
|
}
|
|
145831
145925
|
} catch (error88) {
|
|
@@ -145834,7 +145928,7 @@ async function cleanupConfig(configState) {
|
|
|
145834
145928
|
}
|
|
145835
145929
|
if (configState.reporterPath && configState.reporterWasCreated) {
|
|
145836
145930
|
try {
|
|
145837
|
-
await
|
|
145931
|
+
await fs13.unlink(configState.reporterPath);
|
|
145838
145932
|
log(`Cleaned up reporter file: ${configState.reporterPath}`);
|
|
145839
145933
|
} catch (error88) {
|
|
145840
145934
|
error("Error cleaning up reporter:", error88);
|
|
@@ -145922,12 +146016,12 @@ async function takeScreenshot(port) {
|
|
|
145922
146016
|
// src/proxy/git_actions.ts
|
|
145923
146017
|
var import_path4 = __toESM(require("path"), 1);
|
|
145924
146018
|
var import_fs4 = __toESM(require("fs"), 1);
|
|
145925
|
-
var
|
|
146019
|
+
var import_child_process8 = require("child_process");
|
|
145926
146020
|
|
|
145927
146021
|
// src/proxy/gh.ts
|
|
145928
|
-
var
|
|
146022
|
+
var import_child_process7 = require("child_process");
|
|
145929
146023
|
var import_util13 = require("util");
|
|
145930
|
-
var execAsync = (0, import_util13.promisify)(
|
|
146024
|
+
var execAsync = (0, import_util13.promisify)(import_child_process7.exec);
|
|
145931
146025
|
function sanitizeGitHubText(text3) {
|
|
145932
146026
|
return text3.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
145933
146027
|
}
|
|
@@ -145982,7 +146076,7 @@ Stderr: ${error88.stderr}`
|
|
|
145982
146076
|
execGHSync(command) {
|
|
145983
146077
|
const fullCommand = `gh ${command}`;
|
|
145984
146078
|
try {
|
|
145985
|
-
return (0,
|
|
146079
|
+
return (0, import_child_process7.execSync)(fullCommand, {
|
|
145986
146080
|
cwd: this.cwd,
|
|
145987
146081
|
encoding: "utf-8",
|
|
145988
146082
|
env: {
|
|
@@ -146995,9 +147089,9 @@ async function handleCreateRepo(req, res) {
|
|
|
146995
147089
|
}
|
|
146996
147090
|
if (!import_fs4.default.existsSync(import_path4.default.join(sourceDir, ".git"))) {
|
|
146997
147091
|
log(`=> Initializing git repository in ${sourceDir}`);
|
|
146998
|
-
(0,
|
|
146999
|
-
(0,
|
|
147000
|
-
(0,
|
|
147092
|
+
(0, import_child_process8.execSync)("git init", { cwd: sourceDir });
|
|
147093
|
+
(0, import_child_process8.execSync)("git add -A", { cwd: sourceDir });
|
|
147094
|
+
(0, import_child_process8.execSync)('git commit -m "Initial commit"', { cwd: sourceDir });
|
|
147001
147095
|
}
|
|
147002
147096
|
const gh = new GitHubCLI(body.token, "main", sourceDir);
|
|
147003
147097
|
const { repoUrl } = await gh.createRepository({
|
|
@@ -147189,8 +147283,8 @@ ${prompt}`);
|
|
|
147189
147283
|
}
|
|
147190
147284
|
|
|
147191
147285
|
// src/proxy/code_actions.ts
|
|
147192
|
-
var
|
|
147193
|
-
var
|
|
147286
|
+
var fs15 = __toESM(require("fs/promises"), 1);
|
|
147287
|
+
var path13 = __toESM(require("path"), 1);
|
|
147194
147288
|
async function processCode(code) {
|
|
147195
147289
|
const results = [];
|
|
147196
147290
|
const workspaceHasOneRepo = await hasOnlyOneRepo();
|
|
@@ -147264,24 +147358,24 @@ async function applyFileAction(file3, filePath) {
|
|
|
147264
147358
|
}
|
|
147265
147359
|
async function createFile(filePath, content) {
|
|
147266
147360
|
try {
|
|
147267
|
-
await
|
|
147361
|
+
await fs15.stat(filePath);
|
|
147268
147362
|
throw new Error(`File ${filePath} already exists`);
|
|
147269
147363
|
} catch (e) {
|
|
147270
147364
|
if (e.code !== "ENOENT") {
|
|
147271
147365
|
throw e;
|
|
147272
147366
|
}
|
|
147273
147367
|
}
|
|
147274
|
-
const dirPath =
|
|
147368
|
+
const dirPath = path13.dirname(filePath);
|
|
147275
147369
|
try {
|
|
147276
|
-
await
|
|
147370
|
+
await fs15.mkdir(dirPath, { recursive: true });
|
|
147277
147371
|
} catch (e) {
|
|
147278
147372
|
}
|
|
147279
|
-
await
|
|
147373
|
+
await fs15.writeFile(filePath, content, "utf8");
|
|
147280
147374
|
}
|
|
147281
147375
|
async function rewriteFile(filePath, content) {
|
|
147282
147376
|
try {
|
|
147283
|
-
await
|
|
147284
|
-
await
|
|
147377
|
+
await fs15.stat(filePath);
|
|
147378
|
+
await fs15.writeFile(filePath, content, "utf8");
|
|
147285
147379
|
} catch (e) {
|
|
147286
147380
|
if (e.code === "ENOENT") {
|
|
147287
147381
|
await createFile(filePath, content);
|
|
@@ -147292,7 +147386,7 @@ async function rewriteFile(filePath, content) {
|
|
|
147292
147386
|
}
|
|
147293
147387
|
async function modifyFile(filePath, changes) {
|
|
147294
147388
|
try {
|
|
147295
|
-
const originalContent = await
|
|
147389
|
+
const originalContent = await fs15.readFile(filePath, "utf8");
|
|
147296
147390
|
let newContent = originalContent.replace(/\r\n/g, "\n");
|
|
147297
147391
|
const finalChange = changes[changes.length - 1];
|
|
147298
147392
|
if (finalChange && finalChange.search) {
|
|
@@ -147317,7 +147411,7 @@ async function modifyFile(filePath, changes) {
|
|
|
147317
147411
|
}
|
|
147318
147412
|
}
|
|
147319
147413
|
if (originalContent !== newContent) {
|
|
147320
|
-
await
|
|
147414
|
+
await fs15.writeFile(filePath, newContent, "utf8");
|
|
147321
147415
|
} else {
|
|
147322
147416
|
log(`=> NO CHANGES to file ${filePath}`);
|
|
147323
147417
|
}
|
|
@@ -147326,7 +147420,7 @@ async function modifyFile(filePath, changes) {
|
|
|
147326
147420
|
}
|
|
147327
147421
|
}
|
|
147328
147422
|
async function deleteFile(filePath) {
|
|
147329
|
-
await
|
|
147423
|
+
await fs15.unlink(filePath);
|
|
147330
147424
|
}
|
|
147331
147425
|
|
|
147332
147426
|
// src/proxy/server.ts
|
|
@@ -147956,14 +148050,46 @@ async function startProxyServer() {
|
|
|
147956
148050
|
});
|
|
147957
148051
|
app.use(requireAuth);
|
|
147958
148052
|
app.post("/session", async (req, res) => {
|
|
147959
|
-
const {
|
|
148053
|
+
const {
|
|
148054
|
+
sessionId,
|
|
148055
|
+
webhookUrl,
|
|
148056
|
+
apiKey,
|
|
148057
|
+
searchApiKey,
|
|
148058
|
+
model,
|
|
148059
|
+
agent,
|
|
148060
|
+
system,
|
|
148061
|
+
temperature,
|
|
148062
|
+
jsonMode,
|
|
148063
|
+
summaryApiKey,
|
|
148064
|
+
mcpServers,
|
|
148065
|
+
baseUrl,
|
|
148066
|
+
headers,
|
|
148067
|
+
repoName,
|
|
148068
|
+
_metadata
|
|
148069
|
+
} = req.body;
|
|
147960
148070
|
if (!sessionId) {
|
|
147961
148071
|
res.status(400).json({
|
|
147962
148072
|
error: "Missing required fields: sessionId, webhookUrl"
|
|
147963
148073
|
});
|
|
147964
148074
|
return;
|
|
147965
148075
|
}
|
|
147966
|
-
const { token, created } = createSession(
|
|
148076
|
+
const { token, created } = createSession(
|
|
148077
|
+
sessionId,
|
|
148078
|
+
webhookUrl,
|
|
148079
|
+
apiKey,
|
|
148080
|
+
searchApiKey,
|
|
148081
|
+
model,
|
|
148082
|
+
agent,
|
|
148083
|
+
system,
|
|
148084
|
+
temperature,
|
|
148085
|
+
jsonMode,
|
|
148086
|
+
summaryApiKey,
|
|
148087
|
+
mcpServers,
|
|
148088
|
+
baseUrl,
|
|
148089
|
+
headers,
|
|
148090
|
+
repoName,
|
|
148091
|
+
_metadata
|
|
148092
|
+
);
|
|
147967
148093
|
res.json({
|
|
147968
148094
|
sessionId,
|
|
147969
148095
|
token,
|
|
@@ -147994,7 +148120,14 @@ async function startProxyServer() {
|
|
|
147994
148120
|
}
|
|
147995
148121
|
try {
|
|
147996
148122
|
const messages = exportSession(sessionId, "assistant");
|
|
147997
|
-
|
|
148123
|
+
const session = getSession(sessionId);
|
|
148124
|
+
const { _metadata = null, ...config3 } = session ?? {};
|
|
148125
|
+
res.json({
|
|
148126
|
+
success: true,
|
|
148127
|
+
messages,
|
|
148128
|
+
config: session ? config3 : null,
|
|
148129
|
+
_metadata
|
|
148130
|
+
});
|
|
147998
148131
|
} catch (error88) {
|
|
147999
148132
|
error("Error exporting session:", error88);
|
|
148000
148133
|
res.status(404).json({
|