Core utilities

This is the catch-all bucket for the cross-cutting primitives the rest of the binding builds on: Definitions and NameSpace register the DSM types of an application; Path addresses and edits a portion of a nested value; Error parses the structured description carried by a thrown Viper error; the Hash* family hashes blobs; and the Logger* family emits leveled diagnostics. Because the bucket is broad, the Quick Start below touches only a representative few — consult the Reference section below for the rest.

When to use: reach for Path to navigate or mutate nested values by location; for Error to turn a caught ViperError into queryable fields; and for the logging family when you need leveled, optionally-captured diagnostics. Definitions and NameSpace come into play when you register custom types (see Database).

Quick Start

const { Path, Error: VError, LoggerReport, ValueInt64, ValueString } =
    require('@digitalsubstrate/dsviper');

// Path — address a portion of a nested value, then read or write it.
// JS has no `/` operator overload, so chain the fluent .field()/.index()/.key().
const path = new Path().field('user').field('settings').key('theme').const();
path.representation();              // human-readable, includes "user" / "settings"
// path.at(value) reads; path.set(value, 'dark') writes; both take a Value.
const decoded = Path.decode(path.encode(), defs.const());  // ValueBlob round-trip

// Error — a thrown Viper runtime error is a JS Error with a structured message.
try {
    ValueInt64.cast(new ValueString('hello'));   // type mismatch -> throws
} catch (e) {
    e.name;                        // "ViperError"
    const err = VError.parse(e.message);          // undefined if it doesn't match
    err.component();               // "Viper.ValueInt64"
    err.domain();                  // "TypeErrors"
    err.code();                    // a number
    err.message();                 // "expected int64, got string [cast]."
    err.explained();               // multi-line, all fields
}

// Logging — a leveled facade. Levels are raw uint8 severities passed to the
// constructor (DEBUG=10, INFO=20, WARNING=30, ERROR=40, CRITICAL=50); a logger
// emits only when its level <= the message level. LoggerReport captures to an
// array; LoggerConsole writes to stdout; LoggerNull discards.
const reporter = new LoggerReport(20);            // INFO and above
const log = reporter.logging();
log.info('started');
log.warning('careful');
reporter.messages();               // ["INF:started", "WNG:careful"]

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

Key classes

Class

Purpose

Example

Path

Address and edit a portion of a nested value

new Path().field('x').key('k')

Error

Parse a thrown ViperError into fields

Error.parse(e.message)

Logging

Leveled diagnostics interface

logger.logging().info(msg)

LoggerReport

Capture messages into an array

new LoggerReport(20).messages()

HashSHA1

Hash a ValueBlob (also MD5, SHA256, SHA3, CRC32)

HashSHA1.hash(blob)

NameSpace

Group registered types under a UUID

new NameSpace(uuid, 'App')

Definitions

Register custom DSM types

new Definitions()

The mirror of this page for the Python binding is Core Utilities.

Summary

Class

Description

Cancelation

A cooperative cancellation flag shared between a host signal handler and a server loop

Databasing

An interface used to abstract the implementation of the persistence layer for a CRUD like database

DocumentNode

A class used to represent a node in the tree representation of a value

Error

The structured error raised by Viper: component, domain, code and message

Float16

A class used to handle float16 representation

FunctionPrototype

A class used to represent the prototype of a function

HashCRC32

A class used to hash data with CRC32

HashMD5

A class used to hash data with MD5

HashSHA1

A class used to hash data with SHA1

HashSHA256

A class used to hash data with SHA256

HashSHA3

A class used to hash a data with SHA3

Hashing

An interface to abstract a hasher

Html

A class used to generate HTML representation

KeyHelper

A class used to collect keys, attachments and missing attachments for a key

KeyNamer

A class used to get a name for a key from available attachments

LoggerConsole

A class used to display a message on the console

LoggerNull

A class used to discard messages

LoggerReport

A class used to collect messages

Logging

An interface to emit a message

NameSpace

A class used to describe a namespace

Path

A class used to construct the location of a portion of a value

PathComponent

A class used to represent a component of a Path

PathConst

A class used to retrieve a value from a Path

PathElementInfo

A class used to represent the various information for an element of a set

PathEntryKeyInfo

A class used to represent various information for an entry of a map

SQLite

A class used to retrieve the configuration of SQLite3

ServiceRemote

A class used to connect to a remote service

ServiceRemoteAttachmentFunction

A class used to call a remote attachment function

ServiceRemoteAttachmentFunctionPool

A class used to represent a remote attachment function pool

ServiceRemoteAttachmentFunctionPoolFunction

A class used to represent a remote attachment function

ServiceRemoteAttachmentFunctionPoolFunctions

A class used to represent the remote attachment functions

ServiceRemoteFunction

A class used to call a remote function

ServiceRemoteFunctionPool

A class used to represent a remote function pool

ServiceRemoteFunctionPoolFunction

A class used to represent a remote function

ServiceRemoteFunctionPoolFunctions

A class used to represent the functions of a pool

SharedMemory

A class used to represent a shared memory region

Socket

A passive (listening) socket for a server

Reference

class Cancelation()
A cooperative cancellation flag, shared between a host signal handler and a

server loop. Set it from a SIGINT handler and test it between step() calls.

exported from index.d

Cancelation.cancel()

Request cancellation. Safe to call from a signal handler.

Cancelation.requested()

Return true once cancellation has been requested.

Returns:

boolean

class Databasing()
An interface used to abstract the implementation of the persistence layer for a

CRUD like database.

Note: Not directly instantiable.

exported from index.d

Databasing.TRANSACTION_DEFERRED

type: readonly string

Databasing.TRANSACTION_EXCLUSIVE

type: readonly string

Databasing.TRANSACTION_IMMEDIATE

type: readonly string

Databasing.[Symbol․dispose]()

Release the resource at scope exit via using (TC39 disposable); delegates to close(). Idempotent.

Databasing.beginTransaction(mode)
Begin a transaction where the mode is ‘Deferred’, ‘Immediate’ or

‘Exclusive’.

Arguments:
  • mode (string)

Databasing.blob(blobId)

Return a blob or null.

Arguments:
  • blobId (ValueBlobId)

Returns:

ValueBlob | undefined

Databasing.blobIds()

Return the set of blob_id of all blobs.

Returns:

ValueBlobId[]

Databasing.blobInfo(blobId)

Return the information for the blob or null.

Arguments:
  • blobId (ValueBlobId)

Returns:

BlobInfo | undefined

Databasing.blobInfos(blobIds)

Return a list of BlobInfo.

Arguments:
  • blobIds (ValueBlobId[])

Returns:

BlobInfo[]

Databasing.blobStatistics()

Return the statistics for blobs.

Returns:

BlobStatistics

Databasing.blobStreamClose(streamId, blobId)

Close the stream.

Arguments:
  • streamId (ValueUUId)

  • blobId (ValueBlobId)

Databasing.blobStreamCreate(blobLayout, size)

Return the uuid of the stream.

Arguments:
  • blobLayout (BlobLayout)

  • size (number)

Returns:

ValueUUId

Databasing.blobStreamDelete(streamId)

Delete the stream.

Arguments:
  • streamId (ValueUUId)

Databasing.blobStreamWrite(streamId, blob, offset)

write a region of the blob.

Arguments:
  • streamId (ValueUUId)

  • blob (ValueBlob)

  • offset (number)

Databasing.close()

Close the database.

Databasing.codecName()

Return the name of the codec.

Returns:

string

Databasing.commit()

Commit the transaction.

Databasing.createBlob(blobId, blobLayout, blob)

Create the blob and return a boolean.

Arguments:
  • blobId (ValueBlobId)

  • blobLayout (BlobLayout)

  • blob (ValueBlob)

Returns:

boolean

Databasing.createZeroBlob(blobId, blobLayout, size)

Return the true if the blob was created.

Arguments:
  • blobId (ValueBlobId)

  • blobLayout (BlobLayout)

  • size (number)

Returns:

boolean

Databasing.dataVersion()

Return the data version.

Returns:

number

Databasing.definitions()

Return the definitions.

Returns:

DefinitionsConst

Databasing.definitionsHexdigest()

Return the definitions.

Returns:

string

Databasing.delBlob(blobId)

Return true if the blob was deleted.

Arguments:
  • blobId (ValueBlobId)

Returns:

boolean

Databasing.delete(attachment, key)

Return true if the value was deleted.

Arguments:
  • attachment (Attachment)

  • key (ValueKey)

Returns:

boolean

Databasing.documentation()

Return the documentation.

Returns:

string

Databasing.extendDefinitions(other)

Extend the definitions.

Arguments:
  • other (DefinitionsConst)

Returns:

DefinitionsExtendInfo

Databasing.freezeBlob(blobId)

Return true if the blob was frozen.

Arguments:
  • blobId (ValueBlobId)

Returns:

boolean

Databasing.get(attachment, key)

Return an optional<document_type> associated with the key.

Arguments:
  • attachment (Attachment)

  • key (ValueKey)

Returns:

ValueOptional

Databasing.has(attachment, key)

Return true if a value is present for the key.

Arguments:
  • attachment (Attachment)

  • key (ValueKey)

Returns:

boolean

Databasing.inTransaction()

Return true if a transaction is running.

Returns:

boolean

Databasing.isClosed()

Return true if the database is closed.

Returns:

boolean

Databasing.keys(attachment)

Return the set of all keys.

Arguments:
  • attachment (Attachment)

Returns:

ValueSet

Databasing.path()

Return the path.

Returns:

string

Databasing.readBlob(blobId, size, offset)

Return the blob at offset.

Arguments:
  • blobId (ValueBlobId)

  • size (number)

  • offset (number)

Returns:

ValueBlob

Databasing.rollback()

Roll back the transaction.

Databasing.set(attachment, key, value)

Assigns the value to the key.

Arguments:
  • attachment (Attachment)

  • key (ValueKey)

  • value (InputValue)

Returns:

boolean

Databasing.uuid()

Return the uuid.

Returns:

ValueUUId

Databasing.writeBlob(blobId, blob, offset)

Write a region of the blob at offset.

Arguments:
  • blobId (ValueBlobId)

  • blob (ValueBlob)

  • offset (number)

class DocumentNode()

A class used to represent a node in the tree representation of a value.

Note: Not directly instantiable.

exported from index.d

DocumentNode.attachment()

Return the attachment.

Returns:

Attachment

DocumentNode.children()

Return the list of child.

Returns:

DocumentNode[]

DocumentNode.document()

Return the document.

Returns:

Value

DocumentNode.isBlobId()

Return true the node is a blob_id.

Returns:

boolean

DocumentNode.isBoolean()

Return true the node is a boolean.

Returns:

boolean

DocumentNode.isCollection()

Return true the node is a collection.

Returns:

boolean

DocumentNode.isContainer()

Return true it’s a container.

Returns:

boolean

DocumentNode.isDouble()

Return true the node is a double.

Returns:

boolean

DocumentNode.isEditable()

Return true if it’s editable.

Returns:

boolean

DocumentNode.isEnumeration()

Return true the node is an enumeration.

Returns:

boolean

DocumentNode.isExpandable()

Return true the node is expandable.

Returns:

boolean

DocumentNode.isFloat()

Return true the node is a float.

Returns:

boolean

DocumentNode.isInt16()

Return true the node is an int16.

Returns:

boolean

DocumentNode.isInt32()

Return true the node is an int32.

Returns:

boolean

DocumentNode.isInt64()

Return true the node is an int64.

Returns:

boolean

DocumentNode.isInt8()

Return true the node is an int8.

Returns:

boolean

DocumentNode.isInteger()

Return true the node is an integer.

Returns:

boolean

DocumentNode.isKey()

Return true the node is a key.

Returns:

boolean

DocumentNode.isNumeric()

Return true the node is a number.

Returns:

boolean

DocumentNode.isPrimitive()

Return true the node is a primitive.

Returns:

boolean

DocumentNode.isReadonly()

Return true if it’s readonly.

Returns:

boolean

DocumentNode.isReal()

Return true the node is real.

Returns:

boolean

DocumentNode.isString()

Return true the node is a string.

Returns:

boolean

DocumentNode.isUint16()

Return true the node is an uint16.

Returns:

boolean

DocumentNode.isUint32()

Return true the node is an uint32.

Returns:

boolean

DocumentNode.isUint64()

Return true the node is an uint64.

Returns:

boolean

DocumentNode.isUint8()

Return true the node is an uint8.

Returns:

boolean

DocumentNode.isUuid()

Return true the node is an uuid.

Returns:

boolean

DocumentNode.key()

Return the key.

Returns:

ValueKey

DocumentNode.parent()

Return the parent or null.

Returns:

DocumentNode | undefined

DocumentNode.path()

Return the path.

Returns:

PathConst

DocumentNode.stringComponent()

Return the string component.

Returns:

string

DocumentNode.stringComponentTooltip()

Return the string component tooltip.

Returns:

string

DocumentNode.stringPath()

Return the string path.

Returns:

string

DocumentNode.stringType()

Return the string type.

Returns:

string

DocumentNode.stringValue()

Return the string_value.

Returns:

string

DocumentNode.stringValueTooltip()

Return the string value tooltip.

Returns:

string

DocumentNode.type()

Return the type of node.

Returns:

string

DocumentNode.uuid()

Return the uuid.

Returns:

ValueUUId

DocumentNode.value()

Return the value.

Returns:

Value

static DocumentNode.createDocuments(key, attachmentGetting)

Return a list of documents as a hierarchy of DocumentNode.

Arguments:
  • key (ValueKey)

  • attachmentGetting (AttachmentGetting)

Returns:

DocumentNode[]

class Error(module, domain, code, message)

The structured error raised by Viper: component, domain, code and message.

exported from index.d

Arguments:
  • module (string)

  • domain (string)

  • code (number)

  • message (string)

Error.code()

Return the code.

Returns:

number

Error.component()

Return the component.

Returns:

string

Error.domain()

Return the domain.

Returns:

string

Error.explained()

Return the explanation of the error.

Returns:

string

Error.hostname()

Return the hostname.

Returns:

string

Error.message()

Return the message.

Returns:

string

Error.processName()

Return the process name.

Returns:

string

static Error.parse(description)

Return an Error or null.

Arguments:
  • description (string)

Returns:

Error | undefined

static Error.setProcessName(name)

Assign the name of the process reported in Error.

Arguments:
  • name (string)

class Float16()

A class used to handle float16 representation.

Note: Not directly instantiable.

exported from index.d

static Float16.fromFloat(v)

Return the float16 as an unsigned int.

Arguments:
  • v (number)

Returns:

number

static Float16.toFloat(v)

Return the float from an unsigned int representing a float16 storage.

Arguments:
  • v (number)

Returns:

number

class FunctionPrototype()

A class used to represent the prototype of a function.

Note: Not directly instantiable.

exported from index.d

FunctionPrototype.parameters()

Return the list of parameters.

Returns:

[string, Type][]

FunctionPrototype.returnType()

Return the type of the returned value.

Returns:

Type

class HashCRC32()

A class used to hash data with CRC32.

exported from index.d

HashCRC32.blockSize()

Return the internal block size of the hash algorithm in bytes.

Returns:

number

HashCRC32.digest()

Return the digest.

Returns:

ValueBlob

HashCRC32.digestSize()

Return the size of the resulting hash in bytes.

Returns:

number

HashCRC32.hashing()

Return the Hashing interface.

Returns:

Hashing

HashCRC32.hexdigest()

Return the digest in hexadecimal.

Returns:

string

HashCRC32.name()

Return the name.

Returns:

string

HashCRC32.reset()

Reset the hasher.

HashCRC32.update(blob)

Update the data.

Arguments:
  • blob (ValueBlob)

static HashCRC32.hash(blob)

Return the hexdigest of the blob.

Arguments:
  • blob (ValueBlob)

Returns:

string

class HashMD5()

A class used to hash data with MD5.

exported from index.d

HashMD5.blockSize()

Return the internal block size of the hash algorithm in bytes.

Returns:

number

HashMD5.digest()

Return the digest.

Returns:

ValueBlob

HashMD5.digestSize()

Return the size of the resulting hash in bytes.

Returns:

number

HashMD5.hashing()

Return the Hashing interface.

Returns:

Hashing

HashMD5.hexdigest()

Return the digest in hexadecimal.

Returns:

string

HashMD5.name()

Return the name.

Returns:

string

HashMD5.reset()

Reset the hasher.

HashMD5.update(blob)

Update the data.

Arguments:
  • blob (ValueBlob)

static HashMD5.hash(blob)

Return the hexdigest of the blob.

Arguments:
  • blob (ValueBlob)

Returns:

string

class HashSHA1()

A class used to hash data with SHA1.

exported from index.d

HashSHA1.blockSize()

Return the internal block size of the hash algorithm in bytes.

Returns:

number

HashSHA1.digest()

Return the digest.

Returns:

ValueBlob

HashSHA1.digestSize()

Return the size of the resulting hash in bytes.

Returns:

number

HashSHA1.hashing()

Return the Hashing interface.

Returns:

Hashing

HashSHA1.hexdigest()

Return the digest in hexadecimal.

Returns:

string

HashSHA1.name()

Return the name.

Returns:

string

HashSHA1.reset()

Reset the hasher.

HashSHA1.update(blob)

Update the data.

Arguments:
  • blob (ValueBlob)

static HashSHA1.hash(blob)

Return the hexdigest of the blob.

Arguments:
  • blob (ValueBlob)

Returns:

string

class HashSHA256()

A class used to hash data with SHA256.

exported from index.d

HashSHA256.blockSize()

Return the internal block size of the hash algorithm in bytes.

Returns:

number

HashSHA256.digest()

Return the digest.

Returns:

ValueBlob

HashSHA256.digestSize()

Return the size of the resulting hash in bytes.

Returns:

number

HashSHA256.hashing()

Return the Hashing interface.

Returns:

Hashing

HashSHA256.hexdigest()

Return the digest in hexadecimal.

Returns:

string

HashSHA256.name()

Return the name.

Returns:

string

HashSHA256.reset()

Reset the hasher.

HashSHA256.update(blob)

Update the data.

Arguments:
  • blob (ValueBlob)

static HashSHA256.hash(blob)

Return the hexdigest of the blob.

Arguments:
  • blob (ValueBlob)

Returns:

string

class HashSHA3(bits)
A class used to hash a data with SHA3.

Supported bits are 224, 256, 384 or 512.

exported from index.d

Arguments:
  • bits (string)

HashSHA3.blockSize()

Return the internal block size of the hash algorithm in bytes.

Returns:

number

HashSHA3.digest()

Return the digest.

Returns:

ValueBlob

HashSHA3.digestSize()

Return the size of the resulting hash in bytes.

Returns:

number

HashSHA3.hashing()

Return the Hashing interface.

Returns:

Hashing

HashSHA3.hexdigest()

Return the hexa digest.

Returns:

string

HashSHA3.name()

Return the name.

Returns:

string

HashSHA3.reset()

Reset the hasher.

HashSHA3.update(blob)

Update the data.

Arguments:
  • blob (ValueBlob)

static HashSHA3.hash(blob, bits)

Return the hexdigest of the blob.

Arguments:
  • blob (ValueBlob)

  • bits (string)

Returns:

string

class Hashing()

An interface to abstract a hasher.

Note: Not directly instantiable.

exported from index.d

Hashing.blockSize()

Return the internal block size of the hash algorithm in bytes.

Returns:

number

Hashing.digest()

Return the digest.

Returns:

ValueBlob

Hashing.digestSize()

Return the size of the resulting hash in bytes.

Returns:

number

Hashing.hexdigest()

Return the digest in hexadecimal.

Returns:

string

Hashing.name()

Return the name.

Returns:

string

Hashing.reset()

Reset the hasher.

Hashing.update(blob)

Update the data.

Arguments:
  • blob (ValueBlob)

class Html()

A class used to generate HTML representation.

Note: Not directly instantiable.

exported from index.d

static Html.body(content)

Embed the content in a body.

Arguments:
  • content (string)

Returns:

string

static Html.document(title, style, body)

Return an HTML document.

Arguments:
  • title (string)

  • style (string)

  • body (string)

Returns:

string

static Html.documentsDetails(documents, showType)
Return the HTML representation of the documents as a hierarchy of

details.

Arguments:
  • documents (DocumentNode[])

  • showType (boolean)

Returns:

string

static Html.dsmDefinitions(definitions, showDocumentation, showRuntimeId)

Return the HTML representation of the DSM Definitions.

Arguments:
  • definitions (DSMDefinitions)

  • showDocumentation (boolean)

  • showRuntimeId (boolean)

Returns:

string

static Html.style()

Return the default style.

Returns:

string

static Html.type(type)

Return the representation of the type in HTML.

Arguments:
  • type (Type)

Returns:

string

static Html.value(value, useDescription)

Return the representation of the value in HTML.

Arguments:
  • value (Value)

  • useDescription (boolean)

Returns:

string

static Html.valuePretty(value, showType)

Return the representation of the value like the HTML pretty printer.

Arguments:
  • value (Value)

  • showType (boolean)

Returns:

string

class KeyHelper()

A class used to collect keys, attachments and missing attachments for a key.

Note: Not directly instantiable.

exported from index.d

static KeyHelper.attachments(type, definitions)

Return a list of attachments.

Arguments:
  • type (Type)

  • definitions (DefinitionsConst)

Returns:

Attachment[]

static KeyHelper.collectKeys(typeKey, attachmentGetting)

Return a set of key.

Arguments:
  • typeKey (TypeKey)

  • attachmentGetting (AttachmentGetting)

Returns:

ValueSet

static KeyHelper.missingAttachments(key, attachmentGetting)

Return the list of missing attachments.

Arguments:
  • key (ValueKey)

  • attachmentGetting (AttachmentGetting)

Returns:

Attachment[]

class KeyNamer(definitions)

A class used to get a name for a key from available attachments.

exported from index.d

Arguments:
  • definitions (DefinitionsConst)

KeyNamer.name(key, attachmentGetting)

Return the name or null.

Arguments:
  • key (ValueKey)

  • attachmentGetting (AttachmentGetting)

Returns:

string | undefined

KeyNamer.smartName(key, attachmentGetting)

Return the name or null.

Arguments:
  • key (ValueKey)

  • attachmentGetting (AttachmentGetting)

Returns:

string | undefined

class LoggerConsole(level)

A class used to display a message on the console.

exported from index.d

Arguments:
  • level (number)

LoggerConsole.logging()

Return the Logging interface.

Returns:

Logging

class LoggerNull(level)

A class used to discard messages.

exported from index.d

Arguments:
  • level (number)

LoggerNull.logging()

Return the Logging interface.

Returns:

Logging

class LoggerReport(level)

A class used to collect messages.

exported from index.d

Arguments:
  • level (number)

LoggerReport.logging()

Return the Logging interface.

Returns:

Logging

LoggerReport.messages()

Return the list of messages.

Returns:

string[]

class Logging()

An interface to emit a message.

Note: Not directly instantiable.

exported from index.d

Logging.LEVEL_ALL

type: readonly number

Logging.LEVEL_CRITICAL

type: readonly number

Logging.LEVEL_DEBUG

type: readonly number

Logging.LEVEL_ERROR

type: readonly number

Logging.LEVEL_INFO

type: readonly number

Logging.LEVEL_WARNING

type: readonly number

Logging.critical(message)

Log the message for level Critical.

Arguments:
  • message (string)

Logging.debug(message)

Log the message for level Debug.

Arguments:
  • message (string)

Logging.error(message)

Log the message for level Error.

Arguments:
  • message (string)

Logging.info(message)

Log the message for level Info.

Arguments:
  • message (string)

Logging.log(level, message)

Log the message for level.

Arguments:
  • level (number)

  • message (string)

Logging.warning(message)

Log the message for level Warning.

Arguments:
  • message (string)

class NameSpace(uuid, name)

A class used to describe a namespace.

exported from index.d

Arguments:
  • uuid (ValueUUId)

  • name (string)

NameSpace.GLOBAL

type: readonly NameSpace

NameSpace.name()

Return the name.

Returns:

string

NameSpace.uuid()

Return the uuid.

Returns:

ValueUUId

class Path(path)

A class used to construct the location of a portion of a value.

Use the static factory method fromField(…), fromIndex(…), fromKey(…), fromPosition(…) and fromUnwrap().

exported from index.d

Arguments:
  • path (PathConst)

Path.[Symbol․iterator]()

Iterate the path’s components (for..of / spread), via the PathConst view.

Returns:

Iterator<PathComponent>

Path.const()

Return the PathConst interface.

Returns:

PathConst

Path.copy()

Return a copy.

Returns:

Path

Path.element(index)

Append an element component and return self.

Arguments:
  • index (number)

Returns:

Path

Path.entry(key)

Append an entry component and return self.

Arguments:
  • key (InputValue)

Returns:

Path

Path.field(name)

Append a field component and return self.

Arguments:
  • name (string)

Returns:

Path

Path.index(value)

Append an index component and return self.

Arguments:
  • value (number)

Returns:

Path

Path.key(value)

Append a key component and return self.

Arguments:
  • value (InputValue)

Returns:

Path

Path.path(other)

Append path components and return self.

Arguments:
  • other (PathConst)

Returns:

Path

Path.position(value)

Append a position component and return self.

Arguments:
  • value (ValueUUId)

Returns:

Path

Path.representation()

Return a string representation.

Returns:

string

Path.toJSON()
Serialize for JSON.stringify — the path’s representation string (the easy toJSON

case: a string, no bigint), so JSON.stringify(path) yields that string, not {}.

Returns:

string

Path.unwrap()

Append an unwrap directive component and return self.

Returns:

Path

static Path.decode(blob, definitions, streamCodecInstancing)
Return a Path by decoding the blob with a StreamBinaryCodec if not

specified.

Arguments:
  • blob (ValueBlob)

  • definitions (DefinitionsConst)

  • streamCodecInstancing (StreamCodecInstancing)

Returns:

Path

static Path.fromElement(index)

Create and return a Path with an element component at index.

Arguments:
  • index (number)

Returns:

Path

static Path.fromEntry(value)

Create and return a Path with an entry component.

Arguments:
  • value (InputValue)

Returns:

Path

static Path.fromField(name)

Create and return a Path with a field component.

Arguments:
  • name (string)

Returns:

Path

static Path.fromIndex(index)

Create a return a Path with an index component.

Arguments:
  • index (number)

Returns:

Path

static Path.fromKey(key)

Create and return a Path with a key component.

Arguments:
  • key (InputValue)

Returns:

Path

static Path.fromPosition(position)

Create and return a Path with a position component.

Arguments:
  • position (ValueUUId)

Returns:

Path

static Path.fromUnwrap()

Create and return a Path with an unwrap component.

Returns:

Path

static Path.read(streamReading, definitions)

Read and return a Path.

Arguments:
  • streamReading (StreamReading)

  • definitions (DefinitionsConst)

Returns:

Path

class PathComponent()

A class used to represent a component of a Path.

Note: Not directly instantiable.

exported from index.d

PathComponent.type()

Return the type.

Returns:

string

PathComponent.value(encoded)

Return the value or null.

Arguments:
  • encoded (boolean)

Returns:

OutputValue | undefined

class PathConst()

A class used to retrieve a value from a Path.

Note: Not directly instantiable.

exported from index.d

PathConst.ancestors()

Return the list of ancestors.

Returns:

Path[]

PathConst.at(target, encoded)

Return the value for the target.

Arguments:
  • target (Value)

  • encoded (boolean)

Returns:

OutputValue

PathConst.checkType(type)

Check if the path can be used to locate the value in the type.

Arguments:
  • type (Type)

Returns:

Type

PathConst.components()

Return the list of components.

Returns:

PathComponent[]

PathConst.copy()

Return a copy.

Returns:

Path

PathConst.elementInfo()

Return the ElementInfo.

Returns:

PathElementInfo

PathConst.encode(streamCodecInstancing)
Return a blob that encodes the Path with a StreamTokenBinaryCodec

if not specified.

Arguments:
  • streamCodecInstancing (StreamCodecInstancing)

Returns:

ValueBlob

PathConst.entryKeyInfo()

Return the EntryKeyInfo.

Returns:

PathEntryKeyInfo

PathConst.fromComponent(index)

Return a path from index.

Arguments:
  • index (number)

Returns:

Path

PathConst.hasPrefix(path)

Return true if other is a prefix.

Arguments:
  • path (PathConst)

Returns:

boolean

PathConst.isApplicable(value)

Check if the path is applicable to the value.

Arguments:
  • value (Value)

Returns:

boolean

PathConst.isElementPath()

Return true if the path contains Element components.

Returns:

boolean

PathConst.isEntryKeyPath()

Return true if the path contains Entry components.

Returns:

boolean

PathConst.isRegular()

Return false if the path contains Entry components.

Returns:

boolean

PathConst.isRoot()

Return true if self is the root.

Returns:

boolean

PathConst.lastComponent()

Return the last component as a Path.

Returns:

Path

PathConst.lastComponentValue(encoded)

Return the last component value.

Arguments:
  • encoded (boolean)

Returns:

OutputValue | undefined

PathConst.parent()

Return the parent Path or throw if self is root.

Returns:

Path

PathConst.patch(target, value)

Assign the value to the target.

Arguments:
  • target (Value)

  • value (InputValue)

PathConst.regularized()

Return the path without the entry component.

Returns:

Path

PathConst.representation()

Return a string representation.

Returns:

string

PathConst.set(target, value)

Assign the value to the target.

Arguments:
  • target (Value)

  • value (InputValue)

PathConst.toComponent(index)

Return a path to index (excluded).

Arguments:
  • index (number)

Returns:

Path

PathConst.write(streamWriting)

Write a path.

Arguments:
  • streamWriting (StreamWriting)

class PathElementInfo()

A class used to represent the various information for an element of a set.

Note: Not directly instantiable.

exported from index.d

PathElementInfo.elementPath()

Return the path for the element.

Returns:

PathConst

PathElementInfo.index()

Return the index for the element.

Returns:

number

PathElementInfo.setPath()

Return the path for the set.

Returns:

PathConst

class PathEntryKeyInfo()

A class used to represent various information for an entry of a map.

Note: Not directly instantiable.

exported from index.d

PathEntryKeyInfo.key()

Return the key.

Returns:

Value

PathEntryKeyInfo.keyPath()

Return the path for the key.

Returns:

PathConst

PathEntryKeyInfo.mapPath()

Return the path for the map.

Returns:

PathConst

class SQLite()

A class used to retrieve the configuration of SQLite3.

Note: Not directly instantiable.

exported from index.d

SQLite.compileOptions()

Return a dict[str, str] of compilation options

Returns:

[string, string][]

SQLite.getPragma(key)

Return the pragma value in a list of str.

Arguments:
  • key (ValueKey)

Returns:

string[]

SQLite.maxDatabaseSize()

Return maximum size.

Returns:

number

SQLite.maxLength()

Return the max size supported by the current implementation of SQLite3.

Returns:

number

SQLite.maxPageCount()

Return the max page count.

Returns:

number

SQLite.pageSize()

Return the page size.

Returns:

number

SQLite.pragmas()

Return the list of pragmas.

Returns:

string[]

SQLite.setPragma(key, value)

set the pragma value.

Arguments:
  • key (string)

  • value (string)

static SQLite.isSqlite3(filePath)

Return true if the file is a SQLite3 database.

Arguments:
  • filePath (string)

Returns:

boolean

class ServiceRemote()
A class used to connect to a remote service. Use the static factory method

connect(…) or connectLocal(…).

Note: Not directly instantiable.

exported from index.d

ServiceRemote.[Symbol․dispose]()

Release the resource at scope exit via using (TC39 disposable); delegates to close(). Idempotent.

ServiceRemote.attachmentFunctionPoolFunc(poolIdOrName, name)

Return one callable function by pool and name; throws if the pool or function is unknown.

Arguments:
  • poolIdOrName (string | ValueUUId)

  • name (string)

Returns:

ServiceRemoteAttachmentFunction

ServiceRemote.attachmentFunctionPoolFuncs(poolIdOrName)

Return functions or null.

Arguments:
  • poolIdOrName (string | ValueUUId)

Returns:

ServiceRemoteAttachmentFunctionPoolFunctions | undefined

ServiceRemote.attachmentFunctionPools()

Return a list of pools.

Returns:

ServiceRemoteAttachmentFunctionPool[]

ServiceRemote.close()

Close the service.

ServiceRemote.definitions()

Return the definitions.

Returns:

DefinitionsConst

ServiceRemote.functionPoolFunc(poolIdOrName, name)

Return one callable function by pool and name; throws if the pool or function is unknown.

Arguments:
  • poolIdOrName (string | ValueUUId)

  • name (string)

Returns:

ServiceRemoteFunction

ServiceRemote.functionPoolFuncs(poolIdOrName)

Return functions or null.

Arguments:
  • poolIdOrName (string | ValueUUId)

Returns:

ServiceRemoteFunctionPoolFunctions | undefined

ServiceRemote.functionPools()

Return a list of pools.

Returns:

ServiceRemoteFunctionPool[]

ServiceRemote.isClosed()

Return true if the service is closed.

Returns:

boolean

ServiceRemote.peername()

Return the peername.

Returns:

string

ServiceRemote.sockname()

Return the sockname.

Returns:

string

ServiceRemote.toDsmDefinitions()

Return the DSMDefinitions of the service.

Returns:

DSMDefinitions

static ServiceRemote.connect(host, service, definitions)

Connect to a remote service.

Arguments:
  • host (string)

  • service (string)

  • definitions (Definitions)

Returns:

ServiceRemote

static ServiceRemote.connectLocal(socketPath, definitions)

Connect to a service located at socket_path.

Arguments:
  • socketPath (string)

  • definitions (Definitions)

Returns:

ServiceRemote

class ServiceRemoteAttachmentFunction()

A class used to call a remote attachment function.

Note: Not directly instantiable.

exported from index.d

ServiceRemoteAttachmentFunction.call(...args)
Call the remote attachment function and return its result (a native leaf, or a wrapped

Value for a container / blob). Args are checked against the prototype.

Arguments:
  • args (InputValue[])

Returns:

OutputValue

ServiceRemoteAttachmentFunction.function()

Return the function.

Returns:

ServiceRemoteAttachmentFunctionPoolFunction

ServiceRemoteAttachmentFunction.pool()

Return the pool.

Returns:

ServiceRemoteAttachmentFunctionPool

ServiceRemoteAttachmentFunction.service()

Return the service.

Returns:

ServiceRemote

class ServiceRemoteAttachmentFunctionPool()

A class used to represent a remote attachment function pool.

Note: Not directly instantiable.

exported from index.d

ServiceRemoteAttachmentFunctionPool.check(funcName)

Return a function or throw.

Arguments:
  • funcName (string)

Returns:

ServiceRemoteAttachmentFunctionPoolFunction

ServiceRemoteAttachmentFunctionPool.definitions()
Returns:

DefinitionsConst

ServiceRemoteAttachmentFunctionPool.documentation()

Return the documentation.

Returns:

string

ServiceRemoteAttachmentFunctionPool.functions()

Return the list of functions.

Returns:

ServiceRemoteAttachmentFunctionPoolFunction[]

ServiceRemoteAttachmentFunctionPool.name()

Return the name.

Returns:

string

ServiceRemoteAttachmentFunctionPool.query(funcName)

Return a function or null.

Arguments:
  • funcName (string)

Returns:

ServiceRemoteAttachmentFunctionPoolFunction | undefined

ServiceRemoteAttachmentFunctionPool.uuid()

Return the uuid.

Returns:

ValueUUId

class ServiceRemoteAttachmentFunctionPoolFunction()

A class used to represent a remote attachment function.

Note: Not directly instantiable.

exported from index.d

ServiceRemoteAttachmentFunctionPoolFunction.documentation()

Return the documentation.

Returns:

string

ServiceRemoteAttachmentFunctionPoolFunction.isMutable()

Return true if the function is mutable.

Returns:

boolean

ServiceRemoteAttachmentFunctionPoolFunction.prototype()

Return the prototype.

Returns:

FunctionPrototype

class ServiceRemoteAttachmentFunctionPoolFunctions()

A class used to represent the remote attachment functions.

Note: Not directly instantiable.

exported from index.d

class ServiceRemoteFunction()

A class used to call a remote function.

Note: Not directly instantiable.

exported from index.d

ServiceRemoteFunction.call(...args)
Call the remote function and return its result (a native leaf, or a wrapped Value for a

container / blob — the encoded projection). Args are checked against the prototype.

Arguments:
  • args (InputValue[])

Returns:

OutputValue

ServiceRemoteFunction.function()

Return the function.

Returns:

ServiceRemoteFunctionPoolFunction

ServiceRemoteFunction.pool()

Return the pool.

Returns:

ServiceRemoteFunctionPool

ServiceRemoteFunction.service()

Return the service.

Returns:

ServiceRemote

class ServiceRemoteFunctionPool()

A class used to represent a remote function pool.

Note: Not directly instantiable.

exported from index.d

ServiceRemoteFunctionPool.check(funcName)

Return a function or throw.

Arguments:
  • funcName (string)

Returns:

ServiceRemoteFunctionPoolFunction

ServiceRemoteFunctionPool.documentation()

Return the documentation.

Returns:

string

ServiceRemoteFunctionPool.functions()

Return the list of functions.

Returns:

ServiceRemoteFunctionPoolFunction[]

ServiceRemoteFunctionPool.name()

Return the name.

Returns:

string

ServiceRemoteFunctionPool.query(funcName)

Return a function or null.

Arguments:
  • funcName (string)

Returns:

ServiceRemoteFunctionPoolFunction | undefined

ServiceRemoteFunctionPool.uuid()

Return the uuid.

Returns:

ValueUUId

class ServiceRemoteFunctionPoolFunction()

A class used to represent a remote function.

Note: Not directly instantiable.

exported from index.d

ServiceRemoteFunctionPoolFunction.documentation()

Return the documentation.

Returns:

string

ServiceRemoteFunctionPoolFunction.prototype()

Return the prototype.

Returns:

FunctionPrototype

class ServiceRemoteFunctionPoolFunctions()

A class used to represent the functions of a pool.

Note: Not directly instantiable.

exported from index.d

class SharedMemory()

A class used to represent a shared memory region.

Note: Not directly instantiable — use SharedMemory.create / SharedMemory.open.

exported from index.d

SharedMemory.address()

Return the address.

Returns:

bigint

SharedMemory.fd()

Return the file descriptor.

Returns:

number

SharedMemory.name()

Return the name.

Returns:

string

SharedMemory.size()

Return the size.

Returns:

number

static SharedMemory.create(name, size)

Create a shared memory segment.

Arguments:
  • name (string)

  • size (number)

Returns:

SharedMemory

static SharedMemory.exists(name)

Return True is the name exist.

Arguments:
  • name (string)

Returns:

boolean

static SharedMemory.open(name, size)

Open an exising shared memory segment.

Arguments:
  • name (string)

  • size (number)

Returns:

SharedMemory

Unlink the shared memory object.

Arguments:
  • name (string)

Returns:

boolean

class Socket()

A passive (listening) socket for a server.

Only the passive factories a server needs are exposed: the active side, the socket options and the I/O surface stay internal — a Node host consumes a service through the *Remote classes, it does not drive a socket by hand.

On macOS/Linux a unix socket path is limited to ~104 bytes; a longer path fails bind with a misleading “Address already in use”.

exported from index.d

Socket.[Symbol․dispose]()
Socket.close()
Release the socket. A passive local socket is a file on disk, and the destructor

only runs when V8 collects — which is neither timely nor guaranteed — so a host that abandons a socket must close it. Idempotent.

Socket.isClosed()

Return true once the socket has been released.

Returns:

boolean

static Socket.createPassiveInet(hostname, service)

Create a listening TCP socket bound to hostname:service.

Arguments:
  • hostname (string)

  • service (string)

Returns:

Socket

static Socket.createPassiveLocal(socketPath)

Create a listening unix-domain socket at socketPath.

Arguments:
  • socketPath (string)

Returns:

Socket