autotel-cloudflare 2.12.0 → 2.14.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 (44) hide show
  1. package/dist/actors.js +1 -1
  2. package/dist/bindings.d.ts +113 -1
  3. package/dist/bindings.js +2 -2
  4. package/dist/chunk-4UG2QCPQ.js +1060 -0
  5. package/dist/chunk-4UG2QCPQ.js.map +1 -0
  6. package/dist/{chunk-5NL62W4L.js → chunk-O4IYKWPJ.js} +8 -3
  7. package/dist/chunk-O4IYKWPJ.js.map +1 -0
  8. package/dist/{chunk-ADWSZ5GY.js → chunk-WDNZVVRW.js} +8 -9
  9. package/dist/chunk-WDNZVVRW.js.map +1 -0
  10. package/dist/handlers.d.ts +5 -14
  11. package/dist/handlers.js +2 -2
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.js +34 -6
  14. package/dist/index.js.map +1 -1
  15. package/package.json +2 -2
  16. package/src/bindings/ai.test.ts +156 -0
  17. package/src/bindings/ai.ts +71 -0
  18. package/src/bindings/analytics-engine.test.ts +160 -0
  19. package/src/bindings/analytics-engine.ts +78 -0
  20. package/src/bindings/bindings-detection.test.ts +235 -0
  21. package/src/bindings/bindings.ts +98 -47
  22. package/src/bindings/browser-rendering.test.ts +144 -0
  23. package/src/bindings/browser-rendering.ts +70 -0
  24. package/src/bindings/common.ts +9 -0
  25. package/src/bindings/hyperdrive.test.ts +154 -0
  26. package/src/bindings/hyperdrive.ts +74 -0
  27. package/src/bindings/images.test.ts +229 -0
  28. package/src/bindings/images.ts +182 -0
  29. package/src/bindings/index.ts +8 -0
  30. package/src/bindings/queue-producer.test.ts +192 -0
  31. package/src/bindings/queue-producer.ts +105 -0
  32. package/src/bindings/rate-limiter.test.ts +124 -0
  33. package/src/bindings/rate-limiter.ts +69 -0
  34. package/src/bindings/vectorize.test.ts +340 -0
  35. package/src/bindings/vectorize.ts +86 -0
  36. package/src/handlers/workflows.test.ts +325 -0
  37. package/src/handlers/workflows.ts +51 -41
  38. package/src/index.ts +8 -0
  39. package/src/wrappers/cf-attributes.test.ts +275 -0
  40. package/src/wrappers/instrument.ts +38 -0
  41. package/dist/chunk-5NL62W4L.js.map +0 -1
  42. package/dist/chunk-ADWSZ5GY.js.map +0 -1
  43. package/dist/chunk-UPQE3J4I.js +0 -520
  44. package/dist/chunk-UPQE3J4I.js.map +0 -1
package/dist/actors.js CHANGED
@@ -1,4 +1,4 @@
1
- import { wrap } from './chunk-5NL62W4L.js';
1
+ import { wrap } from './chunk-O4IYKWPJ.js';
2
2
  import { propagation, SpanKind, SpanStatusCode, context, trace } from '@opentelemetry/api';
3
3
  import { createInitialiser, setConfig } from 'autotel-edge';
4
4
 
@@ -34,7 +34,119 @@ declare function instrumentD1<D extends D1Database>(d1: D, databaseName?: string
34
34
  declare function instrumentServiceBinding<F extends Fetcher>(fetcher: F, serviceName?: string): F;
35
35
  /**
36
36
  * Auto-instrument all Cloudflare bindings in the environment
37
+ *
38
+ * Detection order (most specific first):
39
+ * 1. R2 — get, put, delete, list, head
40
+ * 2. KV — get, put, delete, list (not head)
41
+ * 3. D1 — prepare, exec
42
+ * 4. Vectorize — query, insert, upsert, describe
43
+ * 5. AI — run + (gateway or models discriminator)
44
+ * 6. Hyperdrive — connect + connectionString + host
45
+ * 7. Queue Producer — send, sendBatch (not get)
46
+ * 8. Analytics Engine — writeDataPoint
47
+ * 9. Images — info, input
48
+ * 10. Service Binding — fetch (broadest, must be last)
49
+ *
50
+ * Not auto-detected (manual only):
51
+ * - Rate Limiter — limit() alone too generic
52
+ * - Browser Rendering — indistinguishable from Service Binding
37
53
  */
38
54
  declare function instrumentBindings(env: Record<string, any>): Record<string, any>;
39
55
 
40
- export { instrumentBindings, instrumentD1, instrumentKV, instrumentR2, instrumentServiceBinding };
56
+ /**
57
+ * Workers AI binding instrumentation
58
+ */
59
+ /**
60
+ * Instrument Workers AI binding
61
+ */
62
+ declare function instrumentAI<T extends Ai>(ai: T, bindingName?: string): T;
63
+
64
+ /**
65
+ * Vectorize binding instrumentation
66
+ */
67
+ /**
68
+ * Instrument Vectorize index binding
69
+ */
70
+ declare function instrumentVectorize<T extends VectorizeIndex>(vectorize: T, indexName?: string): T;
71
+
72
+ /**
73
+ * Hyperdrive binding instrumentation
74
+ */
75
+ /**
76
+ * Instrument Hyperdrive binding
77
+ */
78
+ declare function instrumentHyperdrive<T extends Hyperdrive>(hyperdrive: T, bindingName?: string): T;
79
+
80
+ /**
81
+ * Queue producer binding instrumentation
82
+ */
83
+ /**
84
+ * Instrument Queue producer binding
85
+ */
86
+ declare function instrumentQueueProducer<T extends Queue>(queue: T, queueName?: string): T;
87
+
88
+ /**
89
+ * Analytics Engine binding instrumentation
90
+ */
91
+ /**
92
+ * Instrument Analytics Engine binding
93
+ */
94
+ declare function instrumentAnalyticsEngine<T extends AnalyticsEngineDataset>(ae: T, datasetName?: string): T;
95
+
96
+ /**
97
+ * Images binding instrumentation
98
+ *
99
+ * The Images binding uses a fluent chain: input() -> transform() -> draw() -> output()
100
+ * We only create a span at the terminal output() call to avoid intermediate noise.
101
+ * info() is a standalone operation and gets its own span.
102
+ */
103
+ interface ImagesLike {
104
+ info(blob: ReadableStream | ArrayBuffer | Blob): Promise<{
105
+ width: number;
106
+ height: number;
107
+ format: string;
108
+ }>;
109
+ input(blob: ReadableStream | ArrayBuffer | Blob): ImageTransformerLike;
110
+ }
111
+ interface ImageTransformerLike {
112
+ transform(options: unknown): ImageTransformerLike;
113
+ draw(image: unknown, options?: unknown): ImageTransformerLike;
114
+ output(options?: unknown): Promise<ImageOutputLike>;
115
+ }
116
+ interface ImageOutputLike {
117
+ response(): Response;
118
+ blob(): Promise<Blob>;
119
+ arrayBuffer(): Promise<ArrayBuffer>;
120
+ }
121
+ /**
122
+ * Instrument Images binding
123
+ */
124
+ declare function instrumentImages<T extends ImagesLike>(images: T, bindingName?: string): T;
125
+
126
+ /**
127
+ * Rate Limiter binding instrumentation
128
+ */
129
+ interface RateLimiterLike {
130
+ limit(options: {
131
+ key: string;
132
+ }): Promise<{
133
+ success: boolean;
134
+ }>;
135
+ }
136
+ /**
137
+ * Instrument Rate Limiter binding (manual only — not auto-detected)
138
+ */
139
+ declare function instrumentRateLimiter<T extends RateLimiterLike>(limiter: T, bindingName?: string): T;
140
+
141
+ /**
142
+ * Browser Rendering binding instrumentation
143
+ */
144
+ interface BrowserRenderingLike {
145
+ fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
146
+ }
147
+ /**
148
+ * Instrument Browser Rendering binding (manual only — not auto-detected)
149
+ */
150
+ declare function instrumentBrowserRendering<T extends BrowserRenderingLike>(browser: T, bindingName?: string): T;
151
+
152
+ export { instrumentAI, instrumentAnalyticsEngine, instrumentBindings, instrumentBrowserRendering, instrumentD1, instrumentHyperdrive, instrumentImages, instrumentKV, instrumentQueueProducer, instrumentR2, instrumentRateLimiter, instrumentServiceBinding, instrumentVectorize };
package/dist/bindings.js CHANGED
@@ -1,4 +1,4 @@
1
- export { instrumentBindings, instrumentD1, instrumentKV, instrumentR2, instrumentServiceBinding } from './chunk-UPQE3J4I.js';
2
- import './chunk-5NL62W4L.js';
1
+ export { instrumentAI, instrumentAnalyticsEngine, instrumentBindings, instrumentBrowserRendering, instrumentD1, instrumentHyperdrive, instrumentImages, instrumentKV, instrumentQueueProducer, instrumentR2, instrumentRateLimiter, instrumentServiceBinding, instrumentVectorize } from './chunk-4UG2QCPQ.js';
2
+ import './chunk-O4IYKWPJ.js';
3
3
  //# sourceMappingURL=bindings.js.map
4
4
  //# sourceMappingURL=bindings.js.map