sjursen-digital-watchtower
Version:
A TypeScript Node.js SDK for Watchtower, an Intelligence as a Service (IaaS) platform that uses Google's Gemini AI model to transform traditional logging into an active intelligence system with predictive analytics and automated decision-making capabiliti
135 lines (122 loc) • 2.66 kB
text/typescript
export interface LogMetric {
name: string;
friendly_name: string;
value: {
type: 'number' | 'string' | 'boolean';
value: number | string | boolean;
};
unit: string;
}
export interface LogEntry {
event_id: string;
item_id: string;
timestamp: string;
friendly_name: string;
purpose?: string;
context?: string;
level?: string;
message?: string;
metadata?: Record<string, string>;
metrics?: LogMetric[];
}
export interface CreateLogRequest {
organization_apikey: string;
app_apikey: string;
tenant_apikey?: string;
log_entry: LogEntry;
}
export interface BatchLog {
event_id: string;
item_id: string;
timestamp: string;
friendly_name?: string;
purpose?: string;
context?: string;
level?: string;
message?: string;
metadata?: Record<string, any>;
metrics?: Array<{
name: string;
friendly_name: string;
value: any;
unit: string;
}>;
}
export interface BatchLogRequest {
organization_apikey: string;
app_apikey: string;
tenant_apikey?: string;
logs: BatchLog[];
}
export interface BatchLogResponse {
success_count: number;
failed_count: number;
failed_logs?: string[];
}
export interface GetLogsRequest {
organization_apikey: string;
app_apikey: string;
tenant_apikey?: string;
item_id: string;
page_size: number;
page: number;
before?: string;
after?: string;
}
export interface LogData {
item_id: string;
timestamp: string;
purpose?: string;
context?: string;
level?: string;
message?: string;
friendly_name?: string;
metadata?: Record<string, any>;
metrics?: Array<{
name: string;
friendly_name: string;
value: any;
unit: string;
}>;
}
export interface Log {
id: number;
app_id: string;
tenant_id?: string;
item_id: string;
friendly_name?: string;
log_data: LogData;
created_at: string;
}
export interface PaginatedLogResponse {
logs: Log[];
total_count: number;
page_size: number;
page: number;
total_pages: number;
has_more: boolean;
}
export interface GetLatestLogsRequest {
organization_apikey: string;
app_apikey: string;
tenant_apikey?: string;
item_id: string;
limit?: number;
}
export interface LatestLogsResponse {
logs: Log[];
}
export interface GetLogByIdRequest {
organization_apikey: string;
app_apikey: string;
tenant_apikey?: string;
}
export interface LogResponse {
id: number;
app_id: string;
tenant_id?: string;
item_id: string;
friendly_name?: string;
log_data: LogData;
created_at: string;
}