logixia 2.0.4 → 2.0.6
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/README.md +172 -2614
- package/dist/{async-context-B05ArHgM.mjs → async-context-2mbUKhcl.mjs} +4 -6
- package/dist/async-context-2mbUKhcl.mjs.map +1 -0
- package/dist/{async-context-DTQgi8f7.js → async-context-DUFMDYAr.js} +4 -6
- package/dist/async-context-DUFMDYAr.js.map +1 -0
- package/dist/{azure-monitor.transport-CwbOLZHB.js → azure-monitor.transport-Bu4S2I2q.js} +5 -5
- package/dist/azure-monitor.transport-Bu4S2I2q.js.map +1 -0
- package/dist/{azure-monitor.transport-DV03Z5P4.d.ts → azure-monitor.transport-Bvf7Xegt.d.ts} +2 -2
- package/dist/{azure-monitor.transport-DV03Z5P4.d.ts.map → azure-monitor.transport-Bvf7Xegt.d.ts.map} +1 -1
- package/dist/{azure-monitor.transport-BPbgjATu.mjs → azure-monitor.transport-C1RWAumT.mjs} +5 -5
- package/dist/azure-monitor.transport-C1RWAumT.mjs.map +1 -0
- package/dist/{azure-monitor.transport-C7kYyZUW.d.mts → azure-monitor.transport-CbSHOnNX.d.mts} +2 -2
- package/dist/{azure-monitor.transport-C7kYyZUW.d.mts.map → azure-monitor.transport-CbSHOnNX.d.mts.map} +1 -1
- package/dist/azure.d.mts +1 -1
- package/dist/azure.d.ts +1 -1
- package/dist/azure.js +1 -1
- package/dist/azure.mjs +1 -1
- package/dist/{batch-buffer-0fgLmIPn.mjs → batch-buffer-BvXLDPlV.mjs} +3 -3
- package/dist/{batch-buffer-0fgLmIPn.mjs.map → batch-buffer-BvXLDPlV.mjs.map} +1 -1
- package/dist/{batch-buffer-DT4gdXmf.js → batch-buffer-C7Am4Mw-.js} +3 -3
- package/dist/{batch-buffer-DT4gdXmf.js.map → batch-buffer-C7Am4Mw-.js.map} +1 -1
- package/dist/browser.d.mts +5 -5
- package/dist/browser.d.mts.map +1 -1
- package/dist/browser.d.ts +5 -5
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +47 -12
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +47 -12
- package/dist/browser.mjs.map +1 -1
- package/dist/{builder-D70z6kjj.mjs → builder-DhNhvOkt.mjs} +106 -153
- package/dist/builder-DhNhvOkt.mjs.map +1 -0
- package/dist/{builder-M7NoaugM.js → builder-yFvJrz7o.js} +109 -179
- package/dist/builder-yFvJrz7o.js.map +1 -0
- package/dist/cli/index.js +157 -66
- package/dist/cloudwatch.d.mts +1 -1
- package/dist/cloudwatch.d.ts +1 -1
- package/dist/cloudwatch.js +1 -1
- package/dist/cloudwatch.mjs +1 -1
- package/dist/{cloudwatch.transport-Bf7L4I59.d.ts → cloudwatch.transport-CQyT6U91.d.ts} +2 -2
- package/dist/{cloudwatch.transport-Bf7L4I59.d.ts.map → cloudwatch.transport-CQyT6U91.d.ts.map} +1 -1
- package/dist/{cloudwatch.transport-B2wKQFF7.js → cloudwatch.transport-Ch1Uae-0.js} +6 -6
- package/dist/cloudwatch.transport-Ch1Uae-0.js.map +1 -0
- package/dist/{cloudwatch.transport-Rj4yTpRn.d.mts → cloudwatch.transport-CjVrI6S4.d.mts} +2 -2
- package/dist/{cloudwatch.transport-Rj4yTpRn.d.mts.map → cloudwatch.transport-CjVrI6S4.d.mts.map} +1 -1
- package/dist/{cloudwatch.transport-BTvYfLs9.mjs → cloudwatch.transport-DZqF2xZO.mjs} +6 -6
- package/dist/cloudwatch.transport-DZqF2xZO.mjs.map +1 -0
- package/dist/correlation.d.mts +4 -55
- package/dist/correlation.d.mts.map +1 -1
- package/dist/correlation.d.ts +4 -55
- package/dist/correlation.d.ts.map +1 -1
- package/dist/correlation.js +13 -13
- package/dist/correlation.js.map +1 -1
- package/dist/correlation.mjs +13 -13
- package/dist/correlation.mjs.map +1 -1
- package/dist/{entry-fields-RLd1jCoR.js → entry-fields-BSLkzw18.js} +8 -3
- package/dist/entry-fields-BSLkzw18.js.map +1 -0
- package/dist/{entry-fields-CGuvT2R0.mjs → entry-fields-J1OBi24o.mjs} +8 -3
- package/dist/entry-fields-J1OBi24o.mjs.map +1 -0
- package/dist/gcp.d.mts +1 -1
- package/dist/gcp.d.ts +1 -1
- package/dist/gcp.js +1 -1
- package/dist/gcp.mjs +1 -1
- package/dist/{gcp.transport-CFQfdAOK.d.ts → gcp.transport-BCIvdFV-.d.ts} +4 -4
- package/dist/{gcp.transport-CFQfdAOK.d.ts.map → gcp.transport-BCIvdFV-.d.ts.map} +1 -1
- package/dist/{gcp.transport-C5D72b1g.d.mts → gcp.transport-D9SdLPwP.d.mts} +4 -4
- package/dist/{gcp.transport-C5D72b1g.d.mts.map → gcp.transport-D9SdLPwP.d.mts.map} +1 -1
- package/dist/{gcp.transport-CGKopAhQ.mjs → gcp.transport-DVCmnA3b.mjs} +20 -16
- package/dist/gcp.transport-DVCmnA3b.mjs.map +1 -0
- package/dist/{gcp.transport-KZe9hCAR.js → gcp.transport-Dy2Lf8FI.js} +20 -16
- package/dist/gcp.transport-Dy2Lf8FI.js.map +1 -0
- package/dist/http-shapes-BnBkJcid.d.mts +32 -0
- package/dist/http-shapes-BnBkJcid.d.mts.map +1 -0
- package/dist/http-shapes-BnBkJcid.d.ts +32 -0
- package/dist/http-shapes-BnBkJcid.d.ts.map +1 -0
- package/dist/{index-xqaJtAZn.d.mts → index-BSTtFcQ6.d.mts} +142 -8
- package/dist/index-BSTtFcQ6.d.mts.map +1 -0
- package/dist/{index-DwozbmB4.d.ts → index-CFDGkI8n.d.ts} +142 -8
- package/dist/index-CFDGkI8n.d.ts.map +1 -0
- package/dist/index.d.mts +21 -65
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +21 -65
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -21
- package/dist/index.mjs.map +1 -1
- package/dist/{internal-log-uCSd1PMc.mjs → internal-log-Bg4V1cPg.mjs} +30 -2
- package/dist/internal-log-Bg4V1cPg.mjs.map +1 -0
- package/dist/{internal-log-b0Vp4qrB.js → internal-log-By4Govmu.js} +41 -1
- package/dist/internal-log-By4Govmu.js.map +1 -0
- package/dist/{logitron-logger-D2B75Oc7.d.ts → logitron-logger-D22Yb61K.d.mts} +13 -100
- package/dist/logitron-logger-D22Yb61K.d.mts.map +1 -0
- package/dist/{logitron-logger-oEd6wNhf.d.mts → logitron-logger-D_MYYrQt.d.ts} +13 -100
- package/dist/logitron-logger-D_MYYrQt.d.ts.map +1 -0
- package/dist/middleware.d.mts +4 -17
- package/dist/middleware.d.mts.map +1 -1
- package/dist/middleware.d.ts +4 -17
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +9 -39
- package/dist/middleware.js.map +1 -1
- package/dist/middleware.mjs +7 -37
- package/dist/middleware.mjs.map +1 -1
- package/dist/nest.d.mts +14 -7
- package/dist/nest.d.mts.map +1 -1
- package/dist/nest.d.ts +14 -7
- package/dist/nest.d.ts.map +1 -1
- package/dist/nest.js +15 -10
- package/dist/nest.js.map +1 -1
- package/dist/nest.mjs +15 -10
- package/dist/nest.mjs.map +1 -1
- package/dist/{transport.manager-eZ_EeC00.mjs → otel-Dt5riXuE.mjs} +173 -24
- package/dist/otel-Dt5riXuE.mjs.map +1 -0
- package/dist/{transport.manager-DkcEOlqV.js → otel-DyeH6DVR.js} +214 -23
- package/dist/otel-DyeH6DVR.js.map +1 -0
- package/dist/own-property-BWkibepN.js +40 -0
- package/dist/own-property-BWkibepN.js.map +1 -0
- package/dist/own-property-CjFw9qwZ.mjs +29 -0
- package/dist/own-property-CjFw9qwZ.mjs.map +1 -0
- package/dist/{request-trace-C_fvIDv4.mjs → request-trace-BgNykH9M.mjs} +1 -5
- package/dist/{request-trace-C_fvIDv4.mjs.map → request-trace-BgNykH9M.mjs.map} +1 -1
- package/dist/{request-trace-wTJdKp6-.js → request-trace-ByujsUZk.js} +1 -5
- package/dist/{request-trace-wTJdKp6-.js.map → request-trace-ByujsUZk.js.map} +1 -1
- package/dist/{safe-stringify-BMRl3EX3.mjs → safe-stringify-B5p5ktFe.mjs} +37 -12
- package/dist/safe-stringify-B5p5ktFe.mjs.map +1 -0
- package/dist/{safe-stringify-DLz1Kz3o.js → safe-stringify-J3sh-7YM.js} +37 -12
- package/dist/safe-stringify-J3sh-7YM.js.map +1 -0
- package/dist/{search-DUfWuzFP.js → search-CRjhHxe9.js} +269 -25
- package/dist/search-CRjhHxe9.js.map +1 -0
- package/dist/{search-CazwyX5Z.d.ts → search-DA3ft3X5.d.mts} +5 -2
- package/dist/search-DA3ft3X5.d.mts.map +1 -0
- package/dist/{search-CWMVYC-R.mjs → search-DAXKE-P9.mjs} +269 -25
- package/dist/search-DAXKE-P9.mjs.map +1 -0
- package/dist/{search-BH33XhuU.d.mts → search-DEl3Pe47.d.ts} +5 -2
- package/dist/search-DEl3Pe47.d.ts.map +1 -0
- package/dist/search.d.mts +1 -1
- package/dist/search.d.ts +1 -1
- package/dist/search.js +1 -1
- package/dist/search.mjs +1 -1
- package/dist/{secret-config-CBZBs0p1.js → secret-config-CmK2wVkr.js} +6 -5
- package/dist/secret-config-CmK2wVkr.js.map +1 -0
- package/dist/{secret-config-BegMLkYl.mjs → secret-config-Dhb6pqTU.mjs} +6 -5
- package/dist/secret-config-Dhb6pqTU.mjs.map +1 -0
- package/dist/{slack.transport-DxHOXlLu.d.mts → slack.transport-BDyENuR0.d.mts} +2 -2
- package/dist/{slack.transport-DxHOXlLu.d.mts.map → slack.transport-BDyENuR0.d.mts.map} +1 -1
- package/dist/{slack.transport-Ce96JBDk.mjs → slack.transport-BTEwsREY.mjs} +66 -15
- package/dist/slack.transport-BTEwsREY.mjs.map +1 -0
- package/dist/{slack.transport-DrirgDNy.d.ts → slack.transport-C6E0l4kw.d.ts} +2 -2
- package/dist/{slack.transport-DrirgDNy.d.ts.map → slack.transport-C6E0l4kw.d.ts.map} +1 -1
- package/dist/{slack.transport-Dlx3xvb7.js → slack.transport-UbYvOdKx.js} +67 -16
- package/dist/slack.transport-UbYvOdKx.js.map +1 -0
- package/dist/testing.d.mts +11 -4
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.d.ts +11 -4
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +38 -3
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +38 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/{transport.types-BJVL1QQl.d.ts → transport.types-CzJq4IrF.d.mts} +14 -3
- package/dist/transport.types-CzJq4IrF.d.mts.map +1 -0
- package/dist/{transport.types-BJVL1QQl.d.mts → transport.types-CzJq4IrF.d.ts} +14 -3
- package/dist/transport.types-CzJq4IrF.d.ts.map +1 -0
- package/dist/transports.d.mts +25 -13
- package/dist/transports.d.mts.map +1 -1
- package/dist/transports.d.ts +25 -13
- package/dist/transports.d.ts.map +1 -1
- package/dist/transports.js +15 -15
- package/dist/transports.mjs +6 -6
- package/dist/worker-entry.js +105 -24
- package/dist/worker.d.mts +1 -1
- package/dist/worker.d.ts +1 -1
- package/dist/worker.js +1 -1
- package/dist/worker.mjs +1 -1
- package/dist/{worker.transport-BuPwBi3d.d.ts → worker.transport-B9mCQSM1.d.ts} +7 -2
- package/dist/worker.transport-B9mCQSM1.d.ts.map +1 -0
- package/dist/{worker.transport-hJay1wxA.d.mts → worker.transport-Bl8lFRck.d.mts} +7 -2
- package/dist/worker.transport-Bl8lFRck.d.mts.map +1 -0
- package/dist/{worker.transport-DLVA4y2e.mjs → worker.transport-BmmOKb1-.mjs} +13 -10
- package/dist/worker.transport-BmmOKb1-.mjs.map +1 -0
- package/dist/{worker.transport-C6GNl_r2.js → worker.transport-DxxbqQCG.js} +13 -10
- package/dist/worker.transport-DxxbqQCG.js.map +1 -0
- package/package.json +33 -65
- package/dist/async-context-B05ArHgM.mjs.map +0 -1
- package/dist/async-context-DTQgi8f7.js.map +0 -1
- package/dist/azure-monitor.transport-BPbgjATu.mjs.map +0 -1
- package/dist/azure-monitor.transport-CwbOLZHB.js.map +0 -1
- package/dist/builder-D70z6kjj.mjs.map +0 -1
- package/dist/builder-M7NoaugM.js.map +0 -1
- package/dist/cloudwatch.transport-B2wKQFF7.js.map +0 -1
- package/dist/cloudwatch.transport-BTvYfLs9.mjs.map +0 -1
- package/dist/entry-fields-CGuvT2R0.mjs.map +0 -1
- package/dist/entry-fields-RLd1jCoR.js.map +0 -1
- package/dist/gcp.transport-CGKopAhQ.mjs.map +0 -1
- package/dist/gcp.transport-KZe9hCAR.js.map +0 -1
- package/dist/index-DwozbmB4.d.ts.map +0 -1
- package/dist/index-xqaJtAZn.d.mts.map +0 -1
- package/dist/internal-log-b0Vp4qrB.js.map +0 -1
- package/dist/internal-log-uCSd1PMc.mjs.map +0 -1
- package/dist/logitron-logger-D2B75Oc7.d.ts.map +0 -1
- package/dist/logitron-logger-oEd6wNhf.d.mts.map +0 -1
- package/dist/safe-stringify-BMRl3EX3.mjs.map +0 -1
- package/dist/safe-stringify-DLz1Kz3o.js.map +0 -1
- package/dist/search-BH33XhuU.d.mts.map +0 -1
- package/dist/search-CWMVYC-R.mjs.map +0 -1
- package/dist/search-CazwyX5Z.d.ts.map +0 -1
- package/dist/search-DUfWuzFP.js.map +0 -1
- package/dist/secret-config-BegMLkYl.mjs.map +0 -1
- package/dist/secret-config-CBZBs0p1.js.map +0 -1
- package/dist/slack.transport-Ce96JBDk.mjs.map +0 -1
- package/dist/slack.transport-Dlx3xvb7.js.map +0 -1
- package/dist/transport.manager-DkcEOlqV.js.map +0 -1
- package/dist/transport.manager-eZ_EeC00.mjs.map +0 -1
- package/dist/transport.types-BJVL1QQl.d.mts.map +0 -1
- package/dist/transport.types-BJVL1QQl.d.ts.map +0 -1
- package/dist/worker.transport-BuPwBi3d.d.ts.map +0 -1
- package/dist/worker.transport-C6GNl_r2.js.map +0 -1
- package/dist/worker.transport-DLVA4y2e.mjs.map +0 -1
- package/dist/worker.transport-hJay1wxA.d.mts.map +0 -1
|
@@ -1,4 +1,100 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as TransportConfig } from "./transport.types-CzJq4IrF.js";
|
|
2
|
+
interface LogixiaPlugin {
|
|
3
|
+
/**
|
|
4
|
+
* Unique plugin name.
|
|
5
|
+
* logixia uses this to prevent duplicate registration of the same plugin
|
|
6
|
+
* on the same logger instance.
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* Called once immediately after `logger.use(plugin)` is called.
|
|
11
|
+
* Use for one-time setup (open connections, allocate buffers, etc.).
|
|
12
|
+
* Async `onInit` errors are silently swallowed to avoid blocking the logger.
|
|
13
|
+
*/
|
|
14
|
+
onInit?(): void | Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Called for every log entry **after** PII redaction and **before** transport
|
|
17
|
+
* dispatch. Plugins run in registration order; each receives the (possibly
|
|
18
|
+
* modified) output of the previous plugin.
|
|
19
|
+
*
|
|
20
|
+
* - Return the entry (modified or unchanged) to continue processing.
|
|
21
|
+
* - Return `null` to **drop** the entry — no transport will receive it.
|
|
22
|
+
*
|
|
23
|
+
* Errors thrown inside `onLog` are swallowed so a buggy plugin cannot crash
|
|
24
|
+
* logging; the chain continues with the previous (un-transformed) entry.
|
|
25
|
+
*/
|
|
26
|
+
onLog?(entry: LogEntry): LogEntry | null | Promise<LogEntry | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Called when a transport write fails (after any configured retries).
|
|
29
|
+
* Useful for routing transport errors to an alerting or metrics system.
|
|
30
|
+
* Errors thrown inside `onError` are silently swallowed.
|
|
31
|
+
*/
|
|
32
|
+
onError?(error: Error, entry?: LogEntry): void | Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Called when the logger is closed via `logger.close()` or the process
|
|
35
|
+
* receives a shutdown signal (when `gracefulShutdown` is enabled).
|
|
36
|
+
* Errors thrown inside `onShutdown` are silently swallowed.
|
|
37
|
+
*/
|
|
38
|
+
onShutdown?(): void | Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Holds an ordered list of `LogixiaPlugin` instances and dispatches lifecycle
|
|
42
|
+
* events to them. One registry is created per logger instance; a global
|
|
43
|
+
* singleton is also exported for process-wide registration.
|
|
44
|
+
*/
|
|
45
|
+
declare class PluginRegistry {
|
|
46
|
+
private readonly _plugins;
|
|
47
|
+
/**
|
|
48
|
+
* Register a plugin. Silently skips if a plugin with the same `name` is
|
|
49
|
+
* already registered on this registry.
|
|
50
|
+
*/
|
|
51
|
+
register(plugin: LogixiaPlugin): void;
|
|
52
|
+
/** Remove a previously registered plugin by name. No-op if not found. */
|
|
53
|
+
unregister(name: string): void;
|
|
54
|
+
/** Returns `true` if a plugin with the given name is registered. */
|
|
55
|
+
has(name: string): boolean;
|
|
56
|
+
/** Number of currently registered plugins. */
|
|
57
|
+
get size(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Run all `onLog` hooks in order.
|
|
60
|
+
* Returns `null` if any plugin cancels the entry; otherwise returns the
|
|
61
|
+
* (possibly transformed) entry.
|
|
62
|
+
*/
|
|
63
|
+
runOnLog(entry: LogEntry): Promise<LogEntry | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Notify all `onError` hooks.
|
|
66
|
+
* Errors thrown inside hooks are swallowed to prevent error cascades.
|
|
67
|
+
*/
|
|
68
|
+
runOnError(error: Error, entry?: LogEntry): Promise<void>;
|
|
69
|
+
/** Run all `onShutdown` hooks concurrently. Hook errors are swallowed. */
|
|
70
|
+
runOnShutdown(): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Module-level singleton registry.
|
|
74
|
+
*
|
|
75
|
+
* Plugins registered here are automatically copied into every **new** logger
|
|
76
|
+
* instance created after the registration. Already-created loggers are not
|
|
77
|
+
* retroactively affected — use `logger.use(plugin)` for per-instance control.
|
|
78
|
+
*/
|
|
79
|
+
declare const globalPluginRegistry: PluginRegistry;
|
|
80
|
+
/**
|
|
81
|
+
* Register a plugin in the global registry so it applies to every future
|
|
82
|
+
* logger instance.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* import { usePlugin } from 'logixia';
|
|
87
|
+
*
|
|
88
|
+
* usePlugin({
|
|
89
|
+
* name: 'audit-sink',
|
|
90
|
+
* onLog(entry) {
|
|
91
|
+
* if (entry.level === 'error') auditQueue.push(entry);
|
|
92
|
+
* return entry;
|
|
93
|
+
* },
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
declare function usePlugin(plugin: LogixiaPlugin): void;
|
|
2
98
|
/**
|
|
3
99
|
* HTTP-related type definitions for Logixia
|
|
4
100
|
*/
|
|
@@ -292,7 +388,9 @@ interface IBaseLogger {
|
|
|
292
388
|
time(label: string): void;
|
|
293
389
|
timeEnd(label: string): Promise<number | undefined>;
|
|
294
390
|
timeAsync<T>(label: string, fn: () => Promise<T>): Promise<T>;
|
|
391
|
+
/** Set the minimum log level at runtime. Unknown levels are ignored with a warning. */
|
|
295
392
|
setLevel(level: LogLevel | string): void;
|
|
393
|
+
/** Return the configured minimum log level (not the per-namespace effective one). */
|
|
296
394
|
getLevel(): string;
|
|
297
395
|
setContext(context: string): void;
|
|
298
396
|
getContext(): string | undefined;
|
|
@@ -311,17 +409,53 @@ interface IBaseLogger {
|
|
|
311
409
|
getAvailableTransports(): string[];
|
|
312
410
|
child(context: string, data?: Record<string, unknown>): ILogger;
|
|
313
411
|
close(): Promise<void>;
|
|
314
|
-
use(plugin:
|
|
315
|
-
name: string;
|
|
316
|
-
}): this;
|
|
412
|
+
use(plugin: LogixiaPlugin): this;
|
|
317
413
|
unuse(pluginName: string): this;
|
|
318
414
|
}
|
|
319
|
-
|
|
415
|
+
/**
|
|
416
|
+
* Runtime controls implemented by loggers returned from `createLogger`.
|
|
417
|
+
* Kept separate from {@link IBaseLogger} and {@link ILogger}, so existing
|
|
418
|
+
* implementations of those (mocks, adapters) keep compiling.
|
|
419
|
+
*/
|
|
420
|
+
interface ILoggerRuntimeControls {
|
|
421
|
+
/**
|
|
422
|
+
* Replace the per-namespace level map at runtime.
|
|
423
|
+
* @example logger.setNamespaceLevels({ 'db.*': 'debug', '*': 'info' });
|
|
424
|
+
*/
|
|
425
|
+
setNamespaceLevels(levels: NamespaceLevels): void;
|
|
426
|
+
/** Merge entries into the existing per-namespace level map at runtime. */
|
|
427
|
+
patchNamespaceLevels(levels: NamespaceLevels): void;
|
|
428
|
+
/** Return a copy of the current per-namespace level map. */
|
|
429
|
+
getNamespaceLevels(): NamespaceLevels;
|
|
430
|
+
/** Flush buffered entries in all transports without closing them. */
|
|
431
|
+
flush(): Promise<void>;
|
|
432
|
+
/** Report whether the transports are healthy. */
|
|
433
|
+
healthCheck(): Promise<{
|
|
434
|
+
healthy: boolean;
|
|
435
|
+
details: Record<string, unknown>;
|
|
436
|
+
}>;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Logger member names a custom level must not use: a level with one of these
|
|
440
|
+
* names would shadow, or be shadowed by, a built-in logger method. The built-in
|
|
441
|
+
* level methods (`error`, `warn`, `info`, `debug`, `trace`, `verbose`) are valid level names.
|
|
442
|
+
*/
|
|
443
|
+
type ReservedLevelName = Exclude<keyof IBaseLogger | keyof ILoggerRuntimeControls, 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'verbose'>;
|
|
444
|
+
type CustomLevelMethods<T extends Record<string, number>> = { [K in keyof T as K extends ReservedLevelName ? never : K]: (message: string, data?: Record<string, unknown>) => Promise<void>; };
|
|
320
445
|
type ILogger<TLevels extends Record<string, number> = {}> = IBaseLogger & CustomLevelMethods<TLevels>;
|
|
321
446
|
interface ILoggerDefault extends IBaseLogger {}
|
|
447
|
+
/** What `createLogger` returns for a config with custom levels: the logger plus its runtime controls. */
|
|
448
|
+
type LogixiaLoggerInstance<TLevels extends Record<string, number> = {}> = {
|
|
449
|
+
/** Child loggers carry the runtime controls too. */
|
|
450
|
+
child(context: string, data?: Record<string, unknown>): LogixiaLoggerInstance<TLevels>;
|
|
451
|
+
} & ILogger<TLevels> & ILoggerRuntimeControls;
|
|
452
|
+
/** What `createLogger` returns for a config without custom levels. */
|
|
453
|
+
interface LogixiaLoggerDefault extends ILoggerDefault, ILoggerRuntimeControls {
|
|
454
|
+
child(context: string, data?: Record<string, unknown>): LogixiaLoggerDefault;
|
|
455
|
+
}
|
|
322
456
|
type LoggerWithLevels<T extends LoggerConfig<any>> = T['levelOptions'] extends {
|
|
323
457
|
levels: infer L;
|
|
324
|
-
} ? L extends Record<string, number> ?
|
|
458
|
+
} ? L extends Record<string, number> ? LogixiaLoggerInstance<L> : LogixiaLoggerDefault : LogixiaLoggerDefault;
|
|
325
459
|
type ExtractLevels<T> = T extends LoggerConfig<infer L> ? L : Record<string, number>;
|
|
326
460
|
interface LogEntry {
|
|
327
461
|
timestamp: string;
|
|
@@ -380,5 +514,5 @@ declare const DEFAULT_LOG_COLORS: {
|
|
|
380
514
|
trace: string;
|
|
381
515
|
verbose: string;
|
|
382
516
|
};
|
|
383
|
-
export {
|
|
384
|
-
//# sourceMappingURL=index-
|
|
517
|
+
export { TraceIdConfig as A, usePlugin as B, LogixiaLoggerInstance as C, ReservedLevelName as D, RequestContext as E, RequestMetrics as F, RequestTiming as I, LogixiaPlugin as L, HttpError as M, HttpRequest as N, SamplingConfig as O, HttpResponse as P, PluginRegistry as R, LogixiaLoggerDefault as S, RedactConfig as T, LogFieldKey as _, DEFAULT_LOG_LEVELS as a, LoggerConfig as b, ExtractLevels as c, ILogFormatter as d, ILogger as f, LogEntry as g, LogColor as h, DEFAULT_LOG_COLORS as i, TraceIdExtractorConfig as j, TimingEntry as k, GracefulShutdownConfig as l, ILoggerRuntimeControls as m, ContextData as n, Environment as o, ILoggerDefault as p, CustomLevelMethods as r, ErrorSerializationOptions as s, AdaptiveSamplingConfig as t, IBaseLogger as u, LogLevel as v, NamespaceLevels as w, LoggerWithLevels as x, LogLevelString as y, globalPluginRegistry as z };
|
|
518
|
+
//# sourceMappingURL=index-CFDGkI8n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CFDGkI8n.d.ts","names":[],"sources":["../src/plugin.ts","../src/types/http.types.ts","../src/types/index.ts"],"mappings":";UAkCiB;;;;;;EAMf;;;;;;EAOA,kBAAkB;;;;;;;;;;;;EAalB,OAAO,OAAO,WAAW,kBAAkB,QAAQ;;;;;;EAOnD,SAAS,OAAO,OAAO,QAAQ,kBAAkB;;;;;;EAOjD,sBAAsB;;;;;;;cAUX;mBACM;;;;;EAMjB,SAAS,QAAQ;;EAiBjB,WAAW;;EAMX,IAAI;;MAKA;;;;;;EASE,SAAS,OAAO,WAAW,QAAQ;;;;;EAsBnC,WAAW,OAAO,OAAO,QAAQ,WAAW;;EAiB5C,iBAAiB;;;;;;;;;cA2BZ,sBAAoB;;;;;;;;;;;;;;;;;;iBAmBjB,UAAU,QAAQ;;;;UCjNjB;EACf;EACA;EACA,SAAS;EACT,QAAQ;EACR,SAAS;EACT;EACA;EACA;EACA;;UAGe;EACf;EACA,SAAS;EACT;EACA;EACA;;UAGe,kBAAkB;EACjC;EACA;EACA,UAAU;;UAGK;EACf;EACA;EACA;EACA;IACE;IACA;IACA;IACA;IACA;;;UAIa;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;cC3CW;;;;;;;;KASD,mBAAmB,uBAAuB;KAC1C,iBAAiB;KAGjB;KAoBA;KAeA;UAGK;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA,YAAY;;;;;;;;;;;EAWZ;;UAIe;;;;;EAKf;;;;;;;;;;;;;;EAcA;;;;;EAKA,WAAW;;EAEX;;;;;;;;;;;;;;;;;;EAkBA;;;;;;;;;;;;;;;UAiBe;;;;;EAKf;;;;;;;EAOA,WAAW,QAAQ;;;;;;;EAOnB;;;;;;;;EAQA;;;;;;EAMA;;;;;;;;;;EAUA,WAAW;;UAGI;;;;;;EAMf;;;;;EAKA;;EAEA;;;;;EAKA;;;;;;;;;;;;;;;;KAkBU,kBAAkB,eAAe;U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B,cACjE,mBAAmB;UAIJ,uBAAuB;;KAI5B,sBAAsB,gBAAgB;;EAEhD,MAAM,iBAAiB,OAAO,0BAA0B,sBAAsB;IAC5E,QAAQ,WACV;;UAGe,6BAA6B,gBAAgB;EAC5D,MAAM,iBAAiB,OAAO,0BAA0B;;KAK9C,iBAAiB,UAAU,qBAAqB;EAC1D,cAAc;IAEZ,UAAU,yBACR,sBAAsB,KACtB,uBACF;KAGQ,cAAc,KAAK,UAAU,mBAAmB,KAAK,IAAI;UAGpD;EACf;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA,QAAQ;;UAIO;EACf;EACA;EACA;;UAIe;EACf;EACA;EACA;EACA;;UAIe;GACd;;UAIc;EACf,OAAO,OAAO;;UAIC;EACf;EACA;EACA;EACA;EACA,SAAS;EACT,WAAW;EACX,QAAQ;EACR;EACA;EACA;EACA;;cAIW;;;;;;;;cASA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
1
|
+
import { _ as TransportLogEntry, d as ITransport, h as TransportConfig } from "./transport.types-CzJq4IrF.mjs";
|
|
2
|
+
import { n as HttpResponseShape, t as HttpRequestShape } from "./http-shapes-BnBkJcid.mjs";
|
|
3
|
+
import { A as TraceIdConfig, B as usePlugin, C as LogixiaLoggerInstance, D as ReservedLevelName, E as RequestContext, F as RequestMetrics, I as RequestTiming, L as LogixiaPlugin, M as HttpError, N as HttpRequest, O as SamplingConfig, P as HttpResponse, R as PluginRegistry, S as LogixiaLoggerDefault, T as RedactConfig, _ as LogFieldKey, a as DEFAULT_LOG_LEVELS, b as LoggerConfig, c as ExtractLevels, d as ILogFormatter, f as ILogger, g as LogEntry, h as LogColor, i as DEFAULT_LOG_COLORS, j as TraceIdExtractorConfig, k as TimingEntry, l as GracefulShutdownConfig, m as ILoggerRuntimeControls, n as ContextData, o as Environment, p as ILoggerDefault, r as CustomLevelMethods, s as ErrorSerializationOptions, t as AdaptiveSamplingConfig, u as IBaseLogger, v as LogLevel, w as NamespaceLevels, x as LoggerWithLevels, y as LogLevelString, z as globalPluginRegistry } from "./index-BSTtFcQ6.mjs";
|
|
4
|
+
import { n as createLogger$1, t as LogixiaLogger } from "./logitron-logger-D22Yb61K.mjs";
|
|
5
|
+
import { a as DiscordTransport, c as OtlpLogTransportConfig, i as DiscordEmbed, l as toOtelSeverity, n as SlackTransport, o as DiscordTransportConfig, r as SlackTransportConfig, s as OtlpLogTransport, t as SlackMessage } from "./slack.transport-BDyENuR0.mjs";
|
|
6
|
+
import { A as SearchStats, C as SearchFilters, D as SearchPreset, E as SearchOptions, F as SuggestionType, I as TimeRange, L as TimelineEvent, M as SemanticIndex, N as SimilarLog, O as SearchQuery, P as SortField, S as RelativeTime, T as SearchMatch, _ as ParsedNLQuery, a as ILogSearchEngine, b as RelatedLog, c as SearchManager, d as CorrelatedLogs, f as EntityType, g as LogPattern, h as LogCorrelationSummary, i as BasicSearchEngine, j as SearchSuggestion, k as SearchResult, l as SearchManagerConfig, m as LogCluster, n as NLPSearchEngine, o as BasicLogIndexer, p as ExportOptions, r as CorrelationEngine, s as ILogIndexer, t as PatternRecognitionEngine, u as AnomalyDetection, v as QueryEntity, w as SearchHighlight, x as RelationshipType, y as QueryIntent } from "./search-DA3ft3X5.mjs";
|
|
5
7
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
8
|
import { IncomingMessage, ServerResponse } from "node:http";
|
|
7
9
|
/**
|
|
@@ -593,8 +595,8 @@ interface LogFieldDef {
|
|
|
593
595
|
/** Custom validator — return a string to emit it as a warning message. */
|
|
594
596
|
validate?: (value: unknown) => string | undefined;
|
|
595
597
|
}
|
|
596
|
-
type LogSchema<TFields extends
|
|
597
|
-
interface CompiledSchema<TFields extends
|
|
598
|
+
type LogSchema<TFields extends object> = { [K in keyof TFields]: LogFieldDef; };
|
|
599
|
+
interface CompiledSchema<TFields extends object> {
|
|
598
600
|
readonly fields: LogSchema<TFields>;
|
|
599
601
|
/**
|
|
600
602
|
* Validate a payload against the schema.
|
|
@@ -609,7 +611,7 @@ interface CompiledSchema<TFields extends Record<string, unknown>> {
|
|
|
609
611
|
* Call this once at module initialisation and pass it to `createTypedLogger`.
|
|
610
612
|
* In development, every log call is validated against the schema.
|
|
611
613
|
*/
|
|
612
|
-
export declare function defineLogSchema<TFields extends
|
|
614
|
+
export declare function defineLogSchema<TFields extends object>(fields: LogSchema<TFields>): CompiledSchema<TFields>;
|
|
613
615
|
/** IBaseLogger-compatible subset used by TypedLogger */
|
|
614
616
|
interface LoggerLike {
|
|
615
617
|
error(message: string | Error, data?: Record<string, unknown>): Promise<void>;
|
|
@@ -625,7 +627,7 @@ interface LoggerLike {
|
|
|
625
627
|
* The `error` overload still accepts a plain `Error` object as the first arg
|
|
626
628
|
* (with optional `TFields` data) so the typed logger remains a drop-in replacement.
|
|
627
629
|
*/
|
|
628
|
-
interface TypedLogger<TFields extends
|
|
630
|
+
interface TypedLogger<TFields extends object> {
|
|
629
631
|
error(error: Error, data?: Partial<TFields>): Promise<void>;
|
|
630
632
|
error(message: string, data?: Partial<TFields>): Promise<void>;
|
|
631
633
|
warn(message: string, data?: Partial<TFields>): Promise<void>;
|
|
@@ -642,40 +644,7 @@ interface TypedLogger<TFields extends Record<string, unknown>> {
|
|
|
642
644
|
* @param logger Any object that implements `IBaseLogger` (e.g. the result of `createLogger()`)
|
|
643
645
|
* @param schema Optional schema for dev-time validation. Created with `defineLogSchema()`.
|
|
644
646
|
*/
|
|
645
|
-
export declare function createTypedLogger<TFields extends
|
|
646
|
-
/**
|
|
647
|
-
* logixia — Canonical Log Lines / Wide Events.
|
|
648
|
-
*
|
|
649
|
-
* Emit ONE dense, structured event per unit of work (usually a request) instead
|
|
650
|
-
* of scattering details across many narrow log lines. Fields are accumulated as
|
|
651
|
-
* the request flows through middleware and business logic, then the whole event
|
|
652
|
-
* is emitted ONCE — in a `finally`/teardown path so it fires even on errors.
|
|
653
|
-
*
|
|
654
|
-
* This is the "canonical log line" pattern (Stripe) / "wide events" /
|
|
655
|
-
* "Observability 2.0" (Honeycomb): one pre-joined, queryable record per request,
|
|
656
|
-
* so operators never JOIN across log lines during an incident. It composes with
|
|
657
|
-
* logixia's existing trace correlation — when a trace is active, the event
|
|
658
|
-
* carries `traceId`/`spanId`, making it OTel-friendly.
|
|
659
|
-
*
|
|
660
|
-
* @example Manual scope
|
|
661
|
-
* ```ts
|
|
662
|
-
* import { withWideEvent, addEventFields } from 'logixia';
|
|
663
|
-
*
|
|
664
|
-
* await withWideEvent(logger, { route: '/checkout' }, async () => {
|
|
665
|
-
* addEventFields({ userId, planTier }); // from anywhere in the call tree
|
|
666
|
-
* addEventFields({ dbQueries: 4, cacheHit });
|
|
667
|
-
* // ...one wide event is emitted automatically when this callback settles,
|
|
668
|
-
* // even if it throws.
|
|
669
|
-
* });
|
|
670
|
-
* ```
|
|
671
|
-
*
|
|
672
|
-
* @example Express middleware (auto-emit on response finish/close)
|
|
673
|
-
* ```ts
|
|
674
|
-
* import { wideEventMiddleware } from 'logixia';
|
|
675
|
-
* app.use(wideEventMiddleware(logger));
|
|
676
|
-
* app.get('/x', (req, res) => { addEventFields({ handled: 'x' }); res.json({}); });
|
|
677
|
-
* ```
|
|
678
|
-
*/
|
|
647
|
+
export declare function createTypedLogger<TFields extends object>(logger: LoggerLike, schema?: CompiledSchema<TFields>): TypedLogger<TFields>;
|
|
679
648
|
/** The accumulating event fields for the current scope. */
|
|
680
649
|
type WideEventFields = Record<string, unknown>;
|
|
681
650
|
/** Minimal logger surface a wide event needs to emit itself. */
|
|
@@ -712,23 +681,17 @@ export declare function getEventFields(): WideEventFields | undefined;
|
|
|
712
681
|
* finally" guarantee). On error, `error` + `errorMessage` fields are added.
|
|
713
682
|
*/
|
|
714
683
|
export declare function withWideEvent<T>(logger: WideEventLogger, initialFields: WideEventFields, callback: () => Promise<T> | T, options?: WideEventOptions): Promise<T>;
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
url?: string | undefined;
|
|
718
|
-
originalUrl?: string | undefined;
|
|
719
|
-
ip?: string | undefined;
|
|
720
|
-
headers?: Record<string, unknown> | undefined;
|
|
721
|
-
socket?: {
|
|
722
|
-
remoteAddress?: string;
|
|
723
|
-
} | undefined;
|
|
724
|
-
}
|
|
725
|
-
interface MwRes {
|
|
726
|
-
statusCode?: number;
|
|
727
|
-
once?: (event: string, cb: () => void) => void;
|
|
728
|
-
}
|
|
684
|
+
type MwReq = HttpRequestShape;
|
|
685
|
+
type MwRes = HttpResponseShape;
|
|
729
686
|
interface WideEventMiddlewareOptions extends WideEventOptions {
|
|
730
687
|
/** Derive extra initial fields from the request. */
|
|
731
688
|
enrich?: (req: MwReq) => WideEventFields;
|
|
689
|
+
/**
|
|
690
|
+
* Additional query-string parameter names whose values are redacted from the
|
|
691
|
+
* logged `url`. Merged with the defaults (token, access_token, refresh_token,
|
|
692
|
+
* code, password, secret, api_key, apikey, key, signature, sig, auth).
|
|
693
|
+
*/
|
|
694
|
+
redactQueryParams?: string[];
|
|
732
695
|
/** Skip wide-event emission for a request (e.g. health checks). */
|
|
733
696
|
skip?: (req: MwReq) => boolean;
|
|
734
697
|
}
|
|
@@ -740,16 +703,9 @@ interface WideEventMiddlewareOptions extends WideEventOptions {
|
|
|
740
703
|
* request duration.
|
|
741
704
|
*/
|
|
742
705
|
export declare function wideEventMiddleware(logger: WideEventLogger, options?: WideEventMiddlewareOptions): (req: MwReq, res: MwRes, next: () => void) => void;
|
|
743
|
-
/**
|
|
744
|
-
* Per-request trace ID resolution shared by the HTTP logger middleware and the
|
|
745
|
-
* context helpers. Internal: not re-exported from the package entry points.
|
|
746
|
-
*/
|
|
747
706
|
type TraceHeaderOption = string | readonly string[];
|
|
748
707
|
/** Minimal structural request shape; Express and Fastify requests satisfy it. */
|
|
749
|
-
|
|
750
|
-
headers?: Record<string, string | string[] | undefined>;
|
|
751
|
-
id?: unknown;
|
|
752
|
-
}
|
|
708
|
+
type ContextRequestLike = HttpRequestShape;
|
|
753
709
|
interface LogContext {
|
|
754
710
|
traceId?: string;
|
|
755
711
|
spanId?: string;
|
|
@@ -1369,5 +1325,5 @@ export declare const logger: LogixiaLogger<{
|
|
|
1369
1325
|
/**
|
|
1370
1326
|
* Export default configuration for reference
|
|
1371
1327
|
*/
|
|
1372
|
-
export { AdaptiveSamplingConfig, type AnomalyDetection, BasicLogIndexer, BasicSearchEngine, type BuildParams, type CompiledSchema, ContextData, type CorrelatedLogs, CorrelationEngine, type CounterConfig, CustomLevelMethods, DEFAULT_LOG_COLORS, DEFAULT_LOG_LEVELS, type DiscordEmbed, DiscordTransport, type DiscordTransportConfig, type EntityType, Environment, type ErrorDetail, ErrorSerializationOptions, type ExportOptions, ExtractLevels, type GaugeConfig, GracefulShutdownConfig, type HistogramConfig, HttpError, HttpRequest, HttpResponse, IBaseLogger, ILogFormatter, type ILogIndexer, type ILogSearchEngine, ILogger, ILoggerDefault, type LevelSignalOptions, type LogCluster, LogColor, type LogContext, type LogCorrelationSummary, LogEntry, type LogFieldDef, LogFieldKey, type LogFieldType, LogLevel, LogLevelString, type LogPattern, type LogSchema, LoggerConfig, type LoggerConfig as LoggerConfigInterface, type LoggerLike, LoggerWithLevels, type LogixiaErrorResponse, type LogixiaExceptionOptions, LogixiaLogger, type LogixiaPlugin, type MetricConfig, type MetricsMap, type MetricsPluginOptions, NLPSearchEngine, NamespaceLevels, type OtelBridgeOptions, type OtelSpanContext, OtlpLogTransport, type OtlpLogTransportConfig, type ParsedNLQuery, PatternRecognitionEngine, PluginRegistry, type QueryEntity, type QueryIntent, type ReconfigurableLogger, RedactConfig, type RelatedLog, type RelationshipType, type RelativeTime, RequestContext, RequestMetrics, RequestTiming, type SafeStringifyOptions, SamplingConfig, type SamplingStats, type SearchFilters, type SearchHighlight, SearchManager, type SearchManagerConfig, type SearchMatch, type SearchOptions, type SearchPreset, type SearchQuery, type SearchResult, type SearchStats, type SearchSuggestion, type SemanticIndex, type SimilarLog, type SlackMessage, SlackTransport, type SlackTransportConfig, type SortField, type SuggestionType, type TimeRange, type TimelineEvent, TimingEntry, TraceIdConfig, TraceIdExtractorConfig, type TypedLogger, type WideEventFields, type WideEventLogger, type WideEventMiddlewareOptions, type WideEventOptions, globalPluginRegistry, toOtelSeverity, usePlugin };
|
|
1328
|
+
export { AdaptiveSamplingConfig, type AnomalyDetection, BasicLogIndexer, BasicSearchEngine, type BuildParams, type CompiledSchema, ContextData, type CorrelatedLogs, CorrelationEngine, type CounterConfig, CustomLevelMethods, DEFAULT_LOG_COLORS, DEFAULT_LOG_LEVELS, type DiscordEmbed, DiscordTransport, type DiscordTransportConfig, type EntityType, Environment, type ErrorDetail, ErrorSerializationOptions, type ExportOptions, ExtractLevels, type GaugeConfig, GracefulShutdownConfig, type HistogramConfig, HttpError, HttpRequest, HttpResponse, IBaseLogger, ILogFormatter, type ILogIndexer, type ILogSearchEngine, ILogger, ILoggerDefault, ILoggerRuntimeControls, type ITransport, type LevelSignalOptions, type LogCluster, LogColor, type LogContext, type LogCorrelationSummary, LogEntry, type LogFieldDef, LogFieldKey, type LogFieldType, LogLevel, LogLevelString, type LogPattern, type LogSchema, LoggerConfig, type LoggerConfig as LoggerConfigInterface, type LoggerLike, LoggerWithLevels, type LogixiaErrorResponse, type LogixiaExceptionOptions, LogixiaLogger, LogixiaLoggerDefault, LogixiaLoggerInstance, type LogixiaPlugin, type MetricConfig, type MetricsMap, type MetricsPluginOptions, NLPSearchEngine, NamespaceLevels, type OtelBridgeOptions, type OtelSpanContext, OtlpLogTransport, type OtlpLogTransportConfig, type ParsedNLQuery, PatternRecognitionEngine, PluginRegistry, type QueryEntity, type QueryIntent, type ReconfigurableLogger, RedactConfig, type RelatedLog, type RelationshipType, type RelativeTime, RequestContext, RequestMetrics, RequestTiming, ReservedLevelName, type SafeStringifyOptions, SamplingConfig, type SamplingStats, type SearchFilters, type SearchHighlight, SearchManager, type SearchManagerConfig, type SearchMatch, type SearchOptions, type SearchPreset, type SearchQuery, type SearchResult, type SearchStats, type SearchSuggestion, type SemanticIndex, type SimilarLog, type SlackMessage, SlackTransport, type SlackTransportConfig, type SortField, type SuggestionType, type TimeRange, type TimelineEvent, TimingEntry, TraceIdConfig, TraceIdExtractorConfig, type TransportConfig, type TransportLogEntry, type TypedLogger, type WideEventFields, type WideEventLogger, type WideEventMiddlewareOptions, type WideEventOptions, globalPluginRegistry, toOtelSeverity, usePlugin };
|
|
1373
1329
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["createLoggerFromCore","_$__types0.Environment","_$__types0.LogColor"],"sources":["../src/core/default-config.ts","../src/formatters/json.formatter.ts","../src/formatters/text.formatter.ts","../src/utils/error.utils.ts","../src/utils/otel.ts","../src/utils/redact.utils.ts","../src/utils/runtime-control.ts","../src/utils/safe-stringify.ts","../src/utils/shutdown.utils.ts","../src/utils/trace.utils.ts","../src/utils/typed-logger.ts","../src/wide-events.ts","../src/utils/request-trace.ts","../src/context/async-context.ts","../src/utils/sampling.utils.ts","../src/exceptions/types.ts","../src/exceptions/builder.ts","../src/exceptions/exception.ts","../src/metrics.ts","../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["createLoggerFromCore","_$__types0.Environment","_$__types0.LogColor"],"sources":["../src/core/default-config.ts","../src/formatters/json.formatter.ts","../src/formatters/text.formatter.ts","../src/utils/error.utils.ts","../src/utils/otel.ts","../src/utils/redact.utils.ts","../src/utils/runtime-control.ts","../src/utils/safe-stringify.ts","../src/utils/shutdown.utils.ts","../src/utils/trace.utils.ts","../src/utils/typed-logger.ts","../src/wide-events.ts","../src/utils/request-trace.ts","../src/context/async-context.ts","../src/utils/sampling.utils.ts","../src/exceptions/types.ts","../src/exceptions/builder.ts","../src/exceptions/exception.ts","../src/metrics.ts","../src/index.ts"],"mappings":";;;;;;;;;;;qBAMa;;EAEmB,aAAA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tC,mBAAmB,+BAA+B,+BAChE,kBACC,SAAS,iBAAiB,OAAO;;;;;;;;;;;;;;UCrInB;EACf;;EAEA;;;;;EAKA;EACA;;EAEA;EACA;;;;;;;;;;;;;;;UAgBe;EACf;;EAEA;;EAEA;EACA;;;;;EAKA;;;;;;;;;;UAWe;EACf;;EAEA;;EAEA;EACA;;KAGU,eAAe,gBAAgB,kBAAkB;KACjD,aAAa,eAAe;;qBAkC3B;UAEI;;;;;;;;EAQf;;;;;;;;;;;;;;;;;qBAsEW,yBAAyB;WACpB;mBAEC;mBACA;mBACA;mBAEA;EAEL,YAAA,KAAK,YAAY,UAAS;EAYtC;EAIA,MAAM,OAAO,WAAW;;;;;;;;;;;;;;EAsExB;;;;;EAwDA;;;;;;;;;;;EAeA,mBACE,cACA;IAAO,IAAI,WAAW;IAAqB,IAAI;;;;;;;;;;;;;EAmBjD,gBAAgB,KAAK,iBAAiB,KAAK;;;;;UAsBnC;UAKA;UAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkDM,oBACd,KAAK,YACL,UAAU,uBACT;;;;;;qBCtYU,qBAAYA;;;;qBAKZ,QAAM;;E,aAANC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
1
|
+
import { _ as TransportLogEntry, d as ITransport, h as TransportConfig } from "./transport.types-CzJq4IrF.js";
|
|
2
|
+
import { n as HttpResponseShape, t as HttpRequestShape } from "./http-shapes-BnBkJcid.js";
|
|
3
|
+
import { A as TraceIdConfig, B as usePlugin, C as LogixiaLoggerInstance, D as ReservedLevelName, E as RequestContext, F as RequestMetrics, I as RequestTiming, L as LogixiaPlugin, M as HttpError, N as HttpRequest, O as SamplingConfig, P as HttpResponse, R as PluginRegistry, S as LogixiaLoggerDefault, T as RedactConfig, _ as LogFieldKey, a as DEFAULT_LOG_LEVELS, b as LoggerConfig, c as ExtractLevels, d as ILogFormatter, f as ILogger, g as LogEntry, h as LogColor, i as DEFAULT_LOG_COLORS, j as TraceIdExtractorConfig, k as TimingEntry, l as GracefulShutdownConfig, m as ILoggerRuntimeControls, n as ContextData, o as Environment, p as ILoggerDefault, r as CustomLevelMethods, s as ErrorSerializationOptions, t as AdaptiveSamplingConfig, u as IBaseLogger, v as LogLevel, w as NamespaceLevels, x as LoggerWithLevels, y as LogLevelString, z as globalPluginRegistry } from "./index-CFDGkI8n.js";
|
|
4
|
+
import { n as createLogger$1, t as LogixiaLogger } from "./logitron-logger-D_MYYrQt.js";
|
|
5
|
+
import { a as DiscordTransport, c as OtlpLogTransportConfig, i as DiscordEmbed, l as toOtelSeverity, n as SlackTransport, o as DiscordTransportConfig, r as SlackTransportConfig, s as OtlpLogTransport, t as SlackMessage } from "./slack.transport-C6E0l4kw.js";
|
|
6
|
+
import { A as SearchStats, C as SearchFilters, D as SearchPreset, E as SearchOptions, F as SuggestionType, I as TimeRange, L as TimelineEvent, M as SemanticIndex, N as SimilarLog, O as SearchQuery, P as SortField, S as RelativeTime, T as SearchMatch, _ as ParsedNLQuery, a as ILogSearchEngine, b as RelatedLog, c as SearchManager, d as CorrelatedLogs, f as EntityType, g as LogPattern, h as LogCorrelationSummary, i as BasicSearchEngine, j as SearchSuggestion, k as SearchResult, l as SearchManagerConfig, m as LogCluster, n as NLPSearchEngine, o as BasicLogIndexer, p as ExportOptions, r as CorrelationEngine, s as ILogIndexer, t as PatternRecognitionEngine, u as AnomalyDetection, v as QueryEntity, w as SearchHighlight, x as RelationshipType, y as QueryIntent } from "./search-DEl3Pe47.js";
|
|
5
7
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
8
|
import { IncomingMessage, ServerResponse } from "node:http";
|
|
7
9
|
/**
|
|
@@ -593,8 +595,8 @@ interface LogFieldDef {
|
|
|
593
595
|
/** Custom validator — return a string to emit it as a warning message. */
|
|
594
596
|
validate?: (value: unknown) => string | undefined;
|
|
595
597
|
}
|
|
596
|
-
type LogSchema<TFields extends
|
|
597
|
-
interface CompiledSchema<TFields extends
|
|
598
|
+
type LogSchema<TFields extends object> = { [K in keyof TFields]: LogFieldDef; };
|
|
599
|
+
interface CompiledSchema<TFields extends object> {
|
|
598
600
|
readonly fields: LogSchema<TFields>;
|
|
599
601
|
/**
|
|
600
602
|
* Validate a payload against the schema.
|
|
@@ -609,7 +611,7 @@ interface CompiledSchema<TFields extends Record<string, unknown>> {
|
|
|
609
611
|
* Call this once at module initialisation and pass it to `createTypedLogger`.
|
|
610
612
|
* In development, every log call is validated against the schema.
|
|
611
613
|
*/
|
|
612
|
-
export declare function defineLogSchema<TFields extends
|
|
614
|
+
export declare function defineLogSchema<TFields extends object>(fields: LogSchema<TFields>): CompiledSchema<TFields>;
|
|
613
615
|
/** IBaseLogger-compatible subset used by TypedLogger */
|
|
614
616
|
interface LoggerLike {
|
|
615
617
|
error(message: string | Error, data?: Record<string, unknown>): Promise<void>;
|
|
@@ -625,7 +627,7 @@ interface LoggerLike {
|
|
|
625
627
|
* The `error` overload still accepts a plain `Error` object as the first arg
|
|
626
628
|
* (with optional `TFields` data) so the typed logger remains a drop-in replacement.
|
|
627
629
|
*/
|
|
628
|
-
interface TypedLogger<TFields extends
|
|
630
|
+
interface TypedLogger<TFields extends object> {
|
|
629
631
|
error(error: Error, data?: Partial<TFields>): Promise<void>;
|
|
630
632
|
error(message: string, data?: Partial<TFields>): Promise<void>;
|
|
631
633
|
warn(message: string, data?: Partial<TFields>): Promise<void>;
|
|
@@ -642,40 +644,7 @@ interface TypedLogger<TFields extends Record<string, unknown>> {
|
|
|
642
644
|
* @param logger Any object that implements `IBaseLogger` (e.g. the result of `createLogger()`)
|
|
643
645
|
* @param schema Optional schema for dev-time validation. Created with `defineLogSchema()`.
|
|
644
646
|
*/
|
|
645
|
-
export declare function createTypedLogger<TFields extends
|
|
646
|
-
/**
|
|
647
|
-
* logixia — Canonical Log Lines / Wide Events.
|
|
648
|
-
*
|
|
649
|
-
* Emit ONE dense, structured event per unit of work (usually a request) instead
|
|
650
|
-
* of scattering details across many narrow log lines. Fields are accumulated as
|
|
651
|
-
* the request flows through middleware and business logic, then the whole event
|
|
652
|
-
* is emitted ONCE — in a `finally`/teardown path so it fires even on errors.
|
|
653
|
-
*
|
|
654
|
-
* This is the "canonical log line" pattern (Stripe) / "wide events" /
|
|
655
|
-
* "Observability 2.0" (Honeycomb): one pre-joined, queryable record per request,
|
|
656
|
-
* so operators never JOIN across log lines during an incident. It composes with
|
|
657
|
-
* logixia's existing trace correlation — when a trace is active, the event
|
|
658
|
-
* carries `traceId`/`spanId`, making it OTel-friendly.
|
|
659
|
-
*
|
|
660
|
-
* @example Manual scope
|
|
661
|
-
* ```ts
|
|
662
|
-
* import { withWideEvent, addEventFields } from 'logixia';
|
|
663
|
-
*
|
|
664
|
-
* await withWideEvent(logger, { route: '/checkout' }, async () => {
|
|
665
|
-
* addEventFields({ userId, planTier }); // from anywhere in the call tree
|
|
666
|
-
* addEventFields({ dbQueries: 4, cacheHit });
|
|
667
|
-
* // ...one wide event is emitted automatically when this callback settles,
|
|
668
|
-
* // even if it throws.
|
|
669
|
-
* });
|
|
670
|
-
* ```
|
|
671
|
-
*
|
|
672
|
-
* @example Express middleware (auto-emit on response finish/close)
|
|
673
|
-
* ```ts
|
|
674
|
-
* import { wideEventMiddleware } from 'logixia';
|
|
675
|
-
* app.use(wideEventMiddleware(logger));
|
|
676
|
-
* app.get('/x', (req, res) => { addEventFields({ handled: 'x' }); res.json({}); });
|
|
677
|
-
* ```
|
|
678
|
-
*/
|
|
647
|
+
export declare function createTypedLogger<TFields extends object>(logger: LoggerLike, schema?: CompiledSchema<TFields>): TypedLogger<TFields>;
|
|
679
648
|
/** The accumulating event fields for the current scope. */
|
|
680
649
|
type WideEventFields = Record<string, unknown>;
|
|
681
650
|
/** Minimal logger surface a wide event needs to emit itself. */
|
|
@@ -712,23 +681,17 @@ export declare function getEventFields(): WideEventFields | undefined;
|
|
|
712
681
|
* finally" guarantee). On error, `error` + `errorMessage` fields are added.
|
|
713
682
|
*/
|
|
714
683
|
export declare function withWideEvent<T>(logger: WideEventLogger, initialFields: WideEventFields, callback: () => Promise<T> | T, options?: WideEventOptions): Promise<T>;
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
url?: string | undefined;
|
|
718
|
-
originalUrl?: string | undefined;
|
|
719
|
-
ip?: string | undefined;
|
|
720
|
-
headers?: Record<string, unknown> | undefined;
|
|
721
|
-
socket?: {
|
|
722
|
-
remoteAddress?: string;
|
|
723
|
-
} | undefined;
|
|
724
|
-
}
|
|
725
|
-
interface MwRes {
|
|
726
|
-
statusCode?: number;
|
|
727
|
-
once?: (event: string, cb: () => void) => void;
|
|
728
|
-
}
|
|
684
|
+
type MwReq = HttpRequestShape;
|
|
685
|
+
type MwRes = HttpResponseShape;
|
|
729
686
|
interface WideEventMiddlewareOptions extends WideEventOptions {
|
|
730
687
|
/** Derive extra initial fields from the request. */
|
|
731
688
|
enrich?: (req: MwReq) => WideEventFields;
|
|
689
|
+
/**
|
|
690
|
+
* Additional query-string parameter names whose values are redacted from the
|
|
691
|
+
* logged `url`. Merged with the defaults (token, access_token, refresh_token,
|
|
692
|
+
* code, password, secret, api_key, apikey, key, signature, sig, auth).
|
|
693
|
+
*/
|
|
694
|
+
redactQueryParams?: string[];
|
|
732
695
|
/** Skip wide-event emission for a request (e.g. health checks). */
|
|
733
696
|
skip?: (req: MwReq) => boolean;
|
|
734
697
|
}
|
|
@@ -740,16 +703,9 @@ interface WideEventMiddlewareOptions extends WideEventOptions {
|
|
|
740
703
|
* request duration.
|
|
741
704
|
*/
|
|
742
705
|
export declare function wideEventMiddleware(logger: WideEventLogger, options?: WideEventMiddlewareOptions): (req: MwReq, res: MwRes, next: () => void) => void;
|
|
743
|
-
/**
|
|
744
|
-
* Per-request trace ID resolution shared by the HTTP logger middleware and the
|
|
745
|
-
* context helpers. Internal: not re-exported from the package entry points.
|
|
746
|
-
*/
|
|
747
706
|
type TraceHeaderOption = string | readonly string[];
|
|
748
707
|
/** Minimal structural request shape; Express and Fastify requests satisfy it. */
|
|
749
|
-
|
|
750
|
-
headers?: Record<string, string | string[] | undefined>;
|
|
751
|
-
id?: unknown;
|
|
752
|
-
}
|
|
708
|
+
type ContextRequestLike = HttpRequestShape;
|
|
753
709
|
interface LogContext {
|
|
754
710
|
traceId?: string;
|
|
755
711
|
spanId?: string;
|
|
@@ -1369,5 +1325,5 @@ export declare const logger: LogixiaLogger<{
|
|
|
1369
1325
|
/**
|
|
1370
1326
|
* Export default configuration for reference
|
|
1371
1327
|
*/
|
|
1372
|
-
export { AdaptiveSamplingConfig, type AnomalyDetection, BasicLogIndexer, BasicSearchEngine, type BuildParams, type CompiledSchema, ContextData, type CorrelatedLogs, CorrelationEngine, type CounterConfig, CustomLevelMethods, DEFAULT_LOG_COLORS, DEFAULT_LOG_LEVELS, type DiscordEmbed, DiscordTransport, type DiscordTransportConfig, type EntityType, Environment, type ErrorDetail, ErrorSerializationOptions, type ExportOptions, ExtractLevels, type GaugeConfig, GracefulShutdownConfig, type HistogramConfig, HttpError, HttpRequest, HttpResponse, IBaseLogger, ILogFormatter, type ILogIndexer, type ILogSearchEngine, ILogger, ILoggerDefault, type LevelSignalOptions, type LogCluster, LogColor, type LogContext, type LogCorrelationSummary, LogEntry, type LogFieldDef, LogFieldKey, type LogFieldType, LogLevel, LogLevelString, type LogPattern, type LogSchema, LoggerConfig, type LoggerConfig as LoggerConfigInterface, type LoggerLike, LoggerWithLevels, type LogixiaErrorResponse, type LogixiaExceptionOptions, LogixiaLogger, type LogixiaPlugin, type MetricConfig, type MetricsMap, type MetricsPluginOptions, NLPSearchEngine, NamespaceLevels, type OtelBridgeOptions, type OtelSpanContext, OtlpLogTransport, type OtlpLogTransportConfig, type ParsedNLQuery, PatternRecognitionEngine, PluginRegistry, type QueryEntity, type QueryIntent, type ReconfigurableLogger, RedactConfig, type RelatedLog, type RelationshipType, type RelativeTime, RequestContext, RequestMetrics, RequestTiming, type SafeStringifyOptions, SamplingConfig, type SamplingStats, type SearchFilters, type SearchHighlight, SearchManager, type SearchManagerConfig, type SearchMatch, type SearchOptions, type SearchPreset, type SearchQuery, type SearchResult, type SearchStats, type SearchSuggestion, type SemanticIndex, type SimilarLog, type SlackMessage, SlackTransport, type SlackTransportConfig, type SortField, type SuggestionType, type TimeRange, type TimelineEvent, TimingEntry, TraceIdConfig, TraceIdExtractorConfig, type TypedLogger, type WideEventFields, type WideEventLogger, type WideEventMiddlewareOptions, type WideEventOptions, globalPluginRegistry, toOtelSeverity, usePlugin };
|
|
1328
|
+
export { AdaptiveSamplingConfig, type AnomalyDetection, BasicLogIndexer, BasicSearchEngine, type BuildParams, type CompiledSchema, ContextData, type CorrelatedLogs, CorrelationEngine, type CounterConfig, CustomLevelMethods, DEFAULT_LOG_COLORS, DEFAULT_LOG_LEVELS, type DiscordEmbed, DiscordTransport, type DiscordTransportConfig, type EntityType, Environment, type ErrorDetail, ErrorSerializationOptions, type ExportOptions, ExtractLevels, type GaugeConfig, GracefulShutdownConfig, type HistogramConfig, HttpError, HttpRequest, HttpResponse, IBaseLogger, ILogFormatter, type ILogIndexer, type ILogSearchEngine, ILogger, ILoggerDefault, ILoggerRuntimeControls, type ITransport, type LevelSignalOptions, type LogCluster, LogColor, type LogContext, type LogCorrelationSummary, LogEntry, type LogFieldDef, LogFieldKey, type LogFieldType, LogLevel, LogLevelString, type LogPattern, type LogSchema, LoggerConfig, type LoggerConfig as LoggerConfigInterface, type LoggerLike, LoggerWithLevels, type LogixiaErrorResponse, type LogixiaExceptionOptions, LogixiaLogger, LogixiaLoggerDefault, LogixiaLoggerInstance, type LogixiaPlugin, type MetricConfig, type MetricsMap, type MetricsPluginOptions, NLPSearchEngine, NamespaceLevels, type OtelBridgeOptions, type OtelSpanContext, OtlpLogTransport, type OtlpLogTransportConfig, type ParsedNLQuery, PatternRecognitionEngine, PluginRegistry, type QueryEntity, type QueryIntent, type ReconfigurableLogger, RedactConfig, type RelatedLog, type RelationshipType, type RelativeTime, RequestContext, RequestMetrics, RequestTiming, ReservedLevelName, type SafeStringifyOptions, SamplingConfig, type SamplingStats, type SearchFilters, type SearchHighlight, SearchManager, type SearchManagerConfig, type SearchMatch, type SearchOptions, type SearchPreset, type SearchQuery, type SearchResult, type SearchStats, type SearchSuggestion, type SemanticIndex, type SimilarLog, type SlackMessage, SlackTransport, type SlackTransportConfig, type SortField, type SuggestionType, type TimeRange, type TimelineEvent, TimingEntry, TraceIdConfig, TraceIdExtractorConfig, type TransportConfig, type TransportLogEntry, type TypedLogger, type WideEventFields, type WideEventLogger, type WideEventMiddlewareOptions, type WideEventOptions, globalPluginRegistry, toOtelSeverity, usePlugin };
|
|
1373
1329
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["createLoggerFromCore","_$__types0.Environment","_$__types0.LogColor"],"sources":["../src/core/default-config.ts","../src/formatters/json.formatter.ts","../src/formatters/text.formatter.ts","../src/utils/error.utils.ts","../src/utils/otel.ts","../src/utils/redact.utils.ts","../src/utils/runtime-control.ts","../src/utils/safe-stringify.ts","../src/utils/shutdown.utils.ts","../src/utils/trace.utils.ts","../src/utils/typed-logger.ts","../src/wide-events.ts","../src/utils/request-trace.ts","../src/context/async-context.ts","../src/utils/sampling.utils.ts","../src/exceptions/types.ts","../src/exceptions/builder.ts","../src/exceptions/exception.ts","../src/metrics.ts","../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["createLoggerFromCore","_$__types0.Environment","_$__types0.LogColor"],"sources":["../src/core/default-config.ts","../src/formatters/json.formatter.ts","../src/formatters/text.formatter.ts","../src/utils/error.utils.ts","../src/utils/otel.ts","../src/utils/redact.utils.ts","../src/utils/runtime-control.ts","../src/utils/safe-stringify.ts","../src/utils/shutdown.utils.ts","../src/utils/trace.utils.ts","../src/utils/typed-logger.ts","../src/wide-events.ts","../src/utils/request-trace.ts","../src/context/async-context.ts","../src/utils/sampling.utils.ts","../src/exceptions/types.ts","../src/exceptions/builder.ts","../src/exceptions/exception.ts","../src/metrics.ts","../src/index.ts"],"mappings":";;;;;;;;;;;qBAMa;;EAEmB,aAAA;;;;;;;;;;;;;;;;;;IAyBvB,QAAA,eAAe;;;;;;;;;;;;;qBCTX,yBAAyB;UAC5B;UACA;UACA;UACA;UACA;UACA;EAGN,YAAA;IACE;IACA;IACA;IACA;IACA;IACA;;EAWJ,OAAO,OAAO;UA0DN;;qBC/FG,yBAAyB;UAC5B;UACA;UACA;UACA;UACA;UACA;UACA;EAGN,YAAA;IACE;IACA;IACA;IACA;IACA;IACA;IACA,SAAS;;EAuBb,OAAO,OAAO;UA+DN;UAcA;;;;SAqDD,gBAAgB;SAWhB,kBAAkB;SAWlB,iBAAiB;;;;;;;;;;wBC3KV,eACd,OAAO,OACP,UAAS,4BACR;;;;wBA6Ia,QAAQ,iBAAiB,SAAS;;;;wBAalC,eAAe,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UCzJ/B;;EAEf;;EAEA;;EAEA;;EAEA;;UAGe;;;;;EAKf;;;;;EAKA;;;;;EAKA;;;;;EAKA;;;;;;;;;;;wBA4Cc,qBAAqB,OAAM,oBAAyB;;;;;;;;;;;;;;;wBA0CpD,kBAAkB,OAAM,oBAAyB;;;;;;;;;;;;;;wBA8BjD,eAAe,OAAM;;;;wBAyCrB;;;;;;wBCsLA,aACd,KAAK,yBACL,QAAQ,cACR,wBACC;;;;;wBAyBa,eACd,SAAS,qCACT,QAAQ,2BACP;;UCvZc;EACf,YAAY;EACZ,SAAS,OAAO;EAChB,oBAAoB,QAAQ;EAC5B,uBAAuB;;UAYR;;EAEf,SAAS,OAAO;;EAEhB,QAAQ;;;;;;;;;;wBAWM,oBACd,QAAQ,sBACR,UAAS;UAqBD;EACR;EACA,UAAU;EACV,MAAM,eAAe,KAAK;;UAElB;EACR;EACA,aAAa,WAAW;EACxB,MAAM;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