debux-typescript
v1.0.28
Published
Debux SDK for TypeScript
Readme
debux-typescript
Debux SDK for tracking functions in plain TypeScript environments.
Installation
npm install debux-typescriptimport { DebuxTS } from "debux-typescript";
const debux = new DebuxTS({ apiKey: "your-api-key" });
const trackedFn = debux.track((x: number) => x * 2);
console.log(trackedFn(5)); // 102. Implementation
src/index.ts
import { DebuxCore, type DebuxConfig } from "debux-core";
export class DebuxTS extends DebuxCore {
constructor(config: DebuxConfig) {
super(config);
}
// Override to set framework as "typescript"
protected getFramework(): string {
return "typescript";
}
// Public track method with simpler options for TS users
public track<T extends (...args: any[]) => any>(
fn: T,
options: {
name?: string;
context?: Record<string, string>;
tags?: string[];
} = {}
): T {
return super.track(fn, {
...options,
filepath: "manual.ts", // Default for manual tracking; plugin overrides this
});
}
}
export default DebuxTS;