@lark-apaas/fullstack-nestjs-core 1.1.59 → 1.1.60-alpha.20260824095125
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/index.cjs +325 -221
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +324 -221
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1371,8 +1371,8 @@ var require_node = __commonJS({
|
|
|
1371
1371
|
}
|
|
1372
1372
|
break;
|
|
1373
1373
|
case "FILE":
|
|
1374
|
-
var
|
|
1375
|
-
stream2 = new
|
|
1374
|
+
var fs4 = require("fs");
|
|
1375
|
+
stream2 = new fs4.SyncWriteStream(fd2, {
|
|
1376
1376
|
autoClose: false
|
|
1377
1377
|
});
|
|
1378
1378
|
stream2._type = "fs";
|
|
@@ -5028,10 +5028,10 @@ var require_raw_body = __commonJS({
|
|
|
5028
5028
|
if (done) {
|
|
5029
5029
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
5030
5030
|
}
|
|
5031
|
-
return new Promise(/* @__PURE__ */ __name(function executor(
|
|
5031
|
+
return new Promise(/* @__PURE__ */ __name(function executor(resolve3, reject) {
|
|
5032
5032
|
readStream(stream, encoding, length, limit, /* @__PURE__ */ __name(function onRead(err, buf) {
|
|
5033
5033
|
if (err) return reject(err);
|
|
5034
|
-
|
|
5034
|
+
resolve3(buf);
|
|
5035
5035
|
}, "onRead"));
|
|
5036
5036
|
}, "executor"));
|
|
5037
5037
|
}
|
|
@@ -14160,7 +14160,7 @@ var require_mime_types = __commonJS({
|
|
|
14160
14160
|
"../../../node_modules/type-is/node_modules/mime-types/index.js"(exports2) {
|
|
14161
14161
|
"use strict";
|
|
14162
14162
|
var db = require_mime_db();
|
|
14163
|
-
var
|
|
14163
|
+
var extname3 = require("path").extname;
|
|
14164
14164
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
14165
14165
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
14166
14166
|
exports2.charset = charset;
|
|
@@ -14215,11 +14215,11 @@ var require_mime_types = __commonJS({
|
|
|
14215
14215
|
return exts[0];
|
|
14216
14216
|
}
|
|
14217
14217
|
__name(extension, "extension");
|
|
14218
|
-
function lookup(
|
|
14219
|
-
if (!
|
|
14218
|
+
function lookup(path3) {
|
|
14219
|
+
if (!path3 || typeof path3 !== "string") {
|
|
14220
14220
|
return false;
|
|
14221
14221
|
}
|
|
14222
|
-
var extension2 =
|
|
14222
|
+
var extension2 = extname3("x." + path3).toLowerCase().substr(1);
|
|
14223
14223
|
if (!extension2) {
|
|
14224
14224
|
return false;
|
|
14225
14225
|
}
|
|
@@ -14266,7 +14266,7 @@ var require_type_is = __commonJS({
|
|
|
14266
14266
|
module2.exports = typeofrequest;
|
|
14267
14267
|
module2.exports.is = typeis;
|
|
14268
14268
|
module2.exports.hasBody = hasbody;
|
|
14269
|
-
module2.exports.normalize =
|
|
14269
|
+
module2.exports.normalize = normalize3;
|
|
14270
14270
|
module2.exports.match = mimeMatch;
|
|
14271
14271
|
function typeis(value, types_) {
|
|
14272
14272
|
var i;
|
|
@@ -14286,7 +14286,7 @@ var require_type_is = __commonJS({
|
|
|
14286
14286
|
}
|
|
14287
14287
|
var type;
|
|
14288
14288
|
for (i = 0; i < types.length; i++) {
|
|
14289
|
-
if (mimeMatch(
|
|
14289
|
+
if (mimeMatch(normalize3(type = types[i]), val)) {
|
|
14290
14290
|
return type[0] === "+" || type.indexOf("*") !== -1 ? val : type;
|
|
14291
14291
|
}
|
|
14292
14292
|
}
|
|
@@ -14312,7 +14312,7 @@ var require_type_is = __commonJS({
|
|
|
14312
14312
|
return typeis(value, types);
|
|
14313
14313
|
}
|
|
14314
14314
|
__name(typeofrequest, "typeofrequest");
|
|
14315
|
-
function
|
|
14315
|
+
function normalize3(type) {
|
|
14316
14316
|
if (typeof type !== "string") {
|
|
14317
14317
|
return false;
|
|
14318
14318
|
}
|
|
@@ -14327,7 +14327,7 @@ var require_type_is = __commonJS({
|
|
|
14327
14327
|
}
|
|
14328
14328
|
return type.indexOf("/") === -1 ? mime.lookup(type) : type;
|
|
14329
14329
|
}
|
|
14330
|
-
__name(
|
|
14330
|
+
__name(normalize3, "normalize");
|
|
14331
14331
|
function mimeMatch(expected, actual) {
|
|
14332
14332
|
if (expected === false) {
|
|
14333
14333
|
return false;
|
|
@@ -18069,8 +18069,8 @@ var require_node2 = __commonJS({
|
|
|
18069
18069
|
}
|
|
18070
18070
|
break;
|
|
18071
18071
|
case "FILE":
|
|
18072
|
-
var
|
|
18073
|
-
stream2 = new
|
|
18072
|
+
var fs4 = require("fs");
|
|
18073
|
+
stream2 = new fs4.SyncWriteStream(fd2, {
|
|
18074
18074
|
autoClose: false
|
|
18075
18075
|
});
|
|
18076
18076
|
stream2._type = "fs";
|
|
@@ -18839,8 +18839,8 @@ var require_node3 = __commonJS({
|
|
|
18839
18839
|
}
|
|
18840
18840
|
break;
|
|
18841
18841
|
case "FILE":
|
|
18842
|
-
var
|
|
18843
|
-
stream2 = new
|
|
18842
|
+
var fs4 = require("fs");
|
|
18843
|
+
stream2 = new fs4.SyncWriteStream(fd2, {
|
|
18844
18844
|
autoClose: false
|
|
18845
18845
|
});
|
|
18846
18846
|
stream2._type = "fs";
|
|
@@ -18937,7 +18937,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18937
18937
|
"use strict";
|
|
18938
18938
|
module2.exports = pathToRegexp;
|
|
18939
18939
|
var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
|
|
18940
|
-
function pathToRegexp(
|
|
18940
|
+
function pathToRegexp(path3, keys, options) {
|
|
18941
18941
|
options = options || {};
|
|
18942
18942
|
keys = keys || [];
|
|
18943
18943
|
var strict = options.strict;
|
|
@@ -18951,8 +18951,8 @@ var require_path_to_regexp = __commonJS({
|
|
|
18951
18951
|
var pos = 0;
|
|
18952
18952
|
var backtrack = "";
|
|
18953
18953
|
var m;
|
|
18954
|
-
if (
|
|
18955
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
18954
|
+
if (path3 instanceof RegExp) {
|
|
18955
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path3.source)) {
|
|
18956
18956
|
if (m[0][0] === "\\") continue;
|
|
18957
18957
|
keys.push({
|
|
18958
18958
|
name: m[1] || name++,
|
|
@@ -18960,18 +18960,18 @@ var require_path_to_regexp = __commonJS({
|
|
|
18960
18960
|
offset: m.index
|
|
18961
18961
|
});
|
|
18962
18962
|
}
|
|
18963
|
-
return
|
|
18963
|
+
return path3;
|
|
18964
18964
|
}
|
|
18965
|
-
if (Array.isArray(
|
|
18966
|
-
|
|
18965
|
+
if (Array.isArray(path3)) {
|
|
18966
|
+
path3 = path3.map(function(value) {
|
|
18967
18967
|
return pathToRegexp(value, keys, options).source;
|
|
18968
18968
|
});
|
|
18969
|
-
return new RegExp(
|
|
18969
|
+
return new RegExp(path3.join("|"), flags);
|
|
18970
18970
|
}
|
|
18971
|
-
if (typeof
|
|
18971
|
+
if (typeof path3 !== "string") {
|
|
18972
18972
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
18973
18973
|
}
|
|
18974
|
-
|
|
18974
|
+
path3 = path3.replace(/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g, function(match, slash, format, key, capture, star, optional, offset) {
|
|
18975
18975
|
if (match[0] === "\\") {
|
|
18976
18976
|
backtrack += match;
|
|
18977
18977
|
pos += 2;
|
|
@@ -18986,7 +18986,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18986
18986
|
if (slash || format) {
|
|
18987
18987
|
backtrack = "";
|
|
18988
18988
|
} else {
|
|
18989
|
-
backtrack +=
|
|
18989
|
+
backtrack += path3.slice(pos, offset);
|
|
18990
18990
|
}
|
|
18991
18991
|
pos = offset + match.length;
|
|
18992
18992
|
if (match === "*") {
|
|
@@ -19013,7 +19013,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
19013
19013
|
extraOffset += result.length - match.length;
|
|
19014
19014
|
return result;
|
|
19015
19015
|
});
|
|
19016
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
19016
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path3)) {
|
|
19017
19017
|
if (m[0][0] === "\\") continue;
|
|
19018
19018
|
if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
|
|
19019
19019
|
keys.splice(keysOffset + i, 0, {
|
|
@@ -19024,13 +19024,13 @@ var require_path_to_regexp = __commonJS({
|
|
|
19024
19024
|
}
|
|
19025
19025
|
i++;
|
|
19026
19026
|
}
|
|
19027
|
-
|
|
19027
|
+
path3 += strict ? "" : path3[path3.length - 1] === "/" ? "?" : "/?";
|
|
19028
19028
|
if (end) {
|
|
19029
|
-
|
|
19030
|
-
} else if (
|
|
19031
|
-
|
|
19029
|
+
path3 += "$";
|
|
19030
|
+
} else if (path3[path3.length - 1] !== "/") {
|
|
19031
|
+
path3 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
19032
19032
|
}
|
|
19033
|
-
return new RegExp("^" +
|
|
19033
|
+
return new RegExp("^" + path3, flags);
|
|
19034
19034
|
}
|
|
19035
19035
|
__name(pathToRegexp, "pathToRegexp");
|
|
19036
19036
|
}
|
|
@@ -19044,19 +19044,19 @@ var require_layer = __commonJS({
|
|
|
19044
19044
|
var debug = require_src3()("express:router:layer");
|
|
19045
19045
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
19046
19046
|
module2.exports = Layer;
|
|
19047
|
-
function Layer(
|
|
19047
|
+
function Layer(path3, options, fn) {
|
|
19048
19048
|
if (!(this instanceof Layer)) {
|
|
19049
|
-
return new Layer(
|
|
19049
|
+
return new Layer(path3, options, fn);
|
|
19050
19050
|
}
|
|
19051
|
-
debug("new %o",
|
|
19051
|
+
debug("new %o", path3);
|
|
19052
19052
|
var opts = options || {};
|
|
19053
19053
|
this.handle = fn;
|
|
19054
19054
|
this.name = fn.name || "<anonymous>";
|
|
19055
19055
|
this.params = void 0;
|
|
19056
19056
|
this.path = void 0;
|
|
19057
|
-
this.regexp = pathRegexp(
|
|
19058
|
-
this.regexp.fast_star =
|
|
19059
|
-
this.regexp.fast_slash =
|
|
19057
|
+
this.regexp = pathRegexp(path3, this.keys = [], opts);
|
|
19058
|
+
this.regexp.fast_star = path3 === "*";
|
|
19059
|
+
this.regexp.fast_slash = path3 === "/" && opts.end === false;
|
|
19060
19060
|
}
|
|
19061
19061
|
__name(Layer, "Layer");
|
|
19062
19062
|
Layer.prototype.handle_error = /* @__PURE__ */ __name(function handle_error(error, req, res, next) {
|
|
@@ -19081,9 +19081,9 @@ var require_layer = __commonJS({
|
|
|
19081
19081
|
next(err);
|
|
19082
19082
|
}
|
|
19083
19083
|
}, "handle");
|
|
19084
|
-
Layer.prototype.match = /* @__PURE__ */ __name(function match(
|
|
19084
|
+
Layer.prototype.match = /* @__PURE__ */ __name(function match(path3) {
|
|
19085
19085
|
var match2;
|
|
19086
|
-
if (
|
|
19086
|
+
if (path3 != null) {
|
|
19087
19087
|
if (this.regexp.fast_slash) {
|
|
19088
19088
|
this.params = {};
|
|
19089
19089
|
this.path = "";
|
|
@@ -19091,12 +19091,12 @@ var require_layer = __commonJS({
|
|
|
19091
19091
|
}
|
|
19092
19092
|
if (this.regexp.fast_star) {
|
|
19093
19093
|
this.params = {
|
|
19094
|
-
"0": decode_param(
|
|
19094
|
+
"0": decode_param(path3)
|
|
19095
19095
|
};
|
|
19096
|
-
this.path =
|
|
19096
|
+
this.path = path3;
|
|
19097
19097
|
return true;
|
|
19098
19098
|
}
|
|
19099
|
-
match2 = this.regexp.exec(
|
|
19099
|
+
match2 = this.regexp.exec(path3);
|
|
19100
19100
|
}
|
|
19101
19101
|
if (!match2) {
|
|
19102
19102
|
this.params = void 0;
|
|
@@ -19192,10 +19192,10 @@ var require_route = __commonJS({
|
|
|
19192
19192
|
var slice = Array.prototype.slice;
|
|
19193
19193
|
var toString = Object.prototype.toString;
|
|
19194
19194
|
module2.exports = Route;
|
|
19195
|
-
function Route(
|
|
19196
|
-
this.path =
|
|
19195
|
+
function Route(path3) {
|
|
19196
|
+
this.path = path3;
|
|
19197
19197
|
this.stack = [];
|
|
19198
|
-
debug("new %o",
|
|
19198
|
+
debug("new %o", path3);
|
|
19199
19199
|
this.methods = {};
|
|
19200
19200
|
}
|
|
19201
19201
|
__name(Route, "Route");
|
|
@@ -19411,8 +19411,8 @@ var require_router = __commonJS({
|
|
|
19411
19411
|
if (++sync > 100) {
|
|
19412
19412
|
return setImmediate(next, err);
|
|
19413
19413
|
}
|
|
19414
|
-
var
|
|
19415
|
-
if (
|
|
19414
|
+
var path3 = getPathname(req);
|
|
19415
|
+
if (path3 == null) {
|
|
19416
19416
|
return done(layerError);
|
|
19417
19417
|
}
|
|
19418
19418
|
var layer;
|
|
@@ -19420,7 +19420,7 @@ var require_router = __commonJS({
|
|
|
19420
19420
|
var route;
|
|
19421
19421
|
while (match !== true && idx < stack.length) {
|
|
19422
19422
|
layer = stack[idx++];
|
|
19423
|
-
match = matchLayer(layer,
|
|
19423
|
+
match = matchLayer(layer, path3);
|
|
19424
19424
|
route = layer.route;
|
|
19425
19425
|
if (typeof match !== "boolean") {
|
|
19426
19426
|
layerError = layerError || match;
|
|
@@ -19458,19 +19458,19 @@ var require_router = __commonJS({
|
|
|
19458
19458
|
} else if (route) {
|
|
19459
19459
|
layer.handle_request(req, res, next);
|
|
19460
19460
|
} else {
|
|
19461
|
-
trim_prefix(layer, layerError, layerPath,
|
|
19461
|
+
trim_prefix(layer, layerError, layerPath, path3);
|
|
19462
19462
|
}
|
|
19463
19463
|
sync = 0;
|
|
19464
19464
|
});
|
|
19465
19465
|
}
|
|
19466
19466
|
__name(next, "next");
|
|
19467
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
19467
|
+
function trim_prefix(layer, layerError, layerPath, path3) {
|
|
19468
19468
|
if (layerPath.length !== 0) {
|
|
19469
|
-
if (layerPath !==
|
|
19469
|
+
if (layerPath !== path3.slice(0, layerPath.length)) {
|
|
19470
19470
|
next(layerError);
|
|
19471
19471
|
return;
|
|
19472
19472
|
}
|
|
19473
|
-
var c =
|
|
19473
|
+
var c = path3[layerPath.length];
|
|
19474
19474
|
if (c && c !== "/" && c !== ".") return next(layerError);
|
|
19475
19475
|
debug("trim prefix (%s) from url %s", layerPath, req.url);
|
|
19476
19476
|
removed = layerPath;
|
|
@@ -19551,7 +19551,7 @@ var require_router = __commonJS({
|
|
|
19551
19551
|
}, "process_params");
|
|
19552
19552
|
proto.use = /* @__PURE__ */ __name(function use(fn) {
|
|
19553
19553
|
var offset = 0;
|
|
19554
|
-
var
|
|
19554
|
+
var path3 = "/";
|
|
19555
19555
|
if (typeof fn !== "function") {
|
|
19556
19556
|
var arg = fn;
|
|
19557
19557
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -19559,7 +19559,7 @@ var require_router = __commonJS({
|
|
|
19559
19559
|
}
|
|
19560
19560
|
if (typeof arg !== "function") {
|
|
19561
19561
|
offset = 1;
|
|
19562
|
-
|
|
19562
|
+
path3 = fn;
|
|
19563
19563
|
}
|
|
19564
19564
|
}
|
|
19565
19565
|
var callbacks = flatten(slice.call(arguments, offset));
|
|
@@ -19571,8 +19571,8 @@ var require_router = __commonJS({
|
|
|
19571
19571
|
if (typeof fn !== "function") {
|
|
19572
19572
|
throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
|
|
19573
19573
|
}
|
|
19574
|
-
debug("use %o %s",
|
|
19575
|
-
var layer = new Layer(
|
|
19574
|
+
debug("use %o %s", path3, fn.name || "<anonymous>");
|
|
19575
|
+
var layer = new Layer(path3, {
|
|
19576
19576
|
sensitive: this.caseSensitive,
|
|
19577
19577
|
strict: false,
|
|
19578
19578
|
end: false
|
|
@@ -19582,9 +19582,9 @@ var require_router = __commonJS({
|
|
|
19582
19582
|
}
|
|
19583
19583
|
return this;
|
|
19584
19584
|
}, "use");
|
|
19585
|
-
proto.route = /* @__PURE__ */ __name(function route(
|
|
19586
|
-
var route2 = new Route(
|
|
19587
|
-
var layer = new Layer(
|
|
19585
|
+
proto.route = /* @__PURE__ */ __name(function route(path3) {
|
|
19586
|
+
var route2 = new Route(path3);
|
|
19587
|
+
var layer = new Layer(path3, {
|
|
19588
19588
|
sensitive: this.caseSensitive,
|
|
19589
19589
|
strict: this.strict,
|
|
19590
19590
|
end: true
|
|
@@ -19594,8 +19594,8 @@ var require_router = __commonJS({
|
|
|
19594
19594
|
return route2;
|
|
19595
19595
|
}, "route");
|
|
19596
19596
|
methods.concat("all").forEach(function(method) {
|
|
19597
|
-
proto[method] = function(
|
|
19598
|
-
var route = this.route(
|
|
19597
|
+
proto[method] = function(path3) {
|
|
19598
|
+
var route = this.route(path3);
|
|
19599
19599
|
route[method].apply(route, slice.call(arguments, 1));
|
|
19600
19600
|
return this;
|
|
19601
19601
|
};
|
|
@@ -19635,9 +19635,9 @@ var require_router = __commonJS({
|
|
|
19635
19635
|
return toString.call(obj).replace(objectRegExp, "$1");
|
|
19636
19636
|
}
|
|
19637
19637
|
__name(gettype, "gettype");
|
|
19638
|
-
function matchLayer(layer,
|
|
19638
|
+
function matchLayer(layer, path3) {
|
|
19639
19639
|
try {
|
|
19640
|
-
return layer.match(
|
|
19640
|
+
return layer.match(path3);
|
|
19641
19641
|
} catch (err) {
|
|
19642
19642
|
return err;
|
|
19643
19643
|
}
|
|
@@ -20633,18 +20633,18 @@ var require_view = __commonJS({
|
|
|
20633
20633
|
"../../../node_modules/express/lib/view.js"(exports2, module2) {
|
|
20634
20634
|
"use strict";
|
|
20635
20635
|
var debug = require_src3()("express:view");
|
|
20636
|
-
var
|
|
20637
|
-
var
|
|
20638
|
-
var dirname2 =
|
|
20639
|
-
var basename =
|
|
20640
|
-
var
|
|
20641
|
-
var
|
|
20642
|
-
var
|
|
20636
|
+
var path3 = require("path");
|
|
20637
|
+
var fs4 = require("fs");
|
|
20638
|
+
var dirname2 = path3.dirname;
|
|
20639
|
+
var basename = path3.basename;
|
|
20640
|
+
var extname3 = path3.extname;
|
|
20641
|
+
var join6 = path3.join;
|
|
20642
|
+
var resolve3 = path3.resolve;
|
|
20643
20643
|
module2.exports = View;
|
|
20644
20644
|
function View(name, options) {
|
|
20645
20645
|
var opts = options || {};
|
|
20646
20646
|
this.defaultEngine = opts.defaultEngine;
|
|
20647
|
-
this.ext =
|
|
20647
|
+
this.ext = extname3(name);
|
|
20648
20648
|
this.name = name;
|
|
20649
20649
|
this.root = opts.root;
|
|
20650
20650
|
if (!this.ext && !this.defaultEngine) {
|
|
@@ -20669,39 +20669,39 @@ var require_view = __commonJS({
|
|
|
20669
20669
|
}
|
|
20670
20670
|
__name(View, "View");
|
|
20671
20671
|
View.prototype.lookup = /* @__PURE__ */ __name(function lookup(name) {
|
|
20672
|
-
var
|
|
20672
|
+
var path4;
|
|
20673
20673
|
var roots = [].concat(this.root);
|
|
20674
20674
|
debug('lookup "%s"', name);
|
|
20675
|
-
for (var i = 0; i < roots.length && !
|
|
20675
|
+
for (var i = 0; i < roots.length && !path4; i++) {
|
|
20676
20676
|
var root = roots[i];
|
|
20677
|
-
var loc =
|
|
20677
|
+
var loc = resolve3(root, name);
|
|
20678
20678
|
var dir = dirname2(loc);
|
|
20679
20679
|
var file = basename(loc);
|
|
20680
|
-
|
|
20680
|
+
path4 = this.resolve(dir, file);
|
|
20681
20681
|
}
|
|
20682
|
-
return
|
|
20682
|
+
return path4;
|
|
20683
20683
|
}, "lookup");
|
|
20684
20684
|
View.prototype.render = /* @__PURE__ */ __name(function render(options, callback) {
|
|
20685
20685
|
debug('render "%s"', this.path);
|
|
20686
20686
|
this.engine(this.path, options, callback);
|
|
20687
20687
|
}, "render");
|
|
20688
|
-
View.prototype.resolve = /* @__PURE__ */ __name(function
|
|
20688
|
+
View.prototype.resolve = /* @__PURE__ */ __name(function resolve4(dir, file) {
|
|
20689
20689
|
var ext = this.ext;
|
|
20690
|
-
var
|
|
20691
|
-
var stat = tryStat(
|
|
20690
|
+
var path4 = join6(dir, file);
|
|
20691
|
+
var stat = tryStat(path4);
|
|
20692
20692
|
if (stat && stat.isFile()) {
|
|
20693
|
-
return
|
|
20693
|
+
return path4;
|
|
20694
20694
|
}
|
|
20695
|
-
|
|
20696
|
-
stat = tryStat(
|
|
20695
|
+
path4 = join6(dir, basename(file, ext), "index" + ext);
|
|
20696
|
+
stat = tryStat(path4);
|
|
20697
20697
|
if (stat && stat.isFile()) {
|
|
20698
|
-
return
|
|
20698
|
+
return path4;
|
|
20699
20699
|
}
|
|
20700
20700
|
}, "resolve");
|
|
20701
|
-
function tryStat(
|
|
20702
|
-
debug('stat "%s"',
|
|
20701
|
+
function tryStat(path4) {
|
|
20702
|
+
debug('stat "%s"', path4);
|
|
20703
20703
|
try {
|
|
20704
|
-
return
|
|
20704
|
+
return fs4.statSync(path4);
|
|
20705
20705
|
} catch (e) {
|
|
20706
20706
|
return void 0;
|
|
20707
20707
|
}
|
|
@@ -21350,8 +21350,8 @@ var require_node4 = __commonJS({
|
|
|
21350
21350
|
}
|
|
21351
21351
|
break;
|
|
21352
21352
|
case "FILE":
|
|
21353
|
-
var
|
|
21354
|
-
stream2 = new
|
|
21353
|
+
var fs4 = require("fs");
|
|
21354
|
+
stream2 = new fs4.SyncWriteStream(fd2, {
|
|
21355
21355
|
autoClose: false
|
|
21356
21356
|
});
|
|
21357
21357
|
stream2._type = "fs";
|
|
@@ -21408,14 +21408,14 @@ var require_etag = __commonJS({
|
|
|
21408
21408
|
"../../../node_modules/etag/index.js"(exports2, module2) {
|
|
21409
21409
|
"use strict";
|
|
21410
21410
|
module2.exports = etag;
|
|
21411
|
-
var
|
|
21411
|
+
var crypto4 = require("crypto");
|
|
21412
21412
|
var Stats = require("fs").Stats;
|
|
21413
21413
|
var toString = Object.prototype.toString;
|
|
21414
21414
|
function entitytag(entity) {
|
|
21415
21415
|
if (entity.length === 0) {
|
|
21416
21416
|
return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
|
|
21417
21417
|
}
|
|
21418
|
-
var hash =
|
|
21418
|
+
var hash = crypto4.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
|
|
21419
21419
|
var len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
|
|
21420
21420
|
return '"' + len.toString(16) + "-" + hash + '"';
|
|
21421
21421
|
}
|
|
@@ -21536,8 +21536,8 @@ var require_types = __commonJS({
|
|
|
21536
21536
|
var require_mime = __commonJS({
|
|
21537
21537
|
"../../../node_modules/mime/mime.js"(exports2, module2) {
|
|
21538
21538
|
"use strict";
|
|
21539
|
-
var
|
|
21540
|
-
var
|
|
21539
|
+
var path3 = require("path");
|
|
21540
|
+
var fs4 = require("fs");
|
|
21541
21541
|
function Mime() {
|
|
21542
21542
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
21543
21543
|
this.extensions = /* @__PURE__ */ Object.create(null);
|
|
@@ -21559,7 +21559,7 @@ var require_mime = __commonJS({
|
|
|
21559
21559
|
};
|
|
21560
21560
|
Mime.prototype.load = function(file) {
|
|
21561
21561
|
this._loading = file;
|
|
21562
|
-
var map = {}, content =
|
|
21562
|
+
var map = {}, content = fs4.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
|
|
21563
21563
|
lines.forEach(function(line) {
|
|
21564
21564
|
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
|
|
21565
21565
|
map[fields.shift()] = fields;
|
|
@@ -21567,8 +21567,8 @@ var require_mime = __commonJS({
|
|
|
21567
21567
|
this.define(map);
|
|
21568
21568
|
this._loading = null;
|
|
21569
21569
|
};
|
|
21570
|
-
Mime.prototype.lookup = function(
|
|
21571
|
-
var ext =
|
|
21570
|
+
Mime.prototype.lookup = function(path4, fallback) {
|
|
21571
|
+
var ext = path4.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
21572
21572
|
return this.types[ext] || fallback || this.default_type;
|
|
21573
21573
|
};
|
|
21574
21574
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -21804,34 +21804,34 @@ var require_send = __commonJS({
|
|
|
21804
21804
|
var escapeHtml = require_escape_html();
|
|
21805
21805
|
var etag = require_etag();
|
|
21806
21806
|
var fresh = require_fresh();
|
|
21807
|
-
var
|
|
21807
|
+
var fs4 = require("fs");
|
|
21808
21808
|
var mime = require_mime();
|
|
21809
21809
|
var ms = require_ms5();
|
|
21810
21810
|
var onFinished = require_on_finished();
|
|
21811
21811
|
var parseRange = require_range_parser();
|
|
21812
|
-
var
|
|
21812
|
+
var path3 = require("path");
|
|
21813
21813
|
var statuses = require_statuses();
|
|
21814
21814
|
var Stream = require("stream");
|
|
21815
21815
|
var util = require("util");
|
|
21816
|
-
var
|
|
21817
|
-
var
|
|
21818
|
-
var
|
|
21819
|
-
var
|
|
21820
|
-
var
|
|
21816
|
+
var extname3 = path3.extname;
|
|
21817
|
+
var join6 = path3.join;
|
|
21818
|
+
var normalize3 = path3.normalize;
|
|
21819
|
+
var resolve3 = path3.resolve;
|
|
21820
|
+
var sep2 = path3.sep;
|
|
21821
21821
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
21822
21822
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
21823
21823
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
21824
21824
|
module2.exports = send;
|
|
21825
21825
|
module2.exports.mime = mime;
|
|
21826
|
-
function send(req,
|
|
21827
|
-
return new SendStream(req,
|
|
21826
|
+
function send(req, path4, options) {
|
|
21827
|
+
return new SendStream(req, path4, options);
|
|
21828
21828
|
}
|
|
21829
21829
|
__name(send, "send");
|
|
21830
|
-
function SendStream(req,
|
|
21830
|
+
function SendStream(req, path4, options) {
|
|
21831
21831
|
Stream.call(this);
|
|
21832
21832
|
var opts = options || {};
|
|
21833
21833
|
this.options = opts;
|
|
21834
|
-
this.path =
|
|
21834
|
+
this.path = path4;
|
|
21835
21835
|
this.req = req;
|
|
21836
21836
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
21837
21837
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -21856,7 +21856,7 @@ var require_send = __commonJS({
|
|
|
21856
21856
|
this._maxage = opts.maxAge || opts.maxage;
|
|
21857
21857
|
this._maxage = typeof this._maxage === "string" ? ms(this._maxage) : Number(this._maxage);
|
|
21858
21858
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
21859
|
-
this._root = opts.root ?
|
|
21859
|
+
this._root = opts.root ? resolve3(opts.root) : null;
|
|
21860
21860
|
if (!this._root && opts.from) {
|
|
21861
21861
|
this.from(opts.from);
|
|
21862
21862
|
}
|
|
@@ -21880,8 +21880,8 @@ var require_send = __commonJS({
|
|
|
21880
21880
|
this._index = index2;
|
|
21881
21881
|
return this;
|
|
21882
21882
|
}, "index"), "send.index: pass index as option");
|
|
21883
|
-
SendStream.prototype.root = /* @__PURE__ */ __name(function root(
|
|
21884
|
-
this._root =
|
|
21883
|
+
SendStream.prototype.root = /* @__PURE__ */ __name(function root(path4) {
|
|
21884
|
+
this._root = resolve3(String(path4));
|
|
21885
21885
|
debug("root %s", this._root);
|
|
21886
21886
|
return this;
|
|
21887
21887
|
}, "root");
|
|
@@ -21988,10 +21988,10 @@ var require_send = __commonJS({
|
|
|
21988
21988
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
21989
21989
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
21990
21990
|
}, "isRangeFresh");
|
|
21991
|
-
SendStream.prototype.redirect = /* @__PURE__ */ __name(function redirect(
|
|
21991
|
+
SendStream.prototype.redirect = /* @__PURE__ */ __name(function redirect(path4) {
|
|
21992
21992
|
var res = this.res;
|
|
21993
21993
|
if (hasListeners(this, "directory")) {
|
|
21994
|
-
this.emit("directory", res,
|
|
21994
|
+
this.emit("directory", res, path4);
|
|
21995
21995
|
return;
|
|
21996
21996
|
}
|
|
21997
21997
|
if (this.hasTrailingSlash()) {
|
|
@@ -22011,42 +22011,42 @@ var require_send = __commonJS({
|
|
|
22011
22011
|
SendStream.prototype.pipe = /* @__PURE__ */ __name(function pipe(res) {
|
|
22012
22012
|
var root = this._root;
|
|
22013
22013
|
this.res = res;
|
|
22014
|
-
var
|
|
22015
|
-
if (
|
|
22014
|
+
var path4 = decode(this.path);
|
|
22015
|
+
if (path4 === -1) {
|
|
22016
22016
|
this.error(400);
|
|
22017
22017
|
return res;
|
|
22018
22018
|
}
|
|
22019
|
-
if (~
|
|
22019
|
+
if (~path4.indexOf("\0")) {
|
|
22020
22020
|
this.error(400);
|
|
22021
22021
|
return res;
|
|
22022
22022
|
}
|
|
22023
22023
|
var parts;
|
|
22024
22024
|
if (root !== null) {
|
|
22025
|
-
if (
|
|
22026
|
-
|
|
22025
|
+
if (path4) {
|
|
22026
|
+
path4 = normalize3("." + sep2 + path4);
|
|
22027
22027
|
}
|
|
22028
|
-
if (UP_PATH_REGEXP.test(
|
|
22029
|
-
debug('malicious path "%s"',
|
|
22028
|
+
if (UP_PATH_REGEXP.test(path4)) {
|
|
22029
|
+
debug('malicious path "%s"', path4);
|
|
22030
22030
|
this.error(403);
|
|
22031
22031
|
return res;
|
|
22032
22032
|
}
|
|
22033
|
-
parts =
|
|
22034
|
-
|
|
22033
|
+
parts = path4.split(sep2);
|
|
22034
|
+
path4 = normalize3(join6(root, path4));
|
|
22035
22035
|
} else {
|
|
22036
|
-
if (UP_PATH_REGEXP.test(
|
|
22037
|
-
debug('malicious path "%s"',
|
|
22036
|
+
if (UP_PATH_REGEXP.test(path4)) {
|
|
22037
|
+
debug('malicious path "%s"', path4);
|
|
22038
22038
|
this.error(403);
|
|
22039
22039
|
return res;
|
|
22040
22040
|
}
|
|
22041
|
-
parts =
|
|
22042
|
-
|
|
22041
|
+
parts = normalize3(path4).split(sep2);
|
|
22042
|
+
path4 = resolve3(path4);
|
|
22043
22043
|
}
|
|
22044
22044
|
if (containsDotFile(parts)) {
|
|
22045
22045
|
var access = this._dotfiles;
|
|
22046
22046
|
if (access === void 0) {
|
|
22047
22047
|
access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
|
|
22048
22048
|
}
|
|
22049
|
-
debug('%s dotfile "%s"', access,
|
|
22049
|
+
debug('%s dotfile "%s"', access, path4);
|
|
22050
22050
|
switch (access) {
|
|
22051
22051
|
case "allow":
|
|
22052
22052
|
break;
|
|
@@ -22060,13 +22060,13 @@ var require_send = __commonJS({
|
|
|
22060
22060
|
}
|
|
22061
22061
|
}
|
|
22062
22062
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
22063
|
-
this.sendIndex(
|
|
22063
|
+
this.sendIndex(path4);
|
|
22064
22064
|
return res;
|
|
22065
22065
|
}
|
|
22066
|
-
this.sendFile(
|
|
22066
|
+
this.sendFile(path4);
|
|
22067
22067
|
return res;
|
|
22068
22068
|
}, "pipe");
|
|
22069
|
-
SendStream.prototype.send = /* @__PURE__ */ __name(function send2(
|
|
22069
|
+
SendStream.prototype.send = /* @__PURE__ */ __name(function send2(path4, stat) {
|
|
22070
22070
|
var len = stat.size;
|
|
22071
22071
|
var options = this.options;
|
|
22072
22072
|
var opts = {};
|
|
@@ -22078,9 +22078,9 @@ var require_send = __commonJS({
|
|
|
22078
22078
|
this.headersAlreadySent();
|
|
22079
22079
|
return;
|
|
22080
22080
|
}
|
|
22081
|
-
debug('pipe "%s"',
|
|
22082
|
-
this.setHeader(
|
|
22083
|
-
this.type(
|
|
22081
|
+
debug('pipe "%s"', path4);
|
|
22082
|
+
this.setHeader(path4, stat);
|
|
22083
|
+
this.type(path4);
|
|
22084
22084
|
if (this.isConditionalGET()) {
|
|
22085
22085
|
if (this.isPreconditionFailure()) {
|
|
22086
22086
|
this.error(412);
|
|
@@ -22131,28 +22131,28 @@ var require_send = __commonJS({
|
|
|
22131
22131
|
res.end();
|
|
22132
22132
|
return;
|
|
22133
22133
|
}
|
|
22134
|
-
this.stream(
|
|
22134
|
+
this.stream(path4, opts);
|
|
22135
22135
|
}, "send");
|
|
22136
|
-
SendStream.prototype.sendFile = /* @__PURE__ */ __name(function sendFile(
|
|
22136
|
+
SendStream.prototype.sendFile = /* @__PURE__ */ __name(function sendFile(path4) {
|
|
22137
22137
|
var i = 0;
|
|
22138
22138
|
var self = this;
|
|
22139
|
-
debug('stat "%s"',
|
|
22140
|
-
|
|
22141
|
-
if (err && err.code === "ENOENT" && !
|
|
22139
|
+
debug('stat "%s"', path4);
|
|
22140
|
+
fs4.stat(path4, /* @__PURE__ */ __name(function onstat(err, stat) {
|
|
22141
|
+
if (err && err.code === "ENOENT" && !extname3(path4) && path4[path4.length - 1] !== sep2) {
|
|
22142
22142
|
return next(err);
|
|
22143
22143
|
}
|
|
22144
22144
|
if (err) return self.onStatError(err);
|
|
22145
|
-
if (stat.isDirectory()) return self.redirect(
|
|
22146
|
-
self.emit("file",
|
|
22147
|
-
self.send(
|
|
22145
|
+
if (stat.isDirectory()) return self.redirect(path4);
|
|
22146
|
+
self.emit("file", path4, stat);
|
|
22147
|
+
self.send(path4, stat);
|
|
22148
22148
|
}, "onstat"));
|
|
22149
22149
|
function next(err) {
|
|
22150
22150
|
if (self._extensions.length <= i) {
|
|
22151
22151
|
return err ? self.onStatError(err) : self.error(404);
|
|
22152
22152
|
}
|
|
22153
|
-
var p =
|
|
22153
|
+
var p = path4 + "." + self._extensions[i++];
|
|
22154
22154
|
debug('stat "%s"', p);
|
|
22155
|
-
|
|
22155
|
+
fs4.stat(p, function(err2, stat) {
|
|
22156
22156
|
if (err2) return next(err2);
|
|
22157
22157
|
if (stat.isDirectory()) return next();
|
|
22158
22158
|
self.emit("file", p, stat);
|
|
@@ -22161,7 +22161,7 @@ var require_send = __commonJS({
|
|
|
22161
22161
|
}
|
|
22162
22162
|
__name(next, "next");
|
|
22163
22163
|
}, "sendFile");
|
|
22164
|
-
SendStream.prototype.sendIndex = /* @__PURE__ */ __name(function sendIndex(
|
|
22164
|
+
SendStream.prototype.sendIndex = /* @__PURE__ */ __name(function sendIndex(path4) {
|
|
22165
22165
|
var i = -1;
|
|
22166
22166
|
var self = this;
|
|
22167
22167
|
function next(err) {
|
|
@@ -22169,9 +22169,9 @@ var require_send = __commonJS({
|
|
|
22169
22169
|
if (err) return self.onStatError(err);
|
|
22170
22170
|
return self.error(404);
|
|
22171
22171
|
}
|
|
22172
|
-
var p =
|
|
22172
|
+
var p = join6(path4, self._index[i]);
|
|
22173
22173
|
debug('stat "%s"', p);
|
|
22174
|
-
|
|
22174
|
+
fs4.stat(p, function(err2, stat) {
|
|
22175
22175
|
if (err2) return next(err2);
|
|
22176
22176
|
if (stat.isDirectory()) return next();
|
|
22177
22177
|
self.emit("file", p, stat);
|
|
@@ -22181,10 +22181,10 @@ var require_send = __commonJS({
|
|
|
22181
22181
|
__name(next, "next");
|
|
22182
22182
|
next();
|
|
22183
22183
|
}, "sendIndex");
|
|
22184
|
-
SendStream.prototype.stream = /* @__PURE__ */ __name(function stream(
|
|
22184
|
+
SendStream.prototype.stream = /* @__PURE__ */ __name(function stream(path4, options) {
|
|
22185
22185
|
var self = this;
|
|
22186
22186
|
var res = this.res;
|
|
22187
|
-
var stream2 =
|
|
22187
|
+
var stream2 = fs4.createReadStream(path4, options);
|
|
22188
22188
|
this.emit("stream", stream2);
|
|
22189
22189
|
stream2.pipe(res);
|
|
22190
22190
|
function cleanup() {
|
|
@@ -22200,10 +22200,10 @@ var require_send = __commonJS({
|
|
|
22200
22200
|
self.emit("end");
|
|
22201
22201
|
}, "onend"));
|
|
22202
22202
|
}, "stream");
|
|
22203
|
-
SendStream.prototype.type = /* @__PURE__ */ __name(function type(
|
|
22203
|
+
SendStream.prototype.type = /* @__PURE__ */ __name(function type(path4) {
|
|
22204
22204
|
var res = this.res;
|
|
22205
22205
|
if (res.getHeader("Content-Type")) return;
|
|
22206
|
-
var type2 = mime.lookup(
|
|
22206
|
+
var type2 = mime.lookup(path4);
|
|
22207
22207
|
if (!type2) {
|
|
22208
22208
|
debug("no content-type");
|
|
22209
22209
|
return;
|
|
@@ -22212,9 +22212,9 @@ var require_send = __commonJS({
|
|
|
22212
22212
|
debug("content-type %s", type2);
|
|
22213
22213
|
res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
|
|
22214
22214
|
}, "type");
|
|
22215
|
-
SendStream.prototype.setHeader = /* @__PURE__ */ __name(function setHeader(
|
|
22215
|
+
SendStream.prototype.setHeader = /* @__PURE__ */ __name(function setHeader(path4, stat) {
|
|
22216
22216
|
var res = this.res;
|
|
22217
|
-
this.emit("headers", res,
|
|
22217
|
+
this.emit("headers", res, path4, stat);
|
|
22218
22218
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
22219
22219
|
debug("accept ranges");
|
|
22220
22220
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -22281,9 +22281,9 @@ var require_send = __commonJS({
|
|
|
22281
22281
|
}) : createError(status, err);
|
|
22282
22282
|
}
|
|
22283
22283
|
__name(createHttpError, "createHttpError");
|
|
22284
|
-
function decode(
|
|
22284
|
+
function decode(path4) {
|
|
22285
22285
|
try {
|
|
22286
|
-
return decodeURIComponent(
|
|
22286
|
+
return decodeURIComponent(path4);
|
|
22287
22287
|
} catch (err) {
|
|
22288
22288
|
return -1;
|
|
22289
22289
|
}
|
|
@@ -23541,10 +23541,10 @@ var require_utils3 = __commonJS({
|
|
|
23541
23541
|
exports2.wetag = createETagGenerator({
|
|
23542
23542
|
weak: true
|
|
23543
23543
|
});
|
|
23544
|
-
exports2.isAbsolute = function(
|
|
23545
|
-
if ("/" ===
|
|
23546
|
-
if (":" ===
|
|
23547
|
-
if ("\\\\" ===
|
|
23544
|
+
exports2.isAbsolute = function(path3) {
|
|
23545
|
+
if ("/" === path3[0]) return true;
|
|
23546
|
+
if (":" === path3[1] && ("\\" === path3[2] || "/" === path3[2])) return true;
|
|
23547
|
+
if ("\\\\" === path3.substring(0, 2)) return true;
|
|
23548
23548
|
};
|
|
23549
23549
|
exports2.flatten = deprecate.function(flatten, "utils.flatten: use array-flatten npm module instead");
|
|
23550
23550
|
exports2.normalizeType = function(type) {
|
|
@@ -23648,7 +23648,7 @@ var require_utils3 = __commonJS({
|
|
|
23648
23648
|
return contentType.format(parsed);
|
|
23649
23649
|
}, "setCharset");
|
|
23650
23650
|
function createETagGenerator(options) {
|
|
23651
|
-
return /* @__PURE__ */ __name(function
|
|
23651
|
+
return /* @__PURE__ */ __name(function generateETag3(body, encoding) {
|
|
23652
23652
|
var buf = !Buffer2.isBuffer(body) ? Buffer2.from(body, encoding) : body;
|
|
23653
23653
|
return etag(buf, options);
|
|
23654
23654
|
}, "generateETag");
|
|
@@ -23685,7 +23685,7 @@ var require_application = __commonJS({
|
|
|
23685
23685
|
var deprecate = require_depd()("express");
|
|
23686
23686
|
var flatten = require_array_flatten();
|
|
23687
23687
|
var merge = require_utils_merge();
|
|
23688
|
-
var
|
|
23688
|
+
var resolve3 = require("path").resolve;
|
|
23689
23689
|
var setPrototypeOf = require_setprototypeof();
|
|
23690
23690
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
23691
23691
|
var slice = Array.prototype.slice;
|
|
@@ -23724,7 +23724,7 @@ var require_application = __commonJS({
|
|
|
23724
23724
|
this.mountpath = "/";
|
|
23725
23725
|
this.locals.settings = this.settings;
|
|
23726
23726
|
this.set("view", View);
|
|
23727
|
-
this.set("views",
|
|
23727
|
+
this.set("views", resolve3("views"));
|
|
23728
23728
|
this.set("jsonp callback name", "callback");
|
|
23729
23729
|
if (env === "production") {
|
|
23730
23730
|
this.enable("view cache");
|
|
@@ -23760,7 +23760,7 @@ var require_application = __commonJS({
|
|
|
23760
23760
|
}, "handle");
|
|
23761
23761
|
app.use = /* @__PURE__ */ __name(function use(fn) {
|
|
23762
23762
|
var offset = 0;
|
|
23763
|
-
var
|
|
23763
|
+
var path3 = "/";
|
|
23764
23764
|
if (typeof fn !== "function") {
|
|
23765
23765
|
var arg = fn;
|
|
23766
23766
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -23768,7 +23768,7 @@ var require_application = __commonJS({
|
|
|
23768
23768
|
}
|
|
23769
23769
|
if (typeof arg !== "function") {
|
|
23770
23770
|
offset = 1;
|
|
23771
|
-
|
|
23771
|
+
path3 = fn;
|
|
23772
23772
|
}
|
|
23773
23773
|
}
|
|
23774
23774
|
var fns = flatten(slice.call(arguments, offset));
|
|
@@ -23779,12 +23779,12 @@ var require_application = __commonJS({
|
|
|
23779
23779
|
var router = this._router;
|
|
23780
23780
|
fns.forEach(function(fn2) {
|
|
23781
23781
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
23782
|
-
return router.use(
|
|
23782
|
+
return router.use(path3, fn2);
|
|
23783
23783
|
}
|
|
23784
|
-
debug(".use app under %s",
|
|
23785
|
-
fn2.mountpath =
|
|
23784
|
+
debug(".use app under %s", path3);
|
|
23785
|
+
fn2.mountpath = path3;
|
|
23786
23786
|
fn2.parent = this;
|
|
23787
|
-
router.use(
|
|
23787
|
+
router.use(path3, /* @__PURE__ */ __name(function mounted_app(req, res, next) {
|
|
23788
23788
|
var orig = req.app;
|
|
23789
23789
|
fn2.handle(req, res, function(err) {
|
|
23790
23790
|
setPrototypeOf(req, orig.request);
|
|
@@ -23796,9 +23796,9 @@ var require_application = __commonJS({
|
|
|
23796
23796
|
}, this);
|
|
23797
23797
|
return this;
|
|
23798
23798
|
}, "use");
|
|
23799
|
-
app.route = /* @__PURE__ */ __name(function route(
|
|
23799
|
+
app.route = /* @__PURE__ */ __name(function route(path3) {
|
|
23800
23800
|
this.lazyrouter();
|
|
23801
|
-
return this._router.route(
|
|
23801
|
+
return this._router.route(path3);
|
|
23802
23802
|
}, "route");
|
|
23803
23803
|
app.engine = /* @__PURE__ */ __name(function engine(ext, fn) {
|
|
23804
23804
|
if (typeof fn !== "function") {
|
|
@@ -23849,7 +23849,7 @@ var require_application = __commonJS({
|
|
|
23849
23849
|
}
|
|
23850
23850
|
return this;
|
|
23851
23851
|
}, "set");
|
|
23852
|
-
app.path = /* @__PURE__ */ __name(function
|
|
23852
|
+
app.path = /* @__PURE__ */ __name(function path3() {
|
|
23853
23853
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
23854
23854
|
}, "path");
|
|
23855
23855
|
app.enabled = /* @__PURE__ */ __name(function enabled(setting) {
|
|
@@ -23865,19 +23865,19 @@ var require_application = __commonJS({
|
|
|
23865
23865
|
return this.set(setting, false);
|
|
23866
23866
|
}, "disable");
|
|
23867
23867
|
methods.forEach(function(method) {
|
|
23868
|
-
app[method] = function(
|
|
23868
|
+
app[method] = function(path3) {
|
|
23869
23869
|
if (method === "get" && arguments.length === 1) {
|
|
23870
|
-
return this.set(
|
|
23870
|
+
return this.set(path3);
|
|
23871
23871
|
}
|
|
23872
23872
|
this.lazyrouter();
|
|
23873
|
-
var route = this._router.route(
|
|
23873
|
+
var route = this._router.route(path3);
|
|
23874
23874
|
route[method].apply(route, slice.call(arguments, 1));
|
|
23875
23875
|
return this;
|
|
23876
23876
|
};
|
|
23877
23877
|
});
|
|
23878
|
-
app.all = /* @__PURE__ */ __name(function all(
|
|
23878
|
+
app.all = /* @__PURE__ */ __name(function all(path3) {
|
|
23879
23879
|
this.lazyrouter();
|
|
23880
|
-
var route = this._router.route(
|
|
23880
|
+
var route = this._router.route(path3);
|
|
23881
23881
|
var args = slice.call(arguments, 1);
|
|
23882
23882
|
for (var i = 0; i < methods.length; i++) {
|
|
23883
23883
|
route[methods[i]].apply(route, args);
|
|
@@ -33036,7 +33036,7 @@ var require_mime_types2 = __commonJS({
|
|
|
33036
33036
|
"../../../node_modules/accepts/node_modules/mime-types/index.js"(exports2) {
|
|
33037
33037
|
"use strict";
|
|
33038
33038
|
var db = require_mime_db2();
|
|
33039
|
-
var
|
|
33039
|
+
var extname3 = require("path").extname;
|
|
33040
33040
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
33041
33041
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
33042
33042
|
exports2.charset = charset;
|
|
@@ -33091,11 +33091,11 @@ var require_mime_types2 = __commonJS({
|
|
|
33091
33091
|
return exts[0];
|
|
33092
33092
|
}
|
|
33093
33093
|
__name(extension, "extension");
|
|
33094
|
-
function lookup(
|
|
33095
|
-
if (!
|
|
33094
|
+
function lookup(path3) {
|
|
33095
|
+
if (!path3 || typeof path3 !== "string") {
|
|
33096
33096
|
return false;
|
|
33097
33097
|
}
|
|
33098
|
-
var extension2 =
|
|
33098
|
+
var extension2 = extname3("x." + path3).toLowerCase().substr(1);
|
|
33099
33099
|
if (!extension2) {
|
|
33100
33100
|
return false;
|
|
33101
33101
|
}
|
|
@@ -33325,7 +33325,7 @@ var require_request = __commonJS({
|
|
|
33325
33325
|
];
|
|
33326
33326
|
return subdomains2.slice(offset);
|
|
33327
33327
|
}, "subdomains"));
|
|
33328
|
-
defineGetter(req, "path", /* @__PURE__ */ __name(function
|
|
33328
|
+
defineGetter(req, "path", /* @__PURE__ */ __name(function path3() {
|
|
33329
33329
|
return parse(this).pathname;
|
|
33330
33330
|
}, "path"));
|
|
33331
33331
|
defineGetter(req, "hostname", /* @__PURE__ */ __name(function hostname() {
|
|
@@ -33379,11 +33379,11 @@ var require_request = __commonJS({
|
|
|
33379
33379
|
var require_cookie_signature = __commonJS({
|
|
33380
33380
|
"../../../node_modules/cookie-signature/index.js"(exports2) {
|
|
33381
33381
|
"use strict";
|
|
33382
|
-
var
|
|
33382
|
+
var crypto4 = require("crypto");
|
|
33383
33383
|
exports2.sign = function(val, secret) {
|
|
33384
33384
|
if ("string" !== typeof val) throw new TypeError("Cookie value must be provided as a string.");
|
|
33385
33385
|
if (null == secret) throw new TypeError("Secret key must be provided.");
|
|
33386
|
-
return val + "." +
|
|
33386
|
+
return val + "." + crypto4.createHmac("sha256", secret).update(val).digest("base64").replace(/\=+$/, "");
|
|
33387
33387
|
};
|
|
33388
33388
|
exports2.unsign = function(val, secret) {
|
|
33389
33389
|
if ("string" !== typeof val) throw new TypeError("Signed cookie string must be provided.");
|
|
@@ -33392,7 +33392,7 @@ var require_cookie_signature = __commonJS({
|
|
|
33392
33392
|
return sha1(mac) == sha1(val) ? str : false;
|
|
33393
33393
|
};
|
|
33394
33394
|
function sha1(str) {
|
|
33395
|
-
return
|
|
33395
|
+
return crypto4.createHash("sha1").update(str).digest("hex");
|
|
33396
33396
|
}
|
|
33397
33397
|
__name(sha1, "sha1");
|
|
33398
33398
|
}
|
|
@@ -33660,7 +33660,7 @@ var require_response = __commonJS({
|
|
|
33660
33660
|
var http = require("http");
|
|
33661
33661
|
var isAbsolute = require_utils3().isAbsolute;
|
|
33662
33662
|
var onFinished = require_on_finished();
|
|
33663
|
-
var
|
|
33663
|
+
var path3 = require("path");
|
|
33664
33664
|
var statuses = require_statuses();
|
|
33665
33665
|
var merge = require_utils_merge();
|
|
33666
33666
|
var sign = require_cookie_signature().sign;
|
|
@@ -33669,9 +33669,9 @@ var require_response = __commonJS({
|
|
|
33669
33669
|
var setCharset = require_utils3().setCharset;
|
|
33670
33670
|
var cookie = require_cookie();
|
|
33671
33671
|
var send = require_send();
|
|
33672
|
-
var
|
|
33672
|
+
var extname3 = path3.extname;
|
|
33673
33673
|
var mime = send.mime;
|
|
33674
|
-
var
|
|
33674
|
+
var resolve3 = path3.resolve;
|
|
33675
33675
|
var vary = require_vary();
|
|
33676
33676
|
var res = Object.create(http.ServerResponse.prototype);
|
|
33677
33677
|
module2.exports = res;
|
|
@@ -33743,12 +33743,12 @@ var require_response = __commonJS({
|
|
|
33743
33743
|
}
|
|
33744
33744
|
}
|
|
33745
33745
|
var etagFn = app.get("etag fn");
|
|
33746
|
-
var
|
|
33746
|
+
var generateETag3 = !this.get("ETag") && typeof etagFn === "function";
|
|
33747
33747
|
var len;
|
|
33748
33748
|
if (chunk !== void 0) {
|
|
33749
33749
|
if (Buffer2.isBuffer(chunk)) {
|
|
33750
33750
|
len = chunk.length;
|
|
33751
|
-
} else if (!
|
|
33751
|
+
} else if (!generateETag3 && chunk.length < 1e3) {
|
|
33752
33752
|
len = Buffer2.byteLength(chunk, encoding);
|
|
33753
33753
|
} else {
|
|
33754
33754
|
chunk = Buffer2.from(chunk, encoding);
|
|
@@ -33758,7 +33758,7 @@ var require_response = __commonJS({
|
|
|
33758
33758
|
this.set("Content-Length", len);
|
|
33759
33759
|
}
|
|
33760
33760
|
var etag;
|
|
33761
|
-
if (
|
|
33761
|
+
if (generateETag3 && len !== void 0) {
|
|
33762
33762
|
if (etag = etagFn(chunk, encoding)) {
|
|
33763
33763
|
this.set("ETag", etag);
|
|
33764
33764
|
}
|
|
@@ -33848,26 +33848,26 @@ var require_response = __commonJS({
|
|
|
33848
33848
|
this.type("txt");
|
|
33849
33849
|
return this.send(body);
|
|
33850
33850
|
}, "sendStatus");
|
|
33851
|
-
res.sendFile = /* @__PURE__ */ __name(function sendFile(
|
|
33851
|
+
res.sendFile = /* @__PURE__ */ __name(function sendFile(path4, options, callback) {
|
|
33852
33852
|
var done = callback;
|
|
33853
33853
|
var req = this.req;
|
|
33854
33854
|
var res2 = this;
|
|
33855
33855
|
var next = req.next;
|
|
33856
33856
|
var opts = options || {};
|
|
33857
|
-
if (!
|
|
33857
|
+
if (!path4) {
|
|
33858
33858
|
throw new TypeError("path argument is required to res.sendFile");
|
|
33859
33859
|
}
|
|
33860
|
-
if (typeof
|
|
33860
|
+
if (typeof path4 !== "string") {
|
|
33861
33861
|
throw new TypeError("path must be a string to res.sendFile");
|
|
33862
33862
|
}
|
|
33863
33863
|
if (typeof options === "function") {
|
|
33864
33864
|
done = options;
|
|
33865
33865
|
opts = {};
|
|
33866
33866
|
}
|
|
33867
|
-
if (!opts.root && !isAbsolute(
|
|
33867
|
+
if (!opts.root && !isAbsolute(path4)) {
|
|
33868
33868
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
33869
33869
|
}
|
|
33870
|
-
var pathname = encodeURI(
|
|
33870
|
+
var pathname = encodeURI(path4);
|
|
33871
33871
|
var file = send(req, pathname, opts);
|
|
33872
33872
|
sendfile(res2, file, opts, function(err) {
|
|
33873
33873
|
if (done) return done(err);
|
|
@@ -33877,7 +33877,7 @@ var require_response = __commonJS({
|
|
|
33877
33877
|
}
|
|
33878
33878
|
});
|
|
33879
33879
|
}, "sendFile");
|
|
33880
|
-
res.sendfile = function(
|
|
33880
|
+
res.sendfile = function(path4, options, callback) {
|
|
33881
33881
|
var done = callback;
|
|
33882
33882
|
var req = this.req;
|
|
33883
33883
|
var res2 = this;
|
|
@@ -33887,7 +33887,7 @@ var require_response = __commonJS({
|
|
|
33887
33887
|
done = options;
|
|
33888
33888
|
opts = {};
|
|
33889
33889
|
}
|
|
33890
|
-
var file = send(req,
|
|
33890
|
+
var file = send(req, path4, opts);
|
|
33891
33891
|
sendfile(res2, file, opts, function(err) {
|
|
33892
33892
|
if (done) return done(err);
|
|
33893
33893
|
if (err && err.code === "EISDIR") return next();
|
|
@@ -33897,7 +33897,7 @@ var require_response = __commonJS({
|
|
|
33897
33897
|
});
|
|
33898
33898
|
};
|
|
33899
33899
|
res.sendfile = deprecate.function(res.sendfile, "res.sendfile: Use res.sendFile instead");
|
|
33900
|
-
res.download = /* @__PURE__ */ __name(function download(
|
|
33900
|
+
res.download = /* @__PURE__ */ __name(function download(path4, filename, options, callback) {
|
|
33901
33901
|
var done = callback;
|
|
33902
33902
|
var name = filename;
|
|
33903
33903
|
var opts = options || null;
|
|
@@ -33914,7 +33914,7 @@ var require_response = __commonJS({
|
|
|
33914
33914
|
opts = filename;
|
|
33915
33915
|
}
|
|
33916
33916
|
var headers = {
|
|
33917
|
-
"Content-Disposition": contentDisposition(name ||
|
|
33917
|
+
"Content-Disposition": contentDisposition(name || path4)
|
|
33918
33918
|
};
|
|
33919
33919
|
if (opts && opts.headers) {
|
|
33920
33920
|
var keys = Object.keys(opts.headers);
|
|
@@ -33927,7 +33927,7 @@ var require_response = __commonJS({
|
|
|
33927
33927
|
}
|
|
33928
33928
|
opts = Object.create(opts);
|
|
33929
33929
|
opts.headers = headers;
|
|
33930
|
-
var fullPath = !opts.root ?
|
|
33930
|
+
var fullPath = !opts.root ? resolve3(path4) : path4;
|
|
33931
33931
|
return this.sendFile(fullPath, opts, done);
|
|
33932
33932
|
}, "download");
|
|
33933
33933
|
res.contentType = res.type = /* @__PURE__ */ __name(function contentType(type) {
|
|
@@ -33958,7 +33958,7 @@ var require_response = __commonJS({
|
|
|
33958
33958
|
};
|
|
33959
33959
|
res.attachment = /* @__PURE__ */ __name(function attachment(filename) {
|
|
33960
33960
|
if (filename) {
|
|
33961
|
-
this.type(
|
|
33961
|
+
this.type(extname3(filename));
|
|
33962
33962
|
}
|
|
33963
33963
|
this.set("Content-Disposition", contentDisposition(filename));
|
|
33964
33964
|
return this;
|
|
@@ -34210,7 +34210,7 @@ var require_serve_static = __commonJS({
|
|
|
34210
34210
|
var encodeUrl = require_encodeurl();
|
|
34211
34211
|
var escapeHtml = require_escape_html();
|
|
34212
34212
|
var parseUrl = require_parseurl();
|
|
34213
|
-
var
|
|
34213
|
+
var resolve3 = require("path").resolve;
|
|
34214
34214
|
var send = require_send();
|
|
34215
34215
|
var url = require("url");
|
|
34216
34216
|
module2.exports = serveStatic;
|
|
@@ -34230,7 +34230,7 @@ var require_serve_static = __commonJS({
|
|
|
34230
34230
|
throw new TypeError("option setHeaders must be function");
|
|
34231
34231
|
}
|
|
34232
34232
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
34233
|
-
opts.root =
|
|
34233
|
+
opts.root = resolve3(root);
|
|
34234
34234
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
34235
34235
|
return /* @__PURE__ */ __name(function serveStatic2(req, res, next) {
|
|
34236
34236
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -34245,11 +34245,11 @@ var require_serve_static = __commonJS({
|
|
|
34245
34245
|
}
|
|
34246
34246
|
var forwardError = !fallthrough;
|
|
34247
34247
|
var originalUrl = parseUrl.original(req);
|
|
34248
|
-
var
|
|
34249
|
-
if (
|
|
34250
|
-
|
|
34248
|
+
var path3 = parseUrl(req).pathname;
|
|
34249
|
+
if (path3 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
34250
|
+
path3 = "";
|
|
34251
34251
|
}
|
|
34252
|
-
var stream = send(req,
|
|
34252
|
+
var stream = send(req, path3, opts);
|
|
34253
34253
|
stream.on("directory", onDirectory);
|
|
34254
34254
|
if (setHeaders) {
|
|
34255
34255
|
stream.on("headers", setHeaders);
|
|
@@ -34424,6 +34424,7 @@ __export(index_exports, {
|
|
|
34424
34424
|
ViewContextMiddleware: () => ViewContextMiddleware,
|
|
34425
34425
|
configureApp: () => configureApp,
|
|
34426
34426
|
createLegacyPathRedirectMiddleware: () => createLegacyPathRedirectMiddleware,
|
|
34427
|
+
createPublicAssetsMiddleware: () => createPublicAssetsMiddleware,
|
|
34427
34428
|
safeEscape: () => safeEscape,
|
|
34428
34429
|
safeEscapeDeep: () => safeEscapeDeep,
|
|
34429
34430
|
safeStringParse: () => safeStringParse,
|
|
@@ -34885,7 +34886,7 @@ var RequestContextMiddleware = class {
|
|
|
34885
34886
|
this.requestContext = requestContext;
|
|
34886
34887
|
}
|
|
34887
34888
|
use(req, _res, next) {
|
|
34888
|
-
const
|
|
34889
|
+
const path3 = req.originalUrl ?? req.url;
|
|
34889
34890
|
const userContext = req.userContext ?? {};
|
|
34890
34891
|
const ttEnv = req.headers["x-tt-env"];
|
|
34891
34892
|
const rawPageRoute = req.get("X-Page-Route");
|
|
@@ -34893,7 +34894,7 @@ var RequestContextMiddleware = class {
|
|
|
34893
34894
|
const refererPath = req.headers["rpc-persist-apaas-observability-referer-path"];
|
|
34894
34895
|
const observabilityApi = req.headers["rpc-persist-apaas-observability-api"];
|
|
34895
34896
|
this.requestContext.run({
|
|
34896
|
-
path:
|
|
34897
|
+
path: path3,
|
|
34897
34898
|
method: req.method,
|
|
34898
34899
|
userId: userContext.userId,
|
|
34899
34900
|
tenantId: userContext.tenantId,
|
|
@@ -35377,10 +35378,10 @@ var FileService = class {
|
|
|
35377
35378
|
from(bucket) {
|
|
35378
35379
|
return {
|
|
35379
35380
|
upload: /* @__PURE__ */ __name((file, options) => this._upload(bucket, file, options), "upload"),
|
|
35380
|
-
download: /* @__PURE__ */ __name((
|
|
35381
|
+
download: /* @__PURE__ */ __name((path3) => this._download(bucket, path3), "download"),
|
|
35381
35382
|
list: /* @__PURE__ */ __name((prefix, searchOptions) => this._list(bucket, prefix, searchOptions), "list"),
|
|
35382
35383
|
remove: /* @__PURE__ */ __name((filePaths) => this._remove(bucket, filePaths), "remove"),
|
|
35383
|
-
createSignedUrl: /* @__PURE__ */ __name((
|
|
35384
|
+
createSignedUrl: /* @__PURE__ */ __name((path3, expiresIn) => this._createSignedUrl(bucket, path3, expiresIn), "createSignedUrl"),
|
|
35384
35385
|
getFileMetadata: /* @__PURE__ */ __name((filePath) => this._getFileMetadata(bucket, filePath), "getFileMetadata")
|
|
35385
35386
|
};
|
|
35386
35387
|
}
|
|
@@ -35388,9 +35389,9 @@ var FileService = class {
|
|
|
35388
35389
|
async upload(file, options) {
|
|
35389
35390
|
return this._upload(await this.getDefaultBucket(), file, options);
|
|
35390
35391
|
}
|
|
35391
|
-
download(
|
|
35392
|
+
download(path3) {
|
|
35392
35393
|
const capturedBucketPromise = this.getDefaultBucket();
|
|
35393
|
-
return this._download(capturedBucketPromise,
|
|
35394
|
+
return this._download(capturedBucketPromise, path3);
|
|
35394
35395
|
}
|
|
35395
35396
|
async list(prefix, searchOptions) {
|
|
35396
35397
|
return this._list(await this.getDefaultBucket(), prefix, searchOptions);
|
|
@@ -35398,8 +35399,8 @@ var FileService = class {
|
|
|
35398
35399
|
async remove(filePaths) {
|
|
35399
35400
|
return this._remove(await this.getDefaultBucket(), filePaths);
|
|
35400
35401
|
}
|
|
35401
|
-
async createSignedUrl(
|
|
35402
|
-
return this._createSignedUrl(await this.getDefaultBucket(),
|
|
35402
|
+
async createSignedUrl(path3, expiresIn) {
|
|
35403
|
+
return this._createSignedUrl(await this.getDefaultBucket(), path3, expiresIn);
|
|
35403
35404
|
}
|
|
35404
35405
|
async getFileMetadata(filePath) {
|
|
35405
35406
|
return this._getFileMetadata(await this.getDefaultBucket(), filePath);
|
|
@@ -35466,7 +35467,7 @@ var FileService = class {
|
|
|
35466
35467
|
span.end();
|
|
35467
35468
|
}
|
|
35468
35469
|
}
|
|
35469
|
-
_download(bucket,
|
|
35470
|
+
_download(bucket, path3) {
|
|
35470
35471
|
const capturedAppId = this.getAppId();
|
|
35471
35472
|
const capturedRootSpan = this.requestContextService.getContext()?.requestRootSpan;
|
|
35472
35473
|
const downloadFn = /* @__PURE__ */ __name(async () => {
|
|
@@ -35486,7 +35487,7 @@ var FileService = class {
|
|
|
35486
35487
|
method: "download",
|
|
35487
35488
|
source_type: "server",
|
|
35488
35489
|
request: {
|
|
35489
|
-
path:
|
|
35490
|
+
path: path3
|
|
35490
35491
|
}
|
|
35491
35492
|
};
|
|
35492
35493
|
const startTime = Date.now();
|
|
@@ -35494,7 +35495,7 @@ var FileService = class {
|
|
|
35494
35495
|
const res = await this.fileServiceCore.downloadInner({
|
|
35495
35496
|
appId: capturedAppId,
|
|
35496
35497
|
bucketId: await bucket,
|
|
35497
|
-
filePath:
|
|
35498
|
+
filePath: path3
|
|
35498
35499
|
});
|
|
35499
35500
|
this.nestLogger.log(JSON.stringify({
|
|
35500
35501
|
...baseParams,
|
|
@@ -35613,7 +35614,7 @@ var FileService = class {
|
|
|
35613
35614
|
span.end();
|
|
35614
35615
|
}
|
|
35615
35616
|
}
|
|
35616
|
-
async _createSignedUrl(bucket,
|
|
35617
|
+
async _createSignedUrl(bucket, path3, expiresIn) {
|
|
35617
35618
|
const span = this.observable.startTrace("\u6587\u4EF6: createSignedUrl", this.requestContextService.getContext()?.requestRootSpan);
|
|
35618
35619
|
span.setAttribute("module", "file");
|
|
35619
35620
|
span.setAttribute("source_type", "platform");
|
|
@@ -35630,7 +35631,7 @@ var FileService = class {
|
|
|
35630
35631
|
method: "createSignedUrl",
|
|
35631
35632
|
source_type: "server",
|
|
35632
35633
|
request: {
|
|
35633
|
-
path:
|
|
35634
|
+
path: path3,
|
|
35634
35635
|
expiresIn
|
|
35635
35636
|
}
|
|
35636
35637
|
};
|
|
@@ -35639,7 +35640,7 @@ var FileService = class {
|
|
|
35639
35640
|
const res = await this.fileServiceCore.createSignedUrl({
|
|
35640
35641
|
appId: this.getAppId(),
|
|
35641
35642
|
bucketId: await bucket,
|
|
35642
|
-
filePath:
|
|
35643
|
+
filePath: path3,
|
|
35643
35644
|
expiresIn
|
|
35644
35645
|
});
|
|
35645
35646
|
this.nestLogger.log(JSON.stringify({
|
|
@@ -36001,10 +36002,10 @@ var Mutex = class Mutex2 {
|
|
|
36001
36002
|
this.locked = true;
|
|
36002
36003
|
return;
|
|
36003
36004
|
}
|
|
36004
|
-
return new Promise((
|
|
36005
|
+
return new Promise((resolve3) => {
|
|
36005
36006
|
this.waiting.push(() => {
|
|
36006
36007
|
this.locked = true;
|
|
36007
|
-
|
|
36008
|
+
resolve3();
|
|
36008
36009
|
});
|
|
36009
36010
|
});
|
|
36010
36011
|
}
|
|
@@ -36624,6 +36625,107 @@ function createLegacyPathRedirectMiddleware() {
|
|
|
36624
36625
|
}
|
|
36625
36626
|
__name(createLegacyPathRedirectMiddleware, "createLegacyPathRedirectMiddleware");
|
|
36626
36627
|
|
|
36628
|
+
// src/middlewares/public-assets/index.ts
|
|
36629
|
+
var fs3 = __toESM(require("fs"), 1);
|
|
36630
|
+
var path2 = __toESM(require("path"), 1);
|
|
36631
|
+
var crypto3 = __toESM(require("crypto"), 1);
|
|
36632
|
+
var MIME_TYPES2 = {
|
|
36633
|
+
".png": "image/png",
|
|
36634
|
+
".jpg": "image/jpeg",
|
|
36635
|
+
".jpeg": "image/jpeg",
|
|
36636
|
+
".gif": "image/gif",
|
|
36637
|
+
".svg": "image/svg+xml",
|
|
36638
|
+
".webp": "image/webp",
|
|
36639
|
+
".ico": "image/x-icon",
|
|
36640
|
+
".bmp": "image/bmp",
|
|
36641
|
+
".woff": "font/woff",
|
|
36642
|
+
".woff2": "font/woff2",
|
|
36643
|
+
".ttf": "font/ttf",
|
|
36644
|
+
".eot": "application/vnd.ms-fontobject",
|
|
36645
|
+
".otf": "font/otf",
|
|
36646
|
+
".json": "application/json",
|
|
36647
|
+
".xml": "application/xml",
|
|
36648
|
+
".pdf": "application/pdf",
|
|
36649
|
+
".txt": "text/plain",
|
|
36650
|
+
".html": "text/html",
|
|
36651
|
+
".css": "text/css",
|
|
36652
|
+
".js": "application/javascript",
|
|
36653
|
+
".mjs": "application/javascript",
|
|
36654
|
+
".mp3": "audio/mpeg",
|
|
36655
|
+
".mp4": "video/mp4",
|
|
36656
|
+
".webm": "video/webm",
|
|
36657
|
+
".csv": "text/csv",
|
|
36658
|
+
".md": "text/markdown",
|
|
36659
|
+
".yaml": "text/yaml",
|
|
36660
|
+
".yml": "text/yaml"
|
|
36661
|
+
};
|
|
36662
|
+
function getMimeType2(filePath) {
|
|
36663
|
+
return MIME_TYPES2[path2.extname(filePath).toLowerCase()] || "application/octet-stream";
|
|
36664
|
+
}
|
|
36665
|
+
__name(getMimeType2, "getMimeType");
|
|
36666
|
+
function generateETag2(stat) {
|
|
36667
|
+
return `"${crypto3.createHash("md5").update(`${stat.mtime.getTime()}-${stat.size}`).digest("hex")}"`;
|
|
36668
|
+
}
|
|
36669
|
+
__name(generateETag2, "generateETag");
|
|
36670
|
+
var PLATFORM_PREFIXES = [
|
|
36671
|
+
"api/",
|
|
36672
|
+
"openapi/",
|
|
36673
|
+
"__innerapi__/",
|
|
36674
|
+
"__runtime__/",
|
|
36675
|
+
"static/",
|
|
36676
|
+
"dev/"
|
|
36677
|
+
];
|
|
36678
|
+
function stripBasePath2(pathname, basePath) {
|
|
36679
|
+
let rel = pathname;
|
|
36680
|
+
if (basePath && rel.startsWith(basePath)) {
|
|
36681
|
+
rel = rel.slice(basePath.length);
|
|
36682
|
+
}
|
|
36683
|
+
return rel.replace(/^\/+/, "");
|
|
36684
|
+
}
|
|
36685
|
+
__name(stripBasePath2, "stripBasePath");
|
|
36686
|
+
function createPublicAssetsMiddleware() {
|
|
36687
|
+
const publicDir = path2.resolve(process.cwd(), "public");
|
|
36688
|
+
const basePath = (process.env.CLIENT_BASE_PATH ?? "").replace(/\/+$/, "");
|
|
36689
|
+
return /* @__PURE__ */ __name(function publicAssetsMiddleware(req, res, next) {
|
|
36690
|
+
if (req.method !== "GET" && req.method !== "HEAD") return next();
|
|
36691
|
+
const rel = stripBasePath2(req.path, basePath);
|
|
36692
|
+
if (!rel) return next();
|
|
36693
|
+
if (PLATFORM_PREFIXES.some((p) => rel === p.slice(0, -1) || rel.startsWith(p))) {
|
|
36694
|
+
return next();
|
|
36695
|
+
}
|
|
36696
|
+
const filePath = path2.normalize(path2.join(publicDir, rel));
|
|
36697
|
+
if (filePath !== publicDir && !filePath.startsWith(publicDir + path2.sep)) {
|
|
36698
|
+
return next();
|
|
36699
|
+
}
|
|
36700
|
+
let stat;
|
|
36701
|
+
try {
|
|
36702
|
+
stat = fs3.statSync(filePath);
|
|
36703
|
+
} catch {
|
|
36704
|
+
return next();
|
|
36705
|
+
}
|
|
36706
|
+
if (!stat.isFile()) return next();
|
|
36707
|
+
const etag = generateETag2(stat);
|
|
36708
|
+
if (req.headers["if-none-match"] === etag) {
|
|
36709
|
+
res.status(304).end();
|
|
36710
|
+
return;
|
|
36711
|
+
}
|
|
36712
|
+
res.setHeader("Content-Type", getMimeType2(filePath));
|
|
36713
|
+
res.setHeader("Content-Length", stat.size);
|
|
36714
|
+
res.setHeader("ETag", etag);
|
|
36715
|
+
res.setHeader("Cache-Control", "public, max-age=0, must-revalidate");
|
|
36716
|
+
if (req.method === "HEAD") {
|
|
36717
|
+
res.end();
|
|
36718
|
+
return;
|
|
36719
|
+
}
|
|
36720
|
+
const stream = fs3.createReadStream(filePath);
|
|
36721
|
+
stream.on("error", () => {
|
|
36722
|
+
if (!res.headersSent) res.status(500).end();
|
|
36723
|
+
});
|
|
36724
|
+
stream.pipe(res);
|
|
36725
|
+
}, "publicAssetsMiddleware");
|
|
36726
|
+
}
|
|
36727
|
+
__name(createPublicAssetsMiddleware, "createPublicAssetsMiddleware");
|
|
36728
|
+
|
|
36627
36729
|
// src/setup.ts
|
|
36628
36730
|
var DEFAULT_BODY_LIMIT = "1mb";
|
|
36629
36731
|
var defaultPerms = {
|
|
@@ -36642,6 +36744,7 @@ async function configureApp(app, perms = defaultPerms) {
|
|
|
36642
36744
|
}));
|
|
36643
36745
|
app.use((0, import_cookie_parser.default)());
|
|
36644
36746
|
app.use(createLegacyPathRedirectMiddleware());
|
|
36747
|
+
app.use(createPublicAssetsMiddleware());
|
|
36645
36748
|
const globalPrefix = process.env.CLIENT_BASE_PATH ?? "";
|
|
36646
36749
|
app.setGlobalPrefix(globalPrefix);
|
|
36647
36750
|
app.set("trust proxy", true);
|
|
@@ -36692,6 +36795,7 @@ var import_nestjs_authzpaas2 = require("@lark-apaas/nestjs-authzpaas");
|
|
|
36692
36795
|
ViewContextMiddleware,
|
|
36693
36796
|
configureApp,
|
|
36694
36797
|
createLegacyPathRedirectMiddleware,
|
|
36798
|
+
createPublicAssetsMiddleware,
|
|
36695
36799
|
safeEscape,
|
|
36696
36800
|
safeEscapeDeep,
|
|
36697
36801
|
safeStringParse,
|