Download packages/node-sdk/test/telemetry.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 586 Bytes
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/node-sdk/test/telemetry.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/node-sdk/test/telemetry.ts
-
curl -L -o telemetry.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/node-sdk/test/telemetry.ts
586 Bytes
| import type { TelemetryClient, TelemetryProperties } from '#/index'; | |
| export interface TelemetryRecord { | |
| readonly event: string; | |
| readonly sessionId: string | null; | |
| readonly properties?: TelemetryProperties; | |
| } | |
| export function recordingTelemetry(records: TelemetryRecord[]): TelemetryClient { | |
| return { | |
| track: (event, properties) => { | |
| records.push({ event, sessionId: null, properties }); | |
| }, | |
| withContext: (patch) => ({ | |
| track: (event, properties) => { | |
| records.push({ event, sessionId: patch.sessionId ?? null, properties }); | |
| }, | |
| }), | |
| }; | |
| } | |