axiodb
Version:
The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platfor
72 lines (71 loc) • 1.54 kB
TypeScript
import { CommandType } from './command.types';
/**
* TCP Request structure
* Sent from client to server
*/
export interface TCPRequest {
id: string;
command: CommandType;
params: {
dbName?: string;
collectionName?: string;
crypto?: boolean;
key?: string;
data?: any;
documents?: any[];
query?: object;
id?: string;
updateData?: object;
updateOne?: boolean;
deleteOne?: boolean;
limit?: number;
skip?: number;
sort?: object;
findOne?: boolean;
pipeline?: object[];
fieldNames?: string[];
indexName?: string;
transactionId?: string;
};
}
/**
* TCP Response structure
* Sent from server to client
*/
export interface TCPResponse {
id: string;
statusCode: number;
message: string;
data?: any;
error?: string;
}
/**
* Connection state
*/
export declare enum ConnectionState {
DISCONNECTED = "DISCONNECTED",
CONNECTING = "CONNECTING",
CONNECTED = "CONNECTED",
RECONNECTING = "RECONNECTING",
FAILED = "FAILED"
}
/**
* Pending request tracking
*/
export interface PendingRequest {
resolve: (value: any) => void;
reject: (error: Error) => void;
timeout: NodeJS.Timeout;
timestamp: number;
}
/**
* Connection options
*/
export interface ConnectionOptions {
host: string;
port: number;
timeout?: number;
reconnectAttempts?: number;
reconnectDelay?: number;
heartbeatInterval?: number;
}