Defined in: packages/snapshot-set/src/serialization/json.ts:39
A plain, inert description of a SnapshotSet. It holds no behavior
and no reference to the structure it came from, so it can be stored,
compared, structurally cloned, or sent through postMessage. It survives
JSON.stringify when the values themselves do.
values lists every value ever registered, in first-registration order,
including values currently absent — a value’s history alone determines
whether it is present at any given version, so reconstructing that requires
every registered value, not just the current members. history[i] is the
strictly increasing toggle-version list for values[i]. snapshots is
every id createSnapshot() has minted, ascending. version is the current
version counter.
Serialization here is faithful, not canonical: two structures
with identical observable behavior can serialize differently if they took
different mutation paths. An add followed by a delete of the same value
between two snapshots leaves two toggle entries behind that a canonicalized
form would collapse away, but canonicalizing would mean renumbering
versions — and a caller may be holding an id minted under the old
numbering. knotkit/disjoint-set’s serialization is canonical instead,
because it exposes no ids: nothing constrains it to preserve a numbering
scheme, so two structures with the same partition always serialize
identically.
Type Parameters
Section titled “Type Parameters”T
Properties
Section titled “Properties”schemaVersion
Section titled “schemaVersion”
readonlyschemaVersion:1
Defined in: packages/snapshot-set/src/serialization/json.ts:41
Wire-schema version.
readonlykind:"version-chain"
Defined in: packages/snapshot-set/src/serialization/json.ts:43
The storage layout to restore. Only 'version-chain' exists today.
values
Section titled “values”
readonlyvalues: readonlyT[]
Defined in: packages/snapshot-set/src/serialization/json.ts:45
Every registered value, in first-registration order, including currently absent ones.
history
Section titled “history”
readonlyhistory: readonly (readonlynumber[])[]
Defined in: packages/snapshot-set/src/serialization/json.ts:47
The toggle-version history of the value at the same position, strictly increasing.
snapshots
Section titled “snapshots”
readonlysnapshots: readonlynumber[]
Defined in: packages/snapshot-set/src/serialization/json.ts:49
Every id createSnapshot() has minted, ascending.
version
Section titled “version”
readonlyversion:number
Defined in: packages/snapshot-set/src/serialization/json.ts:51
The current version counter.