autotel-edge 3.16.13 → 3.16.15

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 (45) hide show
  1. package/dist/config-0FktBGyj.js +290 -0
  2. package/dist/config-0FktBGyj.js.map +1 -0
  3. package/dist/events.d.ts +42 -43
  4. package/dist/events.d.ts.map +1 -0
  5. package/dist/events.js +144 -137
  6. package/dist/events.js.map +1 -1
  7. package/dist/execution-logger-BWlya70r.d.ts +137 -0
  8. package/dist/execution-logger-BWlya70r.d.ts.map +1 -0
  9. package/dist/execution-logger-CoxSsBmU.js +247 -0
  10. package/dist/execution-logger-CoxSsBmU.js.map +1 -0
  11. package/dist/index.d.ts +192 -276
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +930 -1060
  14. package/dist/index.js.map +1 -1
  15. package/dist/logger.d.ts +122 -136
  16. package/dist/logger.d.ts.map +1 -0
  17. package/dist/logger.js +783 -774
  18. package/dist/logger.js.map +1 -1
  19. package/dist/parse-error.d.ts +12 -10
  20. package/dist/parse-error.d.ts.map +1 -0
  21. package/dist/parse-error.js +55 -2
  22. package/dist/parse-error.js.map +1 -1
  23. package/dist/sampling.d.ts +51 -76
  24. package/dist/sampling.d.ts.map +1 -0
  25. package/dist/sampling.js +155 -90
  26. package/dist/sampling.js.map +1 -1
  27. package/dist/testing.d.ts +1 -2
  28. package/dist/testing.js +1 -3
  29. package/dist/types-HCbsjZzp.d.ts +214 -0
  30. package/dist/types-HCbsjZzp.d.ts.map +1 -0
  31. package/package.json +6 -6
  32. package/src/core/buffer.ts +4 -3
  33. package/src/core/provider.context.test.ts +55 -0
  34. package/src/core/provider.ts +18 -1
  35. package/binding.gyp +0 -9
  36. package/dist/chunk-AL7ZD64M.js +0 -291
  37. package/dist/chunk-AL7ZD64M.js.map +0 -1
  38. package/dist/chunk-INQQQVXN.js +0 -310
  39. package/dist/chunk-INQQQVXN.js.map +0 -1
  40. package/dist/chunk-M7Z4P5MC.js +0 -64
  41. package/dist/chunk-M7Z4P5MC.js.map +0 -1
  42. package/dist/execution-logger-77TRRoWn.d.ts +0 -84
  43. package/dist/testing.js.map +0 -1
  44. package/dist/types-uulICZo7.d.ts +0 -216
  45. package/index.js +0 -1
@@ -1,216 +0,0 @@
1
- import { Span, TextMapPropagator, SpanOptions, Context, Attributes } from '@opentelemetry/api';
2
- import { ReadableSpan, Sampler, SpanExporter, SpanProcessor } from '@opentelemetry/sdk-trace-base';
3
-
4
- /**
5
- * Shared types for autotel-edge
6
- */
7
-
8
- /**
9
- * Trigger types for edge handlers
10
- * Can be a Request or any vendor-specific trigger type
11
- */
12
- type Trigger = Request | DOConstructorTrigger | WorkflowTrigger | 'do-alarm' | unknown;
13
- interface DOConstructorTrigger {
14
- id: string;
15
- name?: string;
16
- }
17
- interface WorkflowTrigger {
18
- type: 'workflow';
19
- name: string;
20
- }
21
- /**
22
- * Config types
23
- */
24
- interface OTLPExporterConfig {
25
- url: string;
26
- headers?: Record<string, string>;
27
- }
28
- type ExporterConfig = OTLPExporterConfig | SpanExporter;
29
- interface ServiceConfig {
30
- name: string;
31
- namespace?: string;
32
- version?: string;
33
- }
34
- interface ParentRatioSamplingConfig {
35
- acceptRemote?: boolean;
36
- ratio: number;
37
- }
38
- type HeadSamplerConf = Sampler | ParentRatioSamplingConfig;
39
- interface SamplingConfig<HS extends HeadSamplerConf = HeadSamplerConf> {
40
- headSampler?: HS;
41
- tailSampler?: TailSampleFn;
42
- }
43
- interface InstrumentationOptions {
44
- instrumentGlobalFetch?: boolean;
45
- instrumentGlobalCache?: boolean;
46
- /**
47
- * Disable instrumentation entirely (useful for local development)
48
- * When enabled, the handler is returned as-is without any instrumentation
49
- * @default false
50
- */
51
- disabled?: boolean;
52
- }
53
- /**
54
- * Utility types
55
- */
56
- type OrPromise<T> = T | Promise<T>;
57
- /**
58
- * Adapter event types
59
- */
60
- type FunnelStepStatus = 'started' | 'completed' | 'abandoned' | 'failed' | (string & {});
61
- type OutcomeStatus = 'success' | 'failure' | 'partial' | (string & {});
62
- interface EdgeEventBase {
63
- [key: string]: unknown;
64
- service: string;
65
- timestamp: number;
66
- attributes: Record<string, unknown>;
67
- traceId?: string;
68
- spanId?: string;
69
- correlationId?: string;
70
- name: string;
71
- }
72
- interface EdgeTrackEvent extends EdgeEventBase {
73
- type: 'event';
74
- event: string;
75
- }
76
- interface EdgeFunnelStepEvent extends EdgeEventBase {
77
- type: 'funnel-step';
78
- funnel: string;
79
- status: FunnelStepStatus;
80
- }
81
- interface EdgeOutcomeEvent extends EdgeEventBase {
82
- type: 'outcome';
83
- operation: string;
84
- outcome: OutcomeStatus;
85
- }
86
- interface EdgeValueEvent extends EdgeEventBase {
87
- type: 'value';
88
- metric: string;
89
- value: number;
90
- }
91
- type EdgeEvent = EdgeTrackEvent | EdgeFunnelStepEvent | EdgeOutcomeEvent | EdgeValueEvent;
92
- type EdgeSubscriber = (event: EdgeEvent) => OrPromise<void>;
93
- interface FetcherConfig {
94
- includeTraceContext?: boolean | ((request: Request) => boolean);
95
- }
96
- interface RouteServiceConfig {
97
- service: string;
98
- }
99
- interface PostProcessParams {
100
- /**
101
- * The request object that was passed to the fetch handler.
102
- */
103
- request: Request;
104
- /**
105
- * The generated response object.
106
- */
107
- response: Response;
108
- /**
109
- * A readable version of the span object that can be used to access the span's attributes and events.
110
- */
111
- readable: ReadableSpan;
112
- }
113
- interface FetchHandlerConfig {
114
- /**
115
- * Whether to enable context propagation for incoming requests to `fetch`.
116
- * This enables or disables distributed tracing from W3C Trace Context headers.
117
- * @default true
118
- */
119
- acceptTraceContext?: boolean | ((request: Request) => boolean);
120
- /**
121
- * Allows further customization of the generated span, based on the request/response data.
122
- */
123
- postProcess?: (span: Span, ctx: PostProcessParams) => void;
124
- /**
125
- * Route patterns to include for fetch handler instrumentation.
126
- * Supports glob patterns like '/api/**'.
127
- * If not set, all routes are included.
128
- */
129
- include?: string[];
130
- /**
131
- * Route patterns to exclude from fetch handler instrumentation.
132
- * Supports glob patterns like '/health' and '/_internal/**'.
133
- * Exclusions take precedence over inclusions.
134
- */
135
- exclude?: string[];
136
- /**
137
- * Route-specific service mapping.
138
- * The first matching pattern wins based on object iteration order.
139
- */
140
- routes?: Record<string, RouteServiceConfig>;
141
- }
142
- interface HandlerConfig {
143
- fetch?: FetchHandlerConfig;
144
- }
145
- interface DataSafetyConfig {
146
- /** Redact query parameters from URL attributes (default: false) */
147
- redactQueryParams?: boolean;
148
- /** Control D1 SQL statement capture: 'full' (default), 'obfuscated', or 'off' */
149
- captureDbStatement?: 'off' | 'obfuscated' | 'full';
150
- /** Only capture these email headers (lowercase). When set, other headers are excluded. */
151
- emailHeaderAllowlist?: string[];
152
- }
153
- interface EdgeConfigBase {
154
- service: ServiceConfig;
155
- handlers?: HandlerConfig;
156
- fetch?: FetcherConfig;
157
- postProcessor?: PostProcessorFn;
158
- sampling?: SamplingConfig;
159
- propagator?: TextMapPropagator;
160
- instrumentation?: InstrumentationOptions;
161
- subscribers?: EdgeSubscriber[];
162
- /** Opt-in data safety controls for sensitive attribute capture */
163
- dataSafety?: DataSafetyConfig;
164
- }
165
- interface EdgeConfigExporter extends EdgeConfigBase {
166
- exporter: ExporterConfig;
167
- }
168
- interface EdgeConfigSpanProcessors extends EdgeConfigBase {
169
- spanProcessors: SpanProcessor | SpanProcessor[];
170
- }
171
- type EdgeConfig = EdgeConfigExporter | EdgeConfigSpanProcessors;
172
- interface ResolvedEdgeConfig extends EdgeConfigBase {
173
- handlers: Required<HandlerConfig>;
174
- fetch: Required<FetcherConfig>;
175
- postProcessor: PostProcessorFn;
176
- sampling: Required<SamplingConfig<Sampler>>;
177
- spanProcessors: SpanProcessor[];
178
- propagator: TextMapPropagator;
179
- instrumentation: InstrumentationOptions;
180
- subscribers: EdgeSubscriber[];
181
- }
182
- /**
183
- * Function types
184
- */
185
- type ResolveConfigFn<Env = any> = (env: Env, trigger: Trigger) => EdgeConfig;
186
- type ConfigurationOption = EdgeConfig | ResolveConfigFn;
187
- type PostProcessorFn = (spans: ReadableSpan[]) => ReadableSpan[];
188
- type TailSampleFn = (traceInfo: LocalTrace) => boolean;
189
- interface LocalTrace {
190
- traceId: string;
191
- spans: ReadableSpan[];
192
- localRootSpan: ReadableSpan;
193
- }
194
- /**
195
- * Span processor with flush support
196
- */
197
- type TraceFlushableSpanProcessor = SpanProcessor & {
198
- forceFlush: (traceId?: string) => Promise<void>;
199
- };
200
- /**
201
- * Handler instrumentation
202
- */
203
- interface InitialSpanInfo {
204
- name: string;
205
- options: SpanOptions;
206
- context?: Context;
207
- }
208
- interface HandlerInstrumentation<T extends Trigger, R extends any> {
209
- getInitialSpanInfo: (trigger: T) => InitialSpanInfo;
210
- getAttributesFromResult?: (result: Awaited<R>) => Attributes;
211
- instrumentTrigger?: (trigger: T) => T;
212
- executionSucces?: (span: Span, trigger: T, result: Awaited<R>) => void;
213
- executionFailed?: (span: Span, trigger: T, error?: any) => void;
214
- }
215
-
216
- export type { ConfigurationOption as C, DOConstructorTrigger as D, EdgeEvent as E, FunnelStepStatus as F, HandlerInstrumentation as H, InitialSpanInfo as I, LocalTrace as L, OrPromise as O, PostProcessorFn as P, ResolvedEdgeConfig as R, SamplingConfig as S, TailSampleFn as T, WorkflowTrigger as W, OutcomeStatus as a, EdgeFunnelStepEvent as b, EdgeOutcomeEvent as c, EdgeTrackEvent as d, EdgeValueEvent as e, OTLPExporterConfig as f, Trigger as g, EdgeConfig as h, EdgeSubscriber as i, ResolveConfigFn as j, RouteServiceConfig as k, DataSafetyConfig as l, ExporterConfig as m, InstrumentationOptions as n, ServiceConfig as o, TraceFlushableSpanProcessor as p };