serializeChangeNodeForJSON
serializeChangeNodeForJSON<
TIn,TOut>(node,encodeLeaf):CRDTChangeNodeWire<TOut>
Defined in: packages/core/src/merkle-dag-serialization.ts:121
Iteratively serialize a CRDTChangeNode tree by transforming each node’s
change payload via the provided encoder, preserving the kind and
children structure for round-tripping through JSON.
A children value equal to crdtChangeNodeDeferred (i.e. false) is
preserved verbatim so deferred subtrees survive the round-trip.
The output is intentionally byte-identical (modulo the leaf encoding) to the input shape so peers running this code interoperate with peers using the prior per-provider helpers.
Type Parameters
Section titled “Type Parameters”TIn
Input leaf payload type (e.g. Uint8Array or
Uint8Array[]).
TOut
Output leaf payload type (e.g. string or string[]).
Parameters
Section titled “Parameters”CRDTChangeNode<TIn>
The change node tree to serialize.
encodeLeaf
Section titled “encodeLeaf”(leaf) => TOut
Function that maps an input leaf payload to its JSON-serializable representation.
Returns
Section titled “Returns”CRDTChangeNodeWire<TOut>