Grounds
    Preparing search index...

    Module @grounds/core

    Low-level Relish wire format implementation for encoding and decoding binary data.

    This package provides type-safe value construction, encoding to bytes, and decoding back to JavaScript values following the Relish binary serialization specification.

    Quick start - encoding:

    import { encode, U32, String_, Struct } from '@grounds/core';

    const user = Struct(new Map([
    [0, String_('Alice')],
    [1, U32(25)]
    ]));

    encode(user).match(
    (bytes) => {
    console.log('Encoded:', bytes.length, 'bytes');
    },
    (error) => console.error('Encoding failed:', error.message)
    );

    Quick start - decoding:

    import { decode } from '@grounds/core';

    const bytes = new Uint8Array([...]); // from network or storage

    decode(bytes).match(
    (value) => {
    console.log('Decoded:', value);
    },
    (error) => {
    if (error.code === 'UNEXPECTED_EOF') {
    console.error('Incomplete data');
    }
    }
    );

    This package implements the low-level wire format only. For type-safe schema validation and TypeBox integration, use @grounds/schema. For streaming encoding and decoding, use @grounds/stream.

    Key characteristics:

    • Encoding uses wrapped RelishValue types for type safety
    • Decoding returns raw JavaScript DecodedValue for convenience
    • All operations return neverthrow Result types for functional error handling
    • Wire format matches Rust reference implementation

    Type Aliases

    DecodeErrorCode
    TypeCode
    RelishValue
    RelishNull
    RelishBool
    RelishU8
    RelishU16
    RelishU32
    RelishU64
    RelishU128
    RelishI8
    RelishI16
    RelishI32
    RelishI64
    RelishI128
    RelishF32
    RelishF64
    RelishString
    PrimitiveTypeCode
    CompositeTypeCode
    TypeCodeToJsType
    RelishArray
    RelishMap
    MapInput
    DecodedValue
    RelishStruct
    RelishEnum
    RelishTimestamp

    Variables

    TypeCode

    Functions

    isPrimitiveTypeCode

    Decoding

    Decoder
    decode

    Encoding

    encode
    Encoder

    Error Handling

    EncodeError
    DecodeError

    Value Constructors

    Null
    Bool
    U8
    U16
    U32
    U64
    U128
    I8
    I16
    I32
    I64
    I128
    F32
    F64
    String_
    Array_
    Map_
    Struct
    Enum
    Timestamp