incus-ts 0.1.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 +66 -0
- package/dist/index.js +1885 -0
- package/dist/index.js.map +10 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# incus-ts
|
|
2
|
+
|
|
3
|
+
First step of a Bun-first TypeScript port of the Incus Go client.
|
|
4
|
+
|
|
5
|
+
Current status: core runtime is implemented for transport, raw requests, server,
|
|
6
|
+
operations, images, and a practical subset of instance operations. Other
|
|
7
|
+
domains are scaffolded and currently return explicit "not implemented yet"
|
|
8
|
+
errors.
|
|
9
|
+
|
|
10
|
+
## Goals
|
|
11
|
+
|
|
12
|
+
- Keep setup lightweight (Bun for install/build/test).
|
|
13
|
+
- Preserve Incus Go client capability domains.
|
|
14
|
+
- Provide a Gondolin-like ergonomic TypeScript surface:
|
|
15
|
+
- static factories (`Incus.connect*`)
|
|
16
|
+
- grouped resource APIs (`client.instances`, `client.networks`, ...)
|
|
17
|
+
- chainable context scoping (`client.project(...).target(...)`)
|
|
18
|
+
|
|
19
|
+
## Quick look
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { Incus } from "incus-ts";
|
|
23
|
+
|
|
24
|
+
const client = await Incus.connect("https://incus.example");
|
|
25
|
+
|
|
26
|
+
const scoped = client.project("my-project").target("node-1");
|
|
27
|
+
|
|
28
|
+
await scoped.instances.list({ type: "container", allProjects: false });
|
|
29
|
+
await scoped.images.aliases.get("alpine/3.20");
|
|
30
|
+
|
|
31
|
+
const instance = scoped.instances.instance("my-container");
|
|
32
|
+
const proc = instance.exec({ command: ["sh", "-lc", "echo hello"] }, { stdout: "pipe" });
|
|
33
|
+
for await (const chunk of proc) {
|
|
34
|
+
process.stdout.write(new TextDecoder().decode(chunk));
|
|
35
|
+
}
|
|
36
|
+
const result = await proc;
|
|
37
|
+
console.log(result.exitCode);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Implemented now
|
|
41
|
+
|
|
42
|
+
- `connection`, `raw`
|
|
43
|
+
- `server`
|
|
44
|
+
- `operations`
|
|
45
|
+
- `images` + `images.aliases` (simple streams remains unimplemented)
|
|
46
|
+
- `instances` collection + per-instance handles (`instances.instance(name)`) for
|
|
47
|
+
CRUD/state/exec/console/metadata/logs/files with websocket exec stream attach over Unix sockets
|
|
48
|
+
|
|
49
|
+
## Sketched but not implemented yet
|
|
50
|
+
|
|
51
|
+
- `certificates`
|
|
52
|
+
- `events`
|
|
53
|
+
- `networks` and nested groups
|
|
54
|
+
- `profiles`, `projects`
|
|
55
|
+
- `storage` and nested groups
|
|
56
|
+
- `cluster`
|
|
57
|
+
- `warnings`
|
|
58
|
+
- `instances.templates`, `instances.snapshots`, `instances.backups`
|
|
59
|
+
|
|
60
|
+
## Scripts
|
|
61
|
+
|
|
62
|
+
- `bun run typecheck`
|
|
63
|
+
- `bun run test`
|
|
64
|
+
- `bun run test:e2e` (requires local Incus and `INCUS_E2E=1`)
|
|
65
|
+
- `bun run build`
|
|
66
|
+
- `bun run check`
|