@adviser/cement 0.2.26 → 0.2.28

Sign up to get free protection for your applications and to get access to all the features.
package/index.d.cts CHANGED
@@ -146,6 +146,7 @@ interface LoggerInterface<R> {
146
146
  Attributes(): Record<string, unknown>;
147
147
  SetDebug(...modules: (string | string[])[]): R;
148
148
  SetExposeStack(enable?: boolean): R;
149
+ SetFormatter(fmt: LogFormatter): R;
149
150
  Ref(key: string, action: {
150
151
  toString: () => string;
151
152
  } | FnSerialized): R;
@@ -219,7 +220,7 @@ declare class LoggerImpl implements Logger {
219
220
  readonly _logWriter: LogWriterStream;
220
221
  readonly _levelHandler: LevelHandler;
221
222
  readonly _txtEnDe: TxtEnDecoder;
222
- readonly _formatter: LogFormatter;
223
+ _formatter: LogFormatter;
223
224
  constructor(params?: LoggerImplParams);
224
225
  TxtEnDe(): TxtEnDecoder;
225
226
  Attributes(): Record<string, unknown>;
@@ -228,6 +229,7 @@ declare class LoggerImpl implements Logger {
228
229
  DisableLevel(level: Level, ...modules: string[]): Logger;
229
230
  Module(key: string): Logger;
230
231
  SetDebug(...modules: (string | string[])[]): Logger;
232
+ SetFormatter(formatter: LogFormatter): Logger;
231
233
  Timestamp(): Logger;
232
234
  Warn(): Logger;
233
235
  Log(): Logger;
@@ -448,6 +450,7 @@ interface CTArrayBufferView {
448
450
  type CTBufferSource = CTArrayBufferView | ArrayBuffer;
449
451
  interface CryptoRuntime {
450
452
  importKey(format: CTKeyFormat, keyData: CTJsonWebKey | CTBufferSource, algorithm: CTAlgorithmIdentifier | CTRsaHashedImportParams | CTEcKeyImportParams | CTHmacImportParams | CTAesKeyAlgorithm, extractable: boolean, keyUsages: CTKeyUsage[]): Promise<CTCryptoKey>;
453
+ exportKey(format: CTKeyFormat, key: CTCryptoKey): Promise<CTJsonWebKey | ArrayBuffer>;
451
454
  decrypt(algo: {
452
455
  name: string;
453
456
  iv: Uint8Array;
package/index.d.ts CHANGED
@@ -146,6 +146,7 @@ interface LoggerInterface<R> {
146
146
  Attributes(): Record<string, unknown>;
147
147
  SetDebug(...modules: (string | string[])[]): R;
148
148
  SetExposeStack(enable?: boolean): R;
149
+ SetFormatter(fmt: LogFormatter): R;
149
150
  Ref(key: string, action: {
150
151
  toString: () => string;
151
152
  } | FnSerialized): R;
@@ -219,7 +220,7 @@ declare class LoggerImpl implements Logger {
219
220
  readonly _logWriter: LogWriterStream;
220
221
  readonly _levelHandler: LevelHandler;
221
222
  readonly _txtEnDe: TxtEnDecoder;
222
- readonly _formatter: LogFormatter;
223
+ _formatter: LogFormatter;
223
224
  constructor(params?: LoggerImplParams);
224
225
  TxtEnDe(): TxtEnDecoder;
225
226
  Attributes(): Record<string, unknown>;
@@ -228,6 +229,7 @@ declare class LoggerImpl implements Logger {
228
229
  DisableLevel(level: Level, ...modules: string[]): Logger;
229
230
  Module(key: string): Logger;
230
231
  SetDebug(...modules: (string | string[])[]): Logger;
232
+ SetFormatter(formatter: LogFormatter): Logger;
231
233
  Timestamp(): Logger;
232
234
  Warn(): Logger;
233
235
  Log(): Logger;
@@ -448,6 +450,7 @@ interface CTArrayBufferView {
448
450
  type CTBufferSource = CTArrayBufferView | ArrayBuffer;
449
451
  interface CryptoRuntime {
450
452
  importKey(format: CTKeyFormat, keyData: CTJsonWebKey | CTBufferSource, algorithm: CTAlgorithmIdentifier | CTRsaHashedImportParams | CTEcKeyImportParams | CTHmacImportParams | CTAesKeyAlgorithm, extractable: boolean, keyUsages: CTKeyUsage[]): Promise<CTCryptoKey>;
453
+ exportKey(format: CTKeyFormat, key: CTCryptoKey): Promise<CTJsonWebKey | ArrayBuffer>;
451
454
  decrypt(algo: {
452
455
  name: string;
453
456
  iv: Uint8Array;
package/index.js CHANGED
@@ -8079,6 +8079,10 @@ var LoggerImpl = class _LoggerImpl {
8079
8079
  this._levelHandler.setDebug(...modules);
8080
8080
  return this;
8081
8081
  }
8082
+ SetFormatter(formatter) {
8083
+ this._formatter = formatter;
8084
+ return this;
8085
+ }
8082
8086
  Timestamp() {
8083
8087
  this._attributes["ts"] = logValue(() => this._sys.Time().Now().toISOString());
8084
8088
  return this;
@@ -8188,6 +8192,7 @@ var LoggerImpl = class _LoggerImpl {
8188
8192
  logWriter: this._logWriter,
8189
8193
  sys: this._sys,
8190
8194
  levelHandler: this._levelHandler,
8195
+ formatter: this._formatter,
8191
8196
  withAttributes: __spreadValues({
8192
8197
  module: this._attributes["module"]
8193
8198
  }, this._withAttributes)
@@ -8245,6 +8250,10 @@ var WithLoggerBuilder = class {
8245
8250
  this._li._levelHandler.setExposeStack(enable);
8246
8251
  return this;
8247
8252
  }
8253
+ SetFormatter(fmt) {
8254
+ this._li.SetFormatter(fmt);
8255
+ return this;
8256
+ }
8248
8257
  EnableLevel(level, ...modules) {
8249
8258
  this._li._levelHandler.enableLevel(level, ...modules);
8250
8259
  return this;
@@ -8503,6 +8512,7 @@ function digestSHA256(data) {
8503
8512
  function toCryptoRuntime(cryptoOpts = {}) {
8504
8513
  const runtime = {
8505
8514
  importKey: cryptoOpts.importKey || crypto.subtle.importKey.bind(crypto.subtle),
8515
+ exportKey: cryptoOpts.exportKey || crypto.subtle.exportKey.bind(crypto.subtle),
8506
8516
  encrypt: cryptoOpts.encrypt || crypto.subtle.encrypt.bind(crypto.subtle),
8507
8517
  decrypt: cryptoOpts.decrypt || crypto.subtle.decrypt.bind(crypto.subtle),
8508
8518
  randomBytes: cryptoOpts.randomBytes || randomBytes,