ag-common 0.0.894 → 0.0.896

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.
Files changed (236) hide show
  1. package/LICENSE.md +2 -3
  2. package/README.md +2 -2
  3. package/dist/api/helpers/acm.d.ts +1 -1
  4. package/dist/api/helpers/acm.js +3 -3
  5. package/dist/api/helpers/api.d.ts +2 -2
  6. package/dist/api/helpers/api.js +26 -22
  7. package/dist/api/helpers/apigw.js +4 -4
  8. package/dist/api/helpers/aws.js +2 -2
  9. package/dist/api/helpers/cosmos/delete.d.ts +1 -1
  10. package/dist/api/helpers/cosmos/delete.js +15 -16
  11. package/dist/api/helpers/cosmos/get.d.ts +3 -3
  12. package/dist/api/helpers/cosmos/get.js +26 -32
  13. package/dist/api/helpers/cosmos/index.d.ts +3 -3
  14. package/dist/api/helpers/cosmos/index.js +1 -1
  15. package/dist/api/helpers/cosmos/utils.d.ts +1 -1
  16. package/dist/api/helpers/cosmos/utils.js +3 -7
  17. package/dist/api/helpers/cosmos/write.d.ts +1 -1
  18. package/dist/api/helpers/cosmos/write.js +11 -12
  19. package/dist/api/helpers/dynamo/delete.d.ts +1 -1
  20. package/dist/api/helpers/dynamo/delete.js +3 -3
  21. package/dist/api/helpers/dynamo/get.d.ts +2 -2
  22. package/dist/api/helpers/dynamo/get.js +20 -14
  23. package/dist/api/helpers/dynamo/index.d.ts +10 -38
  24. package/dist/api/helpers/dynamo/index.js +4 -4
  25. package/dist/api/helpers/dynamo/set.d.ts +1 -1
  26. package/dist/api/helpers/dynamo/set.js +10 -10
  27. package/dist/api/helpers/dynamo/types.d.ts +3 -3
  28. package/dist/api/helpers/dynamo/types.js +1 -1
  29. package/dist/api/helpers/enforceDynamoProvisionCap.d.ts +13 -1
  30. package/dist/api/helpers/enforceDynamoProvisionCap.js +3 -4
  31. package/dist/api/helpers/google/apikey.js +1 -1
  32. package/dist/api/helpers/google/gemini.d.ts +1 -1
  33. package/dist/api/helpers/google/gemini.js +43 -45
  34. package/dist/api/helpers/google/index.d.ts +2 -2
  35. package/dist/api/helpers/index.d.ts +17 -17
  36. package/dist/api/helpers/retryOnError.js +6 -11
  37. package/dist/api/helpers/s3.d.ts +9 -9
  38. package/dist/api/helpers/s3.js +19 -16
  39. package/dist/api/helpers/ses.d.ts +1 -1
  40. package/dist/api/helpers/ses.js +9 -9
  41. package/dist/api/helpers/sqs.d.ts +1 -1
  42. package/dist/api/helpers/sqs.js +1 -1
  43. package/dist/api/helpers/ssm.d.ts +1 -1
  44. package/dist/api/helpers/ssm.js +2 -2
  45. package/dist/api/helpers/ssmInfra/apigw.d.ts +6 -6
  46. package/dist/api/helpers/ssmInfra/apigw.js +6 -10
  47. package/dist/api/helpers/ssmInfra/dynamo.d.ts +2 -2
  48. package/dist/api/helpers/ssmInfra/dynamo.js +1 -1
  49. package/dist/api/helpers/ssmInfra/index.d.ts +4 -4
  50. package/dist/api/helpers/ssmInfra/s3.d.ts +3 -3
  51. package/dist/api/helpers/ssmInfra/s3.js +1 -1
  52. package/dist/api/helpers/ssmInfra/sqs.d.ts +3 -3
  53. package/dist/api/helpers/ssmInfra/sqs.js +1 -1
  54. package/dist/api/helpers/sts.d.ts +1 -1
  55. package/dist/api/helpers/sts.js +4 -4
  56. package/dist/api/helpers/validations.d.ts +2 -2
  57. package/dist/api/helpers/validations.js +14 -14
  58. package/dist/api/helpers/zod.d.ts +1 -1
  59. package/dist/api/helpers/zod.js +21 -27
  60. package/dist/api/index.d.ts +2 -2
  61. package/dist/api/types/aws.d.ts +0 -56
  62. package/dist/api/types/aws.js +0 -1
  63. package/dist/api/types/index.d.ts +1 -1
  64. package/dist/common/helpers/array.js +9 -10
  65. package/dist/common/helpers/async.js +2 -2
  66. package/dist/common/helpers/binary.d.ts +1 -1
  67. package/dist/common/helpers/binary.js +1 -1
  68. package/dist/common/helpers/csv.d.ts +4 -2
  69. package/dist/common/helpers/csv.js +8 -12
  70. package/dist/common/helpers/date.d.ts +2 -4
  71. package/dist/common/helpers/date.js +2 -2
  72. package/dist/common/helpers/email.js +2 -2
  73. package/dist/common/helpers/fetch.js +8 -8
  74. package/dist/common/helpers/generator.js +2 -2
  75. package/dist/common/helpers/groupBy.js +0 -2
  76. package/dist/common/helpers/hashCode.js +2 -6
  77. package/dist/common/helpers/headers.d.ts +20 -20
  78. package/dist/common/helpers/headers.js +38 -38
  79. package/dist/common/helpers/i18n.d.ts +2 -2
  80. package/dist/common/helpers/i18n.js +5 -6
  81. package/dist/common/helpers/index.d.ts +25 -25
  82. package/dist/common/helpers/log.d.ts +1 -1
  83. package/dist/common/helpers/log.js +30 -30
  84. package/dist/common/helpers/math.d.ts +2 -2
  85. package/dist/common/helpers/math.js +6 -6
  86. package/dist/common/helpers/memo.d.ts +1 -1
  87. package/dist/common/helpers/memo.js +1 -3
  88. package/dist/common/helpers/node-cache.d.ts +2 -2
  89. package/dist/common/helpers/node-cache.js +0 -1
  90. package/dist/common/helpers/object.d.ts +1 -1
  91. package/dist/common/helpers/object.js +16 -27
  92. package/dist/common/helpers/secondsInNearest.js +5 -5
  93. package/dist/common/helpers/stream.js +4 -6
  94. package/dist/common/helpers/string/base64.js +2 -2
  95. package/dist/common/helpers/string/chunk.js +1 -1
  96. package/dist/common/helpers/string/contains.js +1 -3
  97. package/dist/common/helpers/string/getExtendedStringSegment.js +1 -1
  98. package/dist/common/helpers/string/index.d.ts +11 -11
  99. package/dist/common/helpers/string/json.js +1 -1
  100. package/dist/common/helpers/string/redact.js +38 -39
  101. package/dist/common/helpers/string/trim.js +4 -4
  102. package/dist/common/helpers/string/truncate.js +1 -1
  103. package/dist/common/helpers/string/url.js +7 -8
  104. package/dist/common/helpers/withRetry.js +7 -7
  105. package/dist/common/helpers/xml.d.ts +7 -3
  106. package/dist/common/helpers/xml.js +33 -36
  107. package/dist/common/index.d.ts +2 -2
  108. package/dist/index.d.ts +3 -3
  109. package/dist/node/helpers/fetch.js +1 -2
  110. package/dist/node/helpers/fs.js +2 -2
  111. package/dist/node/helpers/index.d.ts +2 -2
  112. package/dist/node/index.d.ts +1 -1
  113. package/dist/ui/components/DarkMode/Base.d.ts +4 -4
  114. package/dist/ui/components/DarkMode/Base.js +26 -31
  115. package/dist/ui/components/DarkMode/index.d.ts +2 -2
  116. package/dist/ui/components/DarkMode/types.d.ts +5 -5
  117. package/dist/ui/components/HeadersRaw/index.d.ts +2 -2
  118. package/dist/ui/components/HeadersRaw/index.js +5 -5
  119. package/dist/ui/components/Markdown/index.d.ts +1 -1
  120. package/dist/ui/components/Markdown/index.js +10 -10
  121. package/dist/ui/components/index.d.ts +4 -4
  122. package/dist/ui/components/shadcn/accordion.d.ts +4 -4
  123. package/dist/ui/components/shadcn/accordion.js +6 -6
  124. package/dist/ui/components/shadcn/alert.d.ts +2 -2
  125. package/dist/ui/components/shadcn/alert.js +6 -6
  126. package/dist/ui/components/shadcn/avatar.d.ts +2 -2
  127. package/dist/ui/components/shadcn/avatar.js +4 -4
  128. package/dist/ui/components/shadcn/button.d.ts +4 -4
  129. package/dist/ui/components/shadcn/button.js +14 -14
  130. package/dist/ui/components/shadcn/card.d.ts +2 -2
  131. package/dist/ui/components/shadcn/card.js +6 -6
  132. package/dist/ui/components/shadcn/checkbox.d.ts +2 -2
  133. package/dist/ui/components/shadcn/checkbox.js +3 -3
  134. package/dist/ui/components/shadcn/dialog.d.ts +10 -10
  135. package/dist/ui/components/shadcn/dialog.js +9 -11
  136. package/dist/ui/components/shadcn/divider.d.ts +1 -1
  137. package/dist/ui/components/shadcn/divider.js +1 -1
  138. package/dist/ui/components/shadcn/dropdown-list.d.ts +1 -1
  139. package/dist/ui/components/shadcn/dropdown-list.js +5 -5
  140. package/dist/ui/components/shadcn/dropdown-menu.d.ts +6 -6
  141. package/dist/ui/components/shadcn/dropdown-menu.js +11 -11
  142. package/dist/ui/components/shadcn/index.d.ts +21 -21
  143. package/dist/ui/components/shadcn/input-selector.d.ts +1 -1
  144. package/dist/ui/components/shadcn/input-selector.js +10 -12
  145. package/dist/ui/components/shadcn/input.d.ts +1 -1
  146. package/dist/ui/components/shadcn/input.js +1 -1
  147. package/dist/ui/components/shadcn/label.d.ts +3 -3
  148. package/dist/ui/components/shadcn/label.js +2 -2
  149. package/dist/ui/components/shadcn/popover.d.ts +2 -2
  150. package/dist/ui/components/shadcn/popover.js +3 -3
  151. package/dist/ui/components/shadcn/radio-group.d.ts +2 -2
  152. package/dist/ui/components/shadcn/radio-group.js +2 -2
  153. package/dist/ui/components/shadcn/scroll-area.d.ts +2 -2
  154. package/dist/ui/components/shadcn/scroll-area.js +3 -5
  155. package/dist/ui/components/shadcn/select.d.ts +2 -2
  156. package/dist/ui/components/shadcn/select.js +12 -12
  157. package/dist/ui/components/shadcn/sheet.d.ts +12 -12
  158. package/dist/ui/components/shadcn/sheet.js +15 -15
  159. package/dist/ui/components/shadcn/switch.d.ts +2 -2
  160. package/dist/ui/components/shadcn/switch.js +3 -3
  161. package/dist/ui/components/shadcn/textarea.d.ts +1 -1
  162. package/dist/ui/components/shadcn/textarea.js +1 -1
  163. package/dist/ui/components/shadcn/toast.d.ts +2 -2
  164. package/dist/ui/components/shadcn/toast.js +25 -25
  165. package/dist/ui/helpers/cognito.d.ts +1 -1
  166. package/dist/ui/helpers/cookie/const.js +1 -1
  167. package/dist/ui/helpers/cookie/get.js +3 -4
  168. package/dist/ui/helpers/cookie/index.d.ts +5 -5
  169. package/dist/ui/helpers/cookie/raw.d.ts +1 -1
  170. package/dist/ui/helpers/cookie/raw.js +8 -9
  171. package/dist/ui/helpers/cookie/use.d.ts +1 -1
  172. package/dist/ui/helpers/cookie/use.js +4 -4
  173. package/dist/ui/helpers/date.js +8 -8
  174. package/dist/ui/helpers/debounce.js +1 -1
  175. package/dist/ui/helpers/dom.d.ts +1 -1
  176. package/dist/ui/helpers/dom.js +4 -14
  177. package/dist/ui/helpers/index.d.ts +26 -26
  178. package/dist/ui/helpers/jwt.d.ts +3 -3
  179. package/dist/ui/helpers/openDialog.d.ts +2 -2
  180. package/dist/ui/helpers/openDialog.js +8 -8
  181. package/dist/ui/helpers/plural.js +1 -1
  182. package/dist/ui/helpers/routes.d.ts +2 -2
  183. package/dist/ui/helpers/routes.js +14 -15
  184. package/dist/ui/helpers/serviceWorker.js +1 -1
  185. package/dist/ui/helpers/useContextMenu.d.ts +1 -1
  186. package/dist/ui/helpers/useContextMenu.js +9 -10
  187. package/dist/ui/helpers/useElementAttribute.js +3 -5
  188. package/dist/ui/helpers/useGranularHook.d.ts +1 -1
  189. package/dist/ui/helpers/useGranularHook.js +2 -3
  190. package/dist/ui/helpers/useInterval.d.ts +2 -2
  191. package/dist/ui/helpers/useInterval.js +2 -2
  192. package/dist/ui/helpers/useIsInViewport.d.ts +1 -1
  193. package/dist/ui/helpers/useIsInViewport.js +0 -1
  194. package/dist/ui/helpers/useLocalStorage.js +6 -6
  195. package/dist/ui/helpers/useLockBodyScroll.js +2 -2
  196. package/dist/ui/helpers/useOnClickOutside.d.ts +1 -1
  197. package/dist/ui/helpers/useOnClickOutside.js +3 -6
  198. package/dist/ui/helpers/useOnScroll.d.ts +1 -1
  199. package/dist/ui/helpers/useOnScroll.js +3 -4
  200. package/dist/ui/helpers/useOverloadPageSearch.js +8 -10
  201. package/dist/ui/helpers/useQueryString.js +7 -7
  202. package/dist/ui/helpers/useResize.js +5 -6
  203. package/dist/ui/helpers/useTimeout.js +1 -1
  204. package/dist/ui/helpers/useTooltip.d.ts +2 -2
  205. package/dist/ui/helpers/useTooltip.js +5 -7
  206. package/dist/ui/helpers/utils.d.ts +2 -2
  207. package/dist/ui/icons/Checkmark.d.ts +2 -2
  208. package/dist/ui/icons/Checkmark.js +1 -1
  209. package/dist/ui/icons/ChevronRight.d.ts +1 -1
  210. package/dist/ui/icons/Circle.d.ts +2 -2
  211. package/dist/ui/icons/Circle.js +1 -1
  212. package/dist/ui/icons/CircleDot.d.ts +2 -2
  213. package/dist/ui/icons/Cog.d.ts +2 -2
  214. package/dist/ui/icons/Computer.d.ts +2 -2
  215. package/dist/ui/icons/Door.d.ts +1 -1
  216. package/dist/ui/icons/Hamburger.d.ts +1 -1
  217. package/dist/ui/icons/HorizontalDots.d.ts +1 -1
  218. package/dist/ui/icons/House.d.ts +2 -2
  219. package/dist/ui/icons/Magnify.d.ts +2 -2
  220. package/dist/ui/icons/Magnify.js +1 -1
  221. package/dist/ui/icons/Moon.d.ts +2 -2
  222. package/dist/ui/icons/Pencil.d.ts +1 -1
  223. package/dist/ui/icons/Save.d.ts +1 -1
  224. package/dist/ui/icons/Sun.d.ts +1 -1
  225. package/dist/ui/icons/Sun.js +1 -1
  226. package/dist/ui/icons/Undo.d.ts +1 -1
  227. package/dist/ui/icons/UserOutline.d.ts +1 -1
  228. package/dist/ui/icons/Warning.d.ts +2 -2
  229. package/dist/ui/icons/Warning.js +1 -1
  230. package/dist/ui/icons/index.d.ts +32 -74
  231. package/dist/ui/index.d.ts +3 -3
  232. package/dist/ui/styles/colours.js +29 -29
  233. package/dist/ui/styles/common.d.ts +1 -1
  234. package/dist/ui/styles/common.js +10 -10
  235. package/dist/ui/styles/index.d.ts +3 -3
  236. package/package.json +65 -75
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useTranslation = exports.t = exports.getValidatedLang = exports.AllLang = void 0;
4
- exports.AllLang = ['en', 'id', 'vi', 'pt'];
4
+ exports.AllLang = ["en", "id", "vi", "pt"];
5
5
  const getValidatedLang = (raw) => {
6
6
  const f = exports.AllLang.find((l) => l === raw);
7
7
  if (!f) {
8
- return 'en';
8
+ return "en";
9
9
  }
10
10
  return f;
11
11
  };
12
12
  exports.getValidatedLang = getValidatedLang;
13
13
  const t = (res, lang) => {
14
14
  if (res[lang] === null) {
15
- return '';
15
+ return "";
16
16
  }
17
17
  return res[lang] ?? res.en;
18
18
  };
@@ -21,10 +21,9 @@ const useTranslation = (texts, lang) => {
21
21
  const ret = (lineText) => {
22
22
  const v1 = texts[lineText][lang];
23
23
  if (v1 || v1 === null) {
24
- return v1 ?? '';
24
+ return v1 ?? "";
25
25
  }
26
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
27
- return texts[lineText].en ?? '???';
26
+ return texts[lineText].en ?? "???";
28
27
  };
29
28
  return ret;
30
29
  };
@@ -1,25 +1,25 @@
1
- export * from './array';
2
- export * from './async';
3
- export * from './binary';
4
- export * from './csv';
5
- export * from './date';
6
- export * from './email';
7
- export * from './fetch';
8
- export * from './func';
9
- export * from './generator';
10
- export * from './groupBy';
11
- export * from './hashCode';
12
- export * from './headers';
13
- export * from './i18n';
14
- export * from './log';
15
- export * from './math';
16
- export * from './memo';
17
- export * from './node-cache';
18
- export * from './object';
19
- export * from './random';
20
- export * from './secondsInNearest';
21
- export * from './sleep';
22
- export * from './stream';
23
- export * from './string';
24
- export * from './withRetry';
25
- export * from './xml';
1
+ export * from "./array";
2
+ export * from "./async";
3
+ export * from "./binary";
4
+ export * from "./csv";
5
+ export * from "./date";
6
+ export * from "./email";
7
+ export * from "./fetch";
8
+ export * from "./func";
9
+ export * from "./generator";
10
+ export * from "./groupBy";
11
+ export * from "./hashCode";
12
+ export * from "./headers";
13
+ export * from "./i18n";
14
+ export * from "./log";
15
+ export * from "./math";
16
+ export * from "./memo";
17
+ export * from "./node-cache";
18
+ export * from "./object";
19
+ export * from "./random";
20
+ export * from "./secondsInNearest";
21
+ export * from "./sleep";
22
+ export * from "./stream";
23
+ export * from "./string";
24
+ export * from "./withRetry";
25
+ export * from "./xml";
@@ -1,4 +1,4 @@
1
- export type TLogType = 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'FATAL';
1
+ export type TLogType = "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL";
2
2
  export declare const GetLogLevel: (l: TLogType) => number;
3
3
  export type TLogShim = (...args: unknown[]) => void;
4
4
  /** if passed in, will use this instead of console.xxx */
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
- /* eslint-disable no-console */
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.fatal = exports.error = exports.trace = exports.warn = exports.info = exports.debug = exports.SetLogLevel = exports.SetLogShim = exports.GetLogLevel = void 0;
5
4
  const array_1 = require("./array");
6
5
  const redact_1 = require("./string/redact");
7
- const GetLogLevel = (l) => ['TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'].findIndex((s) => s === l);
6
+ const GetLogLevel = (l) => ["TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"].findIndex((s) => s === l);
8
7
  exports.GetLogLevel = GetLogLevel;
9
8
  let logShim;
9
+ // oxlint-disable-next-line no-console -- console is the intentional fallback when no shim is set
10
+ const fallbackConsole = console;
10
11
  /** if passed in, will use this instead of console.xxx */
11
12
  const SetLogShim = (ls) => {
12
13
  logShim = ls;
@@ -14,7 +15,7 @@ const SetLogShim = (ls) => {
14
15
  exports.SetLogShim = SetLogShim;
15
16
  let userLogLevel;
16
17
  const SetLogLevel = (l) => {
17
- const lu = (l ?? 'INFO').toUpperCase();
18
+ const lu = (l ?? "INFO").toUpperCase();
18
19
  if ((0, exports.GetLogLevel)(lu) === -1) {
19
20
  return;
20
21
  }
@@ -25,14 +26,14 @@ function logprocess(type, args) {
25
26
  if (!userLogLevel) {
26
27
  (0, exports.SetLogLevel)(process.env.LOG_LEVEL);
27
28
  }
28
- const min = (0, exports.GetLogLevel)(userLogLevel ?? 'WARN');
29
+ const min = (0, exports.GetLogLevel)(userLogLevel ?? "WARN");
29
30
  const typesLogLevel = (0, exports.GetLogLevel)(type);
30
31
  // env ignores it
31
32
  if (typesLogLevel < min) {
32
33
  return;
33
34
  }
34
35
  ////////
35
- const datetime = new Date().toLocaleTimeString('en-GB');
36
+ const datetime = new Date().toLocaleTimeString("en-GB");
36
37
  const log = [
37
38
  `[${datetime}]`,
38
39
  type,
@@ -53,32 +54,32 @@ function logprocess(type, args) {
53
54
  return;
54
55
  }
55
56
  switch (type) {
56
- case 'TRACE': {
57
- console.trace(...log);
57
+ case "TRACE": {
58
+ fallbackConsole.trace(...log);
58
59
  break;
59
60
  }
60
- case 'DEBUG': {
61
- console.debug(...log);
61
+ case "DEBUG": {
62
+ fallbackConsole.debug(...log);
62
63
  break;
63
64
  }
64
- case 'INFO': {
65
- console.log(...log);
65
+ case "INFO": {
66
+ fallbackConsole.log(...log);
66
67
  break;
67
68
  }
68
- case 'WARN': {
69
- console.warn(...log);
69
+ case "WARN": {
70
+ fallbackConsole.warn(...log);
70
71
  break;
71
72
  }
72
- case 'ERROR': {
73
- console.error(...log);
73
+ case "ERROR": {
74
+ fallbackConsole.error(...log);
74
75
  break;
75
76
  }
76
- case 'FATAL': {
77
- console.error(...log);
77
+ case "FATAL": {
78
+ fallbackConsole.error(...log);
78
79
  break;
79
80
  }
80
81
  default: {
81
- console.log(...log);
82
+ fallbackConsole.log(...log);
82
83
  break;
83
84
  }
84
85
  }
@@ -87,13 +88,13 @@ function printStackTrace(...args) {
87
88
  const callstack = [];
88
89
  let isCallstackPopulated = false;
89
90
  try {
90
- throw new Error('Test');
91
+ throw new Error("Test");
91
92
  }
92
93
  catch (e) {
93
94
  const er = e;
94
95
  if (er.stack) {
95
96
  // Firefox / chrome
96
- const lines = er.stack.split('\n');
97
+ const lines = er.stack.split("\n");
97
98
  for (let i = 0, len = lines.length; i < len; i += 1) {
98
99
  callstack.push(` ${lines[i]} `);
99
100
  }
@@ -104,7 +105,7 @@ function printStackTrace(...args) {
104
105
  }
105
106
  else if (window.opera && er.message) {
106
107
  // Opera
107
- const lines = er.message.split('\n');
108
+ const lines = er.message.split("\n");
108
109
  for (let i = 0, len = lines.length; i < len; i += 1) {
109
110
  if (lines[i].match(/^\s*[A-Za-z0-9\-_$]+\(/)) {
110
111
  let entry = lines[i];
@@ -127,33 +128,32 @@ function printStackTrace(...args) {
127
128
  let currentFunction = args.callee.caller;
128
129
  while (currentFunction) {
129
130
  const fn = currentFunction.toString();
130
- const fname = fn.substring(fn.indexOf('function') + 8, fn.indexOf('(')) ??
131
- 'anonymous';
131
+ const fname = fn.substring(fn.indexOf("function") + 8, fn.indexOf("(")) ?? "anonymous";
132
132
  callstack.push(fname);
133
133
  currentFunction = currentFunction.caller;
134
134
  }
135
135
  }
136
- return callstack.join('\n');
136
+ return callstack.join("\n");
137
137
  }
138
- const debug = (...args) => logprocess('DEBUG', args);
138
+ const debug = (...args) => logprocess("DEBUG", args);
139
139
  exports.debug = debug;
140
- const info = (...args) => logprocess('INFO', args);
140
+ const info = (...args) => logprocess("INFO", args);
141
141
  exports.info = info;
142
- const warn = (...args) => logprocess('WARN', args);
142
+ const warn = (...args) => logprocess("WARN", args);
143
143
  exports.warn = warn;
144
144
  //
145
145
  const trace = (...args) => {
146
146
  args.push(printStackTrace());
147
- logprocess('TRACE', args);
147
+ logprocess("TRACE", args);
148
148
  };
149
149
  exports.trace = trace;
150
150
  const error = (...args) => {
151
151
  args.push(printStackTrace());
152
- logprocess('ERROR', args);
152
+ logprocess("ERROR", args);
153
153
  };
154
154
  exports.error = error;
155
155
  const fatal = (...args) => {
156
156
  args.push(printStackTrace());
157
- logprocess('FATAL', args);
157
+ logprocess("FATAL", args);
158
158
  };
159
159
  exports.fatal = fatal;
@@ -1,7 +1,7 @@
1
1
  export declare const toFixed: (num: number, fixed: number) => number;
2
2
  export declare function roundToHalf(converted: number): number;
3
3
  /** restricts value between two numbers */
4
- export declare function clamp({ value, min, max, }: {
4
+ export declare function clamp({ value, min, max }: {
5
5
  value: number;
6
6
  min: number;
7
7
  max: number;
@@ -15,7 +15,7 @@ export declare function toFixedDown(num: number, scale: number): number;
15
15
  * @param param0
16
16
  * @returns
17
17
  */
18
- export declare function rangePercentage({ value, min, max, }: {
18
+ export declare function rangePercentage({ value, min, max }: {
19
19
  value: number;
20
20
  min: number;
21
21
  max: number;
@@ -27,7 +27,7 @@ function roundToHalf(converted) {
27
27
  return parseInt(converted.toString(), 10) + 0.5;
28
28
  }
29
29
  /** restricts value between two numbers */
30
- function clamp({ value, min, max, }) {
30
+ function clamp({ value, min, max }) {
31
31
  if (value < min) {
32
32
  return min;
33
33
  }
@@ -42,14 +42,14 @@ function sumArray(array) {
42
42
  const isNumber = (num) => !isNaN(Number(num));
43
43
  exports.isNumber = isNumber;
44
44
  function toFixedDown(num, scale) {
45
- if (!`${num}`.includes('e')) {
45
+ if (!`${num}`.includes("e")) {
46
46
  // @ts-ignore
47
47
  return +`${Math.round(`${num}e+${scale}`)}e-${scale}`;
48
48
  }
49
- const arr = `${num}`.split('e');
50
- let sig = '';
49
+ const arr = `${num}`.split("e");
50
+ let sig = "";
51
51
  if (+arr[1] + scale > 0) {
52
- sig = '+';
52
+ sig = "+";
53
53
  }
54
54
  // @ts-ignore
55
55
  return +`${Math.round(`${+arr[0]}e${sig}${+arr[1] + scale}`)}e-${scale}`;
@@ -60,7 +60,7 @@ function toFixedDown(num, scale) {
60
60
  * @param param0
61
61
  * @returns
62
62
  */
63
- function rangePercentage({ value, min, max, }) {
63
+ function rangePercentage({ value, min, max }) {
64
64
  const v = clamp({ value, min, max });
65
65
  const r = (v - min) / (max - min);
66
66
  if (isNaN(r)) {
@@ -1 +1 @@
1
- export declare function memo<T>(func: (...a: any) => T, ...args: any[]): T;
1
+ export declare function memo<T, TArgs extends unknown[]>(func: (...args: TArgs) => T, ...args: TArgs): T;
@@ -2,12 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.memo = memo;
4
4
  const hashCode_1 = require("./hashCode");
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
5
  const memoData = {};
7
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
6
  function memo(func, ...args) {
9
7
  const hc = (0, hashCode_1.hashCode)(JSON.stringify(args));
10
- if (!memoData[hc]) {
8
+ if (!(hc in memoData)) {
11
9
  memoData[hc] = func(...args);
12
10
  }
13
11
  return memoData[hc];
@@ -1,4 +1,4 @@
1
- import NodeCache from 'node-cache';
1
+ import NodeCache from "node-cache";
2
2
  export interface CacheOptions {
3
3
  stdTTL?: number;
4
4
  checkperiod?: number;
@@ -7,7 +7,7 @@ export interface CacheOptions {
7
7
  enableLegacyCallbacks?: boolean;
8
8
  maxKeys?: number;
9
9
  }
10
- export declare class TypedNodeCache<T = any> {
10
+ export declare class TypedNodeCache<T = unknown> {
11
11
  private cache;
12
12
  constructor(options?: CacheOptions);
13
13
  /**
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.TypedNodeCache = void 0;
7
7
  const node_cache_1 = __importDefault(require("node-cache"));
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
8
  class TypedNodeCache {
10
9
  cache;
11
10
  constructor(options = {}) {
@@ -55,7 +55,7 @@ export declare const castObject: <TIn, TOut>(orig: Record<string, TIn>, castF: (
55
55
  */
56
56
  export declare const filterObject: <TA extends Record<string | number, TB>, TB>(orig: TA, filterF: (t: TB) => boolean) => Partial<TA>;
57
57
  /** remove key values from an object where the value is null or undefined or other specific passed in values */
58
- export declare const removeUndefValuesFromObject: <TA>(orig: Record<string, TA>) => Record<string, TA extends null | undefined ? never : TA>;
58
+ export declare const removeUndefValuesFromObject: <TA>(orig: Record<string, TA>) => Record<string, Exclude<TA, null | undefined>>;
59
59
  /** remove key values from an object where the value is null or undefined or other specific passed in values */
60
60
  export declare const removeUndefValuesFromObjectAdditional: <T>(orig: Record<string, T>,
61
61
  /** other than null or undefined */
@@ -11,32 +11,28 @@ const tryJsonParse = (str, defaultValue) => {
11
11
  }
12
12
  try {
13
13
  return JSON.parse(str);
14
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
14
  }
16
- catch (e) {
15
+ catch {
17
16
  return defaultValue;
18
17
  }
19
18
  };
20
19
  exports.tryJsonParse = tryJsonParse;
21
20
  function isJson(str) {
22
21
  try {
23
- JSON.parse(typeof str === 'string' ? str : JSON.stringify(str));
24
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
+ JSON.parse(typeof str === "string" ? str : JSON.stringify(str));
25
23
  }
26
- catch (e) {
24
+ catch {
27
25
  return false;
28
26
  }
29
27
  return true;
30
28
  }
31
29
  const objectKeysToLowerCase = (origObj) => {
32
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
33
30
  if (!origObj || Object.keys(origObj).length === 0) {
34
31
  return {};
35
32
  }
36
33
  return Object.keys(origObj).reduce((newObj, key) => {
37
34
  const val = origObj[key];
38
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
- const newVal = typeof val === 'object'
35
+ const newVal = typeof val === "object"
40
36
  ? (0, exports.objectKeysToLowerCase)(val)
41
37
  : val;
42
38
  newObj[key.toLowerCase()] = newVal;
@@ -47,7 +43,6 @@ exports.objectKeysToLowerCase = objectKeysToLowerCase;
47
43
  const getObjectKeysAsNumber = (o) => Object.keys(o).map((o2) => parseInt(o2, 10));
48
44
  exports.getObjectKeysAsNumber = getObjectKeysAsNumber;
49
45
  function objectToArray(obj) {
50
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
51
46
  if (!obj) {
52
47
  return [];
53
48
  }
@@ -67,23 +62,19 @@ const objectAlphaSort = (object, depthLeft = -1) => {
67
62
  if (depthLeft === 0) {
68
63
  return object;
69
64
  }
70
- if (object !== null && typeof object === 'object') {
71
- return (Object.keys(object)
65
+ if (Array.isArray(object)) {
66
+ return object.map((value) => (0, exports.objectAlphaSort)(value, depthLeft - 1));
67
+ }
68
+ if (object !== null && typeof object === "object") {
69
+ const source = object;
70
+ return Object.keys(source)
72
71
  .sort((a, b) => (a.toLowerCase() < b.toLowerCase() ? -1 : 1))
73
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
72
  .reduce((result, key) => {
75
- //@ts-ignore
76
- result[key] = (0, exports.objectAlphaSort)(object[key], depthLeft - 1);
73
+ result[key] = (0, exports.objectAlphaSort)(source[key], depthLeft - 1);
77
74
  return result;
78
- }, {}));
79
- }
80
- else if (Array.isArray(object)) {
81
- //@ts-ignore
82
- return object.map((obj) => (0, exports.objectAlphaSort)(obj, depthLeft - 1));
83
- }
84
- else {
85
- return object;
75
+ }, {});
86
76
  }
77
+ return object;
87
78
  };
88
79
  exports.objectAlphaSort = objectAlphaSort;
89
80
  /**
@@ -110,9 +101,8 @@ function objectToString(obj,
110
101
  joinKeyValue,
111
102
  /** eg '&' */
112
103
  joinKeys) {
113
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
114
104
  if (!obj || Object.keys(obj).length === 0) {
115
- return '';
105
+ return "";
116
106
  }
117
107
  const raw = Object.entries(obj).map(([key, value]) => key + joinKeyValue + value);
118
108
  const ret = raw.join(joinKeys);
@@ -154,7 +144,6 @@ const removeUndefValuesFromObject = (orig) => {
154
144
  const ret = {};
155
145
  Object.entries(orig).forEach(([k, v]) => {
156
146
  if (v !== null && v !== undefined) {
157
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
158
147
  ret[k] = v;
159
148
  }
160
149
  });
@@ -183,13 +172,13 @@ const castStringlyObject = (orig) => {
183
172
  const noundef = (0, exports.removeUndefValuesFromObject)(orig);
184
173
  return (0, exports.castObject)(noundef, (s) => {
185
174
  if (Array.isArray(s)) {
186
- return s.join(',');
175
+ return s.join(",");
187
176
  }
188
177
  return s;
189
178
  });
190
179
  };
191
180
  exports.castStringlyObject = castStringlyObject;
192
- const isObject = (o) => o && typeof o === 'object' && !Array.isArray(o);
181
+ const isObject = (o) => o && typeof o === "object" && !Array.isArray(o);
193
182
  exports.isObject = isObject;
194
183
  const copy = (v) => JSON.parse(JSON.stringify(v));
195
184
  exports.copy = copy;
@@ -15,24 +15,24 @@ const toFixed = (num, fixed) => {
15
15
  */
16
16
  const secondsInNearest = ({ seconds, precision = 2, }) => {
17
17
  if (seconds <= 0) {
18
- return 'Now';
18
+ return "Now";
19
19
  }
20
20
  if (seconds < 90) {
21
21
  const v = toFixed(seconds, precision);
22
- return `${v} ${v === 1 ? 'second' : 'seconds'}`;
22
+ return `${v} ${v === 1 ? "second" : "seconds"}`;
23
23
  }
24
24
  const mins = seconds / 60;
25
25
  if (mins < 120) {
26
26
  const v = toFixed(mins, precision);
27
- return `${v} ${v === 1 ? 'minute' : 'minutes'}`;
27
+ return `${v} ${v === 1 ? "minute" : "minutes"}`;
28
28
  }
29
29
  const hours = mins / 60;
30
30
  if (hours < 24) {
31
31
  const v = toFixed(hours, precision);
32
- return `${v} ${v === 1 ? 'hour' : 'hours'}`;
32
+ return `${v} ${v === 1 ? "hour" : "hours"}`;
33
33
  }
34
34
  const days = hours / 24;
35
35
  const v = toFixed(days, precision);
36
- return `${v} ${v === 1 ? 'day' : 'days'}`;
36
+ return `${v} ${v === 1 ? "day" : "days"}`;
37
37
  };
38
38
  exports.secondsInNearest = secondsInNearest;
@@ -5,11 +5,10 @@ const log_1 = require("./log");
5
5
  async function getStringFromStream(stream) {
6
6
  const decoder = new TextDecoder();
7
7
  const reader = stream.getReader();
8
- let result = '';
8
+ let result = "";
9
9
  try {
10
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
11
10
  while (true) {
12
- // eslint-disable-next-line no-await-in-loop
11
+ // oxlint-disable-next-line no-await-in-loop -- stream chunks must be read sequentially
13
12
  const { done, value } = await reader.read();
14
13
  if (done)
15
14
  break;
@@ -18,10 +17,9 @@ async function getStringFromStream(stream) {
18
17
  // Append the chunk to the final result
19
18
  result += chunkString;
20
19
  }
21
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
20
  }
23
- catch (e) {
24
- (0, log_1.error)('error converting stream');
21
+ catch {
22
+ (0, log_1.error)("error converting stream");
25
23
  }
26
24
  finally {
27
25
  reader.releaseLock();
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromBase64 = exports.toBase64 = void 0;
4
4
  const buffer_1 = require("buffer");
5
- const toBase64 = (str) => buffer_1.Buffer.from(str).toString('base64');
5
+ const toBase64 = (str) => buffer_1.Buffer.from(str).toString("base64");
6
6
  exports.toBase64 = toBase64;
7
- const fromBase64 = (str) => buffer_1.Buffer.from(decodeURIComponent(str), 'base64').toString();
7
+ const fromBase64 = (str) => buffer_1.Buffer.from(decodeURIComponent(str), "base64").toString();
8
8
  exports.fromBase64 = fromBase64;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.chunkString = void 0;
4
- const chunkString = (str, length) => str.match(new RegExp(`.{1,${length}}`, 'g'));
4
+ const chunkString = (str, length) => str.match(new RegExp(`.{1,${length}}`, "g"));
5
5
  exports.chunkString = chunkString;
@@ -49,9 +49,7 @@ function containsInsensitiveIndexes({ haystack, needle, fromLast = false, maxFou
49
49
  if (indexes.length >= maxFound) {
50
50
  break;
51
51
  }
52
- lastIndex = fromLast
53
- ? lstr.lastIndexOf(needle, lastIndex)
54
- : lstr.indexOf(needle, lastIndex);
52
+ lastIndex = fromLast ? lstr.lastIndexOf(needle, lastIndex) : lstr.indexOf(needle, lastIndex);
55
53
  if (lastIndex === -1) {
56
54
  break;
57
55
  }
@@ -9,7 +9,7 @@ const contains_1 = require("./contains");
9
9
  * @returns
10
10
  */
11
11
  const getExtendedStringSegments = (p) => {
12
- const { blocksOnEitherSide = 5, gapChars = ['\n', '\r\n'], hay, needle } = p;
12
+ const { blocksOnEitherSide = 5, gapChars = ["\n", "\r\n"], hay, needle } = p;
13
13
  const fis = (0, contains_1.containsInsensitiveIndexes)({ haystack: hay, needle });
14
14
  const founds = [];
15
15
  fis.forEach((fi) => {
@@ -1,11 +1,11 @@
1
- export * from './base64';
2
- export * from './chunk';
3
- export * from './contains';
4
- export * from './getExtendedStringSegment';
5
- export * from './json';
6
- export * from './object';
7
- export * from './redact';
8
- export * from './surround';
9
- export * from './trim';
10
- export * from './truncate';
11
- export * from './url';
1
+ export * from "./base64";
2
+ export * from "./chunk";
3
+ export * from "./contains";
4
+ export * from "./getExtendedStringSegment";
5
+ export * from "./json";
6
+ export * from "./object";
7
+ export * from "./redact";
8
+ export * from "./surround";
9
+ export * from "./trim";
10
+ export * from "./truncate";
11
+ export * from "./url";
@@ -9,7 +9,7 @@ exports.safeStringify = void 0;
9
9
  */
10
10
  const safeStringify = (obj, indent = 2) => {
11
11
  let cache = [];
12
- const retVal = JSON.stringify(obj, (_key, value) => typeof value === 'object' && value !== null
12
+ const retVal = JSON.stringify(obj, (_key, value) => typeof value === "object" && value !== null
13
13
  ? cache.includes(value)
14
14
  ? undefined // Duplicate reference found, discard key
15
15
  : cache.push(value) && value // Store value in our collection