tupleson
Version:
A hackable JSON serializer/deserializer
21 lines (18 loc) • 1.05 kB
text/typescript
import { TsonSerialized } from '../sync/syncTypes.mjs';
import { TsonAsyncIndex, TsonAsyncOptions, TsonAsyncStringifier, BrandSerialized } from './asyncTypes.mjs';
import '../internals/esque.mjs';
import './asyncErrors.mjs';
import '../errors.mjs';
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 };