How the saved spec stores a type of node (PLAN §10.3): the node's own fields, written after kind, id and inputs, which the codec handles.

interface NodeSpecCodec<N extends QueryNode = QueryNode> {
    keys: readonly string[];
    decode(id: string, json: JsonObject, path: string, rest: JsonObject): N;
    encode(node: N): JsonObject;
}

Type Parameters

Properties

Methods

Properties

keys: readonly string[]

The node's own keys, in the order they are written

Methods

  • The node with this id from its own fields: json holds only keys, and rest the node's unknown keys. Throws a CubeSpecDecodeError for a malformed field, and UnreadableContent for a value this version can't read, which keeps the node as an Unknown node.

    Parameters

    • id: string
    • json: JsonObject
    • path: string
    • rest: JsonObject

    Returns N

  • The node's own fields, in the order of keys, leaving out absent ones

    Parameters

    • node: N

    Returns JsonObject