deserializeChangeNodeFromJSON
deserializeChangeNodeFromJSON<
TIn,TOut>(node,decodeLeaf):CRDTChangeNode<TOut>
Defined in: packages/core/src/merkle-dag-serialization.ts:222
Inverse of serializeChangeNodeForJSON: iteratively reconstruct a
CRDTChangeNode tree from its JSON-friendly wire form, decoding each
node’s change payload via the provided decoder.
Preserves crdtChangeNodeDeferred children verbatim, matching the
serializer.
Wire input is treated as untrusted: the reconstructed children map uses a
null prototype so peer-supplied hash keys (e.g. __proto__,
constructor) cannot pollute Object.prototype or shadow inherited
members. The shape of the node itself is also validated up front: node
must be a non-null, non-array object; kind must be a known
CRDTChangeNodeKind discriminant; and each entry in children
must be a plain object. A malformed peer message throws a descriptive
Error rather than a bare TypeError from property access on null /
non-object input, which would otherwise be a trivial DoS vector.
Type Parameters
Section titled “Type Parameters”TIn
Wire leaf payload type (e.g. string or string[]).
TOut
Decoded leaf payload type (e.g. Uint8Array or
Uint8Array[]).
Parameters
Section titled “Parameters”CRDTChangeNodeWire<TIn>
The wire-form change node tree to deserialize.
decodeLeaf
Section titled “decodeLeaf”(leaf) => TOut
Function that maps a wire leaf payload back to its in-memory representation.
Returns
Section titled “Returns”CRDTChangeNode<TOut>