UNPKG

giantdb

Version:

Large object database in native JavaScript, with encryption support

30 lines (29 loc) 1 kB
/// <reference types="node" /> import WritableWrapper from 'writable-wrapper'; import { Writable } from 'node:stream'; import { Item } from './item.js'; /** * An object representing a change on an item, still to be committed. */ export declare class Change extends WritableWrapper { readonly id: string; private _committer; private _destroyer; private _changeFinished; /** * Constructs a new Change. * * @param id The ID of the new item. * @param writeStream The output stream to write to. * @param committer The function used for committing. * @param destroyer The function used for destruction. */ constructor(id: string, writeStream: Writable, committer: () => Promise<Item>, destroyer?: () => any); /** * Commit this change. This ends the output and makes the item available. * * @returns A Promise that resolves to an Item, or rejects on error. */ commit(): Promise<Item>; private _finalizeBeforeCommit; }