@junkawasaki/kawadb-orm
Version:
TypeScript ORM for KawaDB with KSQL support - works in Web and Electron environments
119 lines (118 loc) • 2.81 kB
TypeScript
/**
* KSQL関連の型定義
*/
export declare enum KsqlQueryType {
CREATE_STREAM = "CREATE_STREAM",
CREATE_TABLE = "CREATE_TABLE",
DROP_STREAM = "DROP_STREAM",
DROP_TABLE = "DROP_TABLE",
SELECT = "SELECT",
INSERT = "INSERT",
SHOW_STREAMS = "SHOW_STREAMS",
SHOW_TABLES = "SHOW_TABLES",
DESCRIBE = "DESCRIBE"
}
export declare enum KsqlDataType {
STRING = "STRING",
INTEGER = "INTEGER",
BIGINT = "BIGINT",
DOUBLE = "DOUBLE",
BOOLEAN = "BOOLEAN",
ARRAY = "ARRAY",
MAP = "MAP",
STRUCT = "STRUCT",
TIMESTAMP = "TIMESTAMP",
DATE = "DATE",
TIME = "TIME"
}
export interface KsqlColumn {
name: string;
type: KsqlDataType;
nullable: boolean;
}
export interface KsqlStream {
name: string;
columns: KsqlColumn[];
topic: string;
format: KsqlDataFormat;
partitionBy?: string;
window?: KsqlWindow;
}
export interface KsqlTable {
name: string;
columns: KsqlColumn[];
topic: string;
format: KsqlDataFormat;
primaryKey: string[];
window?: KsqlWindow;
}
export declare enum KsqlDataFormat {
JSON = "JSON",
AVRO = "AVRO",
PROTOBUF = "PROTOBUF",
DELIMITED = "DELIMITED"
}
export interface KsqlWindow {
type: 'tumbling' | 'hopping' | 'session';
size: number;
unit: 'seconds' | 'minutes' | 'hours' | 'days';
advance?: number;
grace?: number;
}
export interface KsqlResult {
success: boolean;
queryId?: string;
data?: any[];
error?: string;
schema?: KsqlColumn[];
queryType: KsqlQueryType;
}
export interface ContinuousQuery {
id: string;
name: string;
sql: string;
status: QueryStatus;
statistics: QueryStatistics;
inputSources: string[];
outputTarget: string;
createdAt: Date;
lastExecution?: Date;
}
export declare enum QueryStatus {
RUNNING = "RUNNING",
STOPPED = "STOPPED",
ERROR = "ERROR",
PAUSED = "PAUSED"
}
export interface QueryStatistics {
messagesProcessed: number;
resultsProduced: number;
averageProcessingTime: number;
lastError?: string;
throughput: number;
memoryUsage: number;
}
export interface StreamingResult {
queryId: string;
data: any[];
timestamp: Date;
metadata: Record<string, any>;
}
export interface KsqlConfig {
processingGuarantee?: 'at_least_once' | 'exactly_once';
cacheMaxBytesBuffering?: number;
commitIntervalMs?: number;
numStreamThreads?: number;
defaultTimestampExtractor?: string;
defaultKeySerdeClass?: string;
defaultValueSerdeClass?: string;
}
export interface KsqlEngineStats {
totalStreams: number;
totalTables: number;
totalQueries: number;
runningQueries: number;
messagesPerSecond: number;
memoryUsage: number;
cpuUsage: number;
}