@decaf-ts/logging 0.11.4 → 0.12.1
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/logging.cjs +1 -1
- package/lib/cjs/LoggedClass.js.map +1 -0
- package/lib/cjs/constants.js.map +1 -0
- package/lib/cjs/decorators.js.map +1 -0
- package/lib/cjs/environment.js.map +1 -0
- package/lib/cjs/filters/LogFilter.js.map +1 -0
- package/lib/cjs/filters/PatternFilter.js.map +1 -0
- package/lib/cjs/filters/index.js.map +1 -0
- package/lib/{index.cjs → cjs/index.cjs} +1 -1
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/logParameters.js.map +1 -0
- package/lib/cjs/logging.js.map +1 -0
- package/lib/cjs/pino/index.js.map +1 -0
- package/lib/cjs/pino/pino.js.map +1 -0
- package/lib/cjs/text.js.map +1 -0
- package/lib/cjs/time.js.map +1 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/cjs/utils.js.map +1 -0
- package/lib/cjs/web.js.map +1 -0
- package/lib/cjs/winston/index.js.map +1 -0
- package/lib/cjs/winston/winston.js.map +1 -0
- package/lib/esm/index.js +1 -1
- package/package.json +15 -13
- package/lib/LoggedClass.js.map +0 -1
- package/lib/constants.js.map +0 -1
- package/lib/decorators.js.map +0 -1
- package/lib/environment.js.map +0 -1
- package/lib/esm/LoggedClass.d.ts +0 -39
- package/lib/esm/constants.d.ts +0 -104
- package/lib/esm/decorators.d.ts +0 -109
- package/lib/esm/environment.d.ts +0 -120
- package/lib/filters/LogFilter.d.ts +0 -43
- package/lib/filters/LogFilter.js.map +0 -1
- package/lib/filters/PatternFilter.d.ts +0 -56
- package/lib/filters/PatternFilter.js.map +0 -1
- package/lib/filters/index.d.ts +0 -7
- package/lib/filters/index.js.map +0 -1
- package/lib/index.d.ts +0 -34
- package/lib/index.js.map +0 -1
- package/lib/logParameters.d.ts +0 -56
- package/lib/logParameters.js.map +0 -1
- package/lib/logging.d.ts +0 -373
- package/lib/logging.js.map +0 -1
- package/lib/pino/index.d.ts +0 -7
- package/lib/pino/index.js.map +0 -1
- package/lib/pino/pino.d.ts +0 -29
- package/lib/pino/pino.js.map +0 -1
- package/lib/text.d.ts +0 -118
- package/lib/text.js.map +0 -1
- package/lib/time.d.ts +0 -151
- package/lib/time.js.map +0 -1
- package/lib/types.d.ts +0 -287
- package/lib/types.js.map +0 -1
- package/lib/utils.d.ts +0 -48
- package/lib/utils.js.map +0 -1
- package/lib/web.d.ts +0 -8
- package/lib/web.js.map +0 -1
- package/lib/winston/index.d.ts +0 -7
- package/lib/winston/index.js.map +0 -1
- package/lib/winston/winston.d.ts +0 -47
- package/lib/winston/winston.js.map +0 -1
- /package/lib/{LoggedClass.cjs → cjs/LoggedClass.cjs} +0 -0
- /package/lib/{constants.cjs → cjs/constants.cjs} +0 -0
- /package/lib/{decorators.cjs → cjs/decorators.cjs} +0 -0
- /package/lib/{environment.cjs → cjs/environment.cjs} +0 -0
- /package/lib/{filters → cjs/filters}/LogFilter.cjs +0 -0
- /package/lib/{filters → cjs/filters}/PatternFilter.cjs +0 -0
- /package/lib/{filters → cjs/filters}/index.cjs +0 -0
- /package/lib/{logParameters.cjs → cjs/logParameters.cjs} +0 -0
- /package/lib/{logging.cjs → cjs/logging.cjs} +0 -0
- /package/lib/{pino → cjs/pino}/index.cjs +0 -0
- /package/lib/{pino → cjs/pino}/pino.cjs +0 -0
- /package/lib/{text.cjs → cjs/text.cjs} +0 -0
- /package/lib/{time.cjs → cjs/time.cjs} +0 -0
- /package/lib/{types.cjs → cjs/types.cjs} +0 -0
- /package/lib/{utils.cjs → cjs/utils.cjs} +0 -0
- /package/lib/{web.cjs → cjs/web.cjs} +0 -0
- /package/lib/{winston → cjs/winston}/index.cjs +0 -0
- /package/lib/{winston → cjs/winston}/winston.cjs +0 -0
- /package/lib/{LoggedClass.d.ts → types/LoggedClass.d.ts} +0 -0
- /package/lib/{constants.d.ts → types/constants.d.ts} +0 -0
- /package/lib/{decorators.d.ts → types/decorators.d.ts} +0 -0
- /package/lib/{environment.d.ts → types/environment.d.ts} +0 -0
- /package/lib/{esm → types}/filters/LogFilter.d.ts +0 -0
- /package/lib/{esm → types}/filters/PatternFilter.d.ts +0 -0
- /package/lib/{esm → types}/filters/index.d.ts +0 -0
- /package/lib/{esm → types}/index.d.ts +0 -0
- /package/lib/{esm → types}/logParameters.d.ts +0 -0
- /package/lib/{esm → types}/logging.d.ts +0 -0
- /package/lib/{esm → types}/pino/index.d.ts +0 -0
- /package/lib/{esm → types}/pino/pino.d.ts +0 -0
- /package/lib/{esm → types}/text.d.ts +0 -0
- /package/lib/{esm → types}/time.d.ts +0 -0
- /package/lib/{esm → types}/types.d.ts +0 -0
- /package/lib/{esm → types}/utils.d.ts +0 -0
- /package/lib/{esm → types}/web.d.ts +0 -0
- /package/lib/{esm → types}/winston/index.d.ts +0 -0
- /package/lib/{esm → types}/winston/winston.d.ts +0 -0
package/lib/time.d.ts
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description A snapshot of a recorded lap interval.
|
|
3
|
-
* @summary This captures the lap index, an optional label, the elapsed milliseconds for the lap, and the cumulative elapsed time since the stopwatch started.
|
|
4
|
-
* @typedef {object} Lap
|
|
5
|
-
* @property {number} index - The zero-based lap order.
|
|
6
|
-
* @property {string} [label] - An optional label that describes the lap.
|
|
7
|
-
* @property {number} ms - The duration of the lap in milliseconds.
|
|
8
|
-
* @property {number} totalMs - The total elapsed time when the lap was recorded.
|
|
9
|
-
* @memberOf module:Logging
|
|
10
|
-
*/
|
|
11
|
-
export type Lap = {
|
|
12
|
-
index: number;
|
|
13
|
-
label?: string;
|
|
14
|
-
/** Duration of this lap in milliseconds */
|
|
15
|
-
ms: number;
|
|
16
|
-
/** Cumulative time up to this lap in milliseconds */
|
|
17
|
-
totalMs: number;
|
|
18
|
-
};
|
|
19
|
-
type NowFn = () => number;
|
|
20
|
-
/**
|
|
21
|
-
* @description A high-resolution clock accessor that returns milliseconds.
|
|
22
|
-
* @summary This function chooses the most precise timer available in the current runtime, preferring `performance.now` or `process.hrtime.bigint`.
|
|
23
|
-
* @return {number} The milliseconds that have elapsed, according to the best available clock.
|
|
24
|
-
* @function now
|
|
25
|
-
* @memberOf module:Logging
|
|
26
|
-
*/
|
|
27
|
-
export declare const now: NowFn;
|
|
28
|
-
/**
|
|
29
|
-
* @description A high-resolution stopwatch with pause, resume, and lap tracking.
|
|
30
|
-
* @summary This class tracks elapsed time using the highest precision timer available. It supports pausing, resuming, and recording labeled laps for diagnostics and benchmarking.
|
|
31
|
-
* @param {boolean} [autoStart=false] - When `true`, the stopwatch starts immediately upon construction.
|
|
32
|
-
* @class StopWatch
|
|
33
|
-
* @example
|
|
34
|
-
* const sw = new StopWatch(true);
|
|
35
|
-
* // ... work ...
|
|
36
|
-
* const lap = sw.lap("phase 1");
|
|
37
|
-
* sw.pause();
|
|
38
|
-
* console.log(`Elapsed: ${lap.totalMs}ms`);
|
|
39
|
-
* @mermaid
|
|
40
|
-
* sequenceDiagram
|
|
41
|
-
* participant Client
|
|
42
|
-
* participant StopWatch
|
|
43
|
-
* participant Clock as now()
|
|
44
|
-
* Client->>StopWatch: start()
|
|
45
|
-
* StopWatch->>Clock: now()
|
|
46
|
-
* Clock-->>StopWatch: timestamp
|
|
47
|
-
* Client->>StopWatch: lap()
|
|
48
|
-
* StopWatch->>Clock: now()
|
|
49
|
-
* Clock-->>StopWatch: timestamp
|
|
50
|
-
* StopWatch-->>Client: Lap
|
|
51
|
-
* Client->>StopWatch: pause()
|
|
52
|
-
* StopWatch->>Clock: now()
|
|
53
|
-
* Clock-->>StopWatch: timestamp
|
|
54
|
-
*/
|
|
55
|
-
export declare class StopWatch {
|
|
56
|
-
private _startMs;
|
|
57
|
-
private _elapsedMs;
|
|
58
|
-
private _running;
|
|
59
|
-
private _laps;
|
|
60
|
-
private _lastLapTotalMs;
|
|
61
|
-
constructor(autoStart?: boolean);
|
|
62
|
-
/**
|
|
63
|
-
* @description Indicates whether the stopwatch is actively running.
|
|
64
|
-
* @summary This method returns `true` when timing is in progress, and `false` when it is paused or stopped.
|
|
65
|
-
* @return {boolean} The current running state.
|
|
66
|
-
*/
|
|
67
|
-
get running(): boolean;
|
|
68
|
-
/**
|
|
69
|
-
* @description The elapsed time that has been captured by the stopwatch.
|
|
70
|
-
* @summary This method computes the total elapsed time in milliseconds, including the current session if it is running.
|
|
71
|
-
* @return {number} The milliseconds that have elapsed since the stopwatch started.
|
|
72
|
-
*/
|
|
73
|
-
get elapsedMs(): number;
|
|
74
|
-
/**
|
|
75
|
-
* @description Starts timing if the stopwatch is not already running.
|
|
76
|
-
* @summary This method records the current timestamp and transitions the stopwatch into the running state.
|
|
77
|
-
* @return {this} A fluent reference to the stopwatch.
|
|
78
|
-
*/
|
|
79
|
-
start(): this;
|
|
80
|
-
/**
|
|
81
|
-
* @description Pauses timing and accumulates the elapsed milliseconds.
|
|
82
|
-
* @summary This method captures the partial duration, updates the accumulator, and keeps the stopwatch ready to resume later.
|
|
83
|
-
* @return {this} A fluent reference to the stopwatch.
|
|
84
|
-
*/
|
|
85
|
-
pause(): this;
|
|
86
|
-
/**
|
|
87
|
-
* @description Resumes timing after a pause.
|
|
88
|
-
* @summary This method captures a fresh start timestamp, while keeping the previous elapsed time intact.
|
|
89
|
-
* @return {this} A fluent reference to the stopwatch.
|
|
90
|
-
*/
|
|
91
|
-
resume(): this;
|
|
92
|
-
/**
|
|
93
|
-
* @description Stops timing and returns the total elapsed milliseconds.
|
|
94
|
-
* @summary This method invokes {@link StopWatch.pause} to consolidate the elapsed time, and leaves the stopwatch in a non-running state.
|
|
95
|
-
* @return {number} The milliseconds that have accumulated across all runs.
|
|
96
|
-
*/
|
|
97
|
-
stop(): number;
|
|
98
|
-
/**
|
|
99
|
-
* @description Resets the stopwatch state, while optionally continuing to run.
|
|
100
|
-
* @summary This method clears the elapsed time and lap history, and preserves whether the stopwatch should continue ticking.
|
|
101
|
-
* @return {this} A fluent reference to the stopwatch.
|
|
102
|
-
*/
|
|
103
|
-
reset(): this;
|
|
104
|
-
/**
|
|
105
|
-
* @description Records a lap split since the stopwatch started, or since the previous lap.
|
|
106
|
-
* @summary This method stores the lap metadata, updates the cumulative tracking, and returns the newly created {@link Lap}.
|
|
107
|
-
* @param {string} [label] - An optional label that describes the lap.
|
|
108
|
-
* @return {Lap} A lap snapshot that captures incremental and cumulative timings.
|
|
109
|
-
*/
|
|
110
|
-
lap(label?: string): Lap;
|
|
111
|
-
/**
|
|
112
|
-
* @description Retrieves the recorded lap history.
|
|
113
|
-
* @summary This method returns the internal lap array as a read-only view to prevent external mutation.
|
|
114
|
-
* @return {Array<Lap>} The laps that have been captured by the stopwatch.
|
|
115
|
-
*/
|
|
116
|
-
get laps(): readonly Lap[];
|
|
117
|
-
/**
|
|
118
|
-
* @description Formats the elapsed time in a human-readable representation.
|
|
119
|
-
* @summary This method uses {@link formatMs} to produce an `hh:mm:ss.mmm` string for display and logging.
|
|
120
|
-
* @return {string} The elapsed time, formatted for presentation.
|
|
121
|
-
*/
|
|
122
|
-
toString(): string;
|
|
123
|
-
/**
|
|
124
|
-
* @description Serializes the stopwatch state.
|
|
125
|
-
* @summary This method provides a JSON-friendly snapshot that includes the running state, elapsed time, and lap details.
|
|
126
|
-
* @return {{running: boolean, elapsedMs: number, laps: Lap[]}} A serializable stopwatch representation.
|
|
127
|
-
*/
|
|
128
|
-
toJSON(): {
|
|
129
|
-
running: boolean;
|
|
130
|
-
elapsedMs: number;
|
|
131
|
-
laps: Lap[];
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* @description Formats milliseconds into `hh:mm:ss.mmm`.
|
|
136
|
-
* @summary This function breaks the duration into hours, minutes, seconds, and milliseconds, and returns a zero-padded string.
|
|
137
|
-
* @param {number} ms - The milliseconds to format.
|
|
138
|
-
* @return {string} The formatted duration string.
|
|
139
|
-
* @function formatMs
|
|
140
|
-
* @memberOf module:Logging
|
|
141
|
-
* @mermaid
|
|
142
|
-
* sequenceDiagram
|
|
143
|
-
* participant Caller
|
|
144
|
-
* participant Formatter as formatMs
|
|
145
|
-
* Caller->>Formatter: formatMs(ms)
|
|
146
|
-
* Formatter->>Formatter: derive hours/minutes/seconds
|
|
147
|
-
* Formatter->>Formatter: pad segments
|
|
148
|
-
* Formatter-->>Caller: hh:mm:ss.mmm
|
|
149
|
-
*/
|
|
150
|
-
export declare function formatMs(ms: number): string;
|
|
151
|
-
export {};
|
package/lib/time.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":";;;AA+OA,4BASC;AAnOD,SAAS,OAAO;IACd,wCAAwC;IACxC,IACE,OAAO,UAAU,KAAK,WAAW;QACjC,OAAO,UAAU,CAAC,WAAW,EAAE,GAAG,KAAK,UAAU,EACjD,CAAC;QACD,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;IAC5C,CAAC;IACD,oEAAoE;IACpE,IACE,OAAO,OAAO,KAAK,WAAW;QAC9B,OAAQ,OAAe,CAAC,MAAM,EAAE,MAAM,KAAK,UAAU,EACrD,CAAC;QACD,OAAO,GAAG,EAAE;YACV,MAAM,EAAE,GAAI,OAAe,CAAC,MAAM,CAAC,MAAM,EAAY,CAAC,CAAC,cAAc;YACrE,OAAO,MAAM,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,QAAQ;QACzC,CAAC,CAAC;IACJ,CAAC;IACD,WAAW;IACX,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AAC1B,CAAC;AAED;;;;;;GAMG;AACU,QAAA,GAAG,GAAG,OAAO,EAAE,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,SAAS;IAOpB,YAAY,SAAS,GAAG,KAAK;QANrB,aAAQ,GAAkB,IAAI,CAAC;QAC/B,eAAU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CAAC;IACJ,CAAC;CACF;AA/ID,8BA+IC;AACD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,QAAQ,CAAC,EAAU;IACjC,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,MAAM,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACpE,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;AAC3F,CAAC"}
|
package/lib/types.d.ts
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { styles } from "styled-string-builder";
|
|
2
|
-
import { LoggingMode, LogLevel } from "./constants";
|
|
3
|
-
/**
|
|
4
|
-
* @description A string-compatible value that can be accepted by the logging APIs.
|
|
5
|
-
* @summary Represents either a literal string or an object that has a `toString()` method. This allows for the lazy stringification of complex payloads.
|
|
6
|
-
* @typedef {(string|Object)} StringLike
|
|
7
|
-
* @memberOf module:Logging
|
|
8
|
-
*/
|
|
9
|
-
export type StringLike = string | {
|
|
10
|
-
toString: () => string;
|
|
11
|
-
};
|
|
12
|
-
export type LogMeta = Record<string, unknown>;
|
|
13
|
-
/**
|
|
14
|
-
* @description A generic function signature for loosely typed callbacks.
|
|
15
|
-
* @summary This type covers variadic functions where the arguments and return types are not constrained, which enables the logging layer to accept any callable.
|
|
16
|
-
* @typedef {function(...any[]): any} AnyFunction
|
|
17
|
-
* @memberOf module:Logging
|
|
18
|
-
*/
|
|
19
|
-
export type AnyFunction = (...args: any[]) => any;
|
|
20
|
-
/**
|
|
21
|
-
* @description A constructable class type.
|
|
22
|
-
* @summary Describes a constructor that produces instances of type `T`. This allows APIs to accept class references for context-aware logging.
|
|
23
|
-
* @template T
|
|
24
|
-
* @typedef Class
|
|
25
|
-
* @memberOf module:Logging
|
|
26
|
-
*/
|
|
27
|
-
export type Class<T> = {
|
|
28
|
-
new (...args: any[]): T;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* @description A context descriptor that is accepted when requesting a logger instance.
|
|
32
|
-
* @summary Allows the logging system to resolve context names from strings, constructors, or functions.
|
|
33
|
-
* @typedef {(string|Class<any>|AnyFunction)} LoggingContext
|
|
34
|
-
* @memberOf module:Logging
|
|
35
|
-
*/
|
|
36
|
-
export type LoggingContext = string | Class<any> | AnyFunction;
|
|
37
|
-
/**
|
|
38
|
-
* @description An interface for factories that create contextual clones of the receiver.
|
|
39
|
-
* @summary Declares a `for` method that returns another instance of `THIS` using the provided arguments. This enables chained logger customization.
|
|
40
|
-
* @template THIS
|
|
41
|
-
* @template ARGS
|
|
42
|
-
* @interface Impersonatable
|
|
43
|
-
* @memberOf module:Logging
|
|
44
|
-
*/
|
|
45
|
-
export interface Impersonatable<THIS, ARGS extends any[] = any[]> {
|
|
46
|
-
/**
|
|
47
|
-
* @description Produce a copy of the current instance with altered context.
|
|
48
|
-
* @summary Called by logging utilities to derive child objects with supplemental configuration and context metadata.
|
|
49
|
-
* @param {ARGS} args - Arguments forwarded to the impersonation strategy.
|
|
50
|
-
* @return {THIS} Derived instance using the provided arguments.
|
|
51
|
-
*/
|
|
52
|
-
for(...args: ARGS): THIS;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @description An interface for loggers that support multiple verbosity levels.
|
|
56
|
-
* @summary This interface declares severity-specific log methods, configuration overrides, and factory helpers that are used throughout the logging toolkit.
|
|
57
|
-
* @interface Logger
|
|
58
|
-
* @memberOf module:Logging
|
|
59
|
-
*/
|
|
60
|
-
export interface Logger extends Impersonatable<Logger, [
|
|
61
|
-
(string | {
|
|
62
|
-
new (...args: any[]): any;
|
|
63
|
-
} | AnyFunction | Partial<LoggingConfig>),
|
|
64
|
-
Partial<LoggingConfig>,
|
|
65
|
-
...any[]
|
|
66
|
-
]> {
|
|
67
|
-
/**
|
|
68
|
-
* @description Logs a benchmark message.
|
|
69
|
-
* @summary Emits high-frequency performance metrics at the `benchmark` log level.
|
|
70
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
71
|
-
* @return {void}
|
|
72
|
-
*/
|
|
73
|
-
benchmark(msg: StringLike, meta?: LogMeta): void;
|
|
74
|
-
/**
|
|
75
|
-
* @description Logs a `way too verbose` or a silly message.
|
|
76
|
-
* @summary Emits playful or extremely verbose details at the `silly` log level.
|
|
77
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
78
|
-
* @return {void}
|
|
79
|
-
*/
|
|
80
|
-
silly(msg: StringLike, verbosity?: number | LogMeta, meta?: LogMeta): void;
|
|
81
|
-
/**
|
|
82
|
-
* @description Logs developer trace messages.
|
|
83
|
-
* @summary Emits playful or extremely verbose details at the `silly` log level.
|
|
84
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
85
|
-
* @return {void}
|
|
86
|
-
*/
|
|
87
|
-
trace(msg: StringLike, meta?: LogMeta): void;
|
|
88
|
-
/**
|
|
89
|
-
* @description Logs a verbose message.
|
|
90
|
-
* @summary Writes diagnostic output governed by the configured verbosity threshold.
|
|
91
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
92
|
-
* @param {number} [verbosity] - Verbosity level required for the message to pass through.
|
|
93
|
-
* @return {void}
|
|
94
|
-
*/
|
|
95
|
-
verbose(msg: StringLike, verbosityOrMeta?: number | LogMeta, meta?: LogMeta): void;
|
|
96
|
-
/**
|
|
97
|
-
* @description Logs an info message.
|
|
98
|
-
* @summary Emits general informational events that describe application progress.
|
|
99
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
100
|
-
* @return {void}
|
|
101
|
-
*/
|
|
102
|
-
info(msg: StringLike, meta?: LogMeta): void;
|
|
103
|
-
/**
|
|
104
|
-
* @description Logs an error message.
|
|
105
|
-
* @summary Records errors and exceptions, including optional stack traces.
|
|
106
|
-
* @param {StringLike|Error} msg - Message or {@link Error} instance to log.
|
|
107
|
-
* @param {Error} [e] - Optional secondary error or cause.
|
|
108
|
-
* @return {void}
|
|
109
|
-
*/
|
|
110
|
-
error(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
|
|
111
|
-
/**
|
|
112
|
-
* @description Logs a debug message.
|
|
113
|
-
* @summary Emits fine-grained diagnostic details useful during development and troubleshooting.
|
|
114
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
115
|
-
* @return {void}
|
|
116
|
-
*/
|
|
117
|
-
debug(msg: StringLike, meta?: LogMeta): void;
|
|
118
|
-
/**
|
|
119
|
-
* @description Logs a debug message.
|
|
120
|
-
* @summary Emits fine-grained diagnostic details useful during development and troubleshooting.
|
|
121
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
122
|
-
* @return {void}
|
|
123
|
-
*/
|
|
124
|
-
warn(msg: StringLike, meta?: LogMeta): void;
|
|
125
|
-
/**
|
|
126
|
-
* @description Creates a new logger for a specific method or context.
|
|
127
|
-
* @summary Produces a scoped logger that formats entries using the derived context and overrides supplied configuration.
|
|
128
|
-
* @param {any} method - Method name, callback, constructor, or partial configuration used to seed the child logger.
|
|
129
|
-
* @param {Partial<LoggingConfig>} [config] - Optional configuration overrides for the child logger.
|
|
130
|
-
* @param {...any[]} args - Extra arguments forwarded to factory implementations.
|
|
131
|
-
* @return {Logger} Logger instance tailored to the supplied context.
|
|
132
|
-
*/
|
|
133
|
-
for(config: Partial<LoggingConfig>): this;
|
|
134
|
-
for(context: string | {
|
|
135
|
-
new (...args: any[]): any;
|
|
136
|
-
} | AnyFunction | object): this;
|
|
137
|
-
for(method: string | {
|
|
138
|
-
new (...args: any[]): any;
|
|
139
|
-
} | AnyFunction | object | Partial<LoggingConfig>, config?: Partial<LoggingConfig>, ...args: any[]): this;
|
|
140
|
-
/**
|
|
141
|
-
* @description Clears any contextual overrides applied via {@link Logger.for}.
|
|
142
|
-
* @summary Resets temporary context/configuration so ensuing chains start from the base logger while preserving the concrete instance type.
|
|
143
|
-
* @return {this} The same logger instance to continue chaining.
|
|
144
|
-
*/
|
|
145
|
-
clear(): this;
|
|
146
|
-
/**
|
|
147
|
-
* @description Updates the logger configuration.
|
|
148
|
-
* @summary Merges the given options into the logger's existing configuration.
|
|
149
|
-
* @param {Partial<LoggingConfig>} config - Configuration overrides to apply.
|
|
150
|
-
* @return {void}
|
|
151
|
-
*/
|
|
152
|
-
setConfig(config: Partial<LoggingConfig>): void;
|
|
153
|
-
/**
|
|
154
|
-
* @description Immutable base context for the logger instance.
|
|
155
|
-
* @summary Returned as a copy so callers cannot mutate the internal base context while still allowing inspection.
|
|
156
|
-
*/
|
|
157
|
-
readonly root: string[];
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* @description An interface for filters that can mutate or reject log messages.
|
|
161
|
-
* @summary This allows for custom pre-processing of log entries before they are formatted or emitted.
|
|
162
|
-
* @interface LoggingFilter
|
|
163
|
-
* @memberOf module:Logging
|
|
164
|
-
*/
|
|
165
|
-
export interface LoggingFilter {
|
|
166
|
-
/**
|
|
167
|
-
* @description Apply filtering logic to an incoming message.
|
|
168
|
-
* @summary Receives the active configuration, original message, and context stack to produce the final message string.
|
|
169
|
-
* @param {LoggingConfig} config - Active logging configuration.
|
|
170
|
-
* @param {string} message - Message submitted for logging.
|
|
171
|
-
* @param {string[]} context - Context identifiers associated with the message.
|
|
172
|
-
* @return {string} Filtered message string.
|
|
173
|
-
*/
|
|
174
|
-
filter(config: LoggingConfig, message: string, context: string[]): string;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* @description Configuration for the logging system.
|
|
178
|
-
* @summary Defines the log level, verbosity, and other settings for logging.
|
|
179
|
-
* @template TRANSPORT
|
|
180
|
-
* @typedef {object} LoggingConfig
|
|
181
|
-
* @property {string} env - The environment, e.g., "development", "production".
|
|
182
|
-
* @property {LogLevel} level - The logging level.
|
|
183
|
-
* @property {boolean} [logLevel] - Whether to display the log level in the output.
|
|
184
|
-
* @property {number} verbose - The verbosity level.
|
|
185
|
-
* @property {string} contextSeparator - The separator to use between context entries.
|
|
186
|
-
* @property {string} separator - The separator to use between log components.
|
|
187
|
-
* @property {boolean} [style] - Whether to apply styling to the log output.
|
|
188
|
-
* @property {boolean} [timestamp] - Whether to include timestamps in log messages.
|
|
189
|
-
* @property {string} [timestampFormat] - The format for timestamps.
|
|
190
|
-
* @property {boolean} [context] - Whether to include context information in log messages.
|
|
191
|
-
* @property {Theme} [theme] - The theme to use for styling log messages.
|
|
192
|
-
* @property {LoggingMode} format - The output format for log messages.
|
|
193
|
-
* @property {string} pattern - The pattern to use for formatting log messages.
|
|
194
|
-
* @property {(string|number)} [correlationId] - A correlation ID for tracking related log messages.
|
|
195
|
-
* @property {(string[]|LoggingFilter[])} [filters] - An array of filters to apply to log messages.
|
|
196
|
-
* @property {TRANSPORT[]} [transports] - An array of transports to use for logging.
|
|
197
|
-
* @memberOf module:Logging
|
|
198
|
-
*/
|
|
199
|
-
export type LoggingConfig<TRANSPORT = object> = {
|
|
200
|
-
env: "development" | "production" | "test" | "staging" | string;
|
|
201
|
-
level: LogLevel;
|
|
202
|
-
logLevel?: boolean;
|
|
203
|
-
verbose: number;
|
|
204
|
-
contextSeparator: string;
|
|
205
|
-
separator: string;
|
|
206
|
-
style?: boolean;
|
|
207
|
-
timestamp?: boolean;
|
|
208
|
-
timestampFormat?: string;
|
|
209
|
-
context?: boolean;
|
|
210
|
-
meta?: boolean;
|
|
211
|
-
theme?: Theme;
|
|
212
|
-
format: LoggingMode;
|
|
213
|
-
pattern: string;
|
|
214
|
-
correlationId?: string | number;
|
|
215
|
-
filters?: string[] | LoggingFilter[];
|
|
216
|
-
transports?: TRANSPORT[];
|
|
217
|
-
};
|
|
218
|
-
/**
|
|
219
|
-
* @description A factory signature for creating logger instances.
|
|
220
|
-
* @summary This allows consumers to override the logger construction with custom implementations.
|
|
221
|
-
* @template L
|
|
222
|
-
* @typedef {function(string, Partial<LoggingConfig>, ...any[]): L} LoggerFactory
|
|
223
|
-
* @memberOf module:Logging
|
|
224
|
-
*/
|
|
225
|
-
export type LoggerFactory<L extends Logger = Logger> = (object?: string, config?: Partial<LoggingConfig>, ...args: any[]) => L;
|
|
226
|
-
/**
|
|
227
|
-
* @description A theme option that is applied to a specific log element.
|
|
228
|
-
* @summary This interface configures the foreground and background colors, as well as additional style directives for styled console output.
|
|
229
|
-
* @interface ThemeOption
|
|
230
|
-
* @memberOf module:Logging
|
|
231
|
-
*/
|
|
232
|
-
export interface ThemeOption {
|
|
233
|
-
fg?: number | [number] | [number, number, number];
|
|
234
|
-
bg?: number | [number] | [number, number, number];
|
|
235
|
-
style?: number[] | [keyof typeof styles];
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* @description A mapping between log levels and theme overrides.
|
|
239
|
-
* @summary This enables level-specific styling by associating each {@link LogLevel} with a {@link ThemeOption} configuration.
|
|
240
|
-
* @typedef {Partial<Record<LogLevel, ThemeOption>>} ThemeOptionByLogLevel
|
|
241
|
-
* @memberOf module:Logging
|
|
242
|
-
*/
|
|
243
|
-
export type ThemeOptionByLogLevel = Partial<Record<LogLevel, ThemeOption>>;
|
|
244
|
-
/**
|
|
245
|
-
* @description A theme definition that is applied to the console output.
|
|
246
|
-
* @summary This interface specifies the styling for each console log element and supports overrides based on {@link LogLevel} values.
|
|
247
|
-
* @interface Theme
|
|
248
|
-
* @memberOf module:Logging
|
|
249
|
-
*/
|
|
250
|
-
export interface Theme {
|
|
251
|
-
/**
|
|
252
|
-
* @description Styling for application identifiers in the output.
|
|
253
|
-
*/
|
|
254
|
-
app: ThemeOption | ThemeOptionByLogLevel;
|
|
255
|
-
/**
|
|
256
|
-
* @description Styling for separators inserted between log sections.
|
|
257
|
-
*/
|
|
258
|
-
separator: ThemeOption | ThemeOptionByLogLevel;
|
|
259
|
-
/**
|
|
260
|
-
* @description Styling for class names in the output.
|
|
261
|
-
*/
|
|
262
|
-
class: ThemeOption | ThemeOptionByLogLevel;
|
|
263
|
-
/**
|
|
264
|
-
* @description Styling for timestamps in the output.
|
|
265
|
-
*/
|
|
266
|
-
timestamp: ThemeOption | ThemeOptionByLogLevel;
|
|
267
|
-
/**
|
|
268
|
-
* @description Styling for the main message text in the output.
|
|
269
|
-
*/
|
|
270
|
-
message: ThemeOption | ThemeOptionByLogLevel;
|
|
271
|
-
/**
|
|
272
|
-
* @description Styling for method names in the output.
|
|
273
|
-
*/
|
|
274
|
-
method: ThemeOption | ThemeOptionByLogLevel;
|
|
275
|
-
/**
|
|
276
|
-
* @description Styling for identifier elements in the output.
|
|
277
|
-
*/
|
|
278
|
-
id: ThemeOption | ThemeOptionByLogLevel;
|
|
279
|
-
/**
|
|
280
|
-
* @description Styling for stack trace blocks in the output.
|
|
281
|
-
*/
|
|
282
|
-
stack: ThemeOption;
|
|
283
|
-
/**
|
|
284
|
-
* @description Styling overrides keyed by {@link LogLevel}.
|
|
285
|
-
*/
|
|
286
|
-
logLevel: ThemeOptionByLogLevel;
|
|
287
|
-
}
|
package/lib/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/lib/utils.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Checks if a value is a class.
|
|
3
|
-
* @summary This function determines if the given value is a class constructor.
|
|
4
|
-
* @param {unknown} value - The value to check.
|
|
5
|
-
* @return {boolean} `true` if the value is a class, `false` otherwise.
|
|
6
|
-
* @function isClass
|
|
7
|
-
* @memberOf module:Logging
|
|
8
|
-
*/
|
|
9
|
-
export declare function isClass(value: unknown): value is abstract new (...args: any[]) => any;
|
|
10
|
-
/**
|
|
11
|
-
* @description Checks if a value is a function.
|
|
12
|
-
* @summary This function determines if the given value is a function, but not a class.
|
|
13
|
-
* @template T
|
|
14
|
-
* @param {unknown} value - The value to check.
|
|
15
|
-
* @return {boolean} `true` if the value is a function, `false` otherwise.
|
|
16
|
-
* @function isFunction
|
|
17
|
-
* @memberOf module:Logging
|
|
18
|
-
*/
|
|
19
|
-
export declare function isFunction<T extends (...args: any[]) => unknown>(value: unknown): value is T;
|
|
20
|
-
/**
|
|
21
|
-
* @description Checks if a value is a method.
|
|
22
|
-
* @summary This function determines if the given value is a method.
|
|
23
|
-
* @template T
|
|
24
|
-
* @param {unknown} value - The value to check.
|
|
25
|
-
* @return {boolean} `true` if the value is a method, `false` otherwise.
|
|
26
|
-
* @function isMethod
|
|
27
|
-
* @memberOf module:Logging
|
|
28
|
-
*/
|
|
29
|
-
export declare function isMethod<T extends (...args: any[]) => unknown>(value: unknown): value is T;
|
|
30
|
-
/**
|
|
31
|
-
* @description Checks if a value is an instance of a class.
|
|
32
|
-
* @summary This function determines if the given value is an instance of a class.
|
|
33
|
-
* @template T
|
|
34
|
-
* @param {unknown} value - The value to check.
|
|
35
|
-
* @return {boolean} `true` if the value is an instance of a class, `false` otherwise.
|
|
36
|
-
* @function isInstance
|
|
37
|
-
* @memberOf module:Logging
|
|
38
|
-
*/
|
|
39
|
-
export declare function isInstance<T extends object>(value: unknown): value is T;
|
|
40
|
-
/**
|
|
41
|
-
* @description Gets the name of an object.
|
|
42
|
-
* @summary This function returns the name of the given object, which can be a class, an instance of a class, a function, or a primitive value.
|
|
43
|
-
* @param {unknown} value - The value to get the name of.
|
|
44
|
-
* @return {string} The name of the object.
|
|
45
|
-
* @function getObjectName
|
|
46
|
-
* @memberOf module:Logging
|
|
47
|
-
*/
|
|
48
|
-
export declare function getObjectName(value: unknown): string;
|
package/lib/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAQA,0BA+BC;AAWD,gCAIC;AAWD,4BAOC;AAWD,gCAQC;AAUD,sCA0CC;AA/ID;;;;;;;GAOG;AACH,SAAgB,OAAO,CACrB,KAAc;IAEd,IAAI,OAAO,KAAK,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC;IAE9C,kCAAkC;IAClC,yDAAyD;IACzD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpD,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,8DAA8D;IAChE,CAAC;IAED,oEAAoE;IACpE,MAAM,SAAS,GAAG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACtE,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IAEjD,kEAAkE;IAClE,gEAAgE;IAChE,IAAI,SAAS,CAAC,QAAQ,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAE9C,8CAA8C;IAC9C,qEAAqE;IACrE,MAAM,KAAK,GAAI,KAAa,CAAC,SAAS,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,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AAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QAChC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,OAAO,KAAK,CAAC;AACtB,CAAC"}
|
package/lib/web.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Determines if the current environment is a browser by checking the prototype chain of the global object.
|
|
3
|
-
* @summary This function checks if the code is running in a browser environment.
|
|
4
|
-
* @return {boolean} `true` if the environment is a browser, `false` otherwise.
|
|
5
|
-
* @function isBrowser
|
|
6
|
-
* @memberOf module:Logging
|
|
7
|
-
*/
|
|
8
|
-
export declare function isBrowser(): boolean;
|
package/lib/web.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":";;AAOA,8BAKC;AAZD;;;;;;GAMG;AACH,SAAgB,SAAS;IACvB,OAAO,CACL,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACxD,MAAM,CAAC,SAAS,CACjB,CAAC;AACJ,CAAC"}
|
package/lib/winston/index.d.ts
DELETED
package/lib/winston/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/winston/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,gDAA0B"}
|
package/lib/winston/winston.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import winston from "winston";
|
|
2
|
-
import { Logger, LoggerFactory, LogMeta, LoggingConfig, StringLike } from "../types";
|
|
3
|
-
import { MiniLogger } from "../logging";
|
|
4
|
-
import { LogLevel } from "../constants";
|
|
5
|
-
/**
|
|
6
|
-
* @description A logger implementation that uses Winston.
|
|
7
|
-
* @summary This class extends {@link MiniLogger} to provide logging functionality using the Winston library. It configures Winston with the appropriate transports and formats based on the logging configuration.
|
|
8
|
-
* @param {string} [cont] - The context (typically the class name) that this logger is associated with.
|
|
9
|
-
* @param {Partial<LoggingConfig>} [conf] - Optional configuration to override global settings.
|
|
10
|
-
* @class WinstonLogger
|
|
11
|
-
* @example
|
|
12
|
-
* // Create a Winston logger for a class
|
|
13
|
-
* const logger = new WinstonLogger('MyClass');
|
|
14
|
-
*
|
|
15
|
-
* // Log messages at different levels
|
|
16
|
-
* logger.info('Application started');
|
|
17
|
-
* logger.error(new Error('Something went wrong'));
|
|
18
|
-
*
|
|
19
|
-
* // Create a child logger for a specific method
|
|
20
|
-
* const methodLogger = logger.for('myMethod');
|
|
21
|
-
* methodLogger.debug('Processing data...');
|
|
22
|
-
*/
|
|
23
|
-
export declare class WinstonLogger extends MiniLogger implements Logger {
|
|
24
|
-
protected winston: winston.Logger;
|
|
25
|
-
constructor(cont?: string, conf?: Partial<LoggingConfig>);
|
|
26
|
-
private resolveTransports;
|
|
27
|
-
/**
|
|
28
|
-
* @description Logs a message with the specified log level using Winston.
|
|
29
|
-
* @summary This method overrides the base log method to use Winston for logging.
|
|
30
|
-
* @param {LogLevel} level - The log level of the message.
|
|
31
|
-
* @param {(StringLike|Error)} msg - The message to be logged or an Error object.
|
|
32
|
-
* @param {Error} [error] - An optional stack trace to include in the log.
|
|
33
|
-
* @return {void}
|
|
34
|
-
*/
|
|
35
|
-
protected log(level: LogLevel, msg: StringLike | Error, error?: Error, meta?: LogMeta): void;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @description A factory function for creating Winston loggers.
|
|
39
|
-
* @summary This is a {@link LoggerFactory} implementation that creates {@link WinstonLogger} instances.
|
|
40
|
-
* @param {string} [context] - The context (typically the class name) for the logger.
|
|
41
|
-
* @param {Partial<LoggingConfig>} [conf] - Optional configuration to override global settings.
|
|
42
|
-
* @param {...any} _args - Additional arguments to pass to the WinstonLogger constructor.
|
|
43
|
-
* @return {WinstonLogger} A new WinstonLogger instance.
|
|
44
|
-
* @const WinstonFactory
|
|
45
|
-
* @memberOf module:Logging
|
|
46
|
-
*/
|
|
47
|
-
export declare const WinstonFactory: LoggerFactory;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"winston.js","sourceRoot":"","sources":["../../src/winston/winston.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA2D;AAS3D,8CAAiD;AAGjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,aAAc,SAAQ,oBAAU;IAG3C,YAAY,IAAa,EAAE,IAA6B;QACtD,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAClB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAC1B,EAAE,EACF,iBAAO,CAAC,SAAS,EAAE,EACnB,IAAI,CAAC,IAAI,IAAI,EAAE,CACY,CAAC;QAE9B,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CACtC,MAAM,CAAC,UAAsC,IAAI,SAAS,CAC5D,CAAC;QACF,MAAM,WAAW,GAAG,iBAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CACxD,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAChE,CAAC;QAEF,MAAM,aAAa,GAAkB;YACnC,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,UAAU;YACV,MAAM,EAAE,WAAW;SACpB,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,iBAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACrD,CAAC;IAEO,iBAAiB,CAAC,UAAwB;QAChD,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM;YAAE,OAAO,UAAU,CAAC;QACvD,OAAO,CAAC,IAAI,iBAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACgB,GAAG,CACpB,KAAe,EACf,GAAuB,EACvB,KAAa,EACb,IAAc;QAEd,MAAM,OAAO,GAAa;YACxB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC;SACjD,CAAC;QACF,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;YAC9B,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAC1D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;CACF;AArDD,sCAqDC;AAED;;;;;;;;;GASG;AACI,MAAM,cAAc,GAAkB,CAC3C,OAAgB,EAChB,IAA6B;AAC7B,6DAA6D;AAC7D,GAAG,KAAY,EACA,EAAE,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AALxC,QAAA,cAAc,kBAK0B"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|