import * as mod from "https://deno.land/x/cav@0.0.21/browser.ts";
Functions
Constructs a new Client tied to a given base URL. The provided set of packers will be used everywhere that data is packed/unpacked when using this client, including web sockets. | |
Deserializes a value returned by | |
Deserializes a Request or Response object whose body was serialized with
| |
Utility function used in the serial functions that determines if an object is a plain object or not. Because this is such a common operation when checking and serializing unknown objects, it's being exported as part of the API. | |
Serializes a value recursively until it's JSON-compatible. Serializers can be plugged in to extend the accepted types beyond what Cav supports by default. Referential equality will be preserved whenever the same object or symbol value is encountered more than once. If a value isn't recognized by any of the provided serializers or the default serializers, an error is thrown. | |
Serializes a value into a type that is compatible with a Response BodyInit, making it easy to serialize values for sending to an external host/client via HTTP. If a provided value is already compatible with BodyInit, it will be returned with an appropriate mime type, skipping the serialization process. During serialization, this function extends the default supported types to include Blobs and Files. If a Blob is encountered during serialization, the resulting body will be a multipart FormData that encodes the shape of the input as well as the blobs that were encountered. Otherwise, a regular JSON string will be returned. Blobs and Files can be placed anywhere on the input value, even if they are nested. | |
Constructs a Serializer. This simply returns the first argument, it's only used for type annotations. | |
Wraps a regular WebSocket with serializer functionality and type support. |
Interfaces
An endpoint handler can use this Request type to ferry type information to the client from the server about what client arguments are acceptable. | |
Response type used to ferry the type of the deserialized response to the client from the server. If a server handler doesn't return this type, the response type of the corresponding client call will be "unknown". | |
Initializer arguments for constructing HttpErrors, which can expose arbitrary data and status codes during de/serialization. | |
A function that parses data. If data is not shaped as expected, an error should be thrown. | |
An object with a ParserFunction as its "parse" property. Zod compatible. | |
A router handler on the server can use this Request type to ferry type information about valid routes to the client. The client uses the provided RouterShape to infer which property accesses are valid. | |
Type constraint for the Shape parameter of a RouterRequest. The shape describes the client property accesses that would result in a valid endpoint call. | |
A group of functions used to recognize (check), serialize, and deserialize objects and special values that are not strings, basic numbers, booleans, or nulls into objects that are JSON compatible. | |
Cav's WebSocket wrapper interface. | |
Initializer options to use when upgrading a request into a web socket using
the |
Type Aliases
Matches any kind of parser. Useful for type constraints. | |
Type alias representing a Serializer with any input or output type. Useful for type constraints. | |
Type that matches any socket. Useful for type constraints. | |
A function that wraps | |
Arguments for the client function when its internal path points to an endpoint. | |
Generic handler type for server-defined Request handlers. | |
An object or function responsible for parsing data or throwing errors if the
data isn't shaped as expected. These can either be functions with a single
data argument that return the parsed data or an object with a | |
Extracts the input type of a given Parser. | |
Extracts the output type of a given Parser. | |
A group of named Serializer objects. Serializer keys are used to tag serialized values on the output JSON, which is required in order to correctly deserialize the value on the other side. | |
Type for a web socket event listener. The shape of the listener depends on the event type. For the "message" event, the message type may be provided as the second type parameter. | |
A Serializer's |