mtranserver 4.0.31 → 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);
@@ -5557,10 +5575,10 @@ function formatChinesePunctuation(text, toLang, isHTML, enabled) {
5557
5575
  if (!enabled || isHTML || !toLang.startsWith("zh")) {
5558
5576
  return text;
5559
5577
  }
5560
- if (!zhPunctTest.test(text)) {
5578
+ if (!zhCommaTest.test(text)) {
5561
5579
  return text;
5562
5580
  }
5563
- return text.replace(zhPunctGlobal, (ch) => String.fromCharCode(ch.charCodeAt(0) + 65248));
5581
+ return text.replace(zhCommaGlobal, ",");
5564
5582
  }
5565
5583
  function needsPivotTranslation(fromLang, toLang) {
5566
5584
  if (fromLang === "en" || toLang === "en") {
@@ -5696,63 +5714,66 @@ async function translateSegment(fromLang, toLang, text, isHTML) {
5696
5714
  }
5697
5715
  async function translateWithPivot(fromLang, toLang, text, isHTML = false) {
5698
5716
  debug(`TranslateWithPivot: ${fromLang} -> ${toLang}, text length: ${text.length}, isHTML: ${isHTML}`);
5699
- const config2 = getConfig();
5700
- const shouldFullwidth = config2.fullwidthZhPunctuation ?? true;
5717
+ let config2 = null;
5718
+ let result = text;
5701
5719
  if (fromLang !== "auto" && fromLang === toLang) {
5702
- return formatChinesePunctuation(text, toLang, isHTML, shouldFullwidth);
5703
- }
5704
- if (fromLang !== "auto" && text.length <= 512) {
5705
- const translated = await translateSegment(fromLang, toLang, text, isHTML);
5706
- return formatChinesePunctuation(translated, toLang, isHTML, shouldFullwidth);
5707
- }
5708
- const segments = await detectMultipleLanguages(text);
5709
- if (segments.length <= 1) {
5710
- let effectiveFromLang;
5711
- if (segments.length === 1) {
5712
- effectiveFromLang = segments[0].language;
5713
- } else if (fromLang === "auto") {
5714
- const detected = await detectLanguage(text);
5715
- if (!detected) {
5716
- throw new Error("Failed to detect source language");
5717
- }
5718
- effectiveFromLang = detected;
5719
- } else {
5720
- effectiveFromLang = fromLang;
5721
- }
5722
- if (effectiveFromLang === toLang) {
5723
- return formatChinesePunctuation(text, toLang, isHTML, shouldFullwidth);
5724
- }
5725
- if (text.length > config2.maxSentenceLength && !isHTML) {
5726
- const translated2 = await translateLongText(effectiveFromLang, toLang, text);
5727
- return formatChinesePunctuation(translated2, toLang, isHTML, shouldFullwidth);
5728
- }
5729
- const translated = await translateSegment(effectiveFromLang, toLang, text, isHTML);
5730
- return formatChinesePunctuation(translated, toLang, isHTML, shouldFullwidth);
5731
- }
5732
- debug(`Detected ${segments.length} language segments`);
5733
- let result = "";
5734
- let lastEnd = 0;
5735
- for (const seg of segments) {
5736
- if (seg.start > lastEnd) {
5737
- result += text.substring(lastEnd, seg.start);
5738
- }
5739
- if (seg.language === toLang) {
5740
- result += seg.text;
5720
+ result = text;
5721
+ } else if (fromLang !== "auto" && text.length <= 512) {
5722
+ result = await translateSegment(fromLang, toLang, text, isHTML);
5723
+ } else {
5724
+ const segments = await detectMultipleLanguages(text);
5725
+ if (segments.length <= 1) {
5726
+ let effectiveFromLang;
5727
+ if (segments.length === 1) {
5728
+ effectiveFromLang = segments[0].language;
5729
+ } else if (fromLang === "auto") {
5730
+ const detected = await detectLanguage(text);
5731
+ if (!detected) {
5732
+ throw new Error("Failed to detect source language");
5733
+ }
5734
+ effectiveFromLang = detected;
5735
+ } else {
5736
+ effectiveFromLang = fromLang;
5737
+ }
5738
+ if (effectiveFromLang === toLang) {
5739
+ result = text;
5740
+ } else if (!isHTML) {
5741
+ config2 = config2 ?? getConfig();
5742
+ result = text.length > config2.maxSentenceLength ? await translateLongText(effectiveFromLang, toLang, text) : await translateSegment(effectiveFromLang, toLang, text, isHTML);
5743
+ } else {
5744
+ result = await translateSegment(effectiveFromLang, toLang, text, isHTML);
5745
+ }
5741
5746
  } else {
5742
- try {
5743
- const translated = await translateSegment(seg.language, toLang, seg.text, isHTML);
5744
- result += translated;
5745
- } catch (error2) {
5746
- error(`Failed to translate segment: ${error2}`);
5747
- result += seg.text;
5747
+ debug(`Detected ${segments.length} language segments`);
5748
+ result = "";
5749
+ let lastEnd = 0;
5750
+ for (const seg of segments) {
5751
+ if (seg.start > lastEnd) {
5752
+ result += text.substring(lastEnd, seg.start);
5753
+ }
5754
+ if (seg.language === toLang) {
5755
+ result += seg.text;
5756
+ } else {
5757
+ try {
5758
+ const translated = await translateSegment(seg.language, toLang, seg.text, isHTML);
5759
+ result += translated;
5760
+ } catch (error2) {
5761
+ error(`Failed to translate segment: ${error2}`);
5762
+ result += seg.text;
5763
+ }
5764
+ }
5765
+ lastEnd = seg.end;
5766
+ }
5767
+ if (lastEnd < text.length) {
5768
+ result += text.substring(lastEnd);
5748
5769
  }
5749
5770
  }
5750
- lastEnd = seg.end;
5751
5771
  }
5752
- if (lastEnd < text.length) {
5753
- result += text.substring(lastEnd);
5772
+ if (!toLang.startsWith("zh")) {
5773
+ return result;
5754
5774
  }
5755
- return formatChinesePunctuation(result, toLang, isHTML, shouldFullwidth);
5775
+ config2 = config2 ?? getConfig();
5776
+ return formatChinesePunctuation(result, toLang, isHTML, config2.fullwidthZhPunctuation);
5756
5777
  }
5757
5778
  async function translateLongText(fromLang, toLang, text) {
5758
5779
  debug(`Splitting long text (${text.length} chars) into sentences`);
@@ -5787,7 +5808,7 @@ function cleanupAllEngines() {
5787
5808
  engines.clear();
5788
5809
  info("All engines cleaned up successfully");
5789
5810
  }
5790
- var import_bergamot_translator, engines, loadingPromises, zhPunctTest, zhPunctGlobal;
5811
+ var import_bergamot_translator, engines, loadingPromises, zhCommaTest, zhCommaGlobal;
5791
5812
  var init_engine2 = __esm(() => {
5792
5813
  init_engine();
5793
5814
  init_factory();
@@ -5800,8 +5821,8 @@ var init_engine2 = __esm(() => {
5800
5821
  import_bergamot_translator = __toESM(require_bergamot_translator(), 1);
5801
5822
  engines = new Map;
5802
5823
  loadingPromises = new Map;
5803
- zhPunctTest = /[!-/:-@[-`{-~]/;
5804
- zhPunctGlobal = /[!-/:-@[-`{-~]/g;
5824
+ zhCommaTest = /,/;
5825
+ zhCommaGlobal = /,/g;
5805
5826
  });
5806
5827
 
5807
5828
  // src/services/index.ts
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);
@@ -5558,10 +5576,10 @@ function formatChinesePunctuation(text, toLang, isHTML, enabled) {
5558
5576
  if (!enabled || isHTML || !toLang.startsWith("zh")) {
5559
5577
  return text;
5560
5578
  }
5561
- if (!zhPunctTest.test(text)) {
5579
+ if (!zhCommaTest.test(text)) {
5562
5580
  return text;
5563
5581
  }
5564
- return text.replace(zhPunctGlobal, (ch) => String.fromCharCode(ch.charCodeAt(0) + 65248));
5582
+ return text.replace(zhCommaGlobal, ",");
5565
5583
  }
5566
5584
  function needsPivotTranslation(fromLang, toLang) {
5567
5585
  if (fromLang === "en" || toLang === "en") {
@@ -5697,63 +5715,66 @@ async function translateSegment(fromLang, toLang, text, isHTML) {
5697
5715
  }
5698
5716
  async function translateWithPivot(fromLang, toLang, text, isHTML = false) {
5699
5717
  debug(`TranslateWithPivot: ${fromLang} -> ${toLang}, text length: ${text.length}, isHTML: ${isHTML}`);
5700
- const config2 = getConfig();
5701
- const shouldFullwidth = config2.fullwidthZhPunctuation ?? true;
5718
+ let config2 = null;
5719
+ let result = text;
5702
5720
  if (fromLang !== "auto" && fromLang === toLang) {
5703
- return formatChinesePunctuation(text, toLang, isHTML, shouldFullwidth);
5704
- }
5705
- if (fromLang !== "auto" && text.length <= 512) {
5706
- const translated = await translateSegment(fromLang, toLang, text, isHTML);
5707
- return formatChinesePunctuation(translated, toLang, isHTML, shouldFullwidth);
5708
- }
5709
- const segments = await detectMultipleLanguages(text);
5710
- if (segments.length <= 1) {
5711
- let effectiveFromLang;
5712
- if (segments.length === 1) {
5713
- effectiveFromLang = segments[0].language;
5714
- } else if (fromLang === "auto") {
5715
- const detected = await detectLanguage(text);
5716
- if (!detected) {
5717
- throw new Error("Failed to detect source language");
5718
- }
5719
- effectiveFromLang = detected;
5720
- } else {
5721
- effectiveFromLang = fromLang;
5722
- }
5723
- if (effectiveFromLang === toLang) {
5724
- return formatChinesePunctuation(text, toLang, isHTML, shouldFullwidth);
5725
- }
5726
- if (text.length > config2.maxSentenceLength && !isHTML) {
5727
- const translated2 = await translateLongText(effectiveFromLang, toLang, text);
5728
- return formatChinesePunctuation(translated2, toLang, isHTML, shouldFullwidth);
5729
- }
5730
- const translated = await translateSegment(effectiveFromLang, toLang, text, isHTML);
5731
- return formatChinesePunctuation(translated, toLang, isHTML, shouldFullwidth);
5732
- }
5733
- debug(`Detected ${segments.length} language segments`);
5734
- let result = "";
5735
- let lastEnd = 0;
5736
- for (const seg of segments) {
5737
- if (seg.start > lastEnd) {
5738
- result += text.substring(lastEnd, seg.start);
5739
- }
5740
- if (seg.language === toLang) {
5741
- result += seg.text;
5721
+ result = text;
5722
+ } else if (fromLang !== "auto" && text.length <= 512) {
5723
+ result = await translateSegment(fromLang, toLang, text, isHTML);
5724
+ } else {
5725
+ const segments = await detectMultipleLanguages(text);
5726
+ if (segments.length <= 1) {
5727
+ let effectiveFromLang;
5728
+ if (segments.length === 1) {
5729
+ effectiveFromLang = segments[0].language;
5730
+ } else if (fromLang === "auto") {
5731
+ const detected = await detectLanguage(text);
5732
+ if (!detected) {
5733
+ throw new Error("Failed to detect source language");
5734
+ }
5735
+ effectiveFromLang = detected;
5736
+ } else {
5737
+ effectiveFromLang = fromLang;
5738
+ }
5739
+ if (effectiveFromLang === toLang) {
5740
+ result = text;
5741
+ } else if (!isHTML) {
5742
+ config2 = config2 ?? getConfig();
5743
+ result = text.length > config2.maxSentenceLength ? await translateLongText(effectiveFromLang, toLang, text) : await translateSegment(effectiveFromLang, toLang, text, isHTML);
5744
+ } else {
5745
+ result = await translateSegment(effectiveFromLang, toLang, text, isHTML);
5746
+ }
5742
5747
  } else {
5743
- try {
5744
- const translated = await translateSegment(seg.language, toLang, seg.text, isHTML);
5745
- result += translated;
5746
- } catch (error2) {
5747
- error(`Failed to translate segment: ${error2}`);
5748
- result += seg.text;
5748
+ debug(`Detected ${segments.length} language segments`);
5749
+ result = "";
5750
+ let lastEnd = 0;
5751
+ for (const seg of segments) {
5752
+ if (seg.start > lastEnd) {
5753
+ result += text.substring(lastEnd, seg.start);
5754
+ }
5755
+ if (seg.language === toLang) {
5756
+ result += seg.text;
5757
+ } else {
5758
+ try {
5759
+ const translated = await translateSegment(seg.language, toLang, seg.text, isHTML);
5760
+ result += translated;
5761
+ } catch (error2) {
5762
+ error(`Failed to translate segment: ${error2}`);
5763
+ result += seg.text;
5764
+ }
5765
+ }
5766
+ lastEnd = seg.end;
5767
+ }
5768
+ if (lastEnd < text.length) {
5769
+ result += text.substring(lastEnd);
5749
5770
  }
5750
5771
  }
5751
- lastEnd = seg.end;
5752
5772
  }
5753
- if (lastEnd < text.length) {
5754
- result += text.substring(lastEnd);
5773
+ if (!toLang.startsWith("zh")) {
5774
+ return result;
5755
5775
  }
5756
- return formatChinesePunctuation(result, toLang, isHTML, shouldFullwidth);
5776
+ config2 = config2 ?? getConfig();
5777
+ return formatChinesePunctuation(result, toLang, isHTML, config2.fullwidthZhPunctuation);
5757
5778
  }
5758
5779
  async function translateLongText(fromLang, toLang, text) {
5759
5780
  debug(`Splitting long text (${text.length} chars) into sentences`);
@@ -5788,7 +5809,7 @@ function cleanupAllEngines() {
5788
5809
  engines.clear();
5789
5810
  info("All engines cleaned up successfully");
5790
5811
  }
5791
- var import_bergamot_translator, engines, loadingPromises, zhPunctTest, zhPunctGlobal;
5812
+ var import_bergamot_translator, engines, loadingPromises, zhCommaTest, zhCommaGlobal;
5792
5813
  var init_engine2 = __esm(() => {
5793
5814
  init_engine();
5794
5815
  init_factory();
@@ -5801,8 +5822,8 @@ var init_engine2 = __esm(() => {
5801
5822
  import_bergamot_translator = __toESM(require_bergamot_translator(), 1);
5802
5823
  engines = new Map;
5803
5824
  loadingPromises = new Map;
5804
- zhPunctTest = /[!-/:-@[-`{-~]/;
5805
- zhPunctGlobal = /[!-/:-@[-`{-~]/g;
5825
+ zhCommaTest = /,/;
5826
+ zhCommaGlobal = /,/g;
5806
5827
  });
5807
5828
 
5808
5829
  // src/services/index.ts
@@ -7874,7 +7895,7 @@ var require_includesString = __commonJS((exports, module) => {
7874
7895
  value: true
7875
7896
  });
7876
7897
  exports.default = undefined;
7877
- var includes = function includes(str, val) {
7898
+ var includes = function includes2(str, val) {
7878
7899
  return str.indexOf(val) !== -1;
7879
7900
  };
7880
7901
  var _default = exports.default = includes;
@@ -7989,7 +8010,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
7989
8010
  url = split.shift();
7990
8011
  var protocol_match = url.match(/^([a-z][a-z0-9+\-.]*):/i);
7991
8012
  var had_explicit_protocol = false;
7992
- var cleanUpProtocol = function cleanUpProtocol(potential_protocol2) {
8013
+ var cleanUpProtocol = function cleanUpProtocol2(potential_protocol2) {
7993
8014
  had_explicit_protocol = true;
7994
8015
  protocol = potential_protocol2.toLowerCase();
7995
8016
  if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {
@@ -8261,10 +8282,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
8261
8282
  if (!t) {
8262
8283
  if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && typeof r.length == "number") {
8263
8284
  t && (r = t);
8264
- var _n = 0, F = function F() {};
8285
+ var _n = 0, F = function F2() {};
8265
8286
  return { s: F, n: function n() {
8266
8287
  return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
8267
- }, e: function e(r2) {
8288
+ }, e: function e2(r2) {
8268
8289
  throw r2;
8269
8290
  }, f: F };
8270
8291
  }
@@ -8277,7 +8298,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
8277
8298
  }, n: function n() {
8278
8299
  var r2 = t.next();
8279
8300
  return a = r2.done, r2;
8280
- }, e: function e(r2) {
8301
+ }, e: function e2(r2) {
8281
8302
  u = true, o = r2;
8282
8303
  }, f: function f() {
8283
8304
  try {
@@ -8427,7 +8448,7 @@ var require_includesArray = __commonJS((exports, module) => {
8427
8448
  value: true
8428
8449
  });
8429
8450
  exports.default = undefined;
8430
- var includes = function includes(arr, val) {
8451
+ var includes = function includes2(arr, val) {
8431
8452
  return arr.some(function(arrVal) {
8432
8453
  return val === arrVal;
8433
8454
  });
@@ -10075,10 +10096,10 @@ var require_isIdentityCard = __commonJS((exports, module) => {
10075
10096
  ];
10076
10097
  var powers = ["7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2"];
10077
10098
  var parityBit = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
10078
- var checkAddressCode = function checkAddressCode(addressCode) {
10099
+ var checkAddressCode = function checkAddressCode2(addressCode) {
10079
10100
  return (0, _includesArray.default)(provincesAndCities, addressCode);
10080
10101
  };
10081
- var checkBirthDayCode = function checkBirthDayCode(birDayCode) {
10102
+ var checkBirthDayCode = function checkBirthDayCode2(birDayCode) {
10082
10103
  var yyyy = parseInt(birDayCode.substring(0, 4), 10);
10083
10104
  var mm = parseInt(birDayCode.substring(4, 6), 10);
10084
10105
  var dd = parseInt(birDayCode.substring(6), 10);
@@ -10090,7 +10111,7 @@ var require_isIdentityCard = __commonJS((exports, module) => {
10090
10111
  }
10091
10112
  return false;
10092
10113
  };
10093
- var getParityBit = function getParityBit(idCardNo) {
10114
+ var getParityBit = function getParityBit2(idCardNo) {
10094
10115
  var id17 = idCardNo.substring(0, 17);
10095
10116
  var power = 0;
10096
10117
  for (var i = 0;i < 17; i++) {
@@ -10099,10 +10120,10 @@ var require_isIdentityCard = __commonJS((exports, module) => {
10099
10120
  var mod = power % 11;
10100
10121
  return parityBit[mod];
10101
10122
  };
10102
- var checkParityBit = function checkParityBit(idCardNo) {
10123
+ var checkParityBit = function checkParityBit2(idCardNo) {
10103
10124
  return getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase();
10104
10125
  };
10105
- var check15IdCardNo = function check15IdCardNo(idCardNo) {
10126
+ var check15IdCardNo = function check15IdCardNo2(idCardNo) {
10106
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);
10107
10128
  if (!check)
10108
10129
  return false;
@@ -10116,7 +10137,7 @@ var require_isIdentityCard = __commonJS((exports, module) => {
10116
10137
  return false;
10117
10138
  return true;
10118
10139
  };
10119
- var check18IdCardNo = function check18IdCardNo(idCardNo) {
10140
+ var check18IdCardNo = function check18IdCardNo2(idCardNo) {
10120
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);
10121
10142
  if (!check)
10122
10143
  return false;
@@ -10130,7 +10151,7 @@ var require_isIdentityCard = __commonJS((exports, module) => {
10130
10151
  return false;
10131
10152
  return checkParityBit(idCardNo);
10132
10153
  };
10133
- var checkIdCardNo = function checkIdCardNo(idCardNo) {
10154
+ var checkIdCardNo = function checkIdCardNo2(idCardNo) {
10134
10155
  var check = /^\d{15}|(\d{17}(\d|x|X))$/.test(idCardNo);
10135
10156
  if (!check)
10136
10157
  return false;
@@ -10503,7 +10524,7 @@ var require_isTaxID = __commonJS((exports, module) => {
10503
10524
  function _interopRequireWildcard(e, t) {
10504
10525
  if (typeof WeakMap == "function")
10505
10526
  var r = new WeakMap, n = new WeakMap;
10506
- return (_interopRequireWildcard = function _interopRequireWildcard(e2, t2) {
10527
+ return (_interopRequireWildcard = function _interopRequireWildcard2(e2, t2) {
10507
10528
  if (!t2 && e2 && e2.__esModule)
10508
10529
  return e2;
10509
10530
  var o, i, f = { __proto__: null, default: e2 };
@@ -11931,7 +11952,7 @@ var require_isISO8601 = __commonJS((exports, module) => {
11931
11952
  }
11932
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)?)?)?)?$/;
11933
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)?)?)?)?$/;
11934
- var isValidDate = function isValidDate(str) {
11955
+ var isValidDate = function isValidDate2(str) {
11935
11956
  var ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);
11936
11957
  if (ordinalMatch) {
11937
11958
  var oYear = Number(ordinalMatch[1]);
@@ -12308,10 +12329,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
12308
12329
  if (!t) {
12309
12330
  if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && typeof r.length == "number") {
12310
12331
  t && (r = t);
12311
- var _n = 0, F = function F() {};
12332
+ var _n = 0, F = function F2() {};
12312
12333
  return { s: F, n: function n() {
12313
12334
  return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
12314
- }, e: function e(r2) {
12335
+ }, e: function e2(r2) {
12315
12336
  throw r2;
12316
12337
  }, f: F };
12317
12338
  }
@@ -12324,7 +12345,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
12324
12345
  }, n: function n() {
12325
12346
  var r2 = t.next();
12326
12347
  return a = r2.done, r2;
12327
- }, e: function e(r2) {
12348
+ }, e: function e2(r2) {
12328
12349
  u = true, o = r2;
12329
12350
  }, f: function f() {
12330
12351
  try {
@@ -12991,7 +13012,7 @@ var require_isVAT = __commonJS((exports) => {
12991
13012
  function _interopRequireWildcard(e, t) {
12992
13013
  if (typeof WeakMap == "function")
12993
13014
  var r = new WeakMap, n = new WeakMap;
12994
- return (_interopRequireWildcard = function _interopRequireWildcard(e2, t2) {
13015
+ return (_interopRequireWildcard = function _interopRequireWildcard2(e2, t2) {
12995
13016
  if (!t2 && e2 && e2.__esModule)
12996
13017
  return e2;
12997
13018
  var o, i, f = { __proto__: null, default: e2 };
@@ -13010,7 +13031,7 @@ var require_isVAT = __commonJS((exports) => {
13010
13031
  function _interopRequireDefault(e) {
13011
13032
  return e && e.__esModule ? e : { default: e };
13012
13033
  }
13013
- var AU = function AU(str) {
13034
+ var AU = function AU2(str) {
13014
13035
  var match = str.match(/^(AU)?(\d{11})$/);
13015
13036
  if (!match) {
13016
13037
  return false;
@@ -13024,8 +13045,8 @@ var require_isVAT = __commonJS((exports) => {
13024
13045
  }
13025
13046
  return total !== 0 && total % 89 === 0;
13026
13047
  };
13027
- var CH = function CH(str) {
13028
- var hasValidCheckNumber = function hasValidCheckNumber(digits) {
13048
+ var CH = function CH2(str) {
13049
+ var hasValidCheckNumber = function hasValidCheckNumber2(digits) {
13029
13050
  var lastDigit = digits.pop();
13030
13051
  var weights = [5, 4, 3, 2, 7, 6, 5, 4];
13031
13052
  var calculatedCheckNumber = (11 - digits.reduce(function(acc, el, idx) {
@@ -13037,7 +13058,7 @@ var require_isVAT = __commonJS((exports) => {
13037
13058
  return +el;
13038
13059
  }));
13039
13060
  };
13040
- var PT = function PT(str) {
13061
+ var PT = function PT2(str) {
13041
13062
  var match = str.match(/^(PT)?(\d{9})$/);
13042
13063
  if (!match) {
13043
13064
  return false;
@@ -13380,7 +13401,7 @@ var require_validator = __commonJS((exports, module) => {
13380
13401
  function _interopRequireWildcard(e, t) {
13381
13402
  if (typeof WeakMap == "function")
13382
13403
  var r = new WeakMap, n = new WeakMap;
13383
- return (_interopRequireWildcard = function _interopRequireWildcard(e2, t2) {
13404
+ return (_interopRequireWildcard = function _interopRequireWildcard2(e2, t2) {
13384
13405
  if (!t2 && e2 && e2.__esModule)
13385
13406
  return e2;
13386
13407
  var o, i, f = { __proto__: null, default: e2 };
@@ -203010,7 +203031,7 @@ var require_utils = __commonJS((exports) => {
203010
203031
  }
203011
203032
  var toString2 = Object.prototype.toString;
203012
203033
  exports.toString = toString2;
203013
- var isFunction = function isFunction(value) {
203034
+ var isFunction = function isFunction2(value) {
203014
203035
  return typeof value === "function";
203015
203036
  };
203016
203037
  if (isFunction(/x/)) {
@@ -203455,7 +203476,7 @@ var require_logger = __commonJS((exports, module) => {
203455
203476
  }
203456
203477
  return level;
203457
203478
  },
203458
- log: function log(level) {
203479
+ log: function log2(level) {
203459
203480
  level = logger.lookupLevel(level);
203460
203481
  if (typeof console !== "undefined" && logger.lookupLevel(logger.level) <= level) {
203461
203482
  var method = logger.methodMap[level];
@@ -203664,7 +203685,7 @@ var require_wrapHelper = __commonJS((exports) => {
203664
203685
  if (typeof helper !== "function") {
203665
203686
  return helper;
203666
203687
  }
203667
- var wrapper = function wrapper() {
203688
+ var wrapper = function wrapper2() {
203668
203689
  var options = arguments[arguments.length - 1];
203669
203690
  arguments[arguments.length - 1] = transformOptionsFn(options);
203670
203691
  return helper.apply(this, arguments);
@@ -205328,7 +205349,7 @@ var require_compiler = __commonJS((exports) => {
205328
205349
  return true;
205329
205350
  },
205330
205351
  guid: 0,
205331
- compile: function compile(program, options) {
205352
+ compile: function compile2(program, options) {
205332
205353
  this.sourceNode = [];
205333
205354
  this.opcodes = [];
205334
205355
  this.children = [];
@@ -205742,7 +205763,7 @@ var require_code_gen = __commonJS((exports, module) => {
205742
205763
  toStringWithSourceMap: function toStringWithSourceMap() {
205743
205764
  return { code: this.toString() };
205744
205765
  },
205745
- toString: function toString() {
205766
+ toString: function toString2() {
205746
205767
  return this.src;
205747
205768
  }
205748
205769
  };
@@ -213930,7 +213951,7 @@ __export(exports_version, {
213930
213951
  function getVersion() {
213931
213952
  return VERSION;
213932
213953
  }
213933
- var VERSION = "4.0.31";
213954
+ var VERSION = "4.0.33";
213934
213955
 
213935
213956
  // src/server/index.ts
213936
213957
  init_config();
@@ -215732,7 +215753,7 @@ var swagger_default = {
215732
215753
  },
215733
215754
  info: {
215734
215755
  title: "MTranServer API",
215735
- version: "4.0.31",
215756
+ version: "4.0.33",
215736
215757
  description: "Translation server API",
215737
215758
  license: {
215738
215759
  name: "Apache-2.0"
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/services/engine.ts"],"names":[],"mappings":"AAkOA,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,MAAM,CAAC,CA0EjB;AAkCD,wBAAgB,iBAAiB,SAahC"}
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/services/engine.ts"],"names":[],"mappings":"AAiOA,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,MAAM,CAAC,CA0EjB;AAkCD,wBAAgB,iBAAiB,SAahC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtranserver",
3
- "version": "4.0.31",
3
+ "version": "4.0.33",
4
4
  "type": "module",
5
5
  "description": "Translation server",
6
6
  "main": "./dist/index.js",