@adviser/cement 0.2.45 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -14,9 +14,9 @@ var __export = (target, all) => {
14
14
  };
15
15
  var __copyProps = (to, from2, except, desc) => {
16
16
  if (from2 && typeof from2 === "object" || typeof from2 === "function") {
17
- for (let key of __getOwnPropNames(from2))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
17
+ for (let key2 of __getOwnPropNames(from2))
18
+ if (!__hasOwnProp.call(to, key2) && key2 !== except)
19
+ __defProp(to, key2, { get: () => from2[key2], enumerable: !(desc = __getOwnPropDesc(from2, key2)) || desc.enumerable });
20
20
  }
21
21
  return to;
22
22
  };
@@ -65,7 +65,6 @@ __export(src_exports, {
65
65
  MutableURL: () => MutableURL,
66
66
  None: () => None,
67
67
  Option: () => Option,
68
- REQUIRED: () => REQUIRED,
69
68
  RandomMode: () => RandomMode,
70
69
  RandomService: () => RandomService,
71
70
  ResolveOnce: () => ResolveOnce,
@@ -95,7 +94,9 @@ __export(src_exports, {
95
94
  exception2Result: () => exception2Result,
96
95
  hasHostPartProtocols: () => hasHostPartProtocols,
97
96
  isURL: () => isURL,
97
+ key: () => key,
98
98
  logValue: () => logValue,
99
+ registerEnvAction: () => registerEnvAction,
99
100
  runtimeFn: () => runtimeFn,
100
101
  toCryptoRuntime: () => toCryptoRuntime,
101
102
  utils: () => utils_exports
@@ -247,16 +248,16 @@ function logValueInternal(val, ctx) {
247
248
  }
248
249
  const res = {};
249
250
  const typedVal = val;
250
- for (const key in typedVal) {
251
- if (ctx.ignoreAttr.IsSome() && ctx.ignoreAttr.unwrap().test(key)) {
251
+ for (const key2 in typedVal) {
252
+ if (ctx.ignoreAttr.IsSome() && ctx.ignoreAttr.unwrap().test(key2)) {
252
253
  continue;
253
254
  }
254
- const element = typedVal[key];
255
+ const element = typedVal[key2];
255
256
  if (element instanceof LogValue) {
256
- res[key] = element;
257
+ res[key2] = element;
257
258
  } else {
258
259
  if (typeof element !== "function") {
259
- res[key] = logValueInternal(element, ctx);
260
+ res[key2] = logValueInternal(element, ctx);
260
261
  }
261
262
  }
262
263
  }
@@ -663,24 +664,24 @@ var Keyed = class {
663
664
  this._map = /* @__PURE__ */ new Map();
664
665
  this.factory = factory;
665
666
  }
666
- async asyncGet(key) {
667
- return this.get(await key());
667
+ async asyncGet(key2) {
668
+ return this.get(await key2());
668
669
  }
669
- get(key) {
670
- if (typeof key === "function") {
671
- key = key();
670
+ get(key2) {
671
+ if (typeof key2 === "function") {
672
+ key2 = key2();
672
673
  }
673
- let keyed = this._map.get(key);
674
+ let keyed = this._map.get(key2);
674
675
  if (!keyed) {
675
- keyed = this.factory(key);
676
- this._map.set(key, keyed);
676
+ keyed = this.factory(key2);
677
+ this._map.set(key2, keyed);
677
678
  }
678
679
  return keyed;
679
680
  }
680
- unget(key) {
681
- const keyed = this._map.get(key);
681
+ unget(key2) {
682
+ const keyed = this._map.get(key2);
682
683
  keyed == null ? void 0 : keyed.reset();
683
- this._map.delete(key);
684
+ this._map.delete(key2);
684
685
  }
685
686
  reset() {
686
687
  this._map.forEach((keyed) => keyed.reset());
@@ -689,12 +690,12 @@ var Keyed = class {
689
690
  };
690
691
  var KeyedResolvOnce = class extends Keyed {
691
692
  constructor() {
692
- super((key) => new ResolveOnce(key));
693
+ super((key2) => new ResolveOnce(key2));
693
694
  }
694
695
  };
695
696
  var KeyedResolvSeq = class extends Keyed {
696
697
  constructor() {
697
- super((key) => new ResolveSeq(key));
698
+ super((key2) => new ResolveSeq(key2));
698
699
  }
699
700
  };
700
701
 
@@ -715,16 +716,16 @@ var NodeEnvActions = class {
715
716
  keys() {
716
717
  return Object.keys(this._env);
717
718
  }
718
- get(key) {
719
- return this._env[key];
719
+ get(key2) {
720
+ return this._env[key2];
720
721
  }
721
- set(key, value) {
722
+ set(key2, value) {
722
723
  if (value) {
723
- this._env[key] = value;
724
+ this._env[key2] = value;
724
725
  }
725
726
  }
726
- delete(key) {
727
- delete this._env[key];
727
+ delete(key2) {
728
+ delete this._env[key2];
728
729
  }
729
730
  };
730
731
  _node = new WeakMap();
@@ -746,16 +747,16 @@ var DenoEnvActions = class {
746
747
  keys() {
747
748
  return Array.from(this._env.keys());
748
749
  }
749
- get(key) {
750
- return this._env.get(key);
750
+ get(key2) {
751
+ return this._env.get(key2);
751
752
  }
752
- set(key, value) {
753
+ set(key2, value) {
753
754
  if (value) {
754
- this._env.set(key, value);
755
+ this._env.set(key2, value);
755
756
  }
756
757
  }
757
- delete(key) {
758
- this._env.delete(key);
758
+ delete(key2) {
759
+ this._env.delete(key2);
759
760
  }
760
761
  };
761
762
  _deno = new WeakMap();
@@ -764,16 +765,16 @@ var BrowserEnvActions = class {
764
765
  this.env = /* @__PURE__ */ new Map();
765
766
  this.opts = opts;
766
767
  }
767
- get(key) {
768
- return this.env.get(key);
768
+ get(key2) {
769
+ return this.env.get(key2);
769
770
  }
770
- set(key, value) {
771
+ set(key2, value) {
771
772
  if (value) {
772
- this.env.set(key, value);
773
+ this.env.set(key2, value);
773
774
  }
774
775
  }
775
- delete(key) {
776
- this.env.delete(key);
776
+ delete(key2) {
777
+ this.env.delete(key2);
777
778
  }
778
779
  keys() {
779
780
  return Array.from(this.env.keys());
@@ -788,10 +789,26 @@ var BrowserEnvActions = class {
788
789
  return env;
789
790
  }
790
791
  };
792
+ var envActions = [
793
+ { id: "node", fn: (opts) => new NodeEnvActions(opts) },
794
+ { id: "deno", fn: (opts) => new DenoEnvActions(opts) },
795
+ { id: "browser", fn: (opts) => new BrowserEnvActions(opts) }
796
+ ];
797
+ function registerEnvAction(fn) {
798
+ const id = `id-${Math.random()}`;
799
+ envActions.unshift({ id, fn });
800
+ _envFactory.reset();
801
+ return () => {
802
+ const index = envActions.findIndex((i) => i.id === id);
803
+ if (index >= 0) {
804
+ envActions.splice(index, 1);
805
+ }
806
+ };
807
+ }
791
808
  var _envFactory = new ResolveOnce();
792
809
  function envFactory(opts = {}) {
793
810
  return _envFactory.once(() => {
794
- const found = [new NodeEnvActions(opts), new DenoEnvActions(opts), new BrowserEnvActions(opts)].find((env) => env.active());
811
+ const found = envActions.map((facItem) => facItem.fn(opts)).find((env) => env.active());
795
812
  if (!found) {
796
813
  throw new Error("SysContainer:envFactory: no env available");
797
814
  }
@@ -810,15 +827,15 @@ var EnvImpl = class {
810
827
  if (!presetEnv) {
811
828
  return;
812
829
  }
813
- for (const [key, value] of presetEnv) {
814
- this._map.set(key, value);
830
+ for (const [key2, value] of presetEnv) {
831
+ this._map.set(key2, value);
815
832
  }
816
833
  }
817
- _applyOnSet(onSet, key, value) {
834
+ _applyOnSet(onSet, key2, value) {
818
835
  onSet.forEach((item) => {
819
836
  let keys = [];
820
- if (key) {
821
- keys = [key];
837
+ if (key2) {
838
+ keys = [key2];
822
839
  } else {
823
840
  keys = this._map.keys();
824
841
  }
@@ -832,9 +849,9 @@ var EnvImpl = class {
832
849
  return false;
833
850
  }).forEach((k) => {
834
851
  let v;
835
- if (!key && !value) {
852
+ if (!key2 && !value) {
836
853
  v = this._map.get(k);
837
- } else if (key && !value) {
854
+ } else if (key2 && !value) {
838
855
  v = void 0;
839
856
  } else {
840
857
  v = value;
@@ -852,19 +869,19 @@ var EnvImpl = class {
852
869
  this._onSet.push(item);
853
870
  this._applyOnSet([item]);
854
871
  }
855
- get(key) {
856
- return this._map.get(key);
872
+ get(key2) {
873
+ return this._map.get(key2);
857
874
  }
858
- set(key, value) {
875
+ set(key2, value) {
859
876
  if (!value) {
860
877
  return;
861
878
  }
862
- this._map.set(key, value);
863
- this._applyOnSet(this._onSet, key, value);
879
+ this._map.set(key2, value);
880
+ this._applyOnSet(this._onSet, key2, value);
864
881
  }
865
- delete(key) {
866
- this._map.delete(key);
867
- this._applyOnSet(this._onSet, key);
882
+ delete(key2) {
883
+ this._map.delete(key2);
884
+ this._applyOnSet(this._onSet, key2);
868
885
  }
869
886
  };
870
887
 
@@ -1202,37 +1219,37 @@ function localStripper(path, restrips, obj) {
1202
1219
  return obj.map((i) => localStripper(path, restrips, i));
1203
1220
  }
1204
1221
  const ret = { ...obj };
1205
- const matcher = (key, nextPath) => {
1222
+ const matcher = (key2, nextPath) => {
1206
1223
  for (const re of restrips) {
1207
- if (re.test(key) || re.test(nextPath)) {
1224
+ if (re.test(key2) || re.test(nextPath)) {
1208
1225
  return true;
1209
1226
  }
1210
1227
  }
1211
1228
  return false;
1212
1229
  };
1213
- for (const key in ret) {
1214
- if (Object.prototype.hasOwnProperty.call(ret, key)) {
1230
+ for (const key2 in ret) {
1231
+ if (Object.prototype.hasOwnProperty.call(ret, key2)) {
1215
1232
  let nextPath;
1216
1233
  if (path) {
1217
- nextPath = [path, key].join(".");
1234
+ nextPath = [path, key2].join(".");
1218
1235
  } else {
1219
- nextPath = key;
1236
+ nextPath = key2;
1220
1237
  }
1221
- if (matcher(key, nextPath)) {
1222
- delete ret[key];
1238
+ if (matcher(key2, nextPath)) {
1239
+ delete ret[key2];
1223
1240
  continue;
1224
1241
  }
1225
- if (typeof ret[key] === "object") {
1226
- if (Array.isArray(ret[key])) {
1227
- ret[key] = ret[key].reduce((acc, v, i) => {
1228
- const toDelete = matcher(key, `${nextPath}[${i}]`);
1242
+ if (typeof ret[key2] === "object") {
1243
+ if (Array.isArray(ret[key2])) {
1244
+ ret[key2] = ret[key2].reduce((acc, v, i) => {
1245
+ const toDelete = matcher(key2, `${nextPath}[${i}]`);
1229
1246
  if (!toDelete) {
1230
1247
  acc.push(localStripper(`${nextPath}[${i}]`, restrips, v));
1231
1248
  }
1232
1249
  return acc;
1233
1250
  }, []);
1234
1251
  } else {
1235
- ret[key] = localStripper(nextPath, restrips, ret[key]);
1252
+ ret[key2] = localStripper(nextPath, restrips, ret[key2]);
1236
1253
  }
1237
1254
  }
1238
1255
  }
@@ -1241,16 +1258,29 @@ function localStripper(path, restrips, obj) {
1241
1258
  }
1242
1259
 
1243
1260
  // src/uri.ts
1244
- var REQUIRED = 4711;
1245
- function coerceKey(key, def) {
1246
- if (typeof key === "object") {
1247
- const keys = Object.keys(key);
1261
+ var _REQUIRED = class {
1262
+ constructor() {
1263
+ this.val = "REQUIRED";
1264
+ }
1265
+ };
1266
+ var _OPTIONAL = class {
1267
+ constructor() {
1268
+ this.val = "OPTIONAL";
1269
+ }
1270
+ };
1271
+ var key = {
1272
+ REQUIRED: new _REQUIRED(),
1273
+ OPTIONAL: new _OPTIONAL()
1274
+ };
1275
+ function coerceKey(key2, def) {
1276
+ if (typeof key2 === "object") {
1277
+ const keys = Object.keys(key2);
1248
1278
  if (keys.length !== 1) {
1249
- throw new Error(`Invalid key: ${JSON.stringify(key)}`);
1279
+ throw new Error(`Invalid key: ${JSON.stringify(key2)}`);
1250
1280
  }
1251
- return { key: keys[0], def: key[keys[0]] };
1281
+ return { key: keys[0], def: key2[keys[0]] };
1252
1282
  }
1253
- return { key, def };
1283
+ return { key: key2, def };
1254
1284
  }
1255
1285
  function falsy2undef(value) {
1256
1286
  return value === void 0 || value === null ? void 0 : value;
@@ -1353,8 +1383,8 @@ var MutableURL = class _MutableURL extends URL {
1353
1383
  toString() {
1354
1384
  let search = "";
1355
1385
  if (this._sysURL.searchParams.size) {
1356
- for (const [key, value] of Array.from(this._sysURL.searchParams.entries()).sort((a, b) => a[0].localeCompare(b[0]))) {
1357
- search += `${!search.length ? "?" : "&"}${key}=${encodeURIComponent(value)}`;
1386
+ for (const [key2, value] of Array.from(this._sysURL.searchParams.entries()).sort((a, b) => a[0].localeCompare(b[0]))) {
1387
+ search += `${!search.length ? "?" : "&"}${key2}=${encodeURIComponent(value)}`;
1358
1388
  }
1359
1389
  }
1360
1390
  let hostpart = "";
@@ -1389,11 +1419,11 @@ function from(fac, strURLUri, defaultProtocol) {
1389
1419
  throw new Error(`Invalid argument: ${typeof strURLUri}`);
1390
1420
  }
1391
1421
  }
1392
- function getParamResult(key, val, msgFn = (key2) => {
1393
- return `missing parameter: ${key2}`;
1422
+ function getParamResult(key2, val, msgFn = (key3) => {
1423
+ return `missing parameter: ${key3}`;
1394
1424
  }) {
1395
1425
  if (val === void 0) {
1396
- return Result.Err(msgFn(key));
1426
+ return Result.Err(msgFn(key2));
1397
1427
  }
1398
1428
  return Result.Ok(val);
1399
1429
  }
@@ -1401,9 +1431,15 @@ function getParamsResult(keys, getParam) {
1401
1431
  const keyDef = keys.flat().reduce(
1402
1432
  (acc, i) => {
1403
1433
  if (typeof i === "string") {
1404
- acc.push({ key: i });
1434
+ acc.push({ key: i, def: void 0, isOptional: false });
1405
1435
  } else if (typeof i === "object") {
1406
- acc.push(...Object.keys(i).map((k) => ({ key: k, def: typeof i[k] === "string" ? i[k] : void 0 })));
1436
+ acc.push(
1437
+ ...Object.keys(i).map((k) => ({
1438
+ key: k,
1439
+ def: typeof i[k] === "string" ? i[k] : void 0,
1440
+ isOptional: i[k] instanceof _OPTIONAL
1441
+ }))
1442
+ );
1407
1443
  }
1408
1444
  return acc;
1409
1445
  },
@@ -1421,7 +1457,9 @@ function getParamsResult(keys, getParam) {
1421
1457
  if (typeof kd.def === "string") {
1422
1458
  result[kd.key] = kd.def;
1423
1459
  } else {
1424
- errors.push(kd.key);
1460
+ if (!kd.isOptional) {
1461
+ errors.push(kd.key);
1462
+ }
1425
1463
  }
1426
1464
  } else {
1427
1465
  result[kd.key] = val;
@@ -1485,47 +1523,47 @@ var BuildURI = class _BuildURI {
1485
1523
  const pathname = "./" + appendUrl.pathname;
1486
1524
  const basePath = this._url.pathname;
1487
1525
  this.pathname(relativePath(basePath, pathname));
1488
- for (const [key, value] of appendUrl.getParams) {
1489
- this.setParam(key, value);
1526
+ for (const [key2, value] of appendUrl.getParams) {
1527
+ this.setParam(key2, value);
1490
1528
  }
1491
1529
  return this;
1492
1530
  }
1493
1531
  cleanParams() {
1494
- for (const key of Array.from(this._url.searchParams.keys())) {
1495
- this._url.searchParams.delete(key);
1532
+ for (const key2 of Array.from(this._url.searchParams.keys())) {
1533
+ this._url.searchParams.delete(key2);
1496
1534
  }
1497
1535
  return this;
1498
1536
  }
1499
- delParam(key) {
1500
- this._url.searchParams.delete(key);
1537
+ delParam(key2) {
1538
+ this._url.searchParams.delete(key2);
1501
1539
  return this;
1502
1540
  }
1503
- defParam(key, str) {
1504
- if (!this._url.searchParams.has(key)) {
1505
- this._url.searchParams.set(key, str);
1541
+ defParam(key2, str) {
1542
+ if (!this._url.searchParams.has(key2)) {
1543
+ this._url.searchParams.set(key2, str);
1506
1544
  }
1507
1545
  return this;
1508
1546
  }
1509
- setParam(key, str) {
1510
- this._url.searchParams.set(key, str);
1547
+ setParam(key2, str) {
1548
+ this._url.searchParams.set(key2, str);
1511
1549
  return this;
1512
1550
  }
1513
- hasParam(key) {
1514
- return this._url.searchParams.has(key);
1551
+ hasParam(key2) {
1552
+ return this._url.searchParams.has(key2);
1515
1553
  }
1516
1554
  get getParams() {
1517
1555
  return this._url.searchParams.entries();
1518
1556
  }
1519
- getParam(key, def) {
1520
- const { key: k, def: d } = coerceKey(key, def);
1557
+ getParam(key2, def) {
1558
+ const { key: k, def: d } = coerceKey(key2, def);
1521
1559
  let val = this._url.searchParams.get(k);
1522
1560
  if (!falsy2undef(val) && d) {
1523
1561
  val = d;
1524
1562
  }
1525
1563
  return falsy2undef(val);
1526
1564
  }
1527
- getParamResult(key, msgFn) {
1528
- return getParamResult(key, this.getParam(key), msgFn);
1565
+ getParamResult(key2, msgFn) {
1566
+ return getParamResult(key2, this.getParam(key2), msgFn);
1529
1567
  }
1530
1568
  getParamsResult(...keys) {
1531
1569
  return getParamsResult(keys, this);
@@ -1568,8 +1606,8 @@ var URI = class _URI {
1568
1606
  if (!(fPath.length === 0 || fPath === "/" || fPath === "./")) {
1569
1607
  intoUrl.pathname(fromUrl.pathname);
1570
1608
  }
1571
- for (const [key, value] of fromUrl.getParams) {
1572
- intoUrl.setParam(key, value);
1609
+ for (const [key2, value] of fromUrl.getParams) {
1610
+ intoUrl.setParam(key2, value);
1573
1611
  }
1574
1612
  return intoUrl.URI();
1575
1613
  }
@@ -1622,19 +1660,19 @@ var URI = class _URI {
1622
1660
  get getParams() {
1623
1661
  return this._url.searchParams.entries();
1624
1662
  }
1625
- hasParam(key) {
1626
- return this._url.searchParams.has(key);
1663
+ hasParam(key2) {
1664
+ return this._url.searchParams.has(key2);
1627
1665
  }
1628
- getParam(key, def) {
1629
- const { key: k, def: d } = coerceKey(key, def);
1666
+ getParam(key2, def) {
1667
+ const { key: k, def: d } = coerceKey(key2, def);
1630
1668
  let val = this._url.searchParams.get(k);
1631
1669
  if (!falsy2undef(val) && d) {
1632
1670
  val = d;
1633
1671
  }
1634
1672
  return falsy2undef(val);
1635
1673
  }
1636
- getParamResult(key, msgFn) {
1637
- return getParamResult(key, this.getParam(key), msgFn);
1674
+ getParamResult(key2, msgFn) {
1675
+ return getParamResult(key2, this.getParam(key2), msgFn);
1638
1676
  }
1639
1677
  getParamsResult(...keys) {
1640
1678
  return getParamsResult(keys, this);
@@ -2070,9 +2108,9 @@ var LoggerImpl = class _LoggerImpl {
2070
2108
  this.levelHandler.disableLevel(level, ...modules);
2071
2109
  return this;
2072
2110
  }
2073
- Module(key) {
2074
- this._attributes["module"] = logValue(key, toLogValueCtx(this.levelHandler));
2075
- this._withAttributes["module"] = logValue(key, toLogValueCtx(this.levelHandler));
2111
+ Module(key2) {
2112
+ this._attributes["module"] = logValue(key2, toLogValueCtx(this.levelHandler));
2113
+ this._withAttributes["module"] = logValue(key2, toLogValueCtx(this.levelHandler));
2076
2114
  return this;
2077
2115
  }
2078
2116
  // if the string is "*" it will enable for all modules
@@ -2113,10 +2151,10 @@ var LoggerImpl = class _LoggerImpl {
2113
2151
  }
2114
2152
  Err(err) {
2115
2153
  var _a;
2116
- let key = "error";
2154
+ let key2 = "error";
2117
2155
  if (Result.Is(err)) {
2118
2156
  if (err.isOk()) {
2119
- key = "noerror";
2157
+ key2 = "noerror";
2120
2158
  err = err.Ok();
2121
2159
  } else {
2122
2160
  err = err.Err();
@@ -2124,12 +2162,12 @@ var LoggerImpl = class _LoggerImpl {
2124
2162
  }
2125
2163
  if (err instanceof Error) {
2126
2164
  if (err.cause) {
2127
- this.coerceKey(key, {
2165
+ this.coerceKey(key2, {
2128
2166
  message: err.message,
2129
2167
  cause: err.cause
2130
2168
  });
2131
2169
  } else {
2132
- this._attributes[key] = logValue(err.message, toLogValueCtx(this.levelHandler));
2170
+ this._attributes[key2] = logValue(err.message, toLogValueCtx(this.levelHandler));
2133
2171
  }
2134
2172
  if (this.levelHandler.isStackExposed) {
2135
2173
  this._attributes["stack"] = logValue(
@@ -2138,7 +2176,7 @@ var LoggerImpl = class _LoggerImpl {
2138
2176
  );
2139
2177
  }
2140
2178
  } else {
2141
- this.Any(key, err);
2179
+ this.Any(key2, err);
2142
2180
  }
2143
2181
  return this;
2144
2182
  }
@@ -2146,22 +2184,22 @@ var LoggerImpl = class _LoggerImpl {
2146
2184
  this._attributes["level"] = logValue(l, toLogValueCtx(this.levelHandler));
2147
2185
  return this;
2148
2186
  }
2149
- Ref(key, action) {
2187
+ Ref(key2, action) {
2150
2188
  if (typeof action === "function") {
2151
- this._attributes[key] = logValue(action, toLogValueCtx(this.levelHandler));
2189
+ this._attributes[key2] = logValue(action, toLogValueCtx(this.levelHandler));
2152
2190
  } else if (typeof action.toString === "function") {
2153
- this._attributes[key] = logValue(() => action.toString(), toLogValueCtx(this.levelHandler));
2191
+ this._attributes[key2] = logValue(() => action.toString(), toLogValueCtx(this.levelHandler));
2154
2192
  } else {
2155
- this._attributes[key] = logValue("INVALID REF", toLogValueCtx(this.levelHandler));
2193
+ this._attributes[key2] = logValue("INVALID REF", toLogValueCtx(this.levelHandler));
2156
2194
  }
2157
2195
  return this;
2158
2196
  }
2159
- Bool(key, value) {
2160
- this.coerceKey(key, !!value);
2197
+ Bool(key2, value) {
2198
+ this.coerceKey(key2, !!value);
2161
2199
  return this;
2162
2200
  }
2163
2201
  Http(...mix) {
2164
- const key = mix.find((x) => typeof x === "string");
2202
+ const key2 = mix.find((x) => typeof x === "string");
2165
2203
  mix = mix.filter((x) => typeof x !== "string");
2166
2204
  const resErrors = mix.filter((x) => Result.Is(x) && x.isErr());
2167
2205
  if (resErrors.length) {
@@ -2181,72 +2219,72 @@ var LoggerImpl = class _LoggerImpl {
2181
2219
  reqAndOrres = req;
2182
2220
  }
2183
2221
  if (reqAndOrres) {
2184
- this.Any(key || "Http", reqAndOrres);
2222
+ this.Any(key2 || "Http", reqAndOrres);
2185
2223
  }
2186
2224
  return this;
2187
2225
  }
2188
2226
  Pair(x) {
2189
- for (const key of Object.keys(x)) {
2190
- const value = x[key];
2227
+ for (const key2 of Object.keys(x)) {
2228
+ const value = x[key2];
2191
2229
  if (value instanceof LogValue) {
2192
- this._attributes[key] = value;
2230
+ this._attributes[key2] = value;
2193
2231
  continue;
2194
2232
  }
2195
2233
  if (Result.Is(value)) {
2196
- this.Result(key, value);
2234
+ this.Result(key2, value);
2197
2235
  continue;
2198
2236
  }
2199
- this.Any(key, value);
2237
+ this.Any(key2, value);
2200
2238
  }
2201
2239
  return this;
2202
2240
  }
2203
- Result(key, res) {
2241
+ Result(key2, res) {
2204
2242
  if (res.isOk()) {
2205
- this._attributes[key] = logValue(res.Ok(), toLogValueCtx(this.levelHandler));
2243
+ this._attributes[key2] = logValue(res.Ok(), toLogValueCtx(this.levelHandler));
2206
2244
  } else {
2207
2245
  this.Err(res.Err());
2208
2246
  }
2209
2247
  return this;
2210
2248
  }
2211
- Len(value, key = "len") {
2212
- this._attributes[key] = getLen(value, toLogValueCtx(this.levelHandler));
2249
+ Len(value, key2 = "len") {
2250
+ this._attributes[key2] = getLen(value, toLogValueCtx(this.levelHandler));
2213
2251
  return this;
2214
2252
  }
2215
- Hash(value, key = "hash") {
2216
- this._attributes[key] = asyncLogValue(
2253
+ Hash(value, key2 = "hash") {
2254
+ this._attributes[key2] = asyncLogValue(
2217
2255
  async () => `${getLen(value, toLogValueCtx(this.levelHandler)).value()}:${await hash(value)}`
2218
2256
  );
2219
2257
  return this;
2220
2258
  }
2221
- Url(url, key = "url") {
2222
- this.Ref(key, () => URI.from(url).toString());
2259
+ Url(url, key2 = "url") {
2260
+ this.Ref(key2, () => URI.from(url).toString());
2223
2261
  return this;
2224
2262
  }
2225
- coerceKey(key, value) {
2226
- if (typeof key === "string") {
2227
- this._attributes[key] = logValue(value, toLogValueCtx(this.levelHandler));
2263
+ coerceKey(key2, value) {
2264
+ if (typeof key2 === "string") {
2265
+ this._attributes[key2] = logValue(value, toLogValueCtx(this.levelHandler));
2228
2266
  } else {
2229
- this.Pair(key);
2267
+ this.Pair(key2);
2230
2268
  }
2231
2269
  }
2232
- Str(key, value) {
2233
- this.coerceKey(key, value);
2270
+ Str(key2, value) {
2271
+ this.coerceKey(key2, value);
2234
2272
  return this;
2235
2273
  }
2236
- Any(key, value) {
2237
- this.coerceKey(key, value);
2274
+ Any(key2, value) {
2275
+ this.coerceKey(key2, value);
2238
2276
  return this;
2239
2277
  }
2240
- Dur(key, nsec) {
2241
- this._attributes[key] = logValue(`${nsec}ms`, toLogValueCtx(this.levelHandler));
2278
+ Dur(key2, nsec) {
2279
+ this._attributes[key2] = logValue(`${nsec}ms`, toLogValueCtx(this.levelHandler));
2242
2280
  return this;
2243
2281
  }
2244
- Uint64(key, value) {
2245
- this.coerceKey(key, value);
2282
+ Uint64(key2, value) {
2283
+ this.coerceKey(key2, value);
2246
2284
  return this;
2247
2285
  }
2248
- Int(key, value) {
2249
- return this.Uint64(key, value);
2286
+ Int(key2, value) {
2287
+ return this.Uint64(key2, value);
2250
2288
  }
2251
2289
  async Flush() {
2252
2290
  return new Promise((resolve) => {
@@ -2269,8 +2307,8 @@ var LoggerImpl = class _LoggerImpl {
2269
2307
  }
2270
2308
  _resetAttributes(fn) {
2271
2309
  const ret = fn();
2272
- Object.keys(this._attributes).forEach((key) => {
2273
- delete this._attributes[key];
2310
+ Object.keys(this._attributes).forEach((key2) => {
2311
+ delete this._attributes[key2];
2274
2312
  });
2275
2313
  Object.assign(this._attributes, this._withAttributes);
2276
2314
  return ret;
@@ -2337,8 +2375,8 @@ var WithLoggerBuilder = class {
2337
2375
  this._li.levelHandler.enableLevel(level, ...modules);
2338
2376
  return this;
2339
2377
  }
2340
- Module(key) {
2341
- this._li.Module(key);
2378
+ Module(key2) {
2379
+ this._li.Module(key2);
2342
2380
  return this;
2343
2381
  }
2344
2382
  SetDebug(...modules) {
@@ -2353,36 +2391,36 @@ var WithLoggerBuilder = class {
2353
2391
  this._li.Pair(x);
2354
2392
  return this;
2355
2393
  }
2356
- Str(key, value) {
2357
- this._li.Str(key, value);
2394
+ Str(key2, value) {
2395
+ this._li.Str(key2, value);
2358
2396
  return this;
2359
2397
  }
2360
- Len(value, key) {
2361
- this._li.Len(value, key);
2398
+ Len(value, key2) {
2399
+ this._li.Len(value, key2);
2362
2400
  return this;
2363
2401
  }
2364
- Hash(value, key) {
2365
- this._li.Hash(value, key);
2402
+ Hash(value, key2) {
2403
+ this._li.Hash(value, key2);
2366
2404
  return this;
2367
2405
  }
2368
- Ref(key, action) {
2369
- this._li.Ref(key, action);
2406
+ Ref(key2, action) {
2407
+ this._li.Ref(key2, action);
2370
2408
  return this;
2371
2409
  }
2372
- Bool(key, value) {
2373
- this._li.Bool(key, value);
2410
+ Bool(key2, value) {
2411
+ this._li.Bool(key2, value);
2374
2412
  return this;
2375
2413
  }
2376
- Result(key, res) {
2377
- this._li.Result(key, res);
2414
+ Result(key2, res) {
2415
+ this._li.Result(key2, res);
2378
2416
  return this;
2379
2417
  }
2380
- Url(url, key) {
2381
- this._li.Url(url, key);
2418
+ Url(url, key2) {
2419
+ this._li.Url(url, key2);
2382
2420
  return this;
2383
2421
  }
2384
- Int(key, value) {
2385
- this._li.Int(key, value);
2422
+ Int(key2, value) {
2423
+ this._li.Int(key2, value);
2386
2424
  return this;
2387
2425
  }
2388
2426
  Log() {
@@ -2417,16 +2455,16 @@ var WithLoggerBuilder = class {
2417
2455
  this._li.Timestamp();
2418
2456
  return this;
2419
2457
  }
2420
- Any(key, value) {
2421
- this._li.Any(key, value);
2458
+ Any(key2, value) {
2459
+ this._li.Any(key2, value);
2422
2460
  return this;
2423
2461
  }
2424
- Dur(key, nsec) {
2425
- this._li.Dur(key, nsec);
2462
+ Dur(key2, nsec) {
2463
+ this._li.Dur(key2, nsec);
2426
2464
  return this;
2427
2465
  }
2428
- Uint64(key, value) {
2429
- this._li.Uint64(key, value);
2466
+ Uint64(key2, value) {
2467
+ this._li.Uint64(key2, value);
2430
2468
  return this;
2431
2469
  }
2432
2470
  };
@@ -2591,8 +2629,8 @@ var Metrics = class {
2591
2629
  }
2592
2630
  toJSON() {
2593
2631
  const obj = {};
2594
- for (const [key, value] of this.map) {
2595
- obj[key] = value.value;
2632
+ for (const [key2, value] of this.map) {
2633
+ obj[key2] = value.value;
2596
2634
  }
2597
2635
  return obj;
2598
2636
  }
@@ -2765,15 +2803,15 @@ var HeadersImpl = class extends Headers {
2765
2803
  values() {
2766
2804
  return this._headers.values();
2767
2805
  }
2768
- append(key, value) {
2769
- const values = this._headers.get(key);
2806
+ append(key2, value) {
2807
+ const values = this._headers.get(key2);
2770
2808
  if (typeof value === "undefined") {
2771
2809
  value = "";
2772
2810
  }
2773
2811
  if (Array.isArray(value)) {
2774
- this._headers.set(key, [values, ...value].filter((i) => i).join(", "));
2812
+ this._headers.set(key2, [values, ...value].filter((i) => i).join(", "));
2775
2813
  } else {
2776
- this._headers.set(key, [values, value].filter((i) => i).join(", "));
2814
+ this._headers.set(key2, [values, value].filter((i) => i).join(", "));
2777
2815
  }
2778
2816
  return this;
2779
2817
  }
@@ -2816,38 +2854,38 @@ var HttpHeader = class _HttpHeader {
2816
2854
  }
2817
2855
  _asStringString() {
2818
2856
  const ret = /* @__PURE__ */ new Map();
2819
- for (const [key, values] of this._headers) {
2820
- ret.set(key, values.join(", "));
2857
+ for (const [key2, values] of this._headers) {
2858
+ ret.set(key2, values.join(", "));
2821
2859
  }
2822
2860
  return ret;
2823
2861
  }
2824
- _key(key) {
2825
- return key.toLowerCase();
2862
+ _key(key2) {
2863
+ return key2.toLowerCase();
2826
2864
  }
2827
- Values(key) {
2828
- const values = this._headers.get(this._key(key));
2865
+ Values(key2) {
2866
+ const values = this._headers.get(this._key(key2));
2829
2867
  return values || [];
2830
2868
  }
2831
- Get(key) {
2832
- const values = this._headers.get(this._key(key));
2869
+ Get(key2) {
2870
+ const values = this._headers.get(this._key(key2));
2833
2871
  if (values === void 0 || values.length === 0) {
2834
2872
  return void 0;
2835
2873
  }
2836
2874
  return values[0];
2837
2875
  }
2838
- Set(key, valueOr) {
2876
+ Set(key2, valueOr) {
2839
2877
  const value = Array.isArray(valueOr) ? valueOr : [valueOr];
2840
- this._headers.set(this._key(key), value);
2878
+ this._headers.set(this._key(key2), value);
2841
2879
  return this;
2842
2880
  }
2843
- Add(key, value) {
2881
+ Add(key2, value) {
2844
2882
  if (typeof value === "undefined") {
2845
2883
  return this;
2846
2884
  }
2847
2885
  const vs = Array.isArray(value) ? value : [value];
2848
- const values = this._headers.get(this._key(key));
2886
+ const values = this._headers.get(this._key(key2));
2849
2887
  if (values === void 0) {
2850
- this._headers.set(this._key(key), vs);
2888
+ this._headers.set(this._key(key2), vs);
2851
2889
  } else {
2852
2890
  values.push(...vs);
2853
2891
  }
@@ -2865,29 +2903,29 @@ var HttpHeader = class _HttpHeader {
2865
2903
  }
2866
2904
  Clone() {
2867
2905
  const clone = new _HttpHeader();
2868
- for (const [key, values] of this._headers.entries()) {
2869
- clone._headers.set(key, values.slice());
2906
+ for (const [key2, values] of this._headers.entries()) {
2907
+ clone._headers.set(key2, values.slice());
2870
2908
  }
2871
2909
  return clone;
2872
2910
  }
2873
2911
  AsRecordStringStringArray() {
2874
2912
  const obj = {};
2875
- for (const [key, values] of this._headers.entries()) {
2876
- obj[key] = [...values];
2913
+ for (const [key2, values] of this._headers.entries()) {
2914
+ obj[key2] = [...values];
2877
2915
  }
2878
2916
  return obj;
2879
2917
  }
2880
2918
  AsRecordStringString() {
2881
2919
  const obj = {};
2882
- for (const [key, values] of this._headers.entries()) {
2883
- obj[key] = values.join(", ");
2920
+ for (const [key2, values] of this._headers.entries()) {
2921
+ obj[key2] = values.join(", ");
2884
2922
  }
2885
2923
  return obj;
2886
2924
  }
2887
2925
  AsHeaderInit() {
2888
2926
  const obj = {};
2889
- for (const [key, values] of this._headers.entries()) {
2890
- obj[key] = values[0];
2927
+ for (const [key2, values] of this._headers.entries()) {
2928
+ obj[key2] = values[0];
2891
2929
  }
2892
2930
  return obj;
2893
2931
  }
@@ -2897,8 +2935,8 @@ var HttpHeader = class _HttpHeader {
2897
2935
  Merge(other) {
2898
2936
  const ret = this.Clone();
2899
2937
  if (other) {
2900
- for (const [key, values] of other.Items()) {
2901
- ret.Add(key, values);
2938
+ for (const [key2, values] of other.Items()) {
2939
+ ret.Add(key2, values);
2902
2940
  }
2903
2941
  }
2904
2942
  return ret;
@@ -3133,7 +3171,6 @@ function uint8array2stream(str) {
3133
3171
  MutableURL,
3134
3172
  None,
3135
3173
  Option,
3136
- REQUIRED,
3137
3174
  RandomMode,
3138
3175
  RandomService,
3139
3176
  ResolveOnce,
@@ -3163,7 +3200,9 @@ function uint8array2stream(str) {
3163
3200
  exception2Result,
3164
3201
  hasHostPartProtocols,
3165
3202
  isURL,
3203
+ key,
3166
3204
  logValue,
3205
+ registerEnvAction,
3167
3206
  runtimeFn,
3168
3207
  toCryptoRuntime,
3169
3208
  utils