| /** | |
| * Defines protocol messages for event-log remote clients and servers. | |
| * | |
| * This module is the shared boundary between `EventLogRemote` clients and | |
| * event-log servers. It defines store ids, protocol errors, the | |
| * hello/authenticate session handshake, remote calls for writes and changes, | |
| * and message formats for encrypted or plaintext journal entries. | |
| * | |
| * @since 4.0.0 | |
| */ | |
| import type { NonEmptyReadonlyArray } from "../../Array.ts"; | |
| import type { Brand } from "../../Brand.ts"; | |
| import * as Schema from "../../Schema.ts"; | |
| import * as Msgpack from "../encoding/Msgpack.ts"; | |
| import * as Rpc from "../rpc/Rpc.ts"; | |
| import * as RpcGroup from "../rpc/RpcGroup.ts"; | |
| import * as RpcMiddleware from "../rpc/RpcMiddleware.ts"; | |
| import * as Transferable from "../workers/Transferable.ts"; | |
| import { Entry, RemoteEntry } from "./EventJournal.ts"; | |
| import type { Identity } from "./EventLog.ts"; | |
| /** | |
| * Type-level identifier used to brand event-log store ids. | |
| * | |
| * @category type IDs | |
| * @since 4.0.0 | |
| */ | |
| export type StoreIdTypeId = "effect/eventlog/EventLog/StoreId"; | |
| /** | |
| * Runtime brand identifier for event-log store ids. | |
| * | |
| * @category type IDs | |
| * @since 4.0.0 | |
| */ | |
| export declare const StoreIdTypeId: StoreIdTypeId; | |
| /** | |
| * Branded string identifying a logical event-log store. | |
| * | |
| * @category StoreId | |
| * @since 4.0.0 | |
| */ | |
| export type StoreId = string & Brand<StoreIdTypeId>; | |
| /** | |
| * Schema for branded event-log store ids. | |
| * | |
| * @category StoreId | |
| * @since 4.0.0 | |
| */ | |
| export declare const StoreId: Schema.brand<Schema.String, "effect/eventlog/EventLog/StoreId">; | |
| declare const EventLogProtocolError_base: Schema.Class<EventLogProtocolError, Schema.TaggedStruct<"EventLogProtocolError", { | |
| readonly requestTag: Schema.String; | |
| readonly publicKey: Schema.optional<Schema.String>; | |
| readonly storeId: Schema.optional<Schema.brand<Schema.String, "effect/eventlog/EventLog/StoreId">>; | |
| readonly code: Schema.Literals<readonly ["Unauthorized", "Forbidden", "NotFound", "InvalidRequest", "InternalServerError"]>; | |
| readonly message: Schema.String; | |
| }>, import("../../Cause.ts").YieldableError>; | |
| /** | |
| * Error returned by event-log remote RPCs. | |
| * | |
| * **Details** | |
| * | |
| * It records the request tag, optional identity and store information, a protocol | |
| * error code, and a human-readable message. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class EventLogProtocolError extends EventLogProtocolError_base { | |
| } | |
| declare const EventLogAuthentication_base: RpcMiddleware.ServiceClass<EventLogAuthentication, "effect/eventlog/EventLogMessage/EventLogAuthentication", Identity, typeof EventLogProtocolError, never, never, false>; | |
| /** | |
| * RPC middleware that authenticates event-log requests and provides the client | |
| * `Identity` to authenticated handlers. | |
| * | |
| * @category middleware | |
| * @since 4.0.0 | |
| */ | |
| export declare class EventLogAuthentication extends EventLogAuthentication_base { | |
| } | |
| declare const HelloResponse_base: Schema.Class<HelloResponse, Schema.Struct<{ | |
| readonly remoteId: Schema.brand<Schema.Uint8Array, "effect/eventlog/EventJournal/RemoteId">; | |
| readonly challenge: Transferable.Transferable<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; | |
| }>, {}>; | |
| /** | |
| * Response sent by the remote server during the authentication handshake. | |
| * | |
| * **Details** | |
| * | |
| * It contains the server remote id and a challenge that must be signed by the | |
| * client. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class HelloResponse extends HelloResponse_base { | |
| } | |
| declare const HelloRpc_base: Rpc.Rpc<"EventLog.Hello", Schema.Void, typeof HelloResponse, Schema.Never, never, never>; | |
| /** | |
| * RPC used to start an event-log remote session and receive a `HelloResponse`. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class HelloRpc extends HelloRpc_base { | |
| } | |
| declare const Authenticate_base: Schema.Class<Authenticate, Schema.Struct<{ | |
| readonly publicKey: Schema.String; | |
| readonly signingPublicKey: Transferable.Transferable<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; | |
| readonly signature: Transferable.Transferable<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; | |
| readonly algorithm: Schema.Literal<"Ed25519">; | |
| }>, {}>; | |
| /** | |
| * Schema for an authentication request containing the client public key, | |
| * Ed25519 signing public key, signature over the session challenge payload, and | |
| * algorithm name. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class Authenticate extends Authenticate_base { | |
| } | |
| declare const AuthenticateRpc_base: Rpc.Rpc<"EventLog.Authenticate", typeof Authenticate, Schema.Void, typeof EventLogProtocolError, never, never>; | |
| /** | |
| * RPC used to authenticate a remote event-log session after `HelloRpc`. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class AuthenticateRpc extends AuthenticateRpc_base { | |
| } | |
| declare const SingleMessage_base: Schema.Class<SingleMessage, Schema.TaggedStruct<"Single", { | |
| readonly data: Transferable.Transferable<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; | |
| }>, {}>; | |
| /** | |
| * Represents an entire encoded event-log payload in one transport frame. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class SingleMessage extends SingleMessage_base { | |
| } | |
| declare const ChunkedMessage_base: Schema.Class<ChunkedMessage, Schema.TaggedStruct<"Chunked", { | |
| readonly id: Schema.Number; | |
| readonly part: Schema.Tuple<readonly [Schema.Number, Schema.Number]>; | |
| readonly data: Transferable.Transferable<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; | |
| }>, {}>; | |
| /** | |
| * Represents one part of a large encoded event-log payload. | |
| * | |
| * **When to use** | |
| * | |
| * Use to divide data into chunks and `join` to reassemble all chunks with | |
| * the same id once every part has arrived. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class ChunkedMessage extends ChunkedMessage_base { | |
| static chunkSize: number; | |
| static initialJoinState(): Map<number, { | |
| readonly parts: Array<Uint8Array>; | |
| count: number; | |
| bytes: number; | |
| }>; | |
| /** | |
| * Splits binary event-log message data into numbered chunks. | |
| * | |
| * @since 4.0.0 | |
| */ | |
| static split(id: number, data: Uint8Array): NonEmptyReadonlyArray<ChunkedMessage>; | |
| /** | |
| * Reassembles all chunks for a message id into the original binary payload. | |
| * | |
| * @since 4.0.0 | |
| */ | |
| static join(map: Map<number, { | |
| readonly parts: Array<Uint8Array>; | |
| count: number; | |
| bytes: number; | |
| }>, part: ChunkedMessage): Uint8Array<ArrayBuffer> | undefined; | |
| } | |
| declare const WriteChunkedRpc_base: Rpc.Rpc<"EventLog.WriteChunked", typeof ChunkedMessage, Schema.Void, typeof EventLogProtocolError, typeof EventLogAuthentication, never>; | |
| /** | |
| * RPC used to send one chunk of a large encoded write payload. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class WriteChunkedRpc extends WriteChunkedRpc_base { | |
| } | |
| declare const WriteEntries_base: Schema.Class<WriteEntries, Schema.Struct<{ | |
| readonly publicKey: Schema.String; | |
| readonly storeId: Schema.brand<Schema.String, "effect/eventlog/EventLog/StoreId">; | |
| readonly iv: Transferable.Transferable<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; | |
| readonly encryptedEntries: Schema.$Array<Schema.Struct<{ | |
| readonly entryId: Schema.brand<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, "effect/eventlog/EventJournal/EntryId">; | |
| readonly encryptedEntry: Transferable.Transferable<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; | |
| }>>; | |
| }>, {}>; | |
| /** | |
| * Schema for encrypted event-log write payloads sent to a remote store. | |
| * | |
| * **Details** | |
| * | |
| * It includes the client public key, target store id, AES-GCM initialization | |
| * vector, and encrypted entries. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class WriteEntries extends WriteEntries_base { | |
| static FromMsgpack: Msgpack.schema<typeof WriteEntries>; | |
| static encode: (input: WriteEntries, options?: import("../../SchemaAST.ts").ParseOptions) => import("../../Effect.ts").Effect<Uint8Array<ArrayBuffer>, Schema.SchemaError, never>; | |
| static decode: (input: Uint8Array<ArrayBuffer>, options?: import("../../SchemaAST.ts").ParseOptions) => import("../../Effect.ts").Effect<WriteEntries, Schema.SchemaError, never>; | |
| get encoded(): import("../../Effect.ts").Effect<Uint8Array<ArrayBuffer>, Schema.SchemaError, never>; | |
| } | |
| declare const WriteEntriesUnencrypted_base: Schema.Class<WriteEntriesUnencrypted, Schema.Struct<{ | |
| readonly publicKey: Schema.String; | |
| readonly storeId: Schema.brand<Schema.String, "effect/eventlog/EventLog/StoreId">; | |
| readonly entries: Schema.$Array<typeof Entry>; | |
| }>, {}>; | |
| /** | |
| * Schema for plaintext event-log write payloads sent to a remote store. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class WriteEntriesUnencrypted extends WriteEntriesUnencrypted_base { | |
| static FromMsgpack: Msgpack.schema<typeof WriteEntriesUnencrypted>; | |
| static encode: (input: WriteEntriesUnencrypted, options?: import("../../SchemaAST.ts").ParseOptions) => import("../../Effect.ts").Effect<Uint8Array<ArrayBuffer>, Schema.SchemaError, never>; | |
| static decode: (input: Uint8Array<ArrayBuffer>, options?: import("../../SchemaAST.ts").ParseOptions) => import("../../Effect.ts").Effect<WriteEntriesUnencrypted, Schema.SchemaError, never>; | |
| get encoded(): import("../../Effect.ts").Effect<Uint8Array<ArrayBuffer>, Schema.SchemaError, never>; | |
| } | |
| declare const WriteSingleRpc_base: Rpc.Rpc<"EventLog.WriteSingle", Schema.Struct<{ | |
| data: Transferable.Transferable<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; | |
| }>, Schema.Void, typeof EventLogProtocolError, typeof EventLogAuthentication, never>; | |
| /** | |
| * RPC used to send an encoded write payload that fits in one message. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class WriteSingleRpc extends WriteSingleRpc_base { | |
| } | |
| declare const ChangesRpc_base: Rpc.Rpc<"EventLog.Changes", Schema.Struct<{ | |
| publicKey: Schema.String; | |
| storeId: Schema.brand<Schema.String, "effect/eventlog/EventLog/StoreId">; | |
| startSequence: Schema.Number; | |
| }>, import("../rpc/RpcSchema.ts").Stream<Schema.Union<readonly [typeof SingleMessage, typeof ChunkedMessage]>, typeof EventLogProtocolError>, Schema.Never, typeof EventLogAuthentication, never>; | |
| /** | |
| * RPC used to stream remote event-log changes for a public key and store id | |
| * starting at a sequence number. | |
| * | |
| * **Details** | |
| * | |
| * Responses are encoded as either `SingleMessage` values or `ChunkedMessage` | |
| * parts. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class ChangesRpc extends ChangesRpc_base { | |
| static EncryptedFromMsgpack: Msgpack.schema<Schema.NonEmptyArray<Schema.Struct<{ | |
| readonly sequence: Schema.Number; | |
| readonly iv: Transferable.Transferable<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; | |
| readonly entryId: Schema.brand<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, "effect/eventlog/EventJournal/EntryId">; | |
| readonly encryptedEntry: Transferable.Transferable<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; | |
| }>>>; | |
| static UnencryptedFromMsgpack: Msgpack.schema<Schema.NonEmptyArray<typeof RemoteEntry>>; | |
| static encodeEncrypted: (input: readonly [{ | |
| readonly sequence: number; | |
| readonly iv: Uint8Array<ArrayBuffer>; | |
| readonly entryId: Uint8Array<ArrayBuffer> & Brand<"effect/eventlog/EventJournal/EntryId">; | |
| readonly encryptedEntry: Uint8Array<ArrayBuffer>; | |
| }, ...{ | |
| readonly sequence: number; | |
| readonly iv: Uint8Array<ArrayBuffer>; | |
| readonly entryId: Uint8Array<ArrayBuffer> & Brand<"effect/eventlog/EventJournal/EntryId">; | |
| readonly encryptedEntry: Uint8Array<ArrayBuffer>; | |
| }[]], options?: import("../../SchemaAST.ts").ParseOptions) => import("../../Effect.ts").Effect<Uint8Array<ArrayBuffer>, Schema.SchemaError, never>; | |
| static decodeEncrypted: (input: Uint8Array<ArrayBuffer>, options?: import("../../SchemaAST.ts").ParseOptions) => import("../../Effect.ts").Effect<readonly [{ | |
| readonly sequence: number; | |
| readonly iv: Uint8Array<ArrayBuffer>; | |
| readonly entryId: Uint8Array<ArrayBuffer> & Brand<"effect/eventlog/EventJournal/EntryId">; | |
| readonly encryptedEntry: Uint8Array<ArrayBuffer>; | |
| }, ...{ | |
| readonly sequence: number; | |
| readonly iv: Uint8Array<ArrayBuffer>; | |
| readonly entryId: Uint8Array<ArrayBuffer> & Brand<"effect/eventlog/EventJournal/EntryId">; | |
| readonly encryptedEntry: Uint8Array<ArrayBuffer>; | |
| }[]], Schema.SchemaError, never>; | |
| static encodeUnencrypted: (input: readonly [RemoteEntry, ...RemoteEntry[]], options?: import("../../SchemaAST.ts").ParseOptions) => import("../../Effect.ts").Effect<Uint8Array<ArrayBuffer>, Schema.SchemaError, never>; | |
| static decodeUnencrypted: (input: Uint8Array<ArrayBuffer>, options?: import("../../SchemaAST.ts").ParseOptions) => import("../../Effect.ts").Effect<readonly [RemoteEntry, ...RemoteEntry[]], Schema.SchemaError, never>; | |
| } | |
| declare const EventLogRemoteRpcs_base: RpcGroup.RpcGroup<typeof HelloRpc | typeof AuthenticateRpc | typeof WriteChunkedRpc | typeof WriteSingleRpc | typeof ChangesRpc>; | |
| /** | |
| * RPC group containing the event-log remote handshake, authentication, write, and | |
| * changes endpoints. | |
| * | |
| * @category protocols | |
| * @since 4.0.0 | |
| */ | |
| export declare class EventLogRemoteRpcs extends EventLogRemoteRpcs_base { | |
| } | |
| export {}; | |
| //# sourceMappingURL=EventLogMessage.d.ts.map |
Xet Storage Details
- Size:
- 13.6 kB
- Xet hash:
- 9450f58abd0e04b38d1ee0cf6fa0e961fdde0e9759d0d895b7710c56400c1681
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.