@truenas/api-client 1.0.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 ADDED
@@ -0,0 +1,38 @@
1
+ # @truenas/api-client
2
+
3
+ Framework-agnostic TypeScript client for the TrueNAS JSON-RPC 2.0 WebSocket API.
4
+
5
+ > **Status:** early extraction in progress. The client is being pulled out of the TrueNAS Connect UI
6
+ > into this standalone package.
7
+
8
+ ## Requirements
9
+
10
+ - **Node ≥ 22** (provides a global `WebSocket`) or a browser. On older Node, supply a `WebSocket`
11
+ implementation (e.g. the [`ws`](https://www.npmjs.com/package/ws) package) via the socket config.
12
+ - **`rxjs` ^7.8** is a peer dependency — the consuming project provides it.
13
+
14
+ ## Development
15
+
16
+ ```bash
17
+ corepack enable # once, to enable Yarn 4
18
+ yarn install
19
+ yarn build # bundle to dist/ (ESM + CJS + .d.ts) via tsup
20
+ yarn typecheck # tsc --noEmit
21
+ yarn test # vitest
22
+ yarn lint # eslint
23
+ ```
24
+
25
+ ## Layout
26
+
27
+ Sources live under `src/`, grouped by role:
28
+
29
+ ```
30
+ src/
31
+ connection/ api/ auth/ client/ # the WebSocket client, split by responsibility
32
+ types/ enums/ utils/ config/ errors/
33
+ logger.ts factory.ts version-discovery.ts index.ts
34
+ ```
35
+
36
+ Internal modules import each other through the `@/*` path alias (`@/* → src/*`). The alias is a
37
+ build-time convenience only — it is inlined away during bundling and never reaches consumers; the public
38
+ API is solely what `src/index.ts` (the barrel) re-exports.