@lark-apaas/fullstack-nestjs-core 1.1.34-alpha.70 → 1.1.34-alpha.71
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 +289 -497
- package/dist/index.d.cts +2 -12
- package/dist/index.d.ts +2 -12
- package/dist/index.js +245 -452
- package/package.json +1 -1
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 fs3 = require("fs");
|
|
1375
|
+
stream2 = new fs3.SyncWriteStream(fd2, {
|
|
1376
1376
|
autoClose: false
|
|
1377
1377
|
});
|
|
1378
1378
|
stream2._type = "fs";
|
|
@@ -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 = extname2("x." +
|
|
14222
|
+
var extension2 = extname2("x." + path2).toLowerCase().substr(1);
|
|
14223
14223
|
if (!extension2) {
|
|
14224
14224
|
return false;
|
|
14225
14225
|
}
|
|
@@ -18069,8 +18069,8 @@ var require_node2 = __commonJS({
|
|
|
18069
18069
|
}
|
|
18070
18070
|
break;
|
|
18071
18071
|
case "FILE":
|
|
18072
|
-
var
|
|
18073
|
-
stream2 = new
|
|
18072
|
+
var fs3 = require("fs");
|
|
18073
|
+
stream2 = new fs3.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 fs3 = require("fs");
|
|
18843
|
+
stream2 = new fs3.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(path2, 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 (path2 instanceof RegExp) {
|
|
18955
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path2.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 path2;
|
|
18964
18964
|
}
|
|
18965
|
-
if (Array.isArray(
|
|
18966
|
-
|
|
18965
|
+
if (Array.isArray(path2)) {
|
|
18966
|
+
path2 = path2.map(function(value) {
|
|
18967
18967
|
return pathToRegexp(value, keys, options).source;
|
|
18968
18968
|
});
|
|
18969
|
-
return new RegExp(
|
|
18969
|
+
return new RegExp(path2.join("|"), flags);
|
|
18970
18970
|
}
|
|
18971
|
-
if (typeof
|
|
18971
|
+
if (typeof path2 !== "string") {
|
|
18972
18972
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
18973
18973
|
}
|
|
18974
|
-
|
|
18974
|
+
path2 = path2.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 += path2.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(path2)) {
|
|
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
|
+
path2 += strict ? "" : path2[path2.length - 1] === "/" ? "?" : "/?";
|
|
19028
19028
|
if (end) {
|
|
19029
|
-
|
|
19030
|
-
} else if (
|
|
19031
|
-
|
|
19029
|
+
path2 += "$";
|
|
19030
|
+
} else if (path2[path2.length - 1] !== "/") {
|
|
19031
|
+
path2 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
19032
19032
|
}
|
|
19033
|
-
return new RegExp("^" +
|
|
19033
|
+
return new RegExp("^" + path2, 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(path2, options, fn) {
|
|
19048
19048
|
if (!(this instanceof Layer)) {
|
|
19049
|
-
return new Layer(
|
|
19049
|
+
return new Layer(path2, options, fn);
|
|
19050
19050
|
}
|
|
19051
|
-
debug("new %o",
|
|
19051
|
+
debug("new %o", path2);
|
|
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(path2, this.keys = [], opts);
|
|
19058
|
+
this.regexp.fast_star = path2 === "*";
|
|
19059
|
+
this.regexp.fast_slash = path2 === "/" && 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(path2) {
|
|
19085
19085
|
var match2;
|
|
19086
|
-
if (
|
|
19086
|
+
if (path2 != 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(path2)
|
|
19095
19095
|
};
|
|
19096
|
-
this.path =
|
|
19096
|
+
this.path = path2;
|
|
19097
19097
|
return true;
|
|
19098
19098
|
}
|
|
19099
|
-
match2 = this.regexp.exec(
|
|
19099
|
+
match2 = this.regexp.exec(path2);
|
|
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(path2) {
|
|
19196
|
+
this.path = path2;
|
|
19197
19197
|
this.stack = [];
|
|
19198
|
-
debug("new %o",
|
|
19198
|
+
debug("new %o", path2);
|
|
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 path2 = getPathname(req);
|
|
19415
|
+
if (path2 == 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, path2);
|
|
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, path2);
|
|
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, path2) {
|
|
19468
19468
|
if (layerPath.length !== 0) {
|
|
19469
|
-
if (layerPath !==
|
|
19469
|
+
if (layerPath !== path2.slice(0, layerPath.length)) {
|
|
19470
19470
|
next(layerError);
|
|
19471
19471
|
return;
|
|
19472
19472
|
}
|
|
19473
|
-
var c =
|
|
19473
|
+
var c = path2[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 path2 = "/";
|
|
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
|
+
path2 = 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", path2, fn.name || "<anonymous>");
|
|
19575
|
+
var layer = new Layer(path2, {
|
|
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(path2) {
|
|
19586
|
+
var route2 = new Route(path2);
|
|
19587
|
+
var layer = new Layer(path2, {
|
|
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(path2) {
|
|
19598
|
+
var route = this.route(path2);
|
|
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, path2) {
|
|
19639
19639
|
try {
|
|
19640
|
-
return layer.match(
|
|
19640
|
+
return layer.match(path2);
|
|
19641
19641
|
} catch (err) {
|
|
19642
19642
|
return err;
|
|
19643
19643
|
}
|
|
@@ -20633,13 +20633,13 @@ 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 extname2 =
|
|
20641
|
-
var join5 =
|
|
20642
|
-
var resolve2 =
|
|
20636
|
+
var path2 = require("path");
|
|
20637
|
+
var fs3 = require("fs");
|
|
20638
|
+
var dirname2 = path2.dirname;
|
|
20639
|
+
var basename = path2.basename;
|
|
20640
|
+
var extname2 = path2.extname;
|
|
20641
|
+
var join5 = path2.join;
|
|
20642
|
+
var resolve2 = path2.resolve;
|
|
20643
20643
|
module2.exports = View;
|
|
20644
20644
|
function View(name, options) {
|
|
20645
20645
|
var opts = options || {};
|
|
@@ -20669,17 +20669,17 @@ 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 path3;
|
|
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 && !path3; i++) {
|
|
20676
20676
|
var root = roots[i];
|
|
20677
20677
|
var loc = resolve2(root, name);
|
|
20678
20678
|
var dir = dirname2(loc);
|
|
20679
20679
|
var file = basename(loc);
|
|
20680
|
-
|
|
20680
|
+
path3 = this.resolve(dir, file);
|
|
20681
20681
|
}
|
|
20682
|
-
return
|
|
20682
|
+
return path3;
|
|
20683
20683
|
}, "lookup");
|
|
20684
20684
|
View.prototype.render = /* @__PURE__ */ __name(function render(options, callback) {
|
|
20685
20685
|
debug('render "%s"', this.path);
|
|
@@ -20687,21 +20687,21 @@ var require_view = __commonJS({
|
|
|
20687
20687
|
}, "render");
|
|
20688
20688
|
View.prototype.resolve = /* @__PURE__ */ __name(function resolve3(dir, file) {
|
|
20689
20689
|
var ext = this.ext;
|
|
20690
|
-
var
|
|
20691
|
-
var stat = tryStat(
|
|
20690
|
+
var path3 = join5(dir, file);
|
|
20691
|
+
var stat = tryStat(path3);
|
|
20692
20692
|
if (stat && stat.isFile()) {
|
|
20693
|
-
return
|
|
20693
|
+
return path3;
|
|
20694
20694
|
}
|
|
20695
|
-
|
|
20696
|
-
stat = tryStat(
|
|
20695
|
+
path3 = join5(dir, basename(file, ext), "index" + ext);
|
|
20696
|
+
stat = tryStat(path3);
|
|
20697
20697
|
if (stat && stat.isFile()) {
|
|
20698
|
-
return
|
|
20698
|
+
return path3;
|
|
20699
20699
|
}
|
|
20700
20700
|
}, "resolve");
|
|
20701
|
-
function tryStat(
|
|
20702
|
-
debug('stat "%s"',
|
|
20701
|
+
function tryStat(path3) {
|
|
20702
|
+
debug('stat "%s"', path3);
|
|
20703
20703
|
try {
|
|
20704
|
-
return
|
|
20704
|
+
return fs3.statSync(path3);
|
|
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 fs3 = require("fs");
|
|
21354
|
+
stream2 = new fs3.SyncWriteStream(fd2, {
|
|
21355
21355
|
autoClose: false
|
|
21356
21356
|
});
|
|
21357
21357
|
stream2._type = "fs";
|
|
@@ -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 path2 = require("path");
|
|
21540
|
+
var fs3 = 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 = fs3.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(path3, fallback) {
|
|
21571
|
+
var ext = path3.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 fs3 = 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 path2 = require("path");
|
|
21813
21813
|
var statuses = require_statuses();
|
|
21814
21814
|
var Stream = require("stream");
|
|
21815
21815
|
var util = require("util");
|
|
21816
|
-
var extname2 =
|
|
21817
|
-
var join5 =
|
|
21818
|
-
var normalize2 =
|
|
21819
|
-
var resolve2 =
|
|
21820
|
-
var sep =
|
|
21816
|
+
var extname2 = path2.extname;
|
|
21817
|
+
var join5 = path2.join;
|
|
21818
|
+
var normalize2 = path2.normalize;
|
|
21819
|
+
var resolve2 = path2.resolve;
|
|
21820
|
+
var sep = path2.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, path3, options) {
|
|
21827
|
+
return new SendStream(req, path3, options);
|
|
21828
21828
|
}
|
|
21829
21829
|
__name(send, "send");
|
|
21830
|
-
function SendStream(req,
|
|
21830
|
+
function SendStream(req, path3, options) {
|
|
21831
21831
|
Stream.call(this);
|
|
21832
21832
|
var opts = options || {};
|
|
21833
21833
|
this.options = opts;
|
|
21834
|
-
this.path =
|
|
21834
|
+
this.path = path3;
|
|
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;
|
|
@@ -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 = resolve2(String(
|
|
21883
|
+
SendStream.prototype.root = /* @__PURE__ */ __name(function root(path3) {
|
|
21884
|
+
this._root = resolve2(String(path3));
|
|
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(path3) {
|
|
21992
21992
|
var res = this.res;
|
|
21993
21993
|
if (hasListeners(this, "directory")) {
|
|
21994
|
-
this.emit("directory", res,
|
|
21994
|
+
this.emit("directory", res, path3);
|
|
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 path3 = decode(this.path);
|
|
22015
|
+
if (path3 === -1) {
|
|
22016
22016
|
this.error(400);
|
|
22017
22017
|
return res;
|
|
22018
22018
|
}
|
|
22019
|
-
if (~
|
|
22019
|
+
if (~path3.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 (path3) {
|
|
22026
|
+
path3 = normalize2("." + sep + path3);
|
|
22027
22027
|
}
|
|
22028
|
-
if (UP_PATH_REGEXP.test(
|
|
22029
|
-
debug('malicious path "%s"',
|
|
22028
|
+
if (UP_PATH_REGEXP.test(path3)) {
|
|
22029
|
+
debug('malicious path "%s"', path3);
|
|
22030
22030
|
this.error(403);
|
|
22031
22031
|
return res;
|
|
22032
22032
|
}
|
|
22033
|
-
parts =
|
|
22034
|
-
|
|
22033
|
+
parts = path3.split(sep);
|
|
22034
|
+
path3 = normalize2(join5(root, path3));
|
|
22035
22035
|
} else {
|
|
22036
|
-
if (UP_PATH_REGEXP.test(
|
|
22037
|
-
debug('malicious path "%s"',
|
|
22036
|
+
if (UP_PATH_REGEXP.test(path3)) {
|
|
22037
|
+
debug('malicious path "%s"', path3);
|
|
22038
22038
|
this.error(403);
|
|
22039
22039
|
return res;
|
|
22040
22040
|
}
|
|
22041
|
-
parts = normalize2(
|
|
22042
|
-
|
|
22041
|
+
parts = normalize2(path3).split(sep);
|
|
22042
|
+
path3 = resolve2(path3);
|
|
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, path3);
|
|
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(path3);
|
|
22064
22064
|
return res;
|
|
22065
22065
|
}
|
|
22066
|
-
this.sendFile(
|
|
22066
|
+
this.sendFile(path3);
|
|
22067
22067
|
return res;
|
|
22068
22068
|
}, "pipe");
|
|
22069
|
-
SendStream.prototype.send = /* @__PURE__ */ __name(function send2(
|
|
22069
|
+
SendStream.prototype.send = /* @__PURE__ */ __name(function send2(path3, 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"', path3);
|
|
22082
|
+
this.setHeader(path3, stat);
|
|
22083
|
+
this.type(path3);
|
|
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(path3, opts);
|
|
22135
22135
|
}, "send");
|
|
22136
|
-
SendStream.prototype.sendFile = /* @__PURE__ */ __name(function sendFile(
|
|
22136
|
+
SendStream.prototype.sendFile = /* @__PURE__ */ __name(function sendFile(path3) {
|
|
22137
22137
|
var i = 0;
|
|
22138
22138
|
var self = this;
|
|
22139
|
-
debug('stat "%s"',
|
|
22140
|
-
|
|
22141
|
-
if (err && err.code === "ENOENT" && !extname2(
|
|
22139
|
+
debug('stat "%s"', path3);
|
|
22140
|
+
fs3.stat(path3, /* @__PURE__ */ __name(function onstat(err, stat) {
|
|
22141
|
+
if (err && err.code === "ENOENT" && !extname2(path3) && path3[path3.length - 1] !== sep) {
|
|
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(path3);
|
|
22146
|
+
self.emit("file", path3, stat);
|
|
22147
|
+
self.send(path3, 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 = path3 + "." + self._extensions[i++];
|
|
22154
22154
|
debug('stat "%s"', p);
|
|
22155
|
-
|
|
22155
|
+
fs3.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(path3) {
|
|
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 = join5(
|
|
22172
|
+
var p = join5(path3, self._index[i]);
|
|
22173
22173
|
debug('stat "%s"', p);
|
|
22174
|
-
|
|
22174
|
+
fs3.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(path3, options) {
|
|
22185
22185
|
var self = this;
|
|
22186
22186
|
var res = this.res;
|
|
22187
|
-
var stream2 =
|
|
22187
|
+
var stream2 = fs3.createReadStream(path3, 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(path3) {
|
|
22204
22204
|
var res = this.res;
|
|
22205
22205
|
if (res.getHeader("Content-Type")) return;
|
|
22206
|
-
var type2 = mime.lookup(
|
|
22206
|
+
var type2 = mime.lookup(path3);
|
|
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(path3, stat) {
|
|
22216
22216
|
var res = this.res;
|
|
22217
|
-
this.emit("headers", res,
|
|
22217
|
+
this.emit("headers", res, path3, 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(path3) {
|
|
22285
22285
|
try {
|
|
22286
|
-
return decodeURIComponent(
|
|
22286
|
+
return decodeURIComponent(path3);
|
|
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(path2) {
|
|
23545
|
+
if ("/" === path2[0]) return true;
|
|
23546
|
+
if (":" === path2[1] && ("\\" === path2[2] || "/" === path2[2])) return true;
|
|
23547
|
+
if ("\\\\" === path2.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) {
|
|
@@ -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 path2 = "/";
|
|
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
|
+
path2 = 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(path2, fn2);
|
|
23783
23783
|
}
|
|
23784
|
-
debug(".use app under %s",
|
|
23785
|
-
fn2.mountpath =
|
|
23784
|
+
debug(".use app under %s", path2);
|
|
23785
|
+
fn2.mountpath = path2;
|
|
23786
23786
|
fn2.parent = this;
|
|
23787
|
-
router.use(
|
|
23787
|
+
router.use(path2, /* @__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(path2) {
|
|
23800
23800
|
this.lazyrouter();
|
|
23801
|
-
return this._router.route(
|
|
23801
|
+
return this._router.route(path2);
|
|
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 path2() {
|
|
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(path2) {
|
|
23869
23869
|
if (method === "get" && arguments.length === 1) {
|
|
23870
|
-
return this.set(
|
|
23870
|
+
return this.set(path2);
|
|
23871
23871
|
}
|
|
23872
23872
|
this.lazyrouter();
|
|
23873
|
-
var route = this._router.route(
|
|
23873
|
+
var route = this._router.route(path2);
|
|
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(path2) {
|
|
23879
23879
|
this.lazyrouter();
|
|
23880
|
-
var route = this._router.route(
|
|
23880
|
+
var route = this._router.route(path2);
|
|
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);
|
|
@@ -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(path2) {
|
|
33095
|
+
if (!path2 || typeof path2 !== "string") {
|
|
33096
33096
|
return false;
|
|
33097
33097
|
}
|
|
33098
|
-
var extension2 = extname2("x." +
|
|
33098
|
+
var extension2 = extname2("x." + path2).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 path2() {
|
|
33329
33329
|
return parse(this).pathname;
|
|
33330
33330
|
}, "path"));
|
|
33331
33331
|
defineGetter(req, "hostname", /* @__PURE__ */ __name(function hostname() {
|
|
@@ -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 path2 = 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 extname2 =
|
|
33672
|
+
var extname2 = path2.extname;
|
|
33673
33673
|
var mime = send.mime;
|
|
33674
|
-
var resolve2 =
|
|
33674
|
+
var resolve2 = path2.resolve;
|
|
33675
33675
|
var vary = require_vary();
|
|
33676
33676
|
var res = Object.create(http.ServerResponse.prototype);
|
|
33677
33677
|
module2.exports = res;
|
|
@@ -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(path3, 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 (!path3) {
|
|
33858
33858
|
throw new TypeError("path argument is required to res.sendFile");
|
|
33859
33859
|
}
|
|
33860
|
-
if (typeof
|
|
33860
|
+
if (typeof path3 !== "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(path3)) {
|
|
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(path3);
|
|
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(path3, 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, path3, 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(path3, 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 || path3)
|
|
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 ? resolve2(
|
|
33930
|
+
var fullPath = !opts.root ? resolve2(path3) : path3;
|
|
33931
33931
|
return this.sendFile(fullPath, opts, done);
|
|
33932
33932
|
}, "download");
|
|
33933
33933
|
res.contentType = res.type = /* @__PURE__ */ __name(function contentType(type) {
|
|
@@ -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 path2 = parseUrl(req).pathname;
|
|
34249
|
+
if (path2 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
34250
|
+
path2 = "";
|
|
34251
34251
|
}
|
|
34252
|
-
var stream = send(req,
|
|
34252
|
+
var stream = send(req, path2, opts);
|
|
34253
34253
|
stream.on("directory", onDirectory);
|
|
34254
34254
|
if (setHeaders) {
|
|
34255
34255
|
stream.on("headers", setHeaders);
|
|
@@ -34423,13 +34423,12 @@ __export(index_exports, {
|
|
|
34423
34423
|
UserContextMiddleware: () => UserContextMiddleware,
|
|
34424
34424
|
ViewContextMiddleware: () => ViewContextMiddleware,
|
|
34425
34425
|
configureApp: () => configureApp,
|
|
34426
|
-
createLegacyPathRedirectMiddleware: () => createLegacyPathRedirectMiddleware
|
|
34427
|
-
registerOpenApiSpecEndpoint: () => registerOpenApiSpecEndpoint
|
|
34426
|
+
createLegacyPathRedirectMiddleware: () => createLegacyPathRedirectMiddleware
|
|
34428
34427
|
});
|
|
34429
34428
|
module.exports = __toCommonJS(index_exports);
|
|
34430
34429
|
|
|
34431
34430
|
// src/modules/platform/module.ts
|
|
34432
|
-
var
|
|
34431
|
+
var import_common16 = require("@nestjs/common");
|
|
34433
34432
|
var import_core2 = require("@nestjs/core");
|
|
34434
34433
|
var import_nestjs_common6 = require("@lark-apaas/nestjs-common");
|
|
34435
34434
|
var import_config2 = require("@nestjs/config");
|
|
@@ -34824,7 +34823,7 @@ var RequestContextMiddleware = class {
|
|
|
34824
34823
|
this.requestContext = requestContext;
|
|
34825
34824
|
}
|
|
34826
34825
|
use(req, _res, next) {
|
|
34827
|
-
const
|
|
34826
|
+
const path2 = req.originalUrl ?? req.url;
|
|
34828
34827
|
const userContext = req.userContext ?? {};
|
|
34829
34828
|
const ttEnv = req.headers["x-tt-env"];
|
|
34830
34829
|
const rawPageRoute = req.get("X-Page-Route");
|
|
@@ -34832,7 +34831,7 @@ var RequestContextMiddleware = class {
|
|
|
34832
34831
|
const refererPath = req.headers["rpc-persist-apaas-observability-referer-path"];
|
|
34833
34832
|
const observabilityApi = req.headers["rpc-persist-apaas-observability-api"];
|
|
34834
34833
|
this.requestContext.run({
|
|
34835
|
-
path:
|
|
34834
|
+
path: path2,
|
|
34836
34835
|
method: req.method,
|
|
34837
34836
|
userId: userContext.userId,
|
|
34838
34837
|
tenantId: userContext.tenantId,
|
|
@@ -35021,214 +35020,17 @@ FrameworkDebugMiddleware = _ts_decorate7([
|
|
|
35021
35020
|
])
|
|
35022
35021
|
], FrameworkDebugMiddleware);
|
|
35023
35022
|
|
|
35024
|
-
// src/middlewares/openapi-spec/index.ts
|
|
35025
|
-
var import_node_fs = __toESM(require("fs"), 1);
|
|
35026
|
-
var import_swagger = require("@nestjs/swagger");
|
|
35027
|
-
var import_common8 = require("@nestjs/common");
|
|
35028
|
-
function _ts_decorate8(decorators, target, key, desc) {
|
|
35029
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35030
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35031
|
-
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;
|
|
35032
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35033
|
-
}
|
|
35034
|
-
__name(_ts_decorate8, "_ts_decorate");
|
|
35035
|
-
var _app = null;
|
|
35036
|
-
var _openapiFile = null;
|
|
35037
|
-
var _specCache = null;
|
|
35038
|
-
var _fallbackCache = null;
|
|
35039
|
-
function registerOpenApiSpecEndpoint(app, options) {
|
|
35040
|
-
const globalPrefix = (process.env.CLIENT_BASE_PATH ?? "").replace(/\/+$/, "");
|
|
35041
|
-
_app = app;
|
|
35042
|
-
_openapiFile = options.openapiFile;
|
|
35043
|
-
console.log(`[OpenAPI] Registered GET ${globalPrefix}/api/__framework__/openapi-spec (source: ${_openapiFile})`);
|
|
35044
|
-
}
|
|
35045
|
-
__name(registerOpenApiSpecEndpoint, "registerOpenApiSpecEndpoint");
|
|
35046
|
-
var OpenApiSpecMiddleware = class {
|
|
35047
|
-
static {
|
|
35048
|
-
__name(this, "OpenApiSpecMiddleware");
|
|
35049
|
-
}
|
|
35050
|
-
use(_req, res, next) {
|
|
35051
|
-
if (!_app) {
|
|
35052
|
-
next();
|
|
35053
|
-
return;
|
|
35054
|
-
}
|
|
35055
|
-
try {
|
|
35056
|
-
const fromFile = loadSpecFromFile(_openapiFile);
|
|
35057
|
-
if (fromFile) {
|
|
35058
|
-
res.json(fromFile);
|
|
35059
|
-
return;
|
|
35060
|
-
}
|
|
35061
|
-
const fallback = loadFallbackSpec(_app);
|
|
35062
|
-
res.json(fallback);
|
|
35063
|
-
} catch (err) {
|
|
35064
|
-
console.error("[openapi-spec] Failed to generate spec:", err);
|
|
35065
|
-
res.json({
|
|
35066
|
-
openapi: "3.0.0",
|
|
35067
|
-
paths: {},
|
|
35068
|
-
components: {
|
|
35069
|
-
schemas: {}
|
|
35070
|
-
}
|
|
35071
|
-
});
|
|
35072
|
-
}
|
|
35073
|
-
}
|
|
35074
|
-
};
|
|
35075
|
-
OpenApiSpecMiddleware = _ts_decorate8([
|
|
35076
|
-
(0, import_common8.Injectable)()
|
|
35077
|
-
], OpenApiSpecMiddleware);
|
|
35078
|
-
function loadSpecFromFile(file) {
|
|
35079
|
-
if (!file) return null;
|
|
35080
|
-
let statBefore;
|
|
35081
|
-
try {
|
|
35082
|
-
statBefore = import_node_fs.default.statSync(file);
|
|
35083
|
-
} catch {
|
|
35084
|
-
return null;
|
|
35085
|
-
}
|
|
35086
|
-
const sig = `${file}:${statBefore.mtimeMs}:${statBefore.size}`;
|
|
35087
|
-
if (_specCache && _specCache.sig === sig) {
|
|
35088
|
-
return _specCache.spec;
|
|
35089
|
-
}
|
|
35090
|
-
let raw;
|
|
35091
|
-
try {
|
|
35092
|
-
raw = import_node_fs.default.readFileSync(file, "utf8");
|
|
35093
|
-
} catch (err) {
|
|
35094
|
-
console.warn(`[openapi-spec] ${file} read failed: ${err.message}, falling back`);
|
|
35095
|
-
return null;
|
|
35096
|
-
}
|
|
35097
|
-
let statAfter;
|
|
35098
|
-
try {
|
|
35099
|
-
statAfter = import_node_fs.default.statSync(file);
|
|
35100
|
-
} catch {
|
|
35101
|
-
return null;
|
|
35102
|
-
}
|
|
35103
|
-
const raced = statAfter.mtimeMs !== statBefore.mtimeMs || statAfter.size !== statBefore.size;
|
|
35104
|
-
const spec = parseOpenApiSpec(file, raw);
|
|
35105
|
-
if (!spec) return null;
|
|
35106
|
-
if (!raced) {
|
|
35107
|
-
_specCache = {
|
|
35108
|
-
spec,
|
|
35109
|
-
sig
|
|
35110
|
-
};
|
|
35111
|
-
}
|
|
35112
|
-
return spec;
|
|
35113
|
-
}
|
|
35114
|
-
__name(loadSpecFromFile, "loadSpecFromFile");
|
|
35115
|
-
function parseOpenApiSpec(file, raw) {
|
|
35116
|
-
let parsed;
|
|
35117
|
-
try {
|
|
35118
|
-
parsed = JSON.parse(raw);
|
|
35119
|
-
} catch (err) {
|
|
35120
|
-
console.warn(`[openapi-spec] ${file} invalid: ${err.message}, falling back`);
|
|
35121
|
-
return null;
|
|
35122
|
-
}
|
|
35123
|
-
if (!parsed || typeof parsed !== "object" || !parsed.paths || typeof parsed.paths !== "object") {
|
|
35124
|
-
console.warn(`[openapi-spec] ${file} missing "paths", falling back`);
|
|
35125
|
-
return null;
|
|
35126
|
-
}
|
|
35127
|
-
return {
|
|
35128
|
-
openapi: "3.0.0",
|
|
35129
|
-
info: {
|
|
35130
|
-
title: "OpenAPI Spec",
|
|
35131
|
-
version: "1.0.0"
|
|
35132
|
-
},
|
|
35133
|
-
paths: parsed.paths
|
|
35134
|
-
};
|
|
35135
|
-
}
|
|
35136
|
-
__name(parseOpenApiSpec, "parseOpenApiSpec");
|
|
35137
|
-
function loadFallbackSpec(app) {
|
|
35138
|
-
if (_fallbackCache) return _fallbackCache;
|
|
35139
|
-
const globalPrefix = (process.env.CLIENT_BASE_PATH ?? "").replace(/\/+$/, "");
|
|
35140
|
-
const config = new import_swagger.DocumentBuilder().setTitle("OpenAPI Spec").setVersion("1.0").build();
|
|
35141
|
-
const spec = import_swagger.SwaggerModule.createDocument(app, config);
|
|
35142
|
-
console.warn("[openapi-spec] docs/openapi.json not available, falling back to SwaggerModule.createDocument(). Populate docs/openapi.json to use the static-first path.");
|
|
35143
|
-
_fallbackCache = buildFilteredSpec(spec, globalPrefix);
|
|
35144
|
-
return _fallbackCache;
|
|
35145
|
-
}
|
|
35146
|
-
__name(loadFallbackSpec, "loadFallbackSpec");
|
|
35147
|
-
function buildFilteredSpec(spec, globalPrefix) {
|
|
35148
|
-
const schemas = spec.components?.schemas ?? {};
|
|
35149
|
-
const paths = spec.paths ?? {};
|
|
35150
|
-
const filteredPaths = {};
|
|
35151
|
-
for (const [pathKey, methods] of Object.entries(paths)) {
|
|
35152
|
-
const cleanPath = stripPrefix(pathKey, globalPrefix);
|
|
35153
|
-
if (!cleanPath.startsWith("/openapi")) continue;
|
|
35154
|
-
filteredPaths[cleanPath] = {};
|
|
35155
|
-
for (const [method, operation] of Object.entries(methods)) {
|
|
35156
|
-
if ([
|
|
35157
|
-
"parameters",
|
|
35158
|
-
"summary",
|
|
35159
|
-
"description",
|
|
35160
|
-
"servers"
|
|
35161
|
-
].includes(method)) continue;
|
|
35162
|
-
filteredPaths[cleanPath][method] = resolveRefsDeep(structuredClone(operation), schemas);
|
|
35163
|
-
}
|
|
35164
|
-
}
|
|
35165
|
-
return {
|
|
35166
|
-
openapi: spec.openapi,
|
|
35167
|
-
paths: filteredPaths,
|
|
35168
|
-
components: {
|
|
35169
|
-
schemas: resolveAllSchemaRefs(structuredClone(schemas))
|
|
35170
|
-
}
|
|
35171
|
-
};
|
|
35172
|
-
}
|
|
35173
|
-
__name(buildFilteredSpec, "buildFilteredSpec");
|
|
35174
|
-
function stripPrefix(pathStr, prefix) {
|
|
35175
|
-
if (prefix && pathStr.startsWith(prefix)) {
|
|
35176
|
-
return pathStr.slice(prefix.length);
|
|
35177
|
-
}
|
|
35178
|
-
return pathStr;
|
|
35179
|
-
}
|
|
35180
|
-
__name(stripPrefix, "stripPrefix");
|
|
35181
|
-
var MAX_REF_DEPTH = 5;
|
|
35182
|
-
function resolveRefsDeep(obj, schemas, depth = 0) {
|
|
35183
|
-
if (depth > MAX_REF_DEPTH || obj === null || obj === void 0) return obj;
|
|
35184
|
-
if (typeof obj !== "object") return obj;
|
|
35185
|
-
if (Array.isArray(obj)) {
|
|
35186
|
-
return obj.map((item) => resolveRefsDeep(item, schemas, depth));
|
|
35187
|
-
}
|
|
35188
|
-
const record = obj;
|
|
35189
|
-
if (typeof record["$ref"] === "string") {
|
|
35190
|
-
const resolved = resolveRef(record["$ref"], schemas);
|
|
35191
|
-
if (resolved !== void 0) {
|
|
35192
|
-
return resolveRefsDeep(structuredClone(resolved), schemas, depth + 1);
|
|
35193
|
-
}
|
|
35194
|
-
return record;
|
|
35195
|
-
}
|
|
35196
|
-
const result = {};
|
|
35197
|
-
for (const [key, value] of Object.entries(record)) {
|
|
35198
|
-
result[key] = resolveRefsDeep(value, schemas, depth);
|
|
35199
|
-
}
|
|
35200
|
-
return result;
|
|
35201
|
-
}
|
|
35202
|
-
__name(resolveRefsDeep, "resolveRefsDeep");
|
|
35203
|
-
function resolveRef(ref, schemas) {
|
|
35204
|
-
const prefix = "#/components/schemas/";
|
|
35205
|
-
if (ref.startsWith(prefix)) {
|
|
35206
|
-
const name = ref.slice(prefix.length);
|
|
35207
|
-
return schemas[name];
|
|
35208
|
-
}
|
|
35209
|
-
return void 0;
|
|
35210
|
-
}
|
|
35211
|
-
__name(resolveRef, "resolveRef");
|
|
35212
|
-
function resolveAllSchemaRefs(schemas) {
|
|
35213
|
-
const result = {};
|
|
35214
|
-
for (const [name, schema] of Object.entries(schemas)) {
|
|
35215
|
-
result[name] = resolveRefsDeep(schema, schemas);
|
|
35216
|
-
}
|
|
35217
|
-
return result;
|
|
35218
|
-
}
|
|
35219
|
-
__name(resolveAllSchemaRefs, "resolveAllSchemaRefs");
|
|
35220
|
-
|
|
35221
35023
|
// src/services/platform-http-client.service.ts
|
|
35222
|
-
var
|
|
35024
|
+
var import_common8 = require("@nestjs/common");
|
|
35223
35025
|
var import_http_client = require("@lark-apaas/http-client");
|
|
35224
35026
|
var import_nestjs_common3 = require("@lark-apaas/nestjs-common");
|
|
35225
|
-
function
|
|
35027
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
35226
35028
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35227
35029
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35228
35030
|
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;
|
|
35229
35031
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35230
35032
|
}
|
|
35231
|
-
__name(
|
|
35033
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
35232
35034
|
function _ts_metadata5(k, v) {
|
|
35233
35035
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35234
35036
|
}
|
|
@@ -35267,7 +35069,7 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35267
35069
|
requestContext;
|
|
35268
35070
|
client;
|
|
35269
35071
|
protectedClient;
|
|
35270
|
-
logger = new
|
|
35072
|
+
logger = new import_common8.Logger(_PlatformHttpClientService.name);
|
|
35271
35073
|
constructor(requestContext) {
|
|
35272
35074
|
this.requestContext = requestContext;
|
|
35273
35075
|
const baseConfig = {
|
|
@@ -35423,8 +35225,8 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35423
35225
|
});
|
|
35424
35226
|
}
|
|
35425
35227
|
};
|
|
35426
|
-
PlatformHttpClientService =
|
|
35427
|
-
(0,
|
|
35228
|
+
PlatformHttpClientService = _ts_decorate8([
|
|
35229
|
+
(0, import_common8.Injectable)(),
|
|
35428
35230
|
_ts_metadata5("design:type", Function),
|
|
35429
35231
|
_ts_metadata5("design:paramtypes", [
|
|
35430
35232
|
typeof import_nestjs_common3.RequestContextService === "undefined" ? Object : import_nestjs_common3.RequestContextService
|
|
@@ -35435,16 +35237,16 @@ PlatformHttpClientService = _ts_decorate9([
|
|
|
35435
35237
|
var DISABLE_DATAPASS = process.env.FORCE_FRAMEWORK_DISABLE_DATAPASS === "true";
|
|
35436
35238
|
|
|
35437
35239
|
// src/services/file.service.ts
|
|
35438
|
-
var
|
|
35240
|
+
var import_common9 = require("@nestjs/common");
|
|
35439
35241
|
var import_nestjs_common4 = require("@lark-apaas/nestjs-common");
|
|
35440
35242
|
var import_file_service = require("@lark-apaas/file-service");
|
|
35441
|
-
function
|
|
35243
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
35442
35244
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35443
35245
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35444
35246
|
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;
|
|
35445
35247
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35446
35248
|
}
|
|
35447
|
-
__name(
|
|
35249
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
35448
35250
|
function _ts_metadata6(k, v) {
|
|
35449
35251
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35450
35252
|
}
|
|
@@ -35469,7 +35271,7 @@ var FileService = class {
|
|
|
35469
35271
|
this.httpClient = httpClient;
|
|
35470
35272
|
this.observable = observable;
|
|
35471
35273
|
this.fileServiceCore = new import_file_service.FileService(this.httpClient);
|
|
35472
|
-
this.nestLogger = new
|
|
35274
|
+
this.nestLogger = new import_common9.Logger("file");
|
|
35473
35275
|
}
|
|
35474
35276
|
/**
|
|
35475
35277
|
* 返回一个绑定了指定 bucket 的代理对象
|
|
@@ -35478,10 +35280,10 @@ var FileService = class {
|
|
|
35478
35280
|
from(bucket) {
|
|
35479
35281
|
return {
|
|
35480
35282
|
upload: /* @__PURE__ */ __name((file, options) => this._upload(bucket, file, options), "upload"),
|
|
35481
|
-
download: /* @__PURE__ */ __name((
|
|
35283
|
+
download: /* @__PURE__ */ __name((path2) => this._download(bucket, path2), "download"),
|
|
35482
35284
|
list: /* @__PURE__ */ __name((prefix, searchOptions) => this._list(bucket, prefix, searchOptions), "list"),
|
|
35483
35285
|
remove: /* @__PURE__ */ __name((filePaths) => this._remove(bucket, filePaths), "remove"),
|
|
35484
|
-
createSignedUrl: /* @__PURE__ */ __name((
|
|
35286
|
+
createSignedUrl: /* @__PURE__ */ __name((path2, expiresIn) => this._createSignedUrl(bucket, path2, expiresIn), "createSignedUrl"),
|
|
35485
35287
|
getFileMetadata: /* @__PURE__ */ __name((filePath) => this._getFileMetadata(bucket, filePath), "getFileMetadata")
|
|
35486
35288
|
};
|
|
35487
35289
|
}
|
|
@@ -35489,9 +35291,9 @@ var FileService = class {
|
|
|
35489
35291
|
async upload(file, options) {
|
|
35490
35292
|
return this._upload(await this.getDefaultBucket(), file, options);
|
|
35491
35293
|
}
|
|
35492
|
-
download(
|
|
35294
|
+
download(path2) {
|
|
35493
35295
|
const capturedBucketPromise = this.getDefaultBucket();
|
|
35494
|
-
return this._download(capturedBucketPromise,
|
|
35296
|
+
return this._download(capturedBucketPromise, path2);
|
|
35495
35297
|
}
|
|
35496
35298
|
async list(prefix, searchOptions) {
|
|
35497
35299
|
return this._list(await this.getDefaultBucket(), prefix, searchOptions);
|
|
@@ -35499,8 +35301,8 @@ var FileService = class {
|
|
|
35499
35301
|
async remove(filePaths) {
|
|
35500
35302
|
return this._remove(await this.getDefaultBucket(), filePaths);
|
|
35501
35303
|
}
|
|
35502
|
-
async createSignedUrl(
|
|
35503
|
-
return this._createSignedUrl(await this.getDefaultBucket(),
|
|
35304
|
+
async createSignedUrl(path2, expiresIn) {
|
|
35305
|
+
return this._createSignedUrl(await this.getDefaultBucket(), path2, expiresIn);
|
|
35504
35306
|
}
|
|
35505
35307
|
async getFileMetadata(filePath) {
|
|
35506
35308
|
return this._getFileMetadata(await this.getDefaultBucket(), filePath);
|
|
@@ -35567,7 +35369,7 @@ var FileService = class {
|
|
|
35567
35369
|
span.end();
|
|
35568
35370
|
}
|
|
35569
35371
|
}
|
|
35570
|
-
_download(bucket,
|
|
35372
|
+
_download(bucket, path2) {
|
|
35571
35373
|
const capturedAppId = this.getAppId();
|
|
35572
35374
|
const capturedRootSpan = this.requestContextService.getContext()?.requestRootSpan;
|
|
35573
35375
|
const downloadFn = /* @__PURE__ */ __name(async () => {
|
|
@@ -35587,7 +35389,7 @@ var FileService = class {
|
|
|
35587
35389
|
method: "download",
|
|
35588
35390
|
source_type: "server",
|
|
35589
35391
|
request: {
|
|
35590
|
-
path:
|
|
35392
|
+
path: path2
|
|
35591
35393
|
}
|
|
35592
35394
|
};
|
|
35593
35395
|
const startTime = Date.now();
|
|
@@ -35595,7 +35397,7 @@ var FileService = class {
|
|
|
35595
35397
|
const res = await this.fileServiceCore.downloadInner({
|
|
35596
35398
|
appId: capturedAppId,
|
|
35597
35399
|
bucketId: await bucket,
|
|
35598
|
-
filePath:
|
|
35400
|
+
filePath: path2
|
|
35599
35401
|
});
|
|
35600
35402
|
this.nestLogger.log(JSON.stringify({
|
|
35601
35403
|
...baseParams,
|
|
@@ -35714,7 +35516,7 @@ var FileService = class {
|
|
|
35714
35516
|
span.end();
|
|
35715
35517
|
}
|
|
35716
35518
|
}
|
|
35717
|
-
async _createSignedUrl(bucket,
|
|
35519
|
+
async _createSignedUrl(bucket, path2, expiresIn) {
|
|
35718
35520
|
const span = this.observable.startTrace("\u6587\u4EF6: createSignedUrl", this.requestContextService.getContext()?.requestRootSpan);
|
|
35719
35521
|
span.setAttribute("module", "file");
|
|
35720
35522
|
span.setAttribute("source_type", "platform");
|
|
@@ -35731,7 +35533,7 @@ var FileService = class {
|
|
|
35731
35533
|
method: "createSignedUrl",
|
|
35732
35534
|
source_type: "server",
|
|
35733
35535
|
request: {
|
|
35734
|
-
path:
|
|
35536
|
+
path: path2,
|
|
35735
35537
|
expiresIn
|
|
35736
35538
|
}
|
|
35737
35539
|
};
|
|
@@ -35740,7 +35542,7 @@ var FileService = class {
|
|
|
35740
35542
|
const res = await this.fileServiceCore.createSignedUrl({
|
|
35741
35543
|
appId: this.getAppId(),
|
|
35742
35544
|
bucketId: await bucket,
|
|
35743
|
-
filePath:
|
|
35545
|
+
filePath: path2,
|
|
35744
35546
|
expiresIn
|
|
35745
35547
|
});
|
|
35746
35548
|
this.nestLogger.log(JSON.stringify({
|
|
@@ -35809,10 +35611,10 @@ var FileService = class {
|
|
|
35809
35611
|
}
|
|
35810
35612
|
}
|
|
35811
35613
|
};
|
|
35812
|
-
FileService =
|
|
35813
|
-
(0,
|
|
35814
|
-
_ts_param2(1, (0,
|
|
35815
|
-
_ts_param2(2, (0,
|
|
35614
|
+
FileService = _ts_decorate9([
|
|
35615
|
+
(0, import_common9.Injectable)(),
|
|
35616
|
+
_ts_param2(1, (0, import_common9.Inject)(import_nestjs_common4.PLATFORM_HTTP_CLIENT)),
|
|
35617
|
+
_ts_param2(2, (0, import_common9.Inject)(import_nestjs_common4.OBSERVABLE_SERVICE)),
|
|
35816
35618
|
_ts_metadata6("design:type", Function),
|
|
35817
35619
|
_ts_metadata6("design:paramtypes", [
|
|
35818
35620
|
typeof import_nestjs_common4.RequestContextService === "undefined" ? Object : import_nestjs_common4.RequestContextService,
|
|
@@ -35825,21 +35627,21 @@ FileService = _ts_decorate10([
|
|
|
35825
35627
|
var import_nestjs_authzpaas = require("@lark-apaas/nestjs-authzpaas");
|
|
35826
35628
|
|
|
35827
35629
|
// src/modules/static/static.module.ts
|
|
35828
|
-
var
|
|
35630
|
+
var import_common11 = require("@nestjs/common");
|
|
35829
35631
|
|
|
35830
35632
|
// src/modules/static/static.controller.ts
|
|
35831
|
-
var
|
|
35832
|
-
var
|
|
35833
|
-
var
|
|
35633
|
+
var import_common10 = require("@nestjs/common");
|
|
35634
|
+
var import_swagger = require("@nestjs/swagger");
|
|
35635
|
+
var fs = __toESM(require("fs"), 1);
|
|
35834
35636
|
var path = __toESM(require("path"), 1);
|
|
35835
35637
|
var crypto2 = __toESM(require("crypto"), 1);
|
|
35836
|
-
function
|
|
35638
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
35837
35639
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35838
35640
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35839
35641
|
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;
|
|
35840
35642
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35841
35643
|
}
|
|
35842
|
-
__name(
|
|
35644
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
35843
35645
|
function _ts_metadata7(k, v) {
|
|
35844
35646
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35845
35647
|
}
|
|
@@ -35907,7 +35709,7 @@ var StaticController = class _StaticController {
|
|
|
35907
35709
|
static {
|
|
35908
35710
|
__name(this, "StaticController");
|
|
35909
35711
|
}
|
|
35910
|
-
logger = new
|
|
35712
|
+
logger = new import_common10.Logger(_StaticController.name);
|
|
35911
35713
|
staticDir;
|
|
35912
35714
|
constructor() {
|
|
35913
35715
|
this.staticDir = path.resolve(process.cwd(), "shared/static");
|
|
@@ -35928,7 +35730,7 @@ var StaticController = class _StaticController {
|
|
|
35928
35730
|
try {
|
|
35929
35731
|
const relativePath = params["0"] || params["*"] || "";
|
|
35930
35732
|
if (!relativePath) {
|
|
35931
|
-
res.status(
|
|
35733
|
+
res.status(import_common10.HttpStatus.BAD_REQUEST).json({
|
|
35932
35734
|
error: "Bad Request",
|
|
35933
35735
|
message: "File path is required"
|
|
35934
35736
|
});
|
|
@@ -35938,22 +35740,22 @@ var StaticController = class _StaticController {
|
|
|
35938
35740
|
const normalizedPath = path.normalize(filePath);
|
|
35939
35741
|
if (!normalizedPath.startsWith(this.staticDir)) {
|
|
35940
35742
|
this.logger.warn(`Path traversal attempt detected: ${relativePath}`);
|
|
35941
|
-
res.status(
|
|
35743
|
+
res.status(import_common10.HttpStatus.FORBIDDEN).json({
|
|
35942
35744
|
error: "Forbidden",
|
|
35943
35745
|
message: "Access denied"
|
|
35944
35746
|
});
|
|
35945
35747
|
return;
|
|
35946
35748
|
}
|
|
35947
|
-
if (!
|
|
35948
|
-
res.status(
|
|
35749
|
+
if (!fs.existsSync(normalizedPath)) {
|
|
35750
|
+
res.status(import_common10.HttpStatus.NOT_FOUND).json({
|
|
35949
35751
|
error: "Not Found",
|
|
35950
35752
|
message: "File not found"
|
|
35951
35753
|
});
|
|
35952
35754
|
return;
|
|
35953
35755
|
}
|
|
35954
|
-
const stat =
|
|
35756
|
+
const stat = fs.statSync(normalizedPath);
|
|
35955
35757
|
if (stat.isDirectory()) {
|
|
35956
|
-
res.status(
|
|
35758
|
+
res.status(import_common10.HttpStatus.FORBIDDEN).json({
|
|
35957
35759
|
error: "Forbidden",
|
|
35958
35760
|
message: "Directory listing not allowed"
|
|
35959
35761
|
});
|
|
@@ -35963,18 +35765,18 @@ var StaticController = class _StaticController {
|
|
|
35963
35765
|
const etag = generateETag(stat);
|
|
35964
35766
|
const ifNoneMatch = req.headers["if-none-match"];
|
|
35965
35767
|
if (ifNoneMatch === etag) {
|
|
35966
|
-
res.status(
|
|
35768
|
+
res.status(import_common10.HttpStatus.NOT_MODIFIED).end();
|
|
35967
35769
|
return;
|
|
35968
35770
|
}
|
|
35969
35771
|
res.setHeader("Content-Type", mimeType);
|
|
35970
35772
|
res.setHeader("Content-Length", stat.size);
|
|
35971
35773
|
res.setHeader("ETag", etag);
|
|
35972
35774
|
res.setHeader("Cache-Control", "public, max-age=0, must-revalidate");
|
|
35973
|
-
const stream =
|
|
35775
|
+
const stream = fs.createReadStream(normalizedPath);
|
|
35974
35776
|
stream.on("error", (error) => {
|
|
35975
35777
|
this.logger.error(`Error streaming file: ${relativePath}`, error);
|
|
35976
35778
|
if (!res.headersSent) {
|
|
35977
|
-
res.status(
|
|
35779
|
+
res.status(import_common10.HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
35978
35780
|
error: "Internal Server Error",
|
|
35979
35781
|
message: "Failed to read file"
|
|
35980
35782
|
});
|
|
@@ -35984,7 +35786,7 @@ var StaticController = class _StaticController {
|
|
|
35984
35786
|
} catch (error) {
|
|
35985
35787
|
this.logger.error("Error serving static file", error);
|
|
35986
35788
|
if (!res.headersSent) {
|
|
35987
|
-
res.status(
|
|
35789
|
+
res.status(import_common10.HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
35988
35790
|
error: "Internal Server Error",
|
|
35989
35791
|
message: "An unexpected error occurred"
|
|
35990
35792
|
});
|
|
@@ -35992,11 +35794,11 @@ var StaticController = class _StaticController {
|
|
|
35992
35794
|
}
|
|
35993
35795
|
}
|
|
35994
35796
|
};
|
|
35995
|
-
|
|
35996
|
-
(0,
|
|
35997
|
-
_ts_param3(0, (0,
|
|
35998
|
-
_ts_param3(1, (0,
|
|
35999
|
-
_ts_param3(2, (0,
|
|
35797
|
+
_ts_decorate10([
|
|
35798
|
+
(0, import_common10.Get)("*"),
|
|
35799
|
+
_ts_param3(0, (0, import_common10.Param)()),
|
|
35800
|
+
_ts_param3(1, (0, import_common10.Req)()),
|
|
35801
|
+
_ts_param3(2, (0, import_common10.Res)()),
|
|
36000
35802
|
_ts_metadata7("design:type", Function),
|
|
36001
35803
|
_ts_metadata7("design:paramtypes", [
|
|
36002
35804
|
typeof Record === "undefined" ? Object : Record,
|
|
@@ -36005,28 +35807,28 @@ _ts_decorate11([
|
|
|
36005
35807
|
]),
|
|
36006
35808
|
_ts_metadata7("design:returntype", void 0)
|
|
36007
35809
|
], StaticController.prototype, "serveFile", null);
|
|
36008
|
-
StaticController =
|
|
36009
|
-
(0,
|
|
36010
|
-
(0,
|
|
35810
|
+
StaticController = _ts_decorate10([
|
|
35811
|
+
(0, import_swagger.ApiExcludeController)(),
|
|
35812
|
+
(0, import_common10.Controller)("static"),
|
|
36011
35813
|
_ts_metadata7("design:type", Function),
|
|
36012
35814
|
_ts_metadata7("design:paramtypes", [])
|
|
36013
35815
|
], StaticController);
|
|
36014
35816
|
|
|
36015
35817
|
// src/modules/static/static.module.ts
|
|
36016
|
-
function
|
|
35818
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
36017
35819
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36018
35820
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36019
35821
|
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;
|
|
36020
35822
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36021
35823
|
}
|
|
36022
|
-
__name(
|
|
35824
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
36023
35825
|
var StaticModule = class {
|
|
36024
35826
|
static {
|
|
36025
35827
|
__name(this, "StaticModule");
|
|
36026
35828
|
}
|
|
36027
35829
|
};
|
|
36028
|
-
StaticModule =
|
|
36029
|
-
(0,
|
|
35830
|
+
StaticModule = _ts_decorate11([
|
|
35831
|
+
(0, import_common11.Module)({
|
|
36030
35832
|
controllers: [
|
|
36031
35833
|
StaticController
|
|
36032
35834
|
]
|
|
@@ -36034,16 +35836,16 @@ StaticModule = _ts_decorate12([
|
|
|
36034
35836
|
], StaticModule);
|
|
36035
35837
|
|
|
36036
35838
|
// src/modules/html-hot-update/html-hot-update.module.ts
|
|
36037
|
-
var
|
|
35839
|
+
var import_common14 = require("@nestjs/common");
|
|
36038
35840
|
|
|
36039
35841
|
// src/modules/html-hot-update/html-hot-update.controller.ts
|
|
36040
|
-
var
|
|
36041
|
-
var
|
|
35842
|
+
var import_common13 = require("@nestjs/common");
|
|
35843
|
+
var import_swagger2 = require("@nestjs/swagger");
|
|
36042
35844
|
|
|
36043
35845
|
// src/modules/html-hot-update/html-hot-update.service.ts
|
|
36044
|
-
var
|
|
35846
|
+
var import_common12 = require("@nestjs/common");
|
|
35847
|
+
var import_node_fs = require("fs");
|
|
36045
35848
|
var import_node_fs2 = require("fs");
|
|
36046
|
-
var import_node_fs3 = require("fs");
|
|
36047
35849
|
var import_node_crypto = require("crypto");
|
|
36048
35850
|
var import_node_path2 = require("path");
|
|
36049
35851
|
var import_nestjs_common5 = require("@lark-apaas/nestjs-common");
|
|
@@ -36074,13 +35876,13 @@ function setActiveHtmlVersion(version) {
|
|
|
36074
35876
|
__name(setActiveHtmlVersion, "setActiveHtmlVersion");
|
|
36075
35877
|
|
|
36076
35878
|
// src/modules/html-hot-update/html-hot-update.service.ts
|
|
36077
|
-
function
|
|
35879
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
36078
35880
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36079
35881
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36080
35882
|
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;
|
|
36081
35883
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36082
35884
|
}
|
|
36083
|
-
__name(
|
|
35885
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
36084
35886
|
function _ts_metadata8(k, v) {
|
|
36085
35887
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
36086
35888
|
}
|
|
@@ -36123,7 +35925,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36123
35925
|
__name(this, "HtmlHotUpdateService");
|
|
36124
35926
|
}
|
|
36125
35927
|
httpClient;
|
|
36126
|
-
logger = new
|
|
35928
|
+
logger = new import_common12.Logger(_HtmlHotUpdateService.name);
|
|
36127
35929
|
fileLock = new Mutex();
|
|
36128
35930
|
hotUpdateDir = getHotUpdateHtmlDir();
|
|
36129
35931
|
hotUpdateVersionsDir = getHotUpdateVersionsDir();
|
|
@@ -36148,7 +35950,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36148
35950
|
const activeVersion = getActiveHtmlVersion();
|
|
36149
35951
|
if (activeVersion) {
|
|
36150
35952
|
const hotPath = (0, import_node_path2.join)(getHotUpdateVersionDir(activeVersion), fileName);
|
|
36151
|
-
if ((0,
|
|
35953
|
+
if ((0, import_node_fs2.existsSync)(hotPath)) {
|
|
36152
35954
|
return hotPath;
|
|
36153
35955
|
}
|
|
36154
35956
|
}
|
|
@@ -36162,7 +35964,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36162
35964
|
];
|
|
36163
35965
|
}
|
|
36164
35966
|
const activeVersionDir = getHotUpdateVersionDir(activeVersion);
|
|
36165
|
-
return (0,
|
|
35967
|
+
return (0, import_node_fs2.existsSync)(activeVersionDir) ? [
|
|
36166
35968
|
activeVersionDir,
|
|
36167
35969
|
this.originalHtmlDir
|
|
36168
35970
|
] : [
|
|
@@ -36205,28 +36007,28 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36205
36007
|
const version = this.computeVersion(fileMap);
|
|
36206
36008
|
const versionDir = getHotUpdateVersionDir(version);
|
|
36207
36009
|
const currentVersion = getActiveHtmlVersion();
|
|
36208
|
-
if (currentVersion === version && (0,
|
|
36010
|
+
if (currentVersion === version && (0, import_node_fs2.existsSync)(versionDir)) {
|
|
36209
36011
|
this.logger.log(`HTML hot update skipped: version ${version} already active`);
|
|
36210
36012
|
return result;
|
|
36211
36013
|
}
|
|
36212
36014
|
const stagingDir = (0, import_node_path2.join)(this.hotUpdateDir, "staging", `${version}-${process.pid}-${Date.now()}`);
|
|
36213
36015
|
await this.fileLock.acquire();
|
|
36214
36016
|
try {
|
|
36215
|
-
if (getActiveHtmlVersion() === version && (0,
|
|
36017
|
+
if (getActiveHtmlVersion() === version && (0, import_node_fs2.existsSync)(versionDir)) {
|
|
36216
36018
|
this.logger.log(`HTML hot update skipped after lock: version ${version} already active`);
|
|
36217
36019
|
return result;
|
|
36218
36020
|
}
|
|
36219
|
-
await
|
|
36021
|
+
await import_node_fs.promises.mkdir(stagingDir, {
|
|
36220
36022
|
recursive: true
|
|
36221
36023
|
});
|
|
36222
36024
|
for (const [rawFilePath, content] of entries) {
|
|
36223
36025
|
try {
|
|
36224
36026
|
const filePath = this.normalizeFilePath(rawFilePath);
|
|
36225
36027
|
const localPath = (0, import_node_path2.join)(stagingDir, filePath);
|
|
36226
|
-
await
|
|
36028
|
+
await import_node_fs.promises.mkdir((0, import_node_path2.dirname)(localPath), {
|
|
36227
36029
|
recursive: true
|
|
36228
36030
|
});
|
|
36229
|
-
await
|
|
36031
|
+
await import_node_fs.promises.writeFile(localPath, content, "utf-8");
|
|
36230
36032
|
result.updatedFiles.push(filePath);
|
|
36231
36033
|
} catch (error) {
|
|
36232
36034
|
const reason = error instanceof Error ? error.message : String(error);
|
|
@@ -36238,7 +36040,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36238
36040
|
}
|
|
36239
36041
|
}
|
|
36240
36042
|
if (result.updatedFiles.length === 0) {
|
|
36241
|
-
await
|
|
36043
|
+
await import_node_fs.promises.rm(stagingDir, {
|
|
36242
36044
|
recursive: true,
|
|
36243
36045
|
force: true
|
|
36244
36046
|
});
|
|
@@ -36249,7 +36051,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36249
36051
|
await this.cleanupOldVersions(version);
|
|
36250
36052
|
this.logger.log(`HTML hot update activated: version=${version}, files=${result.updatedFiles.length}`);
|
|
36251
36053
|
} finally {
|
|
36252
|
-
await
|
|
36054
|
+
await import_node_fs.promises.rm(stagingDir, {
|
|
36253
36055
|
recursive: true,
|
|
36254
36056
|
force: true
|
|
36255
36057
|
}).catch(() => void 0);
|
|
@@ -36258,11 +36060,11 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36258
36060
|
return result;
|
|
36259
36061
|
}
|
|
36260
36062
|
async promoteVersionDirectory(stagingDir, versionDir) {
|
|
36261
|
-
await
|
|
36063
|
+
await import_node_fs.promises.mkdir(this.hotUpdateVersionsDir, {
|
|
36262
36064
|
recursive: true
|
|
36263
36065
|
});
|
|
36264
36066
|
try {
|
|
36265
|
-
await
|
|
36067
|
+
await import_node_fs.promises.rename(stagingDir, versionDir);
|
|
36266
36068
|
} catch (error) {
|
|
36267
36069
|
const err = error;
|
|
36268
36070
|
if (err.code !== "EEXIST") {
|
|
@@ -36273,11 +36075,11 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36273
36075
|
async cleanupOldVersions(activeVersion) {
|
|
36274
36076
|
let versions = [];
|
|
36275
36077
|
try {
|
|
36276
|
-
versions = await
|
|
36078
|
+
versions = await import_node_fs.promises.readdir(this.hotUpdateVersionsDir);
|
|
36277
36079
|
} catch {
|
|
36278
36080
|
return;
|
|
36279
36081
|
}
|
|
36280
|
-
await Promise.all(versions.filter((version) => version !== activeVersion).map((version) =>
|
|
36082
|
+
await Promise.all(versions.filter((version) => version !== activeVersion).map((version) => import_node_fs.promises.rm(getHotUpdateVersionDir(version), {
|
|
36281
36083
|
recursive: true,
|
|
36282
36084
|
force: true
|
|
36283
36085
|
})));
|
|
@@ -36325,9 +36127,9 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36325
36127
|
return "";
|
|
36326
36128
|
}
|
|
36327
36129
|
};
|
|
36328
|
-
HtmlHotUpdateService =
|
|
36329
|
-
(0,
|
|
36330
|
-
_ts_param4(0, (0,
|
|
36130
|
+
HtmlHotUpdateService = _ts_decorate12([
|
|
36131
|
+
(0, import_common12.Injectable)(),
|
|
36132
|
+
_ts_param4(0, (0, import_common12.Inject)(import_nestjs_common5.PLATFORM_HTTP_CLIENT)),
|
|
36331
36133
|
_ts_metadata8("design:type", Function),
|
|
36332
36134
|
_ts_metadata8("design:paramtypes", [
|
|
36333
36135
|
typeof PlatformHttpClient === "undefined" ? Object : PlatformHttpClient
|
|
@@ -36335,13 +36137,13 @@ HtmlHotUpdateService = _ts_decorate13([
|
|
|
36335
36137
|
], HtmlHotUpdateService);
|
|
36336
36138
|
|
|
36337
36139
|
// src/modules/html-hot-update/html-hot-update.controller.ts
|
|
36338
|
-
function
|
|
36140
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
36339
36141
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36340
36142
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36341
36143
|
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;
|
|
36342
36144
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36343
36145
|
}
|
|
36344
|
-
__name(
|
|
36146
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
36345
36147
|
function _ts_metadata9(k, v) {
|
|
36346
36148
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
36347
36149
|
}
|
|
@@ -36364,7 +36166,7 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
|
|
|
36364
36166
|
__name(this, "HtmlHotUpdateController");
|
|
36365
36167
|
}
|
|
36366
36168
|
htmlHotUpdateService;
|
|
36367
|
-
logger = new
|
|
36169
|
+
logger = new import_common13.Logger(_HtmlHotUpdateController.name);
|
|
36368
36170
|
constructor(htmlHotUpdateService) {
|
|
36369
36171
|
this.htmlHotUpdateService = htmlHotUpdateService;
|
|
36370
36172
|
}
|
|
@@ -36406,19 +36208,19 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
|
|
|
36406
36208
|
}
|
|
36407
36209
|
}
|
|
36408
36210
|
};
|
|
36409
|
-
|
|
36410
|
-
(0,
|
|
36411
|
-
(0,
|
|
36412
|
-
_ts_param5(0, (0,
|
|
36211
|
+
_ts_decorate13([
|
|
36212
|
+
(0, import_common13.Post)("update_html_files"),
|
|
36213
|
+
(0, import_common13.HttpCode)(import_common13.HttpStatus.OK),
|
|
36214
|
+
_ts_param5(0, (0, import_common13.Body)()),
|
|
36413
36215
|
_ts_metadata9("design:type", Function),
|
|
36414
36216
|
_ts_metadata9("design:paramtypes", [
|
|
36415
36217
|
typeof UpdateHtmlFilesDto === "undefined" ? Object : UpdateHtmlFilesDto
|
|
36416
36218
|
]),
|
|
36417
36219
|
_ts_metadata9("design:returntype", Promise)
|
|
36418
36220
|
], HtmlHotUpdateController.prototype, "updateHtmlFiles", null);
|
|
36419
|
-
HtmlHotUpdateController =
|
|
36420
|
-
(0,
|
|
36421
|
-
(0,
|
|
36221
|
+
HtmlHotUpdateController = _ts_decorate13([
|
|
36222
|
+
(0, import_swagger2.ApiExcludeController)(),
|
|
36223
|
+
(0, import_common13.Controller)("__innerapi__"),
|
|
36422
36224
|
_ts_metadata9("design:type", Function),
|
|
36423
36225
|
_ts_metadata9("design:paramtypes", [
|
|
36424
36226
|
typeof HtmlHotUpdateService === "undefined" ? Object : HtmlHotUpdateService
|
|
@@ -36426,20 +36228,20 @@ HtmlHotUpdateController = _ts_decorate14([
|
|
|
36426
36228
|
], HtmlHotUpdateController);
|
|
36427
36229
|
|
|
36428
36230
|
// src/modules/html-hot-update/html-hot-update.module.ts
|
|
36429
|
-
function
|
|
36231
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
36430
36232
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36431
36233
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36432
36234
|
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;
|
|
36433
36235
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36434
36236
|
}
|
|
36435
|
-
__name(
|
|
36237
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
36436
36238
|
var HtmlHotUpdateModule = class {
|
|
36437
36239
|
static {
|
|
36438
36240
|
__name(this, "HtmlHotUpdateModule");
|
|
36439
36241
|
}
|
|
36440
36242
|
};
|
|
36441
|
-
HtmlHotUpdateModule =
|
|
36442
|
-
(0,
|
|
36243
|
+
HtmlHotUpdateModule = _ts_decorate14([
|
|
36244
|
+
(0, import_common14.Module)({
|
|
36443
36245
|
controllers: [
|
|
36444
36246
|
HtmlHotUpdateController
|
|
36445
36247
|
],
|
|
@@ -36453,16 +36255,16 @@ HtmlHotUpdateModule = _ts_decorate15([
|
|
|
36453
36255
|
], HtmlHotUpdateModule);
|
|
36454
36256
|
|
|
36455
36257
|
// src/middlewares/html-hot-update-view/index.ts
|
|
36456
|
-
var
|
|
36457
|
-
var
|
|
36258
|
+
var import_common15 = require("@nestjs/common");
|
|
36259
|
+
var import_node_fs3 = require("fs");
|
|
36458
36260
|
var import_node_path3 = require("path");
|
|
36459
|
-
function
|
|
36261
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
36460
36262
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36461
36263
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36462
36264
|
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;
|
|
36463
36265
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36464
36266
|
}
|
|
36465
|
-
__name(
|
|
36267
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
36466
36268
|
var HtmlHotUpdateViewMiddleware = class {
|
|
36467
36269
|
static {
|
|
36468
36270
|
__name(this, "HtmlHotUpdateViewMiddleware");
|
|
@@ -36481,7 +36283,7 @@ var HtmlHotUpdateViewMiddleware = class {
|
|
|
36481
36283
|
}
|
|
36482
36284
|
const activeVersion = getActiveHtmlVersion();
|
|
36483
36285
|
const hotPath = activeVersion ? (0, import_node_path3.join)(getHotUpdateVersionDir(activeVersion), `${view}.html`) : "";
|
|
36484
|
-
if (hotPath && (0,
|
|
36286
|
+
if (hotPath && (0, import_node_fs3.existsSync)(hotPath)) {
|
|
36485
36287
|
return originalRender(hotPath, renderOptions, renderCallback);
|
|
36486
36288
|
}
|
|
36487
36289
|
return originalRender(view, renderOptions, renderCallback);
|
|
@@ -36489,18 +36291,18 @@ var HtmlHotUpdateViewMiddleware = class {
|
|
|
36489
36291
|
next();
|
|
36490
36292
|
}
|
|
36491
36293
|
};
|
|
36492
|
-
HtmlHotUpdateViewMiddleware =
|
|
36493
|
-
(0,
|
|
36294
|
+
HtmlHotUpdateViewMiddleware = _ts_decorate15([
|
|
36295
|
+
(0, import_common15.Injectable)()
|
|
36494
36296
|
], HtmlHotUpdateViewMiddleware);
|
|
36495
36297
|
|
|
36496
36298
|
// src/modules/platform/module.ts
|
|
36497
|
-
function
|
|
36299
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
36498
36300
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36499
36301
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36500
36302
|
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;
|
|
36501
36303
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36502
36304
|
}
|
|
36503
|
-
__name(
|
|
36305
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
36504
36306
|
var PLATFORM_MODULE_OPTIONS = /* @__PURE__ */ Symbol("PLATFORM_MODULE_OPTIONS");
|
|
36505
36307
|
var PlatformModule = class _PlatformModule {
|
|
36506
36308
|
static {
|
|
@@ -36588,7 +36390,7 @@ var PlatformModule = class _PlatformModule {
|
|
|
36588
36390
|
},
|
|
36589
36391
|
{
|
|
36590
36392
|
provide: import_core2.APP_PIPE,
|
|
36591
|
-
useValue: new
|
|
36393
|
+
useValue: new import_common16.ValidationPipe({
|
|
36592
36394
|
transform: true,
|
|
36593
36395
|
transformOptions: {
|
|
36594
36396
|
enableImplicitConversion: true
|
|
@@ -36645,9 +36447,6 @@ var PlatformModule = class _PlatformModule {
|
|
|
36645
36447
|
if (process.env.NODE_ENV === "development") {
|
|
36646
36448
|
consumer.apply(FrameworkDebugMiddleware).forRoutes("/api/__framework__/debug");
|
|
36647
36449
|
}
|
|
36648
|
-
if (process.env.NODE_ENV !== "production") {
|
|
36649
|
-
consumer.apply(OpenApiSpecMiddleware).forRoutes("/api/__framework__/openapi-spec");
|
|
36650
|
-
}
|
|
36651
36450
|
consumer.apply(UserContextMiddleware, RequestContextMiddleware, import_nestjs_logger2.LoggerContextMiddleware, import_nestjs_observable.ObservableTraceMiddleware, ...DISABLE_DATAPASS ? [] : [
|
|
36652
36451
|
import_nestjs_datapaas.SqlExecutionContextMiddleware
|
|
36653
36452
|
]).forRoutes("/*");
|
|
@@ -36666,13 +36465,12 @@ var PlatformModule = class _PlatformModule {
|
|
|
36666
36465
|
}
|
|
36667
36466
|
}
|
|
36668
36467
|
};
|
|
36669
|
-
PlatformModule =
|
|
36670
|
-
(0,
|
|
36671
|
-
(0,
|
|
36468
|
+
PlatformModule = _ts_decorate16([
|
|
36469
|
+
(0, import_common16.Global)(),
|
|
36470
|
+
(0, import_common16.Module)({})
|
|
36672
36471
|
], PlatformModule);
|
|
36673
36472
|
|
|
36674
36473
|
// src/setup.ts
|
|
36675
|
-
var import_node_path4 = __toESM(require("path"), 1);
|
|
36676
36474
|
var import_nestjs_logger3 = require("@lark-apaas/nestjs-logger");
|
|
36677
36475
|
var import_cookie_parser = __toESM(require("cookie-parser"), 1);
|
|
36678
36476
|
var import_express = __toESM(require_express2(), 1);
|
|
@@ -36745,11 +36543,6 @@ async function configureApp(app, perms = defaultPerms) {
|
|
|
36745
36543
|
console.error("[OpenAPI] OpenAPI \u751F\u6210\u5931\u8D25:", err);
|
|
36746
36544
|
}
|
|
36747
36545
|
}
|
|
36748
|
-
if (process.env.NODE_ENV !== "production") {
|
|
36749
|
-
registerOpenApiSpecEndpoint(app, {
|
|
36750
|
-
openapiFile: import_node_path4.default.resolve(process.cwd(), "docs/openapi.json")
|
|
36751
|
-
});
|
|
36752
|
-
}
|
|
36753
36546
|
console.log("App Started Successfully.");
|
|
36754
36547
|
}
|
|
36755
36548
|
__name(configureApp, "configureApp");
|
|
@@ -36786,7 +36579,6 @@ var import_nestjs_authzpaas2 = require("@lark-apaas/nestjs-authzpaas");
|
|
|
36786
36579
|
ViewContextMiddleware,
|
|
36787
36580
|
configureApp,
|
|
36788
36581
|
createLegacyPathRedirectMiddleware,
|
|
36789
|
-
registerOpenApiSpecEndpoint,
|
|
36790
36582
|
...require("@lark-apaas/nestjs-authnpaas"),
|
|
36791
36583
|
...require("@lark-apaas/nestjs-capability"),
|
|
36792
36584
|
...require("@lark-apaas/nestjs-datapaas"),
|