catchfn 0.1.1 → 0.2.0
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 +45 -13
- package/dist/index.cjs +425 -325
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -18
- package/dist/index.d.ts +74 -18
- package/dist/index.js +425 -325
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -32,8 +32,7 @@ declare const UNSERIALIZABLE = "[Unserializable]";
|
|
|
32
32
|
/**
|
|
33
33
|
* Serialize one entry under the closed set and the per-entry caps.
|
|
34
34
|
*
|
|
35
|
-
* `rootDepth` is the container level the value itself occupies
|
|
36
|
-
* pass 0 for an argument list so that each argument keeps all five levels.
|
|
35
|
+
* `rootDepth` is the container level the value itself occupies.
|
|
37
36
|
*/
|
|
38
37
|
declare function serializeEntry(value: unknown, rootDepth?: number): SerializedValue;
|
|
39
38
|
/** Serialize a value under the closed set. Alias of {@link serializeEntry}. */
|
|
@@ -42,15 +41,17 @@ declare function safeSerialize(value: unknown): SerializedValue;
|
|
|
42
41
|
declare function truncateString(value: string, maxLength: number): string;
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
|
-
*
|
|
44
|
+
* Versioned evidence events.
|
|
46
45
|
*
|
|
47
46
|
* Every collector records its observations as one of these events. The
|
|
48
|
-
*
|
|
47
|
+
* formats are closed: an event has exactly the fields below, and a consumer
|
|
49
48
|
* can check one with {@link validateEvidenceEvent} or with any JSON Schema
|
|
50
49
|
* validator and {@link evidenceEventSchema}.
|
|
51
50
|
*/
|
|
52
51
|
|
|
53
52
|
declare const EVIDENCE_SCHEMA_VERSION: 1;
|
|
53
|
+
declare const CONSOLE_EVIDENCE_SCHEMA_VERSION: 2;
|
|
54
|
+
type EvidenceSchemaVersion = typeof EVIDENCE_SCHEMA_VERSION | typeof CONSOLE_EVIDENCE_SCHEMA_VERSION;
|
|
54
55
|
declare const EVIDENCE_KINDS: readonly ["console", "network", "breadcrumb", "error", "websocket"];
|
|
55
56
|
type EvidenceKind = (typeof EVIDENCE_KINDS)[number];
|
|
56
57
|
declare const CONSOLE_LEVELS: readonly ["log", "info", "warn", "error", "debug"];
|
|
@@ -67,20 +68,29 @@ declare const WEBSOCKET_EVENT_TYPES: readonly ["open", "message", "close", "erro
|
|
|
67
68
|
type WebSocketEventType = (typeof WEBSOCKET_EVENT_TYPES)[number];
|
|
68
69
|
declare const WEBSOCKET_DIRECTIONS: readonly ["sent", "received"];
|
|
69
70
|
type WebSocketDirection = (typeof WEBSOCKET_DIRECTIONS)[number];
|
|
70
|
-
interface EvidenceEventBase {
|
|
71
|
-
schemaVersion:
|
|
71
|
+
interface EvidenceEventBase<Version extends EvidenceSchemaVersion = EvidenceSchemaVersion> {
|
|
72
|
+
schemaVersion: Version;
|
|
72
73
|
kind: EvidenceKind;
|
|
73
74
|
/** Capture order within one loaded copy of catchfn, starting at 0. */
|
|
74
75
|
seq: number;
|
|
75
76
|
/** Capture time in milliseconds since the Unix epoch (`Date.now()`). */
|
|
76
77
|
timestamp: number;
|
|
77
78
|
}
|
|
78
|
-
interface ConsoleEvidenceEvent extends EvidenceEventBase {
|
|
79
|
+
interface ConsoleEvidenceEvent extends EvidenceEventBase<typeof CONSOLE_EVIDENCE_SCHEMA_VERSION> {
|
|
80
|
+
kind: "console";
|
|
81
|
+
level: ConsoleLevel;
|
|
82
|
+
argumentCount: number;
|
|
83
|
+
source: "console";
|
|
84
|
+
lineno?: number;
|
|
85
|
+
colno?: number;
|
|
86
|
+
}
|
|
87
|
+
/** Console evidence saved before catchfn 0.2.0. Current collectors emit metadata. */
|
|
88
|
+
interface LegacyConsoleEvidenceEvent extends EvidenceEventBase<typeof EVIDENCE_SCHEMA_VERSION> {
|
|
79
89
|
kind: "console";
|
|
80
90
|
level: ConsoleLevel;
|
|
81
91
|
args: SerializedValue[];
|
|
82
92
|
}
|
|
83
|
-
interface NetworkEvidenceEvent extends EvidenceEventBase {
|
|
93
|
+
interface NetworkEvidenceEvent extends EvidenceEventBase<typeof EVIDENCE_SCHEMA_VERSION> {
|
|
84
94
|
kind: "network";
|
|
85
95
|
transport: NetworkTransport;
|
|
86
96
|
method: string;
|
|
@@ -96,7 +106,7 @@ interface NetworkEvidenceEvent extends EvidenceEventBase {
|
|
|
96
106
|
/** Redacted with `redactHeaders`. */
|
|
97
107
|
responseHeaders?: Record<string, string>;
|
|
98
108
|
}
|
|
99
|
-
interface BreadcrumbEvidenceEvent extends EvidenceEventBase {
|
|
109
|
+
interface BreadcrumbEvidenceEvent extends EvidenceEventBase<typeof EVIDENCE_SCHEMA_VERSION> {
|
|
100
110
|
kind: "breadcrumb";
|
|
101
111
|
type: BreadcrumbType;
|
|
102
112
|
message?: string;
|
|
@@ -106,7 +116,7 @@ interface BreadcrumbEvidenceEvent extends EvidenceEventBase {
|
|
|
106
116
|
category?: string;
|
|
107
117
|
level?: BreadcrumbLevel;
|
|
108
118
|
}
|
|
109
|
-
interface ErrorEvidenceEvent extends EvidenceEventBase {
|
|
119
|
+
interface ErrorEvidenceEvent extends EvidenceEventBase<typeof EVIDENCE_SCHEMA_VERSION> {
|
|
110
120
|
kind: "error";
|
|
111
121
|
/** The window event that reported it: an uncaught error or an unhandled rejection. */
|
|
112
122
|
source: ErrorSource;
|
|
@@ -125,7 +135,7 @@ interface ErrorEvidenceEvent extends EvidenceEventBase {
|
|
|
125
135
|
*/
|
|
126
136
|
value?: SerializedValue;
|
|
127
137
|
}
|
|
128
|
-
interface WebSocketEvidenceEvent extends EvidenceEventBase {
|
|
138
|
+
interface WebSocketEvidenceEvent extends EvidenceEventBase<typeof EVIDENCE_SCHEMA_VERSION> {
|
|
129
139
|
kind: "websocket";
|
|
130
140
|
type: WebSocketEventType;
|
|
131
141
|
/** Redacted with `redactUrl`; never the application's raw URL. */
|
|
@@ -138,13 +148,56 @@ interface WebSocketEvidenceEvent extends EvidenceEventBase {
|
|
|
138
148
|
code?: number;
|
|
139
149
|
wasClean?: boolean;
|
|
140
150
|
}
|
|
141
|
-
type EvidenceEvent = ConsoleEvidenceEvent | NetworkEvidenceEvent | BreadcrumbEvidenceEvent | ErrorEvidenceEvent | WebSocketEvidenceEvent;
|
|
142
|
-
/** JSON Schema (draft 2020-12) for one
|
|
151
|
+
type EvidenceEvent = ConsoleEvidenceEvent | LegacyConsoleEvidenceEvent | NetworkEvidenceEvent | BreadcrumbEvidenceEvent | ErrorEvidenceEvent | WebSocketEvidenceEvent;
|
|
152
|
+
/** JSON Schema (draft 2020-12) for one supported evidence event. */
|
|
143
153
|
declare const evidenceEventSchema: {
|
|
144
154
|
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
145
|
-
readonly $id: "urn:catchfn:evidence-event:
|
|
146
|
-
readonly title: "catchfn evidence event
|
|
155
|
+
readonly $id: "urn:catchfn:evidence-event:v2";
|
|
156
|
+
readonly title: "catchfn evidence event";
|
|
147
157
|
readonly oneOf: readonly [{
|
|
158
|
+
readonly type: "object";
|
|
159
|
+
readonly additionalProperties: false;
|
|
160
|
+
readonly required: readonly ["schemaVersion", "kind", "seq", "timestamp", "level", "argumentCount", "source"];
|
|
161
|
+
readonly properties: {
|
|
162
|
+
readonly schemaVersion: {
|
|
163
|
+
readonly const: 2;
|
|
164
|
+
};
|
|
165
|
+
readonly kind: {
|
|
166
|
+
readonly const: "console";
|
|
167
|
+
};
|
|
168
|
+
readonly level: {
|
|
169
|
+
readonly enum: readonly ["log", "info", "warn", "error", "debug"];
|
|
170
|
+
};
|
|
171
|
+
readonly argumentCount: {
|
|
172
|
+
readonly type: "integer";
|
|
173
|
+
readonly minimum: 0;
|
|
174
|
+
readonly maximum: number;
|
|
175
|
+
};
|
|
176
|
+
readonly source: {
|
|
177
|
+
readonly const: "console";
|
|
178
|
+
};
|
|
179
|
+
readonly lineno: {
|
|
180
|
+
readonly type: "integer";
|
|
181
|
+
readonly minimum: 0;
|
|
182
|
+
readonly maximum: number;
|
|
183
|
+
};
|
|
184
|
+
readonly colno: {
|
|
185
|
+
readonly type: "integer";
|
|
186
|
+
readonly minimum: 0;
|
|
187
|
+
readonly maximum: number;
|
|
188
|
+
};
|
|
189
|
+
readonly seq: {
|
|
190
|
+
readonly type: "integer";
|
|
191
|
+
readonly minimum: 0;
|
|
192
|
+
readonly maximum: number;
|
|
193
|
+
};
|
|
194
|
+
readonly timestamp: {
|
|
195
|
+
readonly type: "integer";
|
|
196
|
+
readonly minimum: 0;
|
|
197
|
+
readonly maximum: number;
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
}, {
|
|
148
201
|
readonly type: "object";
|
|
149
202
|
readonly additionalProperties: false;
|
|
150
203
|
readonly required: readonly ["schemaVersion", "kind", "seq", "timestamp", "level", "args"];
|
|
@@ -388,8 +441,8 @@ declare const evidenceEventSchema: {
|
|
|
388
441
|
}];
|
|
389
442
|
};
|
|
390
443
|
/**
|
|
391
|
-
* Check a value against the
|
|
392
|
-
*
|
|
444
|
+
* Check a value against the supported event formats. An empty problem
|
|
445
|
+
* list means the value is a valid evidence event.
|
|
393
446
|
*/
|
|
394
447
|
declare function validateEvidenceEvent(value: unknown): string[];
|
|
395
448
|
declare function isEvidenceEvent(value: unknown): value is EvidenceEvent;
|
|
@@ -433,10 +486,13 @@ declare class RingBuffer<T extends {
|
|
|
433
486
|
* events in a bounded buffer. Runs on its own, without a reporter or server.
|
|
434
487
|
*/
|
|
435
488
|
declare class ConsoleCollector {
|
|
489
|
+
#private;
|
|
436
490
|
private readonly events;
|
|
437
491
|
private unsubscribe?;
|
|
438
492
|
constructor(maxSize?: number);
|
|
439
493
|
start(): void;
|
|
494
|
+
/** Record metadata already obtained by caller instrumentation. */
|
|
495
|
+
record(level: ConsoleLevel, argumentCount: number, lineno?: number, colno?: number): void;
|
|
440
496
|
stop(): void;
|
|
441
497
|
/** Captured events, oldest first, optionally limited to a time window. */
|
|
442
498
|
collect(window?: CollectWindow): ConsoleEvidenceEvent[];
|
|
@@ -572,4 +628,4 @@ declare function redactUrl(url: string, sensitiveParams?: string[]): string;
|
|
|
572
628
|
*/
|
|
573
629
|
declare function redactHeaders(headers: Record<string, string>): Record<string, string>;
|
|
574
630
|
|
|
575
|
-
export { BREADCRUMB_LEVELS, BREADCRUMB_TYPES, BreadcrumbCollector, type BreadcrumbEvidenceEvent, type BreadcrumbInput, type BreadcrumbLevel, type BreadcrumbType, CIRCULAR, CONSOLE_LEVELS, type CollectWindow, ConsoleCollector, type ConsoleEvidenceEvent, type ConsoleLevel, ERROR_SOURCES, EVIDENCE_KINDS, EVIDENCE_SCHEMA_VERSION, ErrorCollector, type ErrorEvidenceEvent, type ErrorSource, type EvidenceEvent, type EvidenceEventBase, type EvidenceKind, type IgnorePattern, MAX_DEPTH, MAX_DEPTH_MARKER, MAX_ENTRY_BYTES, MAX_KEYS, NETWORK_TRANSPORTS, NetworkCollector, type NetworkCollectorOptions, type NetworkEvidenceEvent, type NetworkTransport, RingBuffer, type SerializedValue, TRUNCATED, UNREAD_METHOD, UNREAD_URL, UNSERIALIZABLE, WEBSOCKET_DIRECTIONS, WEBSOCKET_EVENT_TYPES, WebSocketCollector, type WebSocketDirection, type WebSocketEventType, type WebSocketEvidenceEvent, evidenceEventSchema, isEvidenceEvent, redactHeaders, redactObject, redactString, redactUrl, safeSerialize, serializeEntry, truncateString, validateEvidenceEvent };
|
|
631
|
+
export { BREADCRUMB_LEVELS, BREADCRUMB_TYPES, BreadcrumbCollector, type BreadcrumbEvidenceEvent, type BreadcrumbInput, type BreadcrumbLevel, type BreadcrumbType, CIRCULAR, CONSOLE_EVIDENCE_SCHEMA_VERSION, CONSOLE_LEVELS, type CollectWindow, ConsoleCollector, type ConsoleEvidenceEvent, type ConsoleLevel, ERROR_SOURCES, EVIDENCE_KINDS, EVIDENCE_SCHEMA_VERSION, ErrorCollector, type ErrorEvidenceEvent, type ErrorSource, type EvidenceEvent, type EvidenceEventBase, type EvidenceKind, type IgnorePattern, type LegacyConsoleEvidenceEvent, MAX_DEPTH, MAX_DEPTH_MARKER, MAX_ENTRY_BYTES, MAX_KEYS, NETWORK_TRANSPORTS, NetworkCollector, type NetworkCollectorOptions, type NetworkEvidenceEvent, type NetworkTransport, RingBuffer, type SerializedValue, TRUNCATED, UNREAD_METHOD, UNREAD_URL, UNSERIALIZABLE, WEBSOCKET_DIRECTIONS, WEBSOCKET_EVENT_TYPES, WebSocketCollector, type WebSocketDirection, type WebSocketEventType, type WebSocketEvidenceEvent, evidenceEventSchema, isEvidenceEvent, redactHeaders, redactObject, redactString, redactUrl, safeSerialize, serializeEntry, truncateString, validateEvidenceEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -32,8 +32,7 @@ declare const UNSERIALIZABLE = "[Unserializable]";
|
|
|
32
32
|
/**
|
|
33
33
|
* Serialize one entry under the closed set and the per-entry caps.
|
|
34
34
|
*
|
|
35
|
-
* `rootDepth` is the container level the value itself occupies
|
|
36
|
-
* pass 0 for an argument list so that each argument keeps all five levels.
|
|
35
|
+
* `rootDepth` is the container level the value itself occupies.
|
|
37
36
|
*/
|
|
38
37
|
declare function serializeEntry(value: unknown, rootDepth?: number): SerializedValue;
|
|
39
38
|
/** Serialize a value under the closed set. Alias of {@link serializeEntry}. */
|
|
@@ -42,15 +41,17 @@ declare function safeSerialize(value: unknown): SerializedValue;
|
|
|
42
41
|
declare function truncateString(value: string, maxLength: number): string;
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
|
-
*
|
|
44
|
+
* Versioned evidence events.
|
|
46
45
|
*
|
|
47
46
|
* Every collector records its observations as one of these events. The
|
|
48
|
-
*
|
|
47
|
+
* formats are closed: an event has exactly the fields below, and a consumer
|
|
49
48
|
* can check one with {@link validateEvidenceEvent} or with any JSON Schema
|
|
50
49
|
* validator and {@link evidenceEventSchema}.
|
|
51
50
|
*/
|
|
52
51
|
|
|
53
52
|
declare const EVIDENCE_SCHEMA_VERSION: 1;
|
|
53
|
+
declare const CONSOLE_EVIDENCE_SCHEMA_VERSION: 2;
|
|
54
|
+
type EvidenceSchemaVersion = typeof EVIDENCE_SCHEMA_VERSION | typeof CONSOLE_EVIDENCE_SCHEMA_VERSION;
|
|
54
55
|
declare const EVIDENCE_KINDS: readonly ["console", "network", "breadcrumb", "error", "websocket"];
|
|
55
56
|
type EvidenceKind = (typeof EVIDENCE_KINDS)[number];
|
|
56
57
|
declare const CONSOLE_LEVELS: readonly ["log", "info", "warn", "error", "debug"];
|
|
@@ -67,20 +68,29 @@ declare const WEBSOCKET_EVENT_TYPES: readonly ["open", "message", "close", "erro
|
|
|
67
68
|
type WebSocketEventType = (typeof WEBSOCKET_EVENT_TYPES)[number];
|
|
68
69
|
declare const WEBSOCKET_DIRECTIONS: readonly ["sent", "received"];
|
|
69
70
|
type WebSocketDirection = (typeof WEBSOCKET_DIRECTIONS)[number];
|
|
70
|
-
interface EvidenceEventBase {
|
|
71
|
-
schemaVersion:
|
|
71
|
+
interface EvidenceEventBase<Version extends EvidenceSchemaVersion = EvidenceSchemaVersion> {
|
|
72
|
+
schemaVersion: Version;
|
|
72
73
|
kind: EvidenceKind;
|
|
73
74
|
/** Capture order within one loaded copy of catchfn, starting at 0. */
|
|
74
75
|
seq: number;
|
|
75
76
|
/** Capture time in milliseconds since the Unix epoch (`Date.now()`). */
|
|
76
77
|
timestamp: number;
|
|
77
78
|
}
|
|
78
|
-
interface ConsoleEvidenceEvent extends EvidenceEventBase {
|
|
79
|
+
interface ConsoleEvidenceEvent extends EvidenceEventBase<typeof CONSOLE_EVIDENCE_SCHEMA_VERSION> {
|
|
80
|
+
kind: "console";
|
|
81
|
+
level: ConsoleLevel;
|
|
82
|
+
argumentCount: number;
|
|
83
|
+
source: "console";
|
|
84
|
+
lineno?: number;
|
|
85
|
+
colno?: number;
|
|
86
|
+
}
|
|
87
|
+
/** Console evidence saved before catchfn 0.2.0. Current collectors emit metadata. */
|
|
88
|
+
interface LegacyConsoleEvidenceEvent extends EvidenceEventBase<typeof EVIDENCE_SCHEMA_VERSION> {
|
|
79
89
|
kind: "console";
|
|
80
90
|
level: ConsoleLevel;
|
|
81
91
|
args: SerializedValue[];
|
|
82
92
|
}
|
|
83
|
-
interface NetworkEvidenceEvent extends EvidenceEventBase {
|
|
93
|
+
interface NetworkEvidenceEvent extends EvidenceEventBase<typeof EVIDENCE_SCHEMA_VERSION> {
|
|
84
94
|
kind: "network";
|
|
85
95
|
transport: NetworkTransport;
|
|
86
96
|
method: string;
|
|
@@ -96,7 +106,7 @@ interface NetworkEvidenceEvent extends EvidenceEventBase {
|
|
|
96
106
|
/** Redacted with `redactHeaders`. */
|
|
97
107
|
responseHeaders?: Record<string, string>;
|
|
98
108
|
}
|
|
99
|
-
interface BreadcrumbEvidenceEvent extends EvidenceEventBase {
|
|
109
|
+
interface BreadcrumbEvidenceEvent extends EvidenceEventBase<typeof EVIDENCE_SCHEMA_VERSION> {
|
|
100
110
|
kind: "breadcrumb";
|
|
101
111
|
type: BreadcrumbType;
|
|
102
112
|
message?: string;
|
|
@@ -106,7 +116,7 @@ interface BreadcrumbEvidenceEvent extends EvidenceEventBase {
|
|
|
106
116
|
category?: string;
|
|
107
117
|
level?: BreadcrumbLevel;
|
|
108
118
|
}
|
|
109
|
-
interface ErrorEvidenceEvent extends EvidenceEventBase {
|
|
119
|
+
interface ErrorEvidenceEvent extends EvidenceEventBase<typeof EVIDENCE_SCHEMA_VERSION> {
|
|
110
120
|
kind: "error";
|
|
111
121
|
/** The window event that reported it: an uncaught error or an unhandled rejection. */
|
|
112
122
|
source: ErrorSource;
|
|
@@ -125,7 +135,7 @@ interface ErrorEvidenceEvent extends EvidenceEventBase {
|
|
|
125
135
|
*/
|
|
126
136
|
value?: SerializedValue;
|
|
127
137
|
}
|
|
128
|
-
interface WebSocketEvidenceEvent extends EvidenceEventBase {
|
|
138
|
+
interface WebSocketEvidenceEvent extends EvidenceEventBase<typeof EVIDENCE_SCHEMA_VERSION> {
|
|
129
139
|
kind: "websocket";
|
|
130
140
|
type: WebSocketEventType;
|
|
131
141
|
/** Redacted with `redactUrl`; never the application's raw URL. */
|
|
@@ -138,13 +148,56 @@ interface WebSocketEvidenceEvent extends EvidenceEventBase {
|
|
|
138
148
|
code?: number;
|
|
139
149
|
wasClean?: boolean;
|
|
140
150
|
}
|
|
141
|
-
type EvidenceEvent = ConsoleEvidenceEvent | NetworkEvidenceEvent | BreadcrumbEvidenceEvent | ErrorEvidenceEvent | WebSocketEvidenceEvent;
|
|
142
|
-
/** JSON Schema (draft 2020-12) for one
|
|
151
|
+
type EvidenceEvent = ConsoleEvidenceEvent | LegacyConsoleEvidenceEvent | NetworkEvidenceEvent | BreadcrumbEvidenceEvent | ErrorEvidenceEvent | WebSocketEvidenceEvent;
|
|
152
|
+
/** JSON Schema (draft 2020-12) for one supported evidence event. */
|
|
143
153
|
declare const evidenceEventSchema: {
|
|
144
154
|
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
145
|
-
readonly $id: "urn:catchfn:evidence-event:
|
|
146
|
-
readonly title: "catchfn evidence event
|
|
155
|
+
readonly $id: "urn:catchfn:evidence-event:v2";
|
|
156
|
+
readonly title: "catchfn evidence event";
|
|
147
157
|
readonly oneOf: readonly [{
|
|
158
|
+
readonly type: "object";
|
|
159
|
+
readonly additionalProperties: false;
|
|
160
|
+
readonly required: readonly ["schemaVersion", "kind", "seq", "timestamp", "level", "argumentCount", "source"];
|
|
161
|
+
readonly properties: {
|
|
162
|
+
readonly schemaVersion: {
|
|
163
|
+
readonly const: 2;
|
|
164
|
+
};
|
|
165
|
+
readonly kind: {
|
|
166
|
+
readonly const: "console";
|
|
167
|
+
};
|
|
168
|
+
readonly level: {
|
|
169
|
+
readonly enum: readonly ["log", "info", "warn", "error", "debug"];
|
|
170
|
+
};
|
|
171
|
+
readonly argumentCount: {
|
|
172
|
+
readonly type: "integer";
|
|
173
|
+
readonly minimum: 0;
|
|
174
|
+
readonly maximum: number;
|
|
175
|
+
};
|
|
176
|
+
readonly source: {
|
|
177
|
+
readonly const: "console";
|
|
178
|
+
};
|
|
179
|
+
readonly lineno: {
|
|
180
|
+
readonly type: "integer";
|
|
181
|
+
readonly minimum: 0;
|
|
182
|
+
readonly maximum: number;
|
|
183
|
+
};
|
|
184
|
+
readonly colno: {
|
|
185
|
+
readonly type: "integer";
|
|
186
|
+
readonly minimum: 0;
|
|
187
|
+
readonly maximum: number;
|
|
188
|
+
};
|
|
189
|
+
readonly seq: {
|
|
190
|
+
readonly type: "integer";
|
|
191
|
+
readonly minimum: 0;
|
|
192
|
+
readonly maximum: number;
|
|
193
|
+
};
|
|
194
|
+
readonly timestamp: {
|
|
195
|
+
readonly type: "integer";
|
|
196
|
+
readonly minimum: 0;
|
|
197
|
+
readonly maximum: number;
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
}, {
|
|
148
201
|
readonly type: "object";
|
|
149
202
|
readonly additionalProperties: false;
|
|
150
203
|
readonly required: readonly ["schemaVersion", "kind", "seq", "timestamp", "level", "args"];
|
|
@@ -388,8 +441,8 @@ declare const evidenceEventSchema: {
|
|
|
388
441
|
}];
|
|
389
442
|
};
|
|
390
443
|
/**
|
|
391
|
-
* Check a value against the
|
|
392
|
-
*
|
|
444
|
+
* Check a value against the supported event formats. An empty problem
|
|
445
|
+
* list means the value is a valid evidence event.
|
|
393
446
|
*/
|
|
394
447
|
declare function validateEvidenceEvent(value: unknown): string[];
|
|
395
448
|
declare function isEvidenceEvent(value: unknown): value is EvidenceEvent;
|
|
@@ -433,10 +486,13 @@ declare class RingBuffer<T extends {
|
|
|
433
486
|
* events in a bounded buffer. Runs on its own, without a reporter or server.
|
|
434
487
|
*/
|
|
435
488
|
declare class ConsoleCollector {
|
|
489
|
+
#private;
|
|
436
490
|
private readonly events;
|
|
437
491
|
private unsubscribe?;
|
|
438
492
|
constructor(maxSize?: number);
|
|
439
493
|
start(): void;
|
|
494
|
+
/** Record metadata already obtained by caller instrumentation. */
|
|
495
|
+
record(level: ConsoleLevel, argumentCount: number, lineno?: number, colno?: number): void;
|
|
440
496
|
stop(): void;
|
|
441
497
|
/** Captured events, oldest first, optionally limited to a time window. */
|
|
442
498
|
collect(window?: CollectWindow): ConsoleEvidenceEvent[];
|
|
@@ -572,4 +628,4 @@ declare function redactUrl(url: string, sensitiveParams?: string[]): string;
|
|
|
572
628
|
*/
|
|
573
629
|
declare function redactHeaders(headers: Record<string, string>): Record<string, string>;
|
|
574
630
|
|
|
575
|
-
export { BREADCRUMB_LEVELS, BREADCRUMB_TYPES, BreadcrumbCollector, type BreadcrumbEvidenceEvent, type BreadcrumbInput, type BreadcrumbLevel, type BreadcrumbType, CIRCULAR, CONSOLE_LEVELS, type CollectWindow, ConsoleCollector, type ConsoleEvidenceEvent, type ConsoleLevel, ERROR_SOURCES, EVIDENCE_KINDS, EVIDENCE_SCHEMA_VERSION, ErrorCollector, type ErrorEvidenceEvent, type ErrorSource, type EvidenceEvent, type EvidenceEventBase, type EvidenceKind, type IgnorePattern, MAX_DEPTH, MAX_DEPTH_MARKER, MAX_ENTRY_BYTES, MAX_KEYS, NETWORK_TRANSPORTS, NetworkCollector, type NetworkCollectorOptions, type NetworkEvidenceEvent, type NetworkTransport, RingBuffer, type SerializedValue, TRUNCATED, UNREAD_METHOD, UNREAD_URL, UNSERIALIZABLE, WEBSOCKET_DIRECTIONS, WEBSOCKET_EVENT_TYPES, WebSocketCollector, type WebSocketDirection, type WebSocketEventType, type WebSocketEvidenceEvent, evidenceEventSchema, isEvidenceEvent, redactHeaders, redactObject, redactString, redactUrl, safeSerialize, serializeEntry, truncateString, validateEvidenceEvent };
|
|
631
|
+
export { BREADCRUMB_LEVELS, BREADCRUMB_TYPES, BreadcrumbCollector, type BreadcrumbEvidenceEvent, type BreadcrumbInput, type BreadcrumbLevel, type BreadcrumbType, CIRCULAR, CONSOLE_EVIDENCE_SCHEMA_VERSION, CONSOLE_LEVELS, type CollectWindow, ConsoleCollector, type ConsoleEvidenceEvent, type ConsoleLevel, ERROR_SOURCES, EVIDENCE_KINDS, EVIDENCE_SCHEMA_VERSION, ErrorCollector, type ErrorEvidenceEvent, type ErrorSource, type EvidenceEvent, type EvidenceEventBase, type EvidenceKind, type IgnorePattern, type LegacyConsoleEvidenceEvent, MAX_DEPTH, MAX_DEPTH_MARKER, MAX_ENTRY_BYTES, MAX_KEYS, NETWORK_TRANSPORTS, NetworkCollector, type NetworkCollectorOptions, type NetworkEvidenceEvent, type NetworkTransport, RingBuffer, type SerializedValue, TRUNCATED, UNREAD_METHOD, UNREAD_URL, UNSERIALIZABLE, WEBSOCKET_DIRECTIONS, WEBSOCKET_EVENT_TYPES, WebSocketCollector, type WebSocketDirection, type WebSocketEventType, type WebSocketEvidenceEvent, evidenceEventSchema, isEvidenceEvent, redactHeaders, redactObject, redactString, redactUrl, safeSerialize, serializeEntry, truncateString, validateEvidenceEvent };
|