@adviser/cement 0.2.40 → 0.2.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.cts CHANGED
@@ -4,9 +4,35 @@ import { T as TxtEnDecoder } from './txt-en-decoder-CZYJUju2.cjs';
4
4
  export { U as Utf8EnDecoder, a as Utf8EnDecoderSingleton } from './txt-en-decoder-CZYJUju2.cjs';
5
5
  export { i as utils } from './index-Q3phXzYr.cjs';
6
6
 
7
+ declare abstract class Option<T> {
8
+ static Some<T>(t: T): Option<T>;
9
+ static None<T>(): Option<T>;
10
+ static Is<T>(t: unknown): t is Option<T>;
11
+ static From<T>(t?: T): Option<T>;
12
+ IsNone(): boolean;
13
+ IsSome(): boolean;
14
+ Unwrap(): T;
15
+ abstract is_none(): boolean;
16
+ abstract is_some(): boolean;
17
+ abstract unwrap(): T;
18
+ }
19
+ declare class Some<T> extends Option<T> {
20
+ private _t;
21
+ constructor(_t: T);
22
+ is_none(): boolean;
23
+ is_some(): boolean;
24
+ unwrap(): T;
25
+ }
26
+ declare class None<T> extends Option<T> {
27
+ is_none(): boolean;
28
+ is_some(): boolean;
29
+ unwrap(): T;
30
+ }
31
+ type WithoutOption<T> = T extends Option<infer U> ? U : T;
32
+
7
33
  declare abstract class Result<T, E = Error> {
8
34
  static Ok<T = void>(t: T): Result<T, Error>;
9
- static Err<T, E extends Error = Error>(t: E | string): Result<T, E>;
35
+ static Err<T, E extends Error = Error>(t: E | string | Result<unknown, E>): Result<T, E>;
10
36
  static Is<T>(t: unknown): t is Result<T>;
11
37
  isOk(): boolean;
12
38
  isErr(): boolean;
@@ -42,7 +68,8 @@ type StripCommand = string | RegExp;
42
68
  type NullOrUndef = null | undefined;
43
69
  type OneKey<K extends string, V = string> = Record<K, V>;
44
70
  type MsgFn = (...keys: string[]) => string;
45
- type KeysParam = (string | MsgFn | Record<string, unknown>)[];
71
+ declare const REQUIRED = 4711;
72
+ type KeysParam = (string | MsgFn | Record<string, typeof REQUIRED | unknown>)[];
46
73
  interface URIInterface<R extends URIInterface<R>> {
47
74
  readonly getParams: Iterable<[string, string]>;
48
75
  hasParam(key: string): boolean;
@@ -161,7 +188,11 @@ declare class LogValue {
161
188
  type LogSerializable = Record<string, LogValue | Promise<LogValue>>;
162
189
  declare function asyncLogValue(val: () => Promise<Serialized>): Promise<LogValue>;
163
190
  type LogValueArg = LogValue | Serialized | Serialized[] | FnSerialized | undefined | null;
164
- declare function logValue(val: LogValueArg, state?: Set<unknown>): LogValue;
191
+ interface LogValueState {
192
+ readonly state?: Set<unknown>;
193
+ readonly ignoreAttr: Option<RegExp>;
194
+ }
195
+ declare function logValue(val: LogValueArg, ctx: LogValueState): LogValue;
165
196
  interface Sized {
166
197
  size: number;
167
198
  }
@@ -176,18 +207,22 @@ interface LevelHandler {
176
207
  enableLevel(level: Level, ...modules: string[]): void;
177
208
  disableLevel(level: Level, ...modules: string[]): void;
178
209
  setExposeStack(enable?: boolean): void;
210
+ setIgnoreAttr(re?: RegExp): void;
211
+ ignoreAttr: Option<RegExp>;
179
212
  isStackExposed: boolean;
180
213
  setDebug(...modules: (string | string[])[]): void;
181
214
  isEnabled(ilevel: unknown, module: unknown): boolean;
182
215
  }
183
216
  type HttpType = Response | Result<Response> | Request | Result<Request>;
184
217
  interface LoggerInterface<R> {
218
+ readonly levelHandler: LevelHandler;
185
219
  TxtEnDe(): TxtEnDecoder;
186
220
  Module(key: string): R;
187
221
  EnableLevel(level: Level, ...modules: string[]): R;
188
222
  DisableLevel(level: Level, ...modules: string[]): R;
189
223
  Attributes(): Record<string, unknown>;
190
224
  SetDebug(...modules: (string | string[])[]): R;
225
+ SetIgnoreAttribute(re?: RegExp): R;
191
226
  SetExposeStack(enable?: boolean): R;
192
227
  SetFormatter(fmt: LogFormatter): R;
193
228
  Ref(key: string, action: {
@@ -264,7 +299,7 @@ declare class LoggerImpl implements Logger {
264
299
  readonly _attributes: LogSerializable;
265
300
  readonly _withAttributes: LogSerializable;
266
301
  readonly _logWriter: LogWriterStream;
267
- readonly _levelHandler: LevelHandler;
302
+ readonly levelHandler: LevelHandler;
268
303
  readonly _txtEnDe: TxtEnDecoder;
269
304
  _formatter: LogFormatter;
270
305
  constructor(params?: LoggerImplParams);
@@ -275,6 +310,7 @@ declare class LoggerImpl implements Logger {
275
310
  DisableLevel(level: Level, ...modules: string[]): Logger;
276
311
  Module(key: string): Logger;
277
312
  SetDebug(...modules: (string | string[])[]): Logger;
313
+ SetIgnoreAttribute(re?: RegExp): Logger;
278
314
  SetFormatter(formatter: LogFormatter): Logger;
279
315
  Timestamp(): Logger;
280
316
  Warn(): Logger;
@@ -353,41 +389,18 @@ declare function MockLogger(params?: {
353
389
  declare class LevelHandlerImpl implements LevelHandler {
354
390
  readonly _globalLevels: Set<Level>;
355
391
  readonly _modules: Map<string, Set<Level>>;
392
+ ignoreAttr: Option<RegExp>;
356
393
  isStackExposed: boolean;
357
394
  enableLevel(level: Level, ...modules: string[]): void;
358
395
  disableLevel(level: Level, ...modules: string[]): void;
359
396
  setExposeStack(enable?: boolean): void;
397
+ setIgnoreAttr(re?: RegExp): void;
360
398
  forModules(level: Level, fnAction: (p: string) => void, ...modules: (string | string[])[]): void;
361
399
  setDebug(...modules: (string | string[])[]): void;
362
400
  isEnabled(ilevel: unknown, module: unknown): boolean;
363
401
  }
364
402
  declare function LevelHandlerSingleton(): LevelHandler;
365
403
 
366
- declare abstract class Option<T> {
367
- static Some<T>(t: T): Option<T>;
368
- static None<T>(): Option<T>;
369
- static Is<T>(t: unknown): t is Option<T>;
370
- IsNone(): boolean;
371
- IsSome(): boolean;
372
- Unwrap(): T;
373
- abstract is_none(): boolean;
374
- abstract is_some(): boolean;
375
- abstract unwrap(): T;
376
- }
377
- declare class Some<T> extends Option<T> {
378
- private _t;
379
- constructor(_t: T);
380
- is_none(): boolean;
381
- is_some(): boolean;
382
- unwrap(): T;
383
- }
384
- declare class None<T> extends Option<T> {
385
- is_none(): boolean;
386
- is_some(): boolean;
387
- unwrap(): T;
388
- }
389
- type WithoutOption<T> = T extends Option<infer U> ? U : T;
390
-
391
404
  type TraceCtx = {
392
405
  readonly spanId: string;
393
406
  readonly time: Time;
@@ -577,4 +590,4 @@ declare function bin2string(hex: ArrayBufferView, size?: number): string;
577
590
 
578
591
  declare const VERSION: string;
579
592
 
580
- 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 };
593
+ 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, type LogValueState, LogWriteStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, Metric, type MetricMap, Metrics, MockLogger, type MockLoggerReturn, type MsgFn, MutableURL, None, Option, type PathURIObject, REQUIRED, 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
@@ -4,9 +4,35 @@ import { T as TxtEnDecoder } from './txt-en-decoder-CZYJUju2.js';
4
4
  export { U as Utf8EnDecoder, a as Utf8EnDecoderSingleton } from './txt-en-decoder-CZYJUju2.js';
5
5
  export { i as utils } from './index-tIGZMHTc.js';
6
6
 
7
+ declare abstract class Option<T> {
8
+ static Some<T>(t: T): Option<T>;
9
+ static None<T>(): Option<T>;
10
+ static Is<T>(t: unknown): t is Option<T>;
11
+ static From<T>(t?: T): Option<T>;
12
+ IsNone(): boolean;
13
+ IsSome(): boolean;
14
+ Unwrap(): T;
15
+ abstract is_none(): boolean;
16
+ abstract is_some(): boolean;
17
+ abstract unwrap(): T;
18
+ }
19
+ declare class Some<T> extends Option<T> {
20
+ private _t;
21
+ constructor(_t: T);
22
+ is_none(): boolean;
23
+ is_some(): boolean;
24
+ unwrap(): T;
25
+ }
26
+ declare class None<T> extends Option<T> {
27
+ is_none(): boolean;
28
+ is_some(): boolean;
29
+ unwrap(): T;
30
+ }
31
+ type WithoutOption<T> = T extends Option<infer U> ? U : T;
32
+
7
33
  declare abstract class Result<T, E = Error> {
8
34
  static Ok<T = void>(t: T): Result<T, Error>;
9
- static Err<T, E extends Error = Error>(t: E | string): Result<T, E>;
35
+ static Err<T, E extends Error = Error>(t: E | string | Result<unknown, E>): Result<T, E>;
10
36
  static Is<T>(t: unknown): t is Result<T>;
11
37
  isOk(): boolean;
12
38
  isErr(): boolean;
@@ -42,7 +68,8 @@ type StripCommand = string | RegExp;
42
68
  type NullOrUndef = null | undefined;
43
69
  type OneKey<K extends string, V = string> = Record<K, V>;
44
70
  type MsgFn = (...keys: string[]) => string;
45
- type KeysParam = (string | MsgFn | Record<string, unknown>)[];
71
+ declare const REQUIRED = 4711;
72
+ type KeysParam = (string | MsgFn | Record<string, typeof REQUIRED | unknown>)[];
46
73
  interface URIInterface<R extends URIInterface<R>> {
47
74
  readonly getParams: Iterable<[string, string]>;
48
75
  hasParam(key: string): boolean;
@@ -161,7 +188,11 @@ declare class LogValue {
161
188
  type LogSerializable = Record<string, LogValue | Promise<LogValue>>;
162
189
  declare function asyncLogValue(val: () => Promise<Serialized>): Promise<LogValue>;
163
190
  type LogValueArg = LogValue | Serialized | Serialized[] | FnSerialized | undefined | null;
164
- declare function logValue(val: LogValueArg, state?: Set<unknown>): LogValue;
191
+ interface LogValueState {
192
+ readonly state?: Set<unknown>;
193
+ readonly ignoreAttr: Option<RegExp>;
194
+ }
195
+ declare function logValue(val: LogValueArg, ctx: LogValueState): LogValue;
165
196
  interface Sized {
166
197
  size: number;
167
198
  }
@@ -176,18 +207,22 @@ interface LevelHandler {
176
207
  enableLevel(level: Level, ...modules: string[]): void;
177
208
  disableLevel(level: Level, ...modules: string[]): void;
178
209
  setExposeStack(enable?: boolean): void;
210
+ setIgnoreAttr(re?: RegExp): void;
211
+ ignoreAttr: Option<RegExp>;
179
212
  isStackExposed: boolean;
180
213
  setDebug(...modules: (string | string[])[]): void;
181
214
  isEnabled(ilevel: unknown, module: unknown): boolean;
182
215
  }
183
216
  type HttpType = Response | Result<Response> | Request | Result<Request>;
184
217
  interface LoggerInterface<R> {
218
+ readonly levelHandler: LevelHandler;
185
219
  TxtEnDe(): TxtEnDecoder;
186
220
  Module(key: string): R;
187
221
  EnableLevel(level: Level, ...modules: string[]): R;
188
222
  DisableLevel(level: Level, ...modules: string[]): R;
189
223
  Attributes(): Record<string, unknown>;
190
224
  SetDebug(...modules: (string | string[])[]): R;
225
+ SetIgnoreAttribute(re?: RegExp): R;
191
226
  SetExposeStack(enable?: boolean): R;
192
227
  SetFormatter(fmt: LogFormatter): R;
193
228
  Ref(key: string, action: {
@@ -264,7 +299,7 @@ declare class LoggerImpl implements Logger {
264
299
  readonly _attributes: LogSerializable;
265
300
  readonly _withAttributes: LogSerializable;
266
301
  readonly _logWriter: LogWriterStream;
267
- readonly _levelHandler: LevelHandler;
302
+ readonly levelHandler: LevelHandler;
268
303
  readonly _txtEnDe: TxtEnDecoder;
269
304
  _formatter: LogFormatter;
270
305
  constructor(params?: LoggerImplParams);
@@ -275,6 +310,7 @@ declare class LoggerImpl implements Logger {
275
310
  DisableLevel(level: Level, ...modules: string[]): Logger;
276
311
  Module(key: string): Logger;
277
312
  SetDebug(...modules: (string | string[])[]): Logger;
313
+ SetIgnoreAttribute(re?: RegExp): Logger;
278
314
  SetFormatter(formatter: LogFormatter): Logger;
279
315
  Timestamp(): Logger;
280
316
  Warn(): Logger;
@@ -353,41 +389,18 @@ declare function MockLogger(params?: {
353
389
  declare class LevelHandlerImpl implements LevelHandler {
354
390
  readonly _globalLevels: Set<Level>;
355
391
  readonly _modules: Map<string, Set<Level>>;
392
+ ignoreAttr: Option<RegExp>;
356
393
  isStackExposed: boolean;
357
394
  enableLevel(level: Level, ...modules: string[]): void;
358
395
  disableLevel(level: Level, ...modules: string[]): void;
359
396
  setExposeStack(enable?: boolean): void;
397
+ setIgnoreAttr(re?: RegExp): void;
360
398
  forModules(level: Level, fnAction: (p: string) => void, ...modules: (string | string[])[]): void;
361
399
  setDebug(...modules: (string | string[])[]): void;
362
400
  isEnabled(ilevel: unknown, module: unknown): boolean;
363
401
  }
364
402
  declare function LevelHandlerSingleton(): LevelHandler;
365
403
 
366
- declare abstract class Option<T> {
367
- static Some<T>(t: T): Option<T>;
368
- static None<T>(): Option<T>;
369
- static Is<T>(t: unknown): t is Option<T>;
370
- IsNone(): boolean;
371
- IsSome(): boolean;
372
- Unwrap(): T;
373
- abstract is_none(): boolean;
374
- abstract is_some(): boolean;
375
- abstract unwrap(): T;
376
- }
377
- declare class Some<T> extends Option<T> {
378
- private _t;
379
- constructor(_t: T);
380
- is_none(): boolean;
381
- is_some(): boolean;
382
- unwrap(): T;
383
- }
384
- declare class None<T> extends Option<T> {
385
- is_none(): boolean;
386
- is_some(): boolean;
387
- unwrap(): T;
388
- }
389
- type WithoutOption<T> = T extends Option<infer U> ? U : T;
390
-
391
404
  type TraceCtx = {
392
405
  readonly spanId: string;
393
406
  readonly time: Time;
@@ -577,4 +590,4 @@ declare function bin2string(hex: ArrayBufferView, size?: number): string;
577
590
 
578
591
  declare const VERSION: string;
579
592
 
580
- 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 };
593
+ 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, type LogValueState, LogWriteStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, Metric, type MetricMap, Metrics, MockLogger, type MockLoggerReturn, type MsgFn, MutableURL, None, Option, type PathURIObject, REQUIRED, 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 };