@lark-apaas/fullstack-nestjs-core 1.1.34-alpha.7 → 1.1.34-alpha.70

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
  }
@@ -20771,9 +20771,9 @@ var require_safe_buffer = __commonJS({
20771
20771
  }
20772
20772
  });
20773
20773
 
20774
- // ../../../node_modules/express/node_modules/content-disposition/index.js
20774
+ // ../../../node_modules/content-disposition/index.js
20775
20775
  var require_content_disposition = __commonJS({
20776
- "../../../node_modules/express/node_modules/content-disposition/index.js"(exports2, module2) {
20776
+ "../../../node_modules/content-disposition/index.js"(exports2, module2) {
20777
20777
  "use strict";
20778
20778
  module2.exports = contentDisposition;
20779
20779
  module2.exports.parse = parse;
@@ -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);
@@ -34404,7 +34404,10 @@ var require_express2 = __commonJS({
34404
34404
  // src/index.ts
34405
34405
  var index_exports = {};
34406
34406
  __export(index_exports, {
34407
+ AuthZPaasModule: () => import_nestjs_authzpaas2.AuthZPaasModule,
34408
+ AuthorizationSDK: () => import_nestjs_authzpaas2.AuthorizationSDK,
34407
34409
  AutoTrace: () => import_nestjs_common8.AutoTrace,
34410
+ Can: () => import_nestjs_authzpaas2.Can,
34408
34411
  CanRole: () => import_nestjs_authzpaas2.CanRole,
34409
34412
  CsrfMiddleware: () => CsrfMiddleware,
34410
34413
  CsrfTokenMiddleware: () => CsrfTokenMiddleware,
@@ -34413,18 +34416,20 @@ __export(index_exports, {
34413
34416
  FileService: () => FileService,
34414
34417
  HtmlHotUpdateModule: () => HtmlHotUpdateModule,
34415
34418
  HtmlHotUpdateService: () => HtmlHotUpdateService,
34419
+ PERMISSION_RESOLVER_TOKEN: () => import_nestjs_authzpaas2.PERMISSION_RESOLVER_TOKEN,
34416
34420
  PlatformHttpClientService: () => PlatformHttpClientService,
34417
34421
  PlatformModule: () => PlatformModule,
34418
34422
  StaticModule: () => StaticModule,
34419
34423
  UserContextMiddleware: () => UserContextMiddleware,
34420
34424
  ViewContextMiddleware: () => ViewContextMiddleware,
34421
34425
  configureApp: () => configureApp,
34422
- createLegacyPathRedirectMiddleware: () => createLegacyPathRedirectMiddleware
34426
+ createLegacyPathRedirectMiddleware: () => createLegacyPathRedirectMiddleware,
34427
+ registerOpenApiSpecEndpoint: () => registerOpenApiSpecEndpoint
34423
34428
  });
34424
34429
  module.exports = __toCommonJS(index_exports);
34425
34430
 
34426
34431
  // src/modules/platform/module.ts
34427
- var import_common16 = require("@nestjs/common");
34432
+ var import_common17 = require("@nestjs/common");
34428
34433
  var import_core2 = require("@nestjs/core");
34429
34434
  var import_nestjs_common6 = require("@lark-apaas/nestjs-common");
34430
34435
  var import_config2 = require("@nestjs/config");
@@ -34769,18 +34774,24 @@ function createApiNotFoundResponse(req) {
34769
34774
  };
34770
34775
  }
34771
34776
  __name(createApiNotFoundResponse, "createApiNotFoundResponse");
34772
- function getApiPathPrefix() {
34777
+ function getApiPathPrefixes() {
34773
34778
  const globalPrefix = process.env.CLIENT_BASE_PATH ?? "";
34774
34779
  if (!globalPrefix) {
34775
- return "/api/";
34780
+ return [
34781
+ "/api/",
34782
+ "/openapi/"
34783
+ ];
34776
34784
  }
34777
34785
  const normalizedPrefix = globalPrefix.replace(/\/+$/, "");
34778
- return `${normalizedPrefix}/api/`;
34786
+ return [
34787
+ `${normalizedPrefix}/api/`,
34788
+ `${normalizedPrefix}/openapi/`
34789
+ ];
34779
34790
  }
34780
- __name(getApiPathPrefix, "getApiPathPrefix");
34791
+ __name(getApiPathPrefixes, "getApiPathPrefixes");
34781
34792
  function apiResponseInterceptor(req, res, next) {
34782
- const apiPrefix = getApiPathPrefix();
34783
- if (!req.baseUrl.startsWith(apiPrefix)) {
34793
+ const apiPrefixes = getApiPathPrefixes();
34794
+ if (!apiPrefixes.some((prefix) => req.baseUrl.startsWith(prefix))) {
34784
34795
  return next();
34785
34796
  }
34786
34797
  res.render = function() {
@@ -34813,19 +34824,22 @@ var RequestContextMiddleware = class {
34813
34824
  this.requestContext = requestContext;
34814
34825
  }
34815
34826
  use(req, _res, next) {
34816
- const path2 = req.originalUrl ?? req.url;
34827
+ const path3 = req.originalUrl ?? req.url;
34817
34828
  const userContext = req.userContext ?? {};
34818
34829
  const ttEnv = req.headers["x-tt-env"];
34830
+ const rawPageRoute = req.get("X-Page-Route");
34831
+ const pageRoute = (0, import_nestjs_common2.stripBasePath)(rawPageRoute, process.env.CLIENT_BASE_PATH) ?? void 0;
34819
34832
  const refererPath = req.headers["rpc-persist-apaas-observability-referer-path"];
34820
34833
  const observabilityApi = req.headers["rpc-persist-apaas-observability-api"];
34821
34834
  this.requestContext.run({
34822
- path: path2,
34835
+ path: path3,
34823
34836
  method: req.method,
34824
34837
  userId: userContext.userId,
34825
34838
  tenantId: userContext.tenantId,
34826
34839
  appId: userContext.appId,
34827
34840
  isSystemAccount: userContext.isSystemAccount,
34828
34841
  ttEnv,
34842
+ pageRoute,
34829
34843
  refererPath,
34830
34844
  observabilityApi
34831
34845
  }, () => next());
@@ -35007,10 +35021,10 @@ FrameworkDebugMiddleware = _ts_decorate7([
35007
35021
  ])
35008
35022
  ], FrameworkDebugMiddleware);
35009
35023
 
35010
- // 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");
35011
35027
  var import_common8 = require("@nestjs/common");
35012
- var import_http_client = require("@lark-apaas/http-client");
35013
- var import_nestjs_common3 = require("@lark-apaas/nestjs-common");
35014
35028
  function _ts_decorate8(decorators, target, key, desc) {
35015
35029
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35016
35030
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -35018,6 +35032,203 @@ function _ts_decorate8(decorators, target, key, desc) {
35018
35032
  return c > 3 && r && Object.defineProperty(target, key, r), r;
35019
35033
  }
35020
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");
35021
35232
  function _ts_metadata5(k, v) {
35022
35233
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
35023
35234
  }
@@ -35056,7 +35267,7 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35056
35267
  requestContext;
35057
35268
  client;
35058
35269
  protectedClient;
35059
- logger = new import_common8.Logger(_PlatformHttpClientService.name);
35270
+ logger = new import_common9.Logger(_PlatformHttpClientService.name);
35060
35271
  constructor(requestContext) {
35061
35272
  this.requestContext = requestContext;
35062
35273
  const baseConfig = {
@@ -35212,8 +35423,8 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35212
35423
  });
35213
35424
  }
35214
35425
  };
35215
- PlatformHttpClientService = _ts_decorate8([
35216
- (0, import_common8.Injectable)(),
35426
+ PlatformHttpClientService = _ts_decorate9([
35427
+ (0, import_common9.Injectable)(),
35217
35428
  _ts_metadata5("design:type", Function),
35218
35429
  _ts_metadata5("design:paramtypes", [
35219
35430
  typeof import_nestjs_common3.RequestContextService === "undefined" ? Object : import_nestjs_common3.RequestContextService
@@ -35224,16 +35435,16 @@ PlatformHttpClientService = _ts_decorate8([
35224
35435
  var DISABLE_DATAPASS = process.env.FORCE_FRAMEWORK_DISABLE_DATAPASS === "true";
35225
35436
 
35226
35437
  // src/services/file.service.ts
35227
- var import_common9 = require("@nestjs/common");
35438
+ var import_common10 = require("@nestjs/common");
35228
35439
  var import_nestjs_common4 = require("@lark-apaas/nestjs-common");
35229
35440
  var import_file_service = require("@lark-apaas/file-service");
35230
- function _ts_decorate9(decorators, target, key, desc) {
35441
+ function _ts_decorate10(decorators, target, key, desc) {
35231
35442
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35232
35443
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35233
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;
35234
35445
  return c > 3 && r && Object.defineProperty(target, key, r), r;
35235
35446
  }
35236
- __name(_ts_decorate9, "_ts_decorate");
35447
+ __name(_ts_decorate10, "_ts_decorate");
35237
35448
  function _ts_metadata6(k, v) {
35238
35449
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
35239
35450
  }
@@ -35258,7 +35469,7 @@ var FileService = class {
35258
35469
  this.httpClient = httpClient;
35259
35470
  this.observable = observable;
35260
35471
  this.fileServiceCore = new import_file_service.FileService(this.httpClient);
35261
- this.nestLogger = new import_common9.Logger("file");
35472
+ this.nestLogger = new import_common10.Logger("file");
35262
35473
  }
35263
35474
  /**
35264
35475
  * 返回一个绑定了指定 bucket 的代理对象
@@ -35267,10 +35478,10 @@ var FileService = class {
35267
35478
  from(bucket) {
35268
35479
  return {
35269
35480
  upload: /* @__PURE__ */ __name((file, options) => this._upload(bucket, file, options), "upload"),
35270
- download: /* @__PURE__ */ __name((path2) => this._download(bucket, path2), "download"),
35481
+ download: /* @__PURE__ */ __name((path3) => this._download(bucket, path3), "download"),
35271
35482
  list: /* @__PURE__ */ __name((prefix, searchOptions) => this._list(bucket, prefix, searchOptions), "list"),
35272
35483
  remove: /* @__PURE__ */ __name((filePaths) => this._remove(bucket, filePaths), "remove"),
35273
- createSignedUrl: /* @__PURE__ */ __name((path2, expiresIn) => this._createSignedUrl(bucket, path2, expiresIn), "createSignedUrl"),
35484
+ createSignedUrl: /* @__PURE__ */ __name((path3, expiresIn) => this._createSignedUrl(bucket, path3, expiresIn), "createSignedUrl"),
35274
35485
  getFileMetadata: /* @__PURE__ */ __name((filePath) => this._getFileMetadata(bucket, filePath), "getFileMetadata")
35275
35486
  };
35276
35487
  }
@@ -35278,9 +35489,9 @@ var FileService = class {
35278
35489
  async upload(file, options) {
35279
35490
  return this._upload(await this.getDefaultBucket(), file, options);
35280
35491
  }
35281
- download(path2) {
35492
+ download(path3) {
35282
35493
  const capturedBucketPromise = this.getDefaultBucket();
35283
- return this._download(capturedBucketPromise, path2);
35494
+ return this._download(capturedBucketPromise, path3);
35284
35495
  }
35285
35496
  async list(prefix, searchOptions) {
35286
35497
  return this._list(await this.getDefaultBucket(), prefix, searchOptions);
@@ -35288,8 +35499,8 @@ var FileService = class {
35288
35499
  async remove(filePaths) {
35289
35500
  return this._remove(await this.getDefaultBucket(), filePaths);
35290
35501
  }
35291
- async createSignedUrl(path2, expiresIn) {
35292
- return this._createSignedUrl(await this.getDefaultBucket(), path2, expiresIn);
35502
+ async createSignedUrl(path3, expiresIn) {
35503
+ return this._createSignedUrl(await this.getDefaultBucket(), path3, expiresIn);
35293
35504
  }
35294
35505
  async getFileMetadata(filePath) {
35295
35506
  return this._getFileMetadata(await this.getDefaultBucket(), filePath);
@@ -35356,7 +35567,7 @@ var FileService = class {
35356
35567
  span.end();
35357
35568
  }
35358
35569
  }
35359
- _download(bucket, path2) {
35570
+ _download(bucket, path3) {
35360
35571
  const capturedAppId = this.getAppId();
35361
35572
  const capturedRootSpan = this.requestContextService.getContext()?.requestRootSpan;
35362
35573
  const downloadFn = /* @__PURE__ */ __name(async () => {
@@ -35376,7 +35587,7 @@ var FileService = class {
35376
35587
  method: "download",
35377
35588
  source_type: "server",
35378
35589
  request: {
35379
- path: path2
35590
+ path: path3
35380
35591
  }
35381
35592
  };
35382
35593
  const startTime = Date.now();
@@ -35384,7 +35595,7 @@ var FileService = class {
35384
35595
  const res = await this.fileServiceCore.downloadInner({
35385
35596
  appId: capturedAppId,
35386
35597
  bucketId: await bucket,
35387
- filePath: path2
35598
+ filePath: path3
35388
35599
  });
35389
35600
  this.nestLogger.log(JSON.stringify({
35390
35601
  ...baseParams,
@@ -35503,7 +35714,7 @@ var FileService = class {
35503
35714
  span.end();
35504
35715
  }
35505
35716
  }
35506
- async _createSignedUrl(bucket, path2, expiresIn) {
35717
+ async _createSignedUrl(bucket, path3, expiresIn) {
35507
35718
  const span = this.observable.startTrace("\u6587\u4EF6: createSignedUrl", this.requestContextService.getContext()?.requestRootSpan);
35508
35719
  span.setAttribute("module", "file");
35509
35720
  span.setAttribute("source_type", "platform");
@@ -35520,7 +35731,7 @@ var FileService = class {
35520
35731
  method: "createSignedUrl",
35521
35732
  source_type: "server",
35522
35733
  request: {
35523
- path: path2,
35734
+ path: path3,
35524
35735
  expiresIn
35525
35736
  }
35526
35737
  };
@@ -35529,7 +35740,7 @@ var FileService = class {
35529
35740
  const res = await this.fileServiceCore.createSignedUrl({
35530
35741
  appId: this.getAppId(),
35531
35742
  bucketId: await bucket,
35532
- filePath: path2,
35743
+ filePath: path3,
35533
35744
  expiresIn
35534
35745
  });
35535
35746
  this.nestLogger.log(JSON.stringify({
@@ -35598,10 +35809,10 @@ var FileService = class {
35598
35809
  }
35599
35810
  }
35600
35811
  };
35601
- FileService = _ts_decorate9([
35602
- (0, import_common9.Injectable)(),
35603
- _ts_param2(1, (0, import_common9.Inject)(import_nestjs_common4.PLATFORM_HTTP_CLIENT)),
35604
- _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)),
35605
35816
  _ts_metadata6("design:type", Function),
35606
35817
  _ts_metadata6("design:paramtypes", [
35607
35818
  typeof import_nestjs_common4.RequestContextService === "undefined" ? Object : import_nestjs_common4.RequestContextService,
@@ -35614,21 +35825,21 @@ FileService = _ts_decorate9([
35614
35825
  var import_nestjs_authzpaas = require("@lark-apaas/nestjs-authzpaas");
35615
35826
 
35616
35827
  // src/modules/static/static.module.ts
35617
- var import_common11 = require("@nestjs/common");
35828
+ var import_common12 = require("@nestjs/common");
35618
35829
 
35619
35830
  // src/modules/static/static.controller.ts
35620
- var import_common10 = require("@nestjs/common");
35621
- var import_swagger = require("@nestjs/swagger");
35622
- 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);
35623
35834
  var path = __toESM(require("path"), 1);
35624
35835
  var crypto2 = __toESM(require("crypto"), 1);
35625
- function _ts_decorate10(decorators, target, key, desc) {
35836
+ function _ts_decorate11(decorators, target, key, desc) {
35626
35837
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35627
35838
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35628
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;
35629
35840
  return c > 3 && r && Object.defineProperty(target, key, r), r;
35630
35841
  }
35631
- __name(_ts_decorate10, "_ts_decorate");
35842
+ __name(_ts_decorate11, "_ts_decorate");
35632
35843
  function _ts_metadata7(k, v) {
35633
35844
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
35634
35845
  }
@@ -35696,7 +35907,7 @@ var StaticController = class _StaticController {
35696
35907
  static {
35697
35908
  __name(this, "StaticController");
35698
35909
  }
35699
- logger = new import_common10.Logger(_StaticController.name);
35910
+ logger = new import_common11.Logger(_StaticController.name);
35700
35911
  staticDir;
35701
35912
  constructor() {
35702
35913
  this.staticDir = path.resolve(process.cwd(), "shared/static");
@@ -35717,7 +35928,7 @@ var StaticController = class _StaticController {
35717
35928
  try {
35718
35929
  const relativePath = params["0"] || params["*"] || "";
35719
35930
  if (!relativePath) {
35720
- res.status(import_common10.HttpStatus.BAD_REQUEST).json({
35931
+ res.status(import_common11.HttpStatus.BAD_REQUEST).json({
35721
35932
  error: "Bad Request",
35722
35933
  message: "File path is required"
35723
35934
  });
@@ -35727,22 +35938,22 @@ var StaticController = class _StaticController {
35727
35938
  const normalizedPath = path.normalize(filePath);
35728
35939
  if (!normalizedPath.startsWith(this.staticDir)) {
35729
35940
  this.logger.warn(`Path traversal attempt detected: ${relativePath}`);
35730
- res.status(import_common10.HttpStatus.FORBIDDEN).json({
35941
+ res.status(import_common11.HttpStatus.FORBIDDEN).json({
35731
35942
  error: "Forbidden",
35732
35943
  message: "Access denied"
35733
35944
  });
35734
35945
  return;
35735
35946
  }
35736
- if (!fs.existsSync(normalizedPath)) {
35737
- res.status(import_common10.HttpStatus.NOT_FOUND).json({
35947
+ if (!fs2.existsSync(normalizedPath)) {
35948
+ res.status(import_common11.HttpStatus.NOT_FOUND).json({
35738
35949
  error: "Not Found",
35739
35950
  message: "File not found"
35740
35951
  });
35741
35952
  return;
35742
35953
  }
35743
- const stat = fs.statSync(normalizedPath);
35954
+ const stat = fs2.statSync(normalizedPath);
35744
35955
  if (stat.isDirectory()) {
35745
- res.status(import_common10.HttpStatus.FORBIDDEN).json({
35956
+ res.status(import_common11.HttpStatus.FORBIDDEN).json({
35746
35957
  error: "Forbidden",
35747
35958
  message: "Directory listing not allowed"
35748
35959
  });
@@ -35752,18 +35963,18 @@ var StaticController = class _StaticController {
35752
35963
  const etag = generateETag(stat);
35753
35964
  const ifNoneMatch = req.headers["if-none-match"];
35754
35965
  if (ifNoneMatch === etag) {
35755
- res.status(import_common10.HttpStatus.NOT_MODIFIED).end();
35966
+ res.status(import_common11.HttpStatus.NOT_MODIFIED).end();
35756
35967
  return;
35757
35968
  }
35758
35969
  res.setHeader("Content-Type", mimeType);
35759
35970
  res.setHeader("Content-Length", stat.size);
35760
35971
  res.setHeader("ETag", etag);
35761
35972
  res.setHeader("Cache-Control", "public, max-age=0, must-revalidate");
35762
- const stream = fs.createReadStream(normalizedPath);
35973
+ const stream = fs2.createReadStream(normalizedPath);
35763
35974
  stream.on("error", (error) => {
35764
35975
  this.logger.error(`Error streaming file: ${relativePath}`, error);
35765
35976
  if (!res.headersSent) {
35766
- res.status(import_common10.HttpStatus.INTERNAL_SERVER_ERROR).json({
35977
+ res.status(import_common11.HttpStatus.INTERNAL_SERVER_ERROR).json({
35767
35978
  error: "Internal Server Error",
35768
35979
  message: "Failed to read file"
35769
35980
  });
@@ -35773,7 +35984,7 @@ var StaticController = class _StaticController {
35773
35984
  } catch (error) {
35774
35985
  this.logger.error("Error serving static file", error);
35775
35986
  if (!res.headersSent) {
35776
- res.status(import_common10.HttpStatus.INTERNAL_SERVER_ERROR).json({
35987
+ res.status(import_common11.HttpStatus.INTERNAL_SERVER_ERROR).json({
35777
35988
  error: "Internal Server Error",
35778
35989
  message: "An unexpected error occurred"
35779
35990
  });
@@ -35781,11 +35992,11 @@ var StaticController = class _StaticController {
35781
35992
  }
35782
35993
  }
35783
35994
  };
35784
- _ts_decorate10([
35785
- (0, import_common10.Get)("*"),
35786
- _ts_param3(0, (0, import_common10.Param)()),
35787
- _ts_param3(1, (0, import_common10.Req)()),
35788
- _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)()),
35789
36000
  _ts_metadata7("design:type", Function),
35790
36001
  _ts_metadata7("design:paramtypes", [
35791
36002
  typeof Record === "undefined" ? Object : Record,
@@ -35794,28 +36005,28 @@ _ts_decorate10([
35794
36005
  ]),
35795
36006
  _ts_metadata7("design:returntype", void 0)
35796
36007
  ], StaticController.prototype, "serveFile", null);
35797
- StaticController = _ts_decorate10([
35798
- (0, import_swagger.ApiExcludeController)(),
35799
- (0, import_common10.Controller)("static"),
36008
+ StaticController = _ts_decorate11([
36009
+ (0, import_swagger2.ApiExcludeController)(),
36010
+ (0, import_common11.Controller)("static"),
35800
36011
  _ts_metadata7("design:type", Function),
35801
36012
  _ts_metadata7("design:paramtypes", [])
35802
36013
  ], StaticController);
35803
36014
 
35804
36015
  // src/modules/static/static.module.ts
35805
- function _ts_decorate11(decorators, target, key, desc) {
36016
+ function _ts_decorate12(decorators, target, key, desc) {
35806
36017
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35807
36018
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35808
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;
35809
36020
  return c > 3 && r && Object.defineProperty(target, key, r), r;
35810
36021
  }
35811
- __name(_ts_decorate11, "_ts_decorate");
36022
+ __name(_ts_decorate12, "_ts_decorate");
35812
36023
  var StaticModule = class {
35813
36024
  static {
35814
36025
  __name(this, "StaticModule");
35815
36026
  }
35816
36027
  };
35817
- StaticModule = _ts_decorate11([
35818
- (0, import_common11.Module)({
36028
+ StaticModule = _ts_decorate12([
36029
+ (0, import_common12.Module)({
35819
36030
  controllers: [
35820
36031
  StaticController
35821
36032
  ]
@@ -35823,16 +36034,16 @@ StaticModule = _ts_decorate11([
35823
36034
  ], StaticModule);
35824
36035
 
35825
36036
  // src/modules/html-hot-update/html-hot-update.module.ts
35826
- var import_common14 = require("@nestjs/common");
36037
+ var import_common15 = require("@nestjs/common");
35827
36038
 
35828
36039
  // src/modules/html-hot-update/html-hot-update.controller.ts
35829
- var import_common13 = require("@nestjs/common");
35830
- var import_swagger2 = require("@nestjs/swagger");
36040
+ var import_common14 = require("@nestjs/common");
36041
+ var import_swagger3 = require("@nestjs/swagger");
35831
36042
 
35832
36043
  // src/modules/html-hot-update/html-hot-update.service.ts
35833
- var import_common12 = require("@nestjs/common");
35834
- var import_node_fs = require("fs");
36044
+ var import_common13 = require("@nestjs/common");
35835
36045
  var import_node_fs2 = require("fs");
36046
+ var import_node_fs3 = require("fs");
35836
36047
  var import_node_crypto = require("crypto");
35837
36048
  var import_node_path2 = require("path");
35838
36049
  var import_nestjs_common5 = require("@lark-apaas/nestjs-common");
@@ -35863,13 +36074,13 @@ function setActiveHtmlVersion(version) {
35863
36074
  __name(setActiveHtmlVersion, "setActiveHtmlVersion");
35864
36075
 
35865
36076
  // src/modules/html-hot-update/html-hot-update.service.ts
35866
- function _ts_decorate12(decorators, target, key, desc) {
36077
+ function _ts_decorate13(decorators, target, key, desc) {
35867
36078
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
35868
36079
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35869
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;
35870
36081
  return c > 3 && r && Object.defineProperty(target, key, r), r;
35871
36082
  }
35872
- __name(_ts_decorate12, "_ts_decorate");
36083
+ __name(_ts_decorate13, "_ts_decorate");
35873
36084
  function _ts_metadata8(k, v) {
35874
36085
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
35875
36086
  }
@@ -35912,7 +36123,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
35912
36123
  __name(this, "HtmlHotUpdateService");
35913
36124
  }
35914
36125
  httpClient;
35915
- logger = new import_common12.Logger(_HtmlHotUpdateService.name);
36126
+ logger = new import_common13.Logger(_HtmlHotUpdateService.name);
35916
36127
  fileLock = new Mutex();
35917
36128
  hotUpdateDir = getHotUpdateHtmlDir();
35918
36129
  hotUpdateVersionsDir = getHotUpdateVersionsDir();
@@ -35937,7 +36148,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
35937
36148
  const activeVersion = getActiveHtmlVersion();
35938
36149
  if (activeVersion) {
35939
36150
  const hotPath = (0, import_node_path2.join)(getHotUpdateVersionDir(activeVersion), fileName);
35940
- if ((0, import_node_fs2.existsSync)(hotPath)) {
36151
+ if ((0, import_node_fs3.existsSync)(hotPath)) {
35941
36152
  return hotPath;
35942
36153
  }
35943
36154
  }
@@ -35951,7 +36162,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
35951
36162
  ];
35952
36163
  }
35953
36164
  const activeVersionDir = getHotUpdateVersionDir(activeVersion);
35954
- return (0, import_node_fs2.existsSync)(activeVersionDir) ? [
36165
+ return (0, import_node_fs3.existsSync)(activeVersionDir) ? [
35955
36166
  activeVersionDir,
35956
36167
  this.originalHtmlDir
35957
36168
  ] : [
@@ -35994,28 +36205,28 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
35994
36205
  const version = this.computeVersion(fileMap);
35995
36206
  const versionDir = getHotUpdateVersionDir(version);
35996
36207
  const currentVersion = getActiveHtmlVersion();
35997
- if (currentVersion === version && (0, import_node_fs2.existsSync)(versionDir)) {
36208
+ if (currentVersion === version && (0, import_node_fs3.existsSync)(versionDir)) {
35998
36209
  this.logger.log(`HTML hot update skipped: version ${version} already active`);
35999
36210
  return result;
36000
36211
  }
36001
36212
  const stagingDir = (0, import_node_path2.join)(this.hotUpdateDir, "staging", `${version}-${process.pid}-${Date.now()}`);
36002
36213
  await this.fileLock.acquire();
36003
36214
  try {
36004
- if (getActiveHtmlVersion() === version && (0, import_node_fs2.existsSync)(versionDir)) {
36215
+ if (getActiveHtmlVersion() === version && (0, import_node_fs3.existsSync)(versionDir)) {
36005
36216
  this.logger.log(`HTML hot update skipped after lock: version ${version} already active`);
36006
36217
  return result;
36007
36218
  }
36008
- await import_node_fs.promises.mkdir(stagingDir, {
36219
+ await import_node_fs2.promises.mkdir(stagingDir, {
36009
36220
  recursive: true
36010
36221
  });
36011
36222
  for (const [rawFilePath, content] of entries) {
36012
36223
  try {
36013
36224
  const filePath = this.normalizeFilePath(rawFilePath);
36014
36225
  const localPath = (0, import_node_path2.join)(stagingDir, filePath);
36015
- 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), {
36016
36227
  recursive: true
36017
36228
  });
36018
- await import_node_fs.promises.writeFile(localPath, content, "utf-8");
36229
+ await import_node_fs2.promises.writeFile(localPath, content, "utf-8");
36019
36230
  result.updatedFiles.push(filePath);
36020
36231
  } catch (error) {
36021
36232
  const reason = error instanceof Error ? error.message : String(error);
@@ -36027,7 +36238,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
36027
36238
  }
36028
36239
  }
36029
36240
  if (result.updatedFiles.length === 0) {
36030
- await import_node_fs.promises.rm(stagingDir, {
36241
+ await import_node_fs2.promises.rm(stagingDir, {
36031
36242
  recursive: true,
36032
36243
  force: true
36033
36244
  });
@@ -36038,7 +36249,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
36038
36249
  await this.cleanupOldVersions(version);
36039
36250
  this.logger.log(`HTML hot update activated: version=${version}, files=${result.updatedFiles.length}`);
36040
36251
  } finally {
36041
- await import_node_fs.promises.rm(stagingDir, {
36252
+ await import_node_fs2.promises.rm(stagingDir, {
36042
36253
  recursive: true,
36043
36254
  force: true
36044
36255
  }).catch(() => void 0);
@@ -36047,11 +36258,11 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
36047
36258
  return result;
36048
36259
  }
36049
36260
  async promoteVersionDirectory(stagingDir, versionDir) {
36050
- await import_node_fs.promises.mkdir(this.hotUpdateVersionsDir, {
36261
+ await import_node_fs2.promises.mkdir(this.hotUpdateVersionsDir, {
36051
36262
  recursive: true
36052
36263
  });
36053
36264
  try {
36054
- await import_node_fs.promises.rename(stagingDir, versionDir);
36265
+ await import_node_fs2.promises.rename(stagingDir, versionDir);
36055
36266
  } catch (error) {
36056
36267
  const err = error;
36057
36268
  if (err.code !== "EEXIST") {
@@ -36062,11 +36273,11 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
36062
36273
  async cleanupOldVersions(activeVersion) {
36063
36274
  let versions = [];
36064
36275
  try {
36065
- versions = await import_node_fs.promises.readdir(this.hotUpdateVersionsDir);
36276
+ versions = await import_node_fs2.promises.readdir(this.hotUpdateVersionsDir);
36066
36277
  } catch {
36067
36278
  return;
36068
36279
  }
36069
- 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), {
36070
36281
  recursive: true,
36071
36282
  force: true
36072
36283
  })));
@@ -36114,9 +36325,9 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
36114
36325
  return "";
36115
36326
  }
36116
36327
  };
36117
- HtmlHotUpdateService = _ts_decorate12([
36118
- (0, import_common12.Injectable)(),
36119
- _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)),
36120
36331
  _ts_metadata8("design:type", Function),
36121
36332
  _ts_metadata8("design:paramtypes", [
36122
36333
  typeof PlatformHttpClient === "undefined" ? Object : PlatformHttpClient
@@ -36124,13 +36335,13 @@ HtmlHotUpdateService = _ts_decorate12([
36124
36335
  ], HtmlHotUpdateService);
36125
36336
 
36126
36337
  // src/modules/html-hot-update/html-hot-update.controller.ts
36127
- function _ts_decorate13(decorators, target, key, desc) {
36338
+ function _ts_decorate14(decorators, target, key, desc) {
36128
36339
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36129
36340
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
36130
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;
36131
36342
  return c > 3 && r && Object.defineProperty(target, key, r), r;
36132
36343
  }
36133
- __name(_ts_decorate13, "_ts_decorate");
36344
+ __name(_ts_decorate14, "_ts_decorate");
36134
36345
  function _ts_metadata9(k, v) {
36135
36346
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
36136
36347
  }
@@ -36153,7 +36364,7 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
36153
36364
  __name(this, "HtmlHotUpdateController");
36154
36365
  }
36155
36366
  htmlHotUpdateService;
36156
- logger = new import_common13.Logger(_HtmlHotUpdateController.name);
36367
+ logger = new import_common14.Logger(_HtmlHotUpdateController.name);
36157
36368
  constructor(htmlHotUpdateService) {
36158
36369
  this.htmlHotUpdateService = htmlHotUpdateService;
36159
36370
  }
@@ -36195,19 +36406,19 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
36195
36406
  }
36196
36407
  }
36197
36408
  };
36198
- _ts_decorate13([
36199
- (0, import_common13.Post)("update_html_files"),
36200
- (0, import_common13.HttpCode)(import_common13.HttpStatus.OK),
36201
- _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)()),
36202
36413
  _ts_metadata9("design:type", Function),
36203
36414
  _ts_metadata9("design:paramtypes", [
36204
36415
  typeof UpdateHtmlFilesDto === "undefined" ? Object : UpdateHtmlFilesDto
36205
36416
  ]),
36206
36417
  _ts_metadata9("design:returntype", Promise)
36207
36418
  ], HtmlHotUpdateController.prototype, "updateHtmlFiles", null);
36208
- HtmlHotUpdateController = _ts_decorate13([
36209
- (0, import_swagger2.ApiExcludeController)(),
36210
- (0, import_common13.Controller)("__innerapi__"),
36419
+ HtmlHotUpdateController = _ts_decorate14([
36420
+ (0, import_swagger3.ApiExcludeController)(),
36421
+ (0, import_common14.Controller)("__innerapi__"),
36211
36422
  _ts_metadata9("design:type", Function),
36212
36423
  _ts_metadata9("design:paramtypes", [
36213
36424
  typeof HtmlHotUpdateService === "undefined" ? Object : HtmlHotUpdateService
@@ -36215,20 +36426,20 @@ HtmlHotUpdateController = _ts_decorate13([
36215
36426
  ], HtmlHotUpdateController);
36216
36427
 
36217
36428
  // src/modules/html-hot-update/html-hot-update.module.ts
36218
- function _ts_decorate14(decorators, target, key, desc) {
36429
+ function _ts_decorate15(decorators, target, key, desc) {
36219
36430
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36220
36431
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
36221
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;
36222
36433
  return c > 3 && r && Object.defineProperty(target, key, r), r;
36223
36434
  }
36224
- __name(_ts_decorate14, "_ts_decorate");
36435
+ __name(_ts_decorate15, "_ts_decorate");
36225
36436
  var HtmlHotUpdateModule = class {
36226
36437
  static {
36227
36438
  __name(this, "HtmlHotUpdateModule");
36228
36439
  }
36229
36440
  };
36230
- HtmlHotUpdateModule = _ts_decorate14([
36231
- (0, import_common14.Module)({
36441
+ HtmlHotUpdateModule = _ts_decorate15([
36442
+ (0, import_common15.Module)({
36232
36443
  controllers: [
36233
36444
  HtmlHotUpdateController
36234
36445
  ],
@@ -36242,16 +36453,16 @@ HtmlHotUpdateModule = _ts_decorate14([
36242
36453
  ], HtmlHotUpdateModule);
36243
36454
 
36244
36455
  // src/middlewares/html-hot-update-view/index.ts
36245
- var import_common15 = require("@nestjs/common");
36246
- var import_node_fs3 = require("fs");
36456
+ var import_common16 = require("@nestjs/common");
36457
+ var import_node_fs4 = require("fs");
36247
36458
  var import_node_path3 = require("path");
36248
- function _ts_decorate15(decorators, target, key, desc) {
36459
+ function _ts_decorate16(decorators, target, key, desc) {
36249
36460
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36250
36461
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
36251
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;
36252
36463
  return c > 3 && r && Object.defineProperty(target, key, r), r;
36253
36464
  }
36254
- __name(_ts_decorate15, "_ts_decorate");
36465
+ __name(_ts_decorate16, "_ts_decorate");
36255
36466
  var HtmlHotUpdateViewMiddleware = class {
36256
36467
  static {
36257
36468
  __name(this, "HtmlHotUpdateViewMiddleware");
@@ -36270,7 +36481,7 @@ var HtmlHotUpdateViewMiddleware = class {
36270
36481
  }
36271
36482
  const activeVersion = getActiveHtmlVersion();
36272
36483
  const hotPath = activeVersion ? (0, import_node_path3.join)(getHotUpdateVersionDir(activeVersion), `${view}.html`) : "";
36273
- if (hotPath && (0, import_node_fs3.existsSync)(hotPath)) {
36484
+ if (hotPath && (0, import_node_fs4.existsSync)(hotPath)) {
36274
36485
  return originalRender(hotPath, renderOptions, renderCallback);
36275
36486
  }
36276
36487
  return originalRender(view, renderOptions, renderCallback);
@@ -36278,18 +36489,18 @@ var HtmlHotUpdateViewMiddleware = class {
36278
36489
  next();
36279
36490
  }
36280
36491
  };
36281
- HtmlHotUpdateViewMiddleware = _ts_decorate15([
36282
- (0, import_common15.Injectable)()
36492
+ HtmlHotUpdateViewMiddleware = _ts_decorate16([
36493
+ (0, import_common16.Injectable)()
36283
36494
  ], HtmlHotUpdateViewMiddleware);
36284
36495
 
36285
36496
  // src/modules/platform/module.ts
36286
- function _ts_decorate16(decorators, target, key, desc) {
36497
+ function _ts_decorate17(decorators, target, key, desc) {
36287
36498
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36288
36499
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
36289
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;
36290
36501
  return c > 3 && r && Object.defineProperty(target, key, r), r;
36291
36502
  }
36292
- __name(_ts_decorate16, "_ts_decorate");
36503
+ __name(_ts_decorate17, "_ts_decorate");
36293
36504
  var PLATFORM_MODULE_OPTIONS = /* @__PURE__ */ Symbol("PLATFORM_MODULE_OPTIONS");
36294
36505
  var PlatformModule = class _PlatformModule {
36295
36506
  static {
@@ -36344,13 +36555,16 @@ var PlatformModule = class _PlatformModule {
36344
36555
  };
36345
36556
  return {
36346
36557
  connectionString: configService.get("app.databaseUrl") ?? "",
36347
- logger: drizzleLogger
36558
+ logger: drizzleLogger,
36559
+ connectionTokenFilePath: "/var/run/secrets/zti/credential"
36348
36560
  };
36349
36561
  }, "useFactory")
36350
36562
  })
36351
36563
  ],
36352
36564
  import_nestjs_authnpaas.AuthNPaasModule.forRoot(),
36353
- import_nestjs_authzpaas.AuthZPaasModule.forRoot(),
36565
+ import_nestjs_authzpaas.AuthZPaasModule.forRoot({
36566
+ ...options.authz || {}
36567
+ }),
36354
36568
  import_nestjs_trigger.AutomationModule.forRoot(),
36355
36569
  import_nestjs_capability.CapabilityModule.forRoot({
36356
36570
  capabilitiesDir: options.capabilitiesDir,
@@ -36374,7 +36588,7 @@ var PlatformModule = class _PlatformModule {
36374
36588
  },
36375
36589
  {
36376
36590
  provide: import_core2.APP_PIPE,
36377
- useValue: new import_common16.ValidationPipe({
36591
+ useValue: new import_common17.ValidationPipe({
36378
36592
  transform: true,
36379
36593
  transformOptions: {
36380
36594
  enableImplicitConversion: true
@@ -36427,16 +36641,21 @@ var PlatformModule = class _PlatformModule {
36427
36641
  */
36428
36642
  configure(consumer) {
36429
36643
  const options = _PlatformModule.moduleOptions;
36430
- consumer.apply(apiResponseInterceptor).forRoutes("/api/*");
36644
+ consumer.apply(apiResponseInterceptor).forRoutes("/api/*", "/openapi/*");
36431
36645
  if (process.env.NODE_ENV === "development") {
36432
36646
  consumer.apply(FrameworkDebugMiddleware).forRoutes("/api/__framework__/debug");
36433
36647
  }
36648
+ if (process.env.NODE_ENV !== "production") {
36649
+ consumer.apply(OpenApiSpecMiddleware).forRoutes("/api/__framework__/openapi-spec");
36650
+ }
36434
36651
  consumer.apply(UserContextMiddleware, RequestContextMiddleware, import_nestjs_logger2.LoggerContextMiddleware, import_nestjs_observable.ObservableTraceMiddleware, ...DISABLE_DATAPASS ? [] : [
36435
36652
  import_nestjs_datapaas.SqlExecutionContextMiddleware
36436
36653
  ]).forRoutes("/*");
36437
- consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/static/(.*)").forRoutes("*");
36654
+ consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/openapi/(.*)", "/static/(.*)").forRoutes("*");
36438
36655
  if (options.enableCsrf !== false) {
36439
- const csrfRoutes = options.csrfRoutes || "/api/*";
36656
+ const csrfRoutes = options.csrfRoutes || [
36657
+ "/api/*"
36658
+ ];
36440
36659
  if (Array.isArray(csrfRoutes)) {
36441
36660
  csrfRoutes.forEach((route) => {
36442
36661
  consumer.apply(CsrfMiddleware).forRoutes(route);
@@ -36447,12 +36666,13 @@ var PlatformModule = class _PlatformModule {
36447
36666
  }
36448
36667
  }
36449
36668
  };
36450
- PlatformModule = _ts_decorate16([
36451
- (0, import_common16.Global)(),
36452
- (0, import_common16.Module)({})
36669
+ PlatformModule = _ts_decorate17([
36670
+ (0, import_common17.Global)(),
36671
+ (0, import_common17.Module)({})
36453
36672
  ], PlatformModule);
36454
36673
 
36455
36674
  // src/setup.ts
36675
+ var import_node_path4 = __toESM(require("path"), 1);
36456
36676
  var import_nestjs_logger3 = require("@lark-apaas/nestjs-logger");
36457
36677
  var import_cookie_parser = __toESM(require("cookie-parser"), 1);
36458
36678
  var import_express = __toESM(require_express2(), 1);
@@ -36525,6 +36745,11 @@ async function configureApp(app, perms = defaultPerms) {
36525
36745
  console.error("[OpenAPI] OpenAPI \u751F\u6210\u5931\u8D25:", err);
36526
36746
  }
36527
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
+ }
36528
36753
  console.log("App Started Successfully.");
36529
36754
  }
36530
36755
  __name(configureApp, "configureApp");
@@ -36541,7 +36766,10 @@ var import_nestjs_common8 = require("@lark-apaas/nestjs-common");
36541
36766
  var import_nestjs_authzpaas2 = require("@lark-apaas/nestjs-authzpaas");
36542
36767
  // Annotate the CommonJS export names for ESM import in node:
36543
36768
  0 && (module.exports = {
36769
+ AuthZPaasModule,
36770
+ AuthorizationSDK,
36544
36771
  AutoTrace,
36772
+ Can,
36545
36773
  CanRole,
36546
36774
  CsrfMiddleware,
36547
36775
  CsrfTokenMiddleware,
@@ -36550,6 +36778,7 @@ var import_nestjs_authzpaas2 = require("@lark-apaas/nestjs-authzpaas");
36550
36778
  FileService,
36551
36779
  HtmlHotUpdateModule,
36552
36780
  HtmlHotUpdateService,
36781
+ PERMISSION_RESOLVER_TOKEN,
36553
36782
  PlatformHttpClientService,
36554
36783
  PlatformModule,
36555
36784
  StaticModule,
@@ -36557,6 +36786,7 @@ var import_nestjs_authzpaas2 = require("@lark-apaas/nestjs-authzpaas");
36557
36786
  ViewContextMiddleware,
36558
36787
  configureApp,
36559
36788
  createLegacyPathRedirectMiddleware,
36789
+ registerOpenApiSpecEndpoint,
36560
36790
  ...require("@lark-apaas/nestjs-authnpaas"),
36561
36791
  ...require("@lark-apaas/nestjs-capability"),
36562
36792
  ...require("@lark-apaas/nestjs-datapaas"),