On this page
Browser history storage. Import it from @sheetwrite/core/browser/history.
Each call opens the database, runs one readwrite transaction over every
store, and closes the connection, so publication and reference counts are
atomic across restarts and tabs.
Members
Methods
Creates the storage; each call opens the database, so nothing opens yet.
Runs action in one atomic transaction over the stored archive; a failure leaves it unchanged.
Declaration
View full TypeScript declaration
interface IndexedDbHistoryStorageOptions {
databaseName?: string;
indexedDB?: IDBFactory;
} interface IndexedDbHistoryStorageOptions {
databaseName ?: string ;
indexedDB ?: IDBFactory ;
} interface IndexedDbHistoryStorageOptions {
databaseName ?: string ;
indexedDB ?: IDBFactory ;
} Database selection for a host-owned browser history archive. API reference interface HistoryStorageRequest {
documentId: string;
limits: Readonly<HistoryLimits>;
signal?: AbortSignal;
} interface HistoryStorageRequest {
documentId : string ;
limits : Readonly < HistoryLimits >;
signal ?: AbortSignal ;
} interface HistoryStorageRequest {
documentId : string ;
limits : Readonly < HistoryLimits >;
signal ?: AbortSignal ;
} Common document identity, ceilings, and cancellation for adapter calls. API reference interface HistoryStorageTransaction {
manifest(): Promise<HistoryManifest>;
saveManifest(manifest: HistoryManifest): Promise<void>;
record(id: string): Promise<StoredHistoryRecord | undefined>;
saveRecord(value: StoredHistoryRecord): Promise<void>;
deleteRecord(id: string): Promise<void>;
recordPage(
kind: HistoryStoredRecord["kind"],
afterId: string,
count: number,
): Promise<HistoryRecordMetadata[]>;
versions(): Promise<HistoryVersion[]>;
saveVersion(version: HistoryVersion): Promise<void>;
deleteVersion(id: string): Promise<void>;
pins(): Promise<HistoryReaderPin[]>;
// … 3 more lines — see the API reference
} interface HistoryStorageTransaction {
manifest (): Promise < HistoryManifest >;
saveManifest ( manifest: HistoryManifest ): Promise < void >;
record ( id: string ): Promise < StoredHistoryRecord | undefined >;
saveRecord ( value: StoredHistoryRecord ): Promise < void >;
deleteRecord ( id: string ): Promise < void >;
recordPage (
kind: HistoryStoredRecord [ "kind" ],
afterId: string ,
count: number ,
): Promise < HistoryRecordMetadata []>;
versions (): Promise < HistoryVersion []>;
saveVersion ( version: HistoryVersion ): Promise < void >;
deleteVersion ( id: string ): Promise < void >;
pins (): Promise < HistoryReaderPin []>;
} interface HistoryStorageTransaction {
manifest (): Promise < HistoryManifest >;
saveManifest (
manifest: HistoryManifest ,
): Promise < void >;
record (
id: string ,
): Promise <
| StoredHistoryRecord
| undefined
>;
saveRecord (
value: StoredHistoryRecord ,
): Promise < void >;
deleteRecord (
id: string ,
): Promise < void >;
recordPage (
kind: HistoryStoredRecord [ "kind" ],
} One atomic database transaction. The memory and IndexedDB adapters supply it; AtomicHistoryStorage keeps all publication and retention rules. API reference class AtomicHistoryStorage implements HistoryStorageAdapter {
get: (
request: HistoryGetRequest,
) => Promise<
HistoryManifest | HistoryVersion | HistoryStoredRecord
>;
list: (request: HistoryListRequest) => Promise<HistoryListPage>;
prune: (request: HistoryPruneRequest) => Promise<HistoryManifest>;
put: (input: HistoryPutRequest) => Promise<HistoryManifest>;
transact: <T>(
request: HistoryStorageRequest,
action: (transaction: HistoryStorageTransaction) => Promise<T>,
) => Promise<T>;
} class AtomicHistoryStorage implements HistoryStorageAdapter {
get : (
request: HistoryGetRequest ,
) => Promise <
HistoryManifest | HistoryVersion | HistoryStoredRecord
>;
list : ( request: HistoryListRequest ) => Promise < HistoryListPage >;
prune : ( request: HistoryPruneRequest ) => Promise < HistoryManifest >;
put : ( input: HistoryPutRequest ) => Promise < HistoryManifest >;
transact : < T >(
request: HistoryStorageRequest ,
action : ( transaction: HistoryStorageTransaction ) => Promise < T >,
) => Promise < T >;
} class AtomicHistoryStorage implements HistoryStorageAdapter {
get : (
request: HistoryGetRequest ,
) => Promise <
| HistoryManifest
| HistoryVersion
| HistoryStoredRecord
>;
list : (
request: HistoryListRequest ,
) => Promise < HistoryListPage >;
prune : (
request: HistoryPruneRequest ,
) => Promise < HistoryManifest >;
put : (
input: HistoryPutRequest ,
) => Promise < HistoryManifest >;
transact : < T >(
request: HistoryStorageRequest ,
} Publication, reader leases and reference-counted retention, shared by the supplied adapters. Every method runs in one transact call, so a failure leaves the stored archive unchanged. API reference On this page