@boundaryml/baml
Advanced tools
Comparing version 0.32.0 to 0.33.0
@@ -10,4 +10,3 @@ import { BamlSpan, RuntimeContextManager, BamlRuntime } from './native'; | ||
startTraceAsync(name: string, args: Record<string, any>): BamlSpan; | ||
endTrace(span: BamlSpan, response: any): Promise<void>; | ||
endTraceSync(span: BamlSpan, response: any): void; | ||
endTrace(span: BamlSpan, response: any): void; | ||
flush(): void; | ||
@@ -14,0 +13,0 @@ traceFnSync<ReturnType, F extends (...args: any[]) => ReturnType>(name: string, func: F): F; |
@@ -41,3 +41,3 @@ "use strict"; | ||
} | ||
async endTrace(span, response) { | ||
endTrace(span, response) { | ||
const manager = this.ctx.getStore(); | ||
@@ -48,12 +48,4 @@ if (!manager) { | ||
} | ||
await span.finish(response, manager); | ||
span.finish(response, manager); | ||
} | ||
endTraceSync(span, response) { | ||
const manager = this.ctx.getStore(); | ||
if (!manager) { | ||
console.error('Context lost before span could be finished\n'); | ||
return; | ||
} | ||
span.finishSync(response, manager); | ||
} | ||
flush() { | ||
@@ -71,7 +63,7 @@ this.rt.flush(); | ||
const response = func(...args); | ||
this.endTraceSync(span, response); | ||
this.endTrace(span, response); | ||
return response; | ||
} | ||
catch (e) { | ||
this.endTraceSync(span, e); | ||
this.endTrace(span, e); | ||
throw e; | ||
@@ -91,7 +83,7 @@ } | ||
const response = await func(...args); | ||
await this.endTrace(span, response); | ||
this.endTrace(span, response); | ||
return response; | ||
} | ||
catch (e) { | ||
await this.endTrace(span, e); | ||
this.endTrace(span, e); | ||
throw e; | ||
@@ -98,0 +90,0 @@ } |
@@ -23,4 +23,3 @@ /* auto-generated by NAPI-RS */ | ||
static new(runtime: BamlRuntime, functionName: string, args: any, ctx: RuntimeContextManager): BamlSpan | ||
finish(result: any, ctx: RuntimeContextManager): Promise<any> | ||
finishSync(result: any, ctx: RuntimeContextManager): any | ||
finish(result: any, ctx: RuntimeContextManager): any | ||
} | ||
@@ -27,0 +26,0 @@ |
{ | ||
"name": "@boundaryml/baml", | ||
"version": "0.32.0", | ||
"version": "0.33.0", | ||
"description": "BAML typescript bindings (package.json)", | ||
@@ -81,9 +81,9 @@ "repository": { | ||
"optionalDependencies": { | ||
"@boundaryml/baml-darwin-arm64": "0.32.0", | ||
"@boundaryml/baml-win32-arm64-msvc": "0.32.0", | ||
"@boundaryml/baml-linux-arm64-gnu": "0.32.0", | ||
"@boundaryml/baml-darwin-x64": "0.32.0", | ||
"@boundaryml/baml-win32-x64-msvc": "0.32.0", | ||
"@boundaryml/baml-linux-x64-gnu": "0.32.0" | ||
"@boundaryml/baml-darwin-arm64": "0.33.0", | ||
"@boundaryml/baml-win32-arm64-msvc": "0.33.0", | ||
"@boundaryml/baml-linux-arm64-gnu": "0.33.0", | ||
"@boundaryml/baml-darwin-x64": "0.33.0", | ||
"@boundaryml/baml-win32-x64-msvc": "0.33.0", | ||
"@boundaryml/baml-linux-x64-gnu": "0.33.0" | ||
} | ||
} |
22333
610