mtranserver 4.0.32 → 4.0.33

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.js CHANGED
@@ -4,25 +4,43 @@ var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
32
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
19
37
  var __export = (target, all) => {
20
38
  for (var name in all)
21
39
  __defProp(target, name, {
22
40
  get: all[name],
23
41
  enumerable: true,
24
42
  configurable: true,
25
- set: (newValue) => all[name] = () => newValue
43
+ set: __exportSetter.bind(all, name)
26
44
  });
27
45
  };
28
46
  var __legacyDecorateClassTS = function(decorators, target, key, desc) {
@@ -825,7 +843,7 @@ class TranslationEngine {
825
843
  const effectiveOptions = forceHtml ? { ...options, html: true } : options;
826
844
  let translation;
827
845
  try {
828
- if (cleanText.length > this.maxSentenceLength) {
846
+ if (cleanText.length > this.maxSentenceLength && !effectiveOptions.html) {
829
847
  translation = this._translateLongText(cleanText, effectiveOptions);
830
848
  } else {
831
849
  translation = this._translateInternal(cleanText, effectiveOptions);
package/dist/main.js CHANGED
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
5
5
  var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
8
13
  var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
9
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
10
22
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
23
  for (let key of __getOwnPropNames(mod))
12
24
  if (!__hasOwnProp.call(to, key))
13
25
  __defProp(to, key, {
14
- get: () => mod[key],
26
+ get: __accessProp.bind(mod, key),
15
27
  enumerable: true
16
28
  });
29
+ if (canCache)
30
+ cache.set(mod, to);
17
31
  return to;
18
32
  };
19
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
+ var __returnValue = (v) => v;
35
+ function __exportSetter(name, newValue) {
36
+ this[name] = __returnValue.bind(null, newValue);
37
+ }
20
38
  var __export = (target, all) => {
21
39
  for (var name in all)
22
40
  __defProp(target, name, {
23
41
  get: all[name],
24
42
  enumerable: true,
25
43
  configurable: true,
26
- set: (newValue) => all[name] = () => newValue
44
+ set: __exportSetter.bind(all, name)
27
45
  });
28
46
  };
29
47
  var __legacyDecorateClassTS = function(decorators, target, key, desc) {
@@ -826,7 +844,7 @@ class TranslationEngine {
826
844
  const effectiveOptions = forceHtml ? { ...options, html: true } : options;
827
845
  let translation;
828
846
  try {
829
- if (cleanText.length > this.maxSentenceLength) {
847
+ if (cleanText.length > this.maxSentenceLength && !effectiveOptions.html) {
830
848
  translation = this._translateLongText(cleanText, effectiveOptions);
831
849
  } else {
832
850
  translation = this._translateInternal(cleanText, effectiveOptions);
@@ -7877,7 +7895,7 @@ var require_includesString = __commonJS((exports, module) => {
7877
7895
  value: true
7878
7896
  });
7879
7897
  exports.default = undefined;
7880
- var includes = function includes(str, val) {
7898
+ var includes = function includes2(str, val) {
7881
7899
  return str.indexOf(val) !== -1;
7882
7900
  };
7883
7901
  var _default = exports.default = includes;
@@ -7992,7 +8010,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
7992
8010
  url = split.shift();
7993
8011
  var protocol_match = url.match(/^([a-z][a-z0-9+\-.]*):/i);
7994
8012
  var had_explicit_protocol = false;
7995
- var cleanUpProtocol = function cleanUpProtocol(potential_protocol2) {
8013
+ var cleanUpProtocol = function cleanUpProtocol2(potential_protocol2) {
7996
8014
  had_explicit_protocol = true;
7997
8015
  protocol = potential_protocol2.toLowerCase();
7998
8016
  if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {
@@ -8264,10 +8282,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
8264
8282
  if (!t) {
8265
8283
  if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && typeof r.length == "number") {
8266
8284
  t && (r = t);
8267
- var _n = 0, F = function F() {};
8285
+ var _n = 0, F = function F2() {};
8268
8286
  return { s: F, n: function n() {
8269
8287
  return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
8270
- }, e: function e(r2) {
8288
+ }, e: function e2(r2) {
8271
8289
  throw r2;
8272
8290
  }, f: F };
8273
8291
  }
@@ -8280,7 +8298,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
8280
8298
  }, n: function n() {
8281
8299
  var r2 = t.next();
8282
8300
  return a = r2.done, r2;
8283
- }, e: function e(r2) {
8301
+ }, e: function e2(r2) {
8284
8302
  u = true, o = r2;
8285
8303
  }, f: function f() {
8286
8304
  try {
@@ -8430,7 +8448,7 @@ var require_includesArray = __commonJS((exports, module) => {
8430
8448
  value: true
8431
8449
  });
8432
8450
  exports.default = undefined;
8433
- var includes = function includes(arr, val) {
8451
+ var includes = function includes2(arr, val) {
8434
8452
  return arr.some(function(arrVal) {
8435
8453
  return val === arrVal;
8436
8454
  });
@@ -10078,10 +10096,10 @@ var require_isIdentityCard = __commonJS((exports, module) => {
10078
10096
  ];
10079
10097
  var powers = ["7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2"];
10080
10098
  var parityBit = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
10081
- var checkAddressCode = function checkAddressCode(addressCode) {
10099
+ var checkAddressCode = function checkAddressCode2(addressCode) {
10082
10100
  return (0, _includesArray.default)(provincesAndCities, addressCode);
10083
10101
  };
10084
- var checkBirthDayCode = function checkBirthDayCode(birDayCode) {
10102
+ var checkBirthDayCode = function checkBirthDayCode2(birDayCode) {
10085
10103
  var yyyy = parseInt(birDayCode.substring(0, 4), 10);
10086
10104
  var mm = parseInt(birDayCode.substring(4, 6), 10);
10087
10105
  var dd = parseInt(birDayCode.substring(6), 10);
@@ -10093,7 +10111,7 @@ var require_isIdentityCard = __commonJS((exports, module) => {
10093
10111
  }
10094
10112
  return false;
10095
10113
  };
10096
- var getParityBit = function getParityBit(idCardNo) {
10114
+ var getParityBit = function getParityBit2(idCardNo) {
10097
10115
  var id17 = idCardNo.substring(0, 17);
10098
10116
  var power = 0;
10099
10117
  for (var i = 0;i < 17; i++) {
@@ -10102,10 +10120,10 @@ var require_isIdentityCard = __commonJS((exports, module) => {
10102
10120
  var mod = power % 11;
10103
10121
  return parityBit[mod];
10104
10122
  };
10105
- var checkParityBit = function checkParityBit(idCardNo) {
10123
+ var checkParityBit = function checkParityBit2(idCardNo) {
10106
10124
  return getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase();
10107
10125
  };
10108
- var check15IdCardNo = function check15IdCardNo(idCardNo) {
10126
+ var check15IdCardNo = function check15IdCardNo2(idCardNo) {
10109
10127
  var check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo);
10110
10128
  if (!check)
10111
10129
  return false;
@@ -10119,7 +10137,7 @@ var require_isIdentityCard = __commonJS((exports, module) => {
10119
10137
  return false;
10120
10138
  return true;
10121
10139
  };
10122
- var check18IdCardNo = function check18IdCardNo(idCardNo) {
10140
+ var check18IdCardNo = function check18IdCardNo2(idCardNo) {
10123
10141
  var check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo);
10124
10142
  if (!check)
10125
10143
  return false;
@@ -10133,7 +10151,7 @@ var require_isIdentityCard = __commonJS((exports, module) => {
10133
10151
  return false;
10134
10152
  return checkParityBit(idCardNo);
10135
10153
  };
10136
- var checkIdCardNo = function checkIdCardNo(idCardNo) {
10154
+ var checkIdCardNo = function checkIdCardNo2(idCardNo) {
10137
10155
  var check = /^\d{15}|(\d{17}(\d|x|X))$/.test(idCardNo);
10138
10156
  if (!check)
10139
10157
  return false;
@@ -10506,7 +10524,7 @@ var require_isTaxID = __commonJS((exports, module) => {
10506
10524
  function _interopRequireWildcard(e, t) {
10507
10525
  if (typeof WeakMap == "function")
10508
10526
  var r = new WeakMap, n = new WeakMap;
10509
- return (_interopRequireWildcard = function _interopRequireWildcard(e2, t2) {
10527
+ return (_interopRequireWildcard = function _interopRequireWildcard2(e2, t2) {
10510
10528
  if (!t2 && e2 && e2.__esModule)
10511
10529
  return e2;
10512
10530
  var o, i, f = { __proto__: null, default: e2 };
@@ -11934,7 +11952,7 @@ var require_isISO8601 = __commonJS((exports, module) => {
11934
11952
  }
11935
11953
  var iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
11936
11954
  var iso8601StrictSeparator = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
11937
- var isValidDate = function isValidDate(str) {
11955
+ var isValidDate = function isValidDate2(str) {
11938
11956
  var ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);
11939
11957
  if (ordinalMatch) {
11940
11958
  var oYear = Number(ordinalMatch[1]);
@@ -12311,10 +12329,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
12311
12329
  if (!t) {
12312
12330
  if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && typeof r.length == "number") {
12313
12331
  t && (r = t);
12314
- var _n = 0, F = function F() {};
12332
+ var _n = 0, F = function F2() {};
12315
12333
  return { s: F, n: function n() {
12316
12334
  return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
12317
- }, e: function e(r2) {
12335
+ }, e: function e2(r2) {
12318
12336
  throw r2;
12319
12337
  }, f: F };
12320
12338
  }
@@ -12327,7 +12345,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
12327
12345
  }, n: function n() {
12328
12346
  var r2 = t.next();
12329
12347
  return a = r2.done, r2;
12330
- }, e: function e(r2) {
12348
+ }, e: function e2(r2) {
12331
12349
  u = true, o = r2;
12332
12350
  }, f: function f() {
12333
12351
  try {
@@ -12994,7 +13012,7 @@ var require_isVAT = __commonJS((exports) => {
12994
13012
  function _interopRequireWildcard(e, t) {
12995
13013
  if (typeof WeakMap == "function")
12996
13014
  var r = new WeakMap, n = new WeakMap;
12997
- return (_interopRequireWildcard = function _interopRequireWildcard(e2, t2) {
13015
+ return (_interopRequireWildcard = function _interopRequireWildcard2(e2, t2) {
12998
13016
  if (!t2 && e2 && e2.__esModule)
12999
13017
  return e2;
13000
13018
  var o, i, f = { __proto__: null, default: e2 };
@@ -13013,7 +13031,7 @@ var require_isVAT = __commonJS((exports) => {
13013
13031
  function _interopRequireDefault(e) {
13014
13032
  return e && e.__esModule ? e : { default: e };
13015
13033
  }
13016
- var AU = function AU(str) {
13034
+ var AU = function AU2(str) {
13017
13035
  var match = str.match(/^(AU)?(\d{11})$/);
13018
13036
  if (!match) {
13019
13037
  return false;
@@ -13027,8 +13045,8 @@ var require_isVAT = __commonJS((exports) => {
13027
13045
  }
13028
13046
  return total !== 0 && total % 89 === 0;
13029
13047
  };
13030
- var CH = function CH(str) {
13031
- var hasValidCheckNumber = function hasValidCheckNumber(digits) {
13048
+ var CH = function CH2(str) {
13049
+ var hasValidCheckNumber = function hasValidCheckNumber2(digits) {
13032
13050
  var lastDigit = digits.pop();
13033
13051
  var weights = [5, 4, 3, 2, 7, 6, 5, 4];
13034
13052
  var calculatedCheckNumber = (11 - digits.reduce(function(acc, el, idx) {
@@ -13040,7 +13058,7 @@ var require_isVAT = __commonJS((exports) => {
13040
13058
  return +el;
13041
13059
  }));
13042
13060
  };
13043
- var PT = function PT(str) {
13061
+ var PT = function PT2(str) {
13044
13062
  var match = str.match(/^(PT)?(\d{9})$/);
13045
13063
  if (!match) {
13046
13064
  return false;
@@ -13383,7 +13401,7 @@ var require_validator = __commonJS((exports, module) => {
13383
13401
  function _interopRequireWildcard(e, t) {
13384
13402
  if (typeof WeakMap == "function")
13385
13403
  var r = new WeakMap, n = new WeakMap;
13386
- return (_interopRequireWildcard = function _interopRequireWildcard(e2, t2) {
13404
+ return (_interopRequireWildcard = function _interopRequireWildcard2(e2, t2) {
13387
13405
  if (!t2 && e2 && e2.__esModule)
13388
13406
  return e2;
13389
13407
  var o, i, f = { __proto__: null, default: e2 };
@@ -203013,7 +203031,7 @@ var require_utils = __commonJS((exports) => {
203013
203031
  }
203014
203032
  var toString2 = Object.prototype.toString;
203015
203033
  exports.toString = toString2;
203016
- var isFunction = function isFunction(value) {
203034
+ var isFunction = function isFunction2(value) {
203017
203035
  return typeof value === "function";
203018
203036
  };
203019
203037
  if (isFunction(/x/)) {
@@ -203458,7 +203476,7 @@ var require_logger = __commonJS((exports, module) => {
203458
203476
  }
203459
203477
  return level;
203460
203478
  },
203461
- log: function log(level) {
203479
+ log: function log2(level) {
203462
203480
  level = logger.lookupLevel(level);
203463
203481
  if (typeof console !== "undefined" && logger.lookupLevel(logger.level) <= level) {
203464
203482
  var method = logger.methodMap[level];
@@ -203667,7 +203685,7 @@ var require_wrapHelper = __commonJS((exports) => {
203667
203685
  if (typeof helper !== "function") {
203668
203686
  return helper;
203669
203687
  }
203670
- var wrapper = function wrapper() {
203688
+ var wrapper = function wrapper2() {
203671
203689
  var options = arguments[arguments.length - 1];
203672
203690
  arguments[arguments.length - 1] = transformOptionsFn(options);
203673
203691
  return helper.apply(this, arguments);
@@ -205331,7 +205349,7 @@ var require_compiler = __commonJS((exports) => {
205331
205349
  return true;
205332
205350
  },
205333
205351
  guid: 0,
205334
- compile: function compile(program, options) {
205352
+ compile: function compile2(program, options) {
205335
205353
  this.sourceNode = [];
205336
205354
  this.opcodes = [];
205337
205355
  this.children = [];
@@ -205745,7 +205763,7 @@ var require_code_gen = __commonJS((exports, module) => {
205745
205763
  toStringWithSourceMap: function toStringWithSourceMap() {
205746
205764
  return { code: this.toString() };
205747
205765
  },
205748
- toString: function toString() {
205766
+ toString: function toString2() {
205749
205767
  return this.src;
205750
205768
  }
205751
205769
  };
@@ -213933,7 +213951,7 @@ __export(exports_version, {
213933
213951
  function getVersion() {
213934
213952
  return VERSION;
213935
213953
  }
213936
- var VERSION = "4.0.32";
213954
+ var VERSION = "4.0.33";
213937
213955
 
213938
213956
  // src/server/index.ts
213939
213957
  init_config();
@@ -215735,7 +215753,7 @@ var swagger_default = {
215735
215753
  },
215736
215754
  info: {
215737
215755
  title: "MTranServer API",
215738
- version: "4.0.32",
215756
+ version: "4.0.33",
215739
215757
  description: "Translation server API",
215740
215758
  license: {
215741
215759
  name: "Apache-2.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtranserver",
3
- "version": "4.0.32",
3
+ "version": "4.0.33",
4
4
  "type": "module",
5
5
  "description": "Translation server",
6
6
  "main": "./dist/index.js",