UNPKG

@adpt/core

Version:
34 lines 1.34 kB
/// <reference types="node" /> import { URL } from "url"; import { HistoryStore } from "./history"; import { AdaptServer, DeleteOptions, GetOptions, ServerLock, ServerOptions, SetOptions } from "./server"; import { Locker, ServerBase } from "./server_base"; export interface LocalServerOptions extends ServerOptions { init?: boolean; } export interface FileLock extends ServerLock { release: () => Promise<void>; } export declare class FileLocker implements Locker<FileLock> { filename: string; constructor(filename: string); lock(): Promise<FileLock>; unlock(l: FileLock): Promise<void>; } export declare const dbFilename = "adapt_local.json"; export declare class LocalServer extends ServerBase<FileLock> implements AdaptServer { static urlMatch: RegExp; private db; private rootDir; private filename; private options; private historyStores; constructor(url: URL, options: Partial<LocalServerOptions>); init(): Promise<void>; destroy(): Promise<void>; set(dataPath: string, val: any, options?: SetOptions): Promise<void>; get(dataPath: string, options?: GetOptions): Promise<any>; delete(dataPath: string, options?: DeleteOptions): Promise<void>; historyStore(dataPath: string, init: boolean): Promise<HistoryStore>; } //# sourceMappingURL=local_server.d.ts.map