autotel 7.9.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.
Files changed (158) hide show
  1. package/README.md +14 -0
  2. package/dist/analysis.cjs +1 -1
  3. package/dist/analysis.d.cts +6 -7
  4. package/dist/analysis.d.ts +6 -7
  5. package/dist/analysis.js +1 -1
  6. package/dist/attributes.d.cts +1 -1
  7. package/dist/attributes.d.ts +1 -1
  8. package/dist/auto.cjs +1 -1
  9. package/dist/auto.js +1 -1
  10. package/dist/business-baggage.d.cts +12 -13
  11. package/dist/business-baggage.d.ts +12 -13
  12. package/dist/{canonical-log-line-processor-Bwrt_L4c.d.ts → canonical-log-line-processor-DDGzm-wi.d.ts} +1 -1
  13. package/dist/{canonical-log-line-processor-C0Z_N4oL.d.cts → canonical-log-line-processor-DLeAQjgb.d.cts} +1 -1
  14. package/dist/channel-BobQKsZd.js +64 -0
  15. package/dist/channel-D0eaVqn3.cjs +81 -0
  16. package/dist/config.d.cts +7 -7
  17. package/dist/config.d.ts +7 -7
  18. package/dist/correlation-id.cjs +1 -1
  19. package/dist/correlation-id.d.cts +9 -10
  20. package/dist/correlation-id.d.ts +9 -10
  21. package/dist/correlation-id.js +1 -1
  22. package/dist/db.d.cts +18 -19
  23. package/dist/db.d.ts +18 -19
  24. package/dist/decorators.cjs +1 -1
  25. package/dist/decorators.d.cts +7 -7
  26. package/dist/decorators.d.ts +7 -7
  27. package/dist/decorators.js +1 -1
  28. package/dist/diagnostics.cjs +10 -70
  29. package/dist/diagnostics.d.cts +6 -6
  30. package/dist/diagnostics.d.ts +6 -6
  31. package/dist/diagnostics.js +1 -61
  32. package/dist/drain-pipeline.d.cts +4 -5
  33. package/dist/drain-pipeline.d.ts +4 -5
  34. package/dist/enrichers.d.cts +7 -8
  35. package/dist/enrichers.d.ts +7 -8
  36. package/dist/event.cjs +1 -1
  37. package/dist/event.d.cts +6 -6
  38. package/dist/event.d.ts +6 -6
  39. package/dist/event.js +1 -1
  40. package/dist/evidence.d.cts +13 -14
  41. package/dist/evidence.d.ts +13 -14
  42. package/dist/exception-fingerprint.d.cts +10 -11
  43. package/dist/exception-fingerprint.d.ts +10 -11
  44. package/dist/exporters.d.cts +2 -2
  45. package/dist/exporters.d.ts +2 -2
  46. package/dist/feature-flags.d.cts +23 -24
  47. package/dist/feature-flags.d.ts +23 -24
  48. package/dist/{filtering-span-processor-vkewzbqB.d.ts → filtering-span-processor-BDGe1myy.d.ts} +1 -1
  49. package/dist/{filtering-span-processor-BpDagWNa.d.cts → filtering-span-processor-BYvLMiNz.d.cts} +1 -1
  50. package/dist/filtering-span-processor.cjs +3 -3
  51. package/dist/filtering-span-processor.d.cts +1 -1
  52. package/dist/filtering-span-processor.d.ts +1 -1
  53. package/dist/filtering-span-processor.js +3 -3
  54. package/dist/{functional-SeRUabkE.d.ts → functional-CbcInXMJ.d.ts} +1 -1
  55. package/dist/{functional-DxHvvWc_.cjs → functional-CjZT7Jur.cjs} +3 -3
  56. package/dist/{functional-6QPJDqUW.js → functional-DHn-xGtR.js} +3 -3
  57. package/dist/{functional-DPZTpGh6.d.cts → functional-j8Joyrwd.d.cts} +1 -1
  58. package/dist/functional.cjs +1 -1
  59. package/dist/functional.d.cts +1 -1
  60. package/dist/functional.d.ts +1 -1
  61. package/dist/functional.js +1 -1
  62. package/dist/http.cjs +1 -1
  63. package/dist/http.d.cts +6 -7
  64. package/dist/http.d.ts +6 -7
  65. package/dist/http.js +1 -1
  66. package/dist/{index-B9aRLp6c.d.ts → index-DAH41w0W.d.ts} +4 -4
  67. package/dist/{index-8bFU4kmd.d.cts → index-DVPsz3DK.d.cts} +4 -4
  68. package/dist/index.cjs +3 -2
  69. package/dist/index.d.cts +38 -38
  70. package/dist/index.d.ts +38 -38
  71. package/dist/index.js +4 -4
  72. package/dist/{init-COfMwKbc.d.cts → init-BtYaU5n9.d.cts} +18 -4
  73. package/dist/{init-CnoRlJqS.d.ts → init-DUIFqRRS.d.ts} +18 -4
  74. package/dist/{init-C-qfxo_u.js → init-rVPOUqng.js} +98 -8
  75. package/dist/{init-W_klPrYk.cjs → init-zb68UvOW.cjs} +97 -6
  76. package/dist/instrumentation.cjs +1 -1
  77. package/dist/instrumentation.d.cts +4 -5
  78. package/dist/instrumentation.d.ts +4 -5
  79. package/dist/instrumentation.js +1 -1
  80. package/dist/{logger-S1Fgl0g3.d.cts → logger-C9UT1aZ_.d.cts} +4 -4
  81. package/dist/{logger-S1Fgl0g3.d.ts → logger-C9UT1aZ_.d.ts} +4 -4
  82. package/dist/logger.d.cts +1 -1
  83. package/dist/logger.d.ts +1 -1
  84. package/dist/messaging-adapters.d.cts +10 -11
  85. package/dist/messaging-adapters.d.ts +10 -11
  86. package/dist/messaging-testing.d.cts +19 -20
  87. package/dist/messaging-testing.d.ts +19 -20
  88. package/dist/messaging.cjs +2 -2
  89. package/dist/messaging.d.cts +23 -24
  90. package/dist/messaging.d.ts +23 -24
  91. package/dist/messaging.js +2 -2
  92. package/dist/metric-helpers.d.cts +6 -7
  93. package/dist/metric-helpers.d.ts +6 -7
  94. package/dist/metric.d.cts +7 -7
  95. package/dist/metric.d.ts +7 -7
  96. package/dist/parse-error.d.cts +3 -4
  97. package/dist/parse-error.d.ts +3 -4
  98. package/dist/policy.cjs +0 -0
  99. package/dist/policy.js +0 -0
  100. package/dist/processors.d.cts +1 -1
  101. package/dist/processors.d.ts +1 -1
  102. package/dist/{sampling-CZi7OM9u.d.ts → sampling-B_8orhSB.d.ts} +1 -1
  103. package/dist/{sampling-DENUjT_8.d.cts → sampling-Dud4XU2m.d.cts} +1 -1
  104. package/dist/sampling.cjs +1 -1
  105. package/dist/sampling.d.cts +1 -1
  106. package/dist/sampling.d.ts +1 -1
  107. package/dist/sampling.js +1 -1
  108. package/dist/security-schema.d.cts +30 -31
  109. package/dist/security-schema.d.ts +30 -31
  110. package/dist/semantic-conventions-yG0X2AsN.d.cts +31 -0
  111. package/dist/semantic-conventions-yG0X2AsN.d.ts +31 -0
  112. package/dist/semantic-conventions.d.cts +1 -1
  113. package/dist/semantic-conventions.d.ts +1 -1
  114. package/dist/semantic-helpers.cjs +1 -1
  115. package/dist/semantic-helpers.d.cts +10 -11
  116. package/dist/semantic-helpers.d.ts +10 -11
  117. package/dist/semantic-helpers.js +1 -1
  118. package/dist/slo.d.cts +12 -13
  119. package/dist/slo.d.ts +12 -13
  120. package/dist/tail-sampling-processor.cjs +1 -1
  121. package/dist/tail-sampling-processor.d.cts +2 -3
  122. package/dist/tail-sampling-processor.d.ts +2 -3
  123. package/dist/tail-sampling-processor.js +1 -1
  124. package/dist/test-span-collector.d.cts +4 -5
  125. package/dist/test-span-collector.d.ts +4 -5
  126. package/dist/testing.d.cts +18 -18
  127. package/dist/testing.d.ts +18 -18
  128. package/dist/trace-helpers.d.cts +15 -16
  129. package/dist/trace-helpers.d.ts +15 -16
  130. package/dist/tracer-provider.cjs +21 -1
  131. package/dist/tracer-provider.d.cts +16 -6
  132. package/dist/tracer-provider.d.ts +16 -6
  133. package/dist/tracer-provider.js +22 -3
  134. package/dist/validate.cjs +8 -7
  135. package/dist/validate.d.cts +12 -12
  136. package/dist/validate.d.ts +12 -12
  137. package/dist/validate.js +8 -7
  138. package/dist/validation-attributes.d.cts +14 -15
  139. package/dist/validation-attributes.d.ts +14 -15
  140. package/dist/webhook.cjs +1 -1
  141. package/dist/webhook.d.cts +11 -12
  142. package/dist/webhook.d.ts +11 -12
  143. package/dist/webhook.js +1 -1
  144. package/dist/workflow-distributed.cjs +1 -1
  145. package/dist/workflow-distributed.d.cts +26 -27
  146. package/dist/workflow-distributed.d.ts +26 -27
  147. package/dist/workflow-distributed.js +1 -1
  148. package/dist/workflow.cjs +1 -1
  149. package/dist/workflow.d.cts +11 -12
  150. package/dist/workflow.d.ts +11 -12
  151. package/dist/workflow.js +1 -1
  152. package/dist/yaml-config.cjs +1 -1
  153. package/dist/yaml-config.d.cts +9 -10
  154. package/dist/yaml-config.d.ts +9 -10
  155. package/dist/yaml-config.js +1 -1
  156. package/package.json +15 -21
  157. package/dist/semantic-conventions-FhSxv-bK.d.cts +0 -31
  158. package/dist/semantic-conventions-FhSxv-bK.d.ts +0 -31
@@ -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
@@ -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
- attributes[require_validation_attributes.VALIDATION_ATTR.name] = mismatch.name;
71
- attributes[require_validation_attributes.VALIDATION_ATTR.boundary] = mismatch.boundary;
72
- attributes[require_validation_attributes.VALIDATION_ATTR.mode] = mismatch.mode;
73
- attributes[require_validation_attributes.VALIDATION_ATTR.issueCount] = mismatch.issues.length;
74
- attributes[require_validation_attributes.VALIDATION_ATTR.issuePaths] = truncate(paths);
75
- attributes[require_validation_attributes.VALIDATION_ATTR.issueCodes] = truncate(codes);
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);
@@ -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 { DefineValidatorOptions, type SchemaLike, ValidationIssue, ValidationMismatch, ValidationMode, ValidationSeverity, Validator, ValidatorResult, defineValidator, formatValidationIssues, onValidationMismatch, recordValidationMismatch };
104
+ export type { SchemaLike };
@@ -1,10 +1,10 @@
1
1
  import { t as UnknownRecord } from "./values-CeMH-mYG.js";
2
2
  import { r as SchemaLike } from "./define-event-Bd8f8mST.js";
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 { DefineValidatorOptions, type SchemaLike, ValidationIssue, ValidationMismatch, ValidationMode, ValidationSeverity, Validator, ValidatorResult, defineValidator, formatValidationIssues, onValidationMismatch, recordValidationMismatch };
104
+ export type { SchemaLike };
package/dist/validate.js CHANGED
@@ -65,13 +65,14 @@ function recordValidationMismatch(mismatch) {
65
65
  const codes = [...new Set(mismatch.issues.map((i) => i.code))];
66
66
  const span = trace.getActiveSpan();
67
67
  if (span) {
68
- const attributes = {};
69
- attributes[VALIDATION_ATTR.name] = mismatch.name;
70
- attributes[VALIDATION_ATTR.boundary] = mismatch.boundary;
71
- attributes[VALIDATION_ATTR.mode] = mismatch.mode;
72
- attributes[VALIDATION_ATTR.issueCount] = mismatch.issues.length;
73
- attributes[VALIDATION_ATTR.issuePaths] = truncate(paths);
74
- attributes[VALIDATION_ATTR.issueCodes] = truncate(codes);
68
+ const attributes = {
69
+ [VALIDATION_ATTR.name]: mismatch.name,
70
+ [VALIDATION_ATTR.boundary]: mismatch.boundary,
71
+ [VALIDATION_ATTR.mode]: mismatch.mode,
72
+ [VALIDATION_ATTR.issueCount]: mismatch.issues.length,
73
+ [VALIDATION_ATTR.issuePaths]: truncate(paths),
74
+ [VALIDATION_ATTR.issueCodes]: truncate(codes)
75
+ };
75
76
  if (mismatch.hash) attributes[VALIDATION_ATTR.hash] = mismatch.hash;
76
77
  if (mismatch.severity) attributes[VALIDATION_ATTR.severity] = mismatch.severity;
77
78
  span.setAttributes(attributes);
@@ -12,30 +12,29 @@
12
12
  * These keys are a public API for the agents that query your telemetry. Treat a
13
13
  * rename here the way you'd treat a breaking change to any other contract.
14
14
  */
15
- declare const VALIDATION_ATTR: {
15
+ export declare const VALIDATION_ATTR: {
16
16
  /** Contract id of the validated boundary, e.g. `POST /orders`, `order.placed`. */
17
- readonly name: "validation.name";
17
+ readonly name: 'validation.name';
18
18
  /** Where validation ran: `http` | `event` | `message` | a custom label. */
19
- readonly boundary: "validation.boundary";
19
+ readonly boundary: 'validation.boundary';
20
20
  /** `observe` (recorded, request continues) or `reject` (recorded, then failed). */
21
- readonly mode: "validation.mode";
21
+ readonly mode: 'validation.mode';
22
22
  /** Stable hash of the declared shape, when a JSON-schema projection is given. */
23
- readonly hash: "validation.hash";
23
+ readonly hash: 'validation.hash';
24
24
  /** `info` | `warning` | `error`. */
25
- readonly severity: "validation.severity";
25
+ readonly severity: 'validation.severity';
26
26
  /** Number of failing fields. */
27
- readonly issueCount: "validation.issue.count";
27
+ readonly issueCount: 'validation.issue.count';
28
28
  /** Comma-separated failing field paths (capped). Never contains values. */
29
- readonly issuePaths: "validation.issue.paths";
29
+ readonly issuePaths: 'validation.issue.paths';
30
30
  /** Comma-separated distinct issue codes (capped). Never contains values. */
31
- readonly issueCodes: "validation.issue.codes";
31
+ readonly issueCodes: 'validation.issue.codes';
32
32
  };
33
- type ValidationAttributeKey = (typeof VALIDATION_ATTR)[keyof typeof VALIDATION_ATTR];
34
- declare const VALIDATION_METRICS: {
33
+ export type ValidationAttributeKey = (typeof VALIDATION_ATTR)[keyof typeof VALIDATION_ATTR];
34
+ export declare const VALIDATION_METRICS: {
35
35
  /** Counter, labelled `{ boundary, validation, mode }`. */
36
- readonly mismatches: "autotel.validation.mismatches";
36
+ readonly mismatches: 'autotel.validation.mismatches';
37
37
  };
38
38
  /** Max field paths / codes stamped onto a span, to bound attribute size. */
39
- declare const VALIDATION_ISSUE_CAP = 20;
40
- //#endregion
41
- export { VALIDATION_ATTR, VALIDATION_ISSUE_CAP, VALIDATION_METRICS, ValidationAttributeKey };
39
+ export declare const VALIDATION_ISSUE_CAP = 20;
40
+ //#endregion
@@ -12,30 +12,29 @@
12
12
  * These keys are a public API for the agents that query your telemetry. Treat a
13
13
  * rename here the way you'd treat a breaking change to any other contract.
14
14
  */
15
- declare const VALIDATION_ATTR: {
15
+ export declare const VALIDATION_ATTR: {
16
16
  /** Contract id of the validated boundary, e.g. `POST /orders`, `order.placed`. */
17
- readonly name: "validation.name";
17
+ readonly name: 'validation.name';
18
18
  /** Where validation ran: `http` | `event` | `message` | a custom label. */
19
- readonly boundary: "validation.boundary";
19
+ readonly boundary: 'validation.boundary';
20
20
  /** `observe` (recorded, request continues) or `reject` (recorded, then failed). */
21
- readonly mode: "validation.mode";
21
+ readonly mode: 'validation.mode';
22
22
  /** Stable hash of the declared shape, when a JSON-schema projection is given. */
23
- readonly hash: "validation.hash";
23
+ readonly hash: 'validation.hash';
24
24
  /** `info` | `warning` | `error`. */
25
- readonly severity: "validation.severity";
25
+ readonly severity: 'validation.severity';
26
26
  /** Number of failing fields. */
27
- readonly issueCount: "validation.issue.count";
27
+ readonly issueCount: 'validation.issue.count';
28
28
  /** Comma-separated failing field paths (capped). Never contains values. */
29
- readonly issuePaths: "validation.issue.paths";
29
+ readonly issuePaths: 'validation.issue.paths';
30
30
  /** Comma-separated distinct issue codes (capped). Never contains values. */
31
- readonly issueCodes: "validation.issue.codes";
31
+ readonly issueCodes: 'validation.issue.codes';
32
32
  };
33
- type ValidationAttributeKey = (typeof VALIDATION_ATTR)[keyof typeof VALIDATION_ATTR];
34
- declare const VALIDATION_METRICS: {
33
+ export type ValidationAttributeKey = (typeof VALIDATION_ATTR)[keyof typeof VALIDATION_ATTR];
34
+ export declare const VALIDATION_METRICS: {
35
35
  /** Counter, labelled `{ boundary, validation, mode }`. */
36
- readonly mismatches: "autotel.validation.mismatches";
36
+ readonly mismatches: 'autotel.validation.mismatches';
37
37
  };
38
38
  /** Max field paths / codes stamped onto a span, to bound attribute size. */
39
- declare const VALIDATION_ISSUE_CAP = 20;
40
- //#endregion
41
- export { VALIDATION_ATTR, VALIDATION_ISSUE_CAP, VALIDATION_METRICS, ValidationAttributeKey };
39
+ export declare const VALIDATION_ISSUE_CAP = 20;
40
+ //#endregion
package/dist/webhook.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_structured_error = require('./structured-error-DynjWTTu.cjs');
3
- const require_functional = require('./functional-DxHvvWc_.cjs');
3
+ const require_functional = require('./functional-CjZT7Jur.cjs');
4
4
  const require_correlated_events = require('./correlated-events-DE_4A3oD.cjs');
5
5
  let _opentelemetry_api = require("@opentelemetry/api");
6
6
 
@@ -4,7 +4,7 @@ import { Link, SpanContext } from "@opentelemetry/api";
4
4
  /**
5
5
  * Stored trace context for parking lot pattern
6
6
  */
7
- interface StoredTraceContext {
7
+ export interface StoredTraceContext {
8
8
  /** Trace ID from the original span */
9
9
  traceId: string;
10
10
  /** Span ID from the original span */
@@ -23,7 +23,7 @@ interface StoredTraceContext {
23
23
  *
24
24
  * Implement this interface to use different storage backends (Redis, DynamoDB, etc.)
25
25
  */
26
- interface TraceContextStore {
26
+ export interface TraceContextStore {
27
27
  /**
28
28
  * Save trace context with a correlation key
29
29
  *
@@ -48,7 +48,7 @@ interface TraceContextStore {
48
48
  /**
49
49
  * Configuration for creating a parking lot
50
50
  */
51
- interface ParkingLotConfig {
51
+ export interface ParkingLotConfig {
52
52
  /** Storage backend for parked contexts */
53
53
  store: TraceContextStore;
54
54
  /** Default TTL in milliseconds (default: 24 hours) */
@@ -63,7 +63,7 @@ interface ParkingLotConfig {
63
63
  /**
64
64
  * Configuration for traceCallback wrapper
65
65
  */
66
- interface CallbackConfig {
66
+ export interface CallbackConfig {
67
67
  /** Span name for the callback handler */
68
68
  name: string;
69
69
  /**
@@ -83,7 +83,7 @@ interface CallbackConfig {
83
83
  /**
84
84
  * Extended context for callback handlers
85
85
  */
86
- interface CallbackContext extends TraceContext {
86
+ export interface CallbackContext extends TraceContext {
87
87
  /** The retrieved parked context, if found */
88
88
  parkedContext: StoredTraceContext | null;
89
89
  /** Time elapsed since context was parked (ms), or null if not found */
@@ -94,7 +94,7 @@ interface CallbackContext extends TraceContext {
94
94
  /**
95
95
  * The parking lot instance
96
96
  */
97
- interface ParkingLot {
97
+ export interface ParkingLot {
98
98
  /**
99
99
  * Park current trace context before initiating async operation
100
100
  *
@@ -174,7 +174,7 @@ interface ParkingLot {
174
174
  * const parkingLot = createParkingLot({ store });
175
175
  * ```
176
176
  */
177
- declare class InMemoryTraceContextStore implements TraceContextStore {
177
+ export declare class InMemoryTraceContextStore implements TraceContextStore {
178
178
  private options;
179
179
  private store;
180
180
  private cleanupInterval;
@@ -238,7 +238,7 @@ declare class InMemoryTraceContextStore implements TraceContextStore {
238
238
  * });
239
239
  * ```
240
240
  */
241
- declare function createParkingLot(config: ParkingLotConfig): ParkingLot;
241
+ export declare function createParkingLot(config: ParkingLotConfig): ParkingLot;
242
242
  /**
243
243
  * Create a correlation key from multiple parts
244
244
  *
@@ -251,13 +251,12 @@ declare function createParkingLot(config: ParkingLotConfig): ParkingLot;
251
251
  * // Returns: "payment:order-123:stripe"
252
252
  * ```
253
253
  */
254
- declare function createCorrelationKey(...parts: (string | number)[]): string;
254
+ export declare function createCorrelationKey(...parts: (string | number)[]): string;
255
255
  /**
256
256
  * Extract span context from stored context for manual linking
257
257
  *
258
258
  * @param storedContext - The stored trace context
259
259
  * @returns SpanContext compatible object
260
260
  */
261
- declare function toSpanContext(storedContext: StoredTraceContext): SpanContext;
262
- //#endregion
263
- export { CallbackConfig, CallbackContext, InMemoryTraceContextStore, ParkingLot, ParkingLotConfig, StoredTraceContext, TraceContextStore, createCorrelationKey, createParkingLot, toSpanContext };
261
+ export declare function toSpanContext(storedContext: StoredTraceContext): SpanContext;
262
+ //#endregion
package/dist/webhook.d.ts CHANGED
@@ -4,7 +4,7 @@ import { Link, SpanContext } from "@opentelemetry/api";
4
4
  /**
5
5
  * Stored trace context for parking lot pattern
6
6
  */
7
- interface StoredTraceContext {
7
+ export interface StoredTraceContext {
8
8
  /** Trace ID from the original span */
9
9
  traceId: string;
10
10
  /** Span ID from the original span */
@@ -23,7 +23,7 @@ interface StoredTraceContext {
23
23
  *
24
24
  * Implement this interface to use different storage backends (Redis, DynamoDB, etc.)
25
25
  */
26
- interface TraceContextStore {
26
+ export interface TraceContextStore {
27
27
  /**
28
28
  * Save trace context with a correlation key
29
29
  *
@@ -48,7 +48,7 @@ interface TraceContextStore {
48
48
  /**
49
49
  * Configuration for creating a parking lot
50
50
  */
51
- interface ParkingLotConfig {
51
+ export interface ParkingLotConfig {
52
52
  /** Storage backend for parked contexts */
53
53
  store: TraceContextStore;
54
54
  /** Default TTL in milliseconds (default: 24 hours) */
@@ -63,7 +63,7 @@ interface ParkingLotConfig {
63
63
  /**
64
64
  * Configuration for traceCallback wrapper
65
65
  */
66
- interface CallbackConfig {
66
+ export interface CallbackConfig {
67
67
  /** Span name for the callback handler */
68
68
  name: string;
69
69
  /**
@@ -83,7 +83,7 @@ interface CallbackConfig {
83
83
  /**
84
84
  * Extended context for callback handlers
85
85
  */
86
- interface CallbackContext extends TraceContext {
86
+ export interface CallbackContext extends TraceContext {
87
87
  /** The retrieved parked context, if found */
88
88
  parkedContext: StoredTraceContext | null;
89
89
  /** Time elapsed since context was parked (ms), or null if not found */
@@ -94,7 +94,7 @@ interface CallbackContext extends TraceContext {
94
94
  /**
95
95
  * The parking lot instance
96
96
  */
97
- interface ParkingLot {
97
+ export interface ParkingLot {
98
98
  /**
99
99
  * Park current trace context before initiating async operation
100
100
  *
@@ -174,7 +174,7 @@ interface ParkingLot {
174
174
  * const parkingLot = createParkingLot({ store });
175
175
  * ```
176
176
  */
177
- declare class InMemoryTraceContextStore implements TraceContextStore {
177
+ export declare class InMemoryTraceContextStore implements TraceContextStore {
178
178
  private options;
179
179
  private store;
180
180
  private cleanupInterval;
@@ -238,7 +238,7 @@ declare class InMemoryTraceContextStore implements TraceContextStore {
238
238
  * });
239
239
  * ```
240
240
  */
241
- declare function createParkingLot(config: ParkingLotConfig): ParkingLot;
241
+ export declare function createParkingLot(config: ParkingLotConfig): ParkingLot;
242
242
  /**
243
243
  * Create a correlation key from multiple parts
244
244
  *
@@ -251,13 +251,12 @@ declare function createParkingLot(config: ParkingLotConfig): ParkingLot;
251
251
  * // Returns: "payment:order-123:stripe"
252
252
  * ```
253
253
  */
254
- declare function createCorrelationKey(...parts: (string | number)[]): string;
254
+ export declare function createCorrelationKey(...parts: (string | number)[]): string;
255
255
  /**
256
256
  * Extract span context from stored context for manual linking
257
257
  *
258
258
  * @param storedContext - The stored trace context
259
259
  * @returns SpanContext compatible object
260
260
  */
261
- declare function toSpanContext(storedContext: StoredTraceContext): SpanContext;
262
- //#endregion
263
- export { CallbackConfig, CallbackContext, InMemoryTraceContextStore, ParkingLot, ParkingLotConfig, StoredTraceContext, TraceContextStore, createCorrelationKey, createParkingLot, toSpanContext };
261
+ export declare function toSpanContext(storedContext: StoredTraceContext): SpanContext;
262
+ //#endregion
package/dist/webhook.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { r as recordStructuredError } from "./structured-error-Y9y-1Pae.js";
2
- import { l as withTracing } from "./functional-6QPJDqUW.js";
2
+ import { l as withTracing } from "./functional-DHn-xGtR.js";
3
3
  import { t as emitCorrelatedEvent } from "./correlated-events-BfpH5uS-.js";
4
4
  import { SpanKind, trace } from "@opentelemetry/api";
5
5
 
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_values = require('./values-AxGpgYBA.cjs');
3
- const require_functional = require('./functional-DxHvvWc_.cjs');
3
+ const require_functional = require('./functional-CjZT7Jur.cjs');
4
4
  const require_correlated_events = require('./correlated-events-DE_4A3oD.cjs');
5
5
  const require_business_baggage = require('./business-baggage.cjs');
6
6
  let _opentelemetry_api = require("@opentelemetry/api");