@lark-apaas/fullstack-nestjs-core 1.1.22-beta.6 → 1.1.22-beta.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/index.cjs +444 -226
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +441 -224
- package/package.json +7 -7
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 fs2 = require("fs");
|
|
1375
|
+
stream2 = new fs2.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(resolve2, reject) {
|
|
5032
5032
|
readStream(stream, encoding, length, limit, /* @__PURE__ */ __name(function onRead(err, buf) {
|
|
5033
5033
|
if (err) return reject(err);
|
|
5034
|
-
|
|
5034
|
+
resolve2(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 extname2 = 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(path2) {
|
|
14219
|
+
if (!path2 || typeof path2 !== "string") {
|
|
14220
14220
|
return false;
|
|
14221
14221
|
}
|
|
14222
|
-
var extension2 =
|
|
14222
|
+
var extension2 = extname2("x." + path2).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 = normalize2;
|
|
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(normalize2(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 normalize2(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(normalize2, "normalize");
|
|
14331
14331
|
function mimeMatch(expected, actual) {
|
|
14332
14332
|
if (expected === false) {
|
|
14333
14333
|
return false;
|
|
@@ -18039,8 +18039,8 @@ var require_node2 = __commonJS({
|
|
|
18039
18039
|
}
|
|
18040
18040
|
break;
|
|
18041
18041
|
case "FILE":
|
|
18042
|
-
var
|
|
18043
|
-
stream2 = new
|
|
18042
|
+
var fs2 = require("fs");
|
|
18043
|
+
stream2 = new fs2.SyncWriteStream(fd2, {
|
|
18044
18044
|
autoClose: false
|
|
18045
18045
|
});
|
|
18046
18046
|
stream2._type = "fs";
|
|
@@ -18809,8 +18809,8 @@ var require_node3 = __commonJS({
|
|
|
18809
18809
|
}
|
|
18810
18810
|
break;
|
|
18811
18811
|
case "FILE":
|
|
18812
|
-
var
|
|
18813
|
-
stream2 = new
|
|
18812
|
+
var fs2 = require("fs");
|
|
18813
|
+
stream2 = new fs2.SyncWriteStream(fd2, {
|
|
18814
18814
|
autoClose: false
|
|
18815
18815
|
});
|
|
18816
18816
|
stream2._type = "fs";
|
|
@@ -18907,7 +18907,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18907
18907
|
"use strict";
|
|
18908
18908
|
module2.exports = pathToRegexp;
|
|
18909
18909
|
var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
|
|
18910
|
-
function pathToRegexp(
|
|
18910
|
+
function pathToRegexp(path2, keys, options) {
|
|
18911
18911
|
options = options || {};
|
|
18912
18912
|
keys = keys || [];
|
|
18913
18913
|
var strict = options.strict;
|
|
@@ -18921,8 +18921,8 @@ var require_path_to_regexp = __commonJS({
|
|
|
18921
18921
|
var pos = 0;
|
|
18922
18922
|
var backtrack = "";
|
|
18923
18923
|
var m;
|
|
18924
|
-
if (
|
|
18925
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
18924
|
+
if (path2 instanceof RegExp) {
|
|
18925
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path2.source)) {
|
|
18926
18926
|
if (m[0][0] === "\\") continue;
|
|
18927
18927
|
keys.push({
|
|
18928
18928
|
name: m[1] || name++,
|
|
@@ -18930,18 +18930,18 @@ var require_path_to_regexp = __commonJS({
|
|
|
18930
18930
|
offset: m.index
|
|
18931
18931
|
});
|
|
18932
18932
|
}
|
|
18933
|
-
return
|
|
18933
|
+
return path2;
|
|
18934
18934
|
}
|
|
18935
|
-
if (Array.isArray(
|
|
18936
|
-
|
|
18935
|
+
if (Array.isArray(path2)) {
|
|
18936
|
+
path2 = path2.map(function(value) {
|
|
18937
18937
|
return pathToRegexp(value, keys, options).source;
|
|
18938
18938
|
});
|
|
18939
|
-
return new RegExp(
|
|
18939
|
+
return new RegExp(path2.join("|"), flags);
|
|
18940
18940
|
}
|
|
18941
|
-
if (typeof
|
|
18941
|
+
if (typeof path2 !== "string") {
|
|
18942
18942
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
18943
18943
|
}
|
|
18944
|
-
|
|
18944
|
+
path2 = path2.replace(/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g, function(match, slash, format, key, capture, star, optional, offset) {
|
|
18945
18945
|
if (match[0] === "\\") {
|
|
18946
18946
|
backtrack += match;
|
|
18947
18947
|
pos += 2;
|
|
@@ -18956,7 +18956,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18956
18956
|
if (slash || format) {
|
|
18957
18957
|
backtrack = "";
|
|
18958
18958
|
} else {
|
|
18959
|
-
backtrack +=
|
|
18959
|
+
backtrack += path2.slice(pos, offset);
|
|
18960
18960
|
}
|
|
18961
18961
|
pos = offset + match.length;
|
|
18962
18962
|
if (match === "*") {
|
|
@@ -18983,7 +18983,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18983
18983
|
extraOffset += result.length - match.length;
|
|
18984
18984
|
return result;
|
|
18985
18985
|
});
|
|
18986
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
18986
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path2)) {
|
|
18987
18987
|
if (m[0][0] === "\\") continue;
|
|
18988
18988
|
if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
|
|
18989
18989
|
keys.splice(keysOffset + i, 0, {
|
|
@@ -18994,13 +18994,13 @@ var require_path_to_regexp = __commonJS({
|
|
|
18994
18994
|
}
|
|
18995
18995
|
i++;
|
|
18996
18996
|
}
|
|
18997
|
-
|
|
18997
|
+
path2 += strict ? "" : path2[path2.length - 1] === "/" ? "?" : "/?";
|
|
18998
18998
|
if (end) {
|
|
18999
|
-
|
|
19000
|
-
} else if (
|
|
19001
|
-
|
|
18999
|
+
path2 += "$";
|
|
19000
|
+
} else if (path2[path2.length - 1] !== "/") {
|
|
19001
|
+
path2 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
19002
19002
|
}
|
|
19003
|
-
return new RegExp("^" +
|
|
19003
|
+
return new RegExp("^" + path2, flags);
|
|
19004
19004
|
}
|
|
19005
19005
|
__name(pathToRegexp, "pathToRegexp");
|
|
19006
19006
|
}
|
|
@@ -19014,19 +19014,19 @@ var require_layer = __commonJS({
|
|
|
19014
19014
|
var debug = require_src3()("express:router:layer");
|
|
19015
19015
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
19016
19016
|
module2.exports = Layer;
|
|
19017
|
-
function Layer(
|
|
19017
|
+
function Layer(path2, options, fn) {
|
|
19018
19018
|
if (!(this instanceof Layer)) {
|
|
19019
|
-
return new Layer(
|
|
19019
|
+
return new Layer(path2, options, fn);
|
|
19020
19020
|
}
|
|
19021
|
-
debug("new %o",
|
|
19021
|
+
debug("new %o", path2);
|
|
19022
19022
|
var opts = options || {};
|
|
19023
19023
|
this.handle = fn;
|
|
19024
19024
|
this.name = fn.name || "<anonymous>";
|
|
19025
19025
|
this.params = void 0;
|
|
19026
19026
|
this.path = void 0;
|
|
19027
|
-
this.regexp = pathRegexp(
|
|
19028
|
-
this.regexp.fast_star =
|
|
19029
|
-
this.regexp.fast_slash =
|
|
19027
|
+
this.regexp = pathRegexp(path2, this.keys = [], opts);
|
|
19028
|
+
this.regexp.fast_star = path2 === "*";
|
|
19029
|
+
this.regexp.fast_slash = path2 === "/" && opts.end === false;
|
|
19030
19030
|
}
|
|
19031
19031
|
__name(Layer, "Layer");
|
|
19032
19032
|
Layer.prototype.handle_error = /* @__PURE__ */ __name(function handle_error(error, req, res, next) {
|
|
@@ -19051,9 +19051,9 @@ var require_layer = __commonJS({
|
|
|
19051
19051
|
next(err);
|
|
19052
19052
|
}
|
|
19053
19053
|
}, "handle");
|
|
19054
|
-
Layer.prototype.match = /* @__PURE__ */ __name(function match(
|
|
19054
|
+
Layer.prototype.match = /* @__PURE__ */ __name(function match(path2) {
|
|
19055
19055
|
var match2;
|
|
19056
|
-
if (
|
|
19056
|
+
if (path2 != null) {
|
|
19057
19057
|
if (this.regexp.fast_slash) {
|
|
19058
19058
|
this.params = {};
|
|
19059
19059
|
this.path = "";
|
|
@@ -19061,12 +19061,12 @@ var require_layer = __commonJS({
|
|
|
19061
19061
|
}
|
|
19062
19062
|
if (this.regexp.fast_star) {
|
|
19063
19063
|
this.params = {
|
|
19064
|
-
"0": decode_param(
|
|
19064
|
+
"0": decode_param(path2)
|
|
19065
19065
|
};
|
|
19066
|
-
this.path =
|
|
19066
|
+
this.path = path2;
|
|
19067
19067
|
return true;
|
|
19068
19068
|
}
|
|
19069
|
-
match2 = this.regexp.exec(
|
|
19069
|
+
match2 = this.regexp.exec(path2);
|
|
19070
19070
|
}
|
|
19071
19071
|
if (!match2) {
|
|
19072
19072
|
this.params = void 0;
|
|
@@ -19162,10 +19162,10 @@ var require_route = __commonJS({
|
|
|
19162
19162
|
var slice = Array.prototype.slice;
|
|
19163
19163
|
var toString = Object.prototype.toString;
|
|
19164
19164
|
module2.exports = Route;
|
|
19165
|
-
function Route(
|
|
19166
|
-
this.path =
|
|
19165
|
+
function Route(path2) {
|
|
19166
|
+
this.path = path2;
|
|
19167
19167
|
this.stack = [];
|
|
19168
|
-
debug("new %o",
|
|
19168
|
+
debug("new %o", path2);
|
|
19169
19169
|
this.methods = {};
|
|
19170
19170
|
}
|
|
19171
19171
|
__name(Route, "Route");
|
|
@@ -19381,8 +19381,8 @@ var require_router = __commonJS({
|
|
|
19381
19381
|
if (++sync > 100) {
|
|
19382
19382
|
return setImmediate(next, err);
|
|
19383
19383
|
}
|
|
19384
|
-
var
|
|
19385
|
-
if (
|
|
19384
|
+
var path2 = getPathname(req);
|
|
19385
|
+
if (path2 == null) {
|
|
19386
19386
|
return done(layerError);
|
|
19387
19387
|
}
|
|
19388
19388
|
var layer;
|
|
@@ -19390,7 +19390,7 @@ var require_router = __commonJS({
|
|
|
19390
19390
|
var route;
|
|
19391
19391
|
while (match !== true && idx < stack.length) {
|
|
19392
19392
|
layer = stack[idx++];
|
|
19393
|
-
match = matchLayer(layer,
|
|
19393
|
+
match = matchLayer(layer, path2);
|
|
19394
19394
|
route = layer.route;
|
|
19395
19395
|
if (typeof match !== "boolean") {
|
|
19396
19396
|
layerError = layerError || match;
|
|
@@ -19428,19 +19428,19 @@ var require_router = __commonJS({
|
|
|
19428
19428
|
} else if (route) {
|
|
19429
19429
|
layer.handle_request(req, res, next);
|
|
19430
19430
|
} else {
|
|
19431
|
-
trim_prefix(layer, layerError, layerPath,
|
|
19431
|
+
trim_prefix(layer, layerError, layerPath, path2);
|
|
19432
19432
|
}
|
|
19433
19433
|
sync = 0;
|
|
19434
19434
|
});
|
|
19435
19435
|
}
|
|
19436
19436
|
__name(next, "next");
|
|
19437
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
19437
|
+
function trim_prefix(layer, layerError, layerPath, path2) {
|
|
19438
19438
|
if (layerPath.length !== 0) {
|
|
19439
|
-
if (layerPath !==
|
|
19439
|
+
if (layerPath !== path2.slice(0, layerPath.length)) {
|
|
19440
19440
|
next(layerError);
|
|
19441
19441
|
return;
|
|
19442
19442
|
}
|
|
19443
|
-
var c =
|
|
19443
|
+
var c = path2[layerPath.length];
|
|
19444
19444
|
if (c && c !== "/" && c !== ".") return next(layerError);
|
|
19445
19445
|
debug("trim prefix (%s) from url %s", layerPath, req.url);
|
|
19446
19446
|
removed = layerPath;
|
|
@@ -19521,7 +19521,7 @@ var require_router = __commonJS({
|
|
|
19521
19521
|
}, "process_params");
|
|
19522
19522
|
proto.use = /* @__PURE__ */ __name(function use(fn) {
|
|
19523
19523
|
var offset = 0;
|
|
19524
|
-
var
|
|
19524
|
+
var path2 = "/";
|
|
19525
19525
|
if (typeof fn !== "function") {
|
|
19526
19526
|
var arg = fn;
|
|
19527
19527
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -19529,7 +19529,7 @@ var require_router = __commonJS({
|
|
|
19529
19529
|
}
|
|
19530
19530
|
if (typeof arg !== "function") {
|
|
19531
19531
|
offset = 1;
|
|
19532
|
-
|
|
19532
|
+
path2 = fn;
|
|
19533
19533
|
}
|
|
19534
19534
|
}
|
|
19535
19535
|
var callbacks = flatten(slice.call(arguments, offset));
|
|
@@ -19541,8 +19541,8 @@ var require_router = __commonJS({
|
|
|
19541
19541
|
if (typeof fn !== "function") {
|
|
19542
19542
|
throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
|
|
19543
19543
|
}
|
|
19544
|
-
debug("use %o %s",
|
|
19545
|
-
var layer = new Layer(
|
|
19544
|
+
debug("use %o %s", path2, fn.name || "<anonymous>");
|
|
19545
|
+
var layer = new Layer(path2, {
|
|
19546
19546
|
sensitive: this.caseSensitive,
|
|
19547
19547
|
strict: false,
|
|
19548
19548
|
end: false
|
|
@@ -19552,9 +19552,9 @@ var require_router = __commonJS({
|
|
|
19552
19552
|
}
|
|
19553
19553
|
return this;
|
|
19554
19554
|
}, "use");
|
|
19555
|
-
proto.route = /* @__PURE__ */ __name(function route(
|
|
19556
|
-
var route2 = new Route(
|
|
19557
|
-
var layer = new Layer(
|
|
19555
|
+
proto.route = /* @__PURE__ */ __name(function route(path2) {
|
|
19556
|
+
var route2 = new Route(path2);
|
|
19557
|
+
var layer = new Layer(path2, {
|
|
19558
19558
|
sensitive: this.caseSensitive,
|
|
19559
19559
|
strict: this.strict,
|
|
19560
19560
|
end: true
|
|
@@ -19564,8 +19564,8 @@ var require_router = __commonJS({
|
|
|
19564
19564
|
return route2;
|
|
19565
19565
|
}, "route");
|
|
19566
19566
|
methods.concat("all").forEach(function(method) {
|
|
19567
|
-
proto[method] = function(
|
|
19568
|
-
var route = this.route(
|
|
19567
|
+
proto[method] = function(path2) {
|
|
19568
|
+
var route = this.route(path2);
|
|
19569
19569
|
route[method].apply(route, slice.call(arguments, 1));
|
|
19570
19570
|
return this;
|
|
19571
19571
|
};
|
|
@@ -19605,9 +19605,9 @@ var require_router = __commonJS({
|
|
|
19605
19605
|
return toString.call(obj).replace(objectRegExp, "$1");
|
|
19606
19606
|
}
|
|
19607
19607
|
__name(gettype, "gettype");
|
|
19608
|
-
function matchLayer(layer,
|
|
19608
|
+
function matchLayer(layer, path2) {
|
|
19609
19609
|
try {
|
|
19610
|
-
return layer.match(
|
|
19610
|
+
return layer.match(path2);
|
|
19611
19611
|
} catch (err) {
|
|
19612
19612
|
return err;
|
|
19613
19613
|
}
|
|
@@ -19730,18 +19730,18 @@ var require_view = __commonJS({
|
|
|
19730
19730
|
"../../../node_modules/express/lib/view.js"(exports2, module2) {
|
|
19731
19731
|
"use strict";
|
|
19732
19732
|
var debug = require_src3()("express:view");
|
|
19733
|
-
var
|
|
19734
|
-
var
|
|
19735
|
-
var dirname =
|
|
19736
|
-
var basename =
|
|
19737
|
-
var
|
|
19738
|
-
var
|
|
19739
|
-
var
|
|
19733
|
+
var path2 = require("path");
|
|
19734
|
+
var fs2 = require("fs");
|
|
19735
|
+
var dirname = path2.dirname;
|
|
19736
|
+
var basename = path2.basename;
|
|
19737
|
+
var extname2 = path2.extname;
|
|
19738
|
+
var join2 = path2.join;
|
|
19739
|
+
var resolve2 = path2.resolve;
|
|
19740
19740
|
module2.exports = View;
|
|
19741
19741
|
function View(name, options) {
|
|
19742
19742
|
var opts = options || {};
|
|
19743
19743
|
this.defaultEngine = opts.defaultEngine;
|
|
19744
|
-
this.ext =
|
|
19744
|
+
this.ext = extname2(name);
|
|
19745
19745
|
this.name = name;
|
|
19746
19746
|
this.root = opts.root;
|
|
19747
19747
|
if (!this.ext && !this.defaultEngine) {
|
|
@@ -19766,39 +19766,39 @@ var require_view = __commonJS({
|
|
|
19766
19766
|
}
|
|
19767
19767
|
__name(View, "View");
|
|
19768
19768
|
View.prototype.lookup = /* @__PURE__ */ __name(function lookup(name) {
|
|
19769
|
-
var
|
|
19769
|
+
var path3;
|
|
19770
19770
|
var roots = [].concat(this.root);
|
|
19771
19771
|
debug('lookup "%s"', name);
|
|
19772
|
-
for (var i = 0; i < roots.length && !
|
|
19772
|
+
for (var i = 0; i < roots.length && !path3; i++) {
|
|
19773
19773
|
var root = roots[i];
|
|
19774
|
-
var loc =
|
|
19774
|
+
var loc = resolve2(root, name);
|
|
19775
19775
|
var dir = dirname(loc);
|
|
19776
19776
|
var file = basename(loc);
|
|
19777
|
-
|
|
19777
|
+
path3 = this.resolve(dir, file);
|
|
19778
19778
|
}
|
|
19779
|
-
return
|
|
19779
|
+
return path3;
|
|
19780
19780
|
}, "lookup");
|
|
19781
19781
|
View.prototype.render = /* @__PURE__ */ __name(function render(options, callback) {
|
|
19782
19782
|
debug('render "%s"', this.path);
|
|
19783
19783
|
this.engine(this.path, options, callback);
|
|
19784
19784
|
}, "render");
|
|
19785
|
-
View.prototype.resolve = /* @__PURE__ */ __name(function
|
|
19785
|
+
View.prototype.resolve = /* @__PURE__ */ __name(function resolve3(dir, file) {
|
|
19786
19786
|
var ext = this.ext;
|
|
19787
|
-
var
|
|
19788
|
-
var stat = tryStat(
|
|
19787
|
+
var path3 = join2(dir, file);
|
|
19788
|
+
var stat = tryStat(path3);
|
|
19789
19789
|
if (stat && stat.isFile()) {
|
|
19790
|
-
return
|
|
19790
|
+
return path3;
|
|
19791
19791
|
}
|
|
19792
|
-
|
|
19793
|
-
stat = tryStat(
|
|
19792
|
+
path3 = join2(dir, basename(file, ext), "index" + ext);
|
|
19793
|
+
stat = tryStat(path3);
|
|
19794
19794
|
if (stat && stat.isFile()) {
|
|
19795
|
-
return
|
|
19795
|
+
return path3;
|
|
19796
19796
|
}
|
|
19797
19797
|
}, "resolve");
|
|
19798
|
-
function tryStat(
|
|
19799
|
-
debug('stat "%s"',
|
|
19798
|
+
function tryStat(path3) {
|
|
19799
|
+
debug('stat "%s"', path3);
|
|
19800
19800
|
try {
|
|
19801
|
-
return
|
|
19801
|
+
return fs2.statSync(path3);
|
|
19802
19802
|
} catch (e) {
|
|
19803
19803
|
return void 0;
|
|
19804
19804
|
}
|
|
@@ -20447,8 +20447,8 @@ var require_node4 = __commonJS({
|
|
|
20447
20447
|
}
|
|
20448
20448
|
break;
|
|
20449
20449
|
case "FILE":
|
|
20450
|
-
var
|
|
20451
|
-
stream2 = new
|
|
20450
|
+
var fs2 = require("fs");
|
|
20451
|
+
stream2 = new fs2.SyncWriteStream(fd2, {
|
|
20452
20452
|
autoClose: false
|
|
20453
20453
|
});
|
|
20454
20454
|
stream2._type = "fs";
|
|
@@ -20505,14 +20505,14 @@ var require_etag = __commonJS({
|
|
|
20505
20505
|
"../../../node_modules/etag/index.js"(exports2, module2) {
|
|
20506
20506
|
"use strict";
|
|
20507
20507
|
module2.exports = etag;
|
|
20508
|
-
var
|
|
20508
|
+
var crypto3 = require("crypto");
|
|
20509
20509
|
var Stats = require("fs").Stats;
|
|
20510
20510
|
var toString = Object.prototype.toString;
|
|
20511
20511
|
function entitytag(entity) {
|
|
20512
20512
|
if (entity.length === 0) {
|
|
20513
20513
|
return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
|
|
20514
20514
|
}
|
|
20515
|
-
var hash =
|
|
20515
|
+
var hash = crypto3.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
|
|
20516
20516
|
var len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
|
|
20517
20517
|
return '"' + len.toString(16) + "-" + hash + '"';
|
|
20518
20518
|
}
|
|
@@ -20633,8 +20633,8 @@ var require_types = __commonJS({
|
|
|
20633
20633
|
var require_mime = __commonJS({
|
|
20634
20634
|
"../../../node_modules/mime/mime.js"(exports2, module2) {
|
|
20635
20635
|
"use strict";
|
|
20636
|
-
var
|
|
20637
|
-
var
|
|
20636
|
+
var path2 = require("path");
|
|
20637
|
+
var fs2 = require("fs");
|
|
20638
20638
|
function Mime() {
|
|
20639
20639
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
20640
20640
|
this.extensions = /* @__PURE__ */ Object.create(null);
|
|
@@ -20656,7 +20656,7 @@ var require_mime = __commonJS({
|
|
|
20656
20656
|
};
|
|
20657
20657
|
Mime.prototype.load = function(file) {
|
|
20658
20658
|
this._loading = file;
|
|
20659
|
-
var map = {}, content =
|
|
20659
|
+
var map = {}, content = fs2.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
|
|
20660
20660
|
lines.forEach(function(line) {
|
|
20661
20661
|
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
|
|
20662
20662
|
map[fields.shift()] = fields;
|
|
@@ -20664,8 +20664,8 @@ var require_mime = __commonJS({
|
|
|
20664
20664
|
this.define(map);
|
|
20665
20665
|
this._loading = null;
|
|
20666
20666
|
};
|
|
20667
|
-
Mime.prototype.lookup = function(
|
|
20668
|
-
var ext =
|
|
20667
|
+
Mime.prototype.lookup = function(path3, fallback) {
|
|
20668
|
+
var ext = path3.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
20669
20669
|
return this.types[ext] || fallback || this.default_type;
|
|
20670
20670
|
};
|
|
20671
20671
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -20901,34 +20901,34 @@ var require_send = __commonJS({
|
|
|
20901
20901
|
var escapeHtml = require_escape_html();
|
|
20902
20902
|
var etag = require_etag();
|
|
20903
20903
|
var fresh = require_fresh();
|
|
20904
|
-
var
|
|
20904
|
+
var fs2 = require("fs");
|
|
20905
20905
|
var mime = require_mime();
|
|
20906
20906
|
var ms = require_ms5();
|
|
20907
20907
|
var onFinished = require_on_finished();
|
|
20908
20908
|
var parseRange = require_range_parser();
|
|
20909
|
-
var
|
|
20909
|
+
var path2 = require("path");
|
|
20910
20910
|
var statuses = require_statuses();
|
|
20911
20911
|
var Stream = require("stream");
|
|
20912
20912
|
var util = require("util");
|
|
20913
|
-
var
|
|
20914
|
-
var
|
|
20915
|
-
var
|
|
20916
|
-
var
|
|
20917
|
-
var sep =
|
|
20913
|
+
var extname2 = path2.extname;
|
|
20914
|
+
var join2 = path2.join;
|
|
20915
|
+
var normalize2 = path2.normalize;
|
|
20916
|
+
var resolve2 = path2.resolve;
|
|
20917
|
+
var sep = path2.sep;
|
|
20918
20918
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
20919
20919
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
20920
20920
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
20921
20921
|
module2.exports = send;
|
|
20922
20922
|
module2.exports.mime = mime;
|
|
20923
|
-
function send(req,
|
|
20924
|
-
return new SendStream(req,
|
|
20923
|
+
function send(req, path3, options) {
|
|
20924
|
+
return new SendStream(req, path3, options);
|
|
20925
20925
|
}
|
|
20926
20926
|
__name(send, "send");
|
|
20927
|
-
function SendStream(req,
|
|
20927
|
+
function SendStream(req, path3, options) {
|
|
20928
20928
|
Stream.call(this);
|
|
20929
20929
|
var opts = options || {};
|
|
20930
20930
|
this.options = opts;
|
|
20931
|
-
this.path =
|
|
20931
|
+
this.path = path3;
|
|
20932
20932
|
this.req = req;
|
|
20933
20933
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
20934
20934
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -20953,7 +20953,7 @@ var require_send = __commonJS({
|
|
|
20953
20953
|
this._maxage = opts.maxAge || opts.maxage;
|
|
20954
20954
|
this._maxage = typeof this._maxage === "string" ? ms(this._maxage) : Number(this._maxage);
|
|
20955
20955
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
20956
|
-
this._root = opts.root ?
|
|
20956
|
+
this._root = opts.root ? resolve2(opts.root) : null;
|
|
20957
20957
|
if (!this._root && opts.from) {
|
|
20958
20958
|
this.from(opts.from);
|
|
20959
20959
|
}
|
|
@@ -20977,8 +20977,8 @@ var require_send = __commonJS({
|
|
|
20977
20977
|
this._index = index2;
|
|
20978
20978
|
return this;
|
|
20979
20979
|
}, "index"), "send.index: pass index as option");
|
|
20980
|
-
SendStream.prototype.root = /* @__PURE__ */ __name(function root(
|
|
20981
|
-
this._root =
|
|
20980
|
+
SendStream.prototype.root = /* @__PURE__ */ __name(function root(path3) {
|
|
20981
|
+
this._root = resolve2(String(path3));
|
|
20982
20982
|
debug("root %s", this._root);
|
|
20983
20983
|
return this;
|
|
20984
20984
|
}, "root");
|
|
@@ -21085,10 +21085,10 @@ var require_send = __commonJS({
|
|
|
21085
21085
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
21086
21086
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
21087
21087
|
}, "isRangeFresh");
|
|
21088
|
-
SendStream.prototype.redirect = /* @__PURE__ */ __name(function redirect(
|
|
21088
|
+
SendStream.prototype.redirect = /* @__PURE__ */ __name(function redirect(path3) {
|
|
21089
21089
|
var res = this.res;
|
|
21090
21090
|
if (hasListeners(this, "directory")) {
|
|
21091
|
-
this.emit("directory", res,
|
|
21091
|
+
this.emit("directory", res, path3);
|
|
21092
21092
|
return;
|
|
21093
21093
|
}
|
|
21094
21094
|
if (this.hasTrailingSlash()) {
|
|
@@ -21108,42 +21108,42 @@ var require_send = __commonJS({
|
|
|
21108
21108
|
SendStream.prototype.pipe = /* @__PURE__ */ __name(function pipe(res) {
|
|
21109
21109
|
var root = this._root;
|
|
21110
21110
|
this.res = res;
|
|
21111
|
-
var
|
|
21112
|
-
if (
|
|
21111
|
+
var path3 = decode(this.path);
|
|
21112
|
+
if (path3 === -1) {
|
|
21113
21113
|
this.error(400);
|
|
21114
21114
|
return res;
|
|
21115
21115
|
}
|
|
21116
|
-
if (~
|
|
21116
|
+
if (~path3.indexOf("\0")) {
|
|
21117
21117
|
this.error(400);
|
|
21118
21118
|
return res;
|
|
21119
21119
|
}
|
|
21120
21120
|
var parts;
|
|
21121
21121
|
if (root !== null) {
|
|
21122
|
-
if (
|
|
21123
|
-
|
|
21122
|
+
if (path3) {
|
|
21123
|
+
path3 = normalize2("." + sep + path3);
|
|
21124
21124
|
}
|
|
21125
|
-
if (UP_PATH_REGEXP.test(
|
|
21126
|
-
debug('malicious path "%s"',
|
|
21125
|
+
if (UP_PATH_REGEXP.test(path3)) {
|
|
21126
|
+
debug('malicious path "%s"', path3);
|
|
21127
21127
|
this.error(403);
|
|
21128
21128
|
return res;
|
|
21129
21129
|
}
|
|
21130
|
-
parts =
|
|
21131
|
-
|
|
21130
|
+
parts = path3.split(sep);
|
|
21131
|
+
path3 = normalize2(join2(root, path3));
|
|
21132
21132
|
} else {
|
|
21133
|
-
if (UP_PATH_REGEXP.test(
|
|
21134
|
-
debug('malicious path "%s"',
|
|
21133
|
+
if (UP_PATH_REGEXP.test(path3)) {
|
|
21134
|
+
debug('malicious path "%s"', path3);
|
|
21135
21135
|
this.error(403);
|
|
21136
21136
|
return res;
|
|
21137
21137
|
}
|
|
21138
|
-
parts =
|
|
21139
|
-
|
|
21138
|
+
parts = normalize2(path3).split(sep);
|
|
21139
|
+
path3 = resolve2(path3);
|
|
21140
21140
|
}
|
|
21141
21141
|
if (containsDotFile(parts)) {
|
|
21142
21142
|
var access = this._dotfiles;
|
|
21143
21143
|
if (access === void 0) {
|
|
21144
21144
|
access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
|
|
21145
21145
|
}
|
|
21146
|
-
debug('%s dotfile "%s"', access,
|
|
21146
|
+
debug('%s dotfile "%s"', access, path3);
|
|
21147
21147
|
switch (access) {
|
|
21148
21148
|
case "allow":
|
|
21149
21149
|
break;
|
|
@@ -21157,13 +21157,13 @@ var require_send = __commonJS({
|
|
|
21157
21157
|
}
|
|
21158
21158
|
}
|
|
21159
21159
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
21160
|
-
this.sendIndex(
|
|
21160
|
+
this.sendIndex(path3);
|
|
21161
21161
|
return res;
|
|
21162
21162
|
}
|
|
21163
|
-
this.sendFile(
|
|
21163
|
+
this.sendFile(path3);
|
|
21164
21164
|
return res;
|
|
21165
21165
|
}, "pipe");
|
|
21166
|
-
SendStream.prototype.send = /* @__PURE__ */ __name(function send2(
|
|
21166
|
+
SendStream.prototype.send = /* @__PURE__ */ __name(function send2(path3, stat) {
|
|
21167
21167
|
var len = stat.size;
|
|
21168
21168
|
var options = this.options;
|
|
21169
21169
|
var opts = {};
|
|
@@ -21175,9 +21175,9 @@ var require_send = __commonJS({
|
|
|
21175
21175
|
this.headersAlreadySent();
|
|
21176
21176
|
return;
|
|
21177
21177
|
}
|
|
21178
|
-
debug('pipe "%s"',
|
|
21179
|
-
this.setHeader(
|
|
21180
|
-
this.type(
|
|
21178
|
+
debug('pipe "%s"', path3);
|
|
21179
|
+
this.setHeader(path3, stat);
|
|
21180
|
+
this.type(path3);
|
|
21181
21181
|
if (this.isConditionalGET()) {
|
|
21182
21182
|
if (this.isPreconditionFailure()) {
|
|
21183
21183
|
this.error(412);
|
|
@@ -21228,28 +21228,28 @@ var require_send = __commonJS({
|
|
|
21228
21228
|
res.end();
|
|
21229
21229
|
return;
|
|
21230
21230
|
}
|
|
21231
|
-
this.stream(
|
|
21231
|
+
this.stream(path3, opts);
|
|
21232
21232
|
}, "send");
|
|
21233
|
-
SendStream.prototype.sendFile = /* @__PURE__ */ __name(function sendFile(
|
|
21233
|
+
SendStream.prototype.sendFile = /* @__PURE__ */ __name(function sendFile(path3) {
|
|
21234
21234
|
var i = 0;
|
|
21235
21235
|
var self = this;
|
|
21236
|
-
debug('stat "%s"',
|
|
21237
|
-
|
|
21238
|
-
if (err && err.code === "ENOENT" && !
|
|
21236
|
+
debug('stat "%s"', path3);
|
|
21237
|
+
fs2.stat(path3, /* @__PURE__ */ __name(function onstat(err, stat) {
|
|
21238
|
+
if (err && err.code === "ENOENT" && !extname2(path3) && path3[path3.length - 1] !== sep) {
|
|
21239
21239
|
return next(err);
|
|
21240
21240
|
}
|
|
21241
21241
|
if (err) return self.onStatError(err);
|
|
21242
|
-
if (stat.isDirectory()) return self.redirect(
|
|
21243
|
-
self.emit("file",
|
|
21244
|
-
self.send(
|
|
21242
|
+
if (stat.isDirectory()) return self.redirect(path3);
|
|
21243
|
+
self.emit("file", path3, stat);
|
|
21244
|
+
self.send(path3, stat);
|
|
21245
21245
|
}, "onstat"));
|
|
21246
21246
|
function next(err) {
|
|
21247
21247
|
if (self._extensions.length <= i) {
|
|
21248
21248
|
return err ? self.onStatError(err) : self.error(404);
|
|
21249
21249
|
}
|
|
21250
|
-
var p =
|
|
21250
|
+
var p = path3 + "." + self._extensions[i++];
|
|
21251
21251
|
debug('stat "%s"', p);
|
|
21252
|
-
|
|
21252
|
+
fs2.stat(p, function(err2, stat) {
|
|
21253
21253
|
if (err2) return next(err2);
|
|
21254
21254
|
if (stat.isDirectory()) return next();
|
|
21255
21255
|
self.emit("file", p, stat);
|
|
@@ -21258,7 +21258,7 @@ var require_send = __commonJS({
|
|
|
21258
21258
|
}
|
|
21259
21259
|
__name(next, "next");
|
|
21260
21260
|
}, "sendFile");
|
|
21261
|
-
SendStream.prototype.sendIndex = /* @__PURE__ */ __name(function sendIndex(
|
|
21261
|
+
SendStream.prototype.sendIndex = /* @__PURE__ */ __name(function sendIndex(path3) {
|
|
21262
21262
|
var i = -1;
|
|
21263
21263
|
var self = this;
|
|
21264
21264
|
function next(err) {
|
|
@@ -21266,9 +21266,9 @@ var require_send = __commonJS({
|
|
|
21266
21266
|
if (err) return self.onStatError(err);
|
|
21267
21267
|
return self.error(404);
|
|
21268
21268
|
}
|
|
21269
|
-
var p =
|
|
21269
|
+
var p = join2(path3, self._index[i]);
|
|
21270
21270
|
debug('stat "%s"', p);
|
|
21271
|
-
|
|
21271
|
+
fs2.stat(p, function(err2, stat) {
|
|
21272
21272
|
if (err2) return next(err2);
|
|
21273
21273
|
if (stat.isDirectory()) return next();
|
|
21274
21274
|
self.emit("file", p, stat);
|
|
@@ -21278,10 +21278,10 @@ var require_send = __commonJS({
|
|
|
21278
21278
|
__name(next, "next");
|
|
21279
21279
|
next();
|
|
21280
21280
|
}, "sendIndex");
|
|
21281
|
-
SendStream.prototype.stream = /* @__PURE__ */ __name(function stream(
|
|
21281
|
+
SendStream.prototype.stream = /* @__PURE__ */ __name(function stream(path3, options) {
|
|
21282
21282
|
var self = this;
|
|
21283
21283
|
var res = this.res;
|
|
21284
|
-
var stream2 =
|
|
21284
|
+
var stream2 = fs2.createReadStream(path3, options);
|
|
21285
21285
|
this.emit("stream", stream2);
|
|
21286
21286
|
stream2.pipe(res);
|
|
21287
21287
|
function cleanup() {
|
|
@@ -21297,10 +21297,10 @@ var require_send = __commonJS({
|
|
|
21297
21297
|
self.emit("end");
|
|
21298
21298
|
}, "onend"));
|
|
21299
21299
|
}, "stream");
|
|
21300
|
-
SendStream.prototype.type = /* @__PURE__ */ __name(function type(
|
|
21300
|
+
SendStream.prototype.type = /* @__PURE__ */ __name(function type(path3) {
|
|
21301
21301
|
var res = this.res;
|
|
21302
21302
|
if (res.getHeader("Content-Type")) return;
|
|
21303
|
-
var type2 = mime.lookup(
|
|
21303
|
+
var type2 = mime.lookup(path3);
|
|
21304
21304
|
if (!type2) {
|
|
21305
21305
|
debug("no content-type");
|
|
21306
21306
|
return;
|
|
@@ -21309,9 +21309,9 @@ var require_send = __commonJS({
|
|
|
21309
21309
|
debug("content-type %s", type2);
|
|
21310
21310
|
res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
|
|
21311
21311
|
}, "type");
|
|
21312
|
-
SendStream.prototype.setHeader = /* @__PURE__ */ __name(function setHeader(
|
|
21312
|
+
SendStream.prototype.setHeader = /* @__PURE__ */ __name(function setHeader(path3, stat) {
|
|
21313
21313
|
var res = this.res;
|
|
21314
|
-
this.emit("headers", res,
|
|
21314
|
+
this.emit("headers", res, path3, stat);
|
|
21315
21315
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
21316
21316
|
debug("accept ranges");
|
|
21317
21317
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -21378,9 +21378,9 @@ var require_send = __commonJS({
|
|
|
21378
21378
|
}) : createError(status, err);
|
|
21379
21379
|
}
|
|
21380
21380
|
__name(createHttpError, "createHttpError");
|
|
21381
|
-
function decode(
|
|
21381
|
+
function decode(path3) {
|
|
21382
21382
|
try {
|
|
21383
|
-
return decodeURIComponent(
|
|
21383
|
+
return decodeURIComponent(path3);
|
|
21384
21384
|
} catch (err) {
|
|
21385
21385
|
return -1;
|
|
21386
21386
|
}
|
|
@@ -22638,10 +22638,10 @@ var require_utils2 = __commonJS({
|
|
|
22638
22638
|
exports2.wetag = createETagGenerator({
|
|
22639
22639
|
weak: true
|
|
22640
22640
|
});
|
|
22641
|
-
exports2.isAbsolute = function(
|
|
22642
|
-
if ("/" ===
|
|
22643
|
-
if (":" ===
|
|
22644
|
-
if ("\\\\" ===
|
|
22641
|
+
exports2.isAbsolute = function(path2) {
|
|
22642
|
+
if ("/" === path2[0]) return true;
|
|
22643
|
+
if (":" === path2[1] && ("\\" === path2[2] || "/" === path2[2])) return true;
|
|
22644
|
+
if ("\\\\" === path2.substring(0, 2)) return true;
|
|
22645
22645
|
};
|
|
22646
22646
|
exports2.flatten = deprecate.function(flatten, "utils.flatten: use array-flatten npm module instead");
|
|
22647
22647
|
exports2.normalizeType = function(type) {
|
|
@@ -22745,7 +22745,7 @@ var require_utils2 = __commonJS({
|
|
|
22745
22745
|
return contentType.format(parsed);
|
|
22746
22746
|
}, "setCharset");
|
|
22747
22747
|
function createETagGenerator(options) {
|
|
22748
|
-
return /* @__PURE__ */ __name(function
|
|
22748
|
+
return /* @__PURE__ */ __name(function generateETag2(body, encoding) {
|
|
22749
22749
|
var buf = !Buffer2.isBuffer(body) ? Buffer2.from(body, encoding) : body;
|
|
22750
22750
|
return etag(buf, options);
|
|
22751
22751
|
}, "generateETag");
|
|
@@ -22782,7 +22782,7 @@ var require_application = __commonJS({
|
|
|
22782
22782
|
var deprecate = require_depd()("express");
|
|
22783
22783
|
var flatten = require_array_flatten();
|
|
22784
22784
|
var merge = require_utils_merge();
|
|
22785
|
-
var
|
|
22785
|
+
var resolve2 = require("path").resolve;
|
|
22786
22786
|
var setPrototypeOf = require_setprototypeof();
|
|
22787
22787
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
22788
22788
|
var slice = Array.prototype.slice;
|
|
@@ -22821,7 +22821,7 @@ var require_application = __commonJS({
|
|
|
22821
22821
|
this.mountpath = "/";
|
|
22822
22822
|
this.locals.settings = this.settings;
|
|
22823
22823
|
this.set("view", View);
|
|
22824
|
-
this.set("views",
|
|
22824
|
+
this.set("views", resolve2("views"));
|
|
22825
22825
|
this.set("jsonp callback name", "callback");
|
|
22826
22826
|
if (env === "production") {
|
|
22827
22827
|
this.enable("view cache");
|
|
@@ -22857,7 +22857,7 @@ var require_application = __commonJS({
|
|
|
22857
22857
|
}, "handle");
|
|
22858
22858
|
app.use = /* @__PURE__ */ __name(function use(fn) {
|
|
22859
22859
|
var offset = 0;
|
|
22860
|
-
var
|
|
22860
|
+
var path2 = "/";
|
|
22861
22861
|
if (typeof fn !== "function") {
|
|
22862
22862
|
var arg = fn;
|
|
22863
22863
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -22865,7 +22865,7 @@ var require_application = __commonJS({
|
|
|
22865
22865
|
}
|
|
22866
22866
|
if (typeof arg !== "function") {
|
|
22867
22867
|
offset = 1;
|
|
22868
|
-
|
|
22868
|
+
path2 = fn;
|
|
22869
22869
|
}
|
|
22870
22870
|
}
|
|
22871
22871
|
var fns = flatten(slice.call(arguments, offset));
|
|
@@ -22876,12 +22876,12 @@ var require_application = __commonJS({
|
|
|
22876
22876
|
var router = this._router;
|
|
22877
22877
|
fns.forEach(function(fn2) {
|
|
22878
22878
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
22879
|
-
return router.use(
|
|
22879
|
+
return router.use(path2, fn2);
|
|
22880
22880
|
}
|
|
22881
|
-
debug(".use app under %s",
|
|
22882
|
-
fn2.mountpath =
|
|
22881
|
+
debug(".use app under %s", path2);
|
|
22882
|
+
fn2.mountpath = path2;
|
|
22883
22883
|
fn2.parent = this;
|
|
22884
|
-
router.use(
|
|
22884
|
+
router.use(path2, /* @__PURE__ */ __name(function mounted_app(req, res, next) {
|
|
22885
22885
|
var orig = req.app;
|
|
22886
22886
|
fn2.handle(req, res, function(err) {
|
|
22887
22887
|
setPrototypeOf(req, orig.request);
|
|
@@ -22893,9 +22893,9 @@ var require_application = __commonJS({
|
|
|
22893
22893
|
}, this);
|
|
22894
22894
|
return this;
|
|
22895
22895
|
}, "use");
|
|
22896
|
-
app.route = /* @__PURE__ */ __name(function route(
|
|
22896
|
+
app.route = /* @__PURE__ */ __name(function route(path2) {
|
|
22897
22897
|
this.lazyrouter();
|
|
22898
|
-
return this._router.route(
|
|
22898
|
+
return this._router.route(path2);
|
|
22899
22899
|
}, "route");
|
|
22900
22900
|
app.engine = /* @__PURE__ */ __name(function engine(ext, fn) {
|
|
22901
22901
|
if (typeof fn !== "function") {
|
|
@@ -22946,7 +22946,7 @@ var require_application = __commonJS({
|
|
|
22946
22946
|
}
|
|
22947
22947
|
return this;
|
|
22948
22948
|
}, "set");
|
|
22949
|
-
app.path = /* @__PURE__ */ __name(function
|
|
22949
|
+
app.path = /* @__PURE__ */ __name(function path2() {
|
|
22950
22950
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
22951
22951
|
}, "path");
|
|
22952
22952
|
app.enabled = /* @__PURE__ */ __name(function enabled(setting) {
|
|
@@ -22962,19 +22962,19 @@ var require_application = __commonJS({
|
|
|
22962
22962
|
return this.set(setting, false);
|
|
22963
22963
|
}, "disable");
|
|
22964
22964
|
methods.forEach(function(method) {
|
|
22965
|
-
app[method] = function(
|
|
22965
|
+
app[method] = function(path2) {
|
|
22966
22966
|
if (method === "get" && arguments.length === 1) {
|
|
22967
|
-
return this.set(
|
|
22967
|
+
return this.set(path2);
|
|
22968
22968
|
}
|
|
22969
22969
|
this.lazyrouter();
|
|
22970
|
-
var route = this._router.route(
|
|
22970
|
+
var route = this._router.route(path2);
|
|
22971
22971
|
route[method].apply(route, slice.call(arguments, 1));
|
|
22972
22972
|
return this;
|
|
22973
22973
|
};
|
|
22974
22974
|
});
|
|
22975
|
-
app.all = /* @__PURE__ */ __name(function all(
|
|
22975
|
+
app.all = /* @__PURE__ */ __name(function all(path2) {
|
|
22976
22976
|
this.lazyrouter();
|
|
22977
|
-
var route = this._router.route(
|
|
22977
|
+
var route = this._router.route(path2);
|
|
22978
22978
|
var args = slice.call(arguments, 1);
|
|
22979
22979
|
for (var i = 0; i < methods.length; i++) {
|
|
22980
22980
|
route[methods[i]].apply(route, args);
|
|
@@ -32133,7 +32133,7 @@ var require_mime_types2 = __commonJS({
|
|
|
32133
32133
|
"../../../node_modules/accepts/node_modules/mime-types/index.js"(exports2) {
|
|
32134
32134
|
"use strict";
|
|
32135
32135
|
var db = require_mime_db2();
|
|
32136
|
-
var
|
|
32136
|
+
var extname2 = require("path").extname;
|
|
32137
32137
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
32138
32138
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
32139
32139
|
exports2.charset = charset;
|
|
@@ -32188,11 +32188,11 @@ var require_mime_types2 = __commonJS({
|
|
|
32188
32188
|
return exts[0];
|
|
32189
32189
|
}
|
|
32190
32190
|
__name(extension, "extension");
|
|
32191
|
-
function lookup(
|
|
32192
|
-
if (!
|
|
32191
|
+
function lookup(path2) {
|
|
32192
|
+
if (!path2 || typeof path2 !== "string") {
|
|
32193
32193
|
return false;
|
|
32194
32194
|
}
|
|
32195
|
-
var extension2 =
|
|
32195
|
+
var extension2 = extname2("x." + path2).toLowerCase().substr(1);
|
|
32196
32196
|
if (!extension2) {
|
|
32197
32197
|
return false;
|
|
32198
32198
|
}
|
|
@@ -32422,7 +32422,7 @@ var require_request = __commonJS({
|
|
|
32422
32422
|
];
|
|
32423
32423
|
return subdomains2.slice(offset);
|
|
32424
32424
|
}, "subdomains"));
|
|
32425
|
-
defineGetter(req, "path", /* @__PURE__ */ __name(function
|
|
32425
|
+
defineGetter(req, "path", /* @__PURE__ */ __name(function path2() {
|
|
32426
32426
|
return parse(this).pathname;
|
|
32427
32427
|
}, "path"));
|
|
32428
32428
|
defineGetter(req, "hostname", /* @__PURE__ */ __name(function hostname() {
|
|
@@ -32476,11 +32476,11 @@ var require_request = __commonJS({
|
|
|
32476
32476
|
var require_cookie_signature = __commonJS({
|
|
32477
32477
|
"../../../node_modules/cookie-signature/index.js"(exports2) {
|
|
32478
32478
|
"use strict";
|
|
32479
|
-
var
|
|
32479
|
+
var crypto3 = require("crypto");
|
|
32480
32480
|
exports2.sign = function(val, secret) {
|
|
32481
32481
|
if ("string" !== typeof val) throw new TypeError("Cookie value must be provided as a string.");
|
|
32482
32482
|
if (null == secret) throw new TypeError("Secret key must be provided.");
|
|
32483
|
-
return val + "." +
|
|
32483
|
+
return val + "." + crypto3.createHmac("sha256", secret).update(val).digest("base64").replace(/\=+$/, "");
|
|
32484
32484
|
};
|
|
32485
32485
|
exports2.unsign = function(val, secret) {
|
|
32486
32486
|
if ("string" !== typeof val) throw new TypeError("Signed cookie string must be provided.");
|
|
@@ -32489,7 +32489,7 @@ var require_cookie_signature = __commonJS({
|
|
|
32489
32489
|
return sha1(mac) == sha1(val) ? str : false;
|
|
32490
32490
|
};
|
|
32491
32491
|
function sha1(str) {
|
|
32492
|
-
return
|
|
32492
|
+
return crypto3.createHash("sha1").update(str).digest("hex");
|
|
32493
32493
|
}
|
|
32494
32494
|
__name(sha1, "sha1");
|
|
32495
32495
|
}
|
|
@@ -32757,7 +32757,7 @@ var require_response = __commonJS({
|
|
|
32757
32757
|
var http = require("http");
|
|
32758
32758
|
var isAbsolute = require_utils2().isAbsolute;
|
|
32759
32759
|
var onFinished = require_on_finished();
|
|
32760
|
-
var
|
|
32760
|
+
var path2 = require("path");
|
|
32761
32761
|
var statuses = require_statuses();
|
|
32762
32762
|
var merge = require_utils_merge();
|
|
32763
32763
|
var sign = require_cookie_signature().sign;
|
|
@@ -32766,9 +32766,9 @@ var require_response = __commonJS({
|
|
|
32766
32766
|
var setCharset = require_utils2().setCharset;
|
|
32767
32767
|
var cookie = require_cookie();
|
|
32768
32768
|
var send = require_send();
|
|
32769
|
-
var
|
|
32769
|
+
var extname2 = path2.extname;
|
|
32770
32770
|
var mime = send.mime;
|
|
32771
|
-
var
|
|
32771
|
+
var resolve2 = path2.resolve;
|
|
32772
32772
|
var vary = require_vary();
|
|
32773
32773
|
var res = Object.create(http.ServerResponse.prototype);
|
|
32774
32774
|
module2.exports = res;
|
|
@@ -32840,12 +32840,12 @@ var require_response = __commonJS({
|
|
|
32840
32840
|
}
|
|
32841
32841
|
}
|
|
32842
32842
|
var etagFn = app.get("etag fn");
|
|
32843
|
-
var
|
|
32843
|
+
var generateETag2 = !this.get("ETag") && typeof etagFn === "function";
|
|
32844
32844
|
var len;
|
|
32845
32845
|
if (chunk !== void 0) {
|
|
32846
32846
|
if (Buffer2.isBuffer(chunk)) {
|
|
32847
32847
|
len = chunk.length;
|
|
32848
|
-
} else if (!
|
|
32848
|
+
} else if (!generateETag2 && chunk.length < 1e3) {
|
|
32849
32849
|
len = Buffer2.byteLength(chunk, encoding);
|
|
32850
32850
|
} else {
|
|
32851
32851
|
chunk = Buffer2.from(chunk, encoding);
|
|
@@ -32855,7 +32855,7 @@ var require_response = __commonJS({
|
|
|
32855
32855
|
this.set("Content-Length", len);
|
|
32856
32856
|
}
|
|
32857
32857
|
var etag;
|
|
32858
|
-
if (
|
|
32858
|
+
if (generateETag2 && len !== void 0) {
|
|
32859
32859
|
if (etag = etagFn(chunk, encoding)) {
|
|
32860
32860
|
this.set("ETag", etag);
|
|
32861
32861
|
}
|
|
@@ -32945,26 +32945,26 @@ var require_response = __commonJS({
|
|
|
32945
32945
|
this.type("txt");
|
|
32946
32946
|
return this.send(body);
|
|
32947
32947
|
}, "sendStatus");
|
|
32948
|
-
res.sendFile = /* @__PURE__ */ __name(function sendFile(
|
|
32948
|
+
res.sendFile = /* @__PURE__ */ __name(function sendFile(path3, options, callback) {
|
|
32949
32949
|
var done = callback;
|
|
32950
32950
|
var req = this.req;
|
|
32951
32951
|
var res2 = this;
|
|
32952
32952
|
var next = req.next;
|
|
32953
32953
|
var opts = options || {};
|
|
32954
|
-
if (!
|
|
32954
|
+
if (!path3) {
|
|
32955
32955
|
throw new TypeError("path argument is required to res.sendFile");
|
|
32956
32956
|
}
|
|
32957
|
-
if (typeof
|
|
32957
|
+
if (typeof path3 !== "string") {
|
|
32958
32958
|
throw new TypeError("path must be a string to res.sendFile");
|
|
32959
32959
|
}
|
|
32960
32960
|
if (typeof options === "function") {
|
|
32961
32961
|
done = options;
|
|
32962
32962
|
opts = {};
|
|
32963
32963
|
}
|
|
32964
|
-
if (!opts.root && !isAbsolute(
|
|
32964
|
+
if (!opts.root && !isAbsolute(path3)) {
|
|
32965
32965
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
32966
32966
|
}
|
|
32967
|
-
var pathname = encodeURI(
|
|
32967
|
+
var pathname = encodeURI(path3);
|
|
32968
32968
|
var file = send(req, pathname, opts);
|
|
32969
32969
|
sendfile(res2, file, opts, function(err) {
|
|
32970
32970
|
if (done) return done(err);
|
|
@@ -32974,7 +32974,7 @@ var require_response = __commonJS({
|
|
|
32974
32974
|
}
|
|
32975
32975
|
});
|
|
32976
32976
|
}, "sendFile");
|
|
32977
|
-
res.sendfile = function(
|
|
32977
|
+
res.sendfile = function(path3, options, callback) {
|
|
32978
32978
|
var done = callback;
|
|
32979
32979
|
var req = this.req;
|
|
32980
32980
|
var res2 = this;
|
|
@@ -32984,7 +32984,7 @@ var require_response = __commonJS({
|
|
|
32984
32984
|
done = options;
|
|
32985
32985
|
opts = {};
|
|
32986
32986
|
}
|
|
32987
|
-
var file = send(req,
|
|
32987
|
+
var file = send(req, path3, opts);
|
|
32988
32988
|
sendfile(res2, file, opts, function(err) {
|
|
32989
32989
|
if (done) return done(err);
|
|
32990
32990
|
if (err && err.code === "EISDIR") return next();
|
|
@@ -32994,7 +32994,7 @@ var require_response = __commonJS({
|
|
|
32994
32994
|
});
|
|
32995
32995
|
};
|
|
32996
32996
|
res.sendfile = deprecate.function(res.sendfile, "res.sendfile: Use res.sendFile instead");
|
|
32997
|
-
res.download = /* @__PURE__ */ __name(function download(
|
|
32997
|
+
res.download = /* @__PURE__ */ __name(function download(path3, filename, options, callback) {
|
|
32998
32998
|
var done = callback;
|
|
32999
32999
|
var name = filename;
|
|
33000
33000
|
var opts = options || null;
|
|
@@ -33011,7 +33011,7 @@ var require_response = __commonJS({
|
|
|
33011
33011
|
opts = filename;
|
|
33012
33012
|
}
|
|
33013
33013
|
var headers = {
|
|
33014
|
-
"Content-Disposition": contentDisposition(name ||
|
|
33014
|
+
"Content-Disposition": contentDisposition(name || path3)
|
|
33015
33015
|
};
|
|
33016
33016
|
if (opts && opts.headers) {
|
|
33017
33017
|
var keys = Object.keys(opts.headers);
|
|
@@ -33024,7 +33024,7 @@ var require_response = __commonJS({
|
|
|
33024
33024
|
}
|
|
33025
33025
|
opts = Object.create(opts);
|
|
33026
33026
|
opts.headers = headers;
|
|
33027
|
-
var fullPath = !opts.root ?
|
|
33027
|
+
var fullPath = !opts.root ? resolve2(path3) : path3;
|
|
33028
33028
|
return this.sendFile(fullPath, opts, done);
|
|
33029
33029
|
}, "download");
|
|
33030
33030
|
res.contentType = res.type = /* @__PURE__ */ __name(function contentType(type) {
|
|
@@ -33055,7 +33055,7 @@ var require_response = __commonJS({
|
|
|
33055
33055
|
};
|
|
33056
33056
|
res.attachment = /* @__PURE__ */ __name(function attachment(filename) {
|
|
33057
33057
|
if (filename) {
|
|
33058
|
-
this.type(
|
|
33058
|
+
this.type(extname2(filename));
|
|
33059
33059
|
}
|
|
33060
33060
|
this.set("Content-Disposition", contentDisposition(filename));
|
|
33061
33061
|
return this;
|
|
@@ -33307,7 +33307,7 @@ var require_serve_static = __commonJS({
|
|
|
33307
33307
|
var encodeUrl = require_encodeurl();
|
|
33308
33308
|
var escapeHtml = require_escape_html();
|
|
33309
33309
|
var parseUrl = require_parseurl();
|
|
33310
|
-
var
|
|
33310
|
+
var resolve2 = require("path").resolve;
|
|
33311
33311
|
var send = require_send();
|
|
33312
33312
|
var url = require("url");
|
|
33313
33313
|
module2.exports = serveStatic;
|
|
@@ -33327,7 +33327,7 @@ var require_serve_static = __commonJS({
|
|
|
33327
33327
|
throw new TypeError("option setHeaders must be function");
|
|
33328
33328
|
}
|
|
33329
33329
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
33330
|
-
opts.root =
|
|
33330
|
+
opts.root = resolve2(root);
|
|
33331
33331
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
33332
33332
|
return /* @__PURE__ */ __name(function serveStatic2(req, res, next) {
|
|
33333
33333
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -33342,11 +33342,11 @@ var require_serve_static = __commonJS({
|
|
|
33342
33342
|
}
|
|
33343
33343
|
var forwardError = !fallthrough;
|
|
33344
33344
|
var originalUrl = parseUrl.original(req);
|
|
33345
|
-
var
|
|
33346
|
-
if (
|
|
33347
|
-
|
|
33345
|
+
var path2 = parseUrl(req).pathname;
|
|
33346
|
+
if (path2 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
33347
|
+
path2 = "";
|
|
33348
33348
|
}
|
|
33349
|
-
var stream = send(req,
|
|
33349
|
+
var stream = send(req, path2, opts);
|
|
33350
33350
|
stream.on("directory", onDirectory);
|
|
33351
33351
|
if (setHeaders) {
|
|
33352
33352
|
stream.on("headers", setHeaders);
|
|
@@ -33510,6 +33510,7 @@ __export(index_exports, {
|
|
|
33510
33510
|
FileService: () => FileService,
|
|
33511
33511
|
PlatformHttpClientService: () => PlatformHttpClientService,
|
|
33512
33512
|
PlatformModule: () => PlatformModule,
|
|
33513
|
+
StaticModule: () => StaticModule,
|
|
33513
33514
|
UserContextMiddleware: () => UserContextMiddleware,
|
|
33514
33515
|
ViewContextMiddleware: () => ViewContextMiddleware,
|
|
33515
33516
|
configureApp: () => configureApp
|
|
@@ -33517,7 +33518,7 @@ __export(index_exports, {
|
|
|
33517
33518
|
module.exports = __toCommonJS(index_exports);
|
|
33518
33519
|
|
|
33519
33520
|
// src/modules/platform/module.ts
|
|
33520
|
-
var
|
|
33521
|
+
var import_common12 = require("@nestjs/common");
|
|
33521
33522
|
var import_core2 = require("@nestjs/core");
|
|
33522
33523
|
var import_nestjs_common5 = require("@lark-apaas/nestjs-common");
|
|
33523
33524
|
var import_config2 = require("@nestjs/config");
|
|
@@ -33906,13 +33907,13 @@ var RequestContextMiddleware = class {
|
|
|
33906
33907
|
this.requestContext = requestContext;
|
|
33907
33908
|
}
|
|
33908
33909
|
use(req, _res, next) {
|
|
33909
|
-
const
|
|
33910
|
+
const path2 = req.originalUrl ?? req.url;
|
|
33910
33911
|
const userContext = req.userContext ?? {};
|
|
33911
33912
|
const ttEnv = req.headers["x-tt-env"];
|
|
33912
33913
|
const rawPageRoute = req.get("X-Page-Route");
|
|
33913
33914
|
const pageRoute = (0, import_nestjs_common2.stripBasePath)(rawPageRoute, process.env.CLIENT_BASE_PATH);
|
|
33914
33915
|
this.requestContext.run({
|
|
33915
|
-
path,
|
|
33916
|
+
path: path2,
|
|
33916
33917
|
method: req.method,
|
|
33917
33918
|
userId: userContext.userId,
|
|
33918
33919
|
tenantId: userContext.tenantId,
|
|
@@ -34358,10 +34359,10 @@ var FileService = class {
|
|
|
34358
34359
|
from(bucket) {
|
|
34359
34360
|
return {
|
|
34360
34361
|
upload: /* @__PURE__ */ __name((file, options) => this._upload(bucket, file, options), "upload"),
|
|
34361
|
-
download: /* @__PURE__ */ __name((
|
|
34362
|
+
download: /* @__PURE__ */ __name((path2) => this._download(bucket, path2), "download"),
|
|
34362
34363
|
list: /* @__PURE__ */ __name((prefix, searchOptions) => this._list(bucket, prefix, searchOptions), "list"),
|
|
34363
34364
|
remove: /* @__PURE__ */ __name((filePaths) => this._remove(bucket, filePaths), "remove"),
|
|
34364
|
-
createSignedUrl: /* @__PURE__ */ __name((
|
|
34365
|
+
createSignedUrl: /* @__PURE__ */ __name((path2, expiresIn) => this._createSignedUrl(bucket, path2, expiresIn), "createSignedUrl"),
|
|
34365
34366
|
getFileMetadata: /* @__PURE__ */ __name((filePath) => this._getFileMetadata(bucket, filePath), "getFileMetadata")
|
|
34366
34367
|
};
|
|
34367
34368
|
}
|
|
@@ -34369,9 +34370,9 @@ var FileService = class {
|
|
|
34369
34370
|
async upload(file, options) {
|
|
34370
34371
|
return this._upload(await this.getDefaultBucket(), file, options);
|
|
34371
34372
|
}
|
|
34372
|
-
download(
|
|
34373
|
+
download(path2) {
|
|
34373
34374
|
const capturedBucketPromise = this.getDefaultBucket();
|
|
34374
|
-
return this._download(capturedBucketPromise,
|
|
34375
|
+
return this._download(capturedBucketPromise, path2);
|
|
34375
34376
|
}
|
|
34376
34377
|
async list(prefix, searchOptions) {
|
|
34377
34378
|
return this._list(await this.getDefaultBucket(), prefix, searchOptions);
|
|
@@ -34379,8 +34380,8 @@ var FileService = class {
|
|
|
34379
34380
|
async remove(filePaths) {
|
|
34380
34381
|
return this._remove(await this.getDefaultBucket(), filePaths);
|
|
34381
34382
|
}
|
|
34382
|
-
async createSignedUrl(
|
|
34383
|
-
return this._createSignedUrl(await this.getDefaultBucket(),
|
|
34383
|
+
async createSignedUrl(path2, expiresIn) {
|
|
34384
|
+
return this._createSignedUrl(await this.getDefaultBucket(), path2, expiresIn);
|
|
34384
34385
|
}
|
|
34385
34386
|
async getFileMetadata(filePath) {
|
|
34386
34387
|
return this._getFileMetadata(await this.getDefaultBucket(), filePath);
|
|
@@ -34447,7 +34448,7 @@ var FileService = class {
|
|
|
34447
34448
|
span.end();
|
|
34448
34449
|
}
|
|
34449
34450
|
}
|
|
34450
|
-
_download(bucket,
|
|
34451
|
+
_download(bucket, path2) {
|
|
34451
34452
|
const capturedAppId = this.getAppId();
|
|
34452
34453
|
const capturedRootSpan = this.requestContextService.getContext()?.requestRootSpan;
|
|
34453
34454
|
const downloadFn = /* @__PURE__ */ __name(async () => {
|
|
@@ -34467,7 +34468,7 @@ var FileService = class {
|
|
|
34467
34468
|
method: "download",
|
|
34468
34469
|
source_type: "server",
|
|
34469
34470
|
request: {
|
|
34470
|
-
path
|
|
34471
|
+
path: path2
|
|
34471
34472
|
}
|
|
34472
34473
|
};
|
|
34473
34474
|
const startTime = Date.now();
|
|
@@ -34475,7 +34476,7 @@ var FileService = class {
|
|
|
34475
34476
|
const res = await this.fileServiceCore.downloadInner({
|
|
34476
34477
|
appId: capturedAppId,
|
|
34477
34478
|
bucketId: await bucket,
|
|
34478
|
-
filePath:
|
|
34479
|
+
filePath: path2
|
|
34479
34480
|
});
|
|
34480
34481
|
this.nestLogger.log(JSON.stringify({
|
|
34481
34482
|
...baseParams,
|
|
@@ -34594,7 +34595,7 @@ var FileService = class {
|
|
|
34594
34595
|
span.end();
|
|
34595
34596
|
}
|
|
34596
34597
|
}
|
|
34597
|
-
async _createSignedUrl(bucket,
|
|
34598
|
+
async _createSignedUrl(bucket, path2, expiresIn) {
|
|
34598
34599
|
const span = this.observable.startTrace("\u6587\u4EF6: createSignedUrl", this.requestContextService.getContext()?.requestRootSpan);
|
|
34599
34600
|
span.setAttribute("module", "file");
|
|
34600
34601
|
span.setAttribute("source_type", "platform");
|
|
@@ -34611,7 +34612,7 @@ var FileService = class {
|
|
|
34611
34612
|
method: "createSignedUrl",
|
|
34612
34613
|
source_type: "server",
|
|
34613
34614
|
request: {
|
|
34614
|
-
path,
|
|
34615
|
+
path: path2,
|
|
34615
34616
|
expiresIn
|
|
34616
34617
|
}
|
|
34617
34618
|
};
|
|
@@ -34620,7 +34621,7 @@ var FileService = class {
|
|
|
34620
34621
|
const res = await this.fileServiceCore.createSignedUrl({
|
|
34621
34622
|
appId: this.getAppId(),
|
|
34622
34623
|
bucketId: await bucket,
|
|
34623
|
-
filePath:
|
|
34624
|
+
filePath: path2,
|
|
34624
34625
|
expiresIn
|
|
34625
34626
|
});
|
|
34626
34627
|
this.nestLogger.log(JSON.stringify({
|
|
@@ -34703,6 +34704,16 @@ FileService = _ts_decorate9([
|
|
|
34703
34704
|
|
|
34704
34705
|
// src/modules/platform/module.ts
|
|
34705
34706
|
var import_nestjs_authzpaas = require("@lark-apaas/nestjs-authzpaas");
|
|
34707
|
+
|
|
34708
|
+
// src/modules/static/static.module.ts
|
|
34709
|
+
var import_common11 = require("@nestjs/common");
|
|
34710
|
+
|
|
34711
|
+
// src/modules/static/static.controller.ts
|
|
34712
|
+
var import_common10 = require("@nestjs/common");
|
|
34713
|
+
var import_swagger = require("@nestjs/swagger");
|
|
34714
|
+
var fs = __toESM(require("fs"), 1);
|
|
34715
|
+
var path = __toESM(require("path"), 1);
|
|
34716
|
+
var crypto2 = __toESM(require("crypto"), 1);
|
|
34706
34717
|
function _ts_decorate10(decorators, target, key, desc) {
|
|
34707
34718
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
34708
34719
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -34710,6 +34721,207 @@ function _ts_decorate10(decorators, target, key, desc) {
|
|
|
34710
34721
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
34711
34722
|
}
|
|
34712
34723
|
__name(_ts_decorate10, "_ts_decorate");
|
|
34724
|
+
function _ts_metadata7(k, v) {
|
|
34725
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
34726
|
+
}
|
|
34727
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
34728
|
+
function _ts_param3(paramIndex, decorator) {
|
|
34729
|
+
return function(target, key) {
|
|
34730
|
+
decorator(target, key, paramIndex);
|
|
34731
|
+
};
|
|
34732
|
+
}
|
|
34733
|
+
__name(_ts_param3, "_ts_param");
|
|
34734
|
+
var MIME_TYPES = {
|
|
34735
|
+
// Images
|
|
34736
|
+
".png": "image/png",
|
|
34737
|
+
".jpg": "image/jpeg",
|
|
34738
|
+
".jpeg": "image/jpeg",
|
|
34739
|
+
".gif": "image/gif",
|
|
34740
|
+
".svg": "image/svg+xml",
|
|
34741
|
+
".webp": "image/webp",
|
|
34742
|
+
".ico": "image/x-icon",
|
|
34743
|
+
".bmp": "image/bmp",
|
|
34744
|
+
".tiff": "image/tiff",
|
|
34745
|
+
// Fonts
|
|
34746
|
+
".woff": "font/woff",
|
|
34747
|
+
".woff2": "font/woff2",
|
|
34748
|
+
".ttf": "font/ttf",
|
|
34749
|
+
".eot": "application/vnd.ms-fontobject",
|
|
34750
|
+
".otf": "font/otf",
|
|
34751
|
+
// Documents
|
|
34752
|
+
".json": "application/json",
|
|
34753
|
+
".xml": "application/xml",
|
|
34754
|
+
".pdf": "application/pdf",
|
|
34755
|
+
".txt": "text/plain",
|
|
34756
|
+
".html": "text/html",
|
|
34757
|
+
".css": "text/css",
|
|
34758
|
+
".js": "application/javascript",
|
|
34759
|
+
".mjs": "application/javascript",
|
|
34760
|
+
// Audio/Video
|
|
34761
|
+
".mp3": "audio/mpeg",
|
|
34762
|
+
".wav": "audio/wav",
|
|
34763
|
+
".ogg": "audio/ogg",
|
|
34764
|
+
".mp4": "video/mp4",
|
|
34765
|
+
".webm": "video/webm",
|
|
34766
|
+
".avi": "video/x-msvideo",
|
|
34767
|
+
// Archives
|
|
34768
|
+
".zip": "application/zip",
|
|
34769
|
+
".gz": "application/gzip",
|
|
34770
|
+
".tar": "application/x-tar",
|
|
34771
|
+
// Other
|
|
34772
|
+
".csv": "text/csv",
|
|
34773
|
+
".md": "text/markdown",
|
|
34774
|
+
".yaml": "text/yaml",
|
|
34775
|
+
".yml": "text/yaml"
|
|
34776
|
+
};
|
|
34777
|
+
function getMimeType(filePath) {
|
|
34778
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
34779
|
+
return MIME_TYPES[ext] || "application/octet-stream";
|
|
34780
|
+
}
|
|
34781
|
+
__name(getMimeType, "getMimeType");
|
|
34782
|
+
function generateETag(stat) {
|
|
34783
|
+
const hash = crypto2.createHash("md5").update(`${stat.mtime.getTime()}-${stat.size}`).digest("hex");
|
|
34784
|
+
return `"${hash}"`;
|
|
34785
|
+
}
|
|
34786
|
+
__name(generateETag, "generateETag");
|
|
34787
|
+
var StaticController = class _StaticController {
|
|
34788
|
+
static {
|
|
34789
|
+
__name(this, "StaticController");
|
|
34790
|
+
}
|
|
34791
|
+
logger = new import_common10.Logger(_StaticController.name);
|
|
34792
|
+
staticDir;
|
|
34793
|
+
constructor() {
|
|
34794
|
+
this.staticDir = path.resolve(process.cwd(), "../shared/static");
|
|
34795
|
+
}
|
|
34796
|
+
/**
|
|
34797
|
+
* Serve static files from shared/static directory
|
|
34798
|
+
*
|
|
34799
|
+
* Security measures:
|
|
34800
|
+
* - Path traversal prevention via normalization check
|
|
34801
|
+
* - Directory listing prevention
|
|
34802
|
+
* - File existence validation
|
|
34803
|
+
*
|
|
34804
|
+
* Caching:
|
|
34805
|
+
* - ETag-based cache validation
|
|
34806
|
+
* - Returns 304 Not Modified if ETag matches
|
|
34807
|
+
*/
|
|
34808
|
+
serveFile(params, req, res) {
|
|
34809
|
+
try {
|
|
34810
|
+
const relativePath = params["0"] || params["*"] || "";
|
|
34811
|
+
if (!relativePath) {
|
|
34812
|
+
res.status(import_common10.HttpStatus.BAD_REQUEST).json({
|
|
34813
|
+
error: "Bad Request",
|
|
34814
|
+
message: "File path is required"
|
|
34815
|
+
});
|
|
34816
|
+
return;
|
|
34817
|
+
}
|
|
34818
|
+
const filePath = path.join(this.staticDir, relativePath);
|
|
34819
|
+
const normalizedPath = path.normalize(filePath);
|
|
34820
|
+
if (!normalizedPath.startsWith(this.staticDir)) {
|
|
34821
|
+
this.logger.warn(`Path traversal attempt detected: ${relativePath}`);
|
|
34822
|
+
res.status(import_common10.HttpStatus.FORBIDDEN).json({
|
|
34823
|
+
error: "Forbidden",
|
|
34824
|
+
message: "Access denied"
|
|
34825
|
+
});
|
|
34826
|
+
return;
|
|
34827
|
+
}
|
|
34828
|
+
if (!fs.existsSync(normalizedPath)) {
|
|
34829
|
+
res.status(import_common10.HttpStatus.NOT_FOUND).json({
|
|
34830
|
+
error: "Not Found",
|
|
34831
|
+
message: "File not found"
|
|
34832
|
+
});
|
|
34833
|
+
return;
|
|
34834
|
+
}
|
|
34835
|
+
const stat = fs.statSync(normalizedPath);
|
|
34836
|
+
if (stat.isDirectory()) {
|
|
34837
|
+
res.status(import_common10.HttpStatus.FORBIDDEN).json({
|
|
34838
|
+
error: "Forbidden",
|
|
34839
|
+
message: "Directory listing not allowed"
|
|
34840
|
+
});
|
|
34841
|
+
return;
|
|
34842
|
+
}
|
|
34843
|
+
const mimeType = getMimeType(normalizedPath);
|
|
34844
|
+
const etag = generateETag(stat);
|
|
34845
|
+
const ifNoneMatch = req.headers["if-none-match"];
|
|
34846
|
+
if (ifNoneMatch === etag) {
|
|
34847
|
+
res.status(import_common10.HttpStatus.NOT_MODIFIED).end();
|
|
34848
|
+
return;
|
|
34849
|
+
}
|
|
34850
|
+
res.setHeader("Content-Type", mimeType);
|
|
34851
|
+
res.setHeader("Content-Length", stat.size);
|
|
34852
|
+
res.setHeader("ETag", etag);
|
|
34853
|
+
res.setHeader("Cache-Control", "public, max-age=0, must-revalidate");
|
|
34854
|
+
const stream = fs.createReadStream(normalizedPath);
|
|
34855
|
+
stream.on("error", (error) => {
|
|
34856
|
+
this.logger.error(`Error streaming file: ${relativePath}`, error);
|
|
34857
|
+
if (!res.headersSent) {
|
|
34858
|
+
res.status(import_common10.HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
34859
|
+
error: "Internal Server Error",
|
|
34860
|
+
message: "Failed to read file"
|
|
34861
|
+
});
|
|
34862
|
+
}
|
|
34863
|
+
});
|
|
34864
|
+
stream.pipe(res);
|
|
34865
|
+
} catch (error) {
|
|
34866
|
+
this.logger.error("Error serving static file", error);
|
|
34867
|
+
if (!res.headersSent) {
|
|
34868
|
+
res.status(import_common10.HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
34869
|
+
error: "Internal Server Error",
|
|
34870
|
+
message: "An unexpected error occurred"
|
|
34871
|
+
});
|
|
34872
|
+
}
|
|
34873
|
+
}
|
|
34874
|
+
}
|
|
34875
|
+
};
|
|
34876
|
+
_ts_decorate10([
|
|
34877
|
+
(0, import_common10.Get)("*"),
|
|
34878
|
+
_ts_param3(0, (0, import_common10.Param)()),
|
|
34879
|
+
_ts_param3(1, (0, import_common10.Req)()),
|
|
34880
|
+
_ts_param3(2, (0, import_common10.Res)()),
|
|
34881
|
+
_ts_metadata7("design:type", Function),
|
|
34882
|
+
_ts_metadata7("design:paramtypes", [
|
|
34883
|
+
typeof Record === "undefined" ? Object : Record,
|
|
34884
|
+
typeof Request === "undefined" ? Object : Request,
|
|
34885
|
+
typeof Response === "undefined" ? Object : Response
|
|
34886
|
+
]),
|
|
34887
|
+
_ts_metadata7("design:returntype", void 0)
|
|
34888
|
+
], StaticController.prototype, "serveFile", null);
|
|
34889
|
+
StaticController = _ts_decorate10([
|
|
34890
|
+
(0, import_swagger.ApiExcludeController)(),
|
|
34891
|
+
(0, import_common10.Controller)("static"),
|
|
34892
|
+
_ts_metadata7("design:type", Function),
|
|
34893
|
+
_ts_metadata7("design:paramtypes", [])
|
|
34894
|
+
], StaticController);
|
|
34895
|
+
|
|
34896
|
+
// src/modules/static/static.module.ts
|
|
34897
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
34898
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
34899
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
34900
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
34901
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
34902
|
+
}
|
|
34903
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
34904
|
+
var StaticModule = class {
|
|
34905
|
+
static {
|
|
34906
|
+
__name(this, "StaticModule");
|
|
34907
|
+
}
|
|
34908
|
+
};
|
|
34909
|
+
StaticModule = _ts_decorate11([
|
|
34910
|
+
(0, import_common11.Module)({
|
|
34911
|
+
controllers: [
|
|
34912
|
+
StaticController
|
|
34913
|
+
]
|
|
34914
|
+
})
|
|
34915
|
+
], StaticModule);
|
|
34916
|
+
|
|
34917
|
+
// src/modules/platform/module.ts
|
|
34918
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
34919
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
34920
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
34921
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
34922
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
34923
|
+
}
|
|
34924
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
34713
34925
|
var PLATFORM_MODULE_OPTIONS = /* @__PURE__ */ Symbol("PLATFORM_MODULE_OPTIONS");
|
|
34714
34926
|
var PlatformModule = class _PlatformModule {
|
|
34715
34927
|
static {
|
|
@@ -34775,7 +34987,12 @@ var PlatformModule = class _PlatformModule {
|
|
|
34775
34987
|
import_nestjs_capability.CapabilityModule.forRoot({
|
|
34776
34988
|
capabilitiesDir: options.capabilitiesDir,
|
|
34777
34989
|
enableWatching: process.env.NODE_ENV === "development"
|
|
34778
|
-
})
|
|
34990
|
+
}),
|
|
34991
|
+
// StaticModule 仅在生产环境启用
|
|
34992
|
+
// 开发环境由 Vite/Rspack dev server 的中间件处理 /static/* 请求
|
|
34993
|
+
...process.env.NODE_ENV === "development" ? [] : [
|
|
34994
|
+
StaticModule
|
|
34995
|
+
]
|
|
34779
34996
|
],
|
|
34780
34997
|
providers: [
|
|
34781
34998
|
{
|
|
@@ -34784,7 +35001,7 @@ var PlatformModule = class _PlatformModule {
|
|
|
34784
35001
|
},
|
|
34785
35002
|
{
|
|
34786
35003
|
provide: import_core2.APP_PIPE,
|
|
34787
|
-
useValue: new
|
|
35004
|
+
useValue: new import_common12.ValidationPipe({
|
|
34788
35005
|
transform: true,
|
|
34789
35006
|
transformOptions: {
|
|
34790
35007
|
enableImplicitConversion: true
|
|
@@ -34844,7 +35061,7 @@ var PlatformModule = class _PlatformModule {
|
|
|
34844
35061
|
consumer.apply(UserContextMiddleware, RequestContextMiddleware, import_nestjs_logger2.LoggerContextMiddleware, import_nestjs_observable.ObservableTraceMiddleware, ...DISABLE_DATAPASS ? [] : [
|
|
34845
35062
|
import_nestjs_datapaas.SqlExecutionContextMiddleware
|
|
34846
35063
|
]).forRoutes("/*");
|
|
34847
|
-
consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware).exclude("/api/(.*)").forRoutes("*");
|
|
35064
|
+
consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware).exclude("/api/(.*)", "/static/(.*)").forRoutes("*");
|
|
34848
35065
|
if (options.enableCsrf !== false) {
|
|
34849
35066
|
const csrfRoutes = options.csrfRoutes || "/api/*";
|
|
34850
35067
|
if (Array.isArray(csrfRoutes)) {
|
|
@@ -34857,9 +35074,9 @@ var PlatformModule = class _PlatformModule {
|
|
|
34857
35074
|
}
|
|
34858
35075
|
}
|
|
34859
35076
|
};
|
|
34860
|
-
PlatformModule =
|
|
34861
|
-
(0,
|
|
34862
|
-
(0,
|
|
35077
|
+
PlatformModule = _ts_decorate12([
|
|
35078
|
+
(0, import_common12.Global)(),
|
|
35079
|
+
(0, import_common12.Module)({})
|
|
34863
35080
|
], PlatformModule);
|
|
34864
35081
|
|
|
34865
35082
|
// src/setup.ts
|
|
@@ -34922,6 +35139,7 @@ var import_nestjs_authzpaas2 = require("@lark-apaas/nestjs-authzpaas");
|
|
|
34922
35139
|
FileService,
|
|
34923
35140
|
PlatformHttpClientService,
|
|
34924
35141
|
PlatformModule,
|
|
35142
|
+
StaticModule,
|
|
34925
35143
|
UserContextMiddleware,
|
|
34926
35144
|
ViewContextMiddleware,
|
|
34927
35145
|
configureApp,
|