@synnaxlabs/client 0.20.0 → 0.22.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/.turbo/turbo-build.log +7 -7
- package/.vscode/settings.json +3 -0
- package/README.md +13 -0
- package/dist/auth/auth.d.ts +7 -6
- package/dist/auth/auth.d.ts.map +1 -1
- package/dist/channel/client.d.ts +14 -11
- package/dist/channel/client.d.ts.map +1 -1
- package/dist/channel/creator.d.ts +10 -0
- package/dist/channel/creator.d.ts.map +1 -0
- package/dist/channel/payload.d.ts +6 -2
- package/dist/channel/payload.d.ts.map +1 -1
- package/dist/channel/retriever.d.ts +65 -35
- package/dist/channel/retriever.d.ts.map +1 -1
- package/dist/channel/writer.d.ts +4 -3
- package/dist/client.cjs +19 -22
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +12 -10
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6781 -6675
- package/dist/client.js.map +1 -1
- package/dist/connection/checker.d.ts +4 -3
- package/dist/connection/checker.d.ts.map +1 -1
- package/dist/control/authority.d.ts +2 -1
- package/dist/control/state.d.ts +6 -4
- package/dist/control/state.d.ts.map +1 -1
- package/dist/errors.d.ts +24 -20
- package/dist/errors.d.ts.map +1 -1
- package/dist/framer/adapter.d.ts +5 -4
- package/dist/framer/adapter.d.ts.map +1 -1
- package/dist/framer/client.d.ts +12 -12
- package/dist/framer/client.d.ts.map +1 -1
- package/dist/framer/frame.d.ts +13 -12
- package/dist/framer/frame.d.ts.map +1 -1
- package/dist/framer/iterator.d.ts +5 -4
- package/dist/framer/iterator.d.ts.map +1 -1
- package/dist/framer/streamProxy.d.ts +3 -2
- package/dist/framer/streamProxy.d.ts.map +1 -1
- package/dist/framer/streamer.d.ts +13 -4
- package/dist/framer/streamer.d.ts.map +1 -1
- package/dist/framer/writer.d.ts +67 -33
- package/dist/framer/writer.d.ts.map +1 -1
- package/dist/hardware/client.d.ts +4 -3
- package/dist/hardware/device/client.d.ts +107 -14
- package/dist/hardware/device/client.d.ts.map +1 -1
- package/dist/hardware/device/external.d.ts +0 -2
- package/dist/hardware/device/external.d.ts.map +1 -1
- package/dist/hardware/device/index.d.ts +1 -1
- package/dist/hardware/device/index.d.ts.map +1 -1
- package/dist/hardware/rack/client.d.ts +43 -20
- package/dist/hardware/rack/client.d.ts.map +1 -1
- package/dist/hardware/rack/external.d.ts +0 -2
- package/dist/hardware/rack/external.d.ts.map +1 -1
- package/dist/hardware/task/client.d.ts +197 -14
- package/dist/hardware/task/client.d.ts.map +1 -1
- package/dist/hardware/task/index.d.ts +1 -1
- package/dist/hardware/task/index.d.ts.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/label/client.d.ts +8 -6
- package/dist/label/client.d.ts.map +1 -1
- package/dist/label/payload.d.ts +2 -1
- package/dist/label/retriever.d.ts +3 -2
- package/dist/label/writer.d.ts +4 -3
- package/dist/ontology/client.d.ts +82 -14
- package/dist/ontology/client.d.ts.map +1 -1
- package/dist/ontology/external.d.ts +0 -1
- package/dist/ontology/external.d.ts.map +1 -1
- package/dist/ontology/group/client.d.ts +3 -2
- package/dist/ontology/group/client.d.ts.map +1 -1
- package/dist/ontology/group/group.d.ts +1 -0
- package/dist/ontology/group/payload.d.ts +2 -1
- package/dist/ontology/group/writer.d.ts +4 -3
- package/dist/ontology/payload.d.ts +71 -60
- package/dist/ontology/payload.d.ts.map +1 -1
- package/dist/ontology/writer.d.ts +3 -2
- package/dist/ranger/active.d.ts +3 -2
- package/dist/ranger/alias.d.ts +7 -6
- package/dist/ranger/alias.d.ts.map +1 -1
- package/dist/ranger/client.d.ts +162 -11
- package/dist/ranger/client.d.ts.map +1 -1
- package/dist/ranger/external.d.ts +0 -1
- package/dist/ranger/external.d.ts.map +1 -1
- package/dist/ranger/kv.d.ts +5 -3
- package/dist/ranger/kv.d.ts.map +1 -1
- package/dist/ranger/payload.d.ts +57 -50
- package/dist/ranger/payload.d.ts.map +1 -1
- package/dist/ranger/range.d.ts +12 -10
- package/dist/ranger/range.d.ts.map +1 -1
- package/dist/ranger/writer.d.ts +3 -2
- package/dist/setupspecs.d.ts +2 -1
- package/dist/signals/observable.d.ts +8 -15
- package/dist/signals/observable.d.ts.map +1 -1
- package/dist/transport.d.ts +3 -2
- package/dist/transport.d.ts.map +1 -1
- package/dist/user/payload.d.ts +2 -1
- package/dist/util/retrieve.d.ts +24 -0
- package/dist/util/retrieve.d.ts.map +1 -0
- package/dist/util/retrieve.spec.d.ts +2 -0
- package/dist/util/retrieve.spec.d.ts.map +1 -0
- package/dist/util/telem.d.ts +2 -1
- package/dist/util/telem.d.ts.map +1 -1
- package/dist/util/zod.d.ts +4 -0
- package/dist/util/zod.d.ts.map +1 -0
- package/dist/workspace/client.d.ts +9 -6
- package/dist/workspace/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/client.d.ts +6 -5
- package/dist/workspace/lineplot/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/payload.d.ts +3 -2
- package/dist/workspace/lineplot/payload.d.ts.map +1 -1
- package/dist/workspace/lineplot/retriever.d.ts +3 -2
- package/dist/workspace/lineplot/retriever.d.ts.map +1 -1
- package/dist/workspace/lineplot/writer.d.ts +7 -6
- package/dist/workspace/lineplot/writer.d.ts.map +1 -1
- package/dist/workspace/payload.d.ts +3 -2
- package/dist/workspace/payload.d.ts.map +1 -1
- package/dist/workspace/retriever.d.ts +3 -2
- package/dist/workspace/schematic/client.d.ts +18 -0
- package/dist/workspace/schematic/client.d.ts.map +1 -0
- package/dist/workspace/schematic/external.d.ts.map +1 -0
- package/dist/workspace/schematic/index.d.ts +2 -0
- package/dist/workspace/schematic/index.d.ts.map +1 -0
- package/dist/workspace/{pid → schematic}/payload.d.ts +6 -5
- package/dist/workspace/schematic/payload.d.ts.map +1 -0
- package/dist/workspace/schematic/retriever.d.ts +10 -0
- package/dist/workspace/schematic/retriever.d.ts.map +1 -0
- package/dist/workspace/schematic/schematic.spec.d.ts +2 -0
- package/dist/workspace/schematic/schematic.spec.d.ts.map +1 -0
- package/dist/workspace/{pid → schematic}/writer.d.ts +11 -10
- package/dist/workspace/schematic/writer.d.ts.map +1 -0
- package/dist/workspace/writer.d.ts +5 -4
- package/dist/workspace/writer.d.ts.map +1 -1
- package/examples/node/package-lock.json +29 -12
- package/examples/node/package.json +2 -2
- package/examples/node/streamWrite.js +8 -11
- package/package.json +10 -9
- package/src/auth/auth.spec.ts +55 -15
- package/src/auth/auth.ts +41 -42
- package/src/channel/batchRetriever.spec.ts +37 -40
- package/src/channel/channel.spec.ts +4 -4
- package/src/channel/client.ts +42 -49
- package/src/channel/creator.ts +37 -0
- package/src/channel/payload.ts +2 -1
- package/src/channel/retriever.ts +55 -71
- package/src/client.ts +23 -20
- package/src/connection/checker.ts +1 -1
- package/src/connection/connection.spec.ts +1 -6
- package/src/control/state.ts +3 -1
- package/src/errors.ts +71 -67
- package/src/framer/adapter.spec.ts +33 -1
- package/src/framer/adapter.ts +10 -6
- package/src/framer/client.ts +13 -12
- package/src/framer/frame.spec.ts +1 -1
- package/src/framer/frame.ts +9 -6
- package/src/framer/iterator.spec.ts +1 -1
- package/src/framer/iterator.ts +1 -1
- package/src/framer/streamProxy.ts +12 -13
- package/src/framer/streamer.spec.ts +1 -1
- package/src/framer/streamer.ts +25 -1
- package/src/framer/writer.spec.ts +49 -2
- package/src/framer/writer.ts +27 -2
- package/src/hardware/device/client.ts +155 -28
- package/src/hardware/device/device.spec.ts +2 -2
- package/src/hardware/device/external.ts +0 -2
- package/src/hardware/device/index.ts +2 -2
- package/src/hardware/rack/client.ts +139 -56
- package/src/hardware/rack/external.ts +0 -2
- package/src/hardware/rack/rack.spec.ts +20 -1
- package/src/hardware/task/client.ts +324 -31
- package/src/hardware/task/index.ts +1 -1
- package/src/hardware/task/task.spec.ts +41 -0
- package/src/index.ts +3 -4
- package/src/label/client.ts +3 -2
- package/src/label/retriever.ts +1 -1
- package/src/label/writer.ts +1 -1
- package/src/ontology/client.ts +195 -41
- package/src/ontology/external.ts +0 -1
- package/src/ontology/group/client.ts +1 -2
- package/src/ontology/group/payload.ts +1 -1
- package/src/ontology/ontology.spec.ts +16 -0
- package/src/ontology/payload.ts +22 -13
- package/src/ranger/active.ts +5 -5
- package/src/ranger/alias.ts +2 -2
- package/src/ranger/client.ts +68 -17
- package/src/ranger/external.ts +0 -1
- package/src/ranger/kv.ts +6 -1
- package/src/ranger/payload.ts +6 -4
- package/src/ranger/range.ts +4 -1
- package/src/ranger/ranger.spec.ts +24 -2
- package/src/signals/observable.ts +24 -63
- package/src/transport.ts +2 -1
- package/src/util/retrieve.spec.ts +56 -0
- package/src/util/retrieve.ts +103 -0
- package/src/util/telem.ts +1 -1
- package/src/util/zod.ts +4 -0
- package/src/workspace/client.ts +6 -4
- package/src/workspace/lineplot/client.ts +3 -3
- package/src/workspace/lineplot/linePlot.spec.ts +11 -11
- package/src/workspace/lineplot/payload.ts +1 -1
- package/src/workspace/lineplot/retriever.ts +5 -13
- package/src/workspace/lineplot/writer.ts +8 -7
- package/src/workspace/payload.ts +6 -3
- package/src/workspace/retriever.ts +1 -1
- package/src/workspace/{pid → schematic}/client.ts +10 -10
- package/src/workspace/{pid → schematic}/external.ts +2 -2
- package/src/workspace/{pid → schematic}/index.ts +1 -1
- package/src/workspace/{pid → schematic}/payload.ts +4 -4
- package/src/workspace/{pid → schematic}/retriever.ts +10 -10
- package/src/workspace/{pid/pid.spec.ts → schematic/schematic.spec.ts} +35 -35
- package/src/workspace/{pid → schematic}/writer.ts +26 -25
- package/src/workspace/workspace.spec.ts +7 -7
- package/src/workspace/writer.ts +8 -2
- package/dist/hardware/device/payload.d.ts +0 -30
- package/dist/hardware/device/payload.d.ts.map +0 -1
- package/dist/hardware/device/retriever.d.ts +0 -10
- package/dist/hardware/device/retriever.d.ts.map +0 -1
- package/dist/hardware/device/writer.d.ts +0 -9
- package/dist/hardware/device/writer.d.ts.map +0 -1
- package/dist/hardware/rack/payload.d.ts +0 -26
- package/dist/hardware/rack/payload.d.ts.map +0 -1
- package/dist/hardware/rack/retriever.d.ts +0 -10
- package/dist/hardware/rack/retriever.d.ts.map +0 -1
- package/dist/hardware/rack/writer.d.ts +0 -9
- package/dist/hardware/rack/writer.d.ts.map +0 -1
- package/dist/hardware/task/external.d.ts +0 -4
- package/dist/hardware/task/external.d.ts.map +0 -1
- package/dist/hardware/task/payload.d.ts +0 -42
- package/dist/hardware/task/payload.d.ts.map +0 -1
- package/dist/hardware/task/retriever.d.ts +0 -29
- package/dist/hardware/task/retriever.d.ts.map +0 -1
- package/dist/hardware/task/writer.d.ts +0 -9
- package/dist/hardware/task/writer.d.ts.map +0 -1
- package/dist/ontology/retriever.d.ts +0 -13
- package/dist/ontology/retriever.d.ts.map +0 -1
- package/dist/ontology/signals.d.ts +0 -30
- package/dist/ontology/signals.d.ts.map +0 -1
- package/dist/ranger/retriever.d.ts +0 -11
- package/dist/ranger/retriever.d.ts.map +0 -1
- package/dist/workspace/pid/client.d.ts +0 -17
- package/dist/workspace/pid/client.d.ts.map +0 -1
- package/dist/workspace/pid/external.d.ts.map +0 -1
- package/dist/workspace/pid/index.d.ts +0 -2
- package/dist/workspace/pid/index.d.ts.map +0 -1
- package/dist/workspace/pid/payload.d.ts.map +0 -1
- package/dist/workspace/pid/pid.spec.d.ts +0 -2
- package/dist/workspace/pid/pid.spec.d.ts.map +0 -1
- package/dist/workspace/pid/retriever.d.ts +0 -9
- package/dist/workspace/pid/retriever.d.ts.map +0 -1
- package/dist/workspace/pid/writer.d.ts.map +0 -1
- package/src/hardware/device/payload.ts +0 -27
- package/src/hardware/device/retriever.ts +0 -60
- package/src/hardware/device/writer.ts +0 -59
- package/src/hardware/rack/payload.ts +0 -26
- package/src/hardware/rack/retriever.ts +0 -68
- package/src/hardware/rack/writer.ts +0 -59
- package/src/hardware/task/external.ts +0 -12
- package/src/hardware/task/payload.ts +0 -40
- package/src/hardware/task/retriever.ts +0 -70
- package/src/hardware/task/writer.ts +0 -65
- package/src/ontology/retriever.ts +0 -91
- package/src/ontology/signals.ts +0 -139
- package/src/ranger/retriever.ts +0 -50
- /package/dist/workspace/{pid → schematic}/external.d.ts +0 -0
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
export * from "@/workspace/
|
|
11
|
-
export * from "@/workspace/
|
|
10
|
+
export * from "@/workspace/schematic/payload";
|
|
11
|
+
export * from "@/workspace/schematic/client";
|
|
@@ -7,25 +7,25 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
import { type UnknownRecord, unknownRecordZ } from "@synnaxlabs/x";
|
|
10
|
+
import { type UnknownRecord, unknownRecordZ } from "@synnaxlabs/x/record";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
|
|
13
13
|
export const keyZ = z.string().uuid();
|
|
14
14
|
export type Key = z.infer<typeof keyZ>;
|
|
15
15
|
export type Params = Key | Key[];
|
|
16
16
|
|
|
17
|
-
export const
|
|
17
|
+
export const schematicZ = z.object({
|
|
18
18
|
key: z.string(),
|
|
19
19
|
name: z.string(),
|
|
20
20
|
data: unknownRecordZ.or(z.string().transform((s) => JSON.parse(s) as UnknownRecord)),
|
|
21
21
|
snapshot: z.boolean(),
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
export const
|
|
24
|
+
export const schematicRemoteZ = z.object({
|
|
25
25
|
key: z.string(),
|
|
26
26
|
name: z.string(),
|
|
27
27
|
snapshot: z.boolean(),
|
|
28
28
|
data: z.string().transform((s) => JSON.parse(s) as UnknownRecord),
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
export type
|
|
31
|
+
export type Schematic = z.infer<typeof schematicZ>;
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
-
import { toArray } from "@synnaxlabs/x";
|
|
11
|
+
import { toArray } from "@synnaxlabs/x/toArray";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
|
|
14
|
-
import { type
|
|
14
|
+
import { type Schematic, type Params, schematicRemoteZ } from "@/workspace/schematic/payload";
|
|
15
15
|
|
|
16
16
|
const reqZ = z.object({
|
|
17
17
|
keys: z.string().array(),
|
|
@@ -20,24 +20,24 @@ const reqZ = z.object({
|
|
|
20
20
|
type Request = z.infer<typeof reqZ>;
|
|
21
21
|
|
|
22
22
|
const resZ = z.object({
|
|
23
|
-
|
|
23
|
+
schematics: schematicRemoteZ.array(),
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
export class Retriever {
|
|
27
|
-
private readonly ENDPOINT = "/workspace/
|
|
27
|
+
private readonly ENDPOINT = "/workspace/schematic/retrieve";
|
|
28
28
|
private readonly client: UnaryClient;
|
|
29
29
|
|
|
30
30
|
constructor(client: UnaryClient) {
|
|
31
31
|
this.client = client;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
async retrieve(params: Params): Promise<
|
|
34
|
+
async retrieve(params: Params): Promise<Schematic[]> {
|
|
35
35
|
return (await sendRequired(
|
|
36
|
-
this.client,
|
|
37
|
-
this.ENDPOINT,
|
|
38
|
-
{ keys: toArray(params) },
|
|
39
|
-
reqZ,
|
|
36
|
+
this.client,
|
|
37
|
+
this.ENDPOINT,
|
|
38
|
+
{ keys: toArray(params) },
|
|
39
|
+
reqZ,
|
|
40
40
|
resZ,
|
|
41
|
-
)).
|
|
41
|
+
)).schematics;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -16,94 +16,94 @@ const client = newClient();
|
|
|
16
16
|
|
|
17
17
|
const ZERO_UUID = "00000000-0000-0000-0000-000000000000";
|
|
18
18
|
|
|
19
|
-
describe("
|
|
19
|
+
describe("Schematic", () => {
|
|
20
20
|
describe("create", () => {
|
|
21
21
|
test("create one", async () => {
|
|
22
22
|
const ws = await client.workspaces.create({
|
|
23
|
-
name: "
|
|
23
|
+
name: "Schematic",
|
|
24
24
|
layout: { one: 1 },
|
|
25
25
|
});
|
|
26
|
-
const
|
|
27
|
-
name: "
|
|
26
|
+
const schematic = await client.workspaces.schematic.create(ws.key, {
|
|
27
|
+
name: "Schematic",
|
|
28
28
|
data: { one: 1 },
|
|
29
29
|
});
|
|
30
|
-
expect(
|
|
31
|
-
expect(
|
|
32
|
-
expect(
|
|
30
|
+
expect(schematic.name).toEqual("Schematic");
|
|
31
|
+
expect(schematic.key).not.toEqual(ZERO_UUID);
|
|
32
|
+
expect(schematic.data.one).toEqual(1);
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
describe("rename", () => {
|
|
36
36
|
test("rename one", async () => {
|
|
37
37
|
const ws = await client.workspaces.create({
|
|
38
|
-
name: "
|
|
38
|
+
name: "Schematic",
|
|
39
39
|
layout: { one: 1 },
|
|
40
40
|
});
|
|
41
|
-
const
|
|
42
|
-
name: "
|
|
41
|
+
const schematic = await client.workspaces.schematic.create(ws.key, {
|
|
42
|
+
name: "Schematic",
|
|
43
43
|
data: { one: 1 },
|
|
44
44
|
});
|
|
45
|
-
await client.workspaces.
|
|
46
|
-
const res = await client.workspaces.
|
|
47
|
-
expect(res.name).toEqual("
|
|
45
|
+
await client.workspaces.schematic.rename(schematic.key, "Schematic2");
|
|
46
|
+
const res = await client.workspaces.schematic.retrieve(schematic.key);
|
|
47
|
+
expect(res.name).toEqual("Schematic2");
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
50
|
describe("setData", () => {
|
|
51
51
|
test("set data", async () => {
|
|
52
52
|
const ws = await client.workspaces.create({
|
|
53
|
-
name: "
|
|
53
|
+
name: "Schematic",
|
|
54
54
|
layout: { one: 1 },
|
|
55
55
|
});
|
|
56
|
-
const
|
|
57
|
-
name: "
|
|
56
|
+
const schematic = await client.workspaces.schematic.create(ws.key, {
|
|
57
|
+
name: "Schematic",
|
|
58
58
|
data: { one: 1 },
|
|
59
59
|
});
|
|
60
|
-
await client.workspaces.
|
|
61
|
-
const res = await client.workspaces.
|
|
60
|
+
await client.workspaces.schematic.setData(schematic.key, { two: 2 });
|
|
61
|
+
const res = await client.workspaces.schematic.retrieve(schematic.key);
|
|
62
62
|
expect(res.data.two).toEqual(2);
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
describe("delete", () => {
|
|
66
66
|
test("delete one", async () => {
|
|
67
67
|
const ws = await client.workspaces.create({
|
|
68
|
-
name: "
|
|
68
|
+
name: "Schematic",
|
|
69
69
|
layout: { one: 1 },
|
|
70
70
|
});
|
|
71
|
-
const
|
|
72
|
-
name: "
|
|
71
|
+
const schematic = await client.workspaces.schematic.create(ws.key, {
|
|
72
|
+
name: "Schematic",
|
|
73
73
|
data: { one: 1 },
|
|
74
74
|
});
|
|
75
|
-
await client.workspaces.
|
|
76
|
-
await expect(client.workspaces.
|
|
75
|
+
await client.workspaces.schematic.delete(schematic.key);
|
|
76
|
+
await expect(client.workspaces.schematic.retrieve(schematic.key)).rejects.toThrow();
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
describe("copy", () => {
|
|
80
80
|
test("copy one", async () => {
|
|
81
81
|
const ws = await client.workspaces.create({
|
|
82
|
-
name: "
|
|
82
|
+
name: "Schematic",
|
|
83
83
|
layout: { one: 1 },
|
|
84
84
|
});
|
|
85
|
-
const
|
|
86
|
-
name: "
|
|
85
|
+
const schematic = await client.workspaces.schematic.create(ws.key, {
|
|
86
|
+
name: "Schematic",
|
|
87
87
|
data: { one: 1 },
|
|
88
88
|
});
|
|
89
|
-
const
|
|
90
|
-
expect(
|
|
91
|
-
expect(
|
|
92
|
-
expect(
|
|
89
|
+
const schematic2 = await client.workspaces.schematic.copy(schematic.key, "Schematic2", false);
|
|
90
|
+
expect(schematic2.name).toEqual("Schematic2");
|
|
91
|
+
expect(schematic2.key).not.toEqual(ZERO_UUID);
|
|
92
|
+
expect(schematic2.data.one).toEqual(1);
|
|
93
93
|
});
|
|
94
94
|
describe("snapshot", () => {
|
|
95
95
|
it("should not allow the caller to edit the snapshot", async () => {
|
|
96
96
|
const ws = await client.workspaces.create({
|
|
97
|
-
name: "
|
|
97
|
+
name: "Schematic",
|
|
98
98
|
layout: { one: 1 },
|
|
99
99
|
});
|
|
100
|
-
const
|
|
101
|
-
name: "
|
|
100
|
+
const schematic = await client.workspaces.schematic.create(ws.key, {
|
|
101
|
+
name: "Schematic",
|
|
102
102
|
data: { one: 1 },
|
|
103
103
|
});
|
|
104
|
-
const
|
|
104
|
+
const schematic2 = await client.workspaces.schematic.copy(schematic.key, "Schematic2", true);
|
|
105
105
|
await expect(
|
|
106
|
-
client.workspaces.
|
|
106
|
+
client.workspaces.schematic.setData(schematic2.key, { two: 2 }),
|
|
107
107
|
).rejects.toThrow(ValidationError);
|
|
108
108
|
});
|
|
109
109
|
});
|
|
@@ -8,33 +8,34 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
-
import {
|
|
11
|
+
import { type UnknownRecord } from "@synnaxlabs/x/record";
|
|
12
|
+
import { toArray } from "@synnaxlabs/x/toArray";
|
|
12
13
|
import { z } from "zod";
|
|
13
14
|
|
|
14
15
|
import { keyZ as workspaceKeyZ } from "@/workspace/payload";
|
|
15
16
|
import {
|
|
16
|
-
|
|
17
|
-
type
|
|
17
|
+
schematicZ,
|
|
18
|
+
type Schematic,
|
|
18
19
|
type Params,
|
|
19
20
|
keyZ,
|
|
20
21
|
type Key,
|
|
21
|
-
|
|
22
|
-
} from "@/workspace/
|
|
22
|
+
schematicRemoteZ,
|
|
23
|
+
} from "@/workspace/schematic/payload";
|
|
23
24
|
|
|
24
|
-
export const
|
|
25
|
+
export const newSchematicZ = schematicZ.partial({ key: true, snapshot: true }).transform((p) => ({
|
|
25
26
|
...p,
|
|
26
27
|
data: JSON.stringify(p.data),
|
|
27
28
|
}));
|
|
28
29
|
|
|
29
|
-
export type
|
|
30
|
+
export type NewSchematic = z.input<typeof newSchematicZ>;
|
|
30
31
|
|
|
31
32
|
const createReqZ = z.object({
|
|
32
33
|
workspace: workspaceKeyZ,
|
|
33
|
-
|
|
34
|
+
schematics: newSchematicZ.array(),
|
|
34
35
|
});
|
|
35
36
|
|
|
36
37
|
const createResZ = z.object({
|
|
37
|
-
|
|
38
|
+
schematics: schematicRemoteZ.array(),
|
|
38
39
|
});
|
|
39
40
|
|
|
40
41
|
const deleteReqZ = z.object({
|
|
@@ -64,14 +65,14 @@ const copyReqZ = z.object({
|
|
|
64
65
|
});
|
|
65
66
|
|
|
66
67
|
const copyResZ = z.object({
|
|
67
|
-
|
|
68
|
+
schematic: schematicRemoteZ,
|
|
68
69
|
});
|
|
69
70
|
|
|
70
|
-
const CREATE_ENDPOINT = "/workspace/
|
|
71
|
-
const DELETE_ENDPOINT = "/workspace/
|
|
72
|
-
const RENAME_ENDPOINT = "/workspace/
|
|
73
|
-
const SET_DATA_ENDPOINT = "/workspace/
|
|
74
|
-
const COPY_ENDPOINT = "/workspace/
|
|
71
|
+
const CREATE_ENDPOINT = "/workspace/schematic/create";
|
|
72
|
+
const DELETE_ENDPOINT = "/workspace/schematic/delete";
|
|
73
|
+
const RENAME_ENDPOINT = "/workspace/schematic/rename";
|
|
74
|
+
const SET_DATA_ENDPOINT = "/workspace/schematic/set-data";
|
|
75
|
+
const COPY_ENDPOINT = "/workspace/schematic/copy";
|
|
75
76
|
|
|
76
77
|
export class Writer {
|
|
77
78
|
private readonly client: UnaryClient;
|
|
@@ -80,20 +81,20 @@ export class Writer {
|
|
|
80
81
|
this.client = client;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
async create(workspace: string,
|
|
84
|
-
const
|
|
84
|
+
async create(workspace: string, schematic: NewSchematic): Promise<Schematic> {
|
|
85
|
+
const schematic_ = { ...schematic, data: JSON.stringify(schematic.data) };
|
|
85
86
|
const res = await sendRequired<typeof createReqZ, typeof createResZ>(
|
|
86
87
|
this.client,
|
|
87
88
|
CREATE_ENDPOINT,
|
|
88
|
-
{ workspace,
|
|
89
|
+
{ workspace, schematics: [schematic_] },
|
|
89
90
|
createReqZ,
|
|
90
91
|
createResZ,
|
|
91
92
|
);
|
|
92
93
|
|
|
93
|
-
return res.
|
|
94
|
+
return res.schematics[0];
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
async copy(key: Key, name: string, snapshot: boolean): Promise<
|
|
97
|
+
async copy(key: Key, name: string, snapshot: boolean): Promise<Schematic> {
|
|
97
98
|
const res = await sendRequired<typeof copyReqZ, typeof copyResZ>(
|
|
98
99
|
this.client,
|
|
99
100
|
COPY_ENDPOINT,
|
|
@@ -101,7 +102,7 @@ export class Writer {
|
|
|
101
102
|
copyReqZ,
|
|
102
103
|
copyResZ,
|
|
103
104
|
);
|
|
104
|
-
return res.
|
|
105
|
+
return res.schematic;
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
async delete(params: Params): Promise<void> {
|
|
@@ -115,21 +116,21 @@ export class Writer {
|
|
|
115
116
|
);
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
async rename(
|
|
119
|
+
async rename(schematic: Key, name: string): Promise<void> {
|
|
119
120
|
await sendRequired<typeof renameReqZ, typeof renameResZ>(
|
|
120
121
|
this.client,
|
|
121
122
|
RENAME_ENDPOINT,
|
|
122
|
-
{ key:
|
|
123
|
+
{ key: schematic, name },
|
|
123
124
|
renameReqZ,
|
|
124
125
|
renameResZ,
|
|
125
126
|
);
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
async setData(
|
|
129
|
+
async setData(schematic: Key, data: UnknownRecord): Promise<void> {
|
|
129
130
|
await sendRequired<typeof setDataReqZ, typeof setDataResZ>(
|
|
130
131
|
this.client,
|
|
131
132
|
SET_DATA_ENDPOINT,
|
|
132
|
-
{ key:
|
|
133
|
+
{ key: schematic, data: JSON.stringify(data) },
|
|
133
134
|
setDataReqZ,
|
|
134
135
|
renameResZ,
|
|
135
136
|
);
|
|
@@ -19,10 +19,10 @@ describe("Workspace", () => {
|
|
|
19
19
|
describe("create", () => {
|
|
20
20
|
test("create one", async () => {
|
|
21
21
|
const ws = await client.workspaces.create({
|
|
22
|
-
name: "
|
|
22
|
+
name: "Schematic",
|
|
23
23
|
layout: { one: 1 },
|
|
24
24
|
});
|
|
25
|
-
expect(ws.name).toEqual("
|
|
25
|
+
expect(ws.name).toEqual("Schematic");
|
|
26
26
|
expect(ws.key).not.toEqual(ZERO_UUID);
|
|
27
27
|
expect(ws.layout.one).toEqual(1);
|
|
28
28
|
});
|
|
@@ -30,18 +30,18 @@ describe("Workspace", () => {
|
|
|
30
30
|
describe("rename", () => {
|
|
31
31
|
test("rename one", async () => {
|
|
32
32
|
const ws = await client.workspaces.create({
|
|
33
|
-
name: "
|
|
33
|
+
name: "Schematic",
|
|
34
34
|
layout: { one: 1 },
|
|
35
35
|
});
|
|
36
|
-
await client.workspaces.rename(ws.key, "
|
|
36
|
+
await client.workspaces.rename(ws.key, "Schematic2");
|
|
37
37
|
const res = await client.workspaces.retrieve(ws.key);
|
|
38
|
-
expect(res.name).toEqual("
|
|
38
|
+
expect(res.name).toEqual("Schematic2");
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
41
|
describe("setLayout", () => {
|
|
42
42
|
test("set layout", async () => {
|
|
43
43
|
const ws = await client.workspaces.create({
|
|
44
|
-
name: "
|
|
44
|
+
name: "Schematic",
|
|
45
45
|
layout: { one: 1 },
|
|
46
46
|
});
|
|
47
47
|
await client.workspaces.setLayout(ws.key, { two: 2 });
|
|
@@ -52,7 +52,7 @@ describe("Workspace", () => {
|
|
|
52
52
|
describe("delete", () => {
|
|
53
53
|
test("delete one", async () => {
|
|
54
54
|
const ws = await client.workspaces.create({
|
|
55
|
-
name: "
|
|
55
|
+
name: "Schematic",
|
|
56
56
|
layout: { one: 1 },
|
|
57
57
|
});
|
|
58
58
|
await client.workspaces.delete(ws.key);
|
package/src/workspace/writer.ts
CHANGED
|
@@ -8,10 +8,16 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
-
import {
|
|
11
|
+
import { type UnknownRecord } from "@synnaxlabs/x/record";
|
|
12
|
+
import { toArray } from "@synnaxlabs/x/toArray";
|
|
12
13
|
import { z } from "zod";
|
|
13
14
|
|
|
14
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
type Workspace,
|
|
17
|
+
workspaceZ,
|
|
18
|
+
keyZ,
|
|
19
|
+
workspaceRemoteZ,
|
|
20
|
+
} from "@/workspace/payload";
|
|
15
21
|
|
|
16
22
|
const newWorkspaceZ = workspaceZ.partial({ key: true }).transform((w) => ({
|
|
17
23
|
...w,
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const deviceKeyZ: z.ZodString;
|
|
3
|
-
export declare const deviceZ: z.ZodObject<{
|
|
4
|
-
key: z.ZodString;
|
|
5
|
-
rack: z.ZodNumber;
|
|
6
|
-
name: z.ZodString;
|
|
7
|
-
make: z.ZodString;
|
|
8
|
-
model: z.ZodString;
|
|
9
|
-
location: z.ZodString;
|
|
10
|
-
properties: z.ZodString;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
name: string;
|
|
13
|
-
key: string;
|
|
14
|
-
rack: number;
|
|
15
|
-
make: string;
|
|
16
|
-
model: string;
|
|
17
|
-
location: string;
|
|
18
|
-
properties: string;
|
|
19
|
-
}, {
|
|
20
|
-
name: string;
|
|
21
|
-
key: string;
|
|
22
|
-
rack: number;
|
|
23
|
-
make: string;
|
|
24
|
-
model: string;
|
|
25
|
-
location: string;
|
|
26
|
-
properties: string;
|
|
27
|
-
}>;
|
|
28
|
-
export type Device = z.infer<typeof deviceZ>;
|
|
29
|
-
export type DeviceKey = z.infer<typeof deviceKeyZ>;
|
|
30
|
-
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/hardware/device/payload.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU,aAAa,CAAC;AAErC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;EAQlB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAC7C,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
-
import { type Device } from './payload';
|
|
3
|
-
export declare class Retriever {
|
|
4
|
-
private readonly client;
|
|
5
|
-
constructor(client: UnaryClient);
|
|
6
|
-
search(term: string): Promise<Device[]>;
|
|
7
|
-
page(offset: number, limit: number): Promise<Device[]>;
|
|
8
|
-
retrieve(keys: string[]): Promise<Device[]>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=retriever.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retriever.d.ts","sourceRoot":"","sources":["../../../src/hardware/device/retriever.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,uBAAuB,CAAC;AAGvE,OAAO,EAAE,KAAK,MAAM,EAAuB,MAAM,2BAA2B,CAAC;AAgB7E,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAQvC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAStD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAOlD"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
-
import { type Device } from './payload';
|
|
3
|
-
export declare class Writer {
|
|
4
|
-
private readonly client;
|
|
5
|
-
constructor(client: UnaryClient);
|
|
6
|
-
create(devices: Device[]): Promise<Device[]>;
|
|
7
|
-
delete(keys: string[]): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../../src/hardware/device/writer.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,uBAAuB,CAAC;AAGvE,OAAO,EAAE,KAAK,MAAM,EAAuB,MAAM,2BAA2B,CAAC;AAmB7E,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAW5C,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAS5C"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const rackKeyZ: z.ZodNumber;
|
|
3
|
-
export type RackKey = z.infer<typeof rackKeyZ>;
|
|
4
|
-
export declare const rackZ: z.ZodObject<{
|
|
5
|
-
key: z.ZodNumber;
|
|
6
|
-
name: z.ZodString;
|
|
7
|
-
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
name: string;
|
|
9
|
-
key: number;
|
|
10
|
-
}, {
|
|
11
|
-
name: string;
|
|
12
|
-
key: number;
|
|
13
|
-
}>;
|
|
14
|
-
export type RackPayload = z.infer<typeof rackZ>;
|
|
15
|
-
export declare const newRackZ: z.ZodObject<{
|
|
16
|
-
name: z.ZodString;
|
|
17
|
-
key: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
name: string;
|
|
20
|
-
key?: number | undefined;
|
|
21
|
-
}, {
|
|
22
|
-
name: string;
|
|
23
|
-
key?: number | undefined;
|
|
24
|
-
}>;
|
|
25
|
-
export type NewRack = z.input<typeof newRackZ>;
|
|
26
|
-
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/hardware/rack/payload.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,QAAQ,aAAa,CAAC;AAEnC,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE/C,eAAO,MAAM,KAAK;;;;;;;;;EAGhB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAEhD,eAAO,MAAM,QAAQ;;;;;;;;;EAA+B,CAAC;AAErD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
-
import { type RackPayload } from './payload';
|
|
3
|
-
export declare class Retriever {
|
|
4
|
-
private readonly client;
|
|
5
|
-
constructor(client: UnaryClient);
|
|
6
|
-
page(offset: number, limit: number): Promise<RackPayload[]>;
|
|
7
|
-
search(term: string): Promise<RackPayload[]>;
|
|
8
|
-
retrieve(keys: number[]): Promise<RackPayload[]>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=retriever.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retriever.d.ts","sourceRoot":"","sources":["../../../src/hardware/rack/retriever.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,uBAAuB,CAAC;AAGvE,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAgB5E,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAW3D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAW5C,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAUvD"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NewRack, RackPayload } from './payload';
|
|
2
|
-
import { UnaryClient } from "@synnaxlabs/freighter";
|
|
3
|
-
export declare class Writer {
|
|
4
|
-
private readonly client;
|
|
5
|
-
constructor(client: UnaryClient);
|
|
6
|
-
create(racks: NewRack[]): Promise<RackPayload[]>;
|
|
7
|
-
delete(keys: number[]): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../../src/hardware/rack/writer.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,WAAW,EAA6B,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAgB,MAAM,uBAAuB,CAAC;AAmBlE,qBAAa,MAAM;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAWhD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAU9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/hardware/task/external.ts"],"names":[],"mappings":"AASA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { type UnknownRecord } from "@synnaxlabs/x";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
export declare const taskKeyZ: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodBigInt, string, bigint>, z.ZodEffects<z.ZodNumber, string, number>]>;
|
|
4
|
-
export type TaskKey = z.infer<typeof taskKeyZ>;
|
|
5
|
-
export declare const taskZ: z.ZodObject<{
|
|
6
|
-
key: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodBigInt, string, bigint>, z.ZodEffects<z.ZodNumber, string, number>]>;
|
|
7
|
-
name: z.ZodString;
|
|
8
|
-
type: z.ZodString;
|
|
9
|
-
config: z.ZodType<UnknownRecord, z.ZodTypeDef, UnknownRecord>;
|
|
10
|
-
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
name: string;
|
|
12
|
-
key: string;
|
|
13
|
-
type: string;
|
|
14
|
-
config: UnknownRecord;
|
|
15
|
-
}, {
|
|
16
|
-
name: string;
|
|
17
|
-
key: string | number | bigint;
|
|
18
|
-
type: string;
|
|
19
|
-
config: UnknownRecord;
|
|
20
|
-
}>;
|
|
21
|
-
export declare const newTaskZ: z.ZodObject<{
|
|
22
|
-
name: z.ZodString;
|
|
23
|
-
type: z.ZodString;
|
|
24
|
-
key: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodBigInt, string, bigint>, z.ZodEffects<z.ZodNumber, string, number>]>, string, string | number | bigint>>;
|
|
25
|
-
config: z.ZodEffects<z.ZodUnknown, string, unknown>;
|
|
26
|
-
}, "strip", z.ZodTypeAny, {
|
|
27
|
-
name: string;
|
|
28
|
-
type: string;
|
|
29
|
-
config: string;
|
|
30
|
-
key?: string | undefined;
|
|
31
|
-
}, {
|
|
32
|
-
name: string;
|
|
33
|
-
type: string;
|
|
34
|
-
key?: string | number | bigint | undefined;
|
|
35
|
-
config?: unknown;
|
|
36
|
-
}>;
|
|
37
|
-
export type NewTask = z.input<typeof newTaskZ>;
|
|
38
|
-
export type Task<T extends string = string, C extends UnknownRecord = UnknownRecord> = Omit<z.infer<typeof taskZ>, "config" | "type"> & {
|
|
39
|
-
type: T;
|
|
40
|
-
config: C;
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/hardware/task/payload.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,QAAQ,iHAInB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE/C,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;EAOhB,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;EAGnB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE/C,MAAM,MAAM,IAAI,CACd,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,CAAC,SAAS,aAAa,GAAG,aAAa,IACrC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { type Task } from './payload';
|
|
4
|
-
declare const retrieveReqZ: z.ZodObject<{
|
|
5
|
-
rack: z.ZodOptional<z.ZodNumber>;
|
|
6
|
-
keys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
|
-
offset: z.ZodOptional<z.ZodNumber>;
|
|
8
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
rack?: number | undefined;
|
|
11
|
-
keys?: string[] | undefined;
|
|
12
|
-
offset?: number | undefined;
|
|
13
|
-
limit?: number | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
rack?: number | undefined;
|
|
16
|
-
keys?: string[] | undefined;
|
|
17
|
-
offset?: number | undefined;
|
|
18
|
-
limit?: number | undefined;
|
|
19
|
-
}>;
|
|
20
|
-
export type RetrieveRequest = z.infer<typeof retrieveReqZ>;
|
|
21
|
-
export declare class Retriever {
|
|
22
|
-
private readonly client;
|
|
23
|
-
constructor(client: UnaryClient);
|
|
24
|
-
retrieve(params: RetrieveRequest): Promise<Task[]>;
|
|
25
|
-
search(term: string): Promise<Task[]>;
|
|
26
|
-
page(offset: number, limit: number): Promise<Task[]>;
|
|
27
|
-
}
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=retriever.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retriever.d.ts","sourceRoot":"","sources":["../../../src/hardware/task/retriever.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,IAAI,EAAS,MAAM,yBAAyB,CAAC;AAE3D,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;EAKhB,CAAC;AAMH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAI3D,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAWlD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAWrC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;CAU3D"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
-
import { type NewTask, type Task } from './payload';
|
|
3
|
-
export declare class Writer {
|
|
4
|
-
private readonly client;
|
|
5
|
-
constructor(client: UnaryClient);
|
|
6
|
-
create(tasks: NewTask[]): Promise<Task[]>;
|
|
7
|
-
delete(keys: bigint[]): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../../src/hardware/task/writer.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,uBAAuB,CAAC;AAGvE,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,IAAI,EAIV,MAAM,yBAAyB,CAAC;AAmBjC,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAWzC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAS5C"}
|