openvibe-sdk/account-data
Generated at from
openvibe-contracts v0.114.0 and
openvibe-sdk v0.37.0.
From types/account-data.d.ts (server only). Declarations are shown verbatim.
interface AccountDataTable
A table holding a person's rows here.
export interface AccountDataTable {
table: string;
/** The column naming the person. */
subject: string;
/** usr_… → what the subject column stores (default: the id itself); may return several forms. */
value?: (subject: string) => string | string[];
/** The export file (default '<table>.json'); null leaves the table out of the export. */
file?: string | null;
/** The exported columns (default: all). */
columns?: string[];
/** The export order column (default created_at, else the first column). */
order?: string;
/** 'delete' (default), { anonymize: { column: value } } (subject column NULL, row kept) or { keep: why }. */
erase?: 'delete' | { anonymize: Record<string, unknown> } | { keep: string };
/** The name the counts use (default: the table). */
kind?: string;
}interface ExportFile
export interface ExportFile { name: string; content: unknown }interface ExportPart
export interface ExportPart { subject: string; files: ExportFile[]; truncated: string[]; note?: string }interface EraseCounts
export interface EraseCounts { erased: Record<string, number>; retained: Record<string, number> }type AccountDataOutcome
export type AccountDataOutcome = 'exported' | 'erased' | 'confirmed' | 'closed' | 'unchanged' | `ignored:${string}`;type NetworkSend
export type NetworkSend = (path: string, body: unknown) => Promise<Response>;interface AccountData
export interface AccountData {
apply(event: { event_type: string; source?: string; event_id?: string; payload?: unknown }, opts: { send: NetworkSend }): Promise<AccountDataOutcome>;
exportPart(subject: string): Promise<ExportPart>;
erase(subjects: string[]): Promise<EraseCounts>;
ensureSchema(): Promise<void>;
/** POST /internal/events handler (no body parser before it). */
consumer(opts: { secrets: string[]; send: NetworkSend; onEvent?: (event: any) => Promise<string | void> | string | void; now?: () => number; limit?: number }): (req: IncomingMessage & Record<string, any>, res: ServerResponse) => Promise<void>;
TOPICS: readonly string[];
tables: { table: string; subject: string; file: string | null; erase: AccountDataTable['erase'] }[];
}export export function createAccountData(opts: { db: any; s
export function createAccountData(opts: {
db: any;
service: string;
tables: AccountDataTable[];
extraExport?: (db: any, subject: string) => Promise<ExportFile[] | void>;
extraErase?: (tx: any, subjects: string[], counts: EraseCounts & { add(o: Record<string, number>, kind: string, n: number): void }) => Promise<void>;
note?: string | null;
rowLimit?: number;
log?: { log(msg: string): void; warn(msg: string): void };
}): AccountData;export export function createNetworkSender(opts: { networkInternalU
export function createNetworkSender(opts: { networkInternalUrl: string; clientId: string; clientSecret: string; fetch?: typeof fetch; timeoutMs?: number }): NetworkSend;interface Subscriptions
export interface Subscriptions { topics: string[]; endpoint: string; done: Promise<boolean>; stop(): void }export export function startSubscriptions(opts: { eventsUrl: st
Create any missing Events subscription for `topics` (default TOPICS) at boot; null when a setting is missing.
export function startSubscriptions(opts: {
eventsUrl: string; endpoint: string; secret: string; topics?: readonly string[];
networkInternalUrl: string; clientId: string; clientSecret: string;
fetch?: typeof fetch; log?: { log(msg: string): void; warn(msg: string): void }; delays?: number[];
}): Subscriptions | null;export export const ACCOUNT_DATA_SCHEMA: string;
export const ACCOUNT_DATA_SCHEMA: string;export export const TOPICS: readonly string[];
export const TOPICS: readonly string[];