@rushdb/javascript-sdk
Version:
RushDB Javascript SDK
34 lines (33 loc) • 1.31 kB
TypeScript
import type { HttpClient } from '../network/HttpClient.js';
import type { Schema } from '../types/index.js';
import type { DBRecord } from './record.js';
import { DBRecordInstance } from './record.js';
import type { SDKConfig, State } from './types.js';
import { RestAPI } from '../api/api.js';
export declare class RushDB extends RestAPI {
static instance: RushDB | null;
static initPromise: Promise<RushDB> | null;
static state: State;
constructor(token?: string, config?: SDKConfig);
/**
* Returns a promise that resolves when the SDK is fully initialized
* Use this to ensure the SDK is ready before using it
*/
waitForInitialization(): Promise<RushDB>;
private initializeAsync;
/**
* Static method to get or wait for initialization
* This is the preferred way to get an initialized RushDB instance
*/
static init(): Promise<RushDB>;
/**
* Synchronous getInstance that returns instance or null
*/
static getInstance(): RushDB | null;
/**
* Check if the SDK is initialized
*/
static isInitialized(): boolean;
toDBRecordInstance<S extends Schema = Schema>(record: DBRecord<S>): DBRecordInstance<S, import("../types/query.js").SearchQuery<S>>;
}
export declare const initSDK: (client: HttpClient) => void;