---
title: "openvibe-sdk/account-data · OpenVibe.Services"
canonical: "https://openvibe.services/docs/sdk/account-data"
updated: null
---

# openvibe-sdk/account-data · OpenVibe.Services

HTML: [openvibe-sdk/account-data · OpenVibe.Services](https://openvibe.services/docs/sdk/account-data)

# `openvibe-sdk/account-data`

Generated at 2026-12-01 05:42:00 UTC from [`openvibe-contracts v0.454.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.454.0) and [`openvibe-sdk v0.193.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/v0.193.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;
    /** The service's tables; telemetry_samples is covered by the SDK unless it is listed here. */
    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 UncoveredOptions

~~~~
export interface UncoveredOptions {
    /** The service's table map, as entries or bare table names. */
    tables?: (string | Pick<AccountDataTable, 'table'>)[];
    /** Tables whose person column is a task's key; their rows go with the task, not the account. */
    taskKeyed?: string[];
    /** Tables left out on purpose, each with the reason. */
    exempt?: Record<string, string>;
}
~~~~

## export export function uncovered(db: any, opts?: UncoveredOptions):

The tables with a person column (subject, owner, created\_by, user\_id, person) that nothing covers, sorted.

~~~~
export function uncovered(db: any, opts?: UncoveredOptions): Promise<string[]>;
~~~~

## 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[];
~~~~
