UNPKG

giantdb

Version:

Large object database in native JavaScript, with encryption support

31 lines (30 loc) 998 B
/// <reference types="node" /> import { Stream } from 'node:stream'; import { MiddlewareResult } from './middleware.js'; /** * Represents a triple (stream, metadata, metadataChanged) containing the results of middleware evaluation. */ export interface TransformResult<S extends Stream> { readonly stream: S; readonly metadata: object; readonly metadataChanged: boolean; } /** * Represents a triple (stream, metadata, metadataChanged) that can be updated * with middleware results. */ export declare class MiddlewareTransformable<S extends Stream> implements TransformResult<S> { stream: S; metadata: object; metadataChanged: boolean; constructor(stream: S, metadata: object); /** * Update this object with the results from a middleware. * * If the results contain a reference to metadata, the metadataChanged * attribute will be set to true. * * @param result The results. */ update(result?: MiddlewareResult<S>): void; }