tupleson
Version:
A hackable JSON serializer/deserializer
21 lines (18 loc) • 1.04 kB
TypeScript
import { TsonSerialized } from '../sync/syncTypes.js';
import { TsonAsyncIndex, TsonAsyncOptions, TsonAsyncStringifier, BrandSerialized } from './asyncTypes.js';
import '../internals/esque.js';
import './asyncErrors.js';
import '../errors.js';
type TsonAsyncValueTuple = [TsonAsyncIndex, unknown];
type TsonAsyncSerializer = <T>(value: T) => [TsonSerialized<T>, AsyncIterable<TsonAsyncValueTuple>];
declare function createAsyncTsonSerialize(opts: TsonAsyncOptions): TsonAsyncSerializer;
/**
* JSON stream
*/
declare function createTsonStreamAsync(opts: TsonAsyncOptions): TsonAsyncStringifier;
declare function createTsonSSEResponse(opts: TsonAsyncOptions): <TValue>(value: TValue) => BrandSerialized<Response, TValue>;
/**
* JSON stream Response
*/
declare function createTsonSerializeJsonStreamResponse(opts: TsonAsyncOptions): <TValue>(value: TValue) => BrandSerialized<Response, TValue>;
export { TsonAsyncValueTuple, createAsyncTsonSerialize, createTsonSSEResponse, createTsonSerializeJsonStreamResponse, createTsonStreamAsync };