openvibe-sdk/modules
Generated at from
openvibe-contracts v0.33.0 and
openvibe-sdk v0.5.0.
From types/modules.d.ts (both). Declarations are shown verbatim.
type Updater
export type Updater<T> = (data: T | undefined, record: ModuleRecord | null) => T | undefined | Promise<T | undefined>;interface ModulesClient
export interface ModulesClient {
list(): Promise<{ subject: SubjectRef; modules: ModuleRecord[]; namespaces: Array<{ namespace: string; owner: string; userWritable: boolean; description?: string }> }>;
get(ns: string): Promise<ModuleRecord | null>;
put<T extends object>(ns: string, data: T, opts: { revision: number }): Promise<ModuleRecord>;
delete(ns: string): Promise<boolean>;
/** Read-modify-write; retries on 412 up to `attempts` (default 5). */
update<T extends object>(ns: string, fn: Updater<T>, opts?: { attempts?: number }): Promise<ModuleRecord | null>;
publicGet(ns: string, subjectId: string): Promise<{ subject: SubjectRef; namespace: string; version: number; data: Record<string, unknown> } | null>;
/** Service side (token with network.modules.read / .write for the namespace). */
forSubject: {
get(ns: string, subjectId: string): Promise<ModuleRecord | null>;
put<T extends object>(ns: string, subjectId: string, data: T, opts?: { revision?: number }): Promise<ModuleRecord>;
update<T extends object>(ns: string, subjectId: string, fn: Updater<T>, opts?: { attempts?: number }): Promise<ModuleRecord | null>;
};
}function createModulesClient
export declare function createModulesClient(client: OpenVibeClient, opts?: { baseUrl?: string; maxAttempts?: number }): ModulesClient;