@yoyo-org/progressive-json
Version:
Stream and render JSON data as it arrives - perfect for AI responses, large datasets, and real-time updates
28 lines (27 loc) • 778 B
TypeScript
import type { Plugin, PlaceholderStore } from "../resolve-placeholder";
/**
* Server-side message creator for merge plugin
*/
export declare function merge(key: string, value: Record<string, unknown>): {
type: string;
key: string;
value: Record<string, unknown>;
};
export type MergeMessage = {
type: "merge";
key: string;
value: Record<string, unknown>;
};
/**
* Merge Plugin
*
* Handles "merge" message type that merges the current placeholder value with a new object.
*
* Example server usage:
* ```ts
* writer(merge(userRef, { email: "alice@example.com", verified: true }));
* ```
*
* This will merge the new properties with the existing user object.
*/
export declare const mergePlugin: Plugin<MergeMessage, PlaceholderStore<unknown>>;