@adviser/cement 0.2.37 → 0.2.38

Sign up to get free protection for your applications and to get access to all the features.
package/index.d.cts CHANGED
@@ -41,12 +41,14 @@ type StripCommand = string | RegExp;
41
41
 
42
42
  type NullOrUndef = null | undefined;
43
43
  type OneKey<K extends string, V = string> = Record<K, V>;
44
+ type MsgFn = (...keys: string[]) => string;
45
+ type KeysParam = (string | MsgFn | Record<string, unknown>)[];
44
46
  interface URIInterface<R extends URIInterface<R>> {
45
47
  readonly getParams: Iterable<[string, string]>;
46
48
  hasParam(key: string): boolean;
47
49
  getParam<T extends string | undefined>(key: string | OneKey<string>, def?: T): T extends string ? string : string | undefined;
48
50
  getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
49
- getParamsResult(...keys: keysParam): Result<Record<string, string>>;
51
+ getParamsResult(...keys: KeysParam): Result<Record<string, string>>;
50
52
  clone(): R;
51
53
  asURL(): URL;
52
54
  toString(): string;
@@ -88,8 +90,6 @@ declare class MutableURL extends URL {
88
90
  get searchParams(): URLSearchParams;
89
91
  toString(): string;
90
92
  }
91
- type msgFn = (...keys: string[]) => string;
92
- type keysParam = (string | msgFn | Record<string, unknown>)[];
93
93
  declare class BuildURI implements URIInterface<BuildURI> {
94
94
  _url: MutableURL;
95
95
  private constructor();
@@ -107,7 +107,7 @@ declare class BuildURI implements URIInterface<BuildURI> {
107
107
  get getParams(): Iterable<[string, string]>;
108
108
  getParam<T extends string | undefined>(key: string | OneKey<string>, def?: T): T extends string ? string : string | undefined;
109
109
  getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
110
- getParamsResult(...keys: keysParam): Result<Record<string, string>>;
110
+ getParamsResult(...keys: KeysParam): Result<Record<string, string>>;
111
111
  toString(): string;
112
112
  toJSON(): string;
113
113
  asURL(): URL;
@@ -135,7 +135,7 @@ declare class URI implements URIInterface<URI> {
135
135
  hasParam(key: string): boolean;
136
136
  getParam<T extends string | undefined>(key: string | OneKey<string>, def?: T): T extends string ? string : string | undefined;
137
137
  getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
138
- getParamsResult(...keys: keysParam): Result<Record<string, string>>;
138
+ getParamsResult(...keys: KeysParam): Result<Record<string, string>>;
139
139
  clone(): URI;
140
140
  asURL(): URL;
141
141
  toString(): string;
@@ -576,4 +576,4 @@ declare function bin2string(hex: ArrayBufferView, size?: number): string;
576
576
 
577
577
  declare const VERSION: string;
578
578
 
579
- export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CleanCtx, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, type HostURIObject, type HttpType, type Invokaction, IsLogger, JSONFormatter, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LevelHandlerSingleton, LogCollector, type LogFormatter, type LogSerializable, LogValue, type LogValueArg, LogWriteStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, Metric, type MetricMap, Metrics, MockLogger, type MockLoggerReturn, MutableURL, None, Option, type PathURIObject, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, Time, type TraceCtx, type TraceCtxParam, TraceNode, type TraceNodeMap, TxtEnDecoder, URI, type URIInterface, type URIObject, VERSION, type WithLogger, type WithoutOption, type WithoutResult, YAMLFormatter, asyncLogValue, bin2string, bin2text, exception2Result, hasHostPartProtocols, isURL, logValue, runtimeFn, toCryptoRuntime };
579
+ export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CleanCtx, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, type HostURIObject, type HttpType, type Invokaction, IsLogger, JSONFormatter, Keyed, KeyedResolvOnce, KeyedResolvSeq, type KeysParam, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LevelHandlerSingleton, LogCollector, type LogFormatter, type LogSerializable, LogValue, type LogValueArg, LogWriteStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, Metric, type MetricMap, Metrics, MockLogger, type MockLoggerReturn, type MsgFn, MutableURL, None, Option, type PathURIObject, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, Time, type TraceCtx, type TraceCtxParam, TraceNode, type TraceNodeMap, TxtEnDecoder, URI, type URIInterface, type URIObject, VERSION, type WithLogger, type WithoutOption, type WithoutResult, YAMLFormatter, asyncLogValue, bin2string, bin2text, exception2Result, hasHostPartProtocols, isURL, logValue, runtimeFn, toCryptoRuntime };
package/index.d.ts CHANGED
@@ -41,12 +41,14 @@ type StripCommand = string | RegExp;
41
41
 
42
42
  type NullOrUndef = null | undefined;
43
43
  type OneKey<K extends string, V = string> = Record<K, V>;
44
+ type MsgFn = (...keys: string[]) => string;
45
+ type KeysParam = (string | MsgFn | Record<string, unknown>)[];
44
46
  interface URIInterface<R extends URIInterface<R>> {
45
47
  readonly getParams: Iterable<[string, string]>;
46
48
  hasParam(key: string): boolean;
47
49
  getParam<T extends string | undefined>(key: string | OneKey<string>, def?: T): T extends string ? string : string | undefined;
48
50
  getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
49
- getParamsResult(...keys: keysParam): Result<Record<string, string>>;
51
+ getParamsResult(...keys: KeysParam): Result<Record<string, string>>;
50
52
  clone(): R;
51
53
  asURL(): URL;
52
54
  toString(): string;
@@ -88,8 +90,6 @@ declare class MutableURL extends URL {
88
90
  get searchParams(): URLSearchParams;
89
91
  toString(): string;
90
92
  }
91
- type msgFn = (...keys: string[]) => string;
92
- type keysParam = (string | msgFn | Record<string, unknown>)[];
93
93
  declare class BuildURI implements URIInterface<BuildURI> {
94
94
  _url: MutableURL;
95
95
  private constructor();
@@ -107,7 +107,7 @@ declare class BuildURI implements URIInterface<BuildURI> {
107
107
  get getParams(): Iterable<[string, string]>;
108
108
  getParam<T extends string | undefined>(key: string | OneKey<string>, def?: T): T extends string ? string : string | undefined;
109
109
  getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
110
- getParamsResult(...keys: keysParam): Result<Record<string, string>>;
110
+ getParamsResult(...keys: KeysParam): Result<Record<string, string>>;
111
111
  toString(): string;
112
112
  toJSON(): string;
113
113
  asURL(): URL;
@@ -135,7 +135,7 @@ declare class URI implements URIInterface<URI> {
135
135
  hasParam(key: string): boolean;
136
136
  getParam<T extends string | undefined>(key: string | OneKey<string>, def?: T): T extends string ? string : string | undefined;
137
137
  getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
138
- getParamsResult(...keys: keysParam): Result<Record<string, string>>;
138
+ getParamsResult(...keys: KeysParam): Result<Record<string, string>>;
139
139
  clone(): URI;
140
140
  asURL(): URL;
141
141
  toString(): string;
@@ -576,4 +576,4 @@ declare function bin2string(hex: ArrayBufferView, size?: number): string;
576
576
 
577
577
  declare const VERSION: string;
578
578
 
579
- export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CleanCtx, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, type HostURIObject, type HttpType, type Invokaction, IsLogger, JSONFormatter, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LevelHandlerSingleton, LogCollector, type LogFormatter, type LogSerializable, LogValue, type LogValueArg, LogWriteStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, Metric, type MetricMap, Metrics, MockLogger, type MockLoggerReturn, MutableURL, None, Option, type PathURIObject, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, Time, type TraceCtx, type TraceCtxParam, TraceNode, type TraceNodeMap, TxtEnDecoder, URI, type URIInterface, type URIObject, VERSION, type WithLogger, type WithoutOption, type WithoutResult, YAMLFormatter, asyncLogValue, bin2string, bin2text, exception2Result, hasHostPartProtocols, isURL, logValue, runtimeFn, toCryptoRuntime };
579
+ export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CleanCtx, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, type HostURIObject, type HttpType, type Invokaction, IsLogger, JSONFormatter, Keyed, KeyedResolvOnce, KeyedResolvSeq, type KeysParam, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LevelHandlerSingleton, LogCollector, type LogFormatter, type LogSerializable, LogValue, type LogValueArg, LogWriteStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, Metric, type MetricMap, Metrics, MockLogger, type MockLoggerReturn, type MsgFn, MutableURL, None, Option, type PathURIObject, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, Time, type TraceCtx, type TraceCtxParam, TraceNode, type TraceNodeMap, TxtEnDecoder, URI, type URIInterface, type URIObject, VERSION, type WithLogger, type WithoutOption, type WithoutResult, YAMLFormatter, asyncLogValue, bin2string, bin2text, exception2Result, hasHostPartProtocols, isURL, logValue, runtimeFn, toCryptoRuntime };
package/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-USQXEZHL.js";
6
6
  import {
7
7
  WebSysAbstraction
8
- } from "./chunk-WMMUXBDX.js";
8
+ } from "./chunk-W2GV5KXV.js";
9
9
  import {
10
10
  BaseSysAbstraction,
11
11
  BrowserEnvActions,
@@ -30,7 +30,7 @@ import {
30
30
  TimeUnits,
31
31
  WrapperSysAbstraction,
32
32
  envFactory
33
- } from "./chunk-Q65HLCNL.js";
33
+ } from "./chunk-F5W6VELE.js";
34
34
  import {
35
35
  Utf8EnDecoder,
36
36
  Utf8EnDecoderSingleton,
@@ -141,7 +141,14 @@ function logValue(val, state = /* @__PURE__ */ new Set([Math.random()])) {
141
141
  return new LogValue(() => "null");
142
142
  }
143
143
  if (ArrayBuffer.isView(val)) {
144
- return logValue(bin2string(val, 512));
144
+ try {
145
+ const decoder = new TextDecoder();
146
+ const asStr = decoder.decode(val);
147
+ const obj = JSON.parse(asStr);
148
+ return logValue(obj, state);
149
+ } catch (e) {
150
+ return logValue(bin2string(val, 512));
151
+ }
145
152
  }
146
153
  if (Array.isArray(val)) {
147
154
  return new LogValue(() => val.map((v) => logValue(v).value()));