@automate.ax/codec
v0.87.5
Published
Msgpack-based encoding helpers for Automate.ax runtime data.
Downloads
22,413
Readme
@automate.ax/codec
Msgpack-based encoding helpers for Automate.ax runtime data.
This package owns the shared Encodable value contract used by automation signals and storage boundaries. Most app authors should not need it directly.
Install
bun add @automate.ax/codecUsage
import { decode, encodableSchema, encode } from "@automate.ax/codec"
const bytes = await encode({
message: "hello",
createdAt: new Date(),
})
const value = await decode(bytes)
const validated = encodableSchema.parse(value)API
encode(value)— Checks an unknown value against the supported input surface, then serializes it.decode(bytes)— Deserializes msgpack bytes and returnsEncodable.encodableSchema— Zod schema for validating unknown values against the supported input surface.isEncodable(value)— Runtime guard for the supported input surface.Encodable— Recursive type accepted by the encoder.
Supported Values
Encodable includes primitives, arrays, plain objects, Map, Set, Date, RegExp, typed arrays, ArrayBuffer, DataView, and web platform values such as Request, Response, Blob, File, Headers, URL, and URLSearchParams.
