@lynkoria/contracts 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +40 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,43 @@
1
1
  # @lynkoria/contracts
2
2
 
3
- Shared Lynkoria contract: Zod schemas for REST bodies and responses, Socket.IO event maps
3
+ [![npm](https://img.shields.io/npm/v/@lynkoria/contracts)](https://www.npmjs.com/package/@lynkoria/contracts)
4
+ [![license](https://img.shields.io/npm/l/@lynkoria/contracts)](./LICENSE)
5
+
6
+ The shared Lynkoria contract: Zod schemas for REST requests and responses, the Socket.IO event maps
4
7
  (`ServerToClientEvents`, `ClientToServerEvents`), outbound webhook types, error codes and the typed
5
- `LynkoriaError`. Used by the API and every SDK; consumers usually import it through
6
- `@lynkoria/server` or `@lynkoria/client`.
8
+ `LynkoriaError`. The API and every JavaScript SDK use it, so types match end to end.
9
+
10
+ **[Documentation](https://lynkoria.com/docs/)** · [HTTP API](https://lynkoria.com/docs/http-api/) ·
11
+ [Events](https://lynkoria.com/docs/events/) · [Errors](https://lynkoria.com/docs/errors/) ·
12
+ [Webhooks](https://lynkoria.com/docs/webhooks/)
13
+
14
+ ## Install
15
+
16
+ Most apps do not install this directly: [`@lynkoria/server`](https://www.npmjs.com/package/@lynkoria/server)
17
+ and [`@lynkoria/client`](https://www.npmjs.com/package/@lynkoria/client) depend on it and re-export what you
18
+ need (`LynkoriaError`, `ErrorCode`). Install it when you want the schemas or event types yourself, for
19
+ example to validate webhook payloads or type your own Socket.IO wrapper:
20
+
21
+ ```bash
22
+ npm install @lynkoria/contracts
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```ts
28
+ import { ErrorCode, LynkoriaError } from '@lynkoria/contracts';
29
+
30
+ try {
31
+ await doSomething();
32
+ } catch (err) {
33
+ if (err instanceof LynkoriaError && err.code === ErrorCode.RateLimited) retryLater(err.requestId);
34
+ else throw err;
35
+ }
36
+ ```
37
+
38
+ The error codes, event names and payloads are listed in the [errors](https://lynkoria.com/docs/errors/)
39
+ and [events](https://lynkoria.com/docs/events/) references.
40
+
41
+ ## License
42
+
43
+ [Apache-2.0](./LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynkoria/contracts",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Lynkoria shared contracts: Zod schemas, event names, error codes",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",