@putkoff/abstract-utilities 1.0.71 → 1.0.93

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 (107) hide show
  1. package/dist/cjs/index.js +247 -341
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/server.js +342 -0
  4. package/dist/cjs/server.js.map +1 -0
  5. package/dist/esm/index.js +508 -1156
  6. package/dist/esm/index.js.map +1 -1
  7. package/dist/esm/server.js +305 -0
  8. package/dist/esm/server.js.map +1 -0
  9. package/dist/types/functions/auth_utils/imports.d.ts +0 -0
  10. package/dist/types/functions/auth_utils/index.d.ts +0 -0
  11. package/dist/types/functions/auth_utils/src/index.d.ts +0 -0
  12. package/dist/types/functions/auth_utils/src/token_utils.d.ts +0 -0
  13. package/dist/types/functions/config_utils/imports.d.ts +0 -0
  14. package/dist/types/functions/config_utils/index.d.ts +0 -0
  15. package/dist/types/functions/config_utils/src/config_utils.d.ts +0 -0
  16. package/dist/types/functions/config_utils/src/index.d.ts +0 -0
  17. package/dist/types/functions/constants_utils/index.d.ts +0 -0
  18. package/dist/types/functions/constants_utils/src/constants.d.ts +0 -0
  19. package/dist/types/functions/constants_utils/src/index.d.ts +0 -0
  20. package/dist/types/functions/env_utils/imports.d.ts +0 -0
  21. package/dist/types/functions/env_utils/index.d.ts +0 -0
  22. package/dist/types/functions/env_utils/src/index.d.ts +0 -0
  23. package/dist/types/functions/env_utils/src/window_utils.d.ts +0 -0
  24. package/dist/types/functions/fetch_utils/imports.d.ts +0 -0
  25. package/dist/types/functions/fetch_utils/index.d.ts +0 -0
  26. package/dist/types/functions/fetch_utils/src/fetch_utils.d.ts +0 -0
  27. package/dist/types/functions/fetch_utils/src/index.d.ts +0 -0
  28. package/dist/types/functions/fetch_utils/src/url_utils.d.ts +0 -0
  29. package/dist/types/functions/fetch_utils/src/utils.d.ts +0 -0
  30. package/dist/types/functions/index.d.ts +0 -0
  31. package/dist/types/functions/math_utils/constants.d.ts +0 -0
  32. package/dist/types/functions/math_utils/conversions.d.ts +0 -0
  33. package/dist/types/functions/math_utils/index.d.ts +0 -0
  34. package/dist/types/functions/math_utils/safe_math.d.ts +0 -0
  35. package/dist/types/functions/math_utils/scaleInterfaces.d.ts +0 -0
  36. package/dist/types/functions/path_utils/imports.d.ts +0 -0
  37. package/dist/types/functions/path_utils/index.d.ts +0 -0
  38. package/dist/types/functions/path_utils/src/base_dirs.d.ts +0 -0
  39. package/dist/types/functions/path_utils/src/function_dirs.d.ts +0 -0
  40. package/dist/types/functions/path_utils/src/index.d.ts +0 -0
  41. package/dist/types/functions/path_utils/src/misc_dirs.d.ts +0 -0
  42. package/dist/types/functions/path_utils/src/path_utils.d.ts +0 -0
  43. package/dist/types/functions/path_utils/src/paths.d.ts +0 -0
  44. package/dist/types/functions/path_utils/src/src_dirs.d.ts +0 -0
  45. package/dist/types/functions/read_utils/imports.d.ts +0 -0
  46. package/dist/types/functions/read_utils/index.d.ts +0 -0
  47. package/dist/types/functions/read_utils/src/index.d.ts +3 -1
  48. package/dist/types/functions/read_utils/src/readJsonFile.browser.d.ts +1 -0
  49. package/dist/types/functions/read_utils/src/readJsonFile.d.ts +2 -0
  50. package/dist/types/functions/read_utils/src/readJsonFile.node.d.ts +1 -0
  51. package/dist/types/functions/rndm_utils/imports.d.ts +0 -0
  52. package/dist/types/functions/rndm_utils/index.d.ts +0 -0
  53. package/dist/types/functions/rndm_utils/src/index.d.ts +0 -0
  54. package/dist/types/functions/rndm_utils/src/utils.d.ts +0 -0
  55. package/dist/types/functions/safe_utils/imports.d.ts +0 -0
  56. package/dist/types/functions/safe_utils/index.d.ts +0 -0
  57. package/dist/types/functions/safe_utils/src/index.d.ts +0 -0
  58. package/dist/types/functions/safe_utils/src/safe_document.d.ts +0 -0
  59. package/dist/types/functions/safe_utils/src/safe_globals.d.ts +0 -0
  60. package/dist/types/functions/safe_utils/src/safe_storage.d.ts +0 -0
  61. package/dist/types/functions/safe_utils/src/safe_window.d.ts +0 -0
  62. package/dist/types/functions/string_utils/index.d.ts +0 -0
  63. package/dist/types/functions/string_utils/src/index.d.ts +0 -0
  64. package/dist/types/functions/string_utils/src/string_utils.d.ts +0 -0
  65. package/dist/types/functions/type_utils/imports.d.ts +0 -0
  66. package/dist/types/functions/type_utils/index.d.ts +0 -0
  67. package/dist/types/functions/type_utils/src/clean_utils.d.ts +0 -0
  68. package/dist/types/functions/type_utils/src/ensure_utils.d.ts +0 -0
  69. package/dist/types/functions/type_utils/src/imports.d.ts +0 -0
  70. package/dist/types/functions/type_utils/src/index.d.ts +0 -0
  71. package/dist/types/functions/type_utils/src/json_utils.d.ts +0 -0
  72. package/dist/types/functions/type_utils/src/list_utils.d.ts +0 -0
  73. package/dist/types/functions/type_utils/src/mime_utils.d.ts +0 -0
  74. package/dist/types/functions/type_utils/src/type_utils.d.ts +0 -0
  75. package/dist/types/functions/variable_utils/imports.d.ts +0 -0
  76. package/dist/types/functions/variable_utils/index.d.ts +0 -0
  77. package/dist/types/functions/variable_utils/src/index.d.ts +0 -0
  78. package/dist/types/functions/variable_utils/src/variable_utils.d.ts +0 -0
  79. package/dist/types/index.d.ts +0 -0
  80. package/dist/types/types/index.d.ts +0 -0
  81. package/dist/types/types/src/Files.d.ts +0 -0
  82. package/dist/types/types/src/index.d.ts +0 -0
  83. package/dist/types/types/src/login.d.ts +0 -0
  84. package/dist/types/types/src/logout.d.ts +0 -0
  85. package/dist/types/types/src/utils.d.ts +0 -0
  86. package/dist/types/utils/imports.d.ts +0 -0
  87. package/dist/types/utils/index.d.ts +0 -0
  88. package/dist/types/utils/src/Input.d.ts +0 -0
  89. package/dist/types/utils/src/config.d.ts +0 -0
  90. package/dist/types/utils/src/index.d.ts +0 -0
  91. package/package.json +2 -17
  92. package/dist/index.d.ts +0 -813
  93. package/dist/types/functions/read_utils/src/utils.d.ts +0 -8
  94. package/dist/types/functions/ui_utils/imports.d.ts +0 -4
  95. package/dist/types/functions/ui_utils/index.d.ts +0 -1
  96. package/dist/types/functions/ui_utils/src/button.d.ts +0 -5
  97. package/dist/types/functions/ui_utils/src/checkbox.d.ts +0 -4
  98. package/dist/types/functions/ui_utils/src/index.d.ts +0 -4
  99. package/dist/types/functions/ui_utils/src/input.d.ts +0 -5
  100. package/dist/types/functions/ui_utils/src/spinner.d.ts +0 -1
  101. package/dist/types/types/src/ChangePassword.d.ts +0 -16
  102. package/dist/types/ui/Navbar/DropDowns/DropDownElements.d.ts +0 -8
  103. package/dist/types/ui/Navbar/DropDowns/ForumsDropdown.d.ts +0 -2
  104. package/dist/types/ui/Navbar/DropDowns/index.d.ts +0 -3
  105. package/dist/types/ui/Navbar/NavBar.d.ts +0 -8
  106. package/dist/types/ui/Navbar/index.d.ts +0 -3
  107. package/dist/types/ui/index.d.ts +0 -1
package/dist/cjs/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var path$1 = require('path');
4
- var fs$1 = require('node:fs');
3
+ var path = require('path');
4
+ var fs = require('node:fs');
5
5
  var fsp = require('node:fs/promises');
6
- var path$2 = require('node:path');
6
+ var path$1 = require('node:path');
7
7
  var require$$0$2 = require('util');
8
8
  var require$$0$1 = require('os');
9
9
  var require$$0$3 = require('stream');
@@ -34,9 +34,9 @@ function _interopNamespaceDefault(e) {
34
34
  return Object.freeze(n);
35
35
  }
36
36
 
37
- var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs$1);
37
+ var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
38
38
  var fsp__namespace = /*#__PURE__*/_interopNamespaceDefault(fsp);
39
- var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path$2);
39
+ var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path$1);
40
40
 
41
41
  /** True if token is structurally bad or its exp ≤ now. */
42
42
  function isTokenExpired(token) {
@@ -44,7 +44,7 @@ function isTokenExpired(token) {
44
44
  const payload = decodeJwt(token);
45
45
  return Date.now() / 1000 >= payload.exp;
46
46
  }
47
- catch (_a) {
47
+ catch {
48
48
  return true; // treat malformed token as expired
49
49
  }
50
50
  }
@@ -119,50 +119,6 @@ function get_window_parts() {
119
119
  return null;
120
120
  }
121
121
 
122
- /******************************************************************************
123
- Copyright (c) Microsoft Corporation.
124
-
125
- Permission to use, copy, modify, and/or distribute this software for any
126
- purpose with or without fee is hereby granted.
127
-
128
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
129
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
130
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
131
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
132
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
133
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
134
- PERFORMANCE OF THIS SOFTWARE.
135
- ***************************************************************************** */
136
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
137
-
138
-
139
- function __rest(s, e) {
140
- var t = {};
141
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
142
- t[p] = s[p];
143
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
144
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
145
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
146
- t[p[i]] = s[p[i]];
147
- }
148
- return t;
149
- }
150
-
151
- function __awaiter(thisArg, _arguments, P, generator) {
152
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
153
- return new (P || (P = Promise))(function (resolve, reject) {
154
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
155
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
156
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
157
- step((generator = generator.apply(thisArg, _arguments || [])).next());
158
- });
159
- }
160
-
161
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
162
- var e = new Error(message);
163
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
164
- };
165
-
166
122
  /**
167
123
  * Unwraps nested { result } fields until you hit a non-object or no more "result" keys.
168
124
  */
@@ -186,13 +142,13 @@ function getMethod(method = null, body = null) {
186
142
  }
187
143
  // Gets headers, skips JSON headers when body is FormData
188
144
  function getHeaders(headers = {}, method = null, body = null) {
189
- const result = Object.assign({}, headers);
145
+ const result = { ...headers };
190
146
  // let browser set boundary
191
147
  if (body instanceof FormData) {
192
148
  return result;
193
149
  }
194
- const upper = method === null || method === void 0 ? void 0 : method.toUpperCase();
195
- if (['POST', 'PUT', 'PATCH'].includes(upper !== null && upper !== void 0 ? upper : '') &&
150
+ const upper = method?.toUpperCase();
151
+ if (['POST', 'PUT', 'PATCH'].includes(upper ?? '') &&
196
152
  !result['Content-Type']) {
197
153
  result['Content-Type'] = 'application/json';
198
154
  }
@@ -228,18 +184,16 @@ function getFetchVars(headers = null, method = null, body = null) {
228
184
  * parseResult no longer needs to worry about JSON vs HTML redirect errors;
229
185
  * all 401/403 have already been handled above.
230
186
  */
231
- function parseResult(res) {
232
- return __awaiter(this, void 0, void 0, function* () {
233
- // runs checkResponse first, will throw if session is expired
234
- res = checkResponse(res);
235
- if (!res.ok) {
236
- // for any other non-401 errors, you can still surface them
237
- const errorText = yield res.text();
238
- throw new Error(errorText || res.statusText);
239
- }
240
- // now safely parse JSON
241
- return res.json();
242
- });
187
+ async function parseResult(res) {
188
+ // runs checkResponse first, will throw if session is expired
189
+ res = checkResponse(res);
190
+ if (!res.ok) {
191
+ // for any other non-401 errors, you can still surface them
192
+ const errorText = await res.text();
193
+ throw new Error(errorText || res.statusText);
194
+ }
195
+ // now safely parse JSON
196
+ return res.json();
243
197
  }
244
198
  /**
245
199
  * Intercept 401/403 and force a clean redirect to login
@@ -257,71 +211,67 @@ function checkResponse(res) {
257
211
  return res;
258
212
  }
259
213
 
260
- function fetchIt(endpoint_1) {
261
- return __awaiter(this, arguments, void 0, function* (endpoint, body = null, method = null, headers = null, blob = false, configUrl = false, withCredentials = true, returnJson = true, returnReult = true) {
262
- method = (method || "GET").toUpperCase();
263
- // 2) choose the URL
264
- const url = endpoint;
265
- // 3) prepare headers & body
266
- headers = Object.assign(Object.assign({}, (body instanceof FormData ? {} : { "Content-Type": "application/json" })), headers);
267
- const opts = {
268
- method,
269
- credentials: withCredentials ? "include" : "same-origin",
270
- headers,
271
- body: body instanceof FormData
272
- ? body
273
- : body != null && method !== "GET"
274
- ? JSON.stringify(body)
275
- : undefined,
276
- };
277
- console.debug("➡️ secureFetchIt →", url, opts);
278
- const res = yield fetch(url, opts);
279
- if (!res.ok) {
280
- const err = yield res.text();
281
- throw new Error(`HTTP ${res.status}: ${err}`);
282
- }
283
- if (blob)
284
- return res.blob();
285
- if (returnReult)
286
- return getResult(res.json());
287
- if (returnJson)
288
- return res.json();
289
- return res;
290
- });
214
+ async function fetchIt(endpoint, body = null, method = null, headers = null, blob = false, configUrl = false, withCredentials = true, returnJson = true, returnReult = true) {
215
+ method = (method || "GET").toUpperCase();
216
+ // 2) choose the URL
217
+ const url = endpoint;
218
+ // 3) prepare headers & body
219
+ headers = {
220
+ ...(body instanceof FormData ? {} : { "Content-Type": "application/json" }),
221
+ ...headers,
222
+ };
223
+ const opts = {
224
+ method,
225
+ credentials: withCredentials ? "include" : "same-origin",
226
+ headers,
227
+ body: body instanceof FormData
228
+ ? body
229
+ : body != null && method !== "GET"
230
+ ? JSON.stringify(body)
231
+ : undefined,
232
+ };
233
+ console.debug("➡️ secureFetchIt →", url, opts);
234
+ const res = await fetch(url, opts);
235
+ if (!res.ok) {
236
+ const err = await res.text();
237
+ throw new Error(`HTTP ${res.status}: ${err}`);
238
+ }
239
+ if (blob)
240
+ return res.blob();
241
+ if (returnReult)
242
+ return getResult(res.json());
243
+ if (returnJson)
244
+ return res.json();
245
+ return res;
291
246
  }
292
247
  // Constructs HTML directory path
293
248
  function getHtmlDirectory(directory, filename) {
294
249
  return `${directory}/${filename}.html`;
295
250
  }
296
251
  // Fetches HTML content
297
- function fetchIndexHtml(filename_1) {
298
- return __awaiter(this, arguments, void 0, function* (filename, directory = 'sf_index', base = 'html') {
299
- const url = `/${base}/${directory}/${filename}.html`;
300
- const response = yield fetch(url);
301
- return yield response.text();
302
- });
252
+ async function fetchIndexHtml(filename, directory = 'sf_index', base = 'html') {
253
+ const url = `/${base}/${directory}/${filename}.html`;
254
+ const response = await fetch(url);
255
+ return await response.text();
303
256
  }
304
257
  // Fetches and injects HTML content into container
305
- function fetchIndexHtmlContainer(filename_1) {
306
- return __awaiter(this, arguments, void 0, function* (filename, doc = document, directory = 'html') {
307
- const container = `${filename}-container`;
308
- const html = yield fetchIndexHtml(filename, directory);
309
- const el = doc.getElementById(container);
310
- if (el) {
311
- el.innerHTML = html;
312
- }
313
- else {
314
- console.warn(`⚠️ No container found for: #${container}`);
315
- }
316
- });
258
+ async function fetchIndexHtmlContainer(filename, doc = document, directory = 'html') {
259
+ const container = `${filename}-container`;
260
+ const html = await fetchIndexHtml(filename, directory);
261
+ const el = doc.getElementById(container);
262
+ if (el) {
263
+ el.innerHTML = html;
264
+ }
265
+ else {
266
+ console.warn(`⚠️ No container found for: #${container}`);
267
+ }
317
268
  }
318
269
 
319
270
  function urlJoin(...parts) {
320
- var _a;
321
271
  const s = (parts.length === 1 && Array.isArray(parts[0]) ? parts[0] : parts);
322
272
  let r = "";
323
273
  for (let i = 0; i < s.length; i++) {
324
- let d = ((_a = s[i]) !== null && _a !== void 0 ? _a : "").toString();
274
+ let d = (s[i] ?? "").toString();
325
275
  if (!d)
326
276
  continue;
327
277
  if (i === 0)
@@ -358,7 +308,7 @@ function get_full_path(partial_path, parent_dir = null) {
358
308
  if (typeof partial_path !== 'string') {
359
309
  throw new Error('partial_path must be a string');
360
310
  }
361
- if (path$1.isAbsolute(partial_path)) {
311
+ if (path.isAbsolute(partial_path)) {
362
312
  return partial_path;
363
313
  }
364
314
  return urlJoin(parent_dir, partial_path);
@@ -373,7 +323,7 @@ function path_to_url(filePath, all_paths) {
373
323
  }
374
324
  for (const key in all_paths) {
375
325
  const mapping = all_paths[key];
376
- const normalizedBase = path$1.normalize(mapping.path);
326
+ const normalizedBase = path.normalize(mapping.path);
377
327
  if (filePath.startsWith(normalizedBase)) {
378
328
  const relativePath = filePath.substring(normalizedBase.length);
379
329
  return urlJoin(mapping.url, relativePath.replace(/\\/g, '/'));
@@ -1057,7 +1007,7 @@ function formatNumber(value) {
1057
1007
  return value;
1058
1008
  return US_DECIMAL_FORMATTER.format(num);
1059
1009
  }
1060
- catch (_a) {
1010
+ catch {
1061
1011
  // if anything goes wrong, return the original
1062
1012
  return value;
1063
1013
  }
@@ -1098,7 +1048,7 @@ function findKeyValue(obj, keyToFind) {
1098
1048
  return undefined;
1099
1049
  }
1100
1050
  function omitKeys(obj, ...keys) {
1101
- const newObj = Object.assign({}, obj);
1051
+ const newObj = { ...obj };
1102
1052
  keys.forEach(key => {
1103
1053
  delete newObj[key];
1104
1054
  });
@@ -1114,7 +1064,7 @@ function extractInsertData(insertValue) {
1114
1064
  // Example: Suppose you only need certain fields from the transaction
1115
1065
  // Modify this function based on your actual data structure
1116
1066
  if (insertValue && typeof insertValue === 'object') {
1117
- const { transaction } = insertValue, rest = __rest(insertValue, ["transaction"]); // Exclude 'transaction' property
1067
+ const { transaction, ...rest } = insertValue; // Exclude 'transaction' property
1118
1068
  return rest;
1119
1069
  }
1120
1070
  return insertValue;
@@ -1184,6 +1134,7 @@ function getAlphas() {
1184
1134
  return 'abcdefghijklmnopqrstuvwxyz';
1185
1135
  }
1186
1136
 
1137
+ // mediaTypes.ts
1187
1138
  /** ---- Data: large but explicit, mirrors your Python mapping ---- */
1188
1139
  const MIME_TYPES = {
1189
1140
  image: {
@@ -1335,8 +1286,7 @@ function toCategorySet(categories) {
1335
1286
  return out.size ? out : new Set(allCats);
1336
1287
  }
1337
1288
  function normalizeCategories(categories, opts) {
1338
- var _a;
1339
- const selected = (_a = categories !== null && categories !== void 0 ? categories : opts === null || opts === void 0 ? void 0 : opts.media_types) !== null && _a !== void 0 ? _a : null;
1289
+ const selected = categories ?? opts?.media_types ?? null;
1340
1290
  return toCategorySet(selected);
1341
1291
  }
1342
1292
  function extOf(input) {
@@ -1438,45 +1388,41 @@ function getAllFileTypesSync(directory, categories, opts) {
1438
1388
  walkSync(directory);
1439
1389
  return results;
1440
1390
  }
1441
- catch (_a) {
1391
+ catch {
1442
1392
  return [];
1443
1393
  }
1444
1394
  }
1445
- function getAllFileTypes(directory, categories, opts) {
1446
- return __awaiter(this, void 0, void 0, function* () {
1447
- // 🧩 Skip entirely if fsp isn't available
1448
- if (!fsp__namespace || !path__namespace)
1395
+ async function getAllFileTypes(directory, categories, opts) {
1396
+ // 🧩 Skip entirely if fsp isn't available
1397
+ if (!fsp__namespace || !path__namespace)
1398
+ return [];
1399
+ try {
1400
+ const stat = await fsp__namespace.stat(directory);
1401
+ if (!stat.isDirectory())
1449
1402
  return [];
1450
- try {
1451
- const stat = yield fsp__namespace.stat(directory);
1452
- if (!stat.isDirectory())
1453
- return [];
1454
- const cats = normalizeCategories(categories, opts);
1455
- const wanted = unionExts(cats);
1456
- const results = [];
1457
- function walkAsync(dir) {
1458
- return __awaiter(this, void 0, void 0, function* () {
1459
- const entries = yield fsp__namespace.readdir(dir, { withFileTypes: true });
1460
- for (const ent of entries) {
1461
- const full = path__namespace.join(dir, ent.name);
1462
- if (ent.isDirectory()) {
1463
- yield walkAsync(full);
1464
- }
1465
- else if (ent.isFile()) {
1466
- const ext = path__namespace.extname(ent.name).toLowerCase();
1467
- if (wanted.has(ext))
1468
- results.push(full);
1469
- }
1470
- }
1471
- });
1403
+ const cats = normalizeCategories(categories, opts);
1404
+ const wanted = unionExts(cats);
1405
+ const results = [];
1406
+ async function walkAsync(dir) {
1407
+ const entries = await fsp__namespace.readdir(dir, { withFileTypes: true });
1408
+ for (const ent of entries) {
1409
+ const full = path__namespace.join(dir, ent.name);
1410
+ if (ent.isDirectory()) {
1411
+ await walkAsync(full);
1412
+ }
1413
+ else if (ent.isFile()) {
1414
+ const ext = path__namespace.extname(ent.name).toLowerCase();
1415
+ if (wanted.has(ext))
1416
+ results.push(full);
1417
+ }
1472
1418
  }
1473
- yield walkAsync(directory);
1474
- return results;
1475
- }
1476
- catch (_a) {
1477
- return [];
1478
1419
  }
1479
- });
1420
+ await walkAsync(directory);
1421
+ return results;
1422
+ }
1423
+ catch {
1424
+ return [];
1425
+ }
1480
1426
  }
1481
1427
  /** Optional convenience re-exports that mirror your Python names */
1482
1428
  const get_all_file_types = getAllFileTypes;
@@ -1494,10 +1440,9 @@ function getIfNone(obj, fallback) {
1494
1440
  * Merges non-null values from multiple dictionaries.
1495
1441
  */
1496
1442
  function mergeNotNullValues(dictA, dictB, dictC, dictD, dictE) {
1497
- var _a, _b, _c, _d;
1498
1443
  const result = {};
1499
1444
  for (const key of Object.keys(dictA)) {
1500
- result[key] = (_d = (_c = (_b = (_a = dictA[key]) !== null && _a !== void 0 ? _a : dictB === null || dictB === void 0 ? void 0 : dictB[key]) !== null && _b !== void 0 ? _b : dictC === null || dictC === void 0 ? void 0 : dictC[key]) !== null && _c !== void 0 ? _c : dictD === null || dictD === void 0 ? void 0 : dictD[key]) !== null && _d !== void 0 ? _d : dictE === null || dictE === void 0 ? void 0 : dictE[key];
1445
+ result[key] = dictA[key] ?? dictB?.[key] ?? dictC?.[key] ?? dictD?.[key] ?? dictE?.[key];
1501
1446
  }
1502
1447
  return result;
1503
1448
  }
@@ -1510,8 +1455,8 @@ function emptyObjectToNull(value) {
1510
1455
 
1511
1456
  function getSubstring(obj, maxLength = null, minLength = null) {
1512
1457
  const objLength = obj.length;
1513
- const effectiveMaxLength = maxLength !== null && maxLength !== void 0 ? maxLength : objLength; // Use nullish coalescing for clarity
1514
- const effectiveMinLength = minLength !== null && minLength !== void 0 ? minLength : 0;
1458
+ const effectiveMaxLength = maxLength ?? objLength; // Use nullish coalescing for clarity
1459
+ const effectiveMinLength = minLength ?? 0;
1515
1460
  // Ensure bounds are valid
1516
1461
  const clampedMaxLength = Math.min(Math.max(effectiveMaxLength, 0), objLength);
1517
1462
  const clampedMinLength = Math.min(Math.max(effectiveMinLength, 0), objLength);
@@ -1719,7 +1664,7 @@ function fileURLToPath(fileUrl) {
1719
1664
  const u = new URL(fileUrl);
1720
1665
  return u.pathname;
1721
1666
  }
1722
- catch (_a) {
1667
+ catch {
1723
1668
  // fallback: just strip file://
1724
1669
  return fileUrl.replace(/^file:\/\//, '');
1725
1670
  }
@@ -1979,7 +1924,7 @@ function alertit(obj = null) {
1979
1924
  try {
1980
1925
  msg = JSON.stringify(obj);
1981
1926
  }
1982
- catch (_a) {
1927
+ catch {
1983
1928
  // If JSON.stringify fails (circular refs, etc.), fall back to a simple string
1984
1929
  msg = String(obj);
1985
1930
  }
@@ -2090,14 +2035,14 @@ const TIME_FACTORS = {
2090
2035
  🔍 CANONICALIZATION HELPERS
2091
2036
  ───────────────────────────────────────────────────────────────*/
2092
2037
  function canonDist(u) {
2093
- const key = (u !== null && u !== void 0 ? u : "m").toString().toLowerCase();
2038
+ const key = (u ?? "m").toString().toLowerCase();
2094
2039
  const canon = DIST_ALIASES[key];
2095
2040
  if (!canon)
2096
2041
  throw new Error(`Unknown distance unit: ${u}`);
2097
2042
  return canon;
2098
2043
  }
2099
2044
  function canonTime(u) {
2100
- const key = (u !== null && u !== void 0 ? u : "s").toString().toLowerCase();
2045
+ const key = (u ?? "s").toString().toLowerCase();
2101
2046
  const canon = TIME_ALIASES[key];
2102
2047
  if (!canon)
2103
2048
  throw new Error(`Unknown time unit: ${u}`);
@@ -2140,20 +2085,20 @@ function mpsToSpeed(vMps, distUnit, timeUnit) {
2140
2085
  ───────────────────────────────────────────────────────────────*/
2141
2086
  function convertDistance({ d, fromDist, toDist, vOnly = true, }) {
2142
2087
  const m = distanceToMeters(d, fromDist);
2143
- const D = canonDist(toDist !== null && toDist !== void 0 ? toDist : "m");
2088
+ const D = canonDist(toDist ?? "m");
2144
2089
  const out = metersToDistance(m, D);
2145
2090
  return vOnly ? out : { d: out, D };
2146
2091
  }
2147
2092
  function convertTime({ t, fromTime, toTime, vOnly = true, }) {
2148
2093
  const sec = timeToSeconds(t, fromTime);
2149
- const T = canonTime(toTime !== null && toTime !== void 0 ? toTime : "s");
2094
+ const T = canonTime(toTime ?? "s");
2150
2095
  const out = secondsToTime(sec, T);
2151
2096
  return vOnly ? out : { t: out, T };
2152
2097
  }
2153
2098
  function convertSpeed({ v, fromDist, fromTime, toDist, toTime, vOnly = true, }) {
2154
2099
  const mps = speedToMps(v, fromDist, fromTime);
2155
- const d = canonDist(toDist !== null && toDist !== void 0 ? toDist : "m");
2156
- const t = canonTime(toTime !== null && toTime !== void 0 ? toTime : "s");
2100
+ const d = canonDist(toDist ?? "m");
2101
+ const t = canonTime(toTime ?? "s");
2157
2102
  const out = mpsToSpeed(mps, d, t);
2158
2103
  return vOnly ? out : { v: out, d, t };
2159
2104
  }
@@ -13046,7 +12991,7 @@ function requireFile () {
13046
12991
  hasRequiredFile = 1;
13047
12992
 
13048
12993
  const fs = require$$0$6;
13049
- const path = path$1;
12994
+ const path$1 = path;
13050
12995
  const asyncSeries = requireSeries();
13051
12996
  const zlib = require$$3;
13052
12997
  const { MESSAGE } = tripleBeam;
@@ -13093,17 +13038,17 @@ function requireFile () {
13093
13038
  if (options.filename || options.dirname) {
13094
13039
  throwIf('filename or dirname', 'stream');
13095
13040
  this._basename = this.filename = options.filename
13096
- ? path.basename(options.filename)
13041
+ ? path$1.basename(options.filename)
13097
13042
  : 'winston.log';
13098
13043
 
13099
- this.dirname = options.dirname || path.dirname(options.filename);
13044
+ this.dirname = options.dirname || path$1.dirname(options.filename);
13100
13045
  this.options = options.options || { flags: 'a' };
13101
13046
  } else if (options.stream) {
13102
13047
  // eslint-disable-next-line no-console
13103
13048
  console.warn('options.stream will be removed in winston@4. Use winston.transports.Stream');
13104
13049
  throwIf('stream', 'filename', 'maxsize');
13105
13050
  this._dest = this._stream.pipe(this._setupStream(options.stream));
13106
- this.dirname = path.dirname(this._dest.path);
13051
+ this.dirname = path$1.dirname(this._dest.path);
13107
13052
  // We need to listen for drain events when write() returns false. This
13108
13053
  // can make node mad at times.
13109
13054
  } else {
@@ -13319,7 +13264,7 @@ function requireFile () {
13319
13264
  }
13320
13265
 
13321
13266
  options = normalizeQuery(options);
13322
- const file = path.join(this.dirname, this.filename);
13267
+ const file = path$1.join(this.dirname, this.filename);
13323
13268
  let buff = '';
13324
13269
  let results = [];
13325
13270
  let row = 0;
@@ -13462,7 +13407,7 @@ function requireFile () {
13462
13407
  * TODO: Refactor me.
13463
13408
  */
13464
13409
  stream(options = {}) {
13465
- const file = path.join(this.dirname, this.filename);
13410
+ const file = path$1.join(this.dirname, this.filename);
13466
13411
  const stream = new Stream();
13467
13412
  const tail = {
13468
13413
  file,
@@ -13522,7 +13467,7 @@ function requireFile () {
13522
13467
  */
13523
13468
  stat(callback) {
13524
13469
  const target = this._getFile();
13525
- const fullpath = path.join(this.dirname, target);
13470
+ const fullpath = path$1.join(this.dirname, target);
13526
13471
 
13527
13472
  fs.stat(fullpath, (err, stat) => {
13528
13473
  if (err && err.code === 'ENOENT') {
@@ -13644,7 +13589,7 @@ function requireFile () {
13644
13589
  * @returns {WritableStream} Stream that writes to disk for the active file.
13645
13590
  */
13646
13591
  _createStream(source) {
13647
- const fullpath = path.join(this.dirname, this.filename);
13592
+ const fullpath = path$1.join(this.dirname, this.filename);
13648
13593
 
13649
13594
  debug('create stream start', fullpath, this.options);
13650
13595
  const dest = fs.createWriteStream(fullpath, this.options)
@@ -13680,8 +13625,8 @@ function requireFile () {
13680
13625
  */
13681
13626
  _incFile(callback) {
13682
13627
  debug('_incFile', this.filename);
13683
- const ext = path.extname(this._basename);
13684
- const basename = path.basename(this._basename, ext);
13628
+ const ext = path$1.extname(this._basename);
13629
+ const basename = path$1.basename(this._basename, ext);
13685
13630
  const tasks = [];
13686
13631
 
13687
13632
  if (this.zippedArchive) {
@@ -13689,8 +13634,8 @@ function requireFile () {
13689
13634
  function (cb) {
13690
13635
  const num = this._created > 0 && !this.tailable ? this._created : '';
13691
13636
  this._compressFile(
13692
- path.join(this.dirname, `${basename}${num}${ext}`),
13693
- path.join(this.dirname, `${basename}${num}${ext}.gz`),
13637
+ path$1.join(this.dirname, `${basename}${num}${ext}`),
13638
+ path$1.join(this.dirname, `${basename}${num}${ext}.gz`),
13694
13639
  cb
13695
13640
  );
13696
13641
  }.bind(this)
@@ -13718,8 +13663,8 @@ function requireFile () {
13718
13663
  * @private
13719
13664
  */
13720
13665
  _getFile() {
13721
- const ext = path.extname(this._basename);
13722
- const basename = path.basename(this._basename, ext);
13666
+ const ext = path$1.extname(this._basename);
13667
+ const basename = path$1.basename(this._basename, ext);
13723
13668
  const isRotation = this.rotationFormat
13724
13669
  ? this.rotationFormat()
13725
13670
  : this._created;
@@ -13750,7 +13695,7 @@ function requireFile () {
13750
13695
  const isOldest = oldest !== 0 ? oldest : '';
13751
13696
  const isZipped = this.zippedArchive ? '.gz' : '';
13752
13697
  const filePath = `${basename}${isOldest}${ext}${isZipped}`;
13753
- const target = path.join(this.dirname, filePath);
13698
+ const target = path$1.join(this.dirname, filePath);
13754
13699
 
13755
13700
  fs.unlink(target, callback);
13756
13701
  }
@@ -13777,7 +13722,7 @@ function requireFile () {
13777
13722
  for (let x = this.maxFiles - 1; x > 1; x--) {
13778
13723
  tasks.push(function (i, cb) {
13779
13724
  let fileName = `${basename}${(i - 1)}${ext}${isZipped}`;
13780
- const tmppath = path.join(this.dirname, fileName);
13725
+ const tmppath = path$1.join(this.dirname, fileName);
13781
13726
 
13782
13727
  fs.exists(tmppath, exists => {
13783
13728
  if (!exists) {
@@ -13785,15 +13730,15 @@ function requireFile () {
13785
13730
  }
13786
13731
 
13787
13732
  fileName = `${basename}${i}${ext}${isZipped}`;
13788
- fs.rename(tmppath, path.join(this.dirname, fileName), cb);
13733
+ fs.rename(tmppath, path$1.join(this.dirname, fileName), cb);
13789
13734
  });
13790
13735
  }.bind(this, x));
13791
13736
  }
13792
13737
 
13793
13738
  asyncSeries(tasks, () => {
13794
13739
  fs.rename(
13795
- path.join(this.dirname, `${basename}${ext}${isZipped}`),
13796
- path.join(this.dirname, `${basename}1${ext}${isZipped}`),
13740
+ path$1.join(this.dirname, `${basename}${ext}${isZipped}`),
13741
+ path$1.join(this.dirname, `${basename}1${ext}${isZipped}`),
13797
13742
  callback
13798
13743
  );
13799
13744
  });
@@ -16747,7 +16692,7 @@ function resolveLogger(candidate) {
16747
16692
  return null;
16748
16693
  }
16749
16694
  /* ------------------------------------------------------------------ */
16750
- /* UNIVERSAL getLogString (cannot crash) */
16695
+ /* IMPLEMENTATION */
16751
16696
  /* ------------------------------------------------------------------ */
16752
16697
  function getLogString(messageOrOptions, logType = null, details = null, function_name = null, file_location = null, consumerLogger = null) {
16753
16698
  // ---------------- Normalize inputs ----------------
@@ -16910,7 +16855,7 @@ function getSafeLocalStorage() {
16910
16855
  try {
16911
16856
  return window.localStorage;
16912
16857
  }
16913
- catch (_a) {
16858
+ catch {
16914
16859
  return undefined; // e.g. Safari private-mode block
16915
16860
  }
16916
16861
  }
@@ -16931,7 +16876,7 @@ function callStorage(method, ...args) {
16931
16876
  try {
16932
16877
  return fn.apply(storage, args);
16933
16878
  }
16934
- catch (_a) {
16879
+ catch {
16935
16880
  return undefined;
16936
16881
  }
16937
16882
  }
@@ -16946,7 +16891,7 @@ function safeStorage(storageName, method, ...args) {
16946
16891
  return undefined;
16947
16892
  return store[method](...args);
16948
16893
  }
16949
- catch (_a) {
16894
+ catch {
16950
16895
  return undefined;
16951
16896
  }
16952
16897
  }
@@ -16976,7 +16921,7 @@ function callWindowMethod(method, ...args) {
16976
16921
  // cast to any so TS doesn’t complain about apply/invoke
16977
16922
  return fn(...args);
16978
16923
  }
16979
- catch (_a) {
16924
+ catch {
16980
16925
  return undefined;
16981
16926
  }
16982
16927
  }
@@ -16994,172 +16939,132 @@ function getWindowHost() {
16994
16939
  return getWindowProp('location', 'host');
16995
16940
  }
16996
16941
 
16997
- // src/functions/read_utils/src/read_utils.ts
16998
- let fs = null;
16999
- let path = null;
17000
- function getFsModules() {
17001
- return __awaiter(this, void 0, void 0, function* () {
17002
- var _a;
17003
- if (!fs && !path && typeof process !== "undefined" && ((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node)) {
17004
- try {
17005
- // prevent bundlers from resolving these at build time
17006
- fs = (new Function("return require('fs')"))();
17007
- path = (new Function("return require('path')"))();
17008
- }
17009
- catch (_b) {
17010
- fs = null;
17011
- path = null;
17012
- }
17013
- }
17014
- return { fs, path };
17015
- });
17016
- }
17017
- /**
17018
- * Reads a JSON file, either via Node’s fs (if available)
17019
- * or via window.fetch in the browser. Never throws — returns
17020
- * the parsed object or null on any error.
17021
- */
17022
- function readJsonFile(relativeOrAbsolutePath) {
17023
- return __awaiter(this, void 0, void 0, function* () {
17024
- var _a;
17025
- // 1) Try Node.js fs (only at runtime, not bundled)
17026
- if (typeof process !== "undefined" && ((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node)) {
17027
- try {
17028
- const { fs, path } = yield getFsModules();
17029
- if (fs && path) {
17030
- const filePath = path.isAbsolute(relativeOrAbsolutePath)
17031
- ? relativeOrAbsolutePath
17032
- : path.resolve(process.cwd(), relativeOrAbsolutePath);
17033
- const text = fs.readFileSync(filePath, "utf8");
17034
- return JSON.parse(text);
17035
- }
17036
- }
17037
- catch (_b) {
17038
- // swallow and fall back
17039
- }
17040
- }
17041
- // 2) Try browser fetch
17042
- const fetchFn = safeGlobalProp("fetch");
17043
- if (typeof fetchFn !== "function") {
17044
- return null;
17045
- }
17046
- let url = relativeOrAbsolutePath;
17047
- const baseURI = safeGlobalProp("document", "baseURI");
17048
- if (baseURI) {
17049
- try {
17050
- url = new URL(relativeOrAbsolutePath, baseURI).href;
17051
- }
17052
- catch (_c) {
17053
- /* keep url as-is */
17054
- }
17055
- }
17056
- try {
17057
- const res = yield fetchFn(url);
17058
- if (!res.ok)
17059
- return null;
17060
- return (yield res.json());
17061
- }
17062
- catch (_d) {
16942
+ async function readJsonFileBrowser(url) {
16943
+ const fetchFn = safeGlobalProp("fetch");
16944
+ if (typeof fetchFn !== "function")
16945
+ return null;
16946
+ try {
16947
+ const res = await fetchFn(url);
16948
+ if (!res.ok)
17063
16949
  return null;
17064
- }
17065
- });
16950
+ return (await res.json());
16951
+ }
16952
+ catch {
16953
+ return null;
16954
+ }
17066
16955
  }
17067
- function getConfigContent() {
17068
- return __awaiter(this, void 0, void 0, function* () {
17069
- try {
17070
- // `readJsonFile` should throw if the file isn’t there or isn’t valid JSON
17071
- const cfg = yield readJsonFile('./config.json');
17072
- return cfg;
17073
- }
17074
- catch (_a) {
17075
- // swallow errors & return null so callers can detect “no config”
17076
- return null;
17077
- }
17078
- });
16956
+
16957
+ var readJsonFile_browser = /*#__PURE__*/Object.freeze({
16958
+ __proto__: null,
16959
+ readJsonFileBrowser: readJsonFileBrowser
16960
+ });
16961
+
16962
+ function readJsonFileNode(relativeOrAbsolutePath) {
16963
+ try {
16964
+ const filePath = path$1.isAbsolute(relativeOrAbsolutePath)
16965
+ ? relativeOrAbsolutePath
16966
+ : path$1.resolve(process.cwd(), relativeOrAbsolutePath);
16967
+ return JSON.parse(fs.readFileSync(filePath, "utf8"));
16968
+ }
16969
+ catch {
16970
+ return null;
16971
+ }
17079
16972
  }
17080
- // 2) Pull a single key out of that object
17081
- function getConfigVar() {
17082
- return __awaiter(this, arguments, void 0, function* (key = null) {
17083
- const cfg = yield getConfigContent();
17084
- if (cfg && typeof cfg === 'object' && key in cfg) {
17085
- return cfg[key];
17086
- }
17087
- return undefined;
17088
- });
16973
+
16974
+ var readJsonFile_node = /*#__PURE__*/Object.freeze({
16975
+ __proto__: null,
16976
+ readJsonFileNode: readJsonFileNode
16977
+ });
16978
+
16979
+ async function readJsonFile(relativeOrAbsolutePath) {
16980
+ if (typeof process !== "undefined" && process.versions?.node) {
16981
+ const mod = await Promise.resolve().then(function () { return readJsonFile_node; });
16982
+ return mod.readJsonFileNode(relativeOrAbsolutePath);
16983
+ }
16984
+ else {
16985
+ const mod = await Promise.resolve().then(function () { return readJsonFile_browser; });
16986
+ return mod.readJsonFileBrowser(relativeOrAbsolutePath);
16987
+ }
16988
+ }
16989
+ async function getConfigContent() {
16990
+ try {
16991
+ // `readJsonFile` should throw if the file isn’t there or isn’t valid JSON
16992
+ const cfg = await readJsonFile('./config.json');
16993
+ return cfg;
16994
+ }
16995
+ catch {
16996
+ // swallow errors & return null so callers can detect “no config”
16997
+ return null;
16998
+ }
17089
16999
  }
17090
17000
 
17091
17001
  // src/functions/config_utils/src/config_utils.ts
17092
17002
  let _cachedConfig = null;
17093
- function loadConfig() {
17094
- return __awaiter(this, arguments, void 0, function* (filePath = null) {
17095
- var _a, _b;
17096
- if (_cachedConfig) {
17003
+ async function loadConfig(filePath = null) {
17004
+ if (_cachedConfig) {
17005
+ return _cachedConfig;
17006
+ }
17007
+ // 1) figure out where config.json lives
17008
+ let configUrl;
17009
+ if (filePath) {
17010
+ configUrl = filePath;
17011
+ }
17012
+ else if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) }) !== 'undefined' && typeof (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) === 'string') {
17013
+ // ES module: resolve relative to this file
17014
+ try {
17015
+ const mod = await (new Function("return import('./config.json').catch(() => ({}))"))();
17016
+ _cachedConfig = mod.default ?? {};
17097
17017
  return _cachedConfig;
17098
17018
  }
17099
- // 1) figure out where config.json lives
17100
- let configUrl;
17101
- if (filePath) {
17102
- configUrl = filePath;
17103
- }
17104
- else if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) }) !== 'undefined' && typeof (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) === 'string') {
17105
- // ES module: resolve relative to this file
17106
- try {
17107
- const mod = yield (new Function("return import('./config.json').catch(() => ({}))"))();
17108
- _cachedConfig = (_a = mod.default) !== null && _a !== void 0 ? _a : {};
17109
- return _cachedConfig;
17110
- }
17111
- catch (_c) {
17112
- configUrl = 'config.json';
17113
- }
17019
+ catch {
17020
+ configUrl = 'config.json';
17114
17021
  }
17115
- else {
17116
- // browser fallback
17117
- const baseURI = safeGlobalProp('document', 'baseURI');
17118
- try {
17119
- configUrl =
17120
- typeof baseURI === 'string'
17121
- ? new URL('config.json', baseURI).href
17122
- : 'config.json';
17123
- }
17124
- catch (_d) {
17125
- configUrl = 'config.json';
17126
- }
17022
+ }
17023
+ else {
17024
+ // browser fallback
17025
+ const baseURI = safeGlobalProp('document', 'baseURI');
17026
+ try {
17027
+ configUrl =
17028
+ typeof baseURI === 'string'
17029
+ ? new URL('config.json', baseURI).href
17030
+ : 'config.json';
17127
17031
  }
17128
- // 2) if we have a fetch, try HTTP(S)
17129
- const fetchFn = safeGlobalProp('fetch');
17130
- if (typeof fetchFn === 'function') {
17131
- try {
17132
- const res = yield fetchFn(configUrl);
17133
- if (res.ok) {
17134
- const json = yield res.json();
17135
- // cache & return
17136
- _cachedConfig = (_b = json) !== null && _b !== void 0 ? _b : {};
17137
- return _cachedConfig;
17138
- }
17139
- }
17140
- catch (_e) {
17141
- /* swallow */
17142
- }
17032
+ catch {
17033
+ configUrl = 'config.json';
17143
17034
  }
17144
- // 3) Node fallback: try reading from disk (requires your readJsonFile util)
17035
+ }
17036
+ // 2) if we have a fetch, try HTTP(S)
17037
+ const fetchFn = safeGlobalProp('fetch');
17038
+ if (typeof fetchFn === 'function') {
17145
17039
  try {
17146
- const disk = yield readJsonFile(configUrl);
17147
- _cachedConfig = disk !== null && disk !== void 0 ? disk : {};
17148
- return _cachedConfig;
17040
+ const res = await fetchFn(configUrl);
17041
+ if (res.ok) {
17042
+ const json = await res.json();
17043
+ // cache & return
17044
+ _cachedConfig = json ?? {};
17045
+ return _cachedConfig;
17046
+ }
17149
17047
  }
17150
- catch (_f) {
17048
+ catch {
17151
17049
  /* swallow */
17152
17050
  }
17153
- // 4) if all else fails, return an empty config
17154
- _cachedConfig = {};
17051
+ }
17052
+ // 3) Node fallback: try reading from disk (requires your readJsonFile util)
17053
+ try {
17054
+ const disk = await readJsonFile(configUrl);
17055
+ _cachedConfig = disk ?? {};
17155
17056
  return _cachedConfig;
17156
- });
17057
+ }
17058
+ catch {
17059
+ /* swallow */
17060
+ }
17061
+ // 4) if all else fails, return an empty config
17062
+ _cachedConfig = {};
17063
+ return _cachedConfig;
17157
17064
  }
17158
- function getConfig(key) {
17159
- return __awaiter(this, void 0, void 0, function* () {
17160
- const cfg = yield loadConfig();
17161
- return key != null ? cfg[key] : cfg;
17162
- });
17065
+ async function getConfig(key) {
17066
+ const cfg = await loadConfig();
17067
+ return key != null ? cfg[key] : cfg;
17163
17068
  }
17164
17069
 
17165
17070
  /**
@@ -17381,7 +17286,6 @@ exports.getCleanArray = getCleanArray;
17381
17286
  exports.getComponentsUtilsDirectory = getComponentsUtilsDirectory;
17382
17287
  exports.getConfig = getConfig;
17383
17288
  exports.getConfigContent = getConfigContent;
17384
- exports.getConfigVar = getConfigVar;
17385
17289
  exports.getDbConfigsPath = getDbConfigsPath;
17386
17290
  exports.getDirname = getDirname;
17387
17291
  exports.getDistDir = getDistDir;
@@ -17466,6 +17370,8 @@ exports.path_to_url = path_to_url;
17466
17370
  exports.pathjoin = pathjoin;
17467
17371
  exports.processKeywords = processKeywords;
17468
17372
  exports.readJsonFile = readJsonFile;
17373
+ exports.readJsonFileBrowser = readJsonFileBrowser;
17374
+ exports.readJsonFileNode = readJsonFileNode;
17469
17375
  exports.roundPercentage = roundPercentage;
17470
17376
  exports.safeDivide = safeDivide;
17471
17377
  exports.safeGlobalProp = safeGlobalProp;