| import * as Arr from "../../Array.ts"; | |
| import * as Channel from "../../Channel.ts"; | |
| import * as Schema from "../../Schema.ts"; | |
| import * as SchemaTransformation from "../../SchemaTransformation.ts"; | |
| declare const MsgPackErrorTypeId = "~effect/encoding/MsgPack/MsgPackError"; | |
| declare const MsgPackError_base: new <A extends Record<string, any> = {}>(args: import("../../Types.ts").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("../../Cause.ts").YieldableError & { | |
| readonly _tag: "MsgPackError"; | |
| } & Readonly<A>; | |
| /** | |
| * Error raised when MessagePack encoding or decoding fails. | |
| * | |
| * **Details** | |
| * | |
| * The `kind` field identifies whether the failure happened while packing or | |
| * unpacking, and `cause` preserves the original error. | |
| * | |
| * @category errors | |
| * @since 4.0.0 | |
| */ | |
| export declare class MsgPackError extends MsgPackError_base<{ | |
| readonly kind: "Pack" | "Unpack"; | |
| readonly cause: unknown; | |
| }> { | |
| /** | |
| * Marks this value as a MessagePack encoding or decoding error for runtime guards. | |
| * | |
| * @since 4.0.0 | |
| */ | |
| readonly [MsgPackErrorTypeId] = "~effect/encoding/MsgPack/MsgPackError"; | |
| /** | |
| * Uses the failed MessagePack operation as the public message. | |
| * | |
| * @since 4.0.0 | |
| */ | |
| get message(): "Pack" | "Unpack"; | |
| } | |
| /** | |
| * Creates a channel that encodes non-empty chunks of values as MessagePack byte | |
| * arrays. | |
| * | |
| * **Details** | |
| * | |
| * The channel fails with `MsgPackError` when any value cannot be packed. | |
| * | |
| * @category constructors | |
| * @since 4.0.0 | |
| */ | |
| export declare const encode: <IE = never, Done = unknown>() => Channel.Channel<Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>, IE | MsgPackError, Done, Arr.NonEmptyReadonlyArray<unknown>, IE, Done>; | |
| /** | |
| * Creates a MessagePack encoder channel for values of a schema. | |
| * | |
| * **Details** | |
| * | |
| * Values are first encoded with the schema and then packed as MessagePack bytes, | |
| * so the channel can fail with either schema errors or `MsgPackError`. | |
| * | |
| * @category constructors | |
| * @since 4.0.0 | |
| */ | |
| export declare const encodeSchema: <S extends Schema.Top>(schema: S) => <IE = never, Done = unknown>() => Channel.Channel<Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>, MsgPackError | Schema.SchemaError | IE, Done, Arr.NonEmptyReadonlyArray<S["Type"]>, IE, Done, S["EncodingServices"]>; | |
| /** | |
| * Creates a channel that decodes MessagePack byte chunks into values. | |
| * | |
| * **Details** | |
| * | |
| * Incomplete frames are buffered across chunks, and invalid MessagePack data | |
| * fails with `MsgPackError`. | |
| * | |
| * @category constructors | |
| * @since 4.0.0 | |
| */ | |
| export declare const decode: <IE = never, Done = unknown>() => Channel.Channel<Arr.NonEmptyReadonlyArray<unknown>, IE | MsgPackError, Done, Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>, IE, Done>; | |
| /** | |
| * Creates a MessagePack decoder channel for values of a schema. | |
| * | |
| * **Details** | |
| * | |
| * The channel unpacks bytes into unknown values and then decodes each value with | |
| * the schema. | |
| * | |
| * @category constructors | |
| * @since 4.0.0 | |
| */ | |
| export declare const decodeSchema: <S extends Schema.Top>(schema: S) => <IE = never, Done = unknown>() => Channel.Channel<Arr.NonEmptyReadonlyArray<S["Type"]>, Schema.SchemaError | MsgPackError | IE, Done, Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>, IE, Done, S["DecodingServices"]>; | |
| /** | |
| * Wraps a bidirectional byte channel with MessagePack encoding and decoding. | |
| * | |
| * **Details** | |
| * | |
| * Outgoing values are packed as MessagePack bytes before reaching the wrapped | |
| * channel, and incoming bytes are unpacked into values. | |
| * | |
| * @category combinators | |
| * @since 4.0.0 | |
| */ | |
| export declare const duplex: <R, IE, OE, OutDone, InDone>(self: Channel.Channel<Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>, OE, OutDone, Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>, IE | MsgPackError, InDone, R>) => Channel.Channel<Arr.NonEmptyReadonlyArray<unknown>, MsgPackError | OE, OutDone, Arr.NonEmptyReadonlyArray<unknown>, IE, InDone, R>; | |
| /** | |
| * Wraps a bidirectional byte channel with schema-aware MessagePack encoding and | |
| * decoding. | |
| * | |
| * **Details** | |
| * | |
| * Values sent to the wrapped channel are encoded with `inputSchema` and packed | |
| * as MessagePack bytes; bytes received from it are unpacked and decoded with | |
| * `outputSchema`. | |
| * | |
| * @category combinators | |
| * @since 4.0.0 | |
| */ | |
| export declare const duplexSchema: { | |
| /** | |
| * Wraps a bidirectional byte channel with schema-aware MessagePack encoding and | |
| * decoding. | |
| * | |
| * **Details** | |
| * | |
| * Values sent to the wrapped channel are encoded with `inputSchema` and packed | |
| * as MessagePack bytes; bytes received from it are unpacked and decoded with | |
| * `outputSchema`. | |
| * | |
| * @category combinators | |
| * @since 4.0.0 | |
| */ | |
| <In extends Schema.Top, Out extends Schema.Top>(options: { | |
| readonly inputSchema: In; | |
| readonly outputSchema: Out; | |
| }): <OutErr, OutDone, InErr, InDone, R>(self: Channel.Channel<Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>, OutErr, OutDone, Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>, MsgPackError | Schema.SchemaError | InErr, InDone, R>) => Channel.Channel<Arr.NonEmptyReadonlyArray<Out["Type"]>, MsgPackError | Schema.SchemaError | OutErr, OutDone, Arr.NonEmptyReadonlyArray<In["Type"]>, InErr, InDone, R | In["EncodingServices"] | Out["DecodingServices"]>; | |
| /** | |
| * Wraps a bidirectional byte channel with schema-aware MessagePack encoding and | |
| * decoding. | |
| * | |
| * **Details** | |
| * | |
| * Values sent to the wrapped channel are encoded with `inputSchema` and packed | |
| * as MessagePack bytes; bytes received from it are unpacked and decoded with | |
| * `outputSchema`. | |
| * | |
| * @category combinators | |
| * @since 4.0.0 | |
| */ | |
| <Out extends Schema.Top, In extends Schema.Top, OutErr, OutDone, InErr, InDone, R>(self: Channel.Channel<Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>, OutErr, OutDone, Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>, MsgPackError | Schema.SchemaError | InErr, InDone, R>, options: { | |
| readonly inputSchema: In; | |
| readonly outputSchema: Out; | |
| }): Channel.Channel<Arr.NonEmptyReadonlyArray<Out["Type"]>, MsgPackError | Schema.SchemaError | OutErr, OutDone, Arr.NonEmptyReadonlyArray<In["Type"]>, InErr, InDone, R | In["EncodingServices"] | Out["DecodingServices"]>; | |
| }; | |
| /** | |
| * Schema type for values encoded as MessagePack bytes. | |
| * | |
| * **Details** | |
| * | |
| * It decodes a `Uint8Array` MessagePack payload to the target schema type and | |
| * encodes the target type back to bytes. | |
| * | |
| * @category schemas | |
| * @since 4.0.0 | |
| */ | |
| export interface schema<S extends Schema.Top> extends Schema.decodeTo<S, Schema.instanceOf<Uint8Array<ArrayBuffer>>> { | |
| } | |
| /** | |
| * Schema for decoding MessagePack bytes into values and encoding values back to | |
| * MessagePack bytes. | |
| * | |
| * **Details** | |
| * | |
| * MessagePack codec failures are converted to `InvalidValue` schema issues. | |
| * | |
| * @category schemas | |
| * @since 4.0.0 | |
| */ | |
| export declare const transformation: SchemaTransformation.Transformation<unknown, Uint8Array<ArrayBuffer>>; | |
| /** | |
| * Builds a schema that stores values as MessagePack bytes. | |
| * | |
| * **Details** | |
| * | |
| * The resulting schema decodes `Uint8Array` payloads with MessagePack and the | |
| * provided schema, and encodes values back to MessagePack bytes. | |
| * | |
| * @category schemas | |
| * @since 4.0.0 | |
| */ | |
| export declare const schema: <S extends Schema.Top>(schema: S) => schema<S>; | |
| export {}; | |
| //# sourceMappingURL=Msgpack.d.ts.map |
Xet Storage Details
- Size:
- 7.46 kB
- Xet hash:
- 8e49416bed6d9ad60707dde1e46c9b764d055f8aedc982b92b4e754bdf143efb
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.