tokenmeter 0.9.0 → 0.9.11
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 +220 -6
- package/dist/config.d.ts +7 -84
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -158
- package/dist/config.js.map +1 -1
- package/dist/exporter/PostgresExporter.d.ts.map +1 -1
- package/dist/exporter/PostgresExporter.js +4 -2
- package/dist/exporter/PostgresExporter.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/instrumentation/proxy.d.ts.map +1 -1
- package/dist/instrumentation/proxy.js +279 -51
- package/dist/instrumentation/proxy.js.map +1 -1
- package/dist/instrumentation/strategies/index.d.ts +33 -0
- package/dist/instrumentation/strategies/index.d.ts.map +1 -1
- package/dist/instrumentation/strategies/index.js +146 -17
- package/dist/instrumentation/strategies/index.js.map +1 -1
- package/dist/integrations/inngest/index.d.ts +0 -38
- package/dist/integrations/inngest/index.d.ts.map +1 -1
- package/dist/integrations/inngest/index.js +0 -49
- package/dist/integrations/inngest/index.js.map +1 -1
- package/dist/integrations/vercel-ai/index.d.ts.map +1 -1
- package/dist/integrations/vercel-ai/index.js +2 -1
- package/dist/integrations/vercel-ai/index.js.map +1 -1
- package/dist/pricing/manifest.bundled.d.ts +24 -0
- package/dist/pricing/manifest.bundled.d.ts.map +1 -0
- package/dist/pricing/manifest.bundled.js +13347 -0
- package/dist/pricing/manifest.bundled.js.map +1 -0
- package/dist/pricing/manifest.d.ts +24 -10
- package/dist/pricing/manifest.d.ts.map +1 -1
- package/dist/pricing/manifest.js +189 -118
- package/dist/pricing/manifest.js.map +1 -1
- package/dist/pricing/schema.d.ts +22 -13
- package/dist/pricing/schema.d.ts.map +1 -1
- package/dist/pricing/schema.js +5 -2
- package/dist/pricing/schema.js.map +1 -1
- package/dist/processor/TokenMeterProcessor.d.ts +37 -7
- package/dist/processor/TokenMeterProcessor.d.ts.map +1 -1
- package/dist/processor/TokenMeterProcessor.js +45 -24
- package/dist/processor/TokenMeterProcessor.js.map +1 -1
- package/dist/query/client.d.ts +0 -24
- package/dist/query/client.d.ts.map +1 -1
- package/dist/query/client.js +42 -9
- package/dist/query/client.js.map +1 -1
- package/dist/registry.d.ts +127 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +144 -0
- package/dist/registry.js.map +1 -0
- package/dist/types.d.ts +61 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -28,15 +28,14 @@ npm install tokenmeter @opentelemetry/api @opentelemetry/sdk-trace-node
|
|
|
28
28
|
import OpenAI from 'openai';
|
|
29
29
|
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
30
30
|
import { SimpleSpanProcessor, ConsoleSpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
31
|
-
import { monitor, withAttributes
|
|
31
|
+
import { monitor, withAttributes } from 'tokenmeter';
|
|
32
32
|
|
|
33
|
-
// 1. Set up OpenTelemetry
|
|
33
|
+
// 1. Set up OpenTelemetry
|
|
34
34
|
const provider = new NodeTracerProvider();
|
|
35
|
-
provider.addSpanProcessor(new TokenMeterProcessor());
|
|
36
35
|
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
|
|
37
36
|
provider.register();
|
|
38
37
|
|
|
39
|
-
// 2. Wrap your AI client
|
|
38
|
+
// 2. Wrap your AI client (this is what adds cost tracking!)
|
|
40
39
|
const openai = monitor(new OpenAI());
|
|
41
40
|
|
|
42
41
|
// 3. Track costs with context
|
|
@@ -102,13 +101,100 @@ await withAttributes({ 'org.id': 'acme' }, async () => {
|
|
|
102
101
|
});
|
|
103
102
|
```
|
|
104
103
|
|
|
104
|
+
### Request-Level Cost Attribution
|
|
105
|
+
|
|
106
|
+
Get cost data immediately after each API call using hooks or the `withCost` utility.
|
|
107
|
+
|
|
108
|
+
#### Using Hooks
|
|
109
|
+
|
|
110
|
+
Configure `beforeRequest`, `afterResponse`, and `onError` hooks when creating the monitored client:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { monitor } from 'tokenmeter';
|
|
114
|
+
|
|
115
|
+
const openai = monitor(new OpenAI(), {
|
|
116
|
+
beforeRequest: (ctx) => {
|
|
117
|
+
console.log(`Calling ${ctx.spanName}`);
|
|
118
|
+
// Throw to abort the request (useful for rate limiting)
|
|
119
|
+
if (isRateLimited()) throw new Error('Rate limited');
|
|
120
|
+
},
|
|
121
|
+
afterResponse: (ctx) => {
|
|
122
|
+
console.log(`Cost: $${ctx.cost.toFixed(6)}`);
|
|
123
|
+
console.log(`Tokens: ${ctx.usage?.inputUnits} in, ${ctx.usage?.outputUnits} out`);
|
|
124
|
+
console.log(`Duration: ${ctx.durationMs}ms`);
|
|
125
|
+
|
|
126
|
+
// Track costs in your system
|
|
127
|
+
trackCost(ctx.usage, ctx.cost);
|
|
128
|
+
},
|
|
129
|
+
onError: (ctx) => {
|
|
130
|
+
console.error(`Error in ${ctx.spanName}:`, ctx.error.message);
|
|
131
|
+
alertOnError(ctx.error);
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Hooks are read-only—they observe but cannot modify request arguments.
|
|
137
|
+
|
|
138
|
+
#### Using `withCost`
|
|
139
|
+
|
|
140
|
+
For ad-hoc cost capture without configuring hooks:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { monitor, withCost } from 'tokenmeter';
|
|
144
|
+
|
|
145
|
+
const openai = monitor(new OpenAI());
|
|
146
|
+
|
|
147
|
+
const { result, cost, usage } = await withCost(() =>
|
|
148
|
+
openai.chat.completions.create({
|
|
149
|
+
model: 'gpt-4o',
|
|
150
|
+
messages: [{ role: 'user', content: 'Hello!' }],
|
|
151
|
+
})
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
console.log(`Response: ${result.choices[0].message.content}`);
|
|
155
|
+
console.log(`Cost: $${cost.toFixed(6)}`);
|
|
156
|
+
console.log(`Tokens: ${usage?.inputUnits} in, ${usage?.outputUnits} out`);
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Provider-Specific Types
|
|
160
|
+
|
|
161
|
+
Use type guards to access provider-specific usage data:
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
import {
|
|
165
|
+
withCost,
|
|
166
|
+
isOpenAIUsage,
|
|
167
|
+
isAnthropicUsage,
|
|
168
|
+
type ProviderUsageData
|
|
169
|
+
} from 'tokenmeter';
|
|
170
|
+
|
|
171
|
+
const { usage } = await withCost(() => openai.chat.completions.create({...}));
|
|
172
|
+
|
|
173
|
+
if (isOpenAIUsage(usage)) {
|
|
174
|
+
console.log(`OpenAI tokens: ${usage.inputUnits} in, ${usage.outputUnits} out`);
|
|
175
|
+
if (usage.totalTokens) console.log(`Total: ${usage.totalTokens}`);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (isAnthropicUsage(usage)) {
|
|
179
|
+
console.log(`Anthropic tokens: ${usage.inputUnits} in, ${usage.outputUnits} out`);
|
|
180
|
+
if (usage.cacheCreationTokens) console.log(`Cache: ${usage.cacheCreationTokens}`);
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Available type guards: `isOpenAIUsage`, `isAnthropicUsage`, `isGoogleUsage`, `isBedrockUsage`, `isFalUsage`, `isElevenLabsUsage`, `isBFLUsage`, `isVercelAIUsage`.
|
|
185
|
+
|
|
105
186
|
### `TokenMeterProcessor`
|
|
106
187
|
|
|
107
|
-
An OpenTelemetry SpanProcessor
|
|
188
|
+
An OpenTelemetry SpanProcessor for debugging and validating cost calculations. It logs calculated costs for spans that have usage data.
|
|
189
|
+
|
|
190
|
+
> **Note**: The processor cannot add cost attributes to spans after they end (OpenTelemetry limitation). For production cost tracking, use `monitor()` which adds `tokenmeter.cost_usd` before the span ends.
|
|
108
191
|
|
|
109
192
|
```typescript
|
|
110
193
|
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
111
|
-
import { TokenMeterProcessor } from 'tokenmeter';
|
|
194
|
+
import { TokenMeterProcessor, configureLogger } from 'tokenmeter';
|
|
195
|
+
|
|
196
|
+
// Enable debug logging to see calculated costs
|
|
197
|
+
configureLogger({ level: 'debug' });
|
|
112
198
|
|
|
113
199
|
const provider = new NodeTracerProvider();
|
|
114
200
|
provider.addSpanProcessor(new TokenMeterProcessor());
|
|
@@ -168,6 +254,25 @@ export const generateFn = inngest.createFunction(
|
|
|
168
254
|
);
|
|
169
255
|
```
|
|
170
256
|
|
|
257
|
+
### Vercel AI SDK
|
|
258
|
+
|
|
259
|
+
For non-invasive integration with the Vercel AI SDK using `experimental_telemetry`:
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import { generateText } from 'ai';
|
|
263
|
+
import { openai } from '@ai-sdk/openai';
|
|
264
|
+
import { telemetry } from 'tokenmeter/vercel-ai';
|
|
265
|
+
|
|
266
|
+
const { text } = await generateText({
|
|
267
|
+
model: openai('gpt-4o'),
|
|
268
|
+
prompt: 'Hello!',
|
|
269
|
+
experimental_telemetry: telemetry({
|
|
270
|
+
userId: 'user_123',
|
|
271
|
+
orgId: 'org_456',
|
|
272
|
+
}),
|
|
273
|
+
});
|
|
274
|
+
```
|
|
275
|
+
|
|
171
276
|
## PostgreSQL Persistence
|
|
172
277
|
|
|
173
278
|
Store costs for querying and billing.
|
|
@@ -295,9 +400,34 @@ provider.addSpanProcessor(new BatchSpanProcessor(
|
|
|
295
400
|
|--------|-------------|
|
|
296
401
|
| `monitor(client, options?)` | Wrap AI client with cost tracking |
|
|
297
402
|
| `withAttributes(attrs, fn)` | Set context attributes for nested calls |
|
|
403
|
+
| `withCost(fn)` | Capture cost from API calls in the function |
|
|
298
404
|
| `extractTraceHeaders()` | Get W3C trace headers for propagation |
|
|
299
405
|
| `withExtractedContext(headers, fn)` | Restore context from headers |
|
|
300
406
|
|
|
407
|
+
### Monitor Options
|
|
408
|
+
|
|
409
|
+
| Option | Type | Description |
|
|
410
|
+
|--------|------|-------------|
|
|
411
|
+
| `name` | `string` | Custom name for span naming |
|
|
412
|
+
| `provider` | `string` | Override provider detection |
|
|
413
|
+
| `attributes` | `Attributes` | Custom attributes for all spans |
|
|
414
|
+
| `beforeRequest` | `(ctx) => void` | Hook called before each API call |
|
|
415
|
+
| `afterResponse` | `(ctx) => void` | Hook called after successful response |
|
|
416
|
+
| `onError` | `(ctx) => void` | Hook called on errors |
|
|
417
|
+
|
|
418
|
+
### Type Guards
|
|
419
|
+
|
|
420
|
+
| Export | Description |
|
|
421
|
+
|--------|-------------|
|
|
422
|
+
| `isOpenAIUsage(usage)` | Check if usage is from OpenAI |
|
|
423
|
+
| `isAnthropicUsage(usage)` | Check if usage is from Anthropic |
|
|
424
|
+
| `isGoogleUsage(usage)` | Check if usage is from Google |
|
|
425
|
+
| `isBedrockUsage(usage)` | Check if usage is from AWS Bedrock |
|
|
426
|
+
| `isFalUsage(usage)` | Check if usage is from fal.ai |
|
|
427
|
+
| `isElevenLabsUsage(usage)` | Check if usage is from ElevenLabs |
|
|
428
|
+
| `isBFLUsage(usage)` | Check if usage is from Black Forest Labs |
|
|
429
|
+
| `isVercelAIUsage(usage)` | Check if usage is from Vercel AI SDK |
|
|
430
|
+
|
|
301
431
|
### Processor & Exporter
|
|
302
432
|
|
|
303
433
|
| Export | Description |
|
|
@@ -322,6 +452,90 @@ provider.addSpanProcessor(new BatchSpanProcessor(
|
|
|
322
452
|
| `withTokenmeter` (`tokenmeter/next`) | Next.js App Router wrapper |
|
|
323
453
|
| `withInngest` (`tokenmeter/inngest`) | Inngest function wrapper |
|
|
324
454
|
| `getInngestTraceHeaders` (`tokenmeter/inngest`) | Get headers for Inngest events |
|
|
455
|
+
| `telemetry` (`tokenmeter/vercel-ai`) | Vercel AI SDK telemetry settings |
|
|
456
|
+
|
|
457
|
+
## Questions Engineers Ask
|
|
458
|
+
|
|
459
|
+
### "What's the integration effort?"
|
|
460
|
+
|
|
461
|
+
One line per client. Wrap with `monitor()`, and you're done.
|
|
462
|
+
|
|
463
|
+
```typescript
|
|
464
|
+
// Before
|
|
465
|
+
const openai = new OpenAI();
|
|
466
|
+
|
|
467
|
+
// After
|
|
468
|
+
const openai = monitor(new OpenAI());
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
No changes to your API calls, no middleware, no schema migrations. TypeScript types are fully preserved—autocomplete works exactly as before.
|
|
472
|
+
|
|
473
|
+
### "What's the performance overhead?"
|
|
474
|
+
|
|
475
|
+
Near-zero. The hot path is:
|
|
476
|
+
1. A JavaScript Proxy intercepts the method call
|
|
477
|
+
2. An OTel span is created (microseconds)
|
|
478
|
+
3. Cost lookup happens synchronously from bundled pricing data
|
|
479
|
+
|
|
480
|
+
No network calls block your AI requests. Pricing manifest refresh happens in the background.
|
|
481
|
+
|
|
482
|
+
### "What happens if something fails?"
|
|
483
|
+
|
|
484
|
+
Graceful degradation everywhere:
|
|
485
|
+
|
|
486
|
+
| Scenario | Behavior |
|
|
487
|
+
|----------|----------|
|
|
488
|
+
| Pricing data unavailable | Uses bundled fallback (works offline) |
|
|
489
|
+
| Unknown model | Logs warning, `cost_usd = 0`, doesn't throw |
|
|
490
|
+
| OTel not configured | Spans are no-ops, your code still works |
|
|
491
|
+
| Stream interrupted | Partial cost still recorded |
|
|
492
|
+
|
|
493
|
+
### "Does it work with streaming responses?"
|
|
494
|
+
|
|
495
|
+
Yes, automatically. tokenmeter wraps async iterators and calculates cost when the stream completes.
|
|
496
|
+
|
|
497
|
+
For OpenAI, add `stream_options: { include_usage: true }` to get token counts in streaming mode.
|
|
498
|
+
|
|
499
|
+
### "How do I attribute costs to users/orgs?"
|
|
500
|
+
|
|
501
|
+
Wrap your request handler with `withAttributes()`. All nested AI calls inherit the context automatically via OpenTelemetry Baggage:
|
|
502
|
+
|
|
503
|
+
```typescript
|
|
504
|
+
await withAttributes({ 'user.id': userId, 'org.id': orgId }, async () => {
|
|
505
|
+
// Every AI call in here gets tagged with user.id and org.id
|
|
506
|
+
await openai.chat.completions.create({...});
|
|
507
|
+
await anthropic.messages.create({...}); // Also tagged
|
|
508
|
+
});
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### "What if my provider isn't supported?"
|
|
512
|
+
|
|
513
|
+
Use `registerProvider()` to add custom providers without forking:
|
|
514
|
+
|
|
515
|
+
```typescript
|
|
516
|
+
import { registerProvider } from 'tokenmeter';
|
|
517
|
+
|
|
518
|
+
registerProvider({
|
|
519
|
+
name: 'my-provider',
|
|
520
|
+
detect: (client) => 'myMethod' in client,
|
|
521
|
+
extractUsage: (response) => ({
|
|
522
|
+
inputUnits: response.usage?.input,
|
|
523
|
+
outputUnits: response.usage?.output,
|
|
524
|
+
}),
|
|
525
|
+
extractModel: (args) => args[0]?.model || 'default',
|
|
526
|
+
});
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
### "How accurate/up-to-date is the pricing?"
|
|
530
|
+
|
|
531
|
+
- **Bundled pricing** is compiled from official provider pricing pages at build time
|
|
532
|
+
- **Remote refresh** fetches updates from our Pricing API on startup (5-minute cache)
|
|
533
|
+
- **Model matching** handles version suffixes (e.g., `gpt-4o-2024-05-13` → `gpt-4o`) and aliases
|
|
534
|
+
- **Custom overrides** via `setModelAliases()` for fine-tuned or custom-named models
|
|
535
|
+
|
|
536
|
+
### "Can I use this without PostgreSQL?"
|
|
537
|
+
|
|
538
|
+
Yes. PostgreSQL is optional—only needed if you want to persist and query costs. The core `monitor()` and `withAttributes()` work with any OTel-compatible exporter (Datadog, Honeycomb, Jaeger, console, etc.) or no exporter at all.
|
|
325
539
|
|
|
326
540
|
## Contributing
|
|
327
541
|
|
package/dist/config.d.ts
CHANGED
|
@@ -1,92 +1,15 @@
|
|
|
1
|
-
import type { TokenmeterConfig, StorageAdapter, PricingConfig, BatchingConfig } from "./types.js";
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* TokenMeter Configuration Constants
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
* once at application startup.
|
|
7
|
-
*
|
|
8
|
-
* @param config - Configuration options
|
|
9
|
-
* @param config.databaseUrl - PostgreSQL connection URL (required if no storage adapter)
|
|
10
|
-
* @param config.storage - Custom storage adapter (overrides databaseUrl)
|
|
11
|
-
* @param config.pricing - Custom pricing overrides for models
|
|
12
|
-
* @param config.modelAliases - Map of model aliases to canonical names
|
|
13
|
-
* @param config.batching - Batching configuration (enabled, flushInterval, maxBatchSize, flushOnExit)
|
|
14
|
-
* @param config.identifierType - Label for the identifier field (documentation only)
|
|
15
|
-
*
|
|
16
|
-
* @throws Error if neither databaseUrl nor storage is provided
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* // With PostgreSQL
|
|
21
|
-
* init({
|
|
22
|
-
* databaseUrl: process.env.DATABASE_URL,
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* // With custom storage adapter
|
|
26
|
-
* init({
|
|
27
|
-
* storage: new InMemoryStorageAdapter(),
|
|
28
|
-
* });
|
|
29
|
-
*
|
|
30
|
-
* // With pricing overrides
|
|
31
|
-
* init({
|
|
32
|
-
* databaseUrl: process.env.DATABASE_URL,
|
|
33
|
-
* pricing: {
|
|
34
|
-
* "custom-model": { input: 0.001, output: 0.002 },
|
|
35
|
-
* },
|
|
36
|
-
* });
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare function init(config: TokenmeterConfig): void;
|
|
40
|
-
/**
|
|
41
|
-
* Get the current storage adapter
|
|
42
|
-
*/
|
|
43
|
-
export declare function getStorage(): StorageAdapter;
|
|
44
|
-
/**
|
|
45
|
-
* Get pricing configuration
|
|
46
|
-
*/
|
|
47
|
-
export declare function getPricing(): PricingConfig;
|
|
48
|
-
/**
|
|
49
|
-
* Get model aliases
|
|
50
|
-
*/
|
|
51
|
-
export declare function getModelAliases(): Record<string, string>;
|
|
52
|
-
/**
|
|
53
|
-
* Get batching configuration
|
|
54
|
-
*/
|
|
55
|
-
export declare function getBatching(): BatchingConfig;
|
|
56
|
-
/**
|
|
57
|
-
* Check if tokenmeter has been initialized.
|
|
58
|
-
*
|
|
59
|
-
* @returns true if init() has been called and shutdown() has not been called
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```typescript
|
|
63
|
-
* if (!isInitialized()) {
|
|
64
|
-
* init({ databaseUrl: process.env.DATABASE_URL });
|
|
65
|
-
* }
|
|
66
|
-
* ```
|
|
4
|
+
* Centralized configuration values used across the library.
|
|
67
5
|
*/
|
|
68
|
-
export declare function isInitialized(): boolean;
|
|
69
6
|
/**
|
|
70
|
-
*
|
|
7
|
+
* Package version (should match package.json)
|
|
8
|
+
* Used for OpenTelemetry tracer identification.
|
|
71
9
|
*/
|
|
72
|
-
export declare
|
|
10
|
+
export declare const VERSION = "0.9.0";
|
|
73
11
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* Disconnects from the database and resets the initialized state.
|
|
77
|
-
* Call this before reinitializing or when shutting down your application.
|
|
78
|
-
*
|
|
79
|
-
* @returns A promise that resolves when shutdown is complete
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```typescript
|
|
83
|
-
* // Graceful shutdown
|
|
84
|
-
* process.on("SIGTERM", async () => {
|
|
85
|
-
* await flush();
|
|
86
|
-
* await shutdown();
|
|
87
|
-
* process.exit(0);
|
|
88
|
-
* });
|
|
89
|
-
* ```
|
|
12
|
+
* Package name
|
|
90
13
|
*/
|
|
91
|
-
export declare
|
|
14
|
+
export declare const PACKAGE_NAME = "tokenmeter";
|
|
92
15
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B;;GAEG;AACH,eAAO,MAAM,YAAY,eAAe,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -1,166 +1,15 @@
|
|
|
1
|
-
import { PrismaStorageAdapter } from "./storage/prisma.js";
|
|
2
|
-
import { defaultPricing, mergePricing } from "./pricing/index.js";
|
|
3
|
-
import { initRecorder } from "./recorder.js";
|
|
4
1
|
/**
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
const DEFAULT_BATCHING = {
|
|
8
|
-
enabled: true,
|
|
9
|
-
flushInterval: 1000,
|
|
10
|
-
maxBatchSize: 100,
|
|
11
|
-
flushOnExit: true,
|
|
12
|
-
};
|
|
13
|
-
const state = {
|
|
14
|
-
initialized: false,
|
|
15
|
-
storage: null,
|
|
16
|
-
pricing: defaultPricing,
|
|
17
|
-
modelAliases: {},
|
|
18
|
-
batching: DEFAULT_BATCHING,
|
|
19
|
-
identifierType: "userId",
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Initialize tokenmeter with configuration.
|
|
23
|
-
*
|
|
24
|
-
* Must be called before using any tokenmeter functions. Typically called
|
|
25
|
-
* once at application startup.
|
|
26
|
-
*
|
|
27
|
-
* @param config - Configuration options
|
|
28
|
-
* @param config.databaseUrl - PostgreSQL connection URL (required if no storage adapter)
|
|
29
|
-
* @param config.storage - Custom storage adapter (overrides databaseUrl)
|
|
30
|
-
* @param config.pricing - Custom pricing overrides for models
|
|
31
|
-
* @param config.modelAliases - Map of model aliases to canonical names
|
|
32
|
-
* @param config.batching - Batching configuration (enabled, flushInterval, maxBatchSize, flushOnExit)
|
|
33
|
-
* @param config.identifierType - Label for the identifier field (documentation only)
|
|
34
|
-
*
|
|
35
|
-
* @throws Error if neither databaseUrl nor storage is provided
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```typescript
|
|
39
|
-
* // With PostgreSQL
|
|
40
|
-
* init({
|
|
41
|
-
* databaseUrl: process.env.DATABASE_URL,
|
|
42
|
-
* });
|
|
43
|
-
*
|
|
44
|
-
* // With custom storage adapter
|
|
45
|
-
* init({
|
|
46
|
-
* storage: new InMemoryStorageAdapter(),
|
|
47
|
-
* });
|
|
48
|
-
*
|
|
49
|
-
* // With pricing overrides
|
|
50
|
-
* init({
|
|
51
|
-
* databaseUrl: process.env.DATABASE_URL,
|
|
52
|
-
* pricing: {
|
|
53
|
-
* "custom-model": { input: 0.001, output: 0.002 },
|
|
54
|
-
* },
|
|
55
|
-
* });
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export function init(config) {
|
|
59
|
-
if (state.initialized) {
|
|
60
|
-
console.warn("[tokenmeter] Already initialized. Call shutdown() before reinitializing.");
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
// Set up storage adapter
|
|
64
|
-
if (config.storage) {
|
|
65
|
-
state.storage = config.storage;
|
|
66
|
-
}
|
|
67
|
-
else if (config.databaseUrl) {
|
|
68
|
-
state.storage = new PrismaStorageAdapter(config.databaseUrl);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
throw new Error("[tokenmeter] Either databaseUrl or storage adapter must be provided");
|
|
72
|
-
}
|
|
73
|
-
// Merge pricing with defaults
|
|
74
|
-
if (config.pricing) {
|
|
75
|
-
state.pricing = mergePricing(defaultPricing, config.pricing);
|
|
76
|
-
}
|
|
77
|
-
// Set model aliases
|
|
78
|
-
if (config.modelAliases) {
|
|
79
|
-
state.modelAliases = config.modelAliases;
|
|
80
|
-
}
|
|
81
|
-
// Merge batching config
|
|
82
|
-
if (config.batching) {
|
|
83
|
-
state.batching = { ...DEFAULT_BATCHING, ...config.batching };
|
|
84
|
-
}
|
|
85
|
-
// Set identifier type
|
|
86
|
-
if (config.identifierType) {
|
|
87
|
-
state.identifierType = config.identifierType;
|
|
88
|
-
}
|
|
89
|
-
state.initialized = true;
|
|
90
|
-
// Initialize recorder (registers shutdown hooks)
|
|
91
|
-
initRecorder();
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Get the current storage adapter
|
|
95
|
-
*/
|
|
96
|
-
export function getStorage() {
|
|
97
|
-
if (!state.initialized || !state.storage) {
|
|
98
|
-
throw new Error("[tokenmeter] Not initialized. Call init() before using tokenmeter.");
|
|
99
|
-
}
|
|
100
|
-
return state.storage;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Get pricing configuration
|
|
104
|
-
*/
|
|
105
|
-
export function getPricing() {
|
|
106
|
-
return state.pricing;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Get model aliases
|
|
110
|
-
*/
|
|
111
|
-
export function getModelAliases() {
|
|
112
|
-
return state.modelAliases;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Get batching configuration
|
|
116
|
-
*/
|
|
117
|
-
export function getBatching() {
|
|
118
|
-
return state.batching;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Check if tokenmeter has been initialized.
|
|
122
|
-
*
|
|
123
|
-
* @returns true if init() has been called and shutdown() has not been called
|
|
2
|
+
* TokenMeter Configuration Constants
|
|
124
3
|
*
|
|
125
|
-
*
|
|
126
|
-
* ```typescript
|
|
127
|
-
* if (!isInitialized()) {
|
|
128
|
-
* init({ databaseUrl: process.env.DATABASE_URL });
|
|
129
|
-
* }
|
|
130
|
-
* ```
|
|
4
|
+
* Centralized configuration values used across the library.
|
|
131
5
|
*/
|
|
132
|
-
export function isInitialized() {
|
|
133
|
-
return state.initialized;
|
|
134
|
-
}
|
|
135
6
|
/**
|
|
136
|
-
*
|
|
7
|
+
* Package version (should match package.json)
|
|
8
|
+
* Used for OpenTelemetry tracer identification.
|
|
137
9
|
*/
|
|
138
|
-
export
|
|
139
|
-
return state.modelAliases[model] || model;
|
|
140
|
-
}
|
|
10
|
+
export const VERSION = "0.9.0";
|
|
141
11
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* Disconnects from the database and resets the initialized state.
|
|
145
|
-
* Call this before reinitializing or when shutting down your application.
|
|
146
|
-
*
|
|
147
|
-
* @returns A promise that resolves when shutdown is complete
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```typescript
|
|
151
|
-
* // Graceful shutdown
|
|
152
|
-
* process.on("SIGTERM", async () => {
|
|
153
|
-
* await flush();
|
|
154
|
-
* await shutdown();
|
|
155
|
-
* process.exit(0);
|
|
156
|
-
* });
|
|
157
|
-
* ```
|
|
12
|
+
* Package name
|
|
158
13
|
*/
|
|
159
|
-
export
|
|
160
|
-
if (state.storage) {
|
|
161
|
-
await state.storage.disconnect();
|
|
162
|
-
state.storage = null;
|
|
163
|
-
}
|
|
164
|
-
state.initialized = false;
|
|
165
|
-
}
|
|
14
|
+
export const PACKAGE_NAME = "tokenmeter";
|
|
166
15
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgresExporter.d.ts","sourceRoot":"","sources":["../../src/exporter/PostgresExporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,sBAAsB,EAAc,MAAM,aAAa,CAAC;AAItE;;;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CAAC;IACR,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAoBD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,UAAU,CAA+C;IACjE,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,cAAc,CAAS;gBAEnB,MAAM,EAAE,sBAAsB;IAgB1C;;OAEG;YACW,OAAO;IAcrB;;OAEG;IACH,MAAM,CACJ,KAAK,EAAE,YAAY,EAAE,EACrB,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAC7C,IAAI;IAkCP;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA+BxB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAiB/B;;OAEG;IACH,OAAO,CAAC,YAAY;IAKpB;;OAEG;YACW,WAAW;IAqBzB;;OAEG;YACW,aAAa;IAgE3B;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB/B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGlC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -173,6 +173,8 @@ export class PostgresExporter {
|
|
|
173
173
|
const pool = await this.getPool();
|
|
174
174
|
const tableName = this.config.tableName;
|
|
175
175
|
// Build bulk insert query
|
|
176
|
+
// Note: Column names use snake_case convention for PostgreSQL
|
|
177
|
+
// "input_units" and "output_units" are generic to support tokens, characters, etc.
|
|
176
178
|
const columns = [
|
|
177
179
|
"id",
|
|
178
180
|
"trace_id",
|
|
@@ -182,8 +184,8 @@ export class PostgresExporter {
|
|
|
182
184
|
"organization_id",
|
|
183
185
|
"user_id",
|
|
184
186
|
"cost_usd",
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
+
"input_units",
|
|
188
|
+
"output_units",
|
|
187
189
|
"metadata",
|
|
188
190
|
"created_at",
|
|
189
191
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgresExporter.js","sourceRoot":"","sources":["../../src/exporter/PostgresExporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAgCtC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAiB;IACvB,IAAI,GAAgB,IAAI,CAAC;IACzB,MAAM,GAAiB,EAAE,CAAC;IAC1B,UAAU,GAA0C,IAAI,CAAC;IACzD,YAAY,GAAyB,IAAI,CAAC;IAC1C,cAAc,GAAG,KAAK,CAAC;IAE/B,YAAY,MAA8B;QACxC,IAAI,CAAC,MAAM,GAAG;YACZ,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,mBAAmB;YAClD,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,GAAG;YAClC,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,IAAI;SAChD,CAAC;QAEF,uBAAuB;QACvB,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;YACjC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC/B,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,OAAO;QACnB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,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G;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAE3B,mBAAmB;QACnB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,CAAC;QAED,0BAA0B;QAC1B,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAEzB,aAAa;QACb,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC;CACF;AAED,eAAe,gBAAgB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -24,8 +24,9 @@ export { monitor } from "./instrumentation/proxy.js";
|
|
|
24
24
|
export { withAttributes, withAttributesSync, getCurrentAttributes, getAttribute, extractTraceHeaders, contextFromHeaders, withExtractedContext, } from "./context.js";
|
|
25
25
|
export { TokenMeterProcessor } from "./processor/TokenMeterProcessor.js";
|
|
26
26
|
export { loadManifest, getModelPricing, calculateCost, getCachedManifest, clearManifestCache, configurePricing, getPricingConfig, setModelAliases, clearModelAliases, getModelAliases, type PricingConfig, type ModelAlias, } from "./pricing/manifest.js";
|
|
27
|
-
export type { PricingUnit, ModelPricing, ProviderPricing, PricingManifest, MonitorOptions, UsageData, ExtractionStrategy, TokenMeterAttributes, TokenMeterProcessorConfig, PostgresExporterConfig, CostRecord, CostQueryOptions, CostResult, } from "./types.js";
|
|
27
|
+
export type { PricingUnit, ModelPricing, ProviderPricing, PricingManifest, MonitorOptions, UsageData, ExtractionStrategy, StreamingCostUpdate, StreamingCostCallback, TokenMeterAttributes, TokenMeterProcessorConfig, PostgresExporterConfig, CostRecord, CostQueryOptions, CostResult, } from "./types.js";
|
|
28
28
|
export { TM_ATTRIBUTES, GEN_AI_ATTRIBUTES } from "./types.js";
|
|
29
29
|
export { configureLogger, getLoggerConfig, resetLogger, type LogLevel, type LoggerConfig, } from "./logger.js";
|
|
30
|
-
export {
|
|
30
|
+
export { TOKENMETER_PROVIDER, registerProvider, unregisterProvider, getProvider, getRegisteredProviders, clearProviderRegistry, type ProviderConfig, } from "./registry.js";
|
|
31
|
+
export { strategies, findStrategy, extractUsage, openaiStrategy, anthropicStrategy, bedrockStrategy, vertexAIStrategy, googleGenerativeAIStrategy, falStrategy, bflStrategy, elevenlabsStrategy, vercelAIStrategy, } from "./instrumentation/strategies/index.js";
|
|
31
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGrD,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,UAAU,GAChB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EAEV,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,EAEf,cAAc,EACd,SAAS,EACT,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts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
CHANGED
|
@@ -32,6 +32,8 @@ export { loadManifest, getModelPricing, calculateCost, getCachedManifest, clearM
|
|
|
32
32
|
export { TM_ATTRIBUTES, GEN_AI_ATTRIBUTES } from "./types.js";
|
|
33
33
|
// Logger configuration
|
|
34
34
|
export { configureLogger, getLoggerConfig, resetLogger, } from "./logger.js";
|
|
35
|
+
// Provider registry (for custom providers)
|
|
36
|
+
export { TOKENMETER_PROVIDER, registerProvider, unregisterProvider, getProvider, getRegisteredProviders, clearProviderRegistry, } from "./registry.js";
|
|
35
37
|
// Extraction strategies (for custom implementations)
|
|
36
|
-
export { strategies, findStrategy, extractUsage, openaiStrategy, anthropicStrategy, bedrockStrategy, vertexAIStrategy, falStrategy, bflStrategy, elevenlabsStrategy, vercelAIStrategy, } from "./instrumentation/strategies/index.js";
|
|
38
|
+
export { strategies, findStrategy, extractUsage, openaiStrategy, anthropicStrategy, bedrockStrategy, vertexAIStrategy, googleGenerativeAIStrategy, falStrategy, bflStrategy, elevenlabsStrategy, vercelAIStrategy, } from "./instrumentation/strategies/index.js";
|
|
37
39
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,uBAAuB;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,qBAAqB;AACrB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,YAAY;AACZ,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,oBAAoB;AACpB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,eAAe,GAGhB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,uBAAuB;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,qBAAqB;AACrB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,YAAY;AACZ,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,oBAAoB;AACpB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,eAAe,GAGhB,MAAM,uBAAuB,CAAC;AA2B/B,uBAAuB;AACvB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE9D,uBAAuB;AACvB,OAAO,EACL,eAAe,EACf,eAAe,EACf,WAAW,GAGZ,MAAM,aAAa,CAAC;AAErB,2CAA2C;AAC3C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,sBAAsB,EACtB,qBAAqB,GAEtB,MAAM,eAAe,CAAC;AAEvB,qDAAqD;AACrD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,uCAAuC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/instrumentation/proxy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/instrumentation/proxy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,aAAa,CAAC;AAqdrB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EACtC,MAAM,EAAE,CAAC,EACT,OAAO,GAAE,cAAmB,GAC3B,CAAC,CAkOH;AAED,eAAe,OAAO,CAAC"}
|