logixlysia 6.9.2 → 6.9.4

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/dist/index.d.ts CHANGED
@@ -242,7 +242,7 @@ type LogPreset = "dev" | "prod" | "json";
242
242
  /** Context passed to {@link Options.config.onError} when a sink fails. */
243
243
  interface SinkErrorContext {
244
244
  error: unknown;
245
- sink: "enricher" | "file" | "rotation" | "shutdown" | "transport";
245
+ sink: "enricher" | "file" | "format" | "rotation" | "shutdown" | "transport";
246
246
  }
247
247
  interface RequestIdConfig {
248
248
  /**
@@ -312,9 +312,10 @@ interface OutputConfig {
312
312
  logFilePath?: string;
313
313
  logRotation?: LogRotationConfig;
314
314
  /**
315
- * Called when a sink (transport, file, rotation) or an enricher fails.
316
- * Errors thrown by the hook itself are swallowed. When absent, failures go
317
- * to stderr (rate-limited for transports and enrichers).
315
+ * Called when a sink (transport, file, rotation) or an enricher fails, or
316
+ * when building or printing a log record fails (`sink: 'format'`). Errors
317
+ * thrown by the hook itself are swallowed. When absent, failures go to
318
+ * stderr (rate-limited for transports, enrichers and formatting).
318
319
  */
319
320
  onError?: (context: SinkErrorContext) => void;
320
321
  transports?: Transport[];
@@ -350,7 +351,7 @@ interface RequestTrackingConfig {
350
351
  * into the request context, so the fields reach the console tree, file logs,
351
352
  * and every transport at once.
352
353
  *
353
- * Each entry is either an {@link Enricher} (a `request` phase, a `response`
354
+ * Each entry is either an `Enricher` (a `request` phase, a `response`
354
355
  * phase, or both) or a bare function, which is treated as the request phase.
355
356
  * Ready-made ones — traceparent, user agent, geo, sizes — live in
356
357
  * `logixlysia/enrichers`.
@@ -372,7 +373,8 @@ interface RequestTrackingConfig {
372
373
  requestId?: boolean | RequestIdConfig;
373
374
  /**
374
375
  * Enable request-scoped logger propagation via AsyncLocalStorage.
375
- * When enabled, a request-scoped logger `log` is also derived on the Elysia context.
376
+ * When enabled, `useLogger()` returns the current request's logger anywhere in the request's async call chain.
377
+ * The handler context's `log` is available either way.
376
378
  * @default false
377
379
  */
378
380
  useAsyncLocalStorage?: boolean;
@@ -420,6 +422,7 @@ interface WebSocketLike {
420
422
  };
421
423
  };
422
424
  readonly id?: string;
425
+ readonly raw?: object;
423
426
  }
424
427
  interface WsHandlerHooks<
425
428
  TMessage = unknown,
@@ -511,7 +514,7 @@ interface SamplingRuntime {
511
514
  *
512
515
  * @param random Injectable for deterministic tests; defaults to `Math.random`.
513
516
  */
514
- declare const resolveSampling: (config: SamplingConfig | undefined, random?: () => number) => SamplingRuntime | undefined;
517
+ declare const resolveSampling: (config?: SamplingConfig, random?: () => number) => SamplingRuntime | undefined;
515
518
  /**
516
519
  * Empty singleton slots must not use `Record<string, never>`: intersecting that with Elysia's `Context`
517
520
  * makes every key (including `store`) become `never` because each key is merged with `never`.
@@ -536,7 +539,7 @@ type LogixlysiaPlugin<TFields extends object = LogFields> = Logixlysia<TFields>
536
539
  wrapWs: ReturnType<typeof createWsHandlerWrapper>;
537
540
  };
538
541
  /**
539
- * @typeParam TFields - Field bag for the request-scoped `log`. Supply your own
542
+ * @template TFields - Field bag for the request-scoped `log`. Supply your own
540
543
  * interface to have TypeScript reject misspelled context keys; the default
541
544
  * allows any key, so untyped usage is unchanged.
542
545
  */