Files
ChatLab/packages/parser-native/index.d.ts
T

60 lines
1.9 KiB
TypeScript

/* auto-generated by NAPI-RS */
/* eslint-disable */
/**
* Unified Rust parser for all native-first formats. Usage from JS:
* `parse()` → `metaJson()` → `takeMembers()` → `takeBatch()` until null →
* `summaryJson()`. Constructing with an unknown format id throws, which the
* TS wrapper treats like any other native failure (falls back to TS).
*/
export declare class NativeParser {
constructor(formatId: string, filePath: string, optionsJson?: string | undefined | null)
/** Run the full parse on the libuv thread pool. */
parse(): Promise<unknown>
/** Poll progress while `parse()` is pending. */
progress(): NativeParseProgress
/** Format-specific meta as a JSON string (shape documented per kernel). */
metaJson(): string
/** Move members out to JS. Callable once. */
takeMembers(): Array<NativeMember>
/** Move the next batch of messages out to JS; null when exhausted. */
takeBatch(size: number): Array<NativeMessage> | null
/**
* Post-parse totals as JSON: `{"messageCount":n,"memberCount":n}`.
* Valid any time after `parse()`, even once the vectors are drained.
*/
summaryJson(): string
}
export interface NativeMember {
platformId: string
accountName: string
groupNickname?: string
avatar?: string
roles?: Array<NativeMemberRole>
}
export interface NativeMemberRole {
id: string
/** Present only when the source role object had a `name` key. */
name?: string
}
export interface NativeMessage {
platformMessageId?: string
senderPlatformId: string
senderAccountName: string
senderGroupNickname?: string
/** None when the source timestamp was JSON null (importer skips those). */
timestamp?: number
/** Numeric MessageType enum value from shared-types. */
messageType: number
content?: string
replyToMessageId?: string
}
export interface NativeParseProgress {
bytesRead: number
totalBytes: number
messagesProcessed: number
}