UNPKG

@chittyos/chittycontextual-client

Version:

TypeScript client for ChittyContextul cross-source temporal intelligence platform

236 lines (233 loc) 7.04 kB
type MessageSource = "imessage" | "whatsapp" | "email" | "docusign" | "openphone"; type ProcessingStatus = "pending" | "processing" | "completed" | "failed"; type EntityType = "person" | "organization" | "amount" | "location" | "date"; type CrossRefType = "temporal" | "semantic" | "entity-based"; interface TimeRange { start: Date | string; end: Date | string; } interface Message { messageId: number; source: MessageSource; externalId?: string; externalThreadId?: string; direction?: string; senderPartyId?: number; subject?: string; bodyText?: string; contentHash?: string; sentAt: string; receivedAt?: string; createdAt: string; } interface SearchMessagesParams { query: string; timeRange?: TimeRange; } interface TimelineParams { start: Date | string; end: Date | string; } interface Document { documentId: number; fileName: string; mimeType: string; filePath: string; extractedText: string; status: ProcessingStatus; metadata?: Record<string, any>; createdAt: string; processedAt?: string; } interface UploadProgressCallback { (progress: number, loaded: number, total: number): void; } interface UploadDocumentsResult { message: string; documents: Document[]; } interface Topic { topicId: number; name: string; description?: string; keywords: string[]; createdAt: string; } interface TopicAnalysis { topicAnalysisId: number; contentId: number; contentType: "message" | "document"; topicId: number; relevanceScore: number; context?: string; analyzedAt: string; } interface TopicEvolution { date: string; messageCount: number; relevanceScore: number; topicName: string; } interface Entity { entityId: number; type: EntityType; value: string; normalizedValue: string; createdAt: string; } interface EntityExtraction { extractionId: number; contentId: number; contentType: "message" | "document"; entityId: number; confidence: number; context?: string; extractedAt: string; } interface CrossReference { crossRefId: number; sourceContentId: number; sourceContentType: "message" | "document"; targetContentId: number; targetContentType: "message" | "document"; referenceType: CrossRefType; strength: number; confidence: number; description?: string; createdAt: string; } interface CrossReferenceAnalysisParams { start: Date | string; end: Date | string; } interface CrossReferenceResult { correlations: Array<{ sourceId: number; targetId: number; type: CrossRefType; strength: number; confidence: number; description: string; }>; } interface SourceCorrelation { source: MessageSource; correlatedSource: MessageSource; correlationCount: number; averageTimeDelta: number; } interface ProcessingStats { documentsProcessed: number; entitiesExtracted: number; accuracy: number; } interface BulkAnalysisParams { start: Date | string; end: Date | string; } interface BulkAnalysisResult { processed: number; total: number; message: string; } interface ComprehensiveAnalysisParams { start: Date | string; end: Date | string; focusTopics?: string[]; focusParties?: string[]; } interface ComprehensiveAnalysisResult { [key: string]: any; } interface IntelligentSearchParams { q: string; party?: string; source?: MessageSource; start?: Date | string; end?: Date | string; } interface IntelligentSearchResult { messageId: number; source: MessageSource; subject?: string; bodyText?: string; sentAt: string; relevanceScore?: number; } interface PartyLearningParams { partyIdentifier: string; timeframe?: string; } interface PartyLearningResult { partyIdentifier: string; messagesAnalyzed: number; patternsLearned?: Record<string, any>; status: "learning_completed" | "no_content_to_learn"; } interface ClientConfig { baseUrl?: string; apiKey?: string; timeout?: number; retryAttempts?: number; retryDelay?: number; } interface ErrorResponse { error: string; message?: string; statusCode?: number; } declare class ChittyContextualClient { private baseUrl; private apiKey?; private timeout; private retryAttempts; private retryDelay; constructor(config?: ClientConfig); private request; private formatDate; messages: { list: (options?: { limit?: number; }) => Promise<Message[]>; search: (params: SearchMessagesParams) => Promise<Message[]>; timeline: (params: TimelineParams) => Promise<Message[]>; }; documents: { upload: (files: File[], onProgress?: UploadProgressCallback) => Promise<UploadDocumentsResult>; list: () => Promise<Document[]>; }; topics: { list: () => Promise<Topic[]>; analysis: (timeRange?: { start: Date | string; end: Date | string; }) => Promise<TopicAnalysis[]>; evolution: (topicId: number, timeRange: { start: Date | string; end: Date | string; }) => Promise<TopicEvolution[]>; }; entities: { list: () => Promise<Entity[]>; extractions: () => Promise<EntityExtraction[]>; }; crossReferences: { list: () => Promise<CrossReference[]>; analyze: (params: CrossReferenceAnalysisParams) => Promise<CrossReferenceResult>; }; analytics: { correlations: () => Promise<SourceCorrelation[]>; stats: () => Promise<ProcessingStats>; }; analyze: { bulk: (params: BulkAnalysisParams) => Promise<BulkAnalysisResult>; comprehensive: (params: ComprehensiveAnalysisParams) => Promise<ComprehensiveAnalysisResult>; }; search: { intelligent: (params: IntelligentSearchParams) => Promise<IntelligentSearchResult[]>; }; parties: { learn: (params: PartyLearningParams) => Promise<PartyLearningResult>; }; } export { type BulkAnalysisResult as B, ChittyContextualClient as C, type Document as D, type Entity as E, type IntelligentSearchParams as I, type Message as M, type ProcessingStats as P, type SearchMessagesParams as S, type TimelineParams as T, type UploadProgressCallback as U, type UploadDocumentsResult as a, type Topic as b, type TopicAnalysis as c, type TopicEvolution as d, type EntityExtraction as e, type CrossReference as f, type CrossReferenceResult as g, type CrossReferenceAnalysisParams as h, type SourceCorrelation as i, type BulkAnalysisParams as j, type ComprehensiveAnalysisResult as k, type ComprehensiveAnalysisParams as l, type IntelligentSearchResult as m, type PartyLearningResult as n, type PartyLearningParams as o, type ClientConfig as p, type MessageSource as q, type ProcessingStatus as r, type EntityType as s, type CrossRefType as t, type TimeRange as u, type ErrorResponse as v };