Skip to content

Commit 6003f68

Browse files
committed
typescript 1.0.6
1 parent d01adc5 commit 6003f68

File tree

10 files changed

+43
-24
lines changed

10 files changed

+43
-24
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ Software Development Kit for interacting with Xnode Manager.
44

55
## Related Repos
66

7-
https://github.com/Openmesh-Network/xnode-manager/
7+
https://github.com/Openmesh-Network/xnode-manager
88

99
## Supported Programming Languages And Frameworks
1010

11+
[Rust](./rust/package/)
1112
[TypeScript](./ts/package/)
1213
[React](./ts/react/)
1314

ts/package/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ TypeScript Software Development Kit for interacting with Xnode Manager.
44

55
## Related Repos
66

7-
https://github.com/Openmesh-Network/xnode-manager/
7+
https://github.com/Openmesh-Network/xnode-manager
88

99
## Versioning
1010

ts/package/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openmesh-network/xnode-manager-sdk",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/Openmesh-Network/xnode-manager-sdk.git"

ts/package/src/auth/handlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ export async function login({
2626

2727
await axiosInstance.post(`${baseUrl}${scope()}/api/login`, loginParams);
2828

29-
return { axiosInstance, baseUrl } satisfies login_output;
29+
return { axiosInstance, baseUrl };
3030
}
3131

3232
export type logout_input = Sessioned<{}>;
3333
export type logout_output = void;
3434
export async function logout(input: logout_input): Promise<logout_output> {
35-
return SessionPost(input, scope(), "/xnode-auth/api/logout");
35+
return SessionPost(input, scope(), "/api/logout");
3636
}

ts/package/src/info/handlers.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import * as rust from "../utils/rust-types.js";
2-
3-
import type { Flake } from "./models.js";
1+
import type { Flake, FlakeQuery } from "./models.js";
42
import { SessionGet, type Sessioned } from "../utils/session.js";
53

64
export function scope() {
75
return "/info";
86
}
97

10-
export type flake_input = Sessioned<{ query: { flake: rust.String } }>;
8+
export type flake_input = Sessioned<{ query: FlakeQuery }>;
119
export type flake_output = Flake;
1210
export async function flake(input: flake_input): Promise<flake_output> {
1311
return SessionGet(input, scope(), "/flake");

ts/package/src/info/models.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import * as rust from "../utils/rust-types.js";
22

3+
export interface FlakeQuery {
4+
flake: rust.String;
5+
}
6+
37
export interface Flake {
48
last_modified: rust.u64;
59
revision: rust.String;

ts/package/src/process/handlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function scope() {
99
}
1010

1111
export type list_input = Sessioned<{ path: { scope: rust.String } }>;
12-
export type list_output = Process[];
12+
export type list_output = rust.Vec<Process>;
1313
export async function list(input: list_input): Promise<list_output> {
1414
return SessionGet(input, scope(), (path) => `/${path.scope}/list`);
1515
}
@@ -18,7 +18,7 @@ export type logs_input = Sessioned<{
1818
path: { scope: rust.String; process: rust.String };
1919
query: LogQuery;
2020
}>;
21-
export type logs_output = Log[];
21+
export type logs_output = rust.Vec<Log>;
2222
export async function logs(input: logs_input): Promise<logs_output> {
2323
return SessionGet(
2424
input,

ts/package/src/usage/handlers.ts

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,42 @@
1+
import * as rust from "../utils/rust-types.js";
2+
13
import { SessionGet, type Sessioned } from "../utils/session.js";
24
import type { MemoryUsage, DiskUsage, CpuUsage } from "./models.js";
35

46
export function scope() {
57
return "/usage";
68
}
79

8-
export type cpu_input = Sessioned<{}>;
9-
export type cpu_output = CpuUsage[];
10+
export type cpu_input = Sessioned<{
11+
path: {
12+
scope: rust.String;
13+
};
14+
}>;
15+
export type cpu_output = rust.Vec<CpuUsage>;
1016
export async function cpu(input: cpu_input): Promise<cpu_output> {
11-
return SessionGet(input, scope(), "/host/cpu");
17+
return SessionGet(input, scope(), (path) => `/${path}/cpu`);
1218
}
1319

14-
export type memory_input = Sessioned<{}>;
20+
export type memory_input = Sessioned<{
21+
path: {
22+
scope: rust.String;
23+
};
24+
}>;
1525
export type memory_output = MemoryUsage;
1626
export async function memory(input: memory_input): Promise<memory_output> {
17-
return SessionGet(input, scope(), "/host/memory");
27+
return SessionGet(input, scope(), (path) => `/${path}/memory`);
1828
}
1929

20-
export type disk_input = Sessioned<{}>;
21-
export type disk_output = DiskUsage[];
30+
export type disk_input = Sessioned<{
31+
path: {
32+
scope: rust.String;
33+
};
34+
}>;
35+
export type disk_output = rust.Vec<DiskUsage>;
2236
export async function disk(input: disk_input): Promise<disk_output> {
23-
return SessionGet<disk_output>(input, scope(), "/host/disk").then((data) =>
24-
data.filter((d) => d.mount_point.startsWith("/mnt"))
25-
);
37+
return SessionGet<disk_output, disk_input["path"]>(
38+
input,
39+
scope(),
40+
(path) => `/${path}/disk`
41+
).then((data) => data.filter((d) => d.mount_point.startsWith("/mnt")));
2642
}

ts/react/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ React Software Development Kit for interacting with Xnode Manager.
44

55
## Related Repos
66

7-
https://github.com/Openmesh-Network/xnode-manager/
7+
https://github.com/Openmesh-Network/xnode-manager
88

99
## Versioning
1010

0 commit comments

Comments
 (0)