@bitfab/sdk 0.36.4 → 0.36.5
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-6AXY24UL.js → chunk-FLP6CNRE.js} +2 -2
- package/dist/{chunk-6AXY24UL.js.map → chunk-FLP6CNRE.js.map} +1 -1
- package/dist/{chunk-5NT3VGCB.js → chunk-IYHBVIPJ.js} +60 -5
- package/dist/{chunk-5NT3VGCB.js.map → chunk-IYHBVIPJ.js.map} +1 -1
- package/dist/index.cjs +58 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +67 -2
- package/dist/index.d.ts +67 -2
- package/dist/index.js +2 -2
- package/dist/node.cjs +58 -3
- 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-JGMOJEW2.js} +2 -2
- package/package.json +2 -2
- /package/dist/{replay-EBDSNUIO.js.map → replay-JGMOJEW2.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var __version__;
|
|
|
42
42
|
var init_version_generated = __esm({
|
|
43
43
|
"src/version.generated.ts"() {
|
|
44
44
|
"use strict";
|
|
45
|
-
__version__ = "0.36.
|
|
45
|
+
__version__ = "0.36.5";
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
|
|
@@ -5768,7 +5768,7 @@ var Bitfab = class {
|
|
|
5768
5768
|
}
|
|
5769
5769
|
};
|
|
5770
5770
|
executeWithContext = () => {
|
|
5771
|
-
const result = fn(
|
|
5771
|
+
const result = fn.apply(this, args);
|
|
5772
5772
|
if (result instanceof Promise) {
|
|
5773
5773
|
return result.then((resolvedResult) => {
|
|
5774
5774
|
recordSpan(resolvedResult);
|
|
@@ -5798,7 +5798,7 @@ var Bitfab = class {
|
|
|
5798
5798
|
`withSpan-setup:${traceFunctionKey}`,
|
|
5799
5799
|
`tracing setup failed for "${traceFunctionKey}"; running it untraced. The function still runs and returns normally; no span is recorded.`
|
|
5800
5800
|
);
|
|
5801
|
-
return fn(
|
|
5801
|
+
return fn.apply(this, args);
|
|
5802
5802
|
}
|
|
5803
5803
|
return runWithSpanStack(newStack, executeWithContext);
|
|
5804
5804
|
};
|
|
@@ -5807,6 +5807,40 @@ var Bitfab = class {
|
|
|
5807
5807
|
});
|
|
5808
5808
|
return wrappedFn;
|
|
5809
5809
|
}
|
|
5810
|
+
/**
|
|
5811
|
+
* Create a standard ECMAScript method decorator that records each invocation
|
|
5812
|
+
* as a span.
|
|
5813
|
+
*
|
|
5814
|
+
* It supports instance, static, and private methods; use
|
|
5815
|
+
* {@link Bitfab.withSpan} for standalone functions, class fields, and
|
|
5816
|
+
* accessors.
|
|
5817
|
+
*
|
|
5818
|
+
* @example
|
|
5819
|
+
* ```typescript
|
|
5820
|
+
* const bitfab = new Bitfab({ apiKey: process.env.BITFAB_API_KEY });
|
|
5821
|
+
*
|
|
5822
|
+
* class OrderService {
|
|
5823
|
+
* @bitfab.span("order-processing", { type: "agent" })
|
|
5824
|
+
* async process(orderId: string) {
|
|
5825
|
+
* return { orderId };
|
|
5826
|
+
* }
|
|
5827
|
+
* }
|
|
5828
|
+
* ```
|
|
5829
|
+
*
|
|
5830
|
+
* @param traceFunctionKey - A string identifier for grouping spans
|
|
5831
|
+
* @param options - Span configuration applied to the decorated method
|
|
5832
|
+
* @returns A standard ECMAScript method decorator
|
|
5833
|
+
*/
|
|
5834
|
+
span(traceFunctionKey, options = {}) {
|
|
5835
|
+
return (originalMethod, context) => {
|
|
5836
|
+
if (context.kind !== "method") {
|
|
5837
|
+
throw new BitfabError(
|
|
5838
|
+
`Bitfab span decorators can only decorate methods; ${String(context.name)} is a ${context.kind}`
|
|
5839
|
+
);
|
|
5840
|
+
}
|
|
5841
|
+
return this.withSpan(traceFunctionKey, options, originalMethod);
|
|
5842
|
+
};
|
|
5843
|
+
}
|
|
5810
5844
|
/**
|
|
5811
5845
|
* Get a detached handle to a previously-created trace, looked up by the
|
|
5812
5846
|
* canonical Bitfab trace ID.
|
|
@@ -6083,6 +6117,27 @@ var BitfabFunction = class {
|
|
|
6083
6117
|
const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
|
|
6084
6118
|
return this.client.withSpan(this.traceFunctionKey, options, fn);
|
|
6085
6119
|
}
|
|
6120
|
+
/**
|
|
6121
|
+
* Create a standard ECMAScript method decorator bound to this function key.
|
|
6122
|
+
*
|
|
6123
|
+
* @example
|
|
6124
|
+
* ```typescript
|
|
6125
|
+
* const orders = client.getFunction("order-processing");
|
|
6126
|
+
*
|
|
6127
|
+
* class OrderService {
|
|
6128
|
+
* @orders.span({ type: "agent" })
|
|
6129
|
+
* async process(orderId: string) {
|
|
6130
|
+
* return { orderId };
|
|
6131
|
+
* }
|
|
6132
|
+
* }
|
|
6133
|
+
* ```
|
|
6134
|
+
*
|
|
6135
|
+
* @param options - Span configuration applied to the decorated method
|
|
6136
|
+
* @returns A standard ECMAScript method decorator
|
|
6137
|
+
*/
|
|
6138
|
+
span(options = {}) {
|
|
6139
|
+
return this.client.span(this.traceFunctionKey, options);
|
|
6140
|
+
}
|
|
6086
6141
|
/**
|
|
6087
6142
|
* Get a Vercel AI SDK language-model middleware bound to this function's key.
|
|
6088
6143
|
*
|