feat: TypeScript telemetry client SDK v0.1.0
Standalone npm package (@mosaicstack/telemetry-client) for reporting task-completion telemetry and querying predictions from the Mosaic Stack Telemetry server. - TelemetryClient with setInterval-based background flush - EventQueue (bounded FIFO array) - BatchSubmitter with native fetch, exponential backoff, Retry-After - PredictionCache (Map + TTL) - EventBuilder with auto-generated event_id/timestamp - Zero runtime dependencies (Node 18+ native APIs) - 43 tests, 86% branch coverage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
26
src/types/common.ts
Normal file
26
src/types/common.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { TaskCompletionEvent } from './events.js';
|
||||
import { PredictionQuery, PredictionResponse } from './predictions.js';
|
||||
|
||||
export interface BatchEventRequest {
|
||||
events: TaskCompletionEvent[];
|
||||
}
|
||||
|
||||
export interface BatchEventResult {
|
||||
event_id: string;
|
||||
status: 'accepted' | 'rejected';
|
||||
error?: string | null;
|
||||
}
|
||||
|
||||
export interface BatchEventResponse {
|
||||
accepted: number;
|
||||
rejected: number;
|
||||
results: BatchEventResult[];
|
||||
}
|
||||
|
||||
export interface BatchPredictionRequest {
|
||||
queries: PredictionQuery[];
|
||||
}
|
||||
|
||||
export interface BatchPredictionResponse {
|
||||
results: PredictionResponse[];
|
||||
}
|
||||
Reference in New Issue
Block a user