@andre1502/react-utilities 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. package/README.md +340 -0
  2. package/dist/Config/Config.d.ts +28 -0
  3. package/dist/Config/Config.js +200 -0
  4. package/dist/Config/Config.js.map +1 -0
  5. package/dist/Config/GoogleAuth.d.ts +15 -0
  6. package/dist/Config/GoogleAuth.js +71 -0
  7. package/dist/Config/GoogleAuth.js.map +1 -0
  8. package/dist/Config/Locales.d.ts +18 -0
  9. package/dist/Config/Locales.js +62 -0
  10. package/dist/Config/Locales.js.map +1 -0
  11. package/dist/Config/Output.d.ts +10 -0
  12. package/dist/Config/Output.js +28 -0
  13. package/dist/Config/Output.js.map +1 -0
  14. package/dist/Config/Sitemap.d.ts +13 -0
  15. package/dist/Config/Sitemap.js +73 -0
  16. package/dist/Config/Sitemap.js.map +1 -0
  17. package/dist/Format/NumberFormat.d.ts +6 -0
  18. package/dist/Format/NumberFormat.js +77 -0
  19. package/dist/Format/NumberFormat.js.map +1 -0
  20. package/dist/Format/NumberParser.d.ts +9 -0
  21. package/dist/Format/NumberParser.js +51 -0
  22. package/dist/Format/NumberParser.js.map +1 -0
  23. package/dist/React-BaJ1KfGF.js +87 -0
  24. package/dist/React-BaJ1KfGF.js.map +1 -0
  25. package/dist/React-qUl0CBmE.js +109 -0
  26. package/dist/React-qUl0CBmE.js.map +1 -0
  27. package/dist/ReactNative-CqUrY2ZJ.js +3856 -0
  28. package/dist/ReactNative-CqUrY2ZJ.js.map +1 -0
  29. package/dist/ReactNative-mNnws-b5.js +3834 -0
  30. package/dist/ReactNative-mNnws-b5.js.map +1 -0
  31. package/dist/Sentry/Build.d.ts +9 -0
  32. package/dist/Sentry/Build.js +88 -0
  33. package/dist/Sentry/Build.js.map +1 -0
  34. package/dist/Sentry/React.d.ts +18 -0
  35. package/dist/Sentry/React.js +104 -0
  36. package/dist/Sentry/React.js.map +1 -0
  37. package/dist/Sentry/ReactNative.d.ts +18 -0
  38. package/dist/Sentry/ReactNative.js +114 -0
  39. package/dist/Sentry/ReactNative.js.map +1 -0
  40. package/dist/Sentry/Utils.d.ts +2 -0
  41. package/dist/Sentry/Utils.js +24 -0
  42. package/dist/Sentry/Utils.js.map +1 -0
  43. package/dist/Utils/Files.d.ts +7 -0
  44. package/dist/Utils/Files.js +52 -0
  45. package/dist/Utils/Files.js.map +1 -0
  46. package/dist/Utils-Cq948gfa.js +20 -0
  47. package/dist/Utils-Cq948gfa.js.map +1 -0
  48. package/dist/Utils-Dilye04y.js +22 -0
  49. package/dist/Utils-Dilye04y.js.map +1 -0
  50. package/dist/config-cli.cjs +471 -0
  51. package/dist/config-cli.cjs.map +1 -0
  52. package/dist/config-cli.d.ts +34 -0
  53. package/dist/config-cli.js +220 -0
  54. package/dist/config-cli.js.map +1 -0
  55. package/dist/config-cli.mjs +443 -0
  56. package/dist/config-cli.mjs.map +1 -0
  57. package/dist/enums/CurrencySymbolEnum.d.ts +5 -0
  58. package/dist/enums/CurrencySymbolEnum.js +13 -0
  59. package/dist/enums/CurrencySymbolEnum.js.map +1 -0
  60. package/dist/format.cjs +122 -0
  61. package/dist/format.cjs.map +1 -0
  62. package/dist/format.d.ts +3 -0
  63. package/dist/format.js +55 -0
  64. package/dist/format.js.map +1 -0
  65. package/dist/format.mjs +117 -0
  66. package/dist/format.mjs.map +1 -0
  67. package/dist/index-cli.cjs +24 -0
  68. package/dist/index-cli.cjs.map +1 -0
  69. package/dist/index-cli.d.ts +2 -0
  70. package/dist/index-cli.js +28 -0
  71. package/dist/index-cli.js.map +1 -0
  72. package/dist/index-cli.mjs +12 -0
  73. package/dist/index-cli.mjs.map +1 -0
  74. package/dist/index-fmt.cjs +16 -0
  75. package/dist/index-fmt.cjs.map +1 -0
  76. package/dist/index-fmt.d.ts +1 -0
  77. package/dist/index-fmt.js +17 -0
  78. package/dist/index-fmt.js.map +1 -0
  79. package/dist/index-fmt.mjs +3 -0
  80. package/dist/index-fmt.mjs.map +1 -0
  81. package/dist/index-rn.cjs +21 -0
  82. package/dist/index-rn.cjs.map +1 -0
  83. package/dist/index-rn.d.ts +2 -0
  84. package/dist/index-rn.js +28 -0
  85. package/dist/index-rn.js.map +1 -0
  86. package/dist/index-rn.mjs +6 -0
  87. package/dist/index-rn.mjs.map +1 -0
  88. package/dist/index.cjs +21 -0
  89. package/dist/index.cjs.map +1 -0
  90. package/dist/index.d.ts +2 -0
  91. package/dist/index.js +28 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/index.mjs +6 -0
  94. package/dist/index.mjs.map +1 -0
  95. package/dist/interfaces/Config/ConfigOptions.d.ts +8 -0
  96. package/dist/interfaces/Config/ConfigOptions.js +6 -0
  97. package/dist/interfaces/Config/ConfigOptions.js.map +1 -0
  98. package/dist/interfaces/Config/OutputMap.d.ts +3 -0
  99. package/dist/interfaces/Config/OutputMap.js +6 -0
  100. package/dist/interfaces/Config/OutputMap.js.map +1 -0
  101. package/dist/interfaces/Config/OutputOptions.d.ts +7 -0
  102. package/dist/interfaces/Config/OutputOptions.js +6 -0
  103. package/dist/interfaces/Config/OutputOptions.js.map +1 -0
  104. package/dist/interfaces/Config/SitemapMap.d.ts +5 -0
  105. package/dist/interfaces/Config/SitemapMap.js +6 -0
  106. package/dist/interfaces/Config/SitemapMap.js.map +1 -0
  107. package/dist/interfaces/Config/StringMap.d.ts +3 -0
  108. package/dist/interfaces/Config/StringMap.js +6 -0
  109. package/dist/interfaces/Config/StringMap.js.map +1 -0
  110. package/dist/interfaces/Format/FormatOptions.d.ts +14 -0
  111. package/dist/interfaces/Format/FormatOptions.js +6 -0
  112. package/dist/interfaces/Format/FormatOptions.js.map +1 -0
  113. package/dist/interfaces/Sentry/InitOptions.d.ts +20 -0
  114. package/dist/interfaces/Sentry/InitOptions.js +6 -0
  115. package/dist/interfaces/Sentry/InitOptions.js.map +1 -0
  116. package/dist/interfaces/Sentry/InitOptionsRN.d.ts +4 -0
  117. package/dist/interfaces/Sentry/InitOptionsRN.js +6 -0
  118. package/dist/interfaces/Sentry/InitOptionsRN.js.map +1 -0
  119. package/dist/interfaces/Sentry/SourceMapOptions.d.ts +7 -0
  120. package/dist/interfaces/Sentry/SourceMapOptions.js +6 -0
  121. package/dist/interfaces/Sentry/SourceMapOptions.js.map +1 -0
  122. package/dist/sentry-cli.cjs +119 -0
  123. package/dist/sentry-cli.cjs.map +1 -0
  124. package/dist/sentry-cli.d.ts +9 -0
  125. package/dist/sentry-cli.js +50 -0
  126. package/dist/sentry-cli.js.map +1 -0
  127. package/dist/sentry-cli.mjs +98 -0
  128. package/dist/sentry-cli.mjs.map +1 -0
  129. package/dist/sentry-rn.cjs +11 -0
  130. package/dist/sentry-rn.cjs.map +1 -0
  131. package/dist/sentry-rn.d.ts +2 -0
  132. package/dist/sentry-rn.js +28 -0
  133. package/dist/sentry-rn.js.map +1 -0
  134. package/dist/sentry-rn.mjs +4 -0
  135. package/dist/sentry-rn.mjs.map +1 -0
  136. package/dist/sentry.cjs +11 -0
  137. package/dist/sentry.cjs.map +1 -0
  138. package/dist/sentry.d.ts +2 -0
  139. package/dist/sentry.js +28 -0
  140. package/dist/sentry.js.map +1 -0
  141. package/dist/sentry.mjs +4 -0
  142. package/dist/sentry.mjs.map +1 -0
  143. package/dist/types/Config/OptionType.d.ts +2 -0
  144. package/dist/types/Config/OptionType.js +6 -0
  145. package/dist/types/Config/OptionType.js.map +1 -0
  146. package/dist/types/Format/OptionType.d.ts +3 -0
  147. package/dist/types/Format/OptionType.js +6 -0
  148. package/dist/types/Format/OptionType.js.map +1 -0
  149. package/dist/types/Sentry/OptionType.d.ts +1 -0
  150. package/dist/types/Sentry/OptionType.js +6 -0
  151. package/dist/types/Sentry/OptionType.js.map +1 -0
  152. package/package.json +139 -0
  153. package/src/Config/Config.ts +258 -0
  154. package/src/Config/GoogleAuth.ts +54 -0
  155. package/src/Config/Locales.ts +72 -0
  156. package/src/Config/Output.ts +29 -0
  157. package/src/Config/Sitemap.ts +67 -0
  158. package/src/Format/NumberFormat.ts +96 -0
  159. package/src/Format/NumberParser.ts +42 -0
  160. package/src/Sentry/Build.ts +67 -0
  161. package/src/Sentry/React.ts +127 -0
  162. package/src/Sentry/ReactNative.ts +133 -0
  163. package/src/Sentry/Utils.ts +26 -0
  164. package/src/Utils/Files.ts +51 -0
  165. package/src/config-cli.ts +152 -0
  166. package/src/enums/CurrencySymbolEnum.ts +5 -0
  167. package/src/format.ts +39 -0
  168. package/src/index-cli.ts +2 -0
  169. package/src/index-fmt.ts +1 -0
  170. package/src/index-rn.ts +2 -0
  171. package/src/index.ts +2 -0
  172. package/src/interfaces/Config/ConfigOptions.ts +9 -0
  173. package/src/interfaces/Config/OutputMap.ts +3 -0
  174. package/src/interfaces/Config/OutputOptions.ts +8 -0
  175. package/src/interfaces/Config/SitemapMap.ts +5 -0
  176. package/src/interfaces/Config/StringMap.ts +3 -0
  177. package/src/interfaces/Format/FormatOptions.ts +19 -0
  178. package/src/interfaces/Sentry/InitOptions.ts +23 -0
  179. package/src/interfaces/Sentry/InitOptionsRN.ts +5 -0
  180. package/src/interfaces/Sentry/SourceMapOptions.ts +7 -0
  181. package/src/sentry-cli.ts +16 -0
  182. package/src/sentry-rn.ts +2 -0
  183. package/src/sentry.ts +2 -0
  184. package/src/types/Config/OptionType.ts +2 -0
  185. package/src/types/Format/OptionType.ts +15 -0
  186. package/src/types/Sentry/OptionType.ts +1 -0
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.fetchGoogleSheet = exports.authorizeServiceAccount = void 0;
8
+ var _fs = require("fs");
9
+ var _googleAuthLibrary = require("google-auth-library");
10
+ var _googleapis = require("googleapis");
11
+ var path = _interopRequireWildcard(require("path"));
12
+ var process = _interopRequireWildcard(require("process"));
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
15
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
16
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
17
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
18
+ var SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly'];
19
+ var GOOGLE_APPLICATION_CREDENTIALS_PATH = path.join(process.cwd(), '/google_application_credentials.json');
20
+
21
+ /**
22
+ * Authenticate using google console service account.
23
+ * @return {GoogleAuth<JSONClient>}
24
+ */
25
+ var authorizeServiceAccount = exports.authorizeServiceAccount = function authorizeServiceAccount() {
26
+ var isExist = (0, _fs.existsSync)(GOOGLE_APPLICATION_CREDENTIALS_PATH);
27
+ var options = {
28
+ scopes: SCOPES
29
+ };
30
+ if (isExist) {
31
+ options.keyFile = GOOGLE_APPLICATION_CREDENTIALS_PATH;
32
+ }
33
+ return new _googleAuthLibrary.GoogleAuth(options);
34
+ };
35
+
36
+ /**
37
+ * @param {GoogleAuth<JSONClient>} auth The authenticated Google OAuth client.
38
+ * @param {string} spreadsheetId
39
+ * @param {string} spreadsheetTab
40
+ * @return {Promise<any[][] | null | undefined>}
41
+ */
42
+ var fetchGoogleSheet = exports.fetchGoogleSheet = /*#__PURE__*/function () {
43
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(auth, spreadsheetId, spreadsheetTab) {
44
+ var sheets, res;
45
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
46
+ while (1) switch (_context.prev = _context.next) {
47
+ case 0:
48
+ sheets = _googleapis.google.sheets({
49
+ version: 'v4',
50
+ auth: auth
51
+ });
52
+ _context.next = 3;
53
+ return sheets.spreadsheets.values.get({
54
+ spreadsheetId: spreadsheetId,
55
+ range: spreadsheetTab,
56
+ majorDimension: 'COLUMNS'
57
+ });
58
+ case 3:
59
+ res = _context.sent;
60
+ return _context.abrupt("return", res.data.values);
61
+ case 5:
62
+ case "end":
63
+ return _context.stop();
64
+ }
65
+ }, _callee);
66
+ }));
67
+ return function fetchGoogleSheet(_x, _x2, _x3) {
68
+ return _ref.apply(this, arguments);
69
+ };
70
+ }();
71
+ //# sourceMappingURL=GoogleAuth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GoogleAuth.js","names":["_fs","require","_googleAuthLibrary","_googleapis","path","_interopRequireWildcard","process","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_regeneratorRuntime","prototype","o","value","Symbol","iterator","c","asyncIterator","toStringTag","define","enumerable","configurable","writable","wrap","Generator","create","Context","makeInvokeMethod","tryCatch","type","arg","h","l","f","s","y","GeneratorFunction","GeneratorFunctionPrototype","p","d","getPrototypeOf","v","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","resolve","__await","then","callInvokeWithMethodAndArg","Error","done","method","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","resultName","next","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","isNaN","length","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","awrap","async","Promise","keys","reverse","pop","prev","charAt","slice","stop","rval","handle","complete","finish","_catch","delegateYield","asyncGeneratorStep","_asyncToGenerator","arguments","apply","_next","_throw","SCOPES","GOOGLE_APPLICATION_CREDENTIALS_PATH","join","cwd","authorizeServiceAccount","exports","isExist","existsSync","options","scopes","keyFile","GoogleAuth","fetchGoogleSheet","_ref","_callee","auth","spreadsheetId","spreadsheetTab","sheets","res","_callee$","_context","google","version","spreadsheets","range","majorDimension","data","_x","_x2","_x3"],"sources":["../../src/Config/GoogleAuth.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { GoogleAuth } from 'google-auth-library';\nimport { JSONClient } from 'google-auth-library/build/src/auth/googleauth';\nimport { google } from 'googleapis';\nimport * as path from 'path';\nimport * as process from 'process';\n\nconst SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly'];\nconst GOOGLE_APPLICATION_CREDENTIALS_PATH = path.join(\n process.cwd(),\n '/google_application_credentials.json',\n);\n\n/**\n * Authenticate using google console service account.\n * @return {GoogleAuth<JSONClient>}\n */\nconst authorizeServiceAccount = (): GoogleAuth<JSONClient> => {\n const isExist = existsSync(GOOGLE_APPLICATION_CREDENTIALS_PATH);\n\n const options: any = {\n scopes: SCOPES,\n };\n\n if (isExist) {\n options.keyFile = GOOGLE_APPLICATION_CREDENTIALS_PATH;\n }\n\n return new GoogleAuth(options);\n};\n\n/**\n * @param {GoogleAuth<JSONClient>} auth The authenticated Google OAuth client.\n * @param {string} spreadsheetId\n * @param {string} spreadsheetTab\n * @return {Promise<any[][] | null | undefined>}\n */\nconst fetchGoogleSheet = async (\n auth: GoogleAuth<JSONClient>,\n spreadsheetId: string,\n spreadsheetTab: string,\n): Promise<any[][] | null | undefined> => {\n const sheets = google.sheets({ version: 'v4', auth });\n\n const res = await sheets.spreadsheets.values.get({\n spreadsheetId: spreadsheetId,\n range: spreadsheetTab,\n majorDimension: 'COLUMNS',\n });\n\n return res.data.values;\n};\n\nexport { authorizeServiceAccount, fetchGoogleSheet };\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAD,uBAAA,CAAAJ,OAAA;AAAmC,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,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,YAAY,CAACxF,MAAM,CAAC5C,GAAG,CAAC;YAC/C4H,aAAa,EAAEA,aAAa;YAC5BS,KAAK,EAAER,cAAc;YACrBS,cAAc,EAAE;UAClB,CAAC,CAAC;QAAA;UAJIP,GAAG,GAAAE,QAAA,CAAArE,IAAA;UAAA,OAAAqE,QAAA,CAAAlE,MAAA,WAMFgE,GAAG,CAACQ,IAAI,CAAC3F,MAAM;QAAA;QAAA;UAAA,OAAAqF,QAAA,CAAAlC,IAAA;MAAA;IAAA,GAAA2B,OAAA;EAAA,CACvB;EAAA,gBAdKF,gBAAgBA,CAAAgB,EAAA,EAAAC,GAAA,EAAAC,GAAA;IAAA,OAAAjB,IAAA,CAAAhB,KAAA,OAAAD,SAAA;EAAA;AAAA,GAcrB","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import { OutputMap } from '../interfaces/Config/OutputMap';
2
+ import { OutputOptions } from '../interfaces/Config/OutputOptions';
3
+ /**
4
+ * Process locales data
5
+ *
6
+ * @param {any[][]} rows
7
+ * @return {OutputMap}
8
+ */
9
+ declare const processLocales: (rows: any[][]) => OutputMap;
10
+ /**
11
+ * Export locales data to file
12
+ *
13
+ * @param {OutputMap} data
14
+ * @param {OutputOptions} options
15
+ * @return {void}
16
+ */
17
+ declare const exportLocales: (data: OutputMap, options: OutputOptions) => void;
18
+ export { exportLocales, processLocales };
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.processLocales = exports.exportLocales = void 0;
7
+ var _Output = require("./Output");
8
+ /**
9
+ * Process locales data
10
+ *
11
+ * @param {any[][]} rows
12
+ * @return {OutputMap}
13
+ */
14
+ var processLocales = exports.processLocales = function processLocales(rows) {
15
+ var keys = rows[0].map(function (key) {
16
+ return key;
17
+ });
18
+ var data = {};
19
+ rows.forEach(function (lang, index) {
20
+ if (index === 0) {
21
+ return;
22
+ }
23
+ var langData = {};
24
+ lang.forEach(function (data, dIndex) {
25
+ if (dIndex === 0) {
26
+ return;
27
+ }
28
+ langData[keys[dIndex]] = data;
29
+ });
30
+ data[lang[0]] = langData;
31
+ });
32
+ return data;
33
+ };
34
+
35
+ /**
36
+ * Export locales data to file
37
+ *
38
+ * @param {OutputMap} data
39
+ * @param {OutputOptions} options
40
+ * @return {void}
41
+ */
42
+ var exportLocales = exports.exportLocales = function exportLocales(data, options) {
43
+ Object.keys(data).forEach(function (key) {
44
+ options.filename = "".concat(key, ".").concat(options.exportAs.toLowerCase());
45
+ var content = '';
46
+ switch (options.exportAs) {
47
+ case 'ts':
48
+ content = 'export default ' + JSON.stringify(data[key], null, 2);
49
+ break;
50
+ case 'json':
51
+ content = JSON.stringify(data[key], null, 2);
52
+ break;
53
+ default:
54
+ throw new Error("exportAs ".concat(options.exportAs, " not supported."));
55
+ }
56
+ if (!content) {
57
+ throw new Error("empty content, please check remote value.");
58
+ }
59
+ (0, _Output.outputToFile)(content, options);
60
+ });
61
+ };
62
+ //# sourceMappingURL=Locales.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Locales.js","names":["_Output","require","processLocales","exports","rows","keys","map","key","data","forEach","lang","index","langData","dIndex","exportLocales","options","Object","filename","concat","exportAs","toLowerCase","content","JSON","stringify","Error","outputToFile"],"sources":["../../src/Config/Locales.ts"],"sourcesContent":["import { OutputMap } from '../interfaces/Config/OutputMap';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\nimport { StringMap } from '../interfaces/Config/StringMap';\nimport { outputToFile } from './Output';\n\n/**\n * Process locales data\n *\n * @param {any[][]} rows\n * @return {OutputMap}\n */\nconst processLocales = (rows: any[][]): OutputMap => {\n let keys = rows[0].map((key) => {\n return key;\n });\n\n let data: OutputMap = {};\n\n rows.forEach((lang: string[], index: number) => {\n if (index === 0) {\n return;\n }\n\n let langData: StringMap = {};\n\n lang.forEach((data: string, dIndex: number) => {\n if (dIndex === 0) {\n return;\n }\n\n langData[keys[dIndex]] = data;\n });\n\n data[lang[0]] = langData;\n });\n\n return data;\n};\n\n/**\n * Export locales data to file\n *\n * @param {OutputMap} data\n * @param {OutputOptions} options\n * @return {void}\n */\nconst exportLocales = (data: OutputMap, options: OutputOptions): void => {\n Object.keys(data).forEach((key) => {\n options.filename = `${key}.${options.exportAs!.toLowerCase()}`;\n\n let content = '';\n\n switch (options.exportAs) {\n case 'ts':\n content = 'export default ' + JSON.stringify(data[key], null, 2);\n break;\n case 'json':\n content = JSON.stringify(data[key], null, 2);\n break;\n default:\n throw new Error(`exportAs ${options.exportAs} not supported.`);\n }\n\n if (!content) {\n throw new Error(`empty content, please check remote value.`);\n }\n\n outputToFile(content, options);\n });\n};\n\nexport { exportLocales, processLocales };\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAjBA,cAAcA,CAAIE,IAAa,EAAgB;EACnD,IAAIC,IAAI,GAAGD,IAAI,CAAC,CAAC,CAAC,CAACE,GAAG,CAAC,UAACC,GAAG,EAAK;IAC9B,OAAOA,GAAG;EACZ,CAAC,CAAC;EAEF,IAAIC,IAAe,GAAG,CAAC,CAAC;EAExBJ,IAAI,CAACK,OAAO,CAAC,UAACC,IAAc,EAAEC,KAAa,EAAK;IAC9C,IAAIA,KAAK,KAAK,CAAC,EAAE;MACf;IACF;IAEA,IAAIC,QAAmB,GAAG,CAAC,CAAC;IAE5BF,IAAI,CAACD,OAAO,CAAC,UAACD,IAAY,EAAEK,MAAc,EAAK;MAC7C,IAAIA,MAAM,KAAK,CAAC,EAAE;QAChB;MACF;MAEAD,QAAQ,CAACP,IAAI,CAACQ,MAAM,CAAC,CAAC,GAAGL,IAAI;IAC/B,CAAC,CAAC;IAEFA,IAAI,CAACE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAGE,QAAQ;EAC1B,CAAC,CAAC;EAEF,OAAOJ,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMM,aAAa,GAAAX,OAAA,CAAAW,aAAA,GAAG,SAAhBA,aAAaA,CAAIN,IAAe,EAAEO,OAAsB,EAAW;EACvEC,MAAM,CAACX,IAAI,CAACG,IAAI,CAAC,CAACC,OAAO,CAAC,UAACF,GAAG,EAAK;IACjCQ,OAAO,CAACE,QAAQ,MAAAC,MAAA,CAAMX,GAAG,OAAAW,MAAA,CAAIH,OAAO,CAACI,QAAQ,CAAEC,WAAW,CAAC,CAAC,CAAE;IAE9D,IAAIC,OAAO,GAAG,EAAE;IAEhB,QAAQN,OAAO,CAACI,QAAQ;MACtB,KAAK,IAAI;QACPE,OAAO,GAAG,iBAAiB,GAAGC,IAAI,CAACC,SAAS,CAACf,IAAI,CAACD,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE;MACF,KAAK,MAAM;QACTc,OAAO,GAAGC,IAAI,CAACC,SAAS,CAACf,IAAI,CAACD,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5C;MACF;QACE,MAAM,IAAIiB,KAAK,aAAAN,MAAA,CAAaH,OAAO,CAACI,QAAQ,oBAAiB,CAAC;IAClE;IAEA,IAAI,CAACE,OAAO,EAAE;MACZ,MAAM,IAAIG,KAAK,4CAA4C,CAAC;IAC9D;IAEA,IAAAC,oBAAY,EAACJ,OAAO,EAAEN,OAAO,CAAC;EAChC,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { OutputOptions } from '../interfaces/Config/OutputOptions';
2
+ /**
3
+ * Write content into target file
4
+ *
5
+ * @param {string} content
6
+ * @param {OutputOptions} options
7
+ * @return {void}
8
+ */
9
+ declare const outputToFile: (content: string, options: OutputOptions) => void;
10
+ export { outputToFile };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.outputToFile = void 0;
7
+ var _fs = require("fs");
8
+ /**
9
+ * Write content into target file
10
+ *
11
+ * @param {string} content
12
+ * @param {OutputOptions} options
13
+ * @return {void}
14
+ */
15
+ var outputToFile = exports.outputToFile = function outputToFile(content, options) {
16
+ var filename = options.filename;
17
+ if (options.isFilenameLowercase) {
18
+ filename = filename.toLowerCase();
19
+ }
20
+ var filePath = "".concat(options.folder, "/").concat(filename);
21
+ (0, _fs.writeFile)(filePath, content, 'utf8', function (err) {
22
+ if (err) {
23
+ throw err;
24
+ }
25
+ console.log(filePath, content);
26
+ });
27
+ };
28
+ //# sourceMappingURL=Output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Output.js","names":["_fs","require","outputToFile","exports","content","options","filename","isFilenameLowercase","toLowerCase","filePath","concat","folder","writeFile","err","console","log"],"sources":["../../src/Config/Output.ts"],"sourcesContent":["import { writeFile } from 'fs';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\n\n/**\n * Write content into target file\n *\n * @param {string} content\n * @param {OutputOptions} options\n * @return {void}\n */\nconst outputToFile = (content: string, options: OutputOptions): void => {\n let filename = options.filename;\n\n if (options.isFilenameLowercase) {\n filename = filename.toLowerCase();\n }\n\n const filePath = `${options.folder}/${filename}`;\n\n writeFile(filePath, content, 'utf8', function (err) {\n if (err) {\n throw err;\n }\n\n console.log(filePath, content);\n });\n};\n\nexport { outputToFile };\n"],"mappings":";;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,SAAfA,YAAYA,CAAIE,OAAe,EAAEC,OAAsB,EAAW;EACtE,IAAIC,QAAQ,GAAGD,OAAO,CAACC,QAAQ;EAE/B,IAAID,OAAO,CAACE,mBAAmB,EAAE;IAC/BD,QAAQ,GAAGA,QAAQ,CAACE,WAAW,CAAC,CAAC;EACnC;EAEA,IAAMC,QAAQ,MAAAC,MAAA,CAAML,OAAO,CAACM,MAAM,OAAAD,MAAA,CAAIJ,QAAQ,CAAE;EAEhD,IAAAM,aAAS,EAACH,QAAQ,EAAEL,OAAO,EAAE,MAAM,EAAE,UAAUS,GAAG,EAAE;IAClD,IAAIA,GAAG,EAAE;MACP,MAAMA,GAAG;IACX;IAEAC,OAAO,CAACC,GAAG,CAACN,QAAQ,EAAEL,OAAO,CAAC;EAChC,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import { OutputOptions } from '../interfaces/Config/OutputOptions';
2
+ import { SitemapMap } from '../interfaces/Config/SitemapMap';
3
+ /**
4
+ * Transform Sitemap
5
+ *
6
+ * @param {string} hostname
7
+ * @param {SitemapMap[]} urls
8
+ * @param {boolean} includeRobots
9
+ * @param {OutputOptions} options
10
+ * @return {Promise<void>}
11
+ */
12
+ declare const transformSitemap: (hostname: string, urls: SitemapMap[], includeRobots: boolean, options: OutputOptions) => Promise<void>;
13
+ export { transformSitemap };
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.transformSitemap = void 0;
8
+ var _sitemap = require("sitemap");
9
+ var _stream = require("stream");
10
+ var _Output = require("./Output");
11
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
12
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
13
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
14
+ /**
15
+ * Generate Sitemap Robots
16
+ *
17
+ * @param {string} hostname
18
+ * @param {OutputOptions} options
19
+ * @return {void}
20
+ */
21
+ var generateRobots = function generateRobots(hostname, options) {
22
+ var content = ['# https://www.robotstxt.org/robotstxt.html', "Sitemap: ".concat(hostname, "/").concat(options.filename), 'User-agent: *', 'Disallow:'];
23
+ options.filename = 'robots.txt';
24
+ (0, _Output.outputToFile)(content.join('\r\n'), options);
25
+ };
26
+
27
+ /**
28
+ * Transform Sitemap
29
+ *
30
+ * @param {string} hostname
31
+ * @param {SitemapMap[]} urls
32
+ * @param {boolean} includeRobots
33
+ * @param {OutputOptions} options
34
+ * @return {Promise<void>}
35
+ */
36
+ var transformSitemap = exports.transformSitemap = /*#__PURE__*/function () {
37
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(hostname, urls, includeRobots, options) {
38
+ var stream, content;
39
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
40
+ while (1) switch (_context.prev = _context.next) {
41
+ case 0:
42
+ stream = new _sitemap.SitemapStream({
43
+ hostname: hostname,
44
+ lastmodDateOnly: false,
45
+ xmlns: {
46
+ news: false,
47
+ xhtml: false,
48
+ image: false,
49
+ video: false,
50
+ custom: ['xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"', 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"']
51
+ }
52
+ });
53
+ _context.next = 3;
54
+ return (0, _sitemap.streamToPromise)(_stream.Readable.from(urls).pipe(stream)).then(function (data) {
55
+ return data.toString();
56
+ });
57
+ case 3:
58
+ content = _context.sent;
59
+ (0, _Output.outputToFile)(content, options);
60
+ if (includeRobots) {
61
+ generateRobots(hostname, options);
62
+ }
63
+ case 6:
64
+ case "end":
65
+ return _context.stop();
66
+ }
67
+ }, _callee);
68
+ }));
69
+ return function transformSitemap(_x, _x2, _x3, _x4) {
70
+ return _ref.apply(this, arguments);
71
+ };
72
+ }();
73
+ //# sourceMappingURL=Sitemap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sitemap.js","names":["_sitemap","require","_stream","_Output","_regeneratorRuntime","e","t","r","Object","prototype","n","hasOwnProperty","o","defineProperty","value","i","Symbol","a","iterator","c","asyncIterator","u","toStringTag","define","enumerable","configurable","writable","wrap","Generator","create","Context","makeInvokeMethod","tryCatch","type","arg","call","h","l","f","s","y","GeneratorFunction","GeneratorFunctionPrototype","p","d","getPrototypeOf","v","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","_typeof","resolve","__await","then","callInvokeWithMethodAndArg","Error","done","method","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","resultName","next","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","isNaN","length","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","keys","reverse","pop","prev","charAt","slice","stop","rval","handle","complete","finish","_catch","delegateYield","asyncGeneratorStep","_asyncToGenerator","arguments","apply","_next","_throw","generateRobots","hostname","options","content","concat","filename","outputToFile","join","transformSitemap","exports","_ref","_callee","urls","includeRobots","stream","_callee$","_context","SitemapStream","lastmodDateOnly","xmlns","news","xhtml","image","video","custom","streamToPromise","Readable","from","pipe","data","toString","_x","_x2","_x3","_x4"],"sources":["../../src/Config/Sitemap.ts"],"sourcesContent":["import { SitemapStream, streamToPromise } from 'sitemap';\nimport { Readable } from 'stream';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\nimport { SitemapMap } from '../interfaces/Config/SitemapMap';\nimport { outputToFile } from './Output';\n\n/**\n * Generate Sitemap Robots\n *\n * @param {string} hostname\n * @param {OutputOptions} options\n * @return {void}\n */\nconst generateRobots = (hostname: string, options: OutputOptions): void => {\n let content = [\n '# https://www.robotstxt.org/robotstxt.html',\n `Sitemap: ${hostname}/${options.filename}`,\n 'User-agent: *',\n 'Disallow:',\n ];\n\n options.filename = 'robots.txt';\n\n outputToFile(content.join('\\r\\n'), options);\n};\n\n/**\n * Transform Sitemap\n *\n * @param {string} hostname\n * @param {SitemapMap[]} urls\n * @param {boolean} includeRobots\n * @param {OutputOptions} options\n * @return {Promise<void>}\n */\nconst transformSitemap = async (\n hostname: string,\n urls: SitemapMap[],\n includeRobots: boolean,\n options: OutputOptions,\n): Promise<void> => {\n const stream = new SitemapStream({\n hostname: hostname,\n lastmodDateOnly: false,\n xmlns: {\n news: false,\n xhtml: false,\n image: false,\n video: false,\n custom: [\n 'xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"',\n 'xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\"',\n ],\n },\n });\n const content = await streamToPromise(Readable.from(urls).pipe(stream)).then(\n (data) => data.toString(),\n );\n\n outputToFile(content, options);\n\n if (includeRobots) {\n generateRobots(hostname, options);\n }\n};\n\nexport { transformSitemap };\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAGA,IAAAE,OAAA,GAAAF,OAAA;AAAwC,SAAAG,oBAAA,kBAHxC,qJAAAA,mBAAA,YAAAA,oBAAA,WAAAC,CAAA,SAAAC,CAAA,EAAAD,CAAA,OAAAE,CAAA,GAAAC,MAAA,CAAAC,SAAA,EAAAC,CAAA,GAAAH,CAAA,CAAAI,cAAA,EAAAC,CAAA,GAAAJ,MAAA,CAAAK,cAAA,cAAAP,CAAA,EAAAD,CAAA,EAAAE,CAAA,IAAAD,CAAA,CAAAD,CAAA,IAAAE,CAAA,CAAAO,KAAA,KAAAC,CAAA,wBAAAC,MAAA,GAAAA,MAAA,OAAAC,CAAA,GAAAF,CAAA,CAAAG,QAAA,kBAAAC,CAAA,GAAAJ,CAAA,CAAAK,aAAA,uBAAAC,CAAA,GAAAN,CAAA,CAAAO,WAAA,8BAAAC,OAAAjB,CAAA,EAAAD,CAAA,EAAAE,CAA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 declare const formatAccountNumber: (accountNumber: string, separator?: string) => string;
3
+ declare const getCurrencySymbol: (currency: string, showCurrency?: boolean) => string;
4
+ declare const formatNumber: (options: FormatOptions) => string;
5
+ declare const parseFormatNumber: (lang: string, value: string) => number | null;
6
+ export { formatAccountNumber, formatNumber, getCurrencySymbol, parseFormatNumber, };
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.parseFormatNumber = exports.getCurrencySymbol = exports.formatNumber = exports.formatAccountNumber = void 0;
7
+ var _intlNumberformat = require("@formatjs/intl-numberformat");
8
+ var _CurrencySymbolEnum = require("../enums/CurrencySymbolEnum");
9
+ var _NumberParser = require("./NumberParser");
10
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
15
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
+ var formatAccountNumber = exports.formatAccountNumber = function formatAccountNumber(accountNumber) {
17
+ var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
18
+ return accountNumber === null || accountNumber === void 0 ? void 0 : accountNumber.replace(/\s?/g, '').replace(/(\d{4})/g, "$1".concat(separator)).trim();
19
+ };
20
+ var getCurrencySymbol = exports.getCurrencySymbol = function getCurrencySymbol(currency) {
21
+ var showCurrency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
22
+ var symbol;
23
+ switch (currency) {
24
+ case 'TWD':
25
+ symbol = _CurrencySymbolEnum.CurrencySymbolEnum.TWD;
26
+ break;
27
+ case 'USD':
28
+ symbol = _CurrencySymbolEnum.CurrencySymbolEnum.USD;
29
+ break;
30
+ case 'VND':
31
+ symbol = _CurrencySymbolEnum.CurrencySymbolEnum.VND;
32
+ break;
33
+ default:
34
+ symbol = '';
35
+ }
36
+ if (!showCurrency) {
37
+ symbol = '';
38
+ }
39
+ return symbol;
40
+ };
41
+ var formatNumber = exports.formatNumber = function formatNumber(options) {
42
+ var _options$value, _options$styleCurrenc, _options$currencyDisp, _options$showValue, _options$showCurrency, _options$minimumFract, _options$maximumFract, _options$trailingZero;
43
+ options.value = (_options$value = options.value) !== null && _options$value !== void 0 ? _options$value : 0;
44
+ options.styleCurrency = (_options$styleCurrenc = options.styleCurrency) !== null && _options$styleCurrenc !== void 0 ? _options$styleCurrenc : 'currency';
45
+ options.currencyDisplay = (_options$currencyDisp = options.currencyDisplay) !== null && _options$currencyDisp !== void 0 ? _options$currencyDisp : 'code';
46
+ options.showValue = (_options$showValue = options.showValue) !== null && _options$showValue !== void 0 ? _options$showValue : true;
47
+ options.showCurrency = (_options$showCurrency = options.showCurrency) !== null && _options$showCurrency !== void 0 ? _options$showCurrency : true;
48
+ options.minimumFractionDigits = (_options$minimumFract = options.minimumFractionDigits) !== null && _options$minimumFract !== void 0 ? _options$minimumFract : 0;
49
+ options.maximumFractionDigits = (_options$maximumFract = options.maximumFractionDigits) !== null && _options$maximumFract !== void 0 ? _options$maximumFract : 0;
50
+ options.trailingZeroDisplay = (_options$trailingZero = options.trailingZeroDisplay) !== null && _options$trailingZero !== void 0 ? _options$trailingZero : 'stripIfInteger';
51
+
52
+ // console.log(`options: ${JSON.stringify(options)}.`);
53
+
54
+ var formatOptions = {
55
+ style: options.styleCurrency,
56
+ currency: options.currency,
57
+ currencyDisplay: options.currencyDisplay,
58
+ minimumFractionDigits: options.minimumFractionDigits,
59
+ maximumFractionDigits: options.maximumFractionDigits,
60
+ trailingZeroDisplay: options.trailingZeroDisplay
61
+ };
62
+ if (options.options) {
63
+ formatOptions = _objectSpread(_objectSpread({}, formatOptions), options.options);
64
+ }
65
+ var localizedNumber = (0, _intlNumberformat.NumberFormat)(options.lang, formatOptions).format(options.value).replace(/^([\d,.]+)(\s*)([A-Z]{3})$/, '$3$2$1').replace(/([\d,.]+)$/, options.showValue ? ' $1' : ' ********').replace(options.currency, getCurrencySymbol(options.currency, options.showCurrency)).trim();
66
+
67
+ // console.log(`localizedNumber: ${localizedNumber}.`);
68
+
69
+ return localizedNumber;
70
+ };
71
+ var parseFormatNumber = exports.parseFormatNumber = function parseFormatNumber(lang, value) {
72
+ if (!value) {
73
+ return null;
74
+ }
75
+ return new _NumberParser.NumberParser(lang).parse(value);
76
+ };
77
+ //# sourceMappingURL=NumberFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberFormat.js","names":["_intlNumberformat","require","_CurrencySymbolEnum","_NumberParser","_typeof","o","Symbol","iterator","constructor","prototype","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","toPrimitive","call","TypeError","String","Number","formatAccountNumber","exports","accountNumber","separator","undefined","replace","concat","trim","getCurrencySymbol","currency","showCurrency","symbol","CurrencySymbolEnum","TWD","USD","VND","formatNumber","options","_options$value","_options$styleCurrenc","_options$currencyDisp","_options$showValue","_options$showCurrency","_options$minimumFract","_options$maximumFract","_options$trailingZero","styleCurrency","currencyDisplay","showValue","minimumFractionDigits","maximumFractionDigits","trailingZeroDisplay","formatOptions","style","localizedNumber","NumberFormat","lang","format","parseFormatNumber","NumberParser","parse"],"sources":["../../src/Format/NumberFormat.ts"],"sourcesContent":["import { NumberFormat } from '@formatjs/intl-numberformat';\nimport { CurrencySymbolEnum } from '../enums/CurrencySymbolEnum';\nimport { FormatOptions } from '../interfaces/Format/FormatOptions';\nimport { NumberParser } from './NumberParser';\n\nconst formatAccountNumber = (\n accountNumber: string,\n separator: string = ' ',\n) => {\n return accountNumber\n ?.replace(/\\s?/g, '')\n .replace(/(\\d{4})/g, `$1${separator}`)\n .trim();\n};\n\nconst getCurrencySymbol = (currency: string, showCurrency: boolean = true) => {\n let symbol;\n\n switch (currency) {\n case 'TWD':\n symbol = CurrencySymbolEnum.TWD;\n break;\n case 'USD':\n symbol = CurrencySymbolEnum.USD;\n break;\n case 'VND':\n symbol = CurrencySymbolEnum.VND;\n break;\n default:\n symbol = '';\n }\n\n if (!showCurrency) {\n symbol = '';\n }\n\n return symbol;\n};\n\nconst formatNumber = (options: FormatOptions) => {\n options.value = options.value ?? 0;\n options.styleCurrency = options.styleCurrency ?? 'currency';\n options.currencyDisplay = options.currencyDisplay ?? 'code';\n options.showValue = options.showValue ?? true;\n options.showCurrency = options.showCurrency ?? true;\n options.minimumFractionDigits = options.minimumFractionDigits ?? 0;\n options.maximumFractionDigits = options.maximumFractionDigits ?? 0;\n options.trailingZeroDisplay = options.trailingZeroDisplay ?? 'stripIfInteger';\n\n // console.log(`options: ${JSON.stringify(options)}.`);\n\n let formatOptions = {\n style: options.styleCurrency,\n currency: options.currency,\n currencyDisplay: options.currencyDisplay,\n minimumFractionDigits: options.minimumFractionDigits,\n maximumFractionDigits: options.maximumFractionDigits,\n trailingZeroDisplay: options.trailingZeroDisplay,\n };\n\n if (options.options) {\n formatOptions = {\n ...formatOptions,\n ...options.options,\n };\n }\n\n let localizedNumber = NumberFormat(options.lang, formatOptions)\n .format(options.value)\n .replace(/^([\\d,.]+)(\\s*)([A-Z]{3})$/, '$3$2$1')\n .replace(/([\\d,.]+)$/, options.showValue ? ' $1' : ' ********')\n .replace(\n options.currency,\n getCurrencySymbol(options.currency, options.showCurrency),\n )\n .trim();\n\n // console.log(`localizedNumber: ${localizedNumber}.`);\n\n return localizedNumber;\n};\n\nconst parseFormatNumber = (lang: string, value: string) => {\n if (!value) {\n return null;\n }\n\n return new NumberParser(lang).parse(value);\n};\n\nexport {\n formatAccountNumber,\n formatNumber,\n getCurrencySymbol,\n parseFormatNumber,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AAA8C,SAAAG,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,CAAA,WAAAA,CAAA,yBAAAC,MAAA,IAAAD,CAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,CAAA,KAAAC,MAAA,CAAAG,SAAA,qBAAAJ,CAAA,KAAAD,OAAA,CAAAC,CAAA;AAAA,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAX,CAAA,GAAAS,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAP,CAAA,GAAA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BkB,eAAe,EAAEV,OAAO,CAACU,eAAe;IACxCE,qBAAqB,EAAEZ,OAAO,CAACY,qBAAqB;IACpDC,qBAAqB,EAAEb,OAAO,CAACa,qBAAqB;IACpDC,mBAAmB,EAAEd,OAAO,CAACc;EAC/B,CAAC;EAED,IAAId,OAAO,CAACA,OAAO,EAAE;IACnBe,aAAa,GAAAnD,aAAA,CAAAA,aAAA,KACRmD,aAAa,GACbf,OAAO,CAACA,OAAO,CACnB;EACH;EAEA,IAAIiB,eAAe,GAAG,IAAAC,8BAAY,EAAClB,OAAO,CAACmB,IAAI,EAAEJ,aAAa,CAAC,CAC5DK,MAAM,CAACpB,OAAO,CAAC3B,KAAK,CAAC,CACrBe,OAAO,CAAC,4BAA4B,EAAE,QAAQ,CAAC,CAC/CA,OAAO,CAAC,YAAY,EAAEY,OAAO,CAACW,SAAS,GAAG,KAAK,GAAG,WAAW,CAAC,CAC9DvB,OAAO,CACNY,OAAO,CAACR,QAAQ,EAChBD,iBAAiB,CAACS,OAAO,CAACR,QAAQ,EAAEQ,OAAO,CAACP,YAAY,CAC1D,CAAC,CACAH,IAAI,CAAC,CAAC;;EAET;;EAEA,OAAO2B,eAAe;AACxB,CAAC;AAED,IAAMI,iBAAiB,GAAArC,OAAA,CAAAqC,iBAAA,GAAG,SAApBA,iBAAiBA,CAAIF,IAAY,EAAE9C,KAAa,EAAK;EACzD,IAAI,CAACA,KAAK,EAAE;IACV,OAAO,IAAI;EACb;EAEA,OAAO,IAAIiD,0BAAY,CAACH,IAAI,CAAC,CAACI,KAAK,CAAClD,KAAK,CAAC;AAC5C,CAAC","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ declare class NumberParser {
2
+ private _group;
3
+ private _decimal;
4
+ private _numeral;
5
+ private _index;
6
+ constructor(locale: string);
7
+ parse(value: string): number;
8
+ }
9
+ export { NumberParser };
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NumberParser = void 0;
7
+ var _intlNumberformat = require("@formatjs/intl-numberformat");
8
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
9
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
10
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
13
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
14
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
16
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
17
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ var NumberParser = exports.NumberParser = /*#__PURE__*/function () {
21
+ function NumberParser(locale) {
22
+ var _parts$find, _parts$find2;
23
+ _classCallCheck(this, NumberParser);
24
+ var parts = new _intlNumberformat.NumberFormat(locale).formatToParts(12345.6);
25
+ var numerals = _toConsumableArray(new _intlNumberformat.NumberFormat(locale, {
26
+ useGrouping: false
27
+ }).format(9876543210)).reverse();
28
+ var index = new Map(numerals.map(function (d, i) {
29
+ return [d, i];
30
+ }));
31
+ this._group = new RegExp("[".concat((_parts$find = parts.find(function (d) {
32
+ return d.type === 'group';
33
+ })) === null || _parts$find === void 0 ? void 0 : _parts$find.value, "]"), 'g');
34
+ this._decimal = new RegExp("[".concat((_parts$find2 = parts.find(function (d) {
35
+ return d.type === 'decimal';
36
+ })) === null || _parts$find2 === void 0 ? void 0 : _parts$find2.value, "]"));
37
+ this._numeral = new RegExp("[".concat(numerals.join(''), "]"), 'g');
38
+ this._index = function (d) {
39
+ return index.get(d);
40
+ };
41
+ }
42
+ return _createClass(NumberParser, [{
43
+ key: "parse",
44
+ value: function parse(value) {
45
+ var _value;
46
+ value = (_value = value) === null || _value === void 0 || (_value = _value.trim()) === null || _value === void 0 || (_value = _value.replace(this._group, '')) === null || _value === void 0 || (_value = _value.replace(this._decimal, '.')) === null || _value === void 0 ? void 0 : _value.replace(this._numeral, this._index);
47
+ return value ? +value : NaN;
48
+ }
49
+ }]);
50
+ }();
51
+ //# sourceMappingURL=NumberParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberParser.js","names":["_intlNumberformat","require","_typeof","o","Symbol","iterator","constructor","prototype","_toConsumableArray","r","_arrayWithoutHoles","_iterableToArray","_unsupportedIterableToArray","_nonIterableSpread","TypeError","a","_arrayLikeToArray","t","toString","call","slice","name","Array","from","test","isArray","length","e","n","_classCallCheck","_defineProperties","enumerable","configurable","writable","Object","defineProperty","_toPropertyKey","key","_createClass","i","_toPrimitive","toPrimitive","String","Number","NumberParser","exports","locale","_parts$find","_parts$find2","parts","NumberFormat","formatToParts","numerals","useGrouping","format","reverse","index","Map","map","d","_group","RegExp","concat","find","type","value","_decimal","_numeral","join","_index","get","parse","_value","trim","replace","NaN"],"sources":["../../src/Format/NumberParser.ts"],"sourcesContent":["import { NumberFormat } from '@formatjs/intl-numberformat';\n\nclass NumberParser {\n private _group: RegExp;\n private _decimal: RegExp;\n private _numeral: RegExp;\n private _index: (d: any) => any;\n\n constructor(locale: string) {\n const parts = new NumberFormat(locale).formatToParts(12345.6);\n\n const numerals = [\n ...new NumberFormat(locale, { useGrouping: false }).format(9876543210),\n ].reverse();\n\n const index = new Map(numerals.map((d, i) => [d, i]));\n\n this._group = new RegExp(\n `[${parts.find((d) => d.type === 'group')?.value}]`,\n 'g',\n );\n\n this._decimal = new RegExp(\n `[${parts.find((d) => d.type === 'decimal')?.value}]`,\n );\n\n this._numeral = new RegExp(`[${numerals.join('')}]`, 'g');\n this._index = (d) => index.get(d);\n }\n\n parse(value: string) {\n value = value\n ?.trim()\n ?.replace(this._group, '')\n ?.replace(this._decimal, '.')\n ?.replace(this._numeral, this._index);\n\n return value ? +value : NaN;\n }\n}\n\nexport { NumberParser };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAA2D,SAAAC,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,CAAA,WAAAA,CAAA,yBAAAC,MAAA,IAAAD,CAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,CAAA,KAAAC,MAAA,CAAAG,SAAA,qBAAAJ,CAAA,KAAAD,OAAA,CAAAC,CAAA;AAAA,S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