@heynixie/contract 0.0.0-stage → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -2
- package/dist/build-pending-input.d.ts +8 -0
- package/dist/build-query-utils.d.ts +1855 -0
- package/dist/build-span-state.d.ts +2 -0
- package/dist/client-header-name.d.ts +1 -0
- package/dist/contract.d.ts +2263 -0
- package/dist/has-several-words.d.ts +1 -0
- package/dist/host-contract.d.ts +1266 -0
- package/dist/image-limits.d.ts +6 -0
- package/dist/image-not-found-error.d.ts +4 -0
- package/dist/image-refused-error.d.ts +13 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +1097 -0
- package/dist/is-time-zone.d.ts +1 -0
- package/dist/memory-export-contract.d.ts +29 -0
- package/dist/memory-view-contract.d.ts +1486 -0
- package/dist/moment-contract.d.ts +334 -0
- package/dist/pick-span-source.d.ts +2 -0
- package/dist/proposal-outcome-schema.d.ts +37 -0
- package/dist/render-session-cookie.d.ts +1 -0
- package/dist/reused-id-errors.d.ts +6 -0
- package/dist/session-cookie-name.d.ts +1 -0
- package/dist/signed-in.d.ts +6 -0
- package/dist/span-schema.d.ts +11 -0
- package/dist/task-schema.d.ts +9 -0
- package/dist/tool-call-schema.d.ts +8 -0
- package/dist/types.d.ts +30 -0
- package/package.json +34 -4
package/README.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>@heynixie/contract</h1>
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
<p>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@heynixie/contract"><img src="https://img.shields.io/npm/v/@heynixie/contract" alt="npm version"></a>
|
|
6
|
+
<a href="../../LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"></a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p>
|
|
10
|
+
<a href="../../docs/architecture/channels/api.md">API</a> •
|
|
11
|
+
<a href="../../docs/architecture/deployment/release-pipeline.md">Release pipeline</a>
|
|
12
|
+
</p>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
The oRPC contract of the nixie API, with the types a client needs.
|
|
16
|
+
|
|
17
|
+
Each release of nixie publishes the contract at its own version, so a client takes a change to the
|
|
18
|
+
API with a version bump. To start, install the package beside `@orpc/client`, build a client of the
|
|
19
|
+
`ContractClient` type on an oRPC link to your nixie's `/rpc` path, and send the client header on
|
|
20
|
+
every call.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
The package ships an ES module with its type declarations, so a client on Node, on Bun or in a
|
|
25
|
+
browser bundle loads it. It depends on oRPC and Zod at the versions nixie pins.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
bun add @heynixie/contract @orpc/client
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **The contract.** `contract` holds every procedure the API serves, with the Zod schema of each
|
|
34
|
+
input and output, and `hostContract` holds the procedures that the host commands call on the
|
|
35
|
+
server's local socket.
|
|
36
|
+
- **The client types.** `ContractClient`, `ContractInputs` and `ContractOutputs` give each
|
|
37
|
+
procedure's call, input and output.
|
|
38
|
+
- **The call headers.** `clientHeaderName` holds the name of the header the API needs on every call,
|
|
39
|
+
and `sessionCookieName` holds the name of the cookie that carries a device session.
|
|
40
|
+
|
|
41
|
+
## Configuration
|
|
42
|
+
|
|
43
|
+
A client points its oRPC link at the API's `/rpc` path, and
|
|
44
|
+
[the API](../../docs/architecture/channels/api.md) describes how a call carries its device session.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PendingInput } from './types.js';
|
|
2
|
+
export interface BeforeInputFields {
|
|
3
|
+
readonly inputType: string;
|
|
4
|
+
readonly data: string | null;
|
|
5
|
+
readonly selectionEnd: number;
|
|
6
|
+
readonly selectionStart: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildPendingInput(fields: BeforeInputFields): PendingInput;
|