@bitfab/sdk 0.36.4 → 0.36.6
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/dist/{chunk-5NT3VGCB.js → chunk-BXWUPEC4.js} +60 -5
- package/dist/{chunk-5NT3VGCB.js.map → chunk-BXWUPEC4.js.map} +1 -1
- package/dist/{chunk-6AXY24UL.js → chunk-ENOQ2K2H.js} +49 -21
- package/dist/{chunk-6AXY24UL.js.map → chunk-ENOQ2K2H.js.map} +1 -1
- package/dist/index.cjs +105 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +136 -27
- package/dist/index.d.ts +136 -27
- package/dist/index.js +2 -2
- package/dist/node.cjs +105 -22
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-EBDSNUIO.js → replay-A757QXXM.js} +2 -2
- package/package.json +2 -2
- /package/dist/{replay-EBDSNUIO.js.map → replay-A757QXXM.js.map} +0 -0
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
toJsonSafe,
|
|
17
17
|
toJsonSafeReport,
|
|
18
18
|
warnOnce
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ENOQ2K2H.js";
|
|
20
20
|
|
|
21
21
|
// src/processorPayload.ts
|
|
22
22
|
var SERIALIZATION_DEGRADED_STEP = "serialization_degraded";
|
|
@@ -3064,7 +3064,7 @@ var Bitfab = class {
|
|
|
3064
3064
|
}
|
|
3065
3065
|
};
|
|
3066
3066
|
executeWithContext = () => {
|
|
3067
|
-
const result = fn(
|
|
3067
|
+
const result = fn.apply(this, args);
|
|
3068
3068
|
if (result instanceof Promise) {
|
|
3069
3069
|
return result.then((resolvedResult) => {
|
|
3070
3070
|
recordSpan(resolvedResult);
|
|
@@ -3094,7 +3094,7 @@ var Bitfab = class {
|
|
|
3094
3094
|
`withSpan-setup:${traceFunctionKey}`,
|
|
3095
3095
|
`tracing setup failed for "${traceFunctionKey}"; running it untraced. The function still runs and returns normally; no span is recorded.`
|
|
3096
3096
|
);
|
|
3097
|
-
return fn(
|
|
3097
|
+
return fn.apply(this, args);
|
|
3098
3098
|
}
|
|
3099
3099
|
return runWithSpanStack(newStack, executeWithContext);
|
|
3100
3100
|
};
|
|
@@ -3103,6 +3103,40 @@ var Bitfab = class {
|
|
|
3103
3103
|
});
|
|
3104
3104
|
return wrappedFn;
|
|
3105
3105
|
}
|
|
3106
|
+
/**
|
|
3107
|
+
* Create a standard ECMAScript method decorator that records each invocation
|
|
3108
|
+
* as a span.
|
|
3109
|
+
*
|
|
3110
|
+
* It supports instance, static, and private methods; use
|
|
3111
|
+
* {@link Bitfab.withSpan} for standalone functions, class fields, and
|
|
3112
|
+
* accessors.
|
|
3113
|
+
*
|
|
3114
|
+
* @example
|
|
3115
|
+
* ```typescript
|
|
3116
|
+
* const bitfab = new Bitfab({ apiKey: process.env.BITFAB_API_KEY });
|
|
3117
|
+
*
|
|
3118
|
+
* class OrderService {
|
|
3119
|
+
* @bitfab.span("order-processing", { type: "agent" })
|
|
3120
|
+
* async process(orderId: string) {
|
|
3121
|
+
* return { orderId };
|
|
3122
|
+
* }
|
|
3123
|
+
* }
|
|
3124
|
+
* ```
|
|
3125
|
+
*
|
|
3126
|
+
* @param traceFunctionKey - A string identifier for grouping spans
|
|
3127
|
+
* @param options - Span configuration applied to the decorated method
|
|
3128
|
+
* @returns A standard ECMAScript method decorator
|
|
3129
|
+
*/
|
|
3130
|
+
span(traceFunctionKey, options = {}) {
|
|
3131
|
+
return (originalMethod, context) => {
|
|
3132
|
+
if (context.kind !== "method") {
|
|
3133
|
+
throw new BitfabError(
|
|
3134
|
+
`Bitfab span decorators can only decorate methods; ${String(context.name)} is a ${context.kind}`
|
|
3135
|
+
);
|
|
3136
|
+
}
|
|
3137
|
+
return this.withSpan(traceFunctionKey, options, originalMethod);
|
|
3138
|
+
};
|
|
3139
|
+
}
|
|
3106
3140
|
/**
|
|
3107
3141
|
* Get a detached handle to a previously-created trace, looked up by the
|
|
3108
3142
|
* canonical Bitfab trace ID.
|
|
@@ -3337,7 +3371,7 @@ var Bitfab = class {
|
|
|
3337
3371
|
`Function is wrapped with trace function key '${wrappedKey}' but replay was called with '${traceFunctionKey}'. Pass matching keys, or pass the unwrapped function to replay it under the explicit key.`
|
|
3338
3372
|
);
|
|
3339
3373
|
}
|
|
3340
|
-
const { replay: doReplay } = await import("./replay-
|
|
3374
|
+
const { replay: doReplay } = await import("./replay-A757QXXM.js");
|
|
3341
3375
|
return doReplay(
|
|
3342
3376
|
this.httpClient,
|
|
3343
3377
|
this.serviceUrl,
|
|
@@ -3379,6 +3413,27 @@ var BitfabFunction = class {
|
|
|
3379
3413
|
const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
|
|
3380
3414
|
return this.client.withSpan(this.traceFunctionKey, options, fn);
|
|
3381
3415
|
}
|
|
3416
|
+
/**
|
|
3417
|
+
* Create a standard ECMAScript method decorator bound to this function key.
|
|
3418
|
+
*
|
|
3419
|
+
* @example
|
|
3420
|
+
* ```typescript
|
|
3421
|
+
* const orders = client.getFunction("order-processing");
|
|
3422
|
+
*
|
|
3423
|
+
* class OrderService {
|
|
3424
|
+
* @orders.span({ type: "agent" })
|
|
3425
|
+
* async process(orderId: string) {
|
|
3426
|
+
* return { orderId };
|
|
3427
|
+
* }
|
|
3428
|
+
* }
|
|
3429
|
+
* ```
|
|
3430
|
+
*
|
|
3431
|
+
* @param options - Span configuration applied to the decorated method
|
|
3432
|
+
* @returns A standard ECMAScript method decorator
|
|
3433
|
+
*/
|
|
3434
|
+
span(options = {}) {
|
|
3435
|
+
return this.client.span(this.traceFunctionKey, options);
|
|
3436
|
+
}
|
|
3382
3437
|
/**
|
|
3383
3438
|
* Get a Vercel AI SDK language-model middleware bound to this function's key.
|
|
3384
3439
|
*
|
|
@@ -3554,4 +3609,4 @@ export {
|
|
|
3554
3609
|
BitfabFunction,
|
|
3555
3610
|
finalizers
|
|
3556
3611
|
};
|
|
3557
|
-
//# sourceMappingURL=chunk-
|
|
3612
|
+
//# sourceMappingURL=chunk-BXWUPEC4.js.map
|