@mastra/core
Version:
17 lines • 811 B
TypeScript
/**
* Encode a value into a JSON-safe shape. Non-JSON-safe types (Date, Error,
* Map, Set, RegExp, URL, BigInt, undefined, registered classes) are wrapped
* in tagged envelopes that the decoder can reconstruct.
*
* Functions and symbols are dropped (parity with JSON.stringify). Cycles are
* replaced with null at the second visit. NaN/Infinity become null. Honors
* user `toJSON()` methods on plain objects.
*/
export declare function encode(value: unknown): unknown;
/**
* Decode a value previously produced by `encode`. Reconstructs envelope-tagged
* types and recursively decodes nested values. Plain objects that happen to
* carry a `CODEC_TAG` key but do not match an envelope shape are preserved.
*/
export declare function decode(value: unknown): unknown;
//# sourceMappingURL=codec.d.ts.map