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