autotel 7.8.0 → 7.10.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 +14 -0
- package/dist/analysis.cjs +1 -1
- package/dist/analysis.d.cts +6 -7
- package/dist/analysis.d.ts +6 -7
- package/dist/analysis.js +1 -1
- package/dist/attributes.d.cts +1 -1
- package/dist/attributes.d.ts +1 -1
- package/dist/auto.cjs +1 -1
- package/dist/auto.js +1 -1
- package/dist/business-baggage.d.cts +12 -13
- package/dist/business-baggage.d.ts +12 -13
- package/dist/{canonical-log-line-processor-Bwrt_L4c.d.ts → canonical-log-line-processor-DDGzm-wi.d.ts} +1 -1
- package/dist/{canonical-log-line-processor-C0Z_N4oL.d.cts → canonical-log-line-processor-DLeAQjgb.d.cts} +1 -1
- package/dist/channel-BobQKsZd.js +64 -0
- package/dist/channel-D0eaVqn3.cjs +81 -0
- package/dist/config.d.cts +7 -7
- package/dist/config.d.ts +7 -7
- package/dist/correlation-id.cjs +1 -1
- package/dist/correlation-id.d.cts +9 -10
- package/dist/correlation-id.d.ts +9 -10
- package/dist/correlation-id.js +1 -1
- package/dist/db.d.cts +18 -19
- package/dist/db.d.ts +18 -19
- package/dist/decorators.cjs +1 -1
- package/dist/decorators.d.cts +7 -7
- package/dist/decorators.d.ts +7 -7
- package/dist/decorators.js +1 -1
- package/dist/diagnostics.cjs +10 -70
- package/dist/diagnostics.d.cts +6 -6
- package/dist/diagnostics.d.ts +6 -6
- package/dist/diagnostics.js +1 -61
- package/dist/drain-pipeline.d.cts +4 -5
- package/dist/drain-pipeline.d.ts +4 -5
- package/dist/enrichers.d.cts +7 -8
- package/dist/enrichers.d.ts +7 -8
- package/dist/event.cjs +1 -1
- package/dist/event.d.cts +6 -6
- package/dist/event.d.ts +6 -6
- package/dist/event.js +1 -1
- package/dist/evidence.d.cts +13 -14
- package/dist/evidence.d.ts +13 -14
- package/dist/exception-fingerprint.d.cts +10 -11
- package/dist/exception-fingerprint.d.ts +10 -11
- package/dist/exporters.d.cts +2 -2
- package/dist/exporters.d.ts +2 -2
- package/dist/feature-flags.d.cts +23 -24
- package/dist/feature-flags.d.ts +23 -24
- package/dist/{filtering-span-processor-vkewzbqB.d.ts → filtering-span-processor-BDGe1myy.d.ts} +1 -1
- package/dist/{filtering-span-processor-BpDagWNa.d.cts → filtering-span-processor-BYvLMiNz.d.cts} +1 -1
- package/dist/filtering-span-processor.cjs +3 -3
- package/dist/filtering-span-processor.d.cts +1 -1
- package/dist/filtering-span-processor.d.ts +1 -1
- package/dist/filtering-span-processor.js +3 -3
- package/dist/{functional-SeRUabkE.d.ts → functional-CbcInXMJ.d.ts} +1 -1
- package/dist/{functional-u5Qwjray.cjs → functional-CjZT7Jur.cjs} +19 -21
- package/dist/{functional-CC2BFGAO.js → functional-DHn-xGtR.js} +21 -23
- package/dist/{functional-DPZTpGh6.d.cts → functional-j8Joyrwd.d.cts} +1 -1
- package/dist/functional.cjs +1 -1
- package/dist/functional.d.cts +1 -1
- package/dist/functional.d.ts +1 -1
- package/dist/functional.js +1 -1
- package/dist/http.cjs +1 -1
- package/dist/http.d.cts +6 -7
- package/dist/http.d.ts +6 -7
- package/dist/http.js +1 -1
- package/dist/{index-B9aRLp6c.d.ts → index-DAH41w0W.d.ts} +4 -4
- package/dist/{index-8bFU4kmd.d.cts → index-DVPsz3DK.d.cts} +4 -4
- package/dist/index.cjs +3 -2
- package/dist/index.d.cts +38 -38
- package/dist/index.d.ts +38 -38
- package/dist/index.js +4 -4
- package/dist/{init-COfMwKbc.d.cts → init-BtYaU5n9.d.cts} +18 -4
- package/dist/{init-CnoRlJqS.d.ts → init-DUIFqRRS.d.ts} +18 -4
- package/dist/{init-8SISAGdE.js → init-rVPOUqng.js} +171 -10
- package/dist/{init-21HWbm7_.cjs → init-zb68UvOW.cjs} +180 -6
- package/dist/instrumentation.cjs +1 -1
- package/dist/instrumentation.d.cts +4 -5
- package/dist/instrumentation.d.ts +4 -5
- package/dist/instrumentation.js +1 -1
- package/dist/{logger-S1Fgl0g3.d.cts → logger-C9UT1aZ_.d.cts} +4 -4
- package/dist/{logger-S1Fgl0g3.d.ts → logger-C9UT1aZ_.d.ts} +4 -4
- package/dist/logger.d.cts +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/messaging-adapters.d.cts +10 -11
- package/dist/messaging-adapters.d.ts +10 -11
- package/dist/messaging-testing.d.cts +19 -20
- package/dist/messaging-testing.d.ts +19 -20
- package/dist/messaging.cjs +2 -2
- package/dist/messaging.d.cts +23 -24
- package/dist/messaging.d.ts +23 -24
- package/dist/messaging.js +2 -2
- package/dist/metric-helpers.d.cts +6 -7
- package/dist/metric-helpers.d.ts +6 -7
- package/dist/metric.d.cts +7 -7
- package/dist/metric.d.ts +7 -7
- package/dist/parse-error.d.cts +3 -4
- package/dist/parse-error.d.ts +3 -4
- package/dist/policy.cjs +0 -0
- package/dist/policy.js +0 -0
- package/dist/processors.d.cts +1 -1
- package/dist/processors.d.ts +1 -1
- package/dist/{sampling-CZi7OM9u.d.ts → sampling-B_8orhSB.d.ts} +1 -1
- package/dist/{sampling-DENUjT_8.d.cts → sampling-Dud4XU2m.d.cts} +1 -1
- package/dist/sampling.cjs +1 -1
- package/dist/sampling.d.cts +1 -1
- package/dist/sampling.d.ts +1 -1
- package/dist/sampling.js +1 -1
- package/dist/security-schema.d.cts +30 -31
- package/dist/security-schema.d.ts +30 -31
- package/dist/semantic-conventions-yG0X2AsN.d.cts +31 -0
- package/dist/semantic-conventions-yG0X2AsN.d.ts +31 -0
- package/dist/semantic-conventions.d.cts +1 -1
- package/dist/semantic-conventions.d.ts +1 -1
- package/dist/semantic-helpers.cjs +1 -1
- package/dist/semantic-helpers.d.cts +10 -11
- package/dist/semantic-helpers.d.ts +10 -11
- package/dist/semantic-helpers.js +1 -1
- package/dist/slo.d.cts +12 -13
- package/dist/slo.d.ts +12 -13
- package/dist/tail-sampling-processor.cjs +1 -1
- package/dist/tail-sampling-processor.d.cts +2 -3
- package/dist/tail-sampling-processor.d.ts +2 -3
- package/dist/tail-sampling-processor.js +1 -1
- package/dist/test-span-collector.d.cts +4 -5
- package/dist/test-span-collector.d.ts +4 -5
- package/dist/testing.d.cts +18 -18
- package/dist/testing.d.ts +18 -18
- package/dist/trace-helpers.d.cts +15 -16
- package/dist/trace-helpers.d.ts +15 -16
- package/dist/tracer-provider.cjs +21 -1
- package/dist/tracer-provider.d.cts +16 -6
- package/dist/tracer-provider.d.ts +16 -6
- package/dist/tracer-provider.js +22 -3
- package/dist/validate.cjs +8 -7
- package/dist/validate.d.cts +12 -12
- package/dist/validate.d.ts +12 -12
- package/dist/validate.js +8 -7
- package/dist/validation-attributes.d.cts +14 -15
- package/dist/validation-attributes.d.ts +14 -15
- package/dist/webhook.cjs +1 -1
- package/dist/webhook.d.cts +11 -12
- package/dist/webhook.d.ts +11 -12
- package/dist/webhook.js +1 -1
- package/dist/workflow-distributed.cjs +1 -1
- package/dist/workflow-distributed.d.cts +26 -27
- package/dist/workflow-distributed.d.ts +26 -27
- package/dist/workflow-distributed.js +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.d.cts +11 -12
- package/dist/workflow.d.ts +11 -12
- package/dist/workflow.js +1 -1
- package/dist/yaml-config.cjs +1 -1
- package/dist/yaml-config.d.cts +9 -10
- package/dist/yaml-config.d.ts +9 -10
- package/dist/yaml-config.js +1 -1
- package/package.json +15 -21
- package/dist/semantic-conventions-FhSxv-bK.d.cts +0 -31
- package/dist/semantic-conventions-FhSxv-bK.d.ts +0 -31
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as UnknownRecord } from "./values-CeMH-mYG.js";
|
|
2
|
-
import { s as Logger } from "./logger-
|
|
2
|
+
import { s as Logger } from "./logger-C9UT1aZ_.js";
|
|
3
3
|
import { a as EventsValue, c as createEventCollector, i as EventsOutcome, n as EventData, o as assertEventTracked, r as EventsFunnelStep, s as assertOutcomeTracked, t as EventCollector } from "./event-testing-CkPgV3Ii.js";
|
|
4
4
|
import { SerializedSpan, TestSpanCollector, serializeSpan } from "./test-span-collector.js";
|
|
5
5
|
import { Attributes, Link, SpanKind, SpanStatus, SpanStatusCode } from "@opentelemetry/api";
|
|
@@ -26,7 +26,7 @@ interface MemoryExporter extends SpanExporter {
|
|
|
26
26
|
/** Discard what has been collected. */
|
|
27
27
|
reset(): void;
|
|
28
28
|
}
|
|
29
|
-
declare function createMemoryExporter(): MemoryExporter;
|
|
29
|
+
export declare function createMemoryExporter(): MemoryExporter;
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/testing.d.ts
|
|
32
32
|
/**
|
|
@@ -63,7 +63,7 @@ declare function createMemoryExporter(): MemoryExporter;
|
|
|
63
63
|
/**
|
|
64
64
|
* Simplified span representation for testing
|
|
65
65
|
*/
|
|
66
|
-
interface TestSpan {
|
|
66
|
+
export interface TestSpan {
|
|
67
67
|
traceId: string;
|
|
68
68
|
spanId: string;
|
|
69
69
|
parentSpanId?: string;
|
|
@@ -80,7 +80,7 @@ interface TestSpan {
|
|
|
80
80
|
endTime: number;
|
|
81
81
|
duration: number;
|
|
82
82
|
}
|
|
83
|
-
interface SpanMatch {
|
|
83
|
+
export interface SpanMatch {
|
|
84
84
|
name?: string;
|
|
85
85
|
traceId?: string;
|
|
86
86
|
spanId?: string;
|
|
@@ -91,7 +91,7 @@ interface SpanMatch {
|
|
|
91
91
|
/**
|
|
92
92
|
* In-memory trace collector for testing
|
|
93
93
|
*/
|
|
94
|
-
interface TraceCollector {
|
|
94
|
+
export interface TraceCollector {
|
|
95
95
|
/** Get all collected spans */
|
|
96
96
|
getSpans(): TestSpan[];
|
|
97
97
|
/** Get spans matching a name */
|
|
@@ -137,7 +137,7 @@ interface TraceCollector {
|
|
|
137
137
|
* })
|
|
138
138
|
* ```
|
|
139
139
|
*/
|
|
140
|
-
declare function createTraceCollector(): TraceCollector;
|
|
140
|
+
export declare function createTraceCollector(): TraceCollector;
|
|
141
141
|
/**
|
|
142
142
|
* Assert that a trace was created for an operation
|
|
143
143
|
*
|
|
@@ -157,7 +157,7 @@ declare function createTraceCollector(): TraceCollector;
|
|
|
157
157
|
* })
|
|
158
158
|
* ```
|
|
159
159
|
*/
|
|
160
|
-
declare function assertTraceCreated(collector: TraceCollector, operationName: string, options?: {
|
|
160
|
+
export declare function assertTraceCreated(collector: TraceCollector, operationName: string, options?: {
|
|
161
161
|
minCount?: number;
|
|
162
162
|
maxCount?: number;
|
|
163
163
|
status?: SpanStatusCode;
|
|
@@ -180,7 +180,7 @@ declare function assertTraceCreated(collector: TraceCollector, operationName: st
|
|
|
180
180
|
* assertNoErrors(collector)
|
|
181
181
|
* ```
|
|
182
182
|
*/
|
|
183
|
-
declare function assertNoErrors(collector: TraceCollector): void;
|
|
183
|
+
export declare function assertNoErrors(collector: TraceCollector): void;
|
|
184
184
|
/**
|
|
185
185
|
* Assert that a trace was created and succeeded
|
|
186
186
|
*
|
|
@@ -192,7 +192,7 @@ declare function assertNoErrors(collector: TraceCollector): void;
|
|
|
192
192
|
* assertTraceSucceeded(collector, 'user.createUser')
|
|
193
193
|
* ```
|
|
194
194
|
*/
|
|
195
|
-
declare function assertTraceSucceeded(collector: TraceCollector, operationName: string): void;
|
|
195
|
+
export declare function assertTraceSucceeded(collector: TraceCollector, operationName: string): void;
|
|
196
196
|
/**
|
|
197
197
|
* Assert that a trace was created and failed
|
|
198
198
|
*
|
|
@@ -205,11 +205,11 @@ declare function assertTraceSucceeded(collector: TraceCollector, operationName:
|
|
|
205
205
|
* assertTraceFailed(collector, 'user.createUser', 'Invalid email')
|
|
206
206
|
* ```
|
|
207
207
|
*/
|
|
208
|
-
declare function assertTraceFailed(collector: TraceCollector, operationName: string, errorMessage?: string): void;
|
|
208
|
+
export declare function assertTraceFailed(collector: TraceCollector, operationName: string, errorMessage?: string): void;
|
|
209
209
|
/**
|
|
210
210
|
* In-memory log collector for testing
|
|
211
211
|
*/
|
|
212
|
-
interface LogCollector {
|
|
212
|
+
export interface LogCollector {
|
|
213
213
|
/** Get all collected logs */
|
|
214
214
|
getLogs(): LogEntry[];
|
|
215
215
|
/** Get logs by level */
|
|
@@ -222,7 +222,7 @@ interface LogCollector {
|
|
|
222
222
|
/**
|
|
223
223
|
* Log entry
|
|
224
224
|
*/
|
|
225
|
-
interface LogEntry {
|
|
225
|
+
export interface LogEntry {
|
|
226
226
|
level: 'info' | 'warn' | 'error' | 'debug';
|
|
227
227
|
message: string;
|
|
228
228
|
extra?: UnknownRecord;
|
|
@@ -245,7 +245,7 @@ interface LogEntry {
|
|
|
245
245
|
* expect(logs[0].message).toBe('Operation started')
|
|
246
246
|
* ```
|
|
247
247
|
*/
|
|
248
|
-
declare function createMockLogger(): Logger & LogCollector;
|
|
248
|
+
export declare function createMockLogger(): Logger & LogCollector;
|
|
249
249
|
/**
|
|
250
250
|
* Assert that no error logs were created
|
|
251
251
|
*
|
|
@@ -257,7 +257,7 @@ declare function createMockLogger(): Logger & LogCollector;
|
|
|
257
257
|
* assertNoErrorsLogged(logger)
|
|
258
258
|
* ```
|
|
259
259
|
*/
|
|
260
|
-
declare function assertNoErrorsLogged(logger: LogCollector): void;
|
|
260
|
+
export declare function assertNoErrorsLogged(logger: LogCollector): void;
|
|
261
261
|
/**
|
|
262
262
|
* Wait for a specific trace to be created
|
|
263
263
|
*
|
|
@@ -281,7 +281,7 @@ declare function assertNoErrorsLogged(logger: LogCollector): void;
|
|
|
281
281
|
* assertTraceSucceeded(collector, 'service.doAsyncWork')
|
|
282
282
|
* ```
|
|
283
283
|
*/
|
|
284
|
-
declare function waitForTrace(collector: TraceCollector, operationName: string, timeoutMs?: number): Promise<void>;
|
|
284
|
+
export declare function waitForTrace(collector: TraceCollector, operationName: string, timeoutMs?: number): Promise<void>;
|
|
285
285
|
/**
|
|
286
286
|
* Get trace duration in milliseconds
|
|
287
287
|
*
|
|
@@ -295,7 +295,7 @@ declare function waitForTrace(collector: TraceCollector, operationName: string,
|
|
|
295
295
|
* expect(duration).toBeLessThan(1000) // Should be < 1s
|
|
296
296
|
* ```
|
|
297
297
|
*/
|
|
298
|
-
declare function getTraceDuration(collector: TraceCollector, operationName: string): number | undefined;
|
|
298
|
+
export declare function getTraceDuration(collector: TraceCollector, operationName: string): number | undefined;
|
|
299
299
|
/**
|
|
300
300
|
* Assert that an operation completed within a time threshold
|
|
301
301
|
*
|
|
@@ -313,6 +313,6 @@ declare function getTraceDuration(collector: TraceCollector, operationName: stri
|
|
|
313
313
|
* assertTraceDuration(collector, 'user.createUser', 500) // Must be < 500ms
|
|
314
314
|
* ```
|
|
315
315
|
*/
|
|
316
|
-
declare function assertTraceDuration(collector: TraceCollector, operationName: string, maxDurationMs: number): void;
|
|
316
|
+
export declare function assertTraceDuration(collector: TraceCollector, operationName: string, maxDurationMs: number): void;
|
|
317
317
|
//#endregion
|
|
318
|
-
export { type EventCollector, type EventData, type EventsFunnelStep, type EventsOutcome, type EventsValue,
|
|
318
|
+
export { type EventCollector, type EventData, type EventsFunnelStep, type EventsOutcome, type EventsValue, type MemoryExporter, type RecordedSpan, type SerializedSpan, TestSpanCollector, assertEventTracked, assertOutcomeTracked, createEventCollector, serializeSpan };
|
package/dist/trace-helpers.d.cts
CHANGED
|
@@ -5,11 +5,11 @@ import { Context, Span, Tracer } from "@opentelemetry/api";
|
|
|
5
5
|
* Store span name for a given span
|
|
6
6
|
* Called internally when spans are created
|
|
7
7
|
*/
|
|
8
|
-
declare function setSpanName(span: Span, name: string): void;
|
|
8
|
+
export declare function setSpanName(span: Span, name: string): void;
|
|
9
9
|
/**
|
|
10
10
|
* Trace context extracted from active span
|
|
11
11
|
*/
|
|
12
|
-
interface TraceContext {
|
|
12
|
+
export interface TraceContext {
|
|
13
13
|
/** Full 32-character hex trace ID */
|
|
14
14
|
traceId: string;
|
|
15
15
|
/** 16-character hex span ID */
|
|
@@ -46,7 +46,7 @@ interface TraceContext {
|
|
|
46
46
|
* }
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
-
declare function getTraceContext(): TraceContext | null;
|
|
49
|
+
export declare function getTraceContext(): TraceContext | null;
|
|
50
50
|
/**
|
|
51
51
|
* Enrich object with trace context (traceId, spanId, correlationId, and Datadog fields)
|
|
52
52
|
*
|
|
@@ -79,7 +79,7 @@ declare function getTraceContext(): TraceContext | null;
|
|
|
79
79
|
* // { userId: '123' } - no trace fields added
|
|
80
80
|
* ```
|
|
81
81
|
*/
|
|
82
|
-
declare function enrichWithTraceContext<T extends UnknownRecord>(obj: T): T;
|
|
82
|
+
export declare function enrichWithTraceContext<T extends UnknownRecord>(obj: T): T;
|
|
83
83
|
/**
|
|
84
84
|
* Check if currently in a trace context
|
|
85
85
|
*
|
|
@@ -97,7 +97,7 @@ declare function enrichWithTraceContext<T extends UnknownRecord>(obj: T): T;
|
|
|
97
97
|
* }
|
|
98
98
|
* ```
|
|
99
99
|
*/
|
|
100
|
-
declare function isTracing(): boolean;
|
|
100
|
+
export declare function isTracing(): boolean;
|
|
101
101
|
/**
|
|
102
102
|
* Get a tracer instance for creating custom spans
|
|
103
103
|
*
|
|
@@ -138,7 +138,7 @@ declare function isTracing(): boolean;
|
|
|
138
138
|
* });
|
|
139
139
|
* ```
|
|
140
140
|
*/
|
|
141
|
-
declare function getTracer(name: string, version?: string): Tracer;
|
|
141
|
+
export declare function getTracer(name: string, version?: string): Tracer;
|
|
142
142
|
/**
|
|
143
143
|
* Get the currently active span
|
|
144
144
|
*
|
|
@@ -168,7 +168,7 @@ declare function getTracer(name: string, version?: string): Tracer;
|
|
|
168
168
|
* }
|
|
169
169
|
* ```
|
|
170
170
|
*/
|
|
171
|
-
declare function getActiveSpan(): Span | undefined;
|
|
171
|
+
export declare function getActiveSpan(): Span | undefined;
|
|
172
172
|
/**
|
|
173
173
|
* Get the currently active OpenTelemetry context
|
|
174
174
|
*
|
|
@@ -194,7 +194,7 @@ declare function getActiveSpan(): Span | undefined;
|
|
|
194
194
|
* // Headers now contain trace propagation data
|
|
195
195
|
* ```
|
|
196
196
|
*/
|
|
197
|
-
declare function getActiveContext(): Context;
|
|
197
|
+
export declare function getActiveContext(): Context;
|
|
198
198
|
/**
|
|
199
199
|
* Run a function with a specific span set as active
|
|
200
200
|
*
|
|
@@ -239,7 +239,7 @@ declare function getActiveContext(): Context;
|
|
|
239
239
|
* span.end();
|
|
240
240
|
* ```
|
|
241
241
|
*/
|
|
242
|
-
declare function runWithSpan<T>(span: Span, fn: () => T): T;
|
|
242
|
+
export declare function runWithSpan<T>(span: Span, fn: () => T): T;
|
|
243
243
|
/**
|
|
244
244
|
* Finalize a span with appropriate status and optional error recording
|
|
245
245
|
*
|
|
@@ -304,7 +304,7 @@ declare function runWithSpan<T>(span: Span, fn: () => T): T;
|
|
|
304
304
|
* }
|
|
305
305
|
* ```
|
|
306
306
|
*/
|
|
307
|
-
declare function finalizeSpan(span: Span, cause?: unknown): void;
|
|
307
|
+
export declare function finalizeSpan(span: Span, cause?: unknown): void;
|
|
308
308
|
/**
|
|
309
309
|
* Creates a deterministic trace ID from a seed string.
|
|
310
310
|
*
|
|
@@ -374,7 +374,7 @@ declare function finalizeSpan(span: Span, cause?: unknown): void;
|
|
|
374
374
|
*
|
|
375
375
|
* @public
|
|
376
376
|
*/
|
|
377
|
-
declare function createDeterministicTraceId(seed: string): Promise<string>;
|
|
377
|
+
export declare function createDeterministicTraceId(seed: string): Promise<string>;
|
|
378
378
|
/**
|
|
379
379
|
* Flattens nested metadata objects into dot-notation span attributes.
|
|
380
380
|
*
|
|
@@ -495,11 +495,10 @@ declare function createDeterministicTraceId(seed: string): Promise<string>;
|
|
|
495
495
|
* resolveTraceUrl('https://grafana.example.com/explore?traceId={traceId}', 'abc123')
|
|
496
496
|
* // => 'https://grafana.example.com/explore?traceId=abc123'
|
|
497
497
|
*/
|
|
498
|
-
declare function resolveTraceUrl(template: string | undefined, traceId: string): string | undefined;
|
|
498
|
+
export declare function resolveTraceUrl(template: string | undefined, traceId: string): string | undefined;
|
|
499
499
|
/** Flattened metadata: every leaf rendered as the string an attribute holds. */
|
|
500
|
-
interface FlatMetadata {
|
|
500
|
+
export interface FlatMetadata {
|
|
501
501
|
[key: string]: string;
|
|
502
502
|
}
|
|
503
|
-
declare function flattenMetadata(metadata: UnknownRecord, prefix?: string): FlatMetadata;
|
|
504
|
-
//#endregion
|
|
505
|
-
export { FlatMetadata, TraceContext, createDeterministicTraceId, enrichWithTraceContext, finalizeSpan, flattenMetadata, getActiveContext, getActiveSpan, getTraceContext, getTracer, isTracing, resolveTraceUrl, runWithSpan, setSpanName };
|
|
503
|
+
export declare function flattenMetadata(metadata: UnknownRecord, prefix?: string): FlatMetadata;
|
|
504
|
+
//#endregion
|
package/dist/trace-helpers.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ import { Context, Span, Tracer } from "@opentelemetry/api";
|
|
|
5
5
|
* Store span name for a given span
|
|
6
6
|
* Called internally when spans are created
|
|
7
7
|
*/
|
|
8
|
-
declare function setSpanName(span: Span, name: string): void;
|
|
8
|
+
export declare function setSpanName(span: Span, name: string): void;
|
|
9
9
|
/**
|
|
10
10
|
* Trace context extracted from active span
|
|
11
11
|
*/
|
|
12
|
-
interface TraceContext {
|
|
12
|
+
export interface TraceContext {
|
|
13
13
|
/** Full 32-character hex trace ID */
|
|
14
14
|
traceId: string;
|
|
15
15
|
/** 16-character hex span ID */
|
|
@@ -46,7 +46,7 @@ interface TraceContext {
|
|
|
46
46
|
* }
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
-
declare function getTraceContext(): TraceContext | null;
|
|
49
|
+
export declare function getTraceContext(): TraceContext | null;
|
|
50
50
|
/**
|
|
51
51
|
* Enrich object with trace context (traceId, spanId, correlationId, and Datadog fields)
|
|
52
52
|
*
|
|
@@ -79,7 +79,7 @@ declare function getTraceContext(): TraceContext | null;
|
|
|
79
79
|
* // { userId: '123' } - no trace fields added
|
|
80
80
|
* ```
|
|
81
81
|
*/
|
|
82
|
-
declare function enrichWithTraceContext<T extends UnknownRecord>(obj: T): T;
|
|
82
|
+
export declare function enrichWithTraceContext<T extends UnknownRecord>(obj: T): T;
|
|
83
83
|
/**
|
|
84
84
|
* Check if currently in a trace context
|
|
85
85
|
*
|
|
@@ -97,7 +97,7 @@ declare function enrichWithTraceContext<T extends UnknownRecord>(obj: T): T;
|
|
|
97
97
|
* }
|
|
98
98
|
* ```
|
|
99
99
|
*/
|
|
100
|
-
declare function isTracing(): boolean;
|
|
100
|
+
export declare function isTracing(): boolean;
|
|
101
101
|
/**
|
|
102
102
|
* Get a tracer instance for creating custom spans
|
|
103
103
|
*
|
|
@@ -138,7 +138,7 @@ declare function isTracing(): boolean;
|
|
|
138
138
|
* });
|
|
139
139
|
* ```
|
|
140
140
|
*/
|
|
141
|
-
declare function getTracer(name: string, version?: string): Tracer;
|
|
141
|
+
export declare function getTracer(name: string, version?: string): Tracer;
|
|
142
142
|
/**
|
|
143
143
|
* Get the currently active span
|
|
144
144
|
*
|
|
@@ -168,7 +168,7 @@ declare function getTracer(name: string, version?: string): Tracer;
|
|
|
168
168
|
* }
|
|
169
169
|
* ```
|
|
170
170
|
*/
|
|
171
|
-
declare function getActiveSpan(): Span | undefined;
|
|
171
|
+
export declare function getActiveSpan(): Span | undefined;
|
|
172
172
|
/**
|
|
173
173
|
* Get the currently active OpenTelemetry context
|
|
174
174
|
*
|
|
@@ -194,7 +194,7 @@ declare function getActiveSpan(): Span | undefined;
|
|
|
194
194
|
* // Headers now contain trace propagation data
|
|
195
195
|
* ```
|
|
196
196
|
*/
|
|
197
|
-
declare function getActiveContext(): Context;
|
|
197
|
+
export declare function getActiveContext(): Context;
|
|
198
198
|
/**
|
|
199
199
|
* Run a function with a specific span set as active
|
|
200
200
|
*
|
|
@@ -239,7 +239,7 @@ declare function getActiveContext(): Context;
|
|
|
239
239
|
* span.end();
|
|
240
240
|
* ```
|
|
241
241
|
*/
|
|
242
|
-
declare function runWithSpan<T>(span: Span, fn: () => T): T;
|
|
242
|
+
export declare function runWithSpan<T>(span: Span, fn: () => T): T;
|
|
243
243
|
/**
|
|
244
244
|
* Finalize a span with appropriate status and optional error recording
|
|
245
245
|
*
|
|
@@ -304,7 +304,7 @@ declare function runWithSpan<T>(span: Span, fn: () => T): T;
|
|
|
304
304
|
* }
|
|
305
305
|
* ```
|
|
306
306
|
*/
|
|
307
|
-
declare function finalizeSpan(span: Span, cause?: unknown): void;
|
|
307
|
+
export declare function finalizeSpan(span: Span, cause?: unknown): void;
|
|
308
308
|
/**
|
|
309
309
|
* Creates a deterministic trace ID from a seed string.
|
|
310
310
|
*
|
|
@@ -374,7 +374,7 @@ declare function finalizeSpan(span: Span, cause?: unknown): void;
|
|
|
374
374
|
*
|
|
375
375
|
* @public
|
|
376
376
|
*/
|
|
377
|
-
declare function createDeterministicTraceId(seed: string): Promise<string>;
|
|
377
|
+
export declare function createDeterministicTraceId(seed: string): Promise<string>;
|
|
378
378
|
/**
|
|
379
379
|
* Flattens nested metadata objects into dot-notation span attributes.
|
|
380
380
|
*
|
|
@@ -495,11 +495,10 @@ declare function createDeterministicTraceId(seed: string): Promise<string>;
|
|
|
495
495
|
* resolveTraceUrl('https://grafana.example.com/explore?traceId={traceId}', 'abc123')
|
|
496
496
|
* // => 'https://grafana.example.com/explore?traceId=abc123'
|
|
497
497
|
*/
|
|
498
|
-
declare function resolveTraceUrl(template: string | undefined, traceId: string): string | undefined;
|
|
498
|
+
export declare function resolveTraceUrl(template: string | undefined, traceId: string): string | undefined;
|
|
499
499
|
/** Flattened metadata: every leaf rendered as the string an attribute holds. */
|
|
500
|
-
interface FlatMetadata {
|
|
500
|
+
export interface FlatMetadata {
|
|
501
501
|
[key: string]: string;
|
|
502
502
|
}
|
|
503
|
-
declare function flattenMetadata(metadata: UnknownRecord, prefix?: string): FlatMetadata;
|
|
504
|
-
//#endregion
|
|
505
|
-
export { FlatMetadata, TraceContext, createDeterministicTraceId, enrichWithTraceContext, finalizeSpan, flattenMetadata, getActiveContext, getActiveSpan, getTraceContext, getTracer, isTracing, resolveTraceUrl, runWithSpan, setSpanName };
|
|
503
|
+
export declare function flattenMetadata(metadata: UnknownRecord, prefix?: string): FlatMetadata;
|
|
504
|
+
//#endregion
|
package/dist/tracer-provider.cjs
CHANGED
|
@@ -185,6 +185,25 @@ function getAutotelTracerProvider() {
|
|
|
185
185
|
if (isolatedTracerProvider) return isolatedTracerProvider;
|
|
186
186
|
return _opentelemetry_api.trace.getTracerProvider();
|
|
187
187
|
}
|
|
188
|
+
/** The API's no-op provider: what an empty proxy delegates to. */
|
|
189
|
+
const NOOP_TRACER_PROVIDER = new _opentelemetry_api.ProxyTracerProvider().getDelegate();
|
|
190
|
+
/**
|
|
191
|
+
* True when something could record a span: an isolated provider set via
|
|
192
|
+
* setAutotelTracerProvider(), or a real provider registered globally (by
|
|
193
|
+
* autotel's init() or plain OpenTelemetry).
|
|
194
|
+
*
|
|
195
|
+
* The global provider is always a ProxyTracerProvider; it delegates to the
|
|
196
|
+
* API's no-op singleton until a provider is registered, so compare by identity
|
|
197
|
+
* (minifier-safe, unlike constructor names). A proxy from another copy of
|
|
198
|
+
* @opentelemetry/api only appears once something registered, so it counts.
|
|
199
|
+
*/
|
|
200
|
+
function hasTracerProvider() {
|
|
201
|
+
if (getGlobalState().isolatedTracerProvider) return true;
|
|
202
|
+
const provider = _opentelemetry_api.trace.getTracerProvider();
|
|
203
|
+
const getDelegate = require_values.asFunction(require_values.readProperty(provider, "getDelegate"));
|
|
204
|
+
if (!getDelegate) return true;
|
|
205
|
+
return getDelegate.call(provider) !== NOOP_TRACER_PROVIDER;
|
|
206
|
+
}
|
|
188
207
|
/** The candidate if it can be force-flushed, or undefined. */
|
|
189
208
|
function asForceFlushable(value) {
|
|
190
209
|
return require_values.isFunction(require_values.readProperty(value, "forceFlush")) ? value : void 0;
|
|
@@ -208,7 +227,7 @@ function getForceFlushableProvider(sdk) {
|
|
|
208
227
|
candidates.push(globalProvider);
|
|
209
228
|
const getDelegate = require_values.asFunction(require_values.readProperty(globalProvider, "getDelegate"));
|
|
210
229
|
if (getDelegate) candidates.push(getDelegate.call(globalProvider));
|
|
211
|
-
return candidates.map(asForceFlushable).find((found) => found !== void 0);
|
|
230
|
+
return candidates.map((candidate) => asForceFlushable(candidate)).find((found) => found !== void 0);
|
|
212
231
|
}
|
|
213
232
|
/**
|
|
214
233
|
* Gets the OpenTelemetry tracer instance for Autotel.
|
|
@@ -250,4 +269,5 @@ function getAutotelTracer(name = "autotel", version) {
|
|
|
250
269
|
exports.getAutotelTracer = getAutotelTracer;
|
|
251
270
|
exports.getAutotelTracerProvider = getAutotelTracerProvider;
|
|
252
271
|
exports.getForceFlushableProvider = getForceFlushableProvider;
|
|
272
|
+
exports.hasTracerProvider = hasTracerProvider;
|
|
253
273
|
exports.setAutotelTracerProvider = setAutotelTracerProvider;
|
|
@@ -93,7 +93,7 @@ etryTracerProvider } from 'autotel/tracer-provider'
|
|
|
93
93
|
*
|
|
94
94
|
* @public
|
|
95
95
|
*/
|
|
96
|
-
declare function setAutotelTracerProvider(provider: TracerProvider | null): void;
|
|
96
|
+
export declare function setAutotelTracerProvider(provider: TracerProvider | null): void;
|
|
97
97
|
/**
|
|
98
98
|
* Gets the TracerProvider for Autotel tracing operations.
|
|
99
99
|
*
|
|
@@ -130,7 +130,18 @@ declare function setAutotelTracerProvider(provider: TracerProvider | null): void
|
|
|
130
130
|
*
|
|
131
131
|
* @public
|
|
132
132
|
*/
|
|
133
|
-
declare function getAutotelTracerProvider(): TracerProvider;
|
|
133
|
+
export declare function getAutotelTracerProvider(): TracerProvider;
|
|
134
|
+
/**
|
|
135
|
+
* True when something could record a span: an isolated provider set via
|
|
136
|
+
* setAutotelTracerProvider(), or a real provider registered globally (by
|
|
137
|
+
* autotel's init() or plain OpenTelemetry).
|
|
138
|
+
*
|
|
139
|
+
* The global provider is always a ProxyTracerProvider; it delegates to the
|
|
140
|
+
* API's no-op singleton until a provider is registered, so compare by identity
|
|
141
|
+
* (minifier-safe, unlike constructor names). A proxy from another copy of
|
|
142
|
+
* @opentelemetry/api only appears once something registered, so it counts.
|
|
143
|
+
*/
|
|
144
|
+
export declare function hasTracerProvider(): boolean;
|
|
134
145
|
/** A tracer provider that can be force-flushed (SDK providers implement this). */
|
|
135
146
|
interface ForceFlushable {
|
|
136
147
|
forceFlush(): Promise<void>;
|
|
@@ -148,7 +159,7 @@ interface ForceFlushable {
|
|
|
148
159
|
* @param sdk - Optional NodeSDK handle to try first.
|
|
149
160
|
* @returns Something with `forceFlush()`, or `undefined` if none is registered.
|
|
150
161
|
*/
|
|
151
|
-
declare function getForceFlushableProvider(sdk?: unknown): ForceFlushable | undefined;
|
|
162
|
+
export declare function getForceFlushableProvider(sdk?: unknown): ForceFlushable | undefined;
|
|
152
163
|
/**
|
|
153
164
|
* Gets the OpenTelemetry tracer instance for Autotel.
|
|
154
165
|
*
|
|
@@ -181,6 +192,5 @@ declare function getForceFlushableProvider(sdk?: unknown): ForceFlushable | unde
|
|
|
181
192
|
*
|
|
182
193
|
* @public
|
|
183
194
|
*/
|
|
184
|
-
declare function getAutotelTracer(name?: string, version?: string): import("@opentelemetry/api").Tracer;
|
|
185
|
-
//#endregion
|
|
186
|
-
export { getAutotelTracer, getAutotelTracerProvider, getForceFlushableProvider, setAutotelTracerProvider };
|
|
195
|
+
export declare function getAutotelTracer(name?: string, version?: string): import("@opentelemetry/api").Tracer;
|
|
196
|
+
//#endregion
|
|
@@ -93,7 +93,7 @@ etryTracerProvider } from 'autotel/tracer-provider'
|
|
|
93
93
|
*
|
|
94
94
|
* @public
|
|
95
95
|
*/
|
|
96
|
-
declare function setAutotelTracerProvider(provider: TracerProvider | null): void;
|
|
96
|
+
export declare function setAutotelTracerProvider(provider: TracerProvider | null): void;
|
|
97
97
|
/**
|
|
98
98
|
* Gets the TracerProvider for Autotel tracing operations.
|
|
99
99
|
*
|
|
@@ -130,7 +130,18 @@ declare function setAutotelTracerProvider(provider: TracerProvider | null): void
|
|
|
130
130
|
*
|
|
131
131
|
* @public
|
|
132
132
|
*/
|
|
133
|
-
declare function getAutotelTracerProvider(): TracerProvider;
|
|
133
|
+
export declare function getAutotelTracerProvider(): TracerProvider;
|
|
134
|
+
/**
|
|
135
|
+
* True when something could record a span: an isolated provider set via
|
|
136
|
+
* setAutotelTracerProvider(), or a real provider registered globally (by
|
|
137
|
+
* autotel's init() or plain OpenTelemetry).
|
|
138
|
+
*
|
|
139
|
+
* The global provider is always a ProxyTracerProvider; it delegates to the
|
|
140
|
+
* API's no-op singleton until a provider is registered, so compare by identity
|
|
141
|
+
* (minifier-safe, unlike constructor names). A proxy from another copy of
|
|
142
|
+
* @opentelemetry/api only appears once something registered, so it counts.
|
|
143
|
+
*/
|
|
144
|
+
export declare function hasTracerProvider(): boolean;
|
|
134
145
|
/** A tracer provider that can be force-flushed (SDK providers implement this). */
|
|
135
146
|
interface ForceFlushable {
|
|
136
147
|
forceFlush(): Promise<void>;
|
|
@@ -148,7 +159,7 @@ interface ForceFlushable {
|
|
|
148
159
|
* @param sdk - Optional NodeSDK handle to try first.
|
|
149
160
|
* @returns Something with `forceFlush()`, or `undefined` if none is registered.
|
|
150
161
|
*/
|
|
151
|
-
declare function getForceFlushableProvider(sdk?: unknown): ForceFlushable | undefined;
|
|
162
|
+
export declare function getForceFlushableProvider(sdk?: unknown): ForceFlushable | undefined;
|
|
152
163
|
/**
|
|
153
164
|
* Gets the OpenTelemetry tracer instance for Autotel.
|
|
154
165
|
*
|
|
@@ -181,6 +192,5 @@ declare function getForceFlushableProvider(sdk?: unknown): ForceFlushable | unde
|
|
|
181
192
|
*
|
|
182
193
|
* @public
|
|
183
194
|
*/
|
|
184
|
-
declare function getAutotelTracer(name?: string, version?: string): import("@opentelemetry/api").Tracer;
|
|
185
|
-
//#endregion
|
|
186
|
-
export { getAutotelTracer, getAutotelTracerProvider, getForceFlushableProvider, setAutotelTracerProvider };
|
|
195
|
+
export declare function getAutotelTracer(name?: string, version?: string): import("@opentelemetry/api").Tracer;
|
|
196
|
+
//#endregion
|
package/dist/tracer-provider.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as readProperty, h as isFunction, r as asFunction } from "./values-xBtdXtjA.js";
|
|
2
|
-
import { trace } from "@opentelemetry/api";
|
|
2
|
+
import { ProxyTracerProvider, trace } from "@opentelemetry/api";
|
|
3
3
|
|
|
4
4
|
//#region src/tracer-provider.ts
|
|
5
5
|
/**
|
|
@@ -184,6 +184,25 @@ function getAutotelTracerProvider() {
|
|
|
184
184
|
if (isolatedTracerProvider) return isolatedTracerProvider;
|
|
185
185
|
return trace.getTracerProvider();
|
|
186
186
|
}
|
|
187
|
+
/** The API's no-op provider: what an empty proxy delegates to. */
|
|
188
|
+
const NOOP_TRACER_PROVIDER = new ProxyTracerProvider().getDelegate();
|
|
189
|
+
/**
|
|
190
|
+
* True when something could record a span: an isolated provider set via
|
|
191
|
+
* setAutotelTracerProvider(), or a real provider registered globally (by
|
|
192
|
+
* autotel's init() or plain OpenTelemetry).
|
|
193
|
+
*
|
|
194
|
+
* The global provider is always a ProxyTracerProvider; it delegates to the
|
|
195
|
+
* API's no-op singleton until a provider is registered, so compare by identity
|
|
196
|
+
* (minifier-safe, unlike constructor names). A proxy from another copy of
|
|
197
|
+
* @opentelemetry/api only appears once something registered, so it counts.
|
|
198
|
+
*/
|
|
199
|
+
function hasTracerProvider() {
|
|
200
|
+
if (getGlobalState().isolatedTracerProvider) return true;
|
|
201
|
+
const provider = trace.getTracerProvider();
|
|
202
|
+
const getDelegate = asFunction(readProperty(provider, "getDelegate"));
|
|
203
|
+
if (!getDelegate) return true;
|
|
204
|
+
return getDelegate.call(provider) !== NOOP_TRACER_PROVIDER;
|
|
205
|
+
}
|
|
187
206
|
/** The candidate if it can be force-flushed, or undefined. */
|
|
188
207
|
function asForceFlushable(value) {
|
|
189
208
|
return isFunction(readProperty(value, "forceFlush")) ? value : void 0;
|
|
@@ -207,7 +226,7 @@ function getForceFlushableProvider(sdk) {
|
|
|
207
226
|
candidates.push(globalProvider);
|
|
208
227
|
const getDelegate = asFunction(readProperty(globalProvider, "getDelegate"));
|
|
209
228
|
if (getDelegate) candidates.push(getDelegate.call(globalProvider));
|
|
210
|
-
return candidates.map(asForceFlushable).find((found) => found !== void 0);
|
|
229
|
+
return candidates.map((candidate) => asForceFlushable(candidate)).find((found) => found !== void 0);
|
|
211
230
|
}
|
|
212
231
|
/**
|
|
213
232
|
* Gets the OpenTelemetry tracer instance for Autotel.
|
|
@@ -246,4 +265,4 @@ function getAutotelTracer(name = "autotel", version) {
|
|
|
246
265
|
}
|
|
247
266
|
|
|
248
267
|
//#endregion
|
|
249
|
-
export { getAutotelTracer, getAutotelTracerProvider, getForceFlushableProvider, setAutotelTracerProvider };
|
|
268
|
+
export { getAutotelTracer, getAutotelTracerProvider, getForceFlushableProvider, hasTracerProvider, setAutotelTracerProvider };
|
package/dist/validate.cjs
CHANGED
|
@@ -66,13 +66,14 @@ function recordValidationMismatch(mismatch) {
|
|
|
66
66
|
const codes = [...new Set(mismatch.issues.map((i) => i.code))];
|
|
67
67
|
const span = _opentelemetry_api.trace.getActiveSpan();
|
|
68
68
|
if (span) {
|
|
69
|
-
const attributes = {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
const attributes = {
|
|
70
|
+
[require_validation_attributes.VALIDATION_ATTR.name]: mismatch.name,
|
|
71
|
+
[require_validation_attributes.VALIDATION_ATTR.boundary]: mismatch.boundary,
|
|
72
|
+
[require_validation_attributes.VALIDATION_ATTR.mode]: mismatch.mode,
|
|
73
|
+
[require_validation_attributes.VALIDATION_ATTR.issueCount]: mismatch.issues.length,
|
|
74
|
+
[require_validation_attributes.VALIDATION_ATTR.issuePaths]: truncate(paths),
|
|
75
|
+
[require_validation_attributes.VALIDATION_ATTR.issueCodes]: truncate(codes)
|
|
76
|
+
};
|
|
76
77
|
if (mismatch.hash) attributes[require_validation_attributes.VALIDATION_ATTR.hash] = mismatch.hash;
|
|
77
78
|
if (mismatch.severity) attributes[require_validation_attributes.VALIDATION_ATTR.severity] = mismatch.severity;
|
|
78
79
|
span.setAttributes(attributes);
|
package/dist/validate.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as UnknownRecord } from "./values-CeMH-mYG.cjs";
|
|
2
2
|
import { r as SchemaLike } from "./define-event-BNeuKUPv.cjs";
|
|
3
3
|
//#region src/validate.d.ts
|
|
4
|
-
type ValidationMode = 'observe' | 'reject';
|
|
5
|
-
type ValidationSeverity = 'info' | 'warning' | 'error';
|
|
4
|
+
export type ValidationMode = 'observe' | 'reject';
|
|
5
|
+
export type ValidationSeverity = 'info' | 'warning' | 'error';
|
|
6
6
|
/** A single failing field, stripped of any payload values. */
|
|
7
|
-
interface ValidationIssue {
|
|
7
|
+
export interface ValidationIssue {
|
|
8
8
|
/** Dotted field path, e.g. `items.0.price`. Never a value. */
|
|
9
9
|
path: string;
|
|
10
10
|
/** Issue code (e.g. Zod's `invalid_type`, `too_small`). Never a value. */
|
|
@@ -13,7 +13,7 @@ interface ValidationIssue {
|
|
|
13
13
|
expected?: string;
|
|
14
14
|
}
|
|
15
15
|
/** Everything the recorder needs — already PII-stripped by the caller. */
|
|
16
|
-
interface ValidationMismatch {
|
|
16
|
+
export interface ValidationMismatch {
|
|
17
17
|
/** Contract id, e.g. `POST /orders` or `order.placed`. */
|
|
18
18
|
name: string;
|
|
19
19
|
boundary: string;
|
|
@@ -34,13 +34,13 @@ type MismatchListener = (mismatch: ValidationMismatch) => void;
|
|
|
34
34
|
* register and all fire. Returns an unsubscribe fn that removes only this
|
|
35
35
|
* handler; registering the same function twice is a no-op (Set semantics).
|
|
36
36
|
*/
|
|
37
|
-
declare function onValidationMismatch(handler: MismatchListener): () => void;
|
|
37
|
+
export declare function onValidationMismatch(handler: MismatchListener): () => void;
|
|
38
38
|
/**
|
|
39
39
|
* Record a validation mismatch as telemetry: `validation.*` attributes on the
|
|
40
40
|
* active span (if any) and an increment on `autotel.validation.mismatches`.
|
|
41
41
|
* Fail-open — never throws, so instrumentation can't break the boundary.
|
|
42
42
|
*/
|
|
43
|
-
declare function recordValidationMismatch(mismatch: ValidationMismatch): void;
|
|
43
|
+
export declare function recordValidationMismatch(mismatch: ValidationMismatch): void;
|
|
44
44
|
/**
|
|
45
45
|
* Normalise an arbitrary validation error into PII-safe issues. Reads only
|
|
46
46
|
* `path`, `code`, and (when it is a declared type name) `expected` — and never
|
|
@@ -48,8 +48,8 @@ declare function recordValidationMismatch(mismatch: ValidationMismatch): void;
|
|
|
48
48
|
* (`error.issues`) and a generic `error.errors` fallback; returns `[]` for
|
|
49
49
|
* anything unrecognised.
|
|
50
50
|
*/
|
|
51
|
-
declare function formatValidationIssues(error: unknown): ValidationIssue[];
|
|
52
|
-
interface DefineValidatorOptions<S> {
|
|
51
|
+
export declare function formatValidationIssues(error: unknown): ValidationIssue[];
|
|
52
|
+
export interface DefineValidatorOptions<S> {
|
|
53
53
|
/** Where validation runs. Defaults to `input`. */
|
|
54
54
|
boundary?: string;
|
|
55
55
|
/** `reject` (default): record then throw. `observe`: record then continue. */
|
|
@@ -60,14 +60,14 @@ interface DefineValidatorOptions<S> {
|
|
|
60
60
|
/** Build the error thrown in `reject` mode (defaults to a 400 structured error). */
|
|
61
61
|
onReject?: (issues: ValidationIssue[], name: string) => Error;
|
|
62
62
|
}
|
|
63
|
-
type ValidatorResult<T> = {
|
|
63
|
+
export type ValidatorResult<T> = {
|
|
64
64
|
success: true;
|
|
65
65
|
data: T;
|
|
66
66
|
} | {
|
|
67
67
|
success: false;
|
|
68
68
|
issues: ValidationIssue[];
|
|
69
69
|
};
|
|
70
|
-
interface Validator<T> {
|
|
70
|
+
export interface Validator<T> {
|
|
71
71
|
readonly name: string;
|
|
72
72
|
readonly mode: ValidationMode;
|
|
73
73
|
/** Validate and record on failure; never throws. */
|
|
@@ -99,6 +99,6 @@ interface Validator<T> {
|
|
|
99
99
|
* if (!result.success) metrics.onDrift(result.issues);
|
|
100
100
|
* ```
|
|
101
101
|
*/
|
|
102
|
-
declare function defineValidator<T, S extends SchemaLike<T>>(name: string, schema: S, options?: DefineValidatorOptions<S>): Validator<T>;
|
|
102
|
+
export declare function defineValidator<T, S extends SchemaLike<T>>(name: string, schema: S, options?: DefineValidatorOptions<S>): Validator<T>;
|
|
103
103
|
//#endregion
|
|
104
|
-
export {
|
|
104
|
+
export type { SchemaLike };
|