Values

Values are instances of types. Every value carries its Type and obeys the Java-like equals / hash / compare contract. Value is the base class, exposing factory methods for creating and converting values; each concrete class (ValueString, ValueInt64, …) is constructible directly.

When to use: use values to hold typed data. Primitives are immutable; containers (ValueVector, ValueMap, ValueSet, ValueXArray) are mutable. INT64/UINT64 values encode to native bigint; every other integer and float encodes to number.

For the conceptual guide see Types and Values; for the type system see Type System. The Python equivalent is Values.

Quick Start

const { Value, Type, ValueString, ValueInt64, ValueDouble } = require('@digitalsubstrate/dsviper');

// Direct construction for primitives
const name = new ValueString('Alice');
const count = new ValueInt64(42n);          // INT64 ↔ bigint

// Factory with an explicit type (no native arg defaults the value)
const score = Value.create(Type.DOUBLE, 3.14);
const zero = Value.create(Type.INT64);      // 0n

// Infer the value class from a JS scalar
const flag = Value.deduce(true);            // ValueDouble / ValueString / ValueBool ...

// Access the underlying JS value, its text form, and its type
name.encoded();                             // 'Alice'
score.representation();                     // '3.14'
name.type().equals(Type.STRING);            // true

// equals/compare accept native arguments (never use == between values)
count.equals(42n);                          // true
new ValueDouble(1).compare(2) < 0;          // true

// Parse from text — returns undefined on failure (not a throw)
ValueInt64.tryParse('42').encoded();        // 42n
ValueInt64.tryParse('not a number');        // undefined

// cast re-types a Value, throwing a ViperError on mismatch
ValueDouble.cast(score).encoded();          // 3.14

// Per-type singletons
ValueInt64.ZERO.encoded();                  // 0n
ValueDouble.ONE.encoded();                  // 1.0

Choosing the Right Pattern

Pattern

When to use

Example

new ValueString(...)

Direct primitive construction

new ValueInt64(42n)

Value.create(type[, native])

Generic factory with an explicit type

Value.create(Type.DOUBLE, 3.14)

Value.deduce(scalar)

Infer the value class from a JS scalar

Value.deduce(true)

Value.decode(bytes, type, defs)

Deserialize from the binary stream codec

Value.decode(buf, Type.STRING, defs)

ValueXxx.tryParse(text)

Parse from text, undefined on failure

ValueInt64.tryParse('42')

ValueXxx.cast(value)

Re-type a value, ViperError on mismatch

ValueInt64.cast(v)

Generated from the @digitalsubstrate/dsviper TypeScript declarations (index.d.ts) by TypeDoc.

Base Class

Class

Description

Value

Creates values, and converts between them and native JS values

Primitive Values

Class

Description

ValueVoid

A value of type void

ValueBool

A value of type bool

ValueUInt8

A value of type uint8

ValueUInt16

A value of type uint16

ValueUInt32

A value of type uint32

ValueUInt64

A value of type uint64

ValueInt8

A value of type int8

ValueInt16

A value of type int16

ValueInt32

A value of type int32

ValueInt64

A value of type int64

ValueFloat

A value of type float

ValueDouble

A value of type double

ValueString

A value of type string

ValueBlob

A value of type blob

ValueBlobId

A value of type blob_id

ValueCommitId

A value of type commit_id

ValueUUId

A value of type uuid

Container Values

Class

Description

ValueVector

A value of type vector

ValueVectorIter

Iterator for ValueVector elements

ValueSet

A value of type set

ValueSetIter

Iterator for ValueSet elements

ValueMap

A value of type map<keyType, elementType>

ValueXArray

A value of type xarray

ValueOptional

A value of type optional

Algebraic Values

Class

Description

ValueTuple

A value of type tuple<T0, …>

ValueTupleIter

Iterator for ValueTuple elements

ValueVec

A value of type vec<numericType, size>

ValueMat

A value of type mat<numericType, columns, rows>, stored column-major

ValueVariant

A value of type variant<T0, …>

ValueAny

A value of any type

User-Defined Values

Class

Description

ValueStructure

A value of type struct

ValueEnumeration

A value of type enum

ValueKey

A value of type key

Value Program

Class

Description

ValueProgram

The sequence of opcodes a commit carries

ValueOpcodeKey

What an opcode applies to: an attachment, an instance, and that instance’s concept

ValueOpcode

The base of the opcode hierarchy

ValueOpcodeDocumentSet

Writes a whole document at a key - the only opcode without a path

ValueOpcodeDocumentUpdate

Writes a value at a path inside a document

ValueOpcodeMapUnion

Adds entries to the map at a path, replacing the keys already there

ValueOpcodeMapSubtract

Removes from the map at a path the entries whose key it carries

ValueOpcodeMapUpdate

Writes entries over the keys the map at a path already holds, inserting none

ValueOpcodeSetUnion

Adds elements to the set at a path

ValueOpcodeSetSubtract

Removes elements from the set at a path

ValueOpcodeXArrayInsert

Inserts a position into the xarray at a path, before another one

ValueOpcodeXArrayRemove

Removes the element at a position of the xarray at a path

ValueOpcodeXArrayUpdate

Writes a value at a position of the xarray at a path

ValueProcessorTrace

The execution of one program: whether it ran, and the opcodes it applied

ValueProcessorTraceOpcode

One step of a traced execution: the opcode, and the exception it threw if it did

Reference

class Value()

Creates values, and converts between them and native JS values.

Value.create(type [, initialValue]) builds one of any type; the concrete classes - ValueInt64, ValueString and the rest - construct directly. It also encodes and decodes.

The word has two senses here. encode and decode go between a value and the bytes of a blob; the encoded argument of a read chooses between a JS native (true) and the Value itself (false).

equals() and compare() work between any two values and never throw. A native operand is decoded to the value type first - for an any or a variant, to the type of the value it holds: equals() answers false when it cannot be, and compare() throws. Reach for those two: == compares object identity, so it answers false for two values holding the same thing, and sort() with no comparator orders by text; give it a comparator that calls compare. Against a native, == coerces the value and reads as you would expect.

The order is the runtime’s, total across types. Two values of different types order by the kind of type, then by the type: an int64 5 sorts after an int32 9. Within one type, a vector, a set and a map order by size first, then element by element, so [3, 1, 2] sorts after [4], unlike an array compared element by element; a string and a tuple order element by element, and an empty optional sorts first. Sets and maps keep their elements in this order.

null decoded to a Value is read by the type in context: in a slot that can be empty - an optional, an any - it is empty; in a void slot it is the void value; where the type cannot hold it, an optional argument is absent. undefined is always an absent argument. The void value inside an optional or an any is new ValueVoid().

Ownership follows the reference semantics of the runtime: a container holds the object you give it, and a read hands back what it holds, so mutating either is visible through the other. Three things are copied instead. What has to stay sorted and unique - a set element and a map key. Anything crossing a store: set takes a copy and get hands one back, so a document is never shared with a Database or a CommitDatabase, and mutating it after writing does not reach what was written. And an element of a pack-sized vector, which at() decodes afresh on each read (ValueVector.isPackSized).

Note: Not directly instantiable.

exported from index.d

Value.compare(other)
Return -1, 0 or 1. Total between VALUES: comparing across Viper types answers, so a

mixed list sorts. A NATIVE is decoded to this value’s type first and THROWS when it cannot - compare(42) answers, compare([1]) and compare(null) throw, which is why this one takes InputValue where equals takes unknown.

Arguments:
  • other (InputValue)

Returns:

number

Value.description(namespace)
Arguments:
  • namespace (NameSpace | null)

Returns:

string

Value.equals(other)
Total: answers for ANY operand and never throws, which is why it takes unknown.

A value of another Viper type answers false, and so does a native that does not decode to this one - the runtime’s relations are trans-type, they answer rather than refuse. This is what hashKey() keys on and what a membership test rests on.

Arguments:
  • other (unknown)

Returns:

boolean

Value.hash()
Returns:

bigint

Value.hashKey()
A value-identity key for native value-keyed collections. JS Map/Set key by

identity (SameValueZero) and call no custom hash/equals, so grouping or deduplicating wrapped values by value needs a primitive token. hashKey() folds the type (type().runtimeId()) into the value hash, because the raw hash() is type-blind (Int8(1), Int16(1), Int64(1) all hash 1; an empty container hashes 0 whatever its element type). Returned as one 128-bit bigint, usable directly as a Map/Set/Map.groupBy key. It is a hash, so collisions are possible (negligible at realistic cardinalities) - not a lossless serialization.

Returns:

bigint

Value.representation()
Returns:

string

Value.toJSON()
Serialize for JSON.stringify - the JSON-ready POD (via Value.dumps(this, true)):

native numbers (a 64-bit integer is promoted to number, or THROWS past the 2^53-1 JSON-safe range - never a silent precision loss), base64 for a Blob, arrays / plain objects for containers. Without this a wrapped Value would stringify to a bare {}. For an exact, typed JSON channel use Value.toJsonString instead.

Note: structuredClone(value) produces an INERT object (no methods, no C++ state) - to move a Value across a worker/thread use the binary channel Value.encode / Value.decode (transferable), not structuredClone.

Returns:

NativeValue

Value.toString()
Returns:

string

Value.type()
Returns:

Type

Value.typeCode()
Returns:

string

static Value.collectBlobIds(object)
Return the distinct blobId of all referenced blobId by the object, where object must

be a Value, a Path, a CommitState, a CommitMutableState or a ValueProgram.

Arguments:
  • object (Value | Path | ValueProgram | CommitState | CommitMutableState)

Returns:

ValueSet<ValueBlobId>

static Value.collectCommitIds(object)
Return the distinct commitId of all referenced commitId by the object, where object

must be a Value, a Path, a CommitState, a CommitMutableState or a ValueProgram.

Arguments:
  • object (Value | Path | ValueProgram | CommitState | CommitMutableState)

Returns:

ValueSet<ValueCommitId>

static Value.copy(value)
Return a DEEP copy of a value: the containers it holds are copied too, unlike the

shallow copy a container constructor makes.

Arguments:
  • value (Value)

Returns:

Value

static Value.create(...args)

Return a new value of type, holding initialValue when one is given.

It hands back the SAME container: a value passed as initialValue is not copied, so mutating either shows in the other. A container constructor builds a NEW container instead, over the same ELEMENTS - a shallow copy, where only a mutation inside an element shows through.

The two are interchangeable for the immutable scalars, and differ for every container.

One exception, and it is a rule: what orders a container is COPIED. A ValueSet copies each element, which is its own key; a ValueMap copies each key and shares the value. A key that could mutate underneath would leave the container out of order.

Arguments:
  • args (any[])

Returns:

Value

static Value.decode(blob, type, definitions, streamCodecInstancing, packSized)

Return the value blob holds, read as type against definitions.

The blob must hold that value and nothing more: bytes left past it mean it holds another type or another codec wrote it, and decode throws.

It carries neither the type nor the definitions: the reader needs them and the codec the writer used. Definitions travel as a blob of their own - DefinitionsConst.encode(), read back by Definitions.decode(), whose codec is Codec.STREAM_TOKEN_BINARY by default.

streamCodecInstancing chooses the codec; Codec.STREAM_BINARY is used when it is undefined.

If packSized is true, a vector<T> whose T is sized (Type.isSized) keeps its elements encoded and decodes one only when ValueVector.at reads it: the decoding cost of a large immutable resource is paid on use. See ValueVector.isPackSized for what that changes.

Arguments:
  • blob (ValueBlob)

  • type (Type)

  • definitions (DefinitionsConst)

  • streamCodecInstancing (StreamCodecInstancing | null)

  • packSized (boolean | null)

Returns:

Value

static Value.deduce(value)

Return a strong typed conversion of an object.

Arguments:
  • value (NativeValue)

Returns:

Value

static Value.dumps(value, json)
DEEP projection of a strong-typed value to native JS, recursing all the way to the

leaves (the inverse of loads). Unlike the encoded getters (unwrap / at / toObject), which are shallow - scalar leaves only, containers stay handles - dumps materializes nested containers too; and unlike Value.encode (a serialization codec to bytes), it produces live native JS.

Shapes: vector / tuple / vec -> array; mat -> array of columns; set -> array; map -> array of [key, value] pairs; structure -> object; enumeration -> string; key -> [instanceId, conceptRuntimeId]. json changes two of them. A blob renders as a Buffer (json false, live binary) or as a base64 string (json true). And an Int64/UInt64 leaf renders as a bigint (json false, the stable read-path type) or as a number (json true) - throwing RangeError beyond 2^53-1 rather than losing precision silently. So JSON.stringify(Value.dumps(value)) fails on any 64-bit integer and Value.dumps(value, true) is what a JSON boundary wants; JSON.stringify(value) does it for you through toJSON. Note this differs from Python, where json also swaps set/dict natives - JS has no frozenset / arbitrary-key dict, so sets and maps are arrays/pair-arrays in BOTH modes.

Arguments:
  • value (Value)

  • json (boolean | null)

Returns:

NativeValue

static Value.encode(value, streamCodecInstancing)

Return a blob encoding value.

streamCodecInstancing chooses the codec; Codec.STREAM_BINARY is used when it is undefined.

Arguments:
  • value (Value)

  • streamCodecInstancing (StreamCodecInstancing | null)

Returns:

ValueBlob

static Value.fromBsonBlob(blob, typeStructure, definitions)

Return a value by decoding the bson encoded blob of a structure.

Arguments:
  • blob (ValueBlob)

  • typeStructure (TypeStructure)

  • definitions (DefinitionsConst)

Returns:

ValueStructure

static Value.fromJsonString(string, type, definitions)

Return a value by decoding the json encoded string.

Arguments:
  • string (string)

  • type (Type)

  • definitions (DefinitionsConst)

Returns:

Value

static Value.fromXmlString(string, type, definitions)

Return the value the XML in string holds, read as type against definitions.

Arguments:
  • string (string)

  • type (Type)

  • definitions (DefinitionsConst)

Returns:

Value

static Value.hexdigest(value, hashing)

Hash the value with the hashing interface if specified else use SHA1.

Arguments:
  • value (Value)

  • hashing (Hashing | null)

Returns:

string

static Value.loads(object, type, definitions)
Return a value by decoding a native JS object against the given type (the

inverse of dumps).

Arguments:
  • object (NativeValue)

  • type (Type)

  • definitions (DefinitionsConst)

Returns:

Value

static Value.read(type, streamReading, definitions, packSized)

Read a value of type from streamReading, typed against definitions.

packSized keeps sized elements packed, decoding them only on access.

Arguments:
  • type (Type)

  • streamReading (StreamReading)

  • definitions (DefinitionsConst)

  • packSized (boolean | null)

Returns:

Value

static Value.succ(value)

Return the successor of a value.

Arguments:
  • value (Value)

Returns:

Value

static Value.toBsonBlob(value)

Return the bson encoded blob of the value.

BSON is written from the JSON form, so it refuses infinity and not-a-number for the same reason toJsonString does. Its integers are signed 64-bit: a uint64 above that range is refused here and carried by toJsonString.

Arguments:
  • value (ValueStructure)

Returns:

ValueBlob

static Value.toJsonString(value, indent)

Return the JSON encoded string for the value.

indent gives the number of spaces per level; -1 keeps it on one line. JSON has no form for infinity or not-a-number, so a value holding one is refused here rather than written as something else; a binary codec or toXmlString carries it. A uint64 is written as the bare number, which JSON.parse rounds past 2**53, and an enumeration as its case name after a dot: ‘.green’.

Arguments:
  • value (Value)

  • indent (number | null)

Returns:

string

static Value.toXmlString(value, indent)

Return value encoded as XML.

indent gives the number of spaces per level; -1 keeps it on one line.

XML carries every value - infinity, not-a-number and the whole uint64 range included - and fromXmlString reads back one equal to it. An enumeration is its case name, a blob its base64.

Arguments:
  • value (Value)

  • indent (number | null)

Returns:

string

static Value.write(value, streamWriting)

Write value into streamWriting.

Arguments:
  • value (Value)

  • streamWriting (StreamWriting)

class ValueVoid()
A value of type void. Seamless with null: null or undefined is accepted as input,

and encoded() answers null.

ValueVoid() and Value.create(Type.VOID) both give the single void value.

exported from index.d

Extends:
  • Value

ValueVoid.copy()

Return a deep copy.

Returns:

ValueVoid

ValueVoid.encoded()

Return null, the native void projects to, as Value.dumps does.

Returns:

null

ValueVoid.hash()

Return the hash value.

Returns:

bigint

static ValueVoid.cast(value)

Return value as a void, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueVoid

class ValueBool(value)

A value of type bool. Seamless with a boolean.

Or use Value.create(Type.BOOL [, true|false]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (boolean | ValueBool | null)

ValueBool.FALSE

type: readonly ValueBool

ValueBool.TRUE

type: readonly ValueBool

ValueBool.copy()

Return a deep copy.

Returns:

ValueBool

ValueBool.encoded()

Return the value as a JS boolean.

Returns:

boolean

ValueBool.hash()

Return the hash value.

Returns:

bigint

static ValueBool.cast(value)

Return value as a bool, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueBool

static ValueBool.tryParse(string)

Return string parsed as a bool, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueBool | undefined

class ValueUInt8(value)

A value of type uint8. Seamless with a number.

It holds 0 to 255; outside that the constructor throws rather than

truncating, and the error names the type you asked for.

Or use Value.create(Type.UINT8 [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (number | ValueUInt8 | null)

ValueUInt8.ONE

type: readonly ValueUInt8

ValueUInt8.ZERO

type: readonly ValueUInt8

ValueUInt8.copy()

Return a deep copy.

Returns:

ValueUInt8

ValueUInt8.encoded()

Return the value as a JS number.

Returns:

number

ValueUInt8.hash()

Return the hash value.

Returns:

bigint

static ValueUInt8.cast(value)

Return value as an uint8, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueUInt8

static ValueUInt8.tryParse(string)

Return string parsed as an uint8, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueUInt8 | undefined

class ValueUInt16(value)

A value of type uint16. Seamless with a number.

It holds 0 to 65535; outside that the constructor throws rather than

truncating, and the error names the type you asked for.

Or use Value.create(Type.UINT16 [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (number | ValueUInt16 | null)

ValueUInt16.ONE

type: readonly ValueUInt16

ValueUInt16.ZERO

type: readonly ValueUInt16

ValueUInt16.copy()

Return a deep copy.

Returns:

ValueUInt16

ValueUInt16.encoded()

Return the value as a JS number.

Returns:

number

ValueUInt16.hash()

Return the hash value.

Returns:

bigint

static ValueUInt16.cast(value)

Return value as an uint16, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueUInt16

static ValueUInt16.tryParse(string)

Return string parsed as an uint16, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueUInt16 | undefined

class ValueUInt32(value)

A value of type uint32. Seamless with a number.

It holds 0 to 4294967295; outside that the constructor throws rather than

truncating, and the error names the type you asked for.

Or use Value.create(Type.UINT32 [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (number | ValueUInt32 | null)

ValueUInt32.ONE

type: readonly ValueUInt32

ValueUInt32.ZERO

type: readonly ValueUInt32

ValueUInt32.copy()

Return a deep copy.

Returns:

ValueUInt32

ValueUInt32.encoded()

Return the value as a JS number.

Returns:

number

ValueUInt32.hash()

Return the hash value.

Returns:

bigint

static ValueUInt32.cast(value)

Return value as an uint32, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueUInt32

static ValueUInt32.tryParse(string)

Return string parsed as an uint32, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueUInt32 | undefined

class ValueUInt64(value)

A value of type uint64. Seamless with a bigint, or a number that is a safe integer.

It holds 0 to 18446744073709551615; outside that the constructor throws rather than

truncating, and the error names the type you asked for. That range is wider than a JS number can count exactly, so read it back as a bigint: a number past Number.MAX_SAFE_INTEGER has already lost digits before the binding sees it.

Or use Value.create(Type.UINT64 [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (number | bigint | ValueUInt64 | null)

ValueUInt64.ONE

type: readonly ValueUInt64

ValueUInt64.ZERO

type: readonly ValueUInt64

ValueUInt64.copy()

Return a deep copy.

Returns:

ValueUInt64

ValueUInt64.encoded()

Return the value as a JS bigint.

Returns:

bigint

ValueUInt64.hash()

Return the hash value.

Returns:

bigint

static ValueUInt64.cast(value)

Return value as an uint64, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueUInt64

static ValueUInt64.tryParse(string)

Return string parsed as an uint64, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueUInt64 | undefined

class ValueInt8(value)

A value of type int8. Seamless with a number.

It holds -128 to 127; outside that the constructor throws rather than

truncating, and the error names the type you asked for.

Or use Value.create(Type.INT8 [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (number | ValueInt8 | null)

ValueInt8.ONE

type: readonly ValueInt8

ValueInt8.ZERO

type: readonly ValueInt8

ValueInt8.copy()

Return a deep copy.

Returns:

ValueInt8

ValueInt8.encoded()

Return the value as a JS number.

Returns:

number

ValueInt8.hash()

Return the hash value.

Returns:

bigint

static ValueInt8.cast(value)

Return value as an int8, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueInt8

static ValueInt8.tryParse(string)

Return string parsed as an int8, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueInt8 | undefined

class ValueInt16(value)

A value of type int16. Seamless with a number.

It holds -32768 to 32767; outside that the constructor throws rather than

truncating, and the error names the type you asked for.

Or use Value.create(Type.INT16 [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (number | ValueInt16 | null)

ValueInt16.ONE

type: readonly ValueInt16

ValueInt16.ZERO

type: readonly ValueInt16

ValueInt16.copy()

Return a deep copy.

Returns:

ValueInt16

ValueInt16.encoded()

Return the value as a JS number.

Returns:

number

ValueInt16.hash()

Return the hash value.

Returns:

bigint

static ValueInt16.cast(value)

Return value as an int16, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueInt16

static ValueInt16.tryParse(string)

Return string parsed as an int16, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueInt16 | undefined

class ValueInt32(value)

A value of type int32. Seamless with a number.

It holds -2147483648 to 2147483647; outside that the constructor throws rather than

truncating, and the error names the type you asked for.

Or use Value.create(Type.INT32 [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (number | ValueInt32 | null)

ValueInt32.ONE

type: readonly ValueInt32

ValueInt32.ZERO

type: readonly ValueInt32

ValueInt32.copy()

Return a deep copy.

Returns:

ValueInt32

ValueInt32.encoded()

Return the value as a JS number.

Returns:

number

ValueInt32.hash()

Return the hash value.

Returns:

bigint

static ValueInt32.cast(value)

Return value as an int32, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueInt32

static ValueInt32.tryParse(string)

Return string parsed as an int32, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueInt32 | undefined

class ValueInt64(value)

A value of type int64. Seamless with a bigint, or a number that is a safe integer.

It holds -9223372036854775808 to 9223372036854775807; outside that the constructor throws rather than

truncating, and the error names the type you asked for. That range is wider than a JS number can count exactly, so read it back as a bigint: a number past Number.MAX_SAFE_INTEGER has already lost digits before the binding sees it.

Or use Value.create(Type.INT64 [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (number | bigint | ValueInt64 | null)

ValueInt64.ONE

type: readonly ValueInt64

ValueInt64.ZERO

type: readonly ValueInt64

ValueInt64.copy()

Return a deep copy.

Returns:

ValueInt64

ValueInt64.encoded()

Return the value as a JS bigint.

Returns:

bigint

ValueInt64.hash()

Return the hash value.

Returns:

bigint

static ValueInt64.cast(value)

Return value as an int64, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueInt64

static ValueInt64.tryParse(string)

Return string parsed as an int64, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueInt64 | undefined

class ValueFloat(value)

A value of type float. Seamless with a number.

NaN is a single data-model value here, not the IEEE 754 artefact: NaN equals NaN, hashes deterministically, and sits at one end of the total order, below -Infinity. Arithmetic stays IEEE 754: read the number back with encoded(). ValueFloat.NAN, .INF and .NEG_INF name the three. Or use Value.create(Type.FLOAT [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (number | ValueFloat | null)

ValueFloat.INF

type: readonly ValueFloat

ValueFloat.NAN

type: readonly ValueFloat

ValueFloat.NEG_INF

type: readonly ValueFloat

ValueFloat.ONE

type: readonly ValueFloat

ValueFloat.ZERO

type: readonly ValueFloat

ValueFloat.copy()

Return a deep copy.

Returns:

ValueFloat

ValueFloat.encoded()

Return the value as a JS number.

Returns:

number

ValueFloat.hash()

Return the hash value.

Returns:

bigint

static ValueFloat.cast(value)

Return value as a float, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueFloat

static ValueFloat.tryParse(string)

Return string parsed as a float, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueFloat | undefined

class ValueDouble(value)

A value of type double. Seamless with a number.

NaN is a single data-model value here, not the IEEE 754 artefact: NaN equals NaN, hashes deterministically, and sits at one end of the total order, below -Infinity. That is what lets a NaN be found in a set, deduplicated as a map key, and seen by a diff. Arithmetic stays IEEE 754: read the number back with encoded(). ValueDouble.NAN, .INF and .NEG_INF name the three. Or use Value.create(Type.DOUBLE [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (number | ValueDouble | null)

ValueDouble.INF

type: readonly ValueDouble

ValueDouble.NAN

type: readonly ValueDouble

ValueDouble.NEG_INF

type: readonly ValueDouble

ValueDouble.ONE

type: readonly ValueDouble

ValueDouble.ZERO

type: readonly ValueDouble

ValueDouble.copy()

Return a deep copy.

Returns:

ValueDouble

ValueDouble.encoded()

Return the value as a JS number.

Returns:

number

ValueDouble.hash()

Return the hash value.

Returns:

bigint

static ValueDouble.cast(value)

Return value as a double, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueDouble

static ValueDouble.tryParse(string)

Return string parsed as a double, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueDouble | undefined

class ValueString(value)

A value of type string. Seamless with a string.

Or use Value.create(Type.STRING [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (string | ValueString | null)

ValueString.EMPTY

type: readonly ValueString

ValueString.copy()

Return a deep copy.

Returns:

ValueString

ValueString.encoded()

Return the value as a JS string.

Returns:

string

ValueString.hash()

Return the hash value.

Returns:

bigint

static ValueString.cast(value)

Return value as a string, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueString

class ValueBlob(value)
A value of type blob. Seamless with a Buffer, a TypedArray, an ArrayBuffer and a base64

string.

Or use Value.create(Type.BLOB [, initialValue]).

The bytes are copied in, and a blob is read-only: encoded() returns a copy.

exported from index.d

Extends:
  • Value

Arguments:
  • value (string | ValueBlob | BlobTypedArray | ArrayBuffer | null)

ValueBlob.at(index)

Return the byte at the given index (out of range throws).

Arguments:
  • index (number)

Returns:

number

ValueBlob.base64Encode()

Return the base64 encoded string representation of this blob.

Returns:

string

ValueBlob.copy()

Return a deep copy.

Returns:

ValueBlob

ValueBlob.embed(name)

Return the blob as a C++ array declaration called name, to paste into a source file.

Arguments:
  • name (string)

Returns:

string

ValueBlob.encoded()

Return the value as a JS Buffer.

Returns:

Buffer

ValueBlob.hash()

Return the hash value.

Returns:

bigint

ValueBlob.sha1()

Return the hexdigest (SHA1).

Returns:

string

ValueBlob.size()

Return the number of bytes the blob holds.

Returns:

number

static ValueBlob.base64Decode(base64String)

Return the blob base64_string decodes to.

Arguments:
  • base64String (string)

Returns:

ValueBlob

static ValueBlob.cast(value)

Return value as a blob, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueBlob

class ValueBlobId(blobLayout, blob)
A value of type blob_id. The uniq identifier is computed from the immutable content of

the blob and the layout.

exported from index.d

Extends:
  • Value

Arguments:
  • blobLayout (BlobLayout)

  • blob (ValueBlob)

ValueBlobId.INVALID

type: readonly ValueBlobId

ValueBlobId.copy()

Return a deep copy.

Returns:

ValueBlobId

ValueBlobId.encoded()

Return the value as a JS string.

Returns:

string

ValueBlobId.hash()

Return the hash value.

Returns:

bigint

ValueBlobId.isValid()

Return true if the value is not INVALID.

Returns:

boolean

static ValueBlobId.cast(value)

Return value as a blobId, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueBlobId

static ValueBlobId.tryParse(string)

Return string parsed as a blobId, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueBlobId | undefined

class ValueCommitId(value)

A value of type commit_id.

Use the static factory method tryParse(…).

Or use Value.create(Type.COMMIT_ID [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (string | ValueCommitId | null)

ValueCommitId.INVALID

type: readonly ValueCommitId

ValueCommitId.copy()

Return a deep copy.

Returns:

ValueCommitId

ValueCommitId.encoded()

Return the value as a JS string.

Returns:

string

ValueCommitId.hash()

Return the hash value.

Returns:

bigint

ValueCommitId.isValid()

Return true if the value is not INVALID.

Returns:

boolean

static ValueCommitId.cast(value)

Return value as a commitId, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueCommitId

static ValueCommitId.tryParse(string)

Return string parsed as a commitId, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueCommitId | undefined

class ValueUUId(value)

A value of type uuid.

Use the static factory method create(…) or tryParse(…).

Or use Value.create(Type.UUID [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • value (string | ValueUUId | null)

ValueUUId.INVALID

type: readonly ValueUUId

ValueUUId.copy()

Return a deep copy.

Returns:

ValueUUId

ValueUUId.encoded()

Return the value as a JS string.

Returns:

string

ValueUUId.hash()

Return the hash value.

Returns:

bigint

ValueUUId.isValid()

Return true if the value is not INVALID.

Returns:

boolean

static ValueUUId.cast(value)

Return value as a uuid, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueUUId

static ValueUUId.create(uuidString)

Return a uuid from uuidString if specified otherwise a generated one.

Arguments:
  • uuidString (string | ValueUUId | null)

Returns:

ValueUUId

static ValueUUId.tryParse(string)

Return string parsed as a uuid, or undefined if it does not parse.

Arguments:
  • string (string)

Returns:

ValueUUId | undefined

class ValueVector()

A value of type vector<elementType>. Seamless with an array.

Or use Value.create(typeVector [, initialValue]).

This constructor builds a new container over the same elements, so only a mutation inside an element shows through - unless the vector is pack sized, see isPackSized.

exported from index.d

Extends:
  • DeepKeyPath

  • Value

ValueVector.[Symbol․iterator]()
Returns:

Iterator<OutputValue>

ValueVector.append(value)

Append value to the end of the vector.

Arguments:
  • value (InputValue)

ValueVector.at(index, encoded)

Return the value at index.

Passing encoded false returns a Value rather than a native JS value.

A negative index counts from the end, as Array.prototype.at does: at(-1) is the last element. Out of range still throws.

Arguments:
  • index (number)

  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueVector.back(encoded)

Return the back element or throw.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueVector.capacity()

Return how many elements the vector can hold before it grows.

Returns:

number

ValueVector.clear()

Remove all items.

ValueVector.concat(values)

Return a new vector = this followed by the values (neither operand is modified).

Arguments:
  • values (ValueVector | InputValue[])

Returns:

ValueVector

ValueVector.contains(value)

Return true if the value is present.

Arguments:
  • value (InputValue)

Returns:

boolean

ValueVector.copy()

Return a deep copy.

Returns:

ValueVector

ValueVector.count(value)

Return the number of occurrences for the value.

Arguments:
  • value (InputValue)

Returns:

number

ValueVector.empty()

Return true if the container is empty.

Returns:

boolean

ValueVector.exchange(idx1, idx2)

Exchange the value at idx1 with the value at idx2.

Arguments:
  • idx1 (number)

  • idx2 (number)

ValueVector.extend(values)

Extend the vector by appending the values.

Arguments:
  • values (ValueVector | InputValue[])

ValueVector.front(encoded)

Return the front element or throw.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueVector.index(value)

Return the first index of value.

Arguments:
  • value (InputValue)

Returns:

number

ValueVector.insert(index, value)

Insert value before index.

Arguments:
  • index (number)

  • value (InputValue)

ValueVector.isPackSized()

Return true if the vector keeps its elements packed and encoded.

They sit in one contiguous array of binary encoded elements. A pack-sized vector has value semantics: at() decodes a fresh copy on each call, so a mutation of that copy reaches the vector only through set(index, value). An element type that is not sized (Type.isSized) is kept unpacked.

Returns:

boolean

ValueVector.pop(index, encoded)

Remove and return the element at index, the last one by default.

Throw if the vector is empty or index is out of range.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • index (number | null)

  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueVector.remove(value)
Remove first occurrence of value.

Throws error if the value is not present.

Arguments:
  • value (InputValue)

ValueVector.reserve(size)

Reserve space for size.

Arguments:
  • size (number)

ValueVector.resize(size)

Grow or shrink the vector to size.

New elements hold the element type’s default; elements beyond size are dropped.

Arguments:
  • size (number)

ValueVector.set(index, value)

Set the value at index.

Arguments:
  • index (number)

  • value (InputValue)

ValueVector.shrinkToFit()

Release the capacity beyond size(), so capacity() becomes size().

ValueVector.size()

Return the number of elements.

Returns:

number

ValueVector.typeVector()

Return the type vector<elementType>.

Returns:

TypeVector

static ValueVector.cast(value)

Return value as a vector<elementType>, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueVector

class ValueVectorIter()

Iterator for ValueVector elements.

Note: Not directly instantiable.

exported from index.d

ValueVectorIter.[Symbol․iterator]()
Returns:

Iterator<OutputValue>

ValueVectorIter.next()
Returns:

{ done: boolean; value: OutputValue; }

class ValueSet<T>(type, value)

A value of type set<elementType>. Seamless with an array.

Iterates in sorted order - unlike a JS Set, which keeps insertion order. A set built from ‘z’, ‘a’, ‘m’ reads back as ‘a’, ‘m’, ‘z’. Or use Value.create(typeSet [, initialValue]).

An element of a set is its own key, so a set COPIES each element it takes: neither Value.create nor this constructor shares elements with what you passed. Being its own key is also why its index in sorted order is how one is addressed: at(index) reads that one in sorted order, and a Path reaches the same element with element(index).

exported from index.d

Extends:
  • Value

Type parameters:

T – (extends OutputValue)

Arguments:
  • type (TypeSet)

  • value (InputValue | Iterable<T, any, any>)

ValueSet.[Symbol․iterator]()
Returns:

Iterator<T>

ValueSet.add(value)

Add value to the set, or do nothing if it is already there.

The set stores a copy of the ELEMENT: it keeps its elements sorted and unique, so mutating value afterwards must not reach them. A map key is copied for the same reason; Value states the whole rule.

Arguments:
  • value (InputValue)

ValueSet.at(index, encoded)

Return the element at index.

Passing encoded false returns a Value rather than a native JS value.

A negative index counts from the end, as Array.prototype.at does: at(-1) is the last element. Out of range still throws.

Arguments:
  • index (number)

  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueSet.clear()

Remove all elements from this set.

ValueSet.contains(value)

Return true if the value is a member.

Arguments:
  • value (InputValue)

Returns:

boolean

ValueSet.copy()

Return a deep copy.

Returns:

ValueSet<T>

ValueSet.difference(value)

Return a new set holding the elements of this set that value does not hold.

Arguments:
  • value (InputValue[] | ValueSet<OutputValue> | ReadonlySet<InputValue>)

Returns:

ValueSet<T>

ValueSet.differenceUpdate(value)

Remove every element of value from this set.

Arguments:
  • value (InputValue[] | ValueSet<OutputValue> | ReadonlySet<InputValue>)

ValueSet.discard(value)

Remove value from the set, or do nothing if it is not there.

Arguments:
  • value (InputValue)

ValueSet.empty()

Return true if the container is empty.

Returns:

boolean

ValueSet.extend(elements)

Add every element of elements.

Arguments:
  • elements (InputValue[] | ValueSet<OutputValue>)

ValueSet.hash()

Return the hash value.

Returns:

bigint

ValueSet.index(value)
Return the index of value in the sorted order, or undefined if the set does not

hold it.

Arguments:
  • value (InputValue)

Returns:

number | undefined

ValueSet.intersection(value)

Return a new set holding the elements this set and value share.

Arguments:
  • value (InputValue[] | ValueSet<OutputValue> | ReadonlySet<InputValue>)

Returns:

ValueSet<T>

ValueSet.intersectionUpdate(value)

Keep only the elements this set and value share.

Arguments:
  • value (InputValue[] | ValueSet<OutputValue> | ReadonlySet<InputValue>)

ValueSet.isdisjoint(value)

Return true if this set and value share no element.

Arguments:
  • value (InputValue[] | ValueSet<OutputValue> | ReadonlySet<InputValue>)

Returns:

boolean

ValueSet.issubset(value)

Return true if value holds every element of this set.

Arguments:
  • value (InputValue[] | ValueSet<OutputValue> | ReadonlySet<InputValue>)

Returns:

boolean

ValueSet.issuperset(value)

Return true if this set holds every element of value.

Arguments:
  • value (InputValue[] | ValueSet<OutputValue> | ReadonlySet<InputValue>)

Returns:

boolean

ValueSet.max(encoded)

Return the maximum element or throw.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueSet.min(encoded)

Return the minimum element or throw.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueSet.pop(encoded)

Remove and return the min element. Throws error if the set is empty.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueSet.popMax(encoded)

Remove and return the max element. Throws error if the set is empty.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueSet.remove(value)

Remove value from the set, throwing if it is not there.

Arguments:
  • value (InputValue)

ValueSet.size()

Return the number of elements.

Returns:

number

ValueSet.symmetricDifference(value)

Return a new set holding the elements held by this set or by value, but not by both.

Arguments:
  • value (InputValue[] | ValueSet<OutputValue> | ReadonlySet<InputValue>)

Returns:

ValueSet<T>

ValueSet.symmetricDifferenceUpdate(value)

Keep only the elements held by this set or by value, but not by both.

Arguments:
  • value (InputValue[] | ValueSet<OutputValue> | ReadonlySet<InputValue>)

ValueSet.typeSet()

Return the type set<elementType>.

Returns:

TypeSet

ValueSet.union(value)

Return a new set holding every element of this set and of value.

Arguments:
  • value (InputValue[] | ValueSet<OutputValue> | ReadonlySet<InputValue>)

Returns:

ValueSet<T>

ValueSet.update(value)

Add every element of value to this set.

Arguments:
  • value (InputValue[] | ValueSet<OutputValue> | ReadonlySet<InputValue>)

static ValueSet.cast(value)

Return value as a set, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueSet

class ValueSetIter()

Iterator for ValueSet elements.

Note: Not directly instantiable.

exported from index.d

ValueSetIter.[Symbol․iterator]()
Returns:

Iterator<OutputValue>

ValueSetIter.next()
Returns:

{ done: boolean; value: OutputValue; }

class ValueMap()

A value of type map<keyType, elementType>. Seamless with an array of key/value pairs.

Iterates in sorted key order - unlike a JS Map, which keeps insertion order. Or use Value.create(typeMap [, initialValue]).

This constructor builds a new container over the same elements, so only a mutation inside an element shows through.

exported from index.d

Extends:
  • DeepKeyPath

  • Value

ValueMap.[Symbol․iterator]()
Returns:

Iterator<[OutputValue, OutputValue]>

ValueMap.at(key, encoded)

Return the value for a key.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • key (InputValue)

  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueMap.clear()

Remove all items.

ValueMap.contains(key)

Return true if the map holds an entry at key.

Arguments:
  • key (InputValue)

Returns:

boolean

ValueMap.copy()

Return a deep copy.

Returns:

ValueMap

ValueMap.discard(key)

Remove the key if present.

Arguments:
  • key (InputValue)

ValueMap.empty()

Return true if the container is empty.

Returns:

boolean

ValueMap.get(key, default_, encoded)

Return the value associated with the key, or default when there is none.

Without a default, a missing key answers undefined. default is decoded to the map value type, which reads null: an empty optional or any, the void value, or no default for a type that cannot hold it. undefined is no default.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • key (InputValue)

  • default_ (InputValue)

  • encoded (boolean | null)

Returns:

Value | OutputValue | undefined

ValueMap.items(encoded)

Return the pairs, as an array of two-element arrays.

The array is taken now: a later change to the map does not reach it.

Passing encoded false makes the elements Values rather than native JS values.

Arguments:
  • encoded (boolean | null)

Returns:

[Value | OutputValue, Value | OutputValue][]

ValueMap.keys(encoded)

Return the keys, as an array.

The array is taken now: a later change to the map does not reach it.

Passing encoded false makes the elements Values rather than native JS values.

Arguments:
  • encoded (boolean | null)

Returns:

(Value | OutputValue)[]

ValueMap.max(encoded)

Return the max key.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueMap.merge(other)
Return a new map = a copy of this updated with other (neither operand is modified).

On a key present in both, other’s value wins.

Arguments:
  • other (ValueMap)

Returns:

ValueMap

ValueMap.min(encoded)

Return the min key.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueMap.pop(key, default_, encoded)

Remove the entry at key and return its value.

Return default when the map holds no such key, or throw when no default is given. default is decoded to the map value type, which reads null as get() does.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • key (InputValue)

  • default_ (InputValue)

  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueMap.popitem(encoded)

Remove and return the entry with the smallest key, as a [key, value] pair.

Throws when the map is empty.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

[Value | OutputValue, Value | OutputValue]

ValueMap.remove(key)

Remove the key or throws.

Arguments:
  • key (InputValue)

ValueMap.set(key, value)

Set the value for a key.

The KEY is stored as a copy - a map keeps its keys sorted and unique, so mutating key afterwards must not reach them - while the value is held as you give it, like every other container.

Arguments:
  • key (InputValue)

  • value (InputValue)

ValueMap.setdefault(key, value, encoded)

Return the value for key, inserting value first if the map has no such key.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • key (InputValue)

  • value (InputValue)

  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueMap.size()

Return the number of elements.

Returns:

number

ValueMap.typeMap()

Return the type map<keyType, elementType>.

Returns:

TypeMap

ValueMap.update(value)

Write every entry of value into the map, replacing the keys already there.

Arguments:
  • value (InputValue)

ValueMap.values(encoded)

Return the values, as an array.

The array is taken now: a later change to the map does not reach it.

Passing encoded false makes the elements Values rather than native JS values.

Arguments:
  • encoded (boolean | null)

Returns:

(Value | OutputValue)[]

static ValueMap.cast(value)

Return value as a map, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueMap

class ValueXArray()

A value of type xarray<elementType>. Seamless with an array.

An element is reached by its position: at(position) takes the uuid a position carries and answers undefined for one the array does not hold, and position(index) gives the position of the index-th element.

Or use Value.create(typeXarray [, initialValue]).

This constructor builds a new container over the same elements, so only a mutation inside an element shows through.

exported from index.d

Extends:
  • DeepKeyPath

  • Value

ValueXArray.END

type: readonly ValueUUId

ValueXArray.[Symbol․iterator]()
Returns:

Iterator<OutputValue>

ValueXArray.append(value)

Append value to the end and return END.

END is the position past the last, not the one just created - position(size() - 1) answers that.

Arguments:
  • value (InputValue)

Returns:

ValueUUId

ValueXArray.at(position, encoded)

Return the element at the position or undefined.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • position (ValueUUId)

  • encoded (boolean | null)

Returns:

Value | OutputValue | undefined

ValueXArray.contains(value)

Return true if the value is present.

Arguments:
  • value (InputValue)

Returns:

boolean

ValueXArray.copy()

Return a deep copy.

Returns:

ValueXArray

ValueXArray.disablePosition(position)

Disable the position, so it addresses nothing.

The position is kept rather than reused, so a position another replica still holds keeps resolving.

Arguments:
  • position (ValueUUId)

ValueXArray.extend(values)

Extend by appending the values.

Arguments:
  • values (ValueVector | InputValue[])

Returns:

ValueUUId

ValueXArray.hasPosition(position)

Return true if the position exists.

Arguments:
  • position (ValueUUId)

Returns:

boolean

ValueXArray.index(position)

Return the index of the position, or undefined if the array does not hold it.

Arguments:
  • position (ValueUUId)

Returns:

number | undefined

ValueXArray.insert(beforePosition, value, newPosition)
Insert the value beforePosition and return the new position. Use newPosition if

specified, else a new position is created.

Arguments:
  • beforePosition (ValueUUId)

  • value (InputValue)

  • newPosition (ValueUUId | null)

Returns:

ValueUUId

ValueXArray.insertPosition(beforePosition, newPosition)

Insert beforePosition a newPosition.

Arguments:
  • beforePosition (ValueUUId)

  • newPosition (ValueUUId)

ValueXArray.items(encoded)
Return the list of (position, value) pairs. With encoded true (the default) a scalar

value is a JS native; with encoded false it is a typed Value.

Arguments:
  • encoded (boolean | null)

Returns:

[ValueUUId, Value | OutputValue][]

ValueXArray.position(index)

Return the position for the index or undefined.

Arguments:
  • index (number)

Returns:

ValueUUId | undefined

ValueXArray.positionOf(value)

Return the position of the value or undefined.

Arguments:
  • value (InputValue)

Returns:

ValueUUId | undefined

ValueXArray.positions()

Return the list of positions.

Returns:

ValueUUId[]

ValueXArray.rebuildFrom(source, elements)
Rebuild this XArray ATOMICALLY from another XArray’s position layout (positions and deleted

positions, copied opaquely from source) together with elements - a sequence of (position, value) pairs. The whole target state is installed in a single step, so this XArray never passes through a partial state (no foreign-typed values, no positions without values). This is the trans-definitions (de)serialization of an XArray: source’s layout verbatim, elements provided already re-mapped to this XArray’s domain.

Arguments:
  • source (ValueXArray)

  • elements ([ValueUUId, InputValue][])

ValueXArray.remove(position)
Remove the element at the position. The position is kept, addressing nothing:

hasPosition() still answers true and at() undefined.

Arguments:
  • position (ValueUUId)

ValueXArray.set(position, value)

Set the value at the position.

Arguments:
  • position (ValueUUId)

  • value (InputValue)

ValueXArray.size()

Return the number of elements.

Returns:

number

ValueXArray.toVector()

Convert to a vector<elementType>.

Returns:

ValueVector

ValueXArray.typeXarray()

Return the type xarray<elementType>.

Returns:

TypeXArray

static ValueXArray.cast(value)

Return value as a xarray<elementType>, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueXArray

static ValueXArray.createPosition()

Create and return a position.

Returns:

ValueUUId

class ValueOptional(type, value)

A value of type optional<elementType>.

Or use Value.create(typeOptional [, initialValue]).

This constructor builds a new container over the same elements, so only a mutation inside an element shows through.

exported from index.d

Extends:
  • Value

Arguments:
  • type (TypeOptional)

  • value (ValueOptional | InputValue)

ValueOptional.clear()

Clear the container.

ValueOptional.copy()

Return a deep copy.

Returns:

ValueOptional

ValueOptional.get(default_, encoded)

Return the wrapped value or return default if given; otherwise throw.

Where ValueMap.get answers undefined for a missing key, an empty optional with no default throws.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • default_ (InputValue)

  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueOptional.hash()
Returns:

bigint

ValueOptional.isNil()

Return true if there is no value to unwrap.

Returns:

boolean

ValueOptional.typeOptional()

Return the type optional<elementType>.

Returns:

TypeOptional

ValueOptional.unwrap(encoded)

Return the wrapped value or throw.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueOptional.wrap(value)

Store value in the optional, so it is no longer nil.

Arguments:
  • value (InputValue)

static ValueOptional.cast(value)

Return value as an optional, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueOptional

class ValueTuple()

A value of type tuple<T0, …>. Seamless with an array.

Or use Value.create(typeTuple [, initialValue]).

This constructor builds a new container over the same elements, so only a mutation inside an element shows through.

exported from index.d

Extends:
  • DeepKeyPath

  • Value

ValueTuple.[Symbol․iterator]()
Returns:

Iterator<OutputValue>

ValueTuple.at(index, encoded)

Return the value at index.

Passing encoded false returns a Value rather than a native JS value.

A negative index counts from the end, as Array.prototype.at does: at(-1) is the last element. Out of range still throws.

Arguments:
  • index (number)

  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueTuple.copy()

Return a deep copy.

Returns:

ValueTuple

ValueTuple.empty()

Return true if the container is empty.

Returns:

boolean

ValueTuple.replace(index, value)

Return a copy of the tuple with value at index.

Arguments:
  • index (number)

  • value (InputValue)

Returns:

ValueTuple

ValueTuple.set(index, value)

Set the value at index.

Arguments:
  • index (number)

  • value (InputValue)

ValueTuple.size()

Return the number of elements.

Returns:

number

ValueTuple.typeTuple()

Return the type tuple<T0,…>.

Returns:

TypeTuple

static ValueTuple.cast(value)

Return value as a tuple, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueTuple

class ValueTupleIter()

Iterator for ValueTuple elements.

Note: Not directly instantiable.

exported from index.d

ValueTupleIter.[Symbol․iterator]()
Returns:

Iterator<OutputValue>

ValueTupleIter.next()
Returns:

{ done: boolean; value: OutputValue; }

class ValueVec(typeVec, initialValue)

A value of type vec<numericType, size>. Seamless with an array of numbers.

Or use Value.create(typeVec [, initialValue]).

This constructor builds a new container over the same elements, so only a mutation inside an element shows through.

exported from index.d

Extends:
  • Value

Arguments:
  • typeVec (TypeVec)

  • initialValue (ValueVec | InputValue[] | null)

ValueVec.[Symbol․iterator]()

Iterate the elements (each via at(), so a number, or bigint for int64/uint64).

Returns:

Iterator<NumericOutputValue>

ValueVec.at(index, encoded)

Return the value at index.

Passing encoded false returns a Value rather than a native JS value.

A negative index counts from the end, as Array.prototype.at does: at(-1) is the last element. Out of range still throws.

Arguments:
  • index (number)

  • encoded (boolean | null)

Returns:

Value | NumericOutputValue

ValueVec.copy()

Return a deep copy.

Returns:

ValueVec

ValueVec.hash()

Return the hash value.

Returns:

bigint

ValueVec.set(index, value)

Set the value at index.

Arguments:
  • index (number)

  • value (NumericInputValue)

ValueVec.size()

Return the number of elements.

Returns:

number

ValueVec.toArray()

Return the elements as a native array (number, or bigint for int64/uint64).

Returns:

NumericOutputValue[]

ValueVec.typeVec()

Return the type vec<elementType, size>.

Returns:

TypeVec

static ValueVec.cast(value)

Return value as a vec<elementType, size>, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueVec

class ValueMat(type, value)
A value of type mat<numericType, columns, rows>, stored column-major. Seamless with

an array of arrays of numbers whose outer array lists the columns.

Or use Value.create(typeMat [, initialValue]).

This constructor builds a new container over the same elements, so only a mutation inside an element shows through.

exported from index.d

Extends:
  • Value

Arguments:
  • type (TypeMat)

  • value (ValueMat | InputValue[] | null)

ValueMat.[Symbol․iterator]()
Iterate the columns, each a native array of its rows (number, or bigint for

int64/uint64): the order at(column, row) and toArray() follow.

Returns:

Iterator<NumericOutputValue[]>

ValueMat.at(column, row, encoded)

Return the value at column and row.

Passing encoded false returns a Value rather than a native JS value.

A negative column or row counts from that end, as Array.prototype.at does. Out of range still throws.

Arguments:
  • column (number)

  • row (number)

  • encoded (boolean | null)

Returns:

Value | NumericOutputValue

ValueMat.columns()

Return the number of columns.

Returns:

number

ValueMat.copy()

Return a deep copy.

Returns:

ValueMat

ValueMat.hash()

Return the hash value.

Returns:

bigint

ValueMat.rows()

Return the number of rows.

Returns:

number

ValueMat.set(column, row, value)

Set the value at column, row.

Arguments:
  • column (number)

  • row (number)

  • value (NumericInputValue)

ValueMat.size()

Return the number of elements.

Returns:

number

ValueMat.toArray()
Return the elements column-major as a native 2D array (number, or bigint for

int64/uint64).

Returns:

NumericOutputValue[][]

ValueMat.typeMat()

Return the type mat<elementType, columns, rows>.

Returns:

TypeMat

static ValueMat.cast(value)

Return value as a mat, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueMat

class ValueVariant(type, value)
A value of type variant<T0, …>. Seamless with a JS value compatible with the variant’s

types.

Or use Value.create(typeVariant [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • type (TypeVariant)

  • value (ValueVariant | InputValue)

ValueVariant.copy()

Return a deep copy.

Returns:

ValueVariant

ValueVariant.hash()

Return the hash value.

Returns:

bigint

ValueVariant.typeVariant()

Return the type variant<T0, …>.

Returns:

TypeVariant

ValueVariant.unwrap(encoded)

Return the value or throw.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueVariant.wrap(value, type)
Store value in the variant, as type when the variant admits more than one that

fits.

Arguments:
  • value (InputValue)

  • type (Type | null)

static ValueVariant.cast(value)

Return value as a variant<T0, …>, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueVariant

class ValueAny(initialValue)

A value of any type. Seamless with many JS values.

Or use Value.create(Type.ANY [, initialValue]).

exported from index.d

Extends:
  • Value

Arguments:
  • initialValue (ValueAny | InputValue)

ValueAny.clear()

Clear the container.

ValueAny.copy()

Return a deep copy.

Returns:

ValueAny

ValueAny.hash()

Return the hash value.

Returns:

bigint

ValueAny.isNil()

Return true if there is no value to unwrap.

Returns:

boolean

ValueAny.unwrap(encoded)

Return the wrapped value or throw.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueAny.wrap(value)

Wrap a value.

Arguments:
  • value (InputValue | undefined)

static ValueAny.cast(value)

Return value as an any, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueAny

class ValueStructure()

A value of type struct. Seamless with an object keyed by field name.

Or use Value.create(typeStructure [, initialValue]).

A field is written with set(fieldName, value) or assign({…}), and read with at(fieldName). The handle is sealed, so a field written as a property never lands beside the value: strict code - an ES module, a class body - throws TypeError, and a sloppy script drops the write silently. Reading a field as a property answers undefined.

This constructor builds a new container over the same elements, so only a mutation inside an element shows through.

exported from index.d

Extends:
  • DeepKeyPath

  • Value

ValueStructure.assign(fields)

Set several fields at once from a plain object (type-checked per field; returns this).

Arguments:
  • fields ({ [fieldName: string]: InputValue | undefined; })

Returns:

ValueStructure

ValueStructure.at(fieldName, encoded)

Return the value of the field called fieldName.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • fieldName (string)

  • encoded (boolean | null)

Returns:

Value | OutputValue

ValueStructure.copy()

Return a deep copy.

Returns:

ValueStructure

ValueStructure.set(fieldName, value)

Write value into the field called fieldName.

Arguments:
  • fieldName (string)

  • value (InputValue)

ValueStructure.toObject(encoded)
Return the fields as a plain object - the structure’s encoded projection,

i.e. at(fieldName, encoded) applied per field. Shallow: scalar fields become native, container fields stay typed handles; for a deep plain object use Value.dumps.

Arguments:
  • encoded (boolean | null)

Returns:

{ [fieldName: string]: Value | OutputValue; }

ValueStructure.typeStructure()

Return the type struct.

Returns:

TypeStructure

static ValueStructure.cast(value)

Return value as a struct, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueStructure

class ValueEnumeration(type, value)

A value of type enum. Seamless with a string, or its ordinal as a number.

Or use Value.create(typeEnumeration [, initialValue]). If the initialValue is not specified, the first enum case is used.

A case is written ‘a’, ‘.a’ or ‘NS::E.a’, where NS::E is the qualified name of the enum; any other string throws. The string representation of a case starts with a ‘.’.

exported from index.d

Extends:
  • Value

Arguments:
  • type (TypeEnumeration)

  • value (string | number | ValueEnumeration | null)

ValueEnumeration.copy()

Return a deep copy.

Returns:

ValueEnumeration

ValueEnumeration.hash()
Returns:

bigint

ValueEnumeration.index()

Return the index.

Returns:

number

ValueEnumeration.name()

Return the name of the enumeration case.

Returns:

string

ValueEnumeration.typeEnumeration()

Return the type enum.

Returns:

TypeEnumeration

static ValueEnumeration.cast(value)

Return value as an enum, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueEnumeration

static ValueEnumeration.tryParse(string, typeEnumeration)

Return string parsed as a case of typeEnumeration, or undefined if it names none.

Arguments:
  • string (string)

  • typeEnumeration (TypeEnumeration)

Returns:

ValueEnumeration | undefined

class ValueKey()

A value of type key<elementType>. Use the static factory method create(…).

Note: Not directly instantiable.

exported from index.d

Extends:
  • Value

ValueKey.copy()

Return a deep copy.

Returns:

ValueKey

ValueKey.detailRepresentation()

Return the representation, with the concept name spelled out.

Returns:

string

ValueKey.detailTypeRepresentation()

Return the key’s type, naming the concept of its instance.

‘key<Concept>’ for a key typed by its own concept; when the key is typed by a club, by any_concept or by a parent concept, that type followed by the concept in parentheses: ‘key<Club>(Concept)’. The instance uuid is not part of it.

Returns:

string

ValueKey.hasParentKey()

Return true if a parent key is available.

Returns:

boolean

ValueKey.hash()

Return the hash value.

Returns:

bigint

ValueKey.instanceId()

Return the uuid of the instance.

Returns:

ValueUUId

ValueKey.isMember(targetConcept)

Return true if targetConcept is a member.

Arguments:
  • targetConcept (TypeConcept)

Returns:

boolean

ValueKey.toAnyConceptKey()

Return a key<any_concept>.

Returns:

ValueKey

ValueKey.toClubKey(typeClub)

Return value as a key<typeClub>, or throw if it is not one.

Arguments:
  • typeClub (TypeClub)

Returns:

ValueKey

ValueKey.toConceptKey()

Return a key<typeConcept>.

Returns:

ValueKey

ValueKey.toKey(typeKey)

Return value as a key<typeKey>, or throw if it is not one.

Arguments:
  • typeKey (TypeKey)

Returns:

ValueKey

ValueKey.toMemberKey(targetConcept)

Return value as a key<targetConcept>, or throw if it is not one.

Arguments:
  • targetConcept (TypeConcept)

Returns:

ValueKey

ValueKey.toParentKey()

Return value as a key<parentConcept>, or throw if it is not one.

Returns:

ValueKey

ValueKey.typeConcept()

Return the type of the concept.

Returns:

TypeConcept

ValueKey.typeKey()

Return the TypeKey.

Returns:

TypeKey

static ValueKey.cast(value)

Return value as a key, or throw if it is not one.

Arguments:
  • value (Value | OutputValue)

Returns:

ValueKey

static ValueKey.create(typeConcept, instanceId)
Return a key naming an instance of typeConcept - instanceId, or a fresh uuid when it

is undefined.

Arguments:
  • typeConcept (TypeConcept)

  • instanceId (string | ValueUUId | null)

Returns:

ValueKey

static ValueKey.keys(key)

Return key and every key above it, from the instance up to its root concept.

Arguments:
  • key (ValueKey)

Returns:

ValueKey[]

class ValueProgram()

The sequence of opcodes a commit carries.

Accumulated by CommitMutableState as mutations are applied, and decoded back when the commit is read. allOpcodes() returns the whole sequence; opcodes() and documentSetKeys() index it by key and by attachment.

Note: Not directly instantiable.

exported from index.d

ValueProgram.allOpcodes()

Return the list of all opcodes.

Returns:

ValueOpcode[]

ValueProgram.documentSetKeys(attachmentRuntimeId)
Return the distinct ValueOpcodeKey of type ‘Document_Set’ associated with the

attachmentRuntimeId.

Arguments:
  • attachmentRuntimeId (ValueUUId)

Returns:

ValueOpcodeKey[]

ValueProgram.hasDocumentSet(opcodeKey)

Return true if an opcode ‘Document_Set’ is associated with the opcodeKey.

Arguments:
  • opcodeKey (ValueOpcodeKey)

Returns:

boolean

ValueProgram.opcodes(attachmentRuntimeId, key)

Return the list of opcodes applying to key under attachmentRuntimeId.

key is the instance’s ValueKey, not a ValueOpcodeKey: the two arguments together make the ValueOpcodeKey the program is indexed by.

Arguments:
  • attachmentRuntimeId (ValueUUId)

  • key (ValueKey)

Returns:

ValueOpcode[]

class ValueOpcodeKey()

What an opcode applies to: an attachment, an instance, and that instance’s concept.

Three runtime ids and their combined hash - the key a ValueProgram indexes its opcodes by. It names a document without reading one.

Note: Not directly instantiable.

exported from index.d

ValueOpcodeKey.attachmentRuntimeId()

Return the runtime id of the attachment the opcode applies to.

Returns:

ValueUUId

ValueOpcodeKey.compare(other)

Return -1, 0 or 1. Throws if other is not a ValueOpcodeKey.

Arguments:
  • other (ValueOpcodeKey)

Returns:

number

ValueOpcodeKey.conceptRuntimeId()

Return the uuid identifying the concept’s type.

It follows from the namespace uuid and the name, so the same declaration yields the same id in any Definitions.

Returns:

ValueUUId

ValueOpcodeKey.equals(other)
Return true if both are equal: the same instance, attachment and concept. other

of another type answers false.

Arguments:
  • other (unknown)

Returns:

boolean

ValueOpcodeKey.hashKey()
Return a bigint that is equal for two keys that are equal, so a native Map or Set

holds a key by value rather than by identity.

Returns:

bigint

ValueOpcodeKey.instanceId()

Return the uuid of the instance of the concept.

Returns:

ValueUUId

class ValueOpcode()

The base of the opcode hierarchy.

Recorded by CommitMutableState as it applies mutations through the AttachmentMutating interface, and read back through the concrete subclasses: type() and key(), plus each one’s own arguments.

Note: Not directly instantiable.

exported from index.d

ValueOpcode.key()
Return the ValueOpcodeKey the opcode applies to - the attachment, the instance

and its concept.

Returns:

ValueOpcodeKey

ValueOpcode.type()

Return the name of this opcode’s kind, such as ‘Document_Set’ or ‘Map_Update’.

Returns:

string

class ValueOpcodeDocumentSet()

Writes a whole document at a key - the only opcode without a path.

Note: Not directly instantiable.

exported from index.d

Extends:
  • ValueOpcode

ValueOpcodeDocumentSet.arguments(definitions, encoded)
Return (attachment, key, value), resolving the ids the opcode carries against

definitions.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • definitions (DefinitionsConst)

  • encoded (boolean | null)

Returns:

[Attachment, ValueKey, Value | OutputValue]

ValueOpcodeDocumentSet.value()

Return the document the opcode writes whole.

Returns:

Value

class ValueOpcodeDocumentUpdate()

Writes a value at a path inside a document.

Note: Not directly instantiable.

exported from index.d

Extends:
  • ValueOpcode

ValueOpcodeDocumentUpdate.arguments(definitions, encoded)
Return (attachment, key, path, value), resolving the ids the opcode carries against

definitions.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • definitions (DefinitionsConst)

  • encoded (boolean | null)

Returns:

[Attachment, ValueKey, PathConst, Value | OutputValue]

ValueOpcodeDocumentUpdate.path()

Return the Path inside the document the opcode writes at.

Returns:

PathConst

ValueOpcodeDocumentUpdate.value()

Return the value the opcode writes at path.

Returns:

Value

class ValueOpcodeMapUnion()

Adds entries to the map at a path, replacing the keys already there.

Note: Not directly instantiable.

exported from index.d

Extends:
  • ValueOpcode

ValueOpcodeMapUnion.arguments(definitions, encoded)
Return (attachment, key, path, value), resolving the ids the opcode carries against

definitions.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • definitions (DefinitionsConst)

  • encoded (boolean | null)

Returns:

[Attachment, ValueKey, PathConst, ValueMap]

ValueOpcodeMapUnion.path()

Return the Path inside the document the opcode writes at.

Returns:

PathConst

ValueOpcodeMapUnion.value()

Return the entries the opcode adds to the map.

Returns:

ValueMap

class ValueOpcodeMapSubtract()

Removes from the map at a path the entries whose key it carries.

Note: Not directly instantiable.

exported from index.d

Extends:
  • ValueOpcode

ValueOpcodeMapSubtract.arguments(definitions, encoded)
Return (attachment, key, path, value), resolving the ids the opcode carries against

definitions.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • definitions (DefinitionsConst)

  • encoded (boolean | null)

Returns:

[Attachment, ValueKey, PathConst, ValueSet<OutputValue>]

ValueOpcodeMapSubtract.path()

Return the Path inside the document the opcode writes at.

Returns:

PathConst

ValueOpcodeMapSubtract.value()

Return the keys the opcode removes from the map.

Returns:

ValueSet

class ValueOpcodeMapUpdate()

Writes entries over the keys the map at a path already holds, inserting none.

An entry whose key the map does not hold is left out, where ValueMap.update inserts it - ValueOpcodeMapUnion is the opcode that does.

Note: Not directly instantiable.

exported from index.d

Extends:
  • ValueOpcode

ValueOpcodeMapUpdate.arguments(definitions, encoded)
Return (attachment, key, path, value), resolving the ids the opcode carries against

definitions.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • definitions (DefinitionsConst)

  • encoded (boolean | null)

Returns:

[Attachment, ValueKey, PathConst, ValueMap]

ValueOpcodeMapUpdate.path()

Return the Path inside the document the opcode writes at.

Returns:

PathConst

ValueOpcodeMapUpdate.value()

Return the entries the opcode writes over the keys already there.

Returns:

ValueMap

class ValueOpcodeSetUnion()

Adds elements to the set at a path.

Note: Not directly instantiable.

exported from index.d

Extends:
  • ValueOpcode

ValueOpcodeSetUnion.arguments(definitions, encoded)
Return (attachment, key, path, value), resolving the ids the opcode carries against

definitions.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • definitions (DefinitionsConst)

  • encoded (boolean | null)

Returns:

[Attachment, ValueKey, PathConst, ValueSet<OutputValue>]

ValueOpcodeSetUnion.path()

Return the Path inside the document the opcode writes at.

Returns:

PathConst

ValueOpcodeSetUnion.value()

Return the elements the opcode adds to the set.

Returns:

ValueSet

class ValueOpcodeSetSubtract()

Removes elements from the set at a path.

Note: Not directly instantiable.

exported from index.d

Extends:
  • ValueOpcode

ValueOpcodeSetSubtract.arguments(definitions, encoded)
Return (attachment, key, path, value), resolving the ids the opcode carries against

definitions.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • definitions (DefinitionsConst)

  • encoded (boolean | null)

Returns:

[Attachment, ValueKey, PathConst, ValueSet<OutputValue>]

ValueOpcodeSetSubtract.path()

Return the Path inside the document the opcode writes at.

Returns:

PathConst

ValueOpcodeSetSubtract.value()

Return the elements the opcode removes from the set.

Returns:

ValueSet

class ValueOpcodeXArrayInsert()

Inserts a position into the xarray at a path, before another one.

Note: Not directly instantiable.

exported from index.d

Extends:
  • ValueOpcode

ValueOpcodeXArrayInsert.arguments(definitions)
Return (attachment, key, path, beforePosition, newPosition), resolving the ids the

opcode carries against definitions.

Arguments:
  • definitions (DefinitionsConst)

Returns:

[Attachment, ValueKey, PathConst, ValueUUId, ValueUUId]

ValueOpcodeXArrayInsert.beforePosition()

Return the position the new one is inserted before.

Returns:

ValueUUId

ValueOpcodeXArrayInsert.path()

Return the Path inside the document the opcode writes at.

Returns:

PathConst

ValueOpcodeXArrayInsert.position()

Return the position in the xarray the opcode acts on.

Returns:

ValueUUId

class ValueOpcodeXArrayRemove()
Removes the element at a position of the xarray at a path. The position is kept,

addressing nothing, as ValueXArray.remove keeps it.

Note: Not directly instantiable.

exported from index.d

Extends:
  • ValueOpcode

ValueOpcodeXArrayRemove.arguments(definitions)
Return (attachment, key, path, position), resolving the ids the opcode carries

against definitions.

Arguments:
  • definitions (DefinitionsConst)

Returns:

[Attachment, ValueKey, PathConst, ValueUUId]

ValueOpcodeXArrayRemove.path()

Return the Path inside the document the opcode writes at.

Returns:

PathConst

ValueOpcodeXArrayRemove.position()

Return the position in the xarray the opcode acts on.

Returns:

ValueUUId

class ValueOpcodeXArrayUpdate()

Writes a value at a position of the xarray at a path.

Note: Not directly instantiable.

exported from index.d

Extends:
  • ValueOpcode

ValueOpcodeXArrayUpdate.arguments(definitions, encoded)
Return (attachment, key, path, position, value), resolving the ids the opcode

carries against definitions.

Passing encoded false returns a Value rather than a native JS value.

Arguments:
  • definitions (DefinitionsConst)

  • encoded (boolean | null)

Returns:

[Attachment, ValueKey, PathConst, ValueUUId, Value | OutputValue]

ValueOpcodeXArrayUpdate.path()

Return the Path inside the document the opcode writes at.

Returns:

PathConst

ValueOpcodeXArrayUpdate.position()

Return the position in the xarray the opcode acts on.

Returns:

ValueUUId

ValueOpcodeXArrayUpdate.value()

Return the value the opcode writes at position.

Returns:

Value

class ValueProcessorTrace()

The execution of one program: whether it ran, and the opcodes it applied.

Note: Not directly instantiable.

exported from index.d

ValueProcessorTrace.enabled()

Return true if the commit this trace came from was enabled.

Returns:

boolean

ValueProcessorTrace.opcodes()

Return the list of traces opcodes.

Returns:

ValueProcessorTraceOpcode[]

class ValueProcessorTraceOpcode()

One step of a traced execution: the opcode, and the exception it threw if it did.

Note: Not directly instantiable.

exported from index.d

ValueProcessorTraceOpcode.exception()

Return the exception or undefined.

Returns:

string | undefined

ValueProcessorTraceOpcode.opcode()

Return the opcode this trace step applied.

Returns:

ValueOpcode