@lark-apaas/fullstack-nestjs-core 1.1.34-alpha.68 → 1.1.34-alpha.69

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 CHANGED
@@ -1371,8 +1371,8 @@ var require_node = __commonJS({
1371
1371
  }
1372
1372
  break;
1373
1373
  case "FILE":
1374
- var fs3 = require("fs");
1375
- stream2 = new fs3.SyncWriteStream(fd2, {
1374
+ var fs4 = require("fs");
1375
+ stream2 = new fs4.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(path2) {
14219
- if (!path2 || typeof path2 !== "string") {
14218
+ function lookup(path3) {
14219
+ if (!path3 || typeof path3 !== "string") {
14220
14220
  return false;
14221
14221
  }
14222
- var extension2 = extname2("x." + path2).toLowerCase().substr(1);
14222
+ var extension2 = extname2("x." + path3).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 fs3 = require("fs");
18073
- stream2 = new fs3.SyncWriteStream(fd2, {
18072
+ var fs4 = require("fs");
18073
+ stream2 = new fs4.SyncWriteStream(fd2, {
18074
18074
  autoClose: false
18075
18075
  });
18076
18076
  stream2._type = "fs";
@@ -18839,8 +18839,8 @@ var require_node3 = __commonJS({
18839
18839
  }
18840
18840
  break;
18841
18841
  case "FILE":
18842
- var fs3 = require("fs");
18843
- stream2 = new fs3.SyncWriteStream(fd2, {
18842
+ var fs4 = require("fs");
18843
+ stream2 = new fs4.SyncWriteStream(fd2, {
18844
18844
  autoClose: false
18845
18845
  });
18846
18846
  stream2._type = "fs";
@@ -18937,7 +18937,7 @@ var require_path_to_regexp = __commonJS({
18937
18937
  "use strict";
18938
18938
  module2.exports = pathToRegexp;
18939
18939
  var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
18940
- function pathToRegexp(path2, keys, options) {
18940
+ function pathToRegexp(path3, keys, options) {
18941
18941
  options = options || {};
18942
18942
  keys = keys || [];
18943
18943
  var strict = options.strict;
@@ -18951,8 +18951,8 @@ var require_path_to_regexp = __commonJS({
18951
18951
  var pos = 0;
18952
18952
  var backtrack = "";
18953
18953
  var m;
18954
- if (path2 instanceof RegExp) {
18955
- while (m = MATCHING_GROUP_REGEXP.exec(path2.source)) {
18954
+ if (path3 instanceof RegExp) {
18955
+ while (m = MATCHING_GROUP_REGEXP.exec(path3.source)) {
18956
18956
  if (m[0][0] === "\\") continue;
18957
18957
  keys.push({
18958
18958
  name: m[1] || name++,
@@ -18960,18 +18960,18 @@ var require_path_to_regexp = __commonJS({
18960
18960
  offset: m.index
18961
18961
  });
18962
18962
  }
18963
- return path2;
18963
+ return path3;
18964
18964
  }
18965
- if (Array.isArray(path2)) {
18966
- path2 = path2.map(function(value) {
18965
+ if (Array.isArray(path3)) {
18966
+ path3 = path3.map(function(value) {
18967
18967
  return pathToRegexp(value, keys, options).source;
18968
18968
  });
18969
- return new RegExp(path2.join("|"), flags);
18969
+ return new RegExp(path3.join("|"), flags);
18970
18970
  }
18971
- if (typeof path2 !== "string") {
18971
+ if (typeof path3 !== "string") {
18972
18972
  throw new TypeError("path must be a string, array of strings, or regular expression");
18973
18973
  }
18974
- path2 = path2.replace(/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g, function(match, slash, format, key, capture, star, optional, offset) {
18974
+ path3 = path3.replace(/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g, function(match, slash, format, key, capture, star, optional, offset) {
18975
18975
  if (match[0] === "\\") {
18976
18976
  backtrack += match;
18977
18977
  pos += 2;
@@ -18986,7 +18986,7 @@ var require_path_to_regexp = __commonJS({
18986
18986
  if (slash || format) {
18987
18987
  backtrack = "";
18988
18988
  } else {
18989
- backtrack += path2.slice(pos, offset);
18989
+ backtrack += path3.slice(pos, offset);
18990
18990
  }
18991
18991
  pos = offset + match.length;
18992
18992
  if (match === "*") {
@@ -19013,7 +19013,7 @@ var require_path_to_regexp = __commonJS({
19013
19013
  extraOffset += result.length - match.length;
19014
19014
  return result;
19015
19015
  });
19016
- while (m = MATCHING_GROUP_REGEXP.exec(path2)) {
19016
+ while (m = MATCHING_GROUP_REGEXP.exec(path3)) {
19017
19017
  if (m[0][0] === "\\") continue;
19018
19018
  if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
19019
19019
  keys.splice(keysOffset + i, 0, {
@@ -19024,13 +19024,13 @@ var require_path_to_regexp = __commonJS({
19024
19024
  }
19025
19025
  i++;
19026
19026
  }
19027
- path2 += strict ? "" : path2[path2.length - 1] === "/" ? "?" : "/?";
19027
+ path3 += strict ? "" : path3[path3.length - 1] === "/" ? "?" : "/?";
19028
19028
  if (end) {
19029
- path2 += "$";
19030
- } else if (path2[path2.length - 1] !== "/") {
19031
- path2 += lookahead ? "(?=/|$)" : "(?:/|$)";
19029
+ path3 += "$";
19030
+ } else if (path3[path3.length - 1] !== "/") {
19031
+ path3 += lookahead ? "(?=/|$)" : "(?:/|$)";
19032
19032
  }
19033
- return new RegExp("^" + path2, flags);
19033
+ return new RegExp("^" + path3, flags);
19034
19034
  }
19035
19035
  __name(pathToRegexp, "pathToRegexp");
19036
19036
  }
@@ -19044,19 +19044,19 @@ var require_layer = __commonJS({
19044
19044
  var debug = require_src3()("express:router:layer");
19045
19045
  var hasOwnProperty = Object.prototype.hasOwnProperty;
19046
19046
  module2.exports = Layer;
19047
- function Layer(path2, options, fn) {
19047
+ function Layer(path3, options, fn) {
19048
19048
  if (!(this instanceof Layer)) {
19049
- return new Layer(path2, options, fn);
19049
+ return new Layer(path3, options, fn);
19050
19050
  }
19051
- debug("new %o", path2);
19051
+ debug("new %o", path3);
19052
19052
  var opts = options || {};
19053
19053
  this.handle = fn;
19054
19054
  this.name = fn.name || "<anonymous>";
19055
19055
  this.params = void 0;
19056
19056
  this.path = void 0;
19057
- this.regexp = pathRegexp(path2, this.keys = [], opts);
19058
- this.regexp.fast_star = path2 === "*";
19059
- this.regexp.fast_slash = path2 === "/" && opts.end === false;
19057
+ this.regexp = pathRegexp(path3, this.keys = [], opts);
19058
+ this.regexp.fast_star = path3 === "*";
19059
+ this.regexp.fast_slash = path3 === "/" && opts.end === false;
19060
19060
  }
19061
19061
  __name(Layer, "Layer");
19062
19062
  Layer.prototype.handle_error = /* @__PURE__ */ __name(function handle_error(error, req, res, next) {
@@ -19081,9 +19081,9 @@ var require_layer = __commonJS({
19081
19081
  next(err);
19082
19082
  }
19083
19083
  }, "handle");
19084
- Layer.prototype.match = /* @__PURE__ */ __name(function match(path2) {
19084
+ Layer.prototype.match = /* @__PURE__ */ __name(function match(path3) {
19085
19085
  var match2;
19086
- if (path2 != null) {
19086
+ if (path3 != null) {
19087
19087
  if (this.regexp.fast_slash) {
19088
19088
  this.params = {};
19089
19089
  this.path = "";
@@ -19091,12 +19091,12 @@ var require_layer = __commonJS({
19091
19091
  }
19092
19092
  if (this.regexp.fast_star) {
19093
19093
  this.params = {
19094
- "0": decode_param(path2)
19094
+ "0": decode_param(path3)
19095
19095
  };
19096
- this.path = path2;
19096
+ this.path = path3;
19097
19097
  return true;
19098
19098
  }
19099
- match2 = this.regexp.exec(path2);
19099
+ match2 = this.regexp.exec(path3);
19100
19100
  }
19101
19101
  if (!match2) {
19102
19102
  this.params = void 0;
@@ -19192,10 +19192,10 @@ var require_route = __commonJS({
19192
19192
  var slice = Array.prototype.slice;
19193
19193
  var toString = Object.prototype.toString;
19194
19194
  module2.exports = Route;
19195
- function Route(path2) {
19196
- this.path = path2;
19195
+ function Route(path3) {
19196
+ this.path = path3;
19197
19197
  this.stack = [];
19198
- debug("new %o", path2);
19198
+ debug("new %o", path3);
19199
19199
  this.methods = {};
19200
19200
  }
19201
19201
  __name(Route, "Route");
@@ -19411,8 +19411,8 @@ var require_router = __commonJS({
19411
19411
  if (++sync > 100) {
19412
19412
  return setImmediate(next, err);
19413
19413
  }
19414
- var path2 = getPathname(req);
19415
- if (path2 == null) {
19414
+ var path3 = getPathname(req);
19415
+ if (path3 == null) {
19416
19416
  return done(layerError);
19417
19417
  }
19418
19418
  var layer;
@@ -19420,7 +19420,7 @@ var require_router = __commonJS({
19420
19420
  var route;
19421
19421
  while (match !== true && idx < stack.length) {
19422
19422
  layer = stack[idx++];
19423
- match = matchLayer(layer, path2);
19423
+ match = matchLayer(layer, path3);
19424
19424
  route = layer.route;
19425
19425
  if (typeof match !== "boolean") {
19426
19426
  layerError = layerError || match;
@@ -19458,19 +19458,19 @@ var require_router = __commonJS({
19458
19458
  } else if (route) {
19459
19459
  layer.handle_request(req, res, next);
19460
19460
  } else {
19461
- trim_prefix(layer, layerError, layerPath, path2);
19461
+ trim_prefix(layer, layerError, layerPath, path3);
19462
19462
  }
19463
19463
  sync = 0;
19464
19464
  });
19465
19465
  }
19466
19466
  __name(next, "next");
19467
- function trim_prefix(layer, layerError, layerPath, path2) {
19467
+ function trim_prefix(layer, layerError, layerPath, path3) {
19468
19468
  if (layerPath.length !== 0) {
19469
- if (layerPath !== path2.slice(0, layerPath.length)) {
19469
+ if (layerPath !== path3.slice(0, layerPath.length)) {
19470
19470
  next(layerError);
19471
19471
  return;
19472
19472
  }
19473
- var c = path2[layerPath.length];
19473
+ var c = path3[layerPath.length];
19474
19474
  if (c && c !== "/" && c !== ".") return next(layerError);
19475
19475
  debug("trim prefix (%s) from url %s", layerPath, req.url);
19476
19476
  removed = layerPath;
@@ -19551,7 +19551,7 @@ var require_router = __commonJS({
19551
19551
  }, "process_params");
19552
19552
  proto.use = /* @__PURE__ */ __name(function use(fn) {
19553
19553
  var offset = 0;
19554
- var path2 = "/";
19554
+ var path3 = "/";
19555
19555
  if (typeof fn !== "function") {
19556
19556
  var arg = fn;
19557
19557
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -19559,7 +19559,7 @@ var require_router = __commonJS({
19559
19559
  }
19560
19560
  if (typeof arg !== "function") {
19561
19561
  offset = 1;
19562
- path2 = fn;
19562
+ path3 = fn;
19563
19563
  }
19564
19564
  }
19565
19565
  var callbacks = flatten(slice.call(arguments, offset));
@@ -19571,8 +19571,8 @@ var require_router = __commonJS({
19571
19571
  if (typeof fn !== "function") {
19572
19572
  throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
19573
19573
  }
19574
- debug("use %o %s", path2, fn.name || "<anonymous>");
19575
- var layer = new Layer(path2, {
19574
+ debug("use %o %s", path3, fn.name || "<anonymous>");
19575
+ var layer = new Layer(path3, {
19576
19576
  sensitive: this.caseSensitive,
19577
19577
  strict: false,
19578
19578
  end: false
@@ -19582,9 +19582,9 @@ var require_router = __commonJS({
19582
19582
  }
19583
19583
  return this;
19584
19584
  }, "use");
19585
- proto.route = /* @__PURE__ */ __name(function route(path2) {
19586
- var route2 = new Route(path2);
19587
- var layer = new Layer(path2, {
19585
+ proto.route = /* @__PURE__ */ __name(function route(path3) {
19586
+ var route2 = new Route(path3);
19587
+ var layer = new Layer(path3, {
19588
19588
  sensitive: this.caseSensitive,
19589
19589
  strict: this.strict,
19590
19590
  end: true
@@ -19594,8 +19594,8 @@ var require_router = __commonJS({
19594
19594
  return route2;
19595
19595
  }, "route");
19596
19596
  methods.concat("all").forEach(function(method) {
19597
- proto[method] = function(path2) {
19598
- var route = this.route(path2);
19597
+ proto[method] = function(path3) {
19598
+ var route = this.route(path3);
19599
19599
  route[method].apply(route, slice.call(arguments, 1));
19600
19600
  return this;
19601
19601
  };
@@ -19635,9 +19635,9 @@ var require_router = __commonJS({
19635
19635
  return toString.call(obj).replace(objectRegExp, "$1");
19636
19636
  }
19637
19637
  __name(gettype, "gettype");
19638
- function matchLayer(layer, path2) {
19638
+ function matchLayer(layer, path3) {
19639
19639
  try {
19640
- return layer.match(path2);
19640
+ return layer.match(path3);
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 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;
20636
+ var path3 = require("path");
20637
+ var fs4 = require("fs");
20638
+ var dirname2 = path3.dirname;
20639
+ var basename = path3.basename;
20640
+ var extname2 = path3.extname;
20641
+ var join5 = path3.join;
20642
+ var resolve2 = path3.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 path3;
20672
+ var path4;
20673
20673
  var roots = [].concat(this.root);
20674
20674
  debug('lookup "%s"', name);
20675
- for (var i = 0; i < roots.length && !path3; i++) {
20675
+ for (var i = 0; i < roots.length && !path4; 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
- path3 = this.resolve(dir, file);
20680
+ path4 = this.resolve(dir, file);
20681
20681
  }
20682
- return path3;
20682
+ return path4;
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 path3 = join5(dir, file);
20691
- var stat = tryStat(path3);
20690
+ var path4 = join5(dir, file);
20691
+ var stat = tryStat(path4);
20692
20692
  if (stat && stat.isFile()) {
20693
- return path3;
20693
+ return path4;
20694
20694
  }
20695
- path3 = join5(dir, basename(file, ext), "index" + ext);
20696
- stat = tryStat(path3);
20695
+ path4 = join5(dir, basename(file, ext), "index" + ext);
20696
+ stat = tryStat(path4);
20697
20697
  if (stat && stat.isFile()) {
20698
- return path3;
20698
+ return path4;
20699
20699
  }
20700
20700
  }, "resolve");
20701
- function tryStat(path3) {
20702
- debug('stat "%s"', path3);
20701
+ function tryStat(path4) {
20702
+ debug('stat "%s"', path4);
20703
20703
  try {
20704
- return fs3.statSync(path3);
20704
+ return fs4.statSync(path4);
20705
20705
  } catch (e) {
20706
20706
  return void 0;
20707
20707
  }
@@ -21350,8 +21350,8 @@ var require_node4 = __commonJS({
21350
21350
  }
21351
21351
  break;
21352
21352
  case "FILE":
21353
- var fs3 = require("fs");
21354
- stream2 = new fs3.SyncWriteStream(fd2, {
21353
+ var fs4 = require("fs");
21354
+ stream2 = new fs4.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 path2 = require("path");
21540
- var fs3 = require("fs");
21539
+ var path3 = require("path");
21540
+ var fs4 = require("fs");
21541
21541
  function Mime() {
21542
21542
  this.types = /* @__PURE__ */ Object.create(null);
21543
21543
  this.extensions = /* @__PURE__ */ Object.create(null);
@@ -21559,7 +21559,7 @@ var require_mime = __commonJS({
21559
21559
  };
21560
21560
  Mime.prototype.load = function(file) {
21561
21561
  this._loading = file;
21562
- var map = {}, content = fs3.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
21562
+ var map = {}, content = fs4.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
21563
21563
  lines.forEach(function(line) {
21564
21564
  var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
21565
21565
  map[fields.shift()] = fields;
@@ -21567,8 +21567,8 @@ var require_mime = __commonJS({
21567
21567
  this.define(map);
21568
21568
  this._loading = null;
21569
21569
  };
21570
- Mime.prototype.lookup = function(path3, fallback) {
21571
- var ext = path3.replace(/^.*[\.\/\\]/, "").toLowerCase();
21570
+ Mime.prototype.lookup = function(path4, fallback) {
21571
+ var ext = path4.replace(/^.*[\.\/\\]/, "").toLowerCase();
21572
21572
  return this.types[ext] || fallback || this.default_type;
21573
21573
  };
21574
21574
  Mime.prototype.extension = function(mimeType) {
@@ -21804,34 +21804,34 @@ var require_send = __commonJS({
21804
21804
  var escapeHtml = require_escape_html();
21805
21805
  var etag = require_etag();
21806
21806
  var fresh = require_fresh();
21807
- var fs3 = require("fs");
21807
+ var fs4 = require("fs");
21808
21808
  var mime = require_mime();
21809
21809
  var ms = require_ms5();
21810
21810
  var onFinished = require_on_finished();
21811
21811
  var parseRange = require_range_parser();
21812
- var path2 = require("path");
21812
+ var path3 = require("path");
21813
21813
  var statuses = require_statuses();
21814
21814
  var Stream = require("stream");
21815
21815
  var util = require("util");
21816
- var extname2 = path2.extname;
21817
- var join5 = path2.join;
21818
- var normalize2 = path2.normalize;
21819
- var resolve2 = path2.resolve;
21820
- var sep = path2.sep;
21816
+ var extname2 = path3.extname;
21817
+ var join5 = path3.join;
21818
+ var normalize2 = path3.normalize;
21819
+ var resolve2 = path3.resolve;
21820
+ var sep = path3.sep;
21821
21821
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
21822
21822
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
21823
21823
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
21824
21824
  module2.exports = send;
21825
21825
  module2.exports.mime = mime;
21826
- function send(req, path3, options) {
21827
- return new SendStream(req, path3, options);
21826
+ function send(req, path4, options) {
21827
+ return new SendStream(req, path4, options);
21828
21828
  }
21829
21829
  __name(send, "send");
21830
- function SendStream(req, path3, options) {
21830
+ function SendStream(req, path4, options) {
21831
21831
  Stream.call(this);
21832
21832
  var opts = options || {};
21833
21833
  this.options = opts;
21834
- this.path = path3;
21834
+ this.path = path4;
21835
21835
  this.req = req;
21836
21836
  this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
21837
21837
  this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
@@ -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(path3) {
21884
- this._root = resolve2(String(path3));
21883
+ SendStream.prototype.root = /* @__PURE__ */ __name(function root(path4) {
21884
+ this._root = resolve2(String(path4));
21885
21885
  debug("root %s", this._root);
21886
21886
  return this;
21887
21887
  }, "root");
@@ -21988,10 +21988,10 @@ var require_send = __commonJS({
21988
21988
  var lastModified = this.res.getHeader("Last-Modified");
21989
21989
  return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
21990
21990
  }, "isRangeFresh");
21991
- SendStream.prototype.redirect = /* @__PURE__ */ __name(function redirect(path3) {
21991
+ SendStream.prototype.redirect = /* @__PURE__ */ __name(function redirect(path4) {
21992
21992
  var res = this.res;
21993
21993
  if (hasListeners(this, "directory")) {
21994
- this.emit("directory", res, path3);
21994
+ this.emit("directory", res, path4);
21995
21995
  return;
21996
21996
  }
21997
21997
  if (this.hasTrailingSlash()) {
@@ -22011,42 +22011,42 @@ var require_send = __commonJS({
22011
22011
  SendStream.prototype.pipe = /* @__PURE__ */ __name(function pipe(res) {
22012
22012
  var root = this._root;
22013
22013
  this.res = res;
22014
- var path3 = decode(this.path);
22015
- if (path3 === -1) {
22014
+ var path4 = decode(this.path);
22015
+ if (path4 === -1) {
22016
22016
  this.error(400);
22017
22017
  return res;
22018
22018
  }
22019
- if (~path3.indexOf("\0")) {
22019
+ if (~path4.indexOf("\0")) {
22020
22020
  this.error(400);
22021
22021
  return res;
22022
22022
  }
22023
22023
  var parts;
22024
22024
  if (root !== null) {
22025
- if (path3) {
22026
- path3 = normalize2("." + sep + path3);
22025
+ if (path4) {
22026
+ path4 = normalize2("." + sep + path4);
22027
22027
  }
22028
- if (UP_PATH_REGEXP.test(path3)) {
22029
- debug('malicious path "%s"', path3);
22028
+ if (UP_PATH_REGEXP.test(path4)) {
22029
+ debug('malicious path "%s"', path4);
22030
22030
  this.error(403);
22031
22031
  return res;
22032
22032
  }
22033
- parts = path3.split(sep);
22034
- path3 = normalize2(join5(root, path3));
22033
+ parts = path4.split(sep);
22034
+ path4 = normalize2(join5(root, path4));
22035
22035
  } else {
22036
- if (UP_PATH_REGEXP.test(path3)) {
22037
- debug('malicious path "%s"', path3);
22036
+ if (UP_PATH_REGEXP.test(path4)) {
22037
+ debug('malicious path "%s"', path4);
22038
22038
  this.error(403);
22039
22039
  return res;
22040
22040
  }
22041
- parts = normalize2(path3).split(sep);
22042
- path3 = resolve2(path3);
22041
+ parts = normalize2(path4).split(sep);
22042
+ path4 = resolve2(path4);
22043
22043
  }
22044
22044
  if (containsDotFile(parts)) {
22045
22045
  var access = this._dotfiles;
22046
22046
  if (access === void 0) {
22047
22047
  access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
22048
22048
  }
22049
- debug('%s dotfile "%s"', access, path3);
22049
+ debug('%s dotfile "%s"', access, path4);
22050
22050
  switch (access) {
22051
22051
  case "allow":
22052
22052
  break;
@@ -22060,13 +22060,13 @@ var require_send = __commonJS({
22060
22060
  }
22061
22061
  }
22062
22062
  if (this._index.length && this.hasTrailingSlash()) {
22063
- this.sendIndex(path3);
22063
+ this.sendIndex(path4);
22064
22064
  return res;
22065
22065
  }
22066
- this.sendFile(path3);
22066
+ this.sendFile(path4);
22067
22067
  return res;
22068
22068
  }, "pipe");
22069
- SendStream.prototype.send = /* @__PURE__ */ __name(function send2(path3, stat) {
22069
+ SendStream.prototype.send = /* @__PURE__ */ __name(function send2(path4, stat) {
22070
22070
  var len = stat.size;
22071
22071
  var options = this.options;
22072
22072
  var opts = {};
@@ -22078,9 +22078,9 @@ var require_send = __commonJS({
22078
22078
  this.headersAlreadySent();
22079
22079
  return;
22080
22080
  }
22081
- debug('pipe "%s"', path3);
22082
- this.setHeader(path3, stat);
22083
- this.type(path3);
22081
+ debug('pipe "%s"', path4);
22082
+ this.setHeader(path4, stat);
22083
+ this.type(path4);
22084
22084
  if (this.isConditionalGET()) {
22085
22085
  if (this.isPreconditionFailure()) {
22086
22086
  this.error(412);
@@ -22131,28 +22131,28 @@ var require_send = __commonJS({
22131
22131
  res.end();
22132
22132
  return;
22133
22133
  }
22134
- this.stream(path3, opts);
22134
+ this.stream(path4, opts);
22135
22135
  }, "send");
22136
- SendStream.prototype.sendFile = /* @__PURE__ */ __name(function sendFile(path3) {
22136
+ SendStream.prototype.sendFile = /* @__PURE__ */ __name(function sendFile(path4) {
22137
22137
  var i = 0;
22138
22138
  var self = this;
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) {
22139
+ debug('stat "%s"', path4);
22140
+ fs4.stat(path4, /* @__PURE__ */ __name(function onstat(err, stat) {
22141
+ if (err && err.code === "ENOENT" && !extname2(path4) && path4[path4.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(path3);
22146
- self.emit("file", path3, stat);
22147
- self.send(path3, stat);
22145
+ if (stat.isDirectory()) return self.redirect(path4);
22146
+ self.emit("file", path4, stat);
22147
+ self.send(path4, stat);
22148
22148
  }, "onstat"));
22149
22149
  function next(err) {
22150
22150
  if (self._extensions.length <= i) {
22151
22151
  return err ? self.onStatError(err) : self.error(404);
22152
22152
  }
22153
- var p = path3 + "." + self._extensions[i++];
22153
+ var p = path4 + "." + self._extensions[i++];
22154
22154
  debug('stat "%s"', p);
22155
- fs3.stat(p, function(err2, stat) {
22155
+ fs4.stat(p, function(err2, stat) {
22156
22156
  if (err2) return next(err2);
22157
22157
  if (stat.isDirectory()) return next();
22158
22158
  self.emit("file", p, stat);
@@ -22161,7 +22161,7 @@ var require_send = __commonJS({
22161
22161
  }
22162
22162
  __name(next, "next");
22163
22163
  }, "sendFile");
22164
- SendStream.prototype.sendIndex = /* @__PURE__ */ __name(function sendIndex(path3) {
22164
+ SendStream.prototype.sendIndex = /* @__PURE__ */ __name(function sendIndex(path4) {
22165
22165
  var i = -1;
22166
22166
  var self = this;
22167
22167
  function next(err) {
@@ -22169,9 +22169,9 @@ var require_send = __commonJS({
22169
22169
  if (err) return self.onStatError(err);
22170
22170
  return self.error(404);
22171
22171
  }
22172
- var p = join5(path3, self._index[i]);
22172
+ var p = join5(path4, self._index[i]);
22173
22173
  debug('stat "%s"', p);
22174
- fs3.stat(p, function(err2, stat) {
22174
+ fs4.stat(p, function(err2, stat) {
22175
22175
  if (err2) return next(err2);
22176
22176
  if (stat.isDirectory()) return next();
22177
22177
  self.emit("file", p, stat);
@@ -22181,10 +22181,10 @@ var require_send = __commonJS({
22181
22181
  __name(next, "next");
22182
22182
  next();
22183
22183
  }, "sendIndex");
22184
- SendStream.prototype.stream = /* @__PURE__ */ __name(function stream(path3, options) {
22184
+ SendStream.prototype.stream = /* @__PURE__ */ __name(function stream(path4, options) {
22185
22185
  var self = this;
22186
22186
  var res = this.res;
22187
- var stream2 = fs3.createReadStream(path3, options);
22187
+ var stream2 = fs4.createReadStream(path4, options);
22188
22188
  this.emit("stream", stream2);
22189
22189
  stream2.pipe(res);
22190
22190
  function cleanup() {
@@ -22200,10 +22200,10 @@ var require_send = __commonJS({
22200
22200
  self.emit("end");
22201
22201
  }, "onend"));
22202
22202
  }, "stream");
22203
- SendStream.prototype.type = /* @__PURE__ */ __name(function type(path3) {
22203
+ SendStream.prototype.type = /* @__PURE__ */ __name(function type(path4) {
22204
22204
  var res = this.res;
22205
22205
  if (res.getHeader("Content-Type")) return;
22206
- var type2 = mime.lookup(path3);
22206
+ var type2 = mime.lookup(path4);
22207
22207
  if (!type2) {
22208
22208
  debug("no content-type");
22209
22209
  return;
@@ -22212,9 +22212,9 @@ var require_send = __commonJS({
22212
22212
  debug("content-type %s", type2);
22213
22213
  res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
22214
22214
  }, "type");
22215
- SendStream.prototype.setHeader = /* @__PURE__ */ __name(function setHeader(path3, stat) {
22215
+ SendStream.prototype.setHeader = /* @__PURE__ */ __name(function setHeader(path4, stat) {
22216
22216
  var res = this.res;
22217
- this.emit("headers", res, path3, stat);
22217
+ this.emit("headers", res, path4, stat);
22218
22218
  if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
22219
22219
  debug("accept ranges");
22220
22220
  res.setHeader("Accept-Ranges", "bytes");
@@ -22281,9 +22281,9 @@ var require_send = __commonJS({
22281
22281
  }) : createError(status, err);
22282
22282
  }
22283
22283
  __name(createHttpError, "createHttpError");
22284
- function decode(path3) {
22284
+ function decode(path4) {
22285
22285
  try {
22286
- return decodeURIComponent(path3);
22286
+ return decodeURIComponent(path4);
22287
22287
  } catch (err) {
22288
22288
  return -1;
22289
22289
  }
@@ -23541,10 +23541,10 @@ var require_utils3 = __commonJS({
23541
23541
  exports2.wetag = createETagGenerator({
23542
23542
  weak: true
23543
23543
  });
23544
- exports2.isAbsolute = function(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;
23544
+ exports2.isAbsolute = function(path3) {
23545
+ if ("/" === path3[0]) return true;
23546
+ if (":" === path3[1] && ("\\" === path3[2] || "/" === path3[2])) return true;
23547
+ if ("\\\\" === path3.substring(0, 2)) return true;
23548
23548
  };
23549
23549
  exports2.flatten = deprecate.function(flatten, "utils.flatten: use array-flatten npm module instead");
23550
23550
  exports2.normalizeType = function(type) {
@@ -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 path2 = "/";
23763
+ var path3 = "/";
23764
23764
  if (typeof fn !== "function") {
23765
23765
  var arg = fn;
23766
23766
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -23768,7 +23768,7 @@ var require_application = __commonJS({
23768
23768
  }
23769
23769
  if (typeof arg !== "function") {
23770
23770
  offset = 1;
23771
- path2 = fn;
23771
+ path3 = fn;
23772
23772
  }
23773
23773
  }
23774
23774
  var fns = flatten(slice.call(arguments, offset));
@@ -23779,12 +23779,12 @@ var require_application = __commonJS({
23779
23779
  var router = this._router;
23780
23780
  fns.forEach(function(fn2) {
23781
23781
  if (!fn2 || !fn2.handle || !fn2.set) {
23782
- return router.use(path2, fn2);
23782
+ return router.use(path3, fn2);
23783
23783
  }
23784
- debug(".use app under %s", path2);
23785
- fn2.mountpath = path2;
23784
+ debug(".use app under %s", path3);
23785
+ fn2.mountpath = path3;
23786
23786
  fn2.parent = this;
23787
- router.use(path2, /* @__PURE__ */ __name(function mounted_app(req, res, next) {
23787
+ router.use(path3, /* @__PURE__ */ __name(function mounted_app(req, res, next) {
23788
23788
  var orig = req.app;
23789
23789
  fn2.handle(req, res, function(err) {
23790
23790
  setPrototypeOf(req, orig.request);
@@ -23796,9 +23796,9 @@ var require_application = __commonJS({
23796
23796
  }, this);
23797
23797
  return this;
23798
23798
  }, "use");
23799
- app.route = /* @__PURE__ */ __name(function route(path2) {
23799
+ app.route = /* @__PURE__ */ __name(function route(path3) {
23800
23800
  this.lazyrouter();
23801
- return this._router.route(path2);
23801
+ return this._router.route(path3);
23802
23802
  }, "route");
23803
23803
  app.engine = /* @__PURE__ */ __name(function engine(ext, fn) {
23804
23804
  if (typeof fn !== "function") {
@@ -23849,7 +23849,7 @@ var require_application = __commonJS({
23849
23849
  }
23850
23850
  return this;
23851
23851
  }, "set");
23852
- app.path = /* @__PURE__ */ __name(function path2() {
23852
+ app.path = /* @__PURE__ */ __name(function path3() {
23853
23853
  return this.parent ? this.parent.path() + this.mountpath : "";
23854
23854
  }, "path");
23855
23855
  app.enabled = /* @__PURE__ */ __name(function enabled(setting) {
@@ -23865,19 +23865,19 @@ var require_application = __commonJS({
23865
23865
  return this.set(setting, false);
23866
23866
  }, "disable");
23867
23867
  methods.forEach(function(method) {
23868
- app[method] = function(path2) {
23868
+ app[method] = function(path3) {
23869
23869
  if (method === "get" && arguments.length === 1) {
23870
- return this.set(path2);
23870
+ return this.set(path3);
23871
23871
  }
23872
23872
  this.lazyrouter();
23873
- var route = this._router.route(path2);
23873
+ var route = this._router.route(path3);
23874
23874
  route[method].apply(route, slice.call(arguments, 1));
23875
23875
  return this;
23876
23876
  };
23877
23877
  });
23878
- app.all = /* @__PURE__ */ __name(function all(path2) {
23878
+ app.all = /* @__PURE__ */ __name(function all(path3) {
23879
23879
  this.lazyrouter();
23880
- var route = this._router.route(path2);
23880
+ var route = this._router.route(path3);
23881
23881
  var args = slice.call(arguments, 1);
23882
23882
  for (var i = 0; i < methods.length; i++) {
23883
23883
  route[methods[i]].apply(route, args);
@@ -33091,11 +33091,11 @@ var require_mime_types2 = __commonJS({
33091
33091
  return exts[0];
33092
33092
  }
33093
33093
  __name(extension, "extension");
33094
- function lookup(path2) {
33095
- if (!path2 || typeof path2 !== "string") {
33094
+ function lookup(path3) {
33095
+ if (!path3 || typeof path3 !== "string") {
33096
33096
  return false;
33097
33097
  }
33098
- var extension2 = extname2("x." + path2).toLowerCase().substr(1);
33098
+ var extension2 = extname2("x." + path3).toLowerCase().substr(1);
33099
33099
  if (!extension2) {
33100
33100
  return false;
33101
33101
  }
@@ -33325,7 +33325,7 @@ var require_request = __commonJS({
33325
33325
  ];
33326
33326
  return subdomains2.slice(offset);
33327
33327
  }, "subdomains"));
33328
- defineGetter(req, "path", /* @__PURE__ */ __name(function path2() {
33328
+ defineGetter(req, "path", /* @__PURE__ */ __name(function path3() {
33329
33329
  return parse(this).pathname;
33330
33330
  }, "path"));
33331
33331
  defineGetter(req, "hostname", /* @__PURE__ */ __name(function hostname() {
@@ -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 path2 = require("path");
33663
+ var path3 = require("path");
33664
33664
  var statuses = require_statuses();
33665
33665
  var merge = require_utils_merge();
33666
33666
  var sign = require_cookie_signature().sign;
@@ -33669,9 +33669,9 @@ var require_response = __commonJS({
33669
33669
  var setCharset = require_utils3().setCharset;
33670
33670
  var cookie = require_cookie();
33671
33671
  var send = require_send();
33672
- var extname2 = path2.extname;
33672
+ var extname2 = path3.extname;
33673
33673
  var mime = send.mime;
33674
- var resolve2 = path2.resolve;
33674
+ var resolve2 = path3.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(path3, options, callback) {
33851
+ res.sendFile = /* @__PURE__ */ __name(function sendFile(path4, options, callback) {
33852
33852
  var done = callback;
33853
33853
  var req = this.req;
33854
33854
  var res2 = this;
33855
33855
  var next = req.next;
33856
33856
  var opts = options || {};
33857
- if (!path3) {
33857
+ if (!path4) {
33858
33858
  throw new TypeError("path argument is required to res.sendFile");
33859
33859
  }
33860
- if (typeof path3 !== "string") {
33860
+ if (typeof path4 !== "string") {
33861
33861
  throw new TypeError("path must be a string to res.sendFile");
33862
33862
  }
33863
33863
  if (typeof options === "function") {
33864
33864
  done = options;
33865
33865
  opts = {};
33866
33866
  }
33867
- if (!opts.root && !isAbsolute(path3)) {
33867
+ if (!opts.root && !isAbsolute(path4)) {
33868
33868
  throw new TypeError("path must be absolute or specify root to res.sendFile");
33869
33869
  }
33870
- var pathname = encodeURI(path3);
33870
+ var pathname = encodeURI(path4);
33871
33871
  var file = send(req, pathname, opts);
33872
33872
  sendfile(res2, file, opts, function(err) {
33873
33873
  if (done) return done(err);
@@ -33877,7 +33877,7 @@ var require_response = __commonJS({
33877
33877
  }
33878
33878
  });
33879
33879
  }, "sendFile");
33880
- res.sendfile = function(path3, options, callback) {
33880
+ res.sendfile = function(path4, options, callback) {
33881
33881
  var done = callback;
33882
33882
  var req = this.req;
33883
33883
  var res2 = this;
@@ -33887,7 +33887,7 @@ var require_response = __commonJS({
33887
33887
  done = options;
33888
33888
  opts = {};
33889
33889
  }
33890
- var file = send(req, path3, opts);
33890
+ var file = send(req, path4, opts);
33891
33891
  sendfile(res2, file, opts, function(err) {
33892
33892
  if (done) return done(err);
33893
33893
  if (err && err.code === "EISDIR") return next();
@@ -33897,7 +33897,7 @@ var require_response = __commonJS({
33897
33897
  });
33898
33898
  };
33899
33899
  res.sendfile = deprecate.function(res.sendfile, "res.sendfile: Use res.sendFile instead");
33900
- res.download = /* @__PURE__ */ __name(function download(path3, filename, options, callback) {
33900
+ res.download = /* @__PURE__ */ __name(function download(path4, filename, options, callback) {
33901
33901
  var done = callback;
33902
33902
  var name = filename;
33903
33903
  var opts = options || null;
@@ -33914,7 +33914,7 @@ var require_response = __commonJS({
33914
33914
  opts = filename;
33915
33915
  }
33916
33916
  var headers = {
33917
- "Content-Disposition": contentDisposition(name || path3)
33917
+ "Content-Disposition": contentDisposition(name || path4)
33918
33918
  };
33919
33919
  if (opts && opts.headers) {
33920
33920
  var keys = Object.keys(opts.headers);
@@ -33927,7 +33927,7 @@ var require_response = __commonJS({
33927
33927
  }
33928
33928
  opts = Object.create(opts);
33929
33929
  opts.headers = headers;
33930
- var fullPath = !opts.root ? resolve2(path3) : path3;
33930
+ var fullPath = !opts.root ? resolve2(path4) : path4;
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 path2 = parseUrl(req).pathname;
34249
- if (path2 === "/" && originalUrl.pathname.substr(-1) !== "/") {
34250
- path2 = "";
34248
+ var path3 = parseUrl(req).pathname;
34249
+ if (path3 === "/" && originalUrl.pathname.substr(-1) !== "/") {
34250
+ path3 = "";
34251
34251
  }
34252
- var stream = send(req, path2, opts);
34252
+ var stream = send(req, path3, opts);
34253
34253
  stream.on("directory", onDirectory);
34254
34254
  if (setHeaders) {
34255
34255
  stream.on("headers", setHeaders);
@@ -34423,12 +34423,13 @@ __export(index_exports, {
34423
34423
  UserContextMiddleware: () => UserContextMiddleware,
34424
34424
  ViewContextMiddleware: () => ViewContextMiddleware,
34425
34425
  configureApp: () => configureApp,
34426
- createLegacyPathRedirectMiddleware: () => createLegacyPathRedirectMiddleware
34426
+ createLegacyPathRedirectMiddleware: () => createLegacyPathRedirectMiddleware,
34427
+ registerOpenApiSpecEndpoint: () => registerOpenApiSpecEndpoint
34427
34428
  });
34428
34429
  module.exports = __toCommonJS(index_exports);
34429
34430
 
34430
34431
  // src/modules/platform/module.ts
34431
- var import_common16 = require("@nestjs/common");
34432
+ var import_common17 = require("@nestjs/common");
34432
34433
  var import_core2 = require("@nestjs/core");
34433
34434
  var import_nestjs_common6 = require("@lark-apaas/nestjs-common");
34434
34435
  var import_config2 = require("@nestjs/config");
@@ -34627,32 +34628,31 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
34627
34628
  constructor(client) {
34628
34629
  this.client = client;
34629
34630
  }
34630
- async getAppPublished(appId) {
34631
+ async getAppInfo(appId) {
34631
34632
  if (!appId) {
34632
- this.logger.warn(`appId is empty, skip get app published`);
34633
+ this.logger.warn(`appId is empty, skip get app info`);
34633
34634
  return null;
34634
34635
  }
34635
34636
  try {
34636
34637
  const resp = await this.client.get(`/b/${appId}/get_published_v2`);
34637
34638
  if (resp.status !== 200) {
34638
- throw new Error(`Failed to get app published, status: ${resp.status}`);
34639
+ throw new Error(`Failed to get app info, status: ${resp.status}`);
34639
34640
  }
34640
34641
  const data = await resp.json();
34641
34642
  if (data.status_code !== "0") {
34642
- throw new Error(`Failed to get app published, status_code: ${data.status_code}`);
34643
+ throw new Error(`Failed to get app info, status_code: ${data.status_code}`);
34643
34644
  }
34644
- return data.data ?? null;
34645
+ return data.data.app_info ?? {};
34645
34646
  } catch (err) {
34646
- this.logger.error(err, "Failed to get app published");
34647
+ this.logger.error(err, "Failed to get app info");
34647
34648
  return null;
34648
34649
  }
34649
34650
  }
34650
34651
  async use(req, res, next) {
34651
34652
  const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
34652
34653
  const csrfToken = req.csrfToken;
34654
+ const appInfo = await this.getAppInfo(appId);
34653
34655
  const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
34654
- const appPublishedData = await this.getAppPublished(appId);
34655
- const appInfo = appPublishedData?.app_info ?? null;
34656
34656
  req.__platform_data__ = {
34657
34657
  csrfToken: csrfToken ?? "",
34658
34658
  userId: userId ?? "",
@@ -34663,9 +34663,7 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
34663
34663
  loginUrl: loginUrl ?? "",
34664
34664
  userType: userType ?? "",
34665
34665
  tenantId,
34666
- environment,
34667
- showBadge: appInfo?.show_badge !== false,
34668
- appPublished: appPublishedData ?? null
34666
+ environment
34669
34667
  };
34670
34668
  res.locals = {
34671
34669
  ...res.locals ?? {},
@@ -34776,18 +34774,24 @@ function createApiNotFoundResponse(req) {
34776
34774
  };
34777
34775
  }
34778
34776
  __name(createApiNotFoundResponse, "createApiNotFoundResponse");
34779
- function getApiPathPrefix() {
34777
+ function getApiPathPrefixes() {
34780
34778
  const globalPrefix = process.env.CLIENT_BASE_PATH ?? "";
34781
34779
  if (!globalPrefix) {
34782
- return "/api/";
34780
+ return [
34781
+ "/api/",
34782
+ "/openapi/"
34783
+ ];
34783
34784
  }
34784
34785
  const normalizedPrefix = globalPrefix.replace(/\/+$/, "");
34785
- return `${normalizedPrefix}/api/`;
34786
+ return [
34787
+ `${normalizedPrefix}/api/`,
34788
+ `${normalizedPrefix}/openapi/`
34789
+ ];
34786
34790
  }
34787
- __name(getApiPathPrefix, "getApiPathPrefix");
34791
+ __name(getApiPathPrefixes, "getApiPathPrefixes");
34788
34792
  function apiResponseInterceptor(req, res, next) {
34789
- const apiPrefix = getApiPathPrefix();
34790
- if (!req.baseUrl.startsWith(apiPrefix)) {
34793
+ const apiPrefixes = getApiPathPrefixes();
34794
+ if (!apiPrefixes.some((prefix) => req.baseUrl.startsWith(prefix))) {
34791
34795
  return next();
34792
34796
  }
34793
34797
  res.render = function() {
@@ -34820,7 +34824,7 @@ var RequestContextMiddleware = class {
34820
34824
  this.requestContext = requestContext;
34821
34825
  }
34822
34826
  use(req, _res, next) {
34823
- const path2 = req.originalUrl ?? req.url;
34827
+ const path3 = req.originalUrl ?? req.url;
34824
34828
  const userContext = req.userContext ?? {};
34825
34829
  const ttEnv = req.headers["x-tt-env"];
34826
34830
  const rawPageRoute = req.get("X-Page-Route");
@@ -34828,7 +34832,7 @@ var RequestContextMiddleware = class {
34828
34832
  const refererPath = req.headers["rpc-persist-apaas-observability-referer-path"];
34829
34833
  const observabilityApi = req.headers["rpc-persist-apaas-observability-api"];
34830
34834
  this.requestContext.run({
34831
- path: path2,
34835
+ path: path3,
34832
34836
  method: req.method,
34833
34837
  userId: userContext.userId,
34834
34838
  tenantId: userContext.tenantId,
@@ -35017,10 +35021,10 @@ FrameworkDebugMiddleware = _ts_decorate7([
35017
35021
  ])
35018
35022
  ], FrameworkDebugMiddleware);
35019
35023
 
35020
- // src/services/platform-http-client.service.ts
35024
+ // src/middlewares/openapi-spec/index.ts
35025
+ var import_node_fs = __toESM(require("fs"), 1);
35026
+ var import_swagger = require("@nestjs/swagger");
35021
35027
  var import_common8 = require("@nestjs/common");
35022
- var import_http_client = require("@lark-apaas/http-client");
35023
- var import_nestjs_common3 = require("@lark-apaas/nestjs-common");
35024
35028
  function _ts_decorate8(decorators, target, key, desc) {
35025
35029
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35026
35030
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -35028,6 +35032,203 @@ function _ts_decorate8(decorators, target, key, desc) {
35028
35032
  return c > 3 && r && Object.defineProperty(target, key, r), r;
35029
35033
  }
35030
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
+ // src/services/platform-http-client.service.ts
35222
+ var import_common9 = require("@nestjs/common");
35223
+ var import_http_client = require("@lark-apaas/http-client");
35224
+ var import_nestjs_common3 = require("@lark-apaas/nestjs-common");
35225
+ function _ts_decorate9(decorators, target, key, desc) {
35226
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35227
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35228
+ 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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
35230
+ }
35231
+ __name(_ts_decorate9, "_ts_decorate");
35031
35232
  function _ts_metadata5(k, v) {
35032
35233
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
35033
35234
  }
@@ -35066,7 +35267,7 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35066
35267
  requestContext;
35067
35268
  client;
35068
35269
  protectedClient;
35069
- logger = new import_common8.Logger(_PlatformHttpClientService.name);
35270
+ logger = new import_common9.Logger(_PlatformHttpClientService.name);
35070
35271
  constructor(requestContext) {
35071
35272
  this.requestContext = requestContext;
35072
35273
  const baseConfig = {
@@ -35222,8 +35423,8 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35222
35423
  });
35223
35424
  }
35224
35425
  };
35225
- PlatformHttpClientService = _ts_decorate8([
35226
- (0, import_common8.Injectable)(),
35426
+ PlatformHttpClientService = _ts_decorate9([
35427
+ (0, import_common9.Injectable)(),
35227
35428
  _ts_metadata5("design:type", Function),
35228
35429
  _ts_metadata5("design:paramtypes", [
35229
35430
  typeof import_nestjs_common3.RequestContextService === "undefined" ? Object : import_nestjs_common3.RequestContextService
@@ -35234,16 +35435,16 @@ PlatformHttpClientService = _ts_decorate8([
35234
35435
  var DISABLE_DATAPASS = process.env.FORCE_FRAMEWORK_DISABLE_DATAPASS === "true";
35235
35436
 
35236
35437
  // src/services/file.service.ts
35237
- var import_common9 = require("@nestjs/common");
35438
+ var import_common10 = require("@nestjs/common");
35238
35439
  var import_nestjs_common4 = require("@lark-apaas/nestjs-common");
35239
35440
  var import_file_service = require("@lark-apaas/file-service");
35240
- function _ts_decorate9(decorators, target, key, desc) {
35441
+ function _ts_decorate10(decorators, target, key, desc) {
35241
35442
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35242
35443
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35243
35444
  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;
35244
35445
  return c > 3 && r && Object.defineProperty(target, key, r), r;
35245
35446
  }
35246
- __name(_ts_decorate9, "_ts_decorate");
35447
+ __name(_ts_decorate10, "_ts_decorate");
35247
35448
  function _ts_metadata6(k, v) {
35248
35449
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
35249
35450
  }
@@ -35268,7 +35469,7 @@ var FileService = class {
35268
35469
  this.httpClient = httpClient;
35269
35470
  this.observable = observable;
35270
35471
  this.fileServiceCore = new import_file_service.FileService(this.httpClient);
35271
- this.nestLogger = new import_common9.Logger("file");
35472
+ this.nestLogger = new import_common10.Logger("file");
35272
35473
  }
35273
35474
  /**
35274
35475
  * 返回一个绑定了指定 bucket 的代理对象
@@ -35277,10 +35478,10 @@ var FileService = class {
35277
35478
  from(bucket) {
35278
35479
  return {
35279
35480
  upload: /* @__PURE__ */ __name((file, options) => this._upload(bucket, file, options), "upload"),
35280
- download: /* @__PURE__ */ __name((path2) => this._download(bucket, path2), "download"),
35481
+ download: /* @__PURE__ */ __name((path3) => this._download(bucket, path3), "download"),
35281
35482
  list: /* @__PURE__ */ __name((prefix, searchOptions) => this._list(bucket, prefix, searchOptions), "list"),
35282
35483
  remove: /* @__PURE__ */ __name((filePaths) => this._remove(bucket, filePaths), "remove"),
35283
- createSignedUrl: /* @__PURE__ */ __name((path2, expiresIn) => this._createSignedUrl(bucket, path2, expiresIn), "createSignedUrl"),
35484
+ createSignedUrl: /* @__PURE__ */ __name((path3, expiresIn) => this._createSignedUrl(bucket, path3, expiresIn), "createSignedUrl"),
35284
35485
  getFileMetadata: /* @__PURE__ */ __name((filePath) => this._getFileMetadata(bucket, filePath), "getFileMetadata")
35285
35486
  };
35286
35487
  }
@@ -35288,9 +35489,9 @@ var FileService = class {
35288
35489
  async upload(file, options) {
35289
35490
  return this._upload(await this.getDefaultBucket(), file, options);
35290
35491
  }
35291
- download(path2) {
35492
+ download(path3) {
35292
35493
  const capturedBucketPromise = this.getDefaultBucket();
35293
- return this._download(capturedBucketPromise, path2);
35494
+ return this._download(capturedBucketPromise, path3);
35294
35495
  }
35295
35496
  async list(prefix, searchOptions) {
35296
35497
  return this._list(await this.getDefaultBucket(), prefix, searchOptions);
@@ -35298,8 +35499,8 @@ var FileService = class {
35298
35499
  async remove(filePaths) {
35299
35500
  return this._remove(await this.getDefaultBucket(), filePaths);
35300
35501
  }
35301
- async createSignedUrl(path2, expiresIn) {
35302
- return this._createSignedUrl(await this.getDefaultBucket(), path2, expiresIn);
35502
+ async createSignedUrl(path3, expiresIn) {
35503
+ return this._createSignedUrl(await this.getDefaultBucket(), path3, expiresIn);
35303
35504
  }
35304
35505
  async getFileMetadata(filePath) {
35305
35506
  return this._getFileMetadata(await this.getDefaultBucket(), filePath);
@@ -35366,7 +35567,7 @@ var FileService = class {
35366
35567
  span.end();
35367
35568
  }
35368
35569
  }
35369
- _download(bucket, path2) {
35570
+ _download(bucket, path3) {
35370
35571
  const capturedAppId = this.getAppId();
35371
35572
  const capturedRootSpan = this.requestContextService.getContext()?.requestRootSpan;
35372
35573
  const downloadFn = /* @__PURE__ */ __name(async () => {
@@ -35386,7 +35587,7 @@ var FileService = class {
35386
35587
  method: "download",
35387
35588
  source_type: "server",
35388
35589
  request: {
35389
- path: path2
35590
+ path: path3
35390
35591
  }
35391
35592
  };
35392
35593
  const startTime = Date.now();
@@ -35394,7 +35595,7 @@ var FileService = class {
35394
35595
  const res = await this.fileServiceCore.downloadInner({
35395
35596
  appId: capturedAppId,
35396
35597
  bucketId: await bucket,
35397
- filePath: path2
35598
+ filePath: path3
35398
35599
  });
35399
35600
  this.nestLogger.log(JSON.stringify({
35400
35601
  ...baseParams,
@@ -35513,7 +35714,7 @@ var FileService = class {
35513
35714
  span.end();
35514
35715
  }
35515
35716
  }
35516
- async _createSignedUrl(bucket, path2, expiresIn) {
35717
+ async _createSignedUrl(bucket, path3, expiresIn) {
35517
35718
  const span = this.observable.startTrace("\u6587\u4EF6: createSignedUrl", this.requestContextService.getContext()?.requestRootSpan);
35518
35719
  span.setAttribute("module", "file");
35519
35720
  span.setAttribute("source_type", "platform");
@@ -35530,7 +35731,7 @@ var FileService = class {
35530
35731
  method: "createSignedUrl",
35531
35732
  source_type: "server",
35532
35733
  request: {
35533
- path: path2,
35734
+ path: path3,
35534
35735
  expiresIn
35535
35736
  }
35536
35737
  };
@@ -35539,7 +35740,7 @@ var FileService = class {
35539
35740
  const res = await this.fileServiceCore.createSignedUrl({
35540
35741
  appId: this.getAppId(),
35541
35742
  bucketId: await bucket,
35542
- filePath: path2,
35743
+ filePath: path3,
35543
35744
  expiresIn
35544
35745
  });
35545
35746
  this.nestLogger.log(JSON.stringify({
@@ -35608,10 +35809,10 @@ var FileService = class {
35608
35809
  }
35609
35810
  }
35610
35811
  };
35611
- FileService = _ts_decorate9([
35612
- (0, import_common9.Injectable)(),
35613
- _ts_param2(1, (0, import_common9.Inject)(import_nestjs_common4.PLATFORM_HTTP_CLIENT)),
35614
- _ts_param2(2, (0, import_common9.Inject)(import_nestjs_common4.OBSERVABLE_SERVICE)),
35812
+ FileService = _ts_decorate10([
35813
+ (0, import_common10.Injectable)(),
35814
+ _ts_param2(1, (0, import_common10.Inject)(import_nestjs_common4.PLATFORM_HTTP_CLIENT)),
35815
+ _ts_param2(2, (0, import_common10.Inject)(import_nestjs_common4.OBSERVABLE_SERVICE)),
35615
35816
  _ts_metadata6("design:type", Function),
35616
35817
  _ts_metadata6("design:paramtypes", [
35617
35818
  typeof import_nestjs_common4.RequestContextService === "undefined" ? Object : import_nestjs_common4.RequestContextService,
@@ -35624,21 +35825,21 @@ FileService = _ts_decorate9([
35624
35825
  var import_nestjs_authzpaas = require("@lark-apaas/nestjs-authzpaas");
35625
35826
 
35626
35827
  // src/modules/static/static.module.ts
35627
- var import_common11 = require("@nestjs/common");
35828
+ var import_common12 = require("@nestjs/common");
35628
35829
 
35629
35830
  // src/modules/static/static.controller.ts
35630
- var import_common10 = require("@nestjs/common");
35631
- var import_swagger = require("@nestjs/swagger");
35632
- var fs = __toESM(require("fs"), 1);
35831
+ var import_common11 = require("@nestjs/common");
35832
+ var import_swagger2 = require("@nestjs/swagger");
35833
+ var fs2 = __toESM(require("fs"), 1);
35633
35834
  var path = __toESM(require("path"), 1);
35634
35835
  var crypto2 = __toESM(require("crypto"), 1);
35635
- function _ts_decorate10(decorators, target, key, desc) {
35836
+ function _ts_decorate11(decorators, target, key, desc) {
35636
35837
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35637
35838
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35638
35839
  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;
35639
35840
  return c > 3 && r && Object.defineProperty(target, key, r), r;
35640
35841
  }
35641
- __name(_ts_decorate10, "_ts_decorate");
35842
+ __name(_ts_decorate11, "_ts_decorate");
35642
35843
  function _ts_metadata7(k, v) {
35643
35844
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
35644
35845
  }
@@ -35706,7 +35907,7 @@ var StaticController = class _StaticController {
35706
35907
  static {
35707
35908
  __name(this, "StaticController");
35708
35909
  }
35709
- logger = new import_common10.Logger(_StaticController.name);
35910
+ logger = new import_common11.Logger(_StaticController.name);
35710
35911
  staticDir;
35711
35912
  constructor() {
35712
35913
  this.staticDir = path.resolve(process.cwd(), "shared/static");
@@ -35727,7 +35928,7 @@ var StaticController = class _StaticController {
35727
35928
  try {
35728
35929
  const relativePath = params["0"] || params["*"] || "";
35729
35930
  if (!relativePath) {
35730
- res.status(import_common10.HttpStatus.BAD_REQUEST).json({
35931
+ res.status(import_common11.HttpStatus.BAD_REQUEST).json({
35731
35932
  error: "Bad Request",
35732
35933
  message: "File path is required"
35733
35934
  });
@@ -35737,22 +35938,22 @@ var StaticController = class _StaticController {
35737
35938
  const normalizedPath = path.normalize(filePath);
35738
35939
  if (!normalizedPath.startsWith(this.staticDir)) {
35739
35940
  this.logger.warn(`Path traversal attempt detected: ${relativePath}`);
35740
- res.status(import_common10.HttpStatus.FORBIDDEN).json({
35941
+ res.status(import_common11.HttpStatus.FORBIDDEN).json({
35741
35942
  error: "Forbidden",
35742
35943
  message: "Access denied"
35743
35944
  });
35744
35945
  return;
35745
35946
  }
35746
- if (!fs.existsSync(normalizedPath)) {
35747
- res.status(import_common10.HttpStatus.NOT_FOUND).json({
35947
+ if (!fs2.existsSync(normalizedPath)) {
35948
+ res.status(import_common11.HttpStatus.NOT_FOUND).json({
35748
35949
  error: "Not Found",
35749
35950
  message: "File not found"
35750
35951
  });
35751
35952
  return;
35752
35953
  }
35753
- const stat = fs.statSync(normalizedPath);
35954
+ const stat = fs2.statSync(normalizedPath);
35754
35955
  if (stat.isDirectory()) {
35755
- res.status(import_common10.HttpStatus.FORBIDDEN).json({
35956
+ res.status(import_common11.HttpStatus.FORBIDDEN).json({
35756
35957
  error: "Forbidden",
35757
35958
  message: "Directory listing not allowed"
35758
35959
  });
@@ -35762,18 +35963,18 @@ var StaticController = class _StaticController {
35762
35963
  const etag = generateETag(stat);
35763
35964
  const ifNoneMatch = req.headers["if-none-match"];
35764
35965
  if (ifNoneMatch === etag) {
35765
- res.status(import_common10.HttpStatus.NOT_MODIFIED).end();
35966
+ res.status(import_common11.HttpStatus.NOT_MODIFIED).end();
35766
35967
  return;
35767
35968
  }
35768
35969
  res.setHeader("Content-Type", mimeType);
35769
35970
  res.setHeader("Content-Length", stat.size);
35770
35971
  res.setHeader("ETag", etag);
35771
35972
  res.setHeader("Cache-Control", "public, max-age=0, must-revalidate");
35772
- const stream = fs.createReadStream(normalizedPath);
35973
+ const stream = fs2.createReadStream(normalizedPath);
35773
35974
  stream.on("error", (error) => {
35774
35975
  this.logger.error(`Error streaming file: ${relativePath}`, error);
35775
35976
  if (!res.headersSent) {
35776
- res.status(import_common10.HttpStatus.INTERNAL_SERVER_ERROR).json({
35977
+ res.status(import_common11.HttpStatus.INTERNAL_SERVER_ERROR).json({
35777
35978
  error: "Internal Server Error",
35778
35979
  message: "Failed to read file"
35779
35980
  });
@@ -35783,7 +35984,7 @@ var StaticController = class _StaticController {
35783
35984
  } catch (error) {
35784
35985
  this.logger.error("Error serving static file", error);
35785
35986
  if (!res.headersSent) {
35786
- res.status(import_common10.HttpStatus.INTERNAL_SERVER_ERROR).json({
35987
+ res.status(import_common11.HttpStatus.INTERNAL_SERVER_ERROR).json({
35787
35988
  error: "Internal Server Error",
35788
35989
  message: "An unexpected error occurred"
35789
35990
  });
@@ -35791,11 +35992,11 @@ var StaticController = class _StaticController {
35791
35992
  }
35792
35993
  }
35793
35994
  };
35794
- _ts_decorate10([
35795
- (0, import_common10.Get)("*"),
35796
- _ts_param3(0, (0, import_common10.Param)()),
35797
- _ts_param3(1, (0, import_common10.Req)()),
35798
- _ts_param3(2, (0, import_common10.Res)()),
35995
+ _ts_decorate11([
35996
+ (0, import_common11.Get)("*"),
35997
+ _ts_param3(0, (0, import_common11.Param)()),
35998
+ _ts_param3(1, (0, import_common11.Req)()),
35999
+ _ts_param3(2, (0, import_common11.Res)()),
35799
36000
  _ts_metadata7("design:type", Function),
35800
36001
  _ts_metadata7("design:paramtypes", [
35801
36002
  typeof Record === "undefined" ? Object : Record,
@@ -35804,28 +36005,28 @@ _ts_decorate10([
35804
36005
  ]),
35805
36006
  _ts_metadata7("design:returntype", void 0)
35806
36007
  ], StaticController.prototype, "serveFile", null);
35807
- StaticController = _ts_decorate10([
35808
- (0, import_swagger.ApiExcludeController)(),
35809
- (0, import_common10.Controller)("static"),
36008
+ StaticController = _ts_decorate11([
36009
+ (0, import_swagger2.ApiExcludeController)(),
36010
+ (0, import_common11.Controller)("static"),
35810
36011
  _ts_metadata7("design:type", Function),
35811
36012
  _ts_metadata7("design:paramtypes", [])
35812
36013
  ], StaticController);
35813
36014
 
35814
36015
  // src/modules/static/static.module.ts
35815
- function _ts_decorate11(decorators, target, key, desc) {
36016
+ function _ts_decorate12(decorators, target, key, desc) {
35816
36017
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35817
36018
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35818
36019
  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;
35819
36020
  return c > 3 && r && Object.defineProperty(target, key, r), r;
35820
36021
  }
35821
- __name(_ts_decorate11, "_ts_decorate");
36022
+ __name(_ts_decorate12, "_ts_decorate");
35822
36023
  var StaticModule = class {
35823
36024
  static {
35824
36025
  __name(this, "StaticModule");
35825
36026
  }
35826
36027
  };
35827
- StaticModule = _ts_decorate11([
35828
- (0, import_common11.Module)({
36028
+ StaticModule = _ts_decorate12([
36029
+ (0, import_common12.Module)({
35829
36030
  controllers: [
35830
36031
  StaticController
35831
36032
  ]
@@ -35833,16 +36034,16 @@ StaticModule = _ts_decorate11([
35833
36034
  ], StaticModule);
35834
36035
 
35835
36036
  // src/modules/html-hot-update/html-hot-update.module.ts
35836
- var import_common14 = require("@nestjs/common");
36037
+ var import_common15 = require("@nestjs/common");
35837
36038
 
35838
36039
  // src/modules/html-hot-update/html-hot-update.controller.ts
35839
- var import_common13 = require("@nestjs/common");
35840
- var import_swagger2 = require("@nestjs/swagger");
36040
+ var import_common14 = require("@nestjs/common");
36041
+ var import_swagger3 = require("@nestjs/swagger");
35841
36042
 
35842
36043
  // src/modules/html-hot-update/html-hot-update.service.ts
35843
- var import_common12 = require("@nestjs/common");
35844
- var import_node_fs = require("fs");
36044
+ var import_common13 = require("@nestjs/common");
35845
36045
  var import_node_fs2 = require("fs");
36046
+ var import_node_fs3 = require("fs");
35846
36047
  var import_node_crypto = require("crypto");
35847
36048
  var import_node_path2 = require("path");
35848
36049
  var import_nestjs_common5 = require("@lark-apaas/nestjs-common");
@@ -35873,13 +36074,13 @@ function setActiveHtmlVersion(version) {
35873
36074
  __name(setActiveHtmlVersion, "setActiveHtmlVersion");
35874
36075
 
35875
36076
  // src/modules/html-hot-update/html-hot-update.service.ts
35876
- function _ts_decorate12(decorators, target, key, desc) {
36077
+ function _ts_decorate13(decorators, target, key, desc) {
35877
36078
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35878
36079
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35879
36080
  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;
35880
36081
  return c > 3 && r && Object.defineProperty(target, key, r), r;
35881
36082
  }
35882
- __name(_ts_decorate12, "_ts_decorate");
36083
+ __name(_ts_decorate13, "_ts_decorate");
35883
36084
  function _ts_metadata8(k, v) {
35884
36085
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
35885
36086
  }
@@ -35922,7 +36123,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
35922
36123
  __name(this, "HtmlHotUpdateService");
35923
36124
  }
35924
36125
  httpClient;
35925
- logger = new import_common12.Logger(_HtmlHotUpdateService.name);
36126
+ logger = new import_common13.Logger(_HtmlHotUpdateService.name);
35926
36127
  fileLock = new Mutex();
35927
36128
  hotUpdateDir = getHotUpdateHtmlDir();
35928
36129
  hotUpdateVersionsDir = getHotUpdateVersionsDir();
@@ -35947,7 +36148,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
35947
36148
  const activeVersion = getActiveHtmlVersion();
35948
36149
  if (activeVersion) {
35949
36150
  const hotPath = (0, import_node_path2.join)(getHotUpdateVersionDir(activeVersion), fileName);
35950
- if ((0, import_node_fs2.existsSync)(hotPath)) {
36151
+ if ((0, import_node_fs3.existsSync)(hotPath)) {
35951
36152
  return hotPath;
35952
36153
  }
35953
36154
  }
@@ -35961,7 +36162,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
35961
36162
  ];
35962
36163
  }
35963
36164
  const activeVersionDir = getHotUpdateVersionDir(activeVersion);
35964
- return (0, import_node_fs2.existsSync)(activeVersionDir) ? [
36165
+ return (0, import_node_fs3.existsSync)(activeVersionDir) ? [
35965
36166
  activeVersionDir,
35966
36167
  this.originalHtmlDir
35967
36168
  ] : [
@@ -36004,28 +36205,28 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
36004
36205
  const version = this.computeVersion(fileMap);
36005
36206
  const versionDir = getHotUpdateVersionDir(version);
36006
36207
  const currentVersion = getActiveHtmlVersion();
36007
- if (currentVersion === version && (0, import_node_fs2.existsSync)(versionDir)) {
36208
+ if (currentVersion === version && (0, import_node_fs3.existsSync)(versionDir)) {
36008
36209
  this.logger.log(`HTML hot update skipped: version ${version} already active`);
36009
36210
  return result;
36010
36211
  }
36011
36212
  const stagingDir = (0, import_node_path2.join)(this.hotUpdateDir, "staging", `${version}-${process.pid}-${Date.now()}`);
36012
36213
  await this.fileLock.acquire();
36013
36214
  try {
36014
- if (getActiveHtmlVersion() === version && (0, import_node_fs2.existsSync)(versionDir)) {
36215
+ if (getActiveHtmlVersion() === version && (0, import_node_fs3.existsSync)(versionDir)) {
36015
36216
  this.logger.log(`HTML hot update skipped after lock: version ${version} already active`);
36016
36217
  return result;
36017
36218
  }
36018
- await import_node_fs.promises.mkdir(stagingDir, {
36219
+ await import_node_fs2.promises.mkdir(stagingDir, {
36019
36220
  recursive: true
36020
36221
  });
36021
36222
  for (const [rawFilePath, content] of entries) {
36022
36223
  try {
36023
36224
  const filePath = this.normalizeFilePath(rawFilePath);
36024
36225
  const localPath = (0, import_node_path2.join)(stagingDir, filePath);
36025
- await import_node_fs.promises.mkdir((0, import_node_path2.dirname)(localPath), {
36226
+ await import_node_fs2.promises.mkdir((0, import_node_path2.dirname)(localPath), {
36026
36227
  recursive: true
36027
36228
  });
36028
- await import_node_fs.promises.writeFile(localPath, content, "utf-8");
36229
+ await import_node_fs2.promises.writeFile(localPath, content, "utf-8");
36029
36230
  result.updatedFiles.push(filePath);
36030
36231
  } catch (error) {
36031
36232
  const reason = error instanceof Error ? error.message : String(error);
@@ -36037,7 +36238,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
36037
36238
  }
36038
36239
  }
36039
36240
  if (result.updatedFiles.length === 0) {
36040
- await import_node_fs.promises.rm(stagingDir, {
36241
+ await import_node_fs2.promises.rm(stagingDir, {
36041
36242
  recursive: true,
36042
36243
  force: true
36043
36244
  });
@@ -36048,7 +36249,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
36048
36249
  await this.cleanupOldVersions(version);
36049
36250
  this.logger.log(`HTML hot update activated: version=${version}, files=${result.updatedFiles.length}`);
36050
36251
  } finally {
36051
- await import_node_fs.promises.rm(stagingDir, {
36252
+ await import_node_fs2.promises.rm(stagingDir, {
36052
36253
  recursive: true,
36053
36254
  force: true
36054
36255
  }).catch(() => void 0);
@@ -36057,11 +36258,11 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
36057
36258
  return result;
36058
36259
  }
36059
36260
  async promoteVersionDirectory(stagingDir, versionDir) {
36060
- await import_node_fs.promises.mkdir(this.hotUpdateVersionsDir, {
36261
+ await import_node_fs2.promises.mkdir(this.hotUpdateVersionsDir, {
36061
36262
  recursive: true
36062
36263
  });
36063
36264
  try {
36064
- await import_node_fs.promises.rename(stagingDir, versionDir);
36265
+ await import_node_fs2.promises.rename(stagingDir, versionDir);
36065
36266
  } catch (error) {
36066
36267
  const err = error;
36067
36268
  if (err.code !== "EEXIST") {
@@ -36072,11 +36273,11 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
36072
36273
  async cleanupOldVersions(activeVersion) {
36073
36274
  let versions = [];
36074
36275
  try {
36075
- versions = await import_node_fs.promises.readdir(this.hotUpdateVersionsDir);
36276
+ versions = await import_node_fs2.promises.readdir(this.hotUpdateVersionsDir);
36076
36277
  } catch {
36077
36278
  return;
36078
36279
  }
36079
- await Promise.all(versions.filter((version) => version !== activeVersion).map((version) => import_node_fs.promises.rm(getHotUpdateVersionDir(version), {
36280
+ await Promise.all(versions.filter((version) => version !== activeVersion).map((version) => import_node_fs2.promises.rm(getHotUpdateVersionDir(version), {
36080
36281
  recursive: true,
36081
36282
  force: true
36082
36283
  })));
@@ -36124,9 +36325,9 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
36124
36325
  return "";
36125
36326
  }
36126
36327
  };
36127
- HtmlHotUpdateService = _ts_decorate12([
36128
- (0, import_common12.Injectable)(),
36129
- _ts_param4(0, (0, import_common12.Inject)(import_nestjs_common5.PLATFORM_HTTP_CLIENT)),
36328
+ HtmlHotUpdateService = _ts_decorate13([
36329
+ (0, import_common13.Injectable)(),
36330
+ _ts_param4(0, (0, import_common13.Inject)(import_nestjs_common5.PLATFORM_HTTP_CLIENT)),
36130
36331
  _ts_metadata8("design:type", Function),
36131
36332
  _ts_metadata8("design:paramtypes", [
36132
36333
  typeof PlatformHttpClient === "undefined" ? Object : PlatformHttpClient
@@ -36134,13 +36335,13 @@ HtmlHotUpdateService = _ts_decorate12([
36134
36335
  ], HtmlHotUpdateService);
36135
36336
 
36136
36337
  // src/modules/html-hot-update/html-hot-update.controller.ts
36137
- function _ts_decorate13(decorators, target, key, desc) {
36338
+ function _ts_decorate14(decorators, target, key, desc) {
36138
36339
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36139
36340
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
36140
36341
  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;
36141
36342
  return c > 3 && r && Object.defineProperty(target, key, r), r;
36142
36343
  }
36143
- __name(_ts_decorate13, "_ts_decorate");
36344
+ __name(_ts_decorate14, "_ts_decorate");
36144
36345
  function _ts_metadata9(k, v) {
36145
36346
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
36146
36347
  }
@@ -36163,7 +36364,7 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
36163
36364
  __name(this, "HtmlHotUpdateController");
36164
36365
  }
36165
36366
  htmlHotUpdateService;
36166
- logger = new import_common13.Logger(_HtmlHotUpdateController.name);
36367
+ logger = new import_common14.Logger(_HtmlHotUpdateController.name);
36167
36368
  constructor(htmlHotUpdateService) {
36168
36369
  this.htmlHotUpdateService = htmlHotUpdateService;
36169
36370
  }
@@ -36205,19 +36406,19 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
36205
36406
  }
36206
36407
  }
36207
36408
  };
36208
- _ts_decorate13([
36209
- (0, import_common13.Post)("update_html_files"),
36210
- (0, import_common13.HttpCode)(import_common13.HttpStatus.OK),
36211
- _ts_param5(0, (0, import_common13.Body)()),
36409
+ _ts_decorate14([
36410
+ (0, import_common14.Post)("update_html_files"),
36411
+ (0, import_common14.HttpCode)(import_common14.HttpStatus.OK),
36412
+ _ts_param5(0, (0, import_common14.Body)()),
36212
36413
  _ts_metadata9("design:type", Function),
36213
36414
  _ts_metadata9("design:paramtypes", [
36214
36415
  typeof UpdateHtmlFilesDto === "undefined" ? Object : UpdateHtmlFilesDto
36215
36416
  ]),
36216
36417
  _ts_metadata9("design:returntype", Promise)
36217
36418
  ], HtmlHotUpdateController.prototype, "updateHtmlFiles", null);
36218
- HtmlHotUpdateController = _ts_decorate13([
36219
- (0, import_swagger2.ApiExcludeController)(),
36220
- (0, import_common13.Controller)("__innerapi__"),
36419
+ HtmlHotUpdateController = _ts_decorate14([
36420
+ (0, import_swagger3.ApiExcludeController)(),
36421
+ (0, import_common14.Controller)("__innerapi__"),
36221
36422
  _ts_metadata9("design:type", Function),
36222
36423
  _ts_metadata9("design:paramtypes", [
36223
36424
  typeof HtmlHotUpdateService === "undefined" ? Object : HtmlHotUpdateService
@@ -36225,20 +36426,20 @@ HtmlHotUpdateController = _ts_decorate13([
36225
36426
  ], HtmlHotUpdateController);
36226
36427
 
36227
36428
  // src/modules/html-hot-update/html-hot-update.module.ts
36228
- function _ts_decorate14(decorators, target, key, desc) {
36429
+ function _ts_decorate15(decorators, target, key, desc) {
36229
36430
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36230
36431
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
36231
36432
  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;
36232
36433
  return c > 3 && r && Object.defineProperty(target, key, r), r;
36233
36434
  }
36234
- __name(_ts_decorate14, "_ts_decorate");
36435
+ __name(_ts_decorate15, "_ts_decorate");
36235
36436
  var HtmlHotUpdateModule = class {
36236
36437
  static {
36237
36438
  __name(this, "HtmlHotUpdateModule");
36238
36439
  }
36239
36440
  };
36240
- HtmlHotUpdateModule = _ts_decorate14([
36241
- (0, import_common14.Module)({
36441
+ HtmlHotUpdateModule = _ts_decorate15([
36442
+ (0, import_common15.Module)({
36242
36443
  controllers: [
36243
36444
  HtmlHotUpdateController
36244
36445
  ],
@@ -36252,16 +36453,16 @@ HtmlHotUpdateModule = _ts_decorate14([
36252
36453
  ], HtmlHotUpdateModule);
36253
36454
 
36254
36455
  // src/middlewares/html-hot-update-view/index.ts
36255
- var import_common15 = require("@nestjs/common");
36256
- var import_node_fs3 = require("fs");
36456
+ var import_common16 = require("@nestjs/common");
36457
+ var import_node_fs4 = require("fs");
36257
36458
  var import_node_path3 = require("path");
36258
- function _ts_decorate15(decorators, target, key, desc) {
36459
+ function _ts_decorate16(decorators, target, key, desc) {
36259
36460
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36260
36461
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
36261
36462
  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;
36262
36463
  return c > 3 && r && Object.defineProperty(target, key, r), r;
36263
36464
  }
36264
- __name(_ts_decorate15, "_ts_decorate");
36465
+ __name(_ts_decorate16, "_ts_decorate");
36265
36466
  var HtmlHotUpdateViewMiddleware = class {
36266
36467
  static {
36267
36468
  __name(this, "HtmlHotUpdateViewMiddleware");
@@ -36280,7 +36481,7 @@ var HtmlHotUpdateViewMiddleware = class {
36280
36481
  }
36281
36482
  const activeVersion = getActiveHtmlVersion();
36282
36483
  const hotPath = activeVersion ? (0, import_node_path3.join)(getHotUpdateVersionDir(activeVersion), `${view}.html`) : "";
36283
- if (hotPath && (0, import_node_fs3.existsSync)(hotPath)) {
36484
+ if (hotPath && (0, import_node_fs4.existsSync)(hotPath)) {
36284
36485
  return originalRender(hotPath, renderOptions, renderCallback);
36285
36486
  }
36286
36487
  return originalRender(view, renderOptions, renderCallback);
@@ -36288,18 +36489,18 @@ var HtmlHotUpdateViewMiddleware = class {
36288
36489
  next();
36289
36490
  }
36290
36491
  };
36291
- HtmlHotUpdateViewMiddleware = _ts_decorate15([
36292
- (0, import_common15.Injectable)()
36492
+ HtmlHotUpdateViewMiddleware = _ts_decorate16([
36493
+ (0, import_common16.Injectable)()
36293
36494
  ], HtmlHotUpdateViewMiddleware);
36294
36495
 
36295
36496
  // src/modules/platform/module.ts
36296
- function _ts_decorate16(decorators, target, key, desc) {
36497
+ function _ts_decorate17(decorators, target, key, desc) {
36297
36498
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36298
36499
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
36299
36500
  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;
36300
36501
  return c > 3 && r && Object.defineProperty(target, key, r), r;
36301
36502
  }
36302
- __name(_ts_decorate16, "_ts_decorate");
36503
+ __name(_ts_decorate17, "_ts_decorate");
36303
36504
  var PLATFORM_MODULE_OPTIONS = /* @__PURE__ */ Symbol("PLATFORM_MODULE_OPTIONS");
36304
36505
  var PlatformModule = class _PlatformModule {
36305
36506
  static {
@@ -36387,7 +36588,7 @@ var PlatformModule = class _PlatformModule {
36387
36588
  },
36388
36589
  {
36389
36590
  provide: import_core2.APP_PIPE,
36390
- useValue: new import_common16.ValidationPipe({
36591
+ useValue: new import_common17.ValidationPipe({
36391
36592
  transform: true,
36392
36593
  transformOptions: {
36393
36594
  enableImplicitConversion: true
@@ -36440,16 +36641,21 @@ var PlatformModule = class _PlatformModule {
36440
36641
  */
36441
36642
  configure(consumer) {
36442
36643
  const options = _PlatformModule.moduleOptions;
36443
- consumer.apply(apiResponseInterceptor).forRoutes("/api/*");
36644
+ consumer.apply(apiResponseInterceptor).forRoutes("/api/*", "/openapi/*");
36444
36645
  if (process.env.NODE_ENV === "development") {
36445
36646
  consumer.apply(FrameworkDebugMiddleware).forRoutes("/api/__framework__/debug");
36446
36647
  }
36648
+ if (process.env.NODE_ENV !== "production") {
36649
+ consumer.apply(OpenApiSpecMiddleware).forRoutes("/api/__framework__/openapi-spec");
36650
+ }
36447
36651
  consumer.apply(UserContextMiddleware, RequestContextMiddleware, import_nestjs_logger2.LoggerContextMiddleware, import_nestjs_observable.ObservableTraceMiddleware, ...DISABLE_DATAPASS ? [] : [
36448
36652
  import_nestjs_datapaas.SqlExecutionContextMiddleware
36449
36653
  ]).forRoutes("/*");
36450
- consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/static/(.*)").forRoutes("*");
36654
+ consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/openapi/(.*)", "/static/(.*)").forRoutes("*");
36451
36655
  if (options.enableCsrf !== false) {
36452
- const csrfRoutes = options.csrfRoutes || "/api/*";
36656
+ const csrfRoutes = options.csrfRoutes || [
36657
+ "/api/*"
36658
+ ];
36453
36659
  if (Array.isArray(csrfRoutes)) {
36454
36660
  csrfRoutes.forEach((route) => {
36455
36661
  consumer.apply(CsrfMiddleware).forRoutes(route);
@@ -36460,12 +36666,13 @@ var PlatformModule = class _PlatformModule {
36460
36666
  }
36461
36667
  }
36462
36668
  };
36463
- PlatformModule = _ts_decorate16([
36464
- (0, import_common16.Global)(),
36465
- (0, import_common16.Module)({})
36669
+ PlatformModule = _ts_decorate17([
36670
+ (0, import_common17.Global)(),
36671
+ (0, import_common17.Module)({})
36466
36672
  ], PlatformModule);
36467
36673
 
36468
36674
  // src/setup.ts
36675
+ var import_node_path4 = __toESM(require("path"), 1);
36469
36676
  var import_nestjs_logger3 = require("@lark-apaas/nestjs-logger");
36470
36677
  var import_cookie_parser = __toESM(require("cookie-parser"), 1);
36471
36678
  var import_express = __toESM(require_express2(), 1);
@@ -36538,6 +36745,11 @@ async function configureApp(app, perms = defaultPerms) {
36538
36745
  console.error("[OpenAPI] OpenAPI \u751F\u6210\u5931\u8D25:", err);
36539
36746
  }
36540
36747
  }
36748
+ if (process.env.NODE_ENV !== "production") {
36749
+ registerOpenApiSpecEndpoint(app, {
36750
+ openapiFile: import_node_path4.default.resolve(process.cwd(), "docs/openapi.json")
36751
+ });
36752
+ }
36541
36753
  console.log("App Started Successfully.");
36542
36754
  }
36543
36755
  __name(configureApp, "configureApp");
@@ -36574,6 +36786,7 @@ var import_nestjs_authzpaas2 = require("@lark-apaas/nestjs-authzpaas");
36574
36786
  ViewContextMiddleware,
36575
36787
  configureApp,
36576
36788
  createLegacyPathRedirectMiddleware,
36789
+ registerOpenApiSpecEndpoint,
36577
36790
  ...require("@lark-apaas/nestjs-authnpaas"),
36578
36791
  ...require("@lark-apaas/nestjs-capability"),
36579
36792
  ...require("@lark-apaas/nestjs-datapaas"),