@heynixie/contract
v0.70.1
Published
The oRPC contract of the nixie API, with the types a client needs
Readme
The oRPC contract of the nixie API, with the types a client needs.
Each release of nixie publishes the contract at its own version, so a client takes a change to the
API with a version bump. To start, install the package beside @orpc/client, build a client of the
ContractClient type on an oRPC link to your nixie's /rpc path, and send the client header on
every call.
Install
The package ships an ES module with its type declarations, so a client on Node, on Bun or in a browser bundle loads it. It depends on oRPC and Zod at the versions nixie pins.
bun add @heynixie/contract @orpc/clientFeatures
- The contract.
contractholds every procedure the API serves, with the Zod schema of each input and output, andhostContractholds the procedures that the host commands call on the server's local socket. - The client types.
ContractClient,ContractInputsandContractOutputsgive each procedure's call, input and output. - The call headers.
clientHeaderNameholds the name of the header the API needs on every call, andsessionCookieNameholds the name of the cookie that carries a device session.
Configuration
A client points its oRPC link at the API's /rpc path, and
the API describes how a call carries its device session.
