@adviser/cement 0.2.45 → 0.3.0
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 +228 -207
- package/index.cjs.map +1 -1
- package/index.d.cts +13 -3
- package/index.d.ts +13 -3
- package/index.js +178 -157
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/jsr.json +1 -1
- package/src/uri.ts +29 -6
- package/ts/uri.d.ts +12 -2
- package/ts/uri.d.ts.map +1 -1
- package/ts/uri.js +23 -4
- package/ts/uri.js.map +1 -1
- package/ts/uri.test.js +21 -4
- package/ts/uri.test.js.map +1 -1
package/index.js
CHANGED
@@ -181,16 +181,16 @@ function logValueInternal(val, ctx) {
|
|
181
181
|
}
|
182
182
|
const res = {};
|
183
183
|
const typedVal = val;
|
184
|
-
for (const
|
185
|
-
if (ctx.ignoreAttr.IsSome() && ctx.ignoreAttr.unwrap().test(
|
184
|
+
for (const key2 in typedVal) {
|
185
|
+
if (ctx.ignoreAttr.IsSome() && ctx.ignoreAttr.unwrap().test(key2)) {
|
186
186
|
continue;
|
187
187
|
}
|
188
|
-
const element = typedVal[
|
188
|
+
const element = typedVal[key2];
|
189
189
|
if (element instanceof LogValue) {
|
190
|
-
res[
|
190
|
+
res[key2] = element;
|
191
191
|
} else {
|
192
192
|
if (typeof element !== "function") {
|
193
|
-
res[
|
193
|
+
res[key2] = logValueInternal(element, ctx);
|
194
194
|
}
|
195
195
|
}
|
196
196
|
}
|
@@ -468,37 +468,37 @@ function localStripper(path, restrips, obj) {
|
|
468
468
|
return obj.map((i) => localStripper(path, restrips, i));
|
469
469
|
}
|
470
470
|
const ret = { ...obj };
|
471
|
-
const matcher = (
|
471
|
+
const matcher = (key2, nextPath) => {
|
472
472
|
for (const re of restrips) {
|
473
|
-
if (re.test(
|
473
|
+
if (re.test(key2) || re.test(nextPath)) {
|
474
474
|
return true;
|
475
475
|
}
|
476
476
|
}
|
477
477
|
return false;
|
478
478
|
};
|
479
|
-
for (const
|
480
|
-
if (Object.prototype.hasOwnProperty.call(ret,
|
479
|
+
for (const key2 in ret) {
|
480
|
+
if (Object.prototype.hasOwnProperty.call(ret, key2)) {
|
481
481
|
let nextPath;
|
482
482
|
if (path) {
|
483
|
-
nextPath = [path,
|
483
|
+
nextPath = [path, key2].join(".");
|
484
484
|
} else {
|
485
|
-
nextPath =
|
485
|
+
nextPath = key2;
|
486
486
|
}
|
487
|
-
if (matcher(
|
488
|
-
delete ret[
|
487
|
+
if (matcher(key2, nextPath)) {
|
488
|
+
delete ret[key2];
|
489
489
|
continue;
|
490
490
|
}
|
491
|
-
if (typeof ret[
|
492
|
-
if (Array.isArray(ret[
|
493
|
-
ret[
|
494
|
-
const toDelete = matcher(
|
491
|
+
if (typeof ret[key2] === "object") {
|
492
|
+
if (Array.isArray(ret[key2])) {
|
493
|
+
ret[key2] = ret[key2].reduce((acc, v, i) => {
|
494
|
+
const toDelete = matcher(key2, `${nextPath}[${i}]`);
|
495
495
|
if (!toDelete) {
|
496
496
|
acc.push(localStripper(`${nextPath}[${i}]`, restrips, v));
|
497
497
|
}
|
498
498
|
return acc;
|
499
499
|
}, []);
|
500
500
|
} else {
|
501
|
-
ret[
|
501
|
+
ret[key2] = localStripper(nextPath, restrips, ret[key2]);
|
502
502
|
}
|
503
503
|
}
|
504
504
|
}
|
@@ -507,16 +507,29 @@ function localStripper(path, restrips, obj) {
|
|
507
507
|
}
|
508
508
|
|
509
509
|
// src/uri.ts
|
510
|
-
var
|
511
|
-
|
512
|
-
|
513
|
-
|
510
|
+
var _REQUIRED = class {
|
511
|
+
constructor() {
|
512
|
+
this.val = "REQUIRED";
|
513
|
+
}
|
514
|
+
};
|
515
|
+
var _OPTIONAL = class {
|
516
|
+
constructor() {
|
517
|
+
this.val = "OPTIONAL";
|
518
|
+
}
|
519
|
+
};
|
520
|
+
var key = {
|
521
|
+
REQUIRED: new _REQUIRED(),
|
522
|
+
OPTIONAL: new _OPTIONAL()
|
523
|
+
};
|
524
|
+
function coerceKey(key2, def) {
|
525
|
+
if (typeof key2 === "object") {
|
526
|
+
const keys = Object.keys(key2);
|
514
527
|
if (keys.length !== 1) {
|
515
|
-
throw new Error(`Invalid key: ${JSON.stringify(
|
528
|
+
throw new Error(`Invalid key: ${JSON.stringify(key2)}`);
|
516
529
|
}
|
517
|
-
return { key: keys[0], def:
|
530
|
+
return { key: keys[0], def: key2[keys[0]] };
|
518
531
|
}
|
519
|
-
return { key, def };
|
532
|
+
return { key: key2, def };
|
520
533
|
}
|
521
534
|
function falsy2undef(value) {
|
522
535
|
return value === void 0 || value === null ? void 0 : value;
|
@@ -619,8 +632,8 @@ var MutableURL = class _MutableURL extends URL {
|
|
619
632
|
toString() {
|
620
633
|
let search = "";
|
621
634
|
if (this._sysURL.searchParams.size) {
|
622
|
-
for (const [
|
623
|
-
search += `${!search.length ? "?" : "&"}${
|
635
|
+
for (const [key2, value] of Array.from(this._sysURL.searchParams.entries()).sort((a, b) => a[0].localeCompare(b[0]))) {
|
636
|
+
search += `${!search.length ? "?" : "&"}${key2}=${encodeURIComponent(value)}`;
|
624
637
|
}
|
625
638
|
}
|
626
639
|
let hostpart = "";
|
@@ -655,11 +668,11 @@ function from(fac, strURLUri, defaultProtocol) {
|
|
655
668
|
throw new Error(`Invalid argument: ${typeof strURLUri}`);
|
656
669
|
}
|
657
670
|
}
|
658
|
-
function getParamResult(
|
659
|
-
return `missing parameter: ${
|
671
|
+
function getParamResult(key2, val, msgFn = (key3) => {
|
672
|
+
return `missing parameter: ${key3}`;
|
660
673
|
}) {
|
661
674
|
if (val === void 0) {
|
662
|
-
return Result.Err(msgFn(
|
675
|
+
return Result.Err(msgFn(key2));
|
663
676
|
}
|
664
677
|
return Result.Ok(val);
|
665
678
|
}
|
@@ -667,9 +680,15 @@ function getParamsResult(keys, getParam) {
|
|
667
680
|
const keyDef = keys.flat().reduce(
|
668
681
|
(acc, i) => {
|
669
682
|
if (typeof i === "string") {
|
670
|
-
acc.push({ key: i });
|
683
|
+
acc.push({ key: i, def: void 0, isOptional: false });
|
671
684
|
} else if (typeof i === "object") {
|
672
|
-
acc.push(
|
685
|
+
acc.push(
|
686
|
+
...Object.keys(i).map((k) => ({
|
687
|
+
key: k,
|
688
|
+
def: typeof i[k] === "string" ? i[k] : void 0,
|
689
|
+
isOptional: i[k] instanceof _OPTIONAL
|
690
|
+
}))
|
691
|
+
);
|
673
692
|
}
|
674
693
|
return acc;
|
675
694
|
},
|
@@ -687,7 +706,9 @@ function getParamsResult(keys, getParam) {
|
|
687
706
|
if (typeof kd.def === "string") {
|
688
707
|
result[kd.key] = kd.def;
|
689
708
|
} else {
|
690
|
-
|
709
|
+
if (!kd.isOptional) {
|
710
|
+
errors.push(kd.key);
|
711
|
+
}
|
691
712
|
}
|
692
713
|
} else {
|
693
714
|
result[kd.key] = val;
|
@@ -751,47 +772,47 @@ var BuildURI = class _BuildURI {
|
|
751
772
|
const pathname = "./" + appendUrl.pathname;
|
752
773
|
const basePath = this._url.pathname;
|
753
774
|
this.pathname(relativePath(basePath, pathname));
|
754
|
-
for (const [
|
755
|
-
this.setParam(
|
775
|
+
for (const [key2, value] of appendUrl.getParams) {
|
776
|
+
this.setParam(key2, value);
|
756
777
|
}
|
757
778
|
return this;
|
758
779
|
}
|
759
780
|
cleanParams() {
|
760
|
-
for (const
|
761
|
-
this._url.searchParams.delete(
|
781
|
+
for (const key2 of Array.from(this._url.searchParams.keys())) {
|
782
|
+
this._url.searchParams.delete(key2);
|
762
783
|
}
|
763
784
|
return this;
|
764
785
|
}
|
765
|
-
delParam(
|
766
|
-
this._url.searchParams.delete(
|
786
|
+
delParam(key2) {
|
787
|
+
this._url.searchParams.delete(key2);
|
767
788
|
return this;
|
768
789
|
}
|
769
|
-
defParam(
|
770
|
-
if (!this._url.searchParams.has(
|
771
|
-
this._url.searchParams.set(
|
790
|
+
defParam(key2, str) {
|
791
|
+
if (!this._url.searchParams.has(key2)) {
|
792
|
+
this._url.searchParams.set(key2, str);
|
772
793
|
}
|
773
794
|
return this;
|
774
795
|
}
|
775
|
-
setParam(
|
776
|
-
this._url.searchParams.set(
|
796
|
+
setParam(key2, str) {
|
797
|
+
this._url.searchParams.set(key2, str);
|
777
798
|
return this;
|
778
799
|
}
|
779
|
-
hasParam(
|
780
|
-
return this._url.searchParams.has(
|
800
|
+
hasParam(key2) {
|
801
|
+
return this._url.searchParams.has(key2);
|
781
802
|
}
|
782
803
|
get getParams() {
|
783
804
|
return this._url.searchParams.entries();
|
784
805
|
}
|
785
|
-
getParam(
|
786
|
-
const { key: k, def: d } = coerceKey(
|
806
|
+
getParam(key2, def) {
|
807
|
+
const { key: k, def: d } = coerceKey(key2, def);
|
787
808
|
let val = this._url.searchParams.get(k);
|
788
809
|
if (!falsy2undef(val) && d) {
|
789
810
|
val = d;
|
790
811
|
}
|
791
812
|
return falsy2undef(val);
|
792
813
|
}
|
793
|
-
getParamResult(
|
794
|
-
return getParamResult(
|
814
|
+
getParamResult(key2, msgFn) {
|
815
|
+
return getParamResult(key2, this.getParam(key2), msgFn);
|
795
816
|
}
|
796
817
|
getParamsResult(...keys) {
|
797
818
|
return getParamsResult(keys, this);
|
@@ -834,8 +855,8 @@ var URI = class _URI {
|
|
834
855
|
if (!(fPath.length === 0 || fPath === "/" || fPath === "./")) {
|
835
856
|
intoUrl.pathname(fromUrl.pathname);
|
836
857
|
}
|
837
|
-
for (const [
|
838
|
-
intoUrl.setParam(
|
858
|
+
for (const [key2, value] of fromUrl.getParams) {
|
859
|
+
intoUrl.setParam(key2, value);
|
839
860
|
}
|
840
861
|
return intoUrl.URI();
|
841
862
|
}
|
@@ -888,19 +909,19 @@ var URI = class _URI {
|
|
888
909
|
get getParams() {
|
889
910
|
return this._url.searchParams.entries();
|
890
911
|
}
|
891
|
-
hasParam(
|
892
|
-
return this._url.searchParams.has(
|
912
|
+
hasParam(key2) {
|
913
|
+
return this._url.searchParams.has(key2);
|
893
914
|
}
|
894
|
-
getParam(
|
895
|
-
const { key: k, def: d } = coerceKey(
|
915
|
+
getParam(key2, def) {
|
916
|
+
const { key: k, def: d } = coerceKey(key2, def);
|
896
917
|
let val = this._url.searchParams.get(k);
|
897
918
|
if (!falsy2undef(val) && d) {
|
898
919
|
val = d;
|
899
920
|
}
|
900
921
|
return falsy2undef(val);
|
901
922
|
}
|
902
|
-
getParamResult(
|
903
|
-
return getParamResult(
|
923
|
+
getParamResult(key2, msgFn) {
|
924
|
+
return getParamResult(key2, this.getParam(key2), msgFn);
|
904
925
|
}
|
905
926
|
getParamsResult(...keys) {
|
906
927
|
return getParamsResult(keys, this);
|
@@ -1272,9 +1293,9 @@ var LoggerImpl = class _LoggerImpl {
|
|
1272
1293
|
this.levelHandler.disableLevel(level, ...modules);
|
1273
1294
|
return this;
|
1274
1295
|
}
|
1275
|
-
Module(
|
1276
|
-
this._attributes["module"] = logValue(
|
1277
|
-
this._withAttributes["module"] = logValue(
|
1296
|
+
Module(key2) {
|
1297
|
+
this._attributes["module"] = logValue(key2, toLogValueCtx(this.levelHandler));
|
1298
|
+
this._withAttributes["module"] = logValue(key2, toLogValueCtx(this.levelHandler));
|
1278
1299
|
return this;
|
1279
1300
|
}
|
1280
1301
|
// if the string is "*" it will enable for all modules
|
@@ -1315,10 +1336,10 @@ var LoggerImpl = class _LoggerImpl {
|
|
1315
1336
|
}
|
1316
1337
|
Err(err) {
|
1317
1338
|
var _a;
|
1318
|
-
let
|
1339
|
+
let key2 = "error";
|
1319
1340
|
if (Result.Is(err)) {
|
1320
1341
|
if (err.isOk()) {
|
1321
|
-
|
1342
|
+
key2 = "noerror";
|
1322
1343
|
err = err.Ok();
|
1323
1344
|
} else {
|
1324
1345
|
err = err.Err();
|
@@ -1326,12 +1347,12 @@ var LoggerImpl = class _LoggerImpl {
|
|
1326
1347
|
}
|
1327
1348
|
if (err instanceof Error) {
|
1328
1349
|
if (err.cause) {
|
1329
|
-
this.coerceKey(
|
1350
|
+
this.coerceKey(key2, {
|
1330
1351
|
message: err.message,
|
1331
1352
|
cause: err.cause
|
1332
1353
|
});
|
1333
1354
|
} else {
|
1334
|
-
this._attributes[
|
1355
|
+
this._attributes[key2] = logValue(err.message, toLogValueCtx(this.levelHandler));
|
1335
1356
|
}
|
1336
1357
|
if (this.levelHandler.isStackExposed) {
|
1337
1358
|
this._attributes["stack"] = logValue(
|
@@ -1340,7 +1361,7 @@ var LoggerImpl = class _LoggerImpl {
|
|
1340
1361
|
);
|
1341
1362
|
}
|
1342
1363
|
} else {
|
1343
|
-
this.Any(
|
1364
|
+
this.Any(key2, err);
|
1344
1365
|
}
|
1345
1366
|
return this;
|
1346
1367
|
}
|
@@ -1348,22 +1369,22 @@ var LoggerImpl = class _LoggerImpl {
|
|
1348
1369
|
this._attributes["level"] = logValue(l, toLogValueCtx(this.levelHandler));
|
1349
1370
|
return this;
|
1350
1371
|
}
|
1351
|
-
Ref(
|
1372
|
+
Ref(key2, action) {
|
1352
1373
|
if (typeof action === "function") {
|
1353
|
-
this._attributes[
|
1374
|
+
this._attributes[key2] = logValue(action, toLogValueCtx(this.levelHandler));
|
1354
1375
|
} else if (typeof action.toString === "function") {
|
1355
|
-
this._attributes[
|
1376
|
+
this._attributes[key2] = logValue(() => action.toString(), toLogValueCtx(this.levelHandler));
|
1356
1377
|
} else {
|
1357
|
-
this._attributes[
|
1378
|
+
this._attributes[key2] = logValue("INVALID REF", toLogValueCtx(this.levelHandler));
|
1358
1379
|
}
|
1359
1380
|
return this;
|
1360
1381
|
}
|
1361
|
-
Bool(
|
1362
|
-
this.coerceKey(
|
1382
|
+
Bool(key2, value) {
|
1383
|
+
this.coerceKey(key2, !!value);
|
1363
1384
|
return this;
|
1364
1385
|
}
|
1365
1386
|
Http(...mix) {
|
1366
|
-
const
|
1387
|
+
const key2 = mix.find((x) => typeof x === "string");
|
1367
1388
|
mix = mix.filter((x) => typeof x !== "string");
|
1368
1389
|
const resErrors = mix.filter((x) => Result.Is(x) && x.isErr());
|
1369
1390
|
if (resErrors.length) {
|
@@ -1383,72 +1404,72 @@ var LoggerImpl = class _LoggerImpl {
|
|
1383
1404
|
reqAndOrres = req;
|
1384
1405
|
}
|
1385
1406
|
if (reqAndOrres) {
|
1386
|
-
this.Any(
|
1407
|
+
this.Any(key2 || "Http", reqAndOrres);
|
1387
1408
|
}
|
1388
1409
|
return this;
|
1389
1410
|
}
|
1390
1411
|
Pair(x) {
|
1391
|
-
for (const
|
1392
|
-
const value = x[
|
1412
|
+
for (const key2 of Object.keys(x)) {
|
1413
|
+
const value = x[key2];
|
1393
1414
|
if (value instanceof LogValue) {
|
1394
|
-
this._attributes[
|
1415
|
+
this._attributes[key2] = value;
|
1395
1416
|
continue;
|
1396
1417
|
}
|
1397
1418
|
if (Result.Is(value)) {
|
1398
|
-
this.Result(
|
1419
|
+
this.Result(key2, value);
|
1399
1420
|
continue;
|
1400
1421
|
}
|
1401
|
-
this.Any(
|
1422
|
+
this.Any(key2, value);
|
1402
1423
|
}
|
1403
1424
|
return this;
|
1404
1425
|
}
|
1405
|
-
Result(
|
1426
|
+
Result(key2, res) {
|
1406
1427
|
if (res.isOk()) {
|
1407
|
-
this._attributes[
|
1428
|
+
this._attributes[key2] = logValue(res.Ok(), toLogValueCtx(this.levelHandler));
|
1408
1429
|
} else {
|
1409
1430
|
this.Err(res.Err());
|
1410
1431
|
}
|
1411
1432
|
return this;
|
1412
1433
|
}
|
1413
|
-
Len(value,
|
1414
|
-
this._attributes[
|
1434
|
+
Len(value, key2 = "len") {
|
1435
|
+
this._attributes[key2] = getLen(value, toLogValueCtx(this.levelHandler));
|
1415
1436
|
return this;
|
1416
1437
|
}
|
1417
|
-
Hash(value,
|
1418
|
-
this._attributes[
|
1438
|
+
Hash(value, key2 = "hash") {
|
1439
|
+
this._attributes[key2] = asyncLogValue(
|
1419
1440
|
async () => `${getLen(value, toLogValueCtx(this.levelHandler)).value()}:${await hash(value)}`
|
1420
1441
|
);
|
1421
1442
|
return this;
|
1422
1443
|
}
|
1423
|
-
Url(url,
|
1424
|
-
this.Ref(
|
1444
|
+
Url(url, key2 = "url") {
|
1445
|
+
this.Ref(key2, () => URI.from(url).toString());
|
1425
1446
|
return this;
|
1426
1447
|
}
|
1427
|
-
coerceKey(
|
1428
|
-
if (typeof
|
1429
|
-
this._attributes[
|
1448
|
+
coerceKey(key2, value) {
|
1449
|
+
if (typeof key2 === "string") {
|
1450
|
+
this._attributes[key2] = logValue(value, toLogValueCtx(this.levelHandler));
|
1430
1451
|
} else {
|
1431
|
-
this.Pair(
|
1452
|
+
this.Pair(key2);
|
1432
1453
|
}
|
1433
1454
|
}
|
1434
|
-
Str(
|
1435
|
-
this.coerceKey(
|
1455
|
+
Str(key2, value) {
|
1456
|
+
this.coerceKey(key2, value);
|
1436
1457
|
return this;
|
1437
1458
|
}
|
1438
|
-
Any(
|
1439
|
-
this.coerceKey(
|
1459
|
+
Any(key2, value) {
|
1460
|
+
this.coerceKey(key2, value);
|
1440
1461
|
return this;
|
1441
1462
|
}
|
1442
|
-
Dur(
|
1443
|
-
this._attributes[
|
1463
|
+
Dur(key2, nsec) {
|
1464
|
+
this._attributes[key2] = logValue(`${nsec}ms`, toLogValueCtx(this.levelHandler));
|
1444
1465
|
return this;
|
1445
1466
|
}
|
1446
|
-
Uint64(
|
1447
|
-
this.coerceKey(
|
1467
|
+
Uint64(key2, value) {
|
1468
|
+
this.coerceKey(key2, value);
|
1448
1469
|
return this;
|
1449
1470
|
}
|
1450
|
-
Int(
|
1451
|
-
return this.Uint64(
|
1471
|
+
Int(key2, value) {
|
1472
|
+
return this.Uint64(key2, value);
|
1452
1473
|
}
|
1453
1474
|
async Flush() {
|
1454
1475
|
return new Promise((resolve) => {
|
@@ -1471,8 +1492,8 @@ var LoggerImpl = class _LoggerImpl {
|
|
1471
1492
|
}
|
1472
1493
|
_resetAttributes(fn) {
|
1473
1494
|
const ret = fn();
|
1474
|
-
Object.keys(this._attributes).forEach((
|
1475
|
-
delete this._attributes[
|
1495
|
+
Object.keys(this._attributes).forEach((key2) => {
|
1496
|
+
delete this._attributes[key2];
|
1476
1497
|
});
|
1477
1498
|
Object.assign(this._attributes, this._withAttributes);
|
1478
1499
|
return ret;
|
@@ -1539,8 +1560,8 @@ var WithLoggerBuilder = class {
|
|
1539
1560
|
this._li.levelHandler.enableLevel(level, ...modules);
|
1540
1561
|
return this;
|
1541
1562
|
}
|
1542
|
-
Module(
|
1543
|
-
this._li.Module(
|
1563
|
+
Module(key2) {
|
1564
|
+
this._li.Module(key2);
|
1544
1565
|
return this;
|
1545
1566
|
}
|
1546
1567
|
SetDebug(...modules) {
|
@@ -1555,36 +1576,36 @@ var WithLoggerBuilder = class {
|
|
1555
1576
|
this._li.Pair(x);
|
1556
1577
|
return this;
|
1557
1578
|
}
|
1558
|
-
Str(
|
1559
|
-
this._li.Str(
|
1579
|
+
Str(key2, value) {
|
1580
|
+
this._li.Str(key2, value);
|
1560
1581
|
return this;
|
1561
1582
|
}
|
1562
|
-
Len(value,
|
1563
|
-
this._li.Len(value,
|
1583
|
+
Len(value, key2) {
|
1584
|
+
this._li.Len(value, key2);
|
1564
1585
|
return this;
|
1565
1586
|
}
|
1566
|
-
Hash(value,
|
1567
|
-
this._li.Hash(value,
|
1587
|
+
Hash(value, key2) {
|
1588
|
+
this._li.Hash(value, key2);
|
1568
1589
|
return this;
|
1569
1590
|
}
|
1570
|
-
Ref(
|
1571
|
-
this._li.Ref(
|
1591
|
+
Ref(key2, action) {
|
1592
|
+
this._li.Ref(key2, action);
|
1572
1593
|
return this;
|
1573
1594
|
}
|
1574
|
-
Bool(
|
1575
|
-
this._li.Bool(
|
1595
|
+
Bool(key2, value) {
|
1596
|
+
this._li.Bool(key2, value);
|
1576
1597
|
return this;
|
1577
1598
|
}
|
1578
|
-
Result(
|
1579
|
-
this._li.Result(
|
1599
|
+
Result(key2, res) {
|
1600
|
+
this._li.Result(key2, res);
|
1580
1601
|
return this;
|
1581
1602
|
}
|
1582
|
-
Url(url,
|
1583
|
-
this._li.Url(url,
|
1603
|
+
Url(url, key2) {
|
1604
|
+
this._li.Url(url, key2);
|
1584
1605
|
return this;
|
1585
1606
|
}
|
1586
|
-
Int(
|
1587
|
-
this._li.Int(
|
1607
|
+
Int(key2, value) {
|
1608
|
+
this._li.Int(key2, value);
|
1588
1609
|
return this;
|
1589
1610
|
}
|
1590
1611
|
Log() {
|
@@ -1619,16 +1640,16 @@ var WithLoggerBuilder = class {
|
|
1619
1640
|
this._li.Timestamp();
|
1620
1641
|
return this;
|
1621
1642
|
}
|
1622
|
-
Any(
|
1623
|
-
this._li.Any(
|
1643
|
+
Any(key2, value) {
|
1644
|
+
this._li.Any(key2, value);
|
1624
1645
|
return this;
|
1625
1646
|
}
|
1626
|
-
Dur(
|
1627
|
-
this._li.Dur(
|
1647
|
+
Dur(key2, nsec) {
|
1648
|
+
this._li.Dur(key2, nsec);
|
1628
1649
|
return this;
|
1629
1650
|
}
|
1630
|
-
Uint64(
|
1631
|
-
this._li.Uint64(
|
1651
|
+
Uint64(key2, value) {
|
1652
|
+
this._li.Uint64(key2, value);
|
1632
1653
|
return this;
|
1633
1654
|
}
|
1634
1655
|
};
|
@@ -1767,8 +1788,8 @@ var Metrics = class {
|
|
1767
1788
|
}
|
1768
1789
|
toJSON() {
|
1769
1790
|
const obj = {};
|
1770
|
-
for (const [
|
1771
|
-
obj[
|
1791
|
+
for (const [key2, value] of this.map) {
|
1792
|
+
obj[key2] = value.value;
|
1772
1793
|
}
|
1773
1794
|
return obj;
|
1774
1795
|
}
|
@@ -1941,15 +1962,15 @@ var HeadersImpl = class extends Headers {
|
|
1941
1962
|
values() {
|
1942
1963
|
return this._headers.values();
|
1943
1964
|
}
|
1944
|
-
append(
|
1945
|
-
const values = this._headers.get(
|
1965
|
+
append(key2, value) {
|
1966
|
+
const values = this._headers.get(key2);
|
1946
1967
|
if (typeof value === "undefined") {
|
1947
1968
|
value = "";
|
1948
1969
|
}
|
1949
1970
|
if (Array.isArray(value)) {
|
1950
|
-
this._headers.set(
|
1971
|
+
this._headers.set(key2, [values, ...value].filter((i) => i).join(", "));
|
1951
1972
|
} else {
|
1952
|
-
this._headers.set(
|
1973
|
+
this._headers.set(key2, [values, value].filter((i) => i).join(", "));
|
1953
1974
|
}
|
1954
1975
|
return this;
|
1955
1976
|
}
|
@@ -1992,38 +2013,38 @@ var HttpHeader = class _HttpHeader {
|
|
1992
2013
|
}
|
1993
2014
|
_asStringString() {
|
1994
2015
|
const ret = /* @__PURE__ */ new Map();
|
1995
|
-
for (const [
|
1996
|
-
ret.set(
|
2016
|
+
for (const [key2, values] of this._headers) {
|
2017
|
+
ret.set(key2, values.join(", "));
|
1997
2018
|
}
|
1998
2019
|
return ret;
|
1999
2020
|
}
|
2000
|
-
_key(
|
2001
|
-
return
|
2021
|
+
_key(key2) {
|
2022
|
+
return key2.toLowerCase();
|
2002
2023
|
}
|
2003
|
-
Values(
|
2004
|
-
const values = this._headers.get(this._key(
|
2024
|
+
Values(key2) {
|
2025
|
+
const values = this._headers.get(this._key(key2));
|
2005
2026
|
return values || [];
|
2006
2027
|
}
|
2007
|
-
Get(
|
2008
|
-
const values = this._headers.get(this._key(
|
2028
|
+
Get(key2) {
|
2029
|
+
const values = this._headers.get(this._key(key2));
|
2009
2030
|
if (values === void 0 || values.length === 0) {
|
2010
2031
|
return void 0;
|
2011
2032
|
}
|
2012
2033
|
return values[0];
|
2013
2034
|
}
|
2014
|
-
Set(
|
2035
|
+
Set(key2, valueOr) {
|
2015
2036
|
const value = Array.isArray(valueOr) ? valueOr : [valueOr];
|
2016
|
-
this._headers.set(this._key(
|
2037
|
+
this._headers.set(this._key(key2), value);
|
2017
2038
|
return this;
|
2018
2039
|
}
|
2019
|
-
Add(
|
2040
|
+
Add(key2, value) {
|
2020
2041
|
if (typeof value === "undefined") {
|
2021
2042
|
return this;
|
2022
2043
|
}
|
2023
2044
|
const vs = Array.isArray(value) ? value : [value];
|
2024
|
-
const values = this._headers.get(this._key(
|
2045
|
+
const values = this._headers.get(this._key(key2));
|
2025
2046
|
if (values === void 0) {
|
2026
|
-
this._headers.set(this._key(
|
2047
|
+
this._headers.set(this._key(key2), vs);
|
2027
2048
|
} else {
|
2028
2049
|
values.push(...vs);
|
2029
2050
|
}
|
@@ -2041,29 +2062,29 @@ var HttpHeader = class _HttpHeader {
|
|
2041
2062
|
}
|
2042
2063
|
Clone() {
|
2043
2064
|
const clone = new _HttpHeader();
|
2044
|
-
for (const [
|
2045
|
-
clone._headers.set(
|
2065
|
+
for (const [key2, values] of this._headers.entries()) {
|
2066
|
+
clone._headers.set(key2, values.slice());
|
2046
2067
|
}
|
2047
2068
|
return clone;
|
2048
2069
|
}
|
2049
2070
|
AsRecordStringStringArray() {
|
2050
2071
|
const obj = {};
|
2051
|
-
for (const [
|
2052
|
-
obj[
|
2072
|
+
for (const [key2, values] of this._headers.entries()) {
|
2073
|
+
obj[key2] = [...values];
|
2053
2074
|
}
|
2054
2075
|
return obj;
|
2055
2076
|
}
|
2056
2077
|
AsRecordStringString() {
|
2057
2078
|
const obj = {};
|
2058
|
-
for (const [
|
2059
|
-
obj[
|
2079
|
+
for (const [key2, values] of this._headers.entries()) {
|
2080
|
+
obj[key2] = values.join(", ");
|
2060
2081
|
}
|
2061
2082
|
return obj;
|
2062
2083
|
}
|
2063
2084
|
AsHeaderInit() {
|
2064
2085
|
const obj = {};
|
2065
|
-
for (const [
|
2066
|
-
obj[
|
2086
|
+
for (const [key2, values] of this._headers.entries()) {
|
2087
|
+
obj[key2] = values[0];
|
2067
2088
|
}
|
2068
2089
|
return obj;
|
2069
2090
|
}
|
@@ -2073,8 +2094,8 @@ var HttpHeader = class _HttpHeader {
|
|
2073
2094
|
Merge(other) {
|
2074
2095
|
const ret = this.Clone();
|
2075
2096
|
if (other) {
|
2076
|
-
for (const [
|
2077
|
-
ret.Add(
|
2097
|
+
for (const [key2, values] of other.Items()) {
|
2098
|
+
ret.Add(key2, values);
|
2078
2099
|
}
|
2079
2100
|
}
|
2080
2101
|
return ret;
|
@@ -2109,7 +2130,6 @@ export {
|
|
2109
2130
|
MutableURL,
|
2110
2131
|
None,
|
2111
2132
|
Option,
|
2112
|
-
REQUIRED,
|
2113
2133
|
RandomMode,
|
2114
2134
|
RandomService,
|
2115
2135
|
ResolveOnce,
|
@@ -2139,6 +2159,7 @@ export {
|
|
2139
2159
|
exception2Result,
|
2140
2160
|
hasHostPartProtocols,
|
2141
2161
|
isURL,
|
2162
|
+
key,
|
2142
2163
|
logValue,
|
2143
2164
|
runtimeFn,
|
2144
2165
|
toCryptoRuntime,
|