@adviser/cement 0.3.14 → 0.3.15
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/{base-sys-abstraction-8v83VyEU.d.ts → base-sys-abstraction-BnBZ6zd0.d.ts} +2 -2
- package/{base-sys-abstraction-4Vw4QGaI.d.cts → base-sys-abstraction-DAZ8tx5F.d.cts} +2 -2
- package/cf/index.cjs +46 -18
- package/cf/index.cjs.map +1 -1
- package/cf/index.d.cts +3 -3
- package/cf/index.d.ts +3 -3
- package/cf/index.js +3 -3
- package/{chunk-W53WEZWY.js → chunk-55W4AK2Z.js} +3 -5
- package/{chunk-W53WEZWY.js.map → chunk-55W4AK2Z.js.map} +1 -1
- package/{chunk-22GI5ETU.js → chunk-H3CAVBMO.js} +41 -42
- package/chunk-H3CAVBMO.js.map +1 -0
- package/{chunk-A57BAYWU.js → chunk-LXTKPZ6M.js} +10 -8
- package/chunk-LXTKPZ6M.js.map +1 -0
- package/{chunk-KY47QBK3.js → chunk-WGRZHIFK.js} +155 -152
- package/chunk-WGRZHIFK.js.map +1 -0
- package/{chunk-GLUGMVET.js → chunk-Z3IR6QEZ.js} +3 -3
- package/deno/index.cjs +46 -18
- package/deno/index.cjs.map +1 -1
- package/deno/index.d.cts +3 -3
- package/deno/index.d.ts +3 -3
- package/deno/index.js +2 -2
- package/{get-params-result-C2cbgB78.d.ts → get-params-result-4xHM5s4_.d.cts} +14 -10
- package/{get-params-result-C2cbgB78.d.cts → get-params-result-4xHM5s4_.d.ts} +14 -10
- package/index-CMLb7JSe.d.ts +97 -0
- package/{index-DixRvifF.d.cts → index-Cp1NspHH.d.cts} +10 -10
- package/{index-D2WPDt4R.d.ts → index-D1j1fPYg.d.ts} +10 -10
- package/index-LQOsS7gM.d.cts +97 -0
- package/index.cjs +317 -317
- package/index.cjs.map +1 -1
- package/index.d.cts +9 -11
- package/index.d.ts +9 -11
- package/index.js +35 -40
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/node/index.cjs +46 -18
- package/node/index.cjs.map +1 -1
- package/node/index.d.cts +3 -3
- package/node/index.d.ts +3 -3
- package/node/index.js +2 -2
- package/package.json +5 -4
- package/src/index.ts +3 -2
- package/src/jsr.json +1 -1
- package/src/logger.ts +8 -6
- package/src/sys-abstraction.ts +18 -15
- package/src/time.ts +7 -9
- package/src/types.ts +19 -0
- package/src/uri.ts +4 -3
- package/src/utils/get-params-result.ts +2 -18
- package/src/utils/relative-path.ts +8 -6
- package/{sys-abstraction-3OXhCVsu.d.cts → sys-abstraction-B0x6IE7r.d.ts} +27 -23
- package/{sys-abstraction-DXeSUn9x.d.ts → sys-abstraction-BTs3Vzy4.d.cts} +27 -23
- package/test/index.cjs +87 -46
- package/test/index.cjs.map +1 -1
- package/test/index.d.cts +3 -3
- package/test/index.d.ts +3 -3
- package/test/index.js +4 -4
- package/ts/src/index.d.ts +1 -2
- package/ts/src/index.d.ts.map +1 -1
- package/ts/src/index.js +1 -2
- package/ts/src/index.js.map +1 -1
- package/ts/src/logger.d.ts +7 -6
- package/ts/src/logger.d.ts.map +1 -1
- package/ts/src/logger.js +6 -7
- package/ts/src/logger.js.map +1 -1
- package/ts/src/sys-abstraction.d.ts +18 -15
- package/ts/src/sys-abstraction.d.ts.map +1 -1
- package/ts/src/sys-abstraction.js +15 -18
- package/ts/src/sys-abstraction.js.map +1 -1
- package/ts/src/sys-env.test.js +1 -2
- package/ts/src/sys-env.test.js.map +1 -1
- package/ts/src/time.d.ts +7 -6
- package/ts/src/time.d.ts.map +1 -1
- package/ts/src/time.js +6 -7
- package/ts/src/time.js.map +1 -1
- package/ts/src/types.d.ts +16 -0
- package/ts/src/types.d.ts.map +1 -0
- package/ts/src/types.js +15 -0
- package/ts/src/types.js.map +1 -0
- package/ts/src/uri.d.ts +0 -1
- package/ts/src/uri.d.ts.map +1 -1
- package/ts/src/uri.js +1 -2
- package/ts/src/uri.js.map +1 -1
- package/ts/src/utils/get-params-result.d.ts +2 -13
- package/ts/src/utils/get-params-result.d.ts.map +1 -1
- package/ts/src/utils/get-params-result.js +1 -14
- package/ts/src/utils/get-params-result.js.map +1 -1
- package/ts/src/utils/relative-path.d.ts +7 -6
- package/ts/src/utils/relative-path.d.ts.map +1 -1
- package/ts/src/utils/relative-path.js +6 -7
- package/ts/src/utils/relative-path.js.map +1 -1
- package/utils/index.cjs +9 -9
- package/utils/index.cjs.map +1 -1
- package/utils/index.d.cts +2 -2
- package/utils/index.d.ts +2 -2
- package/utils/index.js +3 -5
- package/web/index.cjs +46 -18
- package/web/index.cjs.map +1 -1
- package/web/index.d.cts +3 -3
- package/web/index.d.ts +3 -3
- package/web/index.js +3 -3
- package/chunk-22GI5ETU.js.map +0 -1
- package/chunk-A57BAYWU.js.map +0 -1
- package/chunk-KY47QBK3.js.map +0 -1
- package/index-Dpc3oVOD.d.cts +0 -99
- package/index-MWn9Xel9.d.ts +0 -99
- /package/{chunk-GLUGMVET.js.map → chunk-Z3IR6QEZ.js.map} +0 -0
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
|
18
|
-
if (!__hasOwnProp.call(to,
|
19
|
-
__defProp(to,
|
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 });
|
20
20
|
}
|
21
21
|
return to;
|
22
22
|
};
|
@@ -95,9 +95,8 @@ __export(index_exports, {
|
|
95
95
|
hasHostPartProtocols: () => hasHostPartProtocols,
|
96
96
|
isCoerceURI: () => isCoerceURI,
|
97
97
|
isURL: () => isURL,
|
98
|
-
key: () => key,
|
99
98
|
logValue: () => logValue,
|
100
|
-
param: () =>
|
99
|
+
param: () => param,
|
101
100
|
pathOps: () => pathOps,
|
102
101
|
registerEnvAction: () => registerEnvAction,
|
103
102
|
runtimeFn: () => runtimeFn,
|
@@ -156,13 +155,12 @@ function bin2string(hex, size = 0) {
|
|
156
155
|
}
|
157
156
|
|
158
157
|
// src/logger.ts
|
159
|
-
var Level =
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
})(Level || {});
|
158
|
+
var Level = {
|
159
|
+
WARN: "warn",
|
160
|
+
DEBUG: "debug",
|
161
|
+
INFO: "info",
|
162
|
+
ERROR: "error"
|
163
|
+
};
|
166
164
|
var LogValue = class {
|
167
165
|
constructor(fn) {
|
168
166
|
this.fn = fn;
|
@@ -256,16 +254,16 @@ function logValueInternal(val, ctx) {
|
|
256
254
|
}
|
257
255
|
const res = {};
|
258
256
|
const typedVal = val;
|
259
|
-
for (const
|
260
|
-
if (ctx.ignoreAttr.IsSome() && ctx.ignoreAttr.unwrap().test(
|
257
|
+
for (const key in typedVal) {
|
258
|
+
if (ctx.ignoreAttr.IsSome() && ctx.ignoreAttr.unwrap().test(key)) {
|
261
259
|
continue;
|
262
260
|
}
|
263
|
-
const element = typedVal[
|
261
|
+
const element = typedVal[key];
|
264
262
|
if (element instanceof LogValue) {
|
265
|
-
res[
|
263
|
+
res[key] = element;
|
266
264
|
} else {
|
267
265
|
if (typeof element !== "function") {
|
268
|
-
res[
|
266
|
+
res[key] = logValueInternal(element, ctx);
|
269
267
|
}
|
270
268
|
}
|
271
269
|
}
|
@@ -300,34 +298,31 @@ function IsLogger(obj) {
|
|
300
298
|
}
|
301
299
|
|
302
300
|
// src/sys-abstraction.ts
|
303
|
-
var TimeMode =
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
IDMode2["STEP"] = "step";
|
319
|
-
return IDMode2;
|
320
|
-
})(IDMode || {});
|
301
|
+
var TimeMode = {
|
302
|
+
REAL: "real",
|
303
|
+
CONST: "const",
|
304
|
+
STEP: "step"
|
305
|
+
};
|
306
|
+
var RandomMode = {
|
307
|
+
CONST: "const",
|
308
|
+
STEP: "step",
|
309
|
+
RANDOM: "random"
|
310
|
+
};
|
311
|
+
var IDMode = {
|
312
|
+
UUID: "uuid",
|
313
|
+
CONST: "const",
|
314
|
+
STEP: "step"
|
315
|
+
};
|
321
316
|
function String2TimeMode(s) {
|
322
317
|
switch (s == null ? void 0 : s.toLowerCase()) {
|
323
318
|
case "real":
|
324
|
-
return
|
319
|
+
return TimeMode.REAL;
|
325
320
|
case "const":
|
326
|
-
return
|
321
|
+
return TimeMode.CONST;
|
327
322
|
case "step":
|
328
|
-
return
|
323
|
+
return TimeMode.STEP;
|
329
324
|
default:
|
330
|
-
return
|
325
|
+
return TimeMode.REAL;
|
331
326
|
}
|
332
327
|
}
|
333
328
|
|
@@ -338,13 +333,15 @@ var Time = class {
|
|
338
333
|
return now.getTime() - start.getTime();
|
339
334
|
}
|
340
335
|
};
|
341
|
-
var TimeUnits =
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
336
|
+
var TimeUnits = {
|
337
|
+
Microsecond: 1,
|
338
|
+
Second: 1e3 * 1,
|
339
|
+
//Microsecond,
|
340
|
+
Minute: 60 * 1e3 * 1,
|
341
|
+
//Second,
|
342
|
+
Hour: 60 * 60 * 1e3 * 1
|
343
|
+
// Minute,
|
344
|
+
};
|
348
345
|
|
349
346
|
// src/base-sys-abstraction.ts
|
350
347
|
var SysTime = class extends Time {
|
@@ -390,11 +387,11 @@ var StepTime = class extends Time {
|
|
390
387
|
};
|
391
388
|
function TimeFactory(timeMode) {
|
392
389
|
switch (timeMode) {
|
393
|
-
case
|
390
|
+
case TimeMode.REAL:
|
394
391
|
return new SysTime();
|
395
|
-
case
|
392
|
+
case TimeMode.CONST:
|
396
393
|
return new ConstTime();
|
397
|
-
case
|
394
|
+
case TimeMode.STEP:
|
398
395
|
return new StepTime();
|
399
396
|
}
|
400
397
|
return new SysTime();
|
@@ -406,12 +403,12 @@ var RandomService = class {
|
|
406
403
|
}
|
407
404
|
Random0ToValue(value) {
|
408
405
|
switch (this._mode) {
|
409
|
-
case
|
406
|
+
case RandomMode.CONST:
|
410
407
|
return 0.5 * value;
|
411
|
-
case
|
408
|
+
case RandomMode.STEP:
|
412
409
|
this._step += 1e-4;
|
413
410
|
return this._step * value;
|
414
|
-
case
|
411
|
+
case RandomMode.RANDOM:
|
415
412
|
return Math.random() * value;
|
416
413
|
default:
|
417
414
|
throw new Error("Unknown RandomMode");
|
@@ -422,17 +419,17 @@ var IdService = class {
|
|
422
419
|
constructor(mode) {
|
423
420
|
this._step = 0;
|
424
421
|
if (!mode) {
|
425
|
-
mode =
|
422
|
+
mode = IDMode.UUID;
|
426
423
|
}
|
427
424
|
this._mode = mode;
|
428
425
|
}
|
429
426
|
NextId() {
|
430
427
|
switch (this._mode) {
|
431
|
-
case
|
428
|
+
case IDMode.UUID:
|
432
429
|
return crypto.randomUUID();
|
433
|
-
case
|
430
|
+
case IDMode.CONST:
|
434
431
|
return "VeryUniqueID";
|
435
|
-
case
|
432
|
+
case IDMode.STEP:
|
436
433
|
return `STEPId-${this._step++}`;
|
437
434
|
default:
|
438
435
|
throw new Error("Unknown IDMode");
|
@@ -462,7 +459,7 @@ var BaseSysAbstraction = class {
|
|
462
459
|
constructor(params) {
|
463
460
|
this._time = new SysTime();
|
464
461
|
this._idService = new IdService();
|
465
|
-
this._randomService = new RandomService(
|
462
|
+
this._randomService = new RandomService(RandomMode.RANDOM);
|
466
463
|
this._fileSystem = params.FileSystem;
|
467
464
|
this._systemService = params.SystemService;
|
468
465
|
this._txtEnDe = params.TxtEnDecoder;
|
@@ -792,24 +789,24 @@ var Keyed = class {
|
|
792
789
|
this._map = /* @__PURE__ */ new Map();
|
793
790
|
this.factory = factory;
|
794
791
|
}
|
795
|
-
async asyncGet(
|
796
|
-
return this.get(await
|
792
|
+
async asyncGet(key) {
|
793
|
+
return this.get(await key());
|
797
794
|
}
|
798
|
-
get(
|
799
|
-
if (typeof
|
800
|
-
|
795
|
+
get(key) {
|
796
|
+
if (typeof key === "function") {
|
797
|
+
key = key();
|
801
798
|
}
|
802
|
-
let keyed = this._map.get(
|
799
|
+
let keyed = this._map.get(key);
|
803
800
|
if (!keyed) {
|
804
|
-
keyed = this.factory(
|
805
|
-
this._map.set(
|
801
|
+
keyed = this.factory(key);
|
802
|
+
this._map.set(key, keyed);
|
806
803
|
}
|
807
804
|
return keyed;
|
808
805
|
}
|
809
|
-
unget(
|
810
|
-
const keyed = this._map.get(
|
806
|
+
unget(key) {
|
807
|
+
const keyed = this._map.get(key);
|
811
808
|
keyed == null ? void 0 : keyed.reset();
|
812
|
-
this._map.delete(
|
809
|
+
this._map.delete(key);
|
813
810
|
}
|
814
811
|
reset() {
|
815
812
|
this._map.forEach((keyed) => keyed.reset());
|
@@ -818,7 +815,7 @@ var Keyed = class {
|
|
818
815
|
};
|
819
816
|
var KeyedResolvOnce = class extends Keyed {
|
820
817
|
constructor() {
|
821
|
-
super((
|
818
|
+
super((key) => new ResolveOnce(key));
|
822
819
|
}
|
823
820
|
/**
|
824
821
|
*
|
@@ -844,7 +841,7 @@ var KeyedResolvOnce = class extends Keyed {
|
|
844
841
|
};
|
845
842
|
var KeyedResolvSeq = class extends Keyed {
|
846
843
|
constructor() {
|
847
|
-
super((
|
844
|
+
super((key) => new ResolveSeq(key));
|
848
845
|
}
|
849
846
|
};
|
850
847
|
|
@@ -900,8 +897,8 @@ var _DenoEnvActions = class _DenoEnvActions {
|
|
900
897
|
return __privateGet(this, _deno).Deno.env;
|
901
898
|
}
|
902
899
|
register(env) {
|
903
|
-
for (const
|
904
|
-
this._env.set(
|
900
|
+
for (const key of env.keys()) {
|
901
|
+
this._env.set(key, env.get(key) || "");
|
905
902
|
}
|
906
903
|
return env;
|
907
904
|
}
|
@@ -911,16 +908,16 @@ var _DenoEnvActions = class _DenoEnvActions {
|
|
911
908
|
keys() {
|
912
909
|
return Object.keys(this._env.toObject());
|
913
910
|
}
|
914
|
-
get(
|
915
|
-
return this._env.get(
|
911
|
+
get(key) {
|
912
|
+
return this._env.get(key);
|
916
913
|
}
|
917
|
-
set(
|
914
|
+
set(key, value) {
|
918
915
|
if (value) {
|
919
|
-
this._env.set(
|
916
|
+
this._env.set(key, value);
|
920
917
|
}
|
921
918
|
}
|
922
|
-
delete(
|
923
|
-
this._env.delete(
|
919
|
+
delete(key) {
|
920
|
+
this._env.delete(key);
|
924
921
|
}
|
925
922
|
};
|
926
923
|
_deno = new WeakMap();
|
@@ -939,8 +936,8 @@ var _NodeEnvActions = class _NodeEnvActions {
|
|
939
936
|
return once2.once(() => new _NodeEnvActions(opts));
|
940
937
|
}
|
941
938
|
register(env) {
|
942
|
-
for (const
|
943
|
-
this._env[
|
939
|
+
for (const key of env.keys()) {
|
940
|
+
this._env[key] = env.get(key) || "";
|
944
941
|
}
|
945
942
|
return env;
|
946
943
|
}
|
@@ -950,16 +947,16 @@ var _NodeEnvActions = class _NodeEnvActions {
|
|
950
947
|
keys() {
|
951
948
|
return Object.keys(this._env);
|
952
949
|
}
|
953
|
-
get(
|
954
|
-
return this._env[
|
950
|
+
get(key) {
|
951
|
+
return this._env[key];
|
955
952
|
}
|
956
|
-
set(
|
953
|
+
set(key, value) {
|
957
954
|
if (value) {
|
958
|
-
this._env[
|
955
|
+
this._env[key] = value;
|
959
956
|
}
|
960
957
|
}
|
961
|
-
delete(
|
962
|
-
delete this._env[
|
958
|
+
delete(key) {
|
959
|
+
delete this._env[key];
|
963
960
|
}
|
964
961
|
};
|
965
962
|
_node = new WeakMap();
|
@@ -975,16 +972,16 @@ var BrowserEnvActions = class _BrowserEnvActions {
|
|
975
972
|
static new(opts) {
|
976
973
|
return once3.once(() => new _BrowserEnvActions(opts));
|
977
974
|
}
|
978
|
-
get(
|
979
|
-
return this.env.get(
|
975
|
+
get(key) {
|
976
|
+
return this.env.get(key);
|
980
977
|
}
|
981
|
-
set(
|
978
|
+
set(key, value) {
|
982
979
|
if (value) {
|
983
|
-
this.env.set(
|
980
|
+
this.env.set(key, value);
|
984
981
|
}
|
985
982
|
}
|
986
|
-
delete(
|
987
|
-
this.env.delete(
|
983
|
+
delete(key) {
|
984
|
+
this.env.delete(key);
|
988
985
|
}
|
989
986
|
keys() {
|
990
987
|
return Array.from(this.env.keys());
|
@@ -1012,13 +1009,13 @@ var CFEnvActions = class _CFEnvActions {
|
|
1012
1009
|
}
|
1013
1010
|
static inject(o) {
|
1014
1011
|
const env = _CFEnvActions.new({});
|
1015
|
-
for (const
|
1016
|
-
const value = o[
|
1012
|
+
for (const key in o) {
|
1013
|
+
const value = o[key];
|
1017
1014
|
if (typeof value === "string") {
|
1018
1015
|
if (env.env) {
|
1019
|
-
env.env.set(
|
1016
|
+
env.env.set(key, value);
|
1020
1017
|
} else {
|
1021
|
-
env.injectOnRegister[
|
1018
|
+
env.injectOnRegister[key] = value;
|
1022
1019
|
}
|
1023
1020
|
}
|
1024
1021
|
}
|
@@ -1028,42 +1025,44 @@ var CFEnvActions = class _CFEnvActions {
|
|
1028
1025
|
}
|
1029
1026
|
register(env) {
|
1030
1027
|
this.env = env;
|
1031
|
-
for (const
|
1032
|
-
env.set(
|
1028
|
+
for (const key in this.injectOnRegister) {
|
1029
|
+
env.set(key, this.injectOnRegister[key]);
|
1033
1030
|
}
|
1034
1031
|
return env;
|
1035
1032
|
}
|
1036
|
-
get(
|
1037
|
-
return this.cfEnv.get(
|
1033
|
+
get(key) {
|
1034
|
+
return this.cfEnv.get(key);
|
1038
1035
|
}
|
1039
|
-
set(
|
1036
|
+
set(key, value) {
|
1040
1037
|
if (value) {
|
1041
|
-
this.cfEnv.set(
|
1038
|
+
this.cfEnv.set(key, value);
|
1042
1039
|
}
|
1043
1040
|
}
|
1044
|
-
delete(
|
1045
|
-
this.cfEnv.delete(
|
1041
|
+
delete(key) {
|
1042
|
+
this.cfEnv.delete(key);
|
1046
1043
|
}
|
1047
1044
|
keys() {
|
1048
1045
|
return Array.from(this.cfEnv.keys());
|
1049
1046
|
}
|
1050
1047
|
};
|
1051
1048
|
|
1052
|
-
// src/
|
1053
|
-
var
|
1049
|
+
// src/types.ts
|
1050
|
+
var _Required = class {
|
1054
1051
|
constructor() {
|
1055
|
-
this.
|
1052
|
+
this.type = "REQUIRED";
|
1056
1053
|
}
|
1057
1054
|
};
|
1058
|
-
var
|
1055
|
+
var _Optional = class {
|
1059
1056
|
constructor() {
|
1060
|
-
this.
|
1057
|
+
this.type = "OPTIONAL";
|
1061
1058
|
}
|
1062
1059
|
};
|
1063
1060
|
var param = {
|
1064
|
-
REQUIRED: new
|
1065
|
-
OPTIONAL: new
|
1061
|
+
REQUIRED: new _Required(),
|
1062
|
+
OPTIONAL: new _Optional()
|
1066
1063
|
};
|
1064
|
+
|
1065
|
+
// src/utils/get-params-result.ts
|
1067
1066
|
function getParamsResult(keys, getParam) {
|
1068
1067
|
const keyDef = keys.flat().reduce(
|
1069
1068
|
(acc, i) => {
|
@@ -1157,16 +1156,16 @@ var EnvImpl = class {
|
|
1157
1156
|
});
|
1158
1157
|
}
|
1159
1158
|
sets(...keys) {
|
1160
|
-
keys.forEach((
|
1161
|
-
if (Array.isArray(
|
1162
|
-
if (
|
1163
|
-
const [k, v] =
|
1159
|
+
keys.forEach((key) => {
|
1160
|
+
if (Array.isArray(key)) {
|
1161
|
+
if (key.length === 2) {
|
1162
|
+
const [k, v] = key;
|
1164
1163
|
if (typeof k === "string" && typeof v === "string") {
|
1165
1164
|
this.set(k, v);
|
1166
1165
|
return;
|
1167
1166
|
}
|
1168
1167
|
}
|
1169
|
-
for (const item of
|
1168
|
+
for (const item of key) {
|
1170
1169
|
if (Array.isArray(item)) {
|
1171
1170
|
if (item.length === 2) {
|
1172
1171
|
const [k, v] = item;
|
@@ -1177,14 +1176,14 @@ var EnvImpl = class {
|
|
1177
1176
|
}
|
1178
1177
|
}
|
1179
1178
|
} else {
|
1180
|
-
if (isIterable(
|
1181
|
-
for (const [k, v] of
|
1179
|
+
if (isIterable(key)) {
|
1180
|
+
for (const [k, v] of key) {
|
1182
1181
|
if (typeof k === "string" && typeof v === "string") {
|
1183
1182
|
this.set(k, v);
|
1184
1183
|
}
|
1185
1184
|
}
|
1186
1185
|
} else {
|
1187
|
-
const rKey =
|
1186
|
+
const rKey = key;
|
1188
1187
|
for (const k in rKey) {
|
1189
1188
|
const v = rKey[k];
|
1190
1189
|
if (typeof k === "string" && typeof v === "string") {
|
@@ -1199,15 +1198,15 @@ var EnvImpl = class {
|
|
1199
1198
|
if (!presetEnv) {
|
1200
1199
|
return;
|
1201
1200
|
}
|
1202
|
-
for (const [
|
1203
|
-
this._map.set(
|
1201
|
+
for (const [key, value] of presetEnv) {
|
1202
|
+
this._map.set(key, value);
|
1204
1203
|
}
|
1205
1204
|
}
|
1206
|
-
_applyOnSet(onSet,
|
1205
|
+
_applyOnSet(onSet, key, value) {
|
1207
1206
|
onSet.forEach((item) => {
|
1208
1207
|
let keys = [];
|
1209
|
-
if (
|
1210
|
-
keys = [
|
1208
|
+
if (key) {
|
1209
|
+
keys = [key];
|
1211
1210
|
} else {
|
1212
1211
|
keys = this._map.keys();
|
1213
1212
|
}
|
@@ -1221,9 +1220,9 @@ var EnvImpl = class {
|
|
1221
1220
|
return false;
|
1222
1221
|
}).forEach((k) => {
|
1223
1222
|
let v;
|
1224
|
-
if (!
|
1223
|
+
if (!key && !value) {
|
1225
1224
|
v = this._map.get(k);
|
1226
|
-
} else if (
|
1225
|
+
} else if (key && !value) {
|
1227
1226
|
v = void 0;
|
1228
1227
|
} else {
|
1229
1228
|
v = value;
|
@@ -1241,19 +1240,19 @@ var EnvImpl = class {
|
|
1241
1240
|
this._onSet.push(item);
|
1242
1241
|
this._applyOnSet([item]);
|
1243
1242
|
}
|
1244
|
-
get(
|
1245
|
-
return this._map.get(
|
1243
|
+
get(key) {
|
1244
|
+
return this._map.get(key);
|
1246
1245
|
}
|
1247
|
-
set(
|
1246
|
+
set(key, value) {
|
1248
1247
|
if (!value) {
|
1249
1248
|
return;
|
1250
1249
|
}
|
1251
|
-
this._map.set(
|
1252
|
-
this._applyOnSet(this._onSet,
|
1250
|
+
this._map.set(key, value);
|
1251
|
+
this._applyOnSet(this._onSet, key, value);
|
1253
1252
|
}
|
1254
|
-
delete(
|
1255
|
-
this._map.delete(
|
1256
|
-
this._applyOnSet(this._onSet,
|
1253
|
+
delete(key) {
|
1254
|
+
this._map.delete(key);
|
1255
|
+
this._applyOnSet(this._onSet, key);
|
1257
1256
|
}
|
1258
1257
|
};
|
1259
1258
|
|
@@ -1392,18 +1391,25 @@ var WebSystemService = class {
|
|
1392
1391
|
}
|
1393
1392
|
};
|
1394
1393
|
var my = void 0;
|
1395
|
-
function WebSysAbstraction(
|
1394
|
+
function WebSysAbstraction(param2) {
|
1396
1395
|
if (!my) {
|
1397
1396
|
my = new BaseSysAbstraction({
|
1398
|
-
TxtEnDecoder: (
|
1397
|
+
TxtEnDecoder: (param2 == null ? void 0 : param2.TxtEnDecoder) || TxtEnDecoderSingleton(),
|
1399
1398
|
FileSystem: new WebFileService(),
|
1400
1399
|
SystemService: new WebSystemService()
|
1401
1400
|
});
|
1402
1401
|
}
|
1403
|
-
return new WrapperSysAbstraction(my,
|
1402
|
+
return new WrapperSysAbstraction(my, param2);
|
1404
1403
|
}
|
1405
1404
|
|
1406
1405
|
// src/utils/relative-path.ts
|
1406
|
+
var PartType = {
|
1407
|
+
Slash: 1,
|
1408
|
+
Root: 3,
|
1409
|
+
Up: 4,
|
1410
|
+
Noop: 8
|
1411
|
+
// RootUp = 0x8 /* ../ */,
|
1412
|
+
};
|
1407
1413
|
var Path = class {
|
1408
1414
|
constructor(parts = []) {
|
1409
1415
|
this.parts = parts;
|
@@ -1414,10 +1420,10 @@ var Path = class {
|
|
1414
1420
|
return part;
|
1415
1421
|
} else {
|
1416
1422
|
switch (part) {
|
1417
|
-
case
|
1418
|
-
case
|
1423
|
+
case PartType.Slash:
|
1424
|
+
case PartType.Root:
|
1419
1425
|
return "/";
|
1420
|
-
case
|
1426
|
+
case PartType.Up:
|
1421
1427
|
return "..";
|
1422
1428
|
default:
|
1423
1429
|
return part;
|
@@ -1426,22 +1432,22 @@ var Path = class {
|
|
1426
1432
|
}).join("");
|
1427
1433
|
}
|
1428
1434
|
add(part) {
|
1429
|
-
if (this.parts.includes(
|
1435
|
+
if (this.parts.includes(PartType.Root) && part === PartType.Root) {
|
1430
1436
|
throw new Error("Cannot add absolute part to absolute path");
|
1431
1437
|
}
|
1432
1438
|
const last = this.parts[this.parts.length - 1];
|
1433
|
-
if (last &
|
1439
|
+
if (last & PartType.Slash && part === PartType.Slash) {
|
1434
1440
|
return;
|
1435
1441
|
}
|
1436
1442
|
switch (part) {
|
1437
1443
|
case ".":
|
1438
|
-
this.parts.push(
|
1444
|
+
this.parts.push(PartType.Noop);
|
1439
1445
|
return;
|
1440
1446
|
case "..":
|
1441
|
-
part =
|
1447
|
+
part = PartType.Up;
|
1442
1448
|
}
|
1443
|
-
if (last ===
|
1444
|
-
if (last ===
|
1449
|
+
if (last === PartType.Noop && part === PartType.Slash) {
|
1450
|
+
if (last === PartType.Noop) {
|
1445
1451
|
this.parts.pop();
|
1446
1452
|
}
|
1447
1453
|
return;
|
@@ -1457,9 +1463,9 @@ function splitPath(path) {
|
|
1457
1463
|
for (let count = 0; path.length; count++) {
|
1458
1464
|
if (path.match(/^\/+/)) {
|
1459
1465
|
if (count === 0) {
|
1460
|
-
p.add(
|
1466
|
+
p.add(PartType.Root);
|
1461
1467
|
} else {
|
1462
|
-
p.add(
|
1468
|
+
p.add(PartType.Slash);
|
1463
1469
|
}
|
1464
1470
|
path = path.replace(/^\/+/, "");
|
1465
1471
|
} else {
|
@@ -1493,7 +1499,7 @@ function pathJoin(...paths) {
|
|
1493
1499
|
function relativePath(path, relative) {
|
1494
1500
|
const relativeParts = splitPath(relative);
|
1495
1501
|
let result;
|
1496
|
-
if (relativeParts.parts[0] ===
|
1502
|
+
if (relativeParts.parts[0] === PartType.Root) {
|
1497
1503
|
result = relative;
|
1498
1504
|
} else {
|
1499
1505
|
result = pathJoin(path, relative);
|
@@ -1503,13 +1509,13 @@ function relativePath(path, relative) {
|
|
1503
1509
|
let topUp = false;
|
1504
1510
|
for (const part of unoptPath.parts) {
|
1505
1511
|
switch (part) {
|
1506
|
-
case
|
1507
|
-
out.push(
|
1512
|
+
case PartType.Root:
|
1513
|
+
out.push(PartType.Root);
|
1508
1514
|
break;
|
1509
|
-
case
|
1515
|
+
case PartType.Up:
|
1510
1516
|
if (out.length && !topUp) {
|
1511
1517
|
const last = out.length - 1;
|
1512
|
-
if (typeof out[last] === "string" && out[last - 1] ==
|
1518
|
+
if (typeof out[last] === "string" && out[last - 1] == PartType.Root) {
|
1513
1519
|
out.pop();
|
1514
1520
|
} else {
|
1515
1521
|
out.pop();
|
@@ -1517,15 +1523,15 @@ function relativePath(path, relative) {
|
|
1517
1523
|
}
|
1518
1524
|
if (out.length === 0) {
|
1519
1525
|
topUp = !topUp ? true : topUp;
|
1520
|
-
out.push(
|
1526
|
+
out.push(PartType.Up);
|
1521
1527
|
}
|
1522
1528
|
} else {
|
1523
|
-
out.push(
|
1529
|
+
out.push(PartType.Up);
|
1524
1530
|
}
|
1525
1531
|
break;
|
1526
|
-
case
|
1527
|
-
if (!(out[out.length - 1] &
|
1528
|
-
out.push(
|
1532
|
+
case PartType.Slash:
|
1533
|
+
if (!(out[out.length - 1] & PartType.Slash)) {
|
1534
|
+
out.push(PartType.Slash);
|
1529
1535
|
}
|
1530
1536
|
break;
|
1531
1537
|
default:
|
@@ -1556,37 +1562,37 @@ function localStripper(path, restrips, obj) {
|
|
1556
1562
|
return obj.map((i) => localStripper(path, restrips, i));
|
1557
1563
|
}
|
1558
1564
|
const ret = { ...obj };
|
1559
|
-
const matcher = (
|
1565
|
+
const matcher = (key, nextPath) => {
|
1560
1566
|
for (const re of restrips) {
|
1561
|
-
if (re.test(
|
1567
|
+
if (re.test(key) || re.test(nextPath)) {
|
1562
1568
|
return true;
|
1563
1569
|
}
|
1564
1570
|
}
|
1565
1571
|
return false;
|
1566
1572
|
};
|
1567
|
-
for (const
|
1568
|
-
if (Object.prototype.hasOwnProperty.call(ret,
|
1573
|
+
for (const key in ret) {
|
1574
|
+
if (Object.prototype.hasOwnProperty.call(ret, key)) {
|
1569
1575
|
let nextPath;
|
1570
1576
|
if (path) {
|
1571
|
-
nextPath = [path,
|
1577
|
+
nextPath = [path, key].join(".");
|
1572
1578
|
} else {
|
1573
|
-
nextPath =
|
1579
|
+
nextPath = key;
|
1574
1580
|
}
|
1575
|
-
if (matcher(
|
1576
|
-
delete ret[
|
1581
|
+
if (matcher(key, nextPath)) {
|
1582
|
+
delete ret[key];
|
1577
1583
|
continue;
|
1578
1584
|
}
|
1579
|
-
if (typeof ret[
|
1580
|
-
if (Array.isArray(ret[
|
1581
|
-
ret[
|
1582
|
-
const toDelete = matcher(
|
1585
|
+
if (typeof ret[key] === "object") {
|
1586
|
+
if (Array.isArray(ret[key])) {
|
1587
|
+
ret[key] = ret[key].reduce((acc, v, i) => {
|
1588
|
+
const toDelete = matcher(key, `${nextPath}[${i}]`);
|
1583
1589
|
if (!toDelete) {
|
1584
1590
|
acc.push(localStripper(`${nextPath}[${i}]`, restrips, v));
|
1585
1591
|
}
|
1586
1592
|
return acc;
|
1587
1593
|
}, []);
|
1588
1594
|
} else {
|
1589
|
-
ret[
|
1595
|
+
ret[key] = localStripper(nextPath, restrips, ret[key]);
|
1590
1596
|
}
|
1591
1597
|
}
|
1592
1598
|
}
|
@@ -1595,16 +1601,15 @@ function localStripper(path, restrips, obj) {
|
|
1595
1601
|
}
|
1596
1602
|
|
1597
1603
|
// src/uri.ts
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
const keys = Object.keys(key2);
|
1604
|
+
function coerceKey(key, def) {
|
1605
|
+
if (typeof key === "object") {
|
1606
|
+
const keys = Object.keys(key);
|
1602
1607
|
if (keys.length !== 1) {
|
1603
|
-
throw new Error(`Invalid key: ${JSON.stringify(
|
1608
|
+
throw new Error(`Invalid key: ${JSON.stringify(key)}`);
|
1604
1609
|
}
|
1605
|
-
return { key: keys[0], def:
|
1610
|
+
return { key: keys[0], def: key[keys[0]] };
|
1606
1611
|
}
|
1607
|
-
return { key
|
1612
|
+
return { key, def };
|
1608
1613
|
}
|
1609
1614
|
function falsy2undef(value) {
|
1610
1615
|
return value === void 0 || value === null ? void 0 : value;
|
@@ -1707,8 +1712,8 @@ var MutableURL = class _MutableURL extends URL {
|
|
1707
1712
|
toString() {
|
1708
1713
|
let search = "";
|
1709
1714
|
if (this._sysURL.searchParams.size) {
|
1710
|
-
for (const [
|
1711
|
-
search += `${!search.length ? "?" : "&"}${
|
1715
|
+
for (const [key, value] of Array.from(this._sysURL.searchParams.entries()).sort((a, b) => a[0].localeCompare(b[0]))) {
|
1716
|
+
search += `${!search.length ? "?" : "&"}${key}=${encodeURIComponent(value)}`;
|
1712
1717
|
}
|
1713
1718
|
}
|
1714
1719
|
let hostpart = "";
|
@@ -1743,11 +1748,11 @@ function from(fac, strURLUri, defaultProtocol) {
|
|
1743
1748
|
throw new Error(`Invalid argument: ${typeof strURLUri}`);
|
1744
1749
|
}
|
1745
1750
|
}
|
1746
|
-
function getParamResult(
|
1747
|
-
return `missing parameter: ${
|
1751
|
+
function getParamResult(key, val, msgFn = (key2) => {
|
1752
|
+
return `missing parameter: ${key2}`;
|
1748
1753
|
}) {
|
1749
1754
|
if (val === void 0) {
|
1750
|
-
return Result.Err(msgFn(
|
1755
|
+
return Result.Err(msgFn(key));
|
1751
1756
|
}
|
1752
1757
|
return Result.Ok(val);
|
1753
1758
|
}
|
@@ -1804,47 +1809,47 @@ var BuildURI = class _BuildURI {
|
|
1804
1809
|
const pathname = "./" + appendUrl.pathname;
|
1805
1810
|
const basePath = this._url.pathname;
|
1806
1811
|
this.pathname(relativePath(basePath, pathname));
|
1807
|
-
for (const [
|
1808
|
-
this.setParam(
|
1812
|
+
for (const [key, value] of appendUrl.getParams) {
|
1813
|
+
this.setParam(key, value);
|
1809
1814
|
}
|
1810
1815
|
return this;
|
1811
1816
|
}
|
1812
1817
|
cleanParams() {
|
1813
|
-
for (const
|
1814
|
-
this._url.searchParams.delete(
|
1818
|
+
for (const key of Array.from(this._url.searchParams.keys())) {
|
1819
|
+
this._url.searchParams.delete(key);
|
1815
1820
|
}
|
1816
1821
|
return this;
|
1817
1822
|
}
|
1818
|
-
delParam(
|
1819
|
-
this._url.searchParams.delete(
|
1823
|
+
delParam(key) {
|
1824
|
+
this._url.searchParams.delete(key);
|
1820
1825
|
return this;
|
1821
1826
|
}
|
1822
|
-
defParam(
|
1823
|
-
if (!this._url.searchParams.has(
|
1824
|
-
this._url.searchParams.set(
|
1827
|
+
defParam(key, str) {
|
1828
|
+
if (!this._url.searchParams.has(key)) {
|
1829
|
+
this._url.searchParams.set(key, str);
|
1825
1830
|
}
|
1826
1831
|
return this;
|
1827
1832
|
}
|
1828
|
-
setParam(
|
1829
|
-
this._url.searchParams.set(
|
1833
|
+
setParam(key, str) {
|
1834
|
+
this._url.searchParams.set(key, str);
|
1830
1835
|
return this;
|
1831
1836
|
}
|
1832
|
-
hasParam(
|
1833
|
-
return this._url.searchParams.has(
|
1837
|
+
hasParam(key) {
|
1838
|
+
return this._url.searchParams.has(key);
|
1834
1839
|
}
|
1835
1840
|
get getParams() {
|
1836
1841
|
return this._url.searchParams.entries();
|
1837
1842
|
}
|
1838
|
-
getParam(
|
1839
|
-
const { key: k, def: d } = coerceKey(
|
1843
|
+
getParam(key, def) {
|
1844
|
+
const { key: k, def: d } = coerceKey(key, def);
|
1840
1845
|
let val = this._url.searchParams.get(k);
|
1841
1846
|
if (!falsy2undef(val) && d) {
|
1842
1847
|
val = d;
|
1843
1848
|
}
|
1844
1849
|
return falsy2undef(val);
|
1845
1850
|
}
|
1846
|
-
getParamResult(
|
1847
|
-
return getParamResult(
|
1851
|
+
getParamResult(key, msgFn) {
|
1852
|
+
return getParamResult(key, this.getParam(key), msgFn);
|
1848
1853
|
}
|
1849
1854
|
getParamsResult(...keys) {
|
1850
1855
|
return getParamsResult(keys, this);
|
@@ -1905,8 +1910,8 @@ var URI = class _URI {
|
|
1905
1910
|
if (!(fPath.length === 0 || fPath === "/" || fPath === "./")) {
|
1906
1911
|
intoUrl.pathname(fromUrl.pathname);
|
1907
1912
|
}
|
1908
|
-
for (const [
|
1909
|
-
intoUrl.setParam(
|
1913
|
+
for (const [key, value] of fromUrl.getParams) {
|
1914
|
+
intoUrl.setParam(key, value);
|
1910
1915
|
}
|
1911
1916
|
return intoUrl.URI();
|
1912
1917
|
}
|
@@ -1959,19 +1964,19 @@ var URI = class _URI {
|
|
1959
1964
|
get getParams() {
|
1960
1965
|
return this._url.searchParams.entries();
|
1961
1966
|
}
|
1962
|
-
hasParam(
|
1963
|
-
return this._url.searchParams.has(
|
1967
|
+
hasParam(key) {
|
1968
|
+
return this._url.searchParams.has(key);
|
1964
1969
|
}
|
1965
|
-
getParam(
|
1966
|
-
const { key: k, def: d } = coerceKey(
|
1970
|
+
getParam(key, def) {
|
1971
|
+
const { key: k, def: d } = coerceKey(key, def);
|
1967
1972
|
let val = this._url.searchParams.get(k);
|
1968
1973
|
if (!falsy2undef(val) && d) {
|
1969
1974
|
val = d;
|
1970
1975
|
}
|
1971
1976
|
return falsy2undef(val);
|
1972
1977
|
}
|
1973
|
-
getParamResult(
|
1974
|
-
return getParamResult(
|
1978
|
+
getParamResult(key, msgFn) {
|
1979
|
+
return getParamResult(key, this.getParam(key), msgFn);
|
1975
1980
|
}
|
1976
1981
|
getParamsResult(...keys) {
|
1977
1982
|
return getParamsResult(keys, this);
|
@@ -2175,7 +2180,7 @@ var None = class extends Option {
|
|
2175
2180
|
// src/log-level-impl.ts
|
2176
2181
|
var LevelHandlerImpl = class {
|
2177
2182
|
constructor() {
|
2178
|
-
this._globalLevels = /* @__PURE__ */ new Set([
|
2183
|
+
this._globalLevels = /* @__PURE__ */ new Set([Level.INFO, Level.ERROR, Level.WARN]);
|
2179
2184
|
this._modules = /* @__PURE__ */ new Map();
|
2180
2185
|
this.ignoreAttr = Option.Some(/^_/);
|
2181
2186
|
this.isStackExposed = false;
|
@@ -2225,9 +2230,9 @@ var LevelHandlerImpl = class {
|
|
2225
2230
|
}
|
2226
2231
|
setDebug(...modules) {
|
2227
2232
|
this.forModules(
|
2228
|
-
|
2233
|
+
Level.DEBUG,
|
2229
2234
|
(p) => {
|
2230
|
-
this._modules.set(p, /* @__PURE__ */ new Set([...this._globalLevels,
|
2235
|
+
this._modules.set(p, /* @__PURE__ */ new Set([...this._globalLevels, Level.DEBUG]));
|
2231
2236
|
},
|
2232
2237
|
...modules
|
2233
2238
|
);
|
@@ -2380,9 +2385,9 @@ var LoggerImpl = class _LoggerImpl {
|
|
2380
2385
|
this.levelHandler.disableLevel(level, ...modules);
|
2381
2386
|
return this;
|
2382
2387
|
}
|
2383
|
-
Module(
|
2384
|
-
this._attributes["module"] = logValue(
|
2385
|
-
this._withAttributes["module"] = logValue(
|
2388
|
+
Module(key) {
|
2389
|
+
this._attributes["module"] = logValue(key, toLogValueCtx(this.levelHandler));
|
2390
|
+
this._withAttributes["module"] = logValue(key, toLogValueCtx(this.levelHandler));
|
2386
2391
|
return this;
|
2387
2392
|
}
|
2388
2393
|
// if the string is "*" it will enable for all modules
|
@@ -2403,30 +2408,30 @@ var LoggerImpl = class _LoggerImpl {
|
|
2403
2408
|
return this;
|
2404
2409
|
}
|
2405
2410
|
Warn() {
|
2406
|
-
this._attributes["level"] = logValue(
|
2411
|
+
this._attributes["level"] = logValue(Level.WARN, toLogValueCtx(this.levelHandler));
|
2407
2412
|
return this;
|
2408
2413
|
}
|
2409
2414
|
Log() {
|
2410
2415
|
return this;
|
2411
2416
|
}
|
2412
2417
|
Debug() {
|
2413
|
-
this._attributes["level"] = logValue(
|
2418
|
+
this._attributes["level"] = logValue(Level.DEBUG, toLogValueCtx(this.levelHandler));
|
2414
2419
|
return this;
|
2415
2420
|
}
|
2416
2421
|
Error() {
|
2417
|
-
this._attributes["level"] = logValue(
|
2422
|
+
this._attributes["level"] = logValue(Level.ERROR, toLogValueCtx(this.levelHandler));
|
2418
2423
|
return this;
|
2419
2424
|
}
|
2420
2425
|
Info() {
|
2421
|
-
this._attributes["level"] = logValue(
|
2426
|
+
this._attributes["level"] = logValue(Level.INFO, toLogValueCtx(this.levelHandler));
|
2422
2427
|
return this;
|
2423
2428
|
}
|
2424
2429
|
Err(err) {
|
2425
2430
|
var _a;
|
2426
|
-
let
|
2431
|
+
let key = "error";
|
2427
2432
|
if (Result.Is(err)) {
|
2428
2433
|
if (err.isOk()) {
|
2429
|
-
|
2434
|
+
key = "noerror";
|
2430
2435
|
err = err.Ok();
|
2431
2436
|
} else {
|
2432
2437
|
err = err.Err();
|
@@ -2434,12 +2439,12 @@ var LoggerImpl = class _LoggerImpl {
|
|
2434
2439
|
}
|
2435
2440
|
if (err instanceof Error) {
|
2436
2441
|
if (err.cause) {
|
2437
|
-
this.coerceKey(
|
2442
|
+
this.coerceKey(key, {
|
2438
2443
|
message: err.message,
|
2439
2444
|
cause: err.cause
|
2440
2445
|
});
|
2441
2446
|
} else {
|
2442
|
-
this._attributes[
|
2447
|
+
this._attributes[key] = logValue(err.message, toLogValueCtx(this.levelHandler));
|
2443
2448
|
}
|
2444
2449
|
if (this.levelHandler.isStackExposed) {
|
2445
2450
|
this._attributes["stack"] = logValue(
|
@@ -2448,7 +2453,7 @@ var LoggerImpl = class _LoggerImpl {
|
|
2448
2453
|
);
|
2449
2454
|
}
|
2450
2455
|
} else {
|
2451
|
-
this.Any(
|
2456
|
+
this.Any(key, err);
|
2452
2457
|
}
|
2453
2458
|
return this;
|
2454
2459
|
}
|
@@ -2456,22 +2461,22 @@ var LoggerImpl = class _LoggerImpl {
|
|
2456
2461
|
this._attributes["level"] = logValue(l, toLogValueCtx(this.levelHandler));
|
2457
2462
|
return this;
|
2458
2463
|
}
|
2459
|
-
Ref(
|
2464
|
+
Ref(key, action) {
|
2460
2465
|
if (typeof action === "function") {
|
2461
|
-
this._attributes[
|
2466
|
+
this._attributes[key] = logValue(action, toLogValueCtx(this.levelHandler));
|
2462
2467
|
} else if (typeof action.toString === "function") {
|
2463
|
-
this._attributes[
|
2468
|
+
this._attributes[key] = logValue(() => action.toString(), toLogValueCtx(this.levelHandler));
|
2464
2469
|
} else {
|
2465
|
-
this._attributes[
|
2470
|
+
this._attributes[key] = logValue("INVALID REF", toLogValueCtx(this.levelHandler));
|
2466
2471
|
}
|
2467
2472
|
return this;
|
2468
2473
|
}
|
2469
|
-
Bool(
|
2470
|
-
this.coerceKey(
|
2474
|
+
Bool(key, value) {
|
2475
|
+
this.coerceKey(key, !!value);
|
2471
2476
|
return this;
|
2472
2477
|
}
|
2473
2478
|
Http(...mix) {
|
2474
|
-
const
|
2479
|
+
const key = mix.find((x) => typeof x === "string");
|
2475
2480
|
mix = mix.filter((x) => typeof x !== "string");
|
2476
2481
|
const resErrors = mix.filter((x) => Result.Is(x) && x.isErr());
|
2477
2482
|
if (resErrors.length) {
|
@@ -2491,70 +2496,70 @@ var LoggerImpl = class _LoggerImpl {
|
|
2491
2496
|
reqAndOrres = req;
|
2492
2497
|
}
|
2493
2498
|
if (reqAndOrres) {
|
2494
|
-
this.Any(
|
2499
|
+
this.Any(key || "Http", reqAndOrres);
|
2495
2500
|
}
|
2496
2501
|
return this;
|
2497
2502
|
}
|
2498
2503
|
Pair(x) {
|
2499
|
-
for (const
|
2500
|
-
const value = x[
|
2504
|
+
for (const key of Object.keys(x)) {
|
2505
|
+
const value = x[key];
|
2501
2506
|
if (value instanceof LogValue) {
|
2502
|
-
this._attributes[
|
2507
|
+
this._attributes[key] = value;
|
2503
2508
|
continue;
|
2504
2509
|
}
|
2505
2510
|
if (Result.Is(value)) {
|
2506
|
-
this.Result(
|
2511
|
+
this.Result(key, value);
|
2507
2512
|
continue;
|
2508
2513
|
}
|
2509
|
-
this.Any(
|
2514
|
+
this.Any(key, value);
|
2510
2515
|
}
|
2511
2516
|
return this;
|
2512
2517
|
}
|
2513
|
-
Result(
|
2518
|
+
Result(key, res) {
|
2514
2519
|
if (res.isOk()) {
|
2515
|
-
this._attributes[
|
2520
|
+
this._attributes[key] = logValue(res.Ok(), toLogValueCtx(this.levelHandler));
|
2516
2521
|
} else {
|
2517
2522
|
this.Err(res.Err());
|
2518
2523
|
}
|
2519
2524
|
return this;
|
2520
2525
|
}
|
2521
|
-
Len(value,
|
2522
|
-
this._attributes[
|
2526
|
+
Len(value, key = "len") {
|
2527
|
+
this._attributes[key] = getLen(value, toLogValueCtx(this.levelHandler));
|
2523
2528
|
return this;
|
2524
2529
|
}
|
2525
2530
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2526
|
-
Hash(value,
|
2531
|
+
Hash(value, key = "hash") {
|
2527
2532
|
throw new Error("Not implemented");
|
2528
2533
|
}
|
2529
|
-
Url(url,
|
2530
|
-
this.Ref(
|
2534
|
+
Url(url, key = "url") {
|
2535
|
+
this.Ref(key, () => URI.from(url).toString());
|
2531
2536
|
return this;
|
2532
2537
|
}
|
2533
|
-
coerceKey(
|
2534
|
-
if (typeof
|
2535
|
-
this._attributes[
|
2538
|
+
coerceKey(key, value) {
|
2539
|
+
if (typeof key === "string") {
|
2540
|
+
this._attributes[key] = logValue(value, toLogValueCtx(this.levelHandler));
|
2536
2541
|
} else {
|
2537
|
-
this.Pair(
|
2542
|
+
this.Pair(key);
|
2538
2543
|
}
|
2539
2544
|
}
|
2540
|
-
Str(
|
2541
|
-
this.coerceKey(
|
2545
|
+
Str(key, value) {
|
2546
|
+
this.coerceKey(key, value);
|
2542
2547
|
return this;
|
2543
2548
|
}
|
2544
|
-
Any(
|
2545
|
-
this.coerceKey(
|
2549
|
+
Any(key, value) {
|
2550
|
+
this.coerceKey(key, value);
|
2546
2551
|
return this;
|
2547
2552
|
}
|
2548
|
-
Dur(
|
2549
|
-
this._attributes[
|
2553
|
+
Dur(key, nsec) {
|
2554
|
+
this._attributes[key] = logValue(`${nsec}ms`, toLogValueCtx(this.levelHandler));
|
2550
2555
|
return this;
|
2551
2556
|
}
|
2552
|
-
Uint64(
|
2553
|
-
this.coerceKey(
|
2557
|
+
Uint64(key, value) {
|
2558
|
+
this.coerceKey(key, value);
|
2554
2559
|
return this;
|
2555
2560
|
}
|
2556
|
-
Int(
|
2557
|
-
return this.Uint64(
|
2561
|
+
Int(key, value) {
|
2562
|
+
return this.Uint64(key, value);
|
2558
2563
|
}
|
2559
2564
|
async Flush() {
|
2560
2565
|
return new Promise((resolve) => {
|
@@ -2577,8 +2582,8 @@ var LoggerImpl = class _LoggerImpl {
|
|
2577
2582
|
}
|
2578
2583
|
_resetAttributes(fn) {
|
2579
2584
|
const ret = fn();
|
2580
|
-
Object.keys(this._attributes).forEach((
|
2581
|
-
delete this._attributes[
|
2585
|
+
Object.keys(this._attributes).forEach((key) => {
|
2586
|
+
delete this._attributes[key];
|
2582
2587
|
});
|
2583
2588
|
Object.assign(this._attributes, this._withAttributes);
|
2584
2589
|
return ret;
|
@@ -2645,8 +2650,8 @@ var WithLoggerBuilder = class {
|
|
2645
2650
|
this._li.levelHandler.enableLevel(level, ...modules);
|
2646
2651
|
return this;
|
2647
2652
|
}
|
2648
|
-
Module(
|
2649
|
-
this._li.Module(
|
2653
|
+
Module(key) {
|
2654
|
+
this._li.Module(key);
|
2650
2655
|
return this;
|
2651
2656
|
}
|
2652
2657
|
SetDebug(...modules) {
|
@@ -2661,36 +2666,36 @@ var WithLoggerBuilder = class {
|
|
2661
2666
|
this._li.Pair(x);
|
2662
2667
|
return this;
|
2663
2668
|
}
|
2664
|
-
Str(
|
2665
|
-
this._li.Str(
|
2669
|
+
Str(key, value) {
|
2670
|
+
this._li.Str(key, value);
|
2666
2671
|
return this;
|
2667
2672
|
}
|
2668
|
-
Len(value,
|
2669
|
-
this._li.Len(value,
|
2673
|
+
Len(value, key) {
|
2674
|
+
this._li.Len(value, key);
|
2670
2675
|
return this;
|
2671
2676
|
}
|
2672
|
-
Hash(value,
|
2673
|
-
this._li.Hash(value,
|
2677
|
+
Hash(value, key) {
|
2678
|
+
this._li.Hash(value, key);
|
2674
2679
|
return this;
|
2675
2680
|
}
|
2676
|
-
Ref(
|
2677
|
-
this._li.Ref(
|
2681
|
+
Ref(key, action) {
|
2682
|
+
this._li.Ref(key, action);
|
2678
2683
|
return this;
|
2679
2684
|
}
|
2680
|
-
Bool(
|
2681
|
-
this._li.Bool(
|
2685
|
+
Bool(key, value) {
|
2686
|
+
this._li.Bool(key, value);
|
2682
2687
|
return this;
|
2683
2688
|
}
|
2684
|
-
Result(
|
2685
|
-
this._li.Result(
|
2689
|
+
Result(key, res) {
|
2690
|
+
this._li.Result(key, res);
|
2686
2691
|
return this;
|
2687
2692
|
}
|
2688
|
-
Url(url,
|
2689
|
-
this._li.Url(url,
|
2693
|
+
Url(url, key) {
|
2694
|
+
this._li.Url(url, key);
|
2690
2695
|
return this;
|
2691
2696
|
}
|
2692
|
-
Int(
|
2693
|
-
this._li.Int(
|
2697
|
+
Int(key, value) {
|
2698
|
+
this._li.Int(key, value);
|
2694
2699
|
return this;
|
2695
2700
|
}
|
2696
2701
|
Log() {
|
@@ -2725,16 +2730,16 @@ var WithLoggerBuilder = class {
|
|
2725
2730
|
this._li.Timestamp();
|
2726
2731
|
return this;
|
2727
2732
|
}
|
2728
|
-
Any(
|
2729
|
-
this._li.Any(
|
2733
|
+
Any(key, value) {
|
2734
|
+
this._li.Any(key, value);
|
2730
2735
|
return this;
|
2731
2736
|
}
|
2732
|
-
Dur(
|
2733
|
-
this._li.Dur(
|
2737
|
+
Dur(key, nsec) {
|
2738
|
+
this._li.Dur(key, nsec);
|
2734
2739
|
return this;
|
2735
2740
|
}
|
2736
|
-
Uint64(
|
2737
|
-
this._li.Uint64(
|
2741
|
+
Uint64(key, value) {
|
2742
|
+
this._li.Uint64(key, value);
|
2738
2743
|
return this;
|
2739
2744
|
}
|
2740
2745
|
};
|
@@ -2899,8 +2904,8 @@ var Metrics = class {
|
|
2899
2904
|
}
|
2900
2905
|
toJSON() {
|
2901
2906
|
const obj = {};
|
2902
|
-
for (const [
|
2903
|
-
obj[
|
2907
|
+
for (const [key, value] of this.map) {
|
2908
|
+
obj[key] = value.value;
|
2904
2909
|
}
|
2905
2910
|
return obj;
|
2906
2911
|
}
|
@@ -3073,15 +3078,15 @@ var HeadersImpl = class extends Headers {
|
|
3073
3078
|
values() {
|
3074
3079
|
return this._headers.values();
|
3075
3080
|
}
|
3076
|
-
append(
|
3077
|
-
const values = this._headers.get(
|
3081
|
+
append(key, value) {
|
3082
|
+
const values = this._headers.get(key);
|
3078
3083
|
if (typeof value === "undefined") {
|
3079
3084
|
value = "";
|
3080
3085
|
}
|
3081
3086
|
if (Array.isArray(value)) {
|
3082
|
-
this._headers.set(
|
3087
|
+
this._headers.set(key, [values, ...value].filter((i) => i).join(", "));
|
3083
3088
|
} else {
|
3084
|
-
this._headers.set(
|
3089
|
+
this._headers.set(key, [values, value].filter((i) => i).join(", "));
|
3085
3090
|
}
|
3086
3091
|
return this;
|
3087
3092
|
}
|
@@ -3124,38 +3129,38 @@ var HttpHeader = class _HttpHeader {
|
|
3124
3129
|
}
|
3125
3130
|
_asStringString() {
|
3126
3131
|
const ret = /* @__PURE__ */ new Map();
|
3127
|
-
for (const [
|
3128
|
-
ret.set(
|
3132
|
+
for (const [key, values] of this._headers) {
|
3133
|
+
ret.set(key, values.join(", "));
|
3129
3134
|
}
|
3130
3135
|
return ret;
|
3131
3136
|
}
|
3132
|
-
_key(
|
3133
|
-
return
|
3137
|
+
_key(key) {
|
3138
|
+
return key.toLowerCase();
|
3134
3139
|
}
|
3135
|
-
Values(
|
3136
|
-
const values = this._headers.get(this._key(
|
3140
|
+
Values(key) {
|
3141
|
+
const values = this._headers.get(this._key(key));
|
3137
3142
|
return values || [];
|
3138
3143
|
}
|
3139
|
-
Get(
|
3140
|
-
const values = this._headers.get(this._key(
|
3144
|
+
Get(key) {
|
3145
|
+
const values = this._headers.get(this._key(key));
|
3141
3146
|
if (values === void 0 || values.length === 0) {
|
3142
3147
|
return void 0;
|
3143
3148
|
}
|
3144
3149
|
return values[0];
|
3145
3150
|
}
|
3146
|
-
Set(
|
3151
|
+
Set(key, valueOr) {
|
3147
3152
|
const value = Array.isArray(valueOr) ? valueOr : [valueOr];
|
3148
|
-
this._headers.set(this._key(
|
3153
|
+
this._headers.set(this._key(key), value);
|
3149
3154
|
return this;
|
3150
3155
|
}
|
3151
|
-
Add(
|
3156
|
+
Add(key, value) {
|
3152
3157
|
if (typeof value === "undefined") {
|
3153
3158
|
return this;
|
3154
3159
|
}
|
3155
3160
|
const vs = Array.isArray(value) ? value : [value];
|
3156
|
-
const values = this._headers.get(this._key(
|
3161
|
+
const values = this._headers.get(this._key(key));
|
3157
3162
|
if (values === void 0) {
|
3158
|
-
this._headers.set(this._key(
|
3163
|
+
this._headers.set(this._key(key), vs);
|
3159
3164
|
} else {
|
3160
3165
|
values.push(...vs);
|
3161
3166
|
}
|
@@ -3173,29 +3178,29 @@ var HttpHeader = class _HttpHeader {
|
|
3173
3178
|
}
|
3174
3179
|
Clone() {
|
3175
3180
|
const clone = new _HttpHeader();
|
3176
|
-
for (const [
|
3177
|
-
clone._headers.set(
|
3181
|
+
for (const [key, values] of this._headers.entries()) {
|
3182
|
+
clone._headers.set(key, values.slice());
|
3178
3183
|
}
|
3179
3184
|
return clone;
|
3180
3185
|
}
|
3181
3186
|
AsRecordStringStringArray() {
|
3182
3187
|
const obj = {};
|
3183
|
-
for (const [
|
3184
|
-
obj[
|
3188
|
+
for (const [key, values] of this._headers.entries()) {
|
3189
|
+
obj[key] = [...values];
|
3185
3190
|
}
|
3186
3191
|
return obj;
|
3187
3192
|
}
|
3188
3193
|
AsRecordStringString() {
|
3189
3194
|
const obj = {};
|
3190
|
-
for (const [
|
3191
|
-
obj[
|
3195
|
+
for (const [key, values] of this._headers.entries()) {
|
3196
|
+
obj[key] = values.join(", ");
|
3192
3197
|
}
|
3193
3198
|
return obj;
|
3194
3199
|
}
|
3195
3200
|
AsHeaderInit() {
|
3196
3201
|
const obj = {};
|
3197
|
-
for (const [
|
3198
|
-
obj[
|
3202
|
+
for (const [key, values] of this._headers.entries()) {
|
3203
|
+
obj[key] = values[0];
|
3199
3204
|
}
|
3200
3205
|
return obj;
|
3201
3206
|
}
|
@@ -3205,8 +3210,8 @@ var HttpHeader = class _HttpHeader {
|
|
3205
3210
|
Merge(other) {
|
3206
3211
|
const ret = this.Clone();
|
3207
3212
|
if (other) {
|
3208
|
-
for (const [
|
3209
|
-
ret.Add(
|
3213
|
+
for (const [key, values] of other.Items()) {
|
3214
|
+
ret.Add(key, values);
|
3210
3215
|
}
|
3211
3216
|
}
|
3212
3217
|
return ret;
|
@@ -3299,7 +3304,6 @@ __export(utils_exports, {
|
|
3299
3304
|
coerceIntoUint8: () => coerceIntoUint8,
|
3300
3305
|
devnull: () => devnull,
|
3301
3306
|
getParamsResult: () => getParamsResult,
|
3302
|
-
param: () => param,
|
3303
3307
|
rebuffer: () => rebuffer,
|
3304
3308
|
rebufferArray: () => rebufferArray,
|
3305
3309
|
stream2array: () => stream2array,
|
@@ -3524,9 +3528,6 @@ function UInt8ArrayEqual(a, b) {
|
|
3524
3528
|
}
|
3525
3529
|
return true;
|
3526
3530
|
}
|
3527
|
-
|
3528
|
-
// src/index.ts
|
3529
|
-
var param2 = param;
|
3530
3531
|
// Annotate the CommonJS export names for ESM import in node:
|
3531
3532
|
0 && (module.exports = {
|
3532
3533
|
BaseSysAbstraction,
|
@@ -3586,7 +3587,6 @@ var param2 = param;
|
|
3586
3587
|
hasHostPartProtocols,
|
3587
3588
|
isCoerceURI,
|
3588
3589
|
isURL,
|
3589
|
-
key,
|
3590
3590
|
logValue,
|
3591
3591
|
param,
|
3592
3592
|
pathOps,
|