@synnaxlabs/client 0.16.3 → 0.17.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 +10 -10
- package/dist/auth/auth.d.ts +2 -2
- package/dist/client.cjs +11 -11
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +14 -4
- package/dist/client.js +5442 -5437
- package/dist/client.js.map +1 -1
- package/dist/framer/frame.d.ts +280 -24
- package/dist/framer/writer.d.ts +203 -15
- package/dist/hardware/rack/client.d.ts +1 -1
- package/dist/hardware/task/payload.d.ts +5 -5
- package/dist/ontology/retriever.d.ts +1 -1
- package/dist/ranger/active.d.ts +1 -1
- package/dist/ranger/payload.d.ts +308 -20
- package/dist/workspace/client.d.ts +2 -2
- package/dist/workspace/lineplot/client.d.ts +2 -2
- package/dist/workspace/lineplot/payload.d.ts +3 -16
- package/dist/workspace/lineplot/retriever.d.ts +0 -1
- package/dist/workspace/lineplot/writer.d.ts +9 -14
- package/dist/workspace/payload.d.ts +3 -3
- package/dist/workspace/pid/client.d.ts +2 -2
- package/dist/workspace/pid/payload.d.ts +3 -3
- package/dist/workspace/pid/retriever.d.ts +0 -1
- package/dist/workspace/pid/writer.d.ts +12 -18
- package/dist/workspace/writer.d.ts +14 -6
- package/examples/node/basicReadWriter.js +66 -0
- package/examples/node/package-lock.json +4961 -0
- package/examples/{package.json → node/package.json} +5 -5
- package/package.json +5 -5
- package/src/auth/auth.ts +5 -4
- package/src/channel/client.ts +0 -1
- package/src/channel/creator.ts +1 -0
- package/src/channel/retriever.ts +2 -2
- package/src/client.ts +2 -2
- package/src/connection/checker.ts +6 -2
- package/src/framer/client.ts +7 -3
- package/src/framer/frame.ts +4 -4
- package/src/hardware/device/retriever.ts +3 -3
- package/src/hardware/device/writer.ts +3 -1
- package/src/hardware/rack/client.ts +3 -4
- package/src/hardware/rack/retriever.ts +3 -0
- package/src/hardware/rack/writer.ts +2 -0
- package/src/hardware/task/payload.ts +5 -4
- package/src/hardware/task/retriever.ts +10 -7
- package/src/hardware/task/writer.ts +3 -1
- package/src/label/retriever.ts +1 -0
- package/src/label/writer.ts +4 -0
- package/src/ontology/group/writer.ts +18 -5
- package/src/ontology/retriever.ts +9 -9
- package/src/ontology/writer.ts +25 -11
- package/src/ranger/active.ts +26 -8
- package/src/ranger/alias.ts +9 -13
- package/src/ranger/client.ts +0 -1
- package/src/ranger/kv.ts +4 -1
- package/src/ranger/retriever.ts +1 -1
- package/src/ranger/writer.ts +3 -0
- package/src/workspace/client.ts +3 -3
- package/src/workspace/lineplot/client.ts +2 -2
- package/src/workspace/lineplot/payload.ts +1 -7
- package/src/workspace/lineplot/retriever.ts +10 -11
- package/src/workspace/lineplot/writer.ts +13 -8
- package/src/workspace/payload.ts +1 -1
- package/src/workspace/pid/client.ts +2 -2
- package/src/workspace/pid/payload.ts +1 -1
- package/src/workspace/pid/retriever.ts +8 -10
- package/src/workspace/pid/writer.ts +12 -5
- package/src/workspace/retriever.ts +2 -4
- package/src/workspace/workspace.spec.ts +4 -4
- package/src/workspace/writer.ts +12 -10
- package/.pytest_cache/README.md +0 -8
- package/examples/index.js +0 -1
|
@@ -2,43 +2,37 @@ import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
|
2
2
|
import { type UnknownRecord } from "@synnaxlabs/x";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { type PID, type Params, type Key } from './payload';
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const newPIDZ: z.ZodEffects<z.ZodObject<{
|
|
6
6
|
name: z.ZodString;
|
|
7
7
|
key: z.ZodOptional<z.ZodString>;
|
|
8
|
-
data: z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>;
|
|
9
|
-
snapshot: z.ZodBoolean
|
|
8
|
+
data: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
|
|
9
|
+
snapshot: z.ZodOptional<z.ZodBoolean>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
name: string;
|
|
12
|
-
data: Record<string | number | symbol, unknown
|
|
13
|
-
snapshot: boolean;
|
|
12
|
+
data: (UnknownRecord | Record<string | number | symbol, unknown>) & (UnknownRecord | Record<string | number | symbol, unknown> | undefined);
|
|
14
13
|
key?: string | undefined;
|
|
14
|
+
snapshot?: boolean | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
name: string;
|
|
17
|
-
data: Record<string | number | symbol, unknown
|
|
18
|
-
snapshot: boolean;
|
|
17
|
+
data: (string | Record<string | number | symbol, unknown>) & (string | Record<string | number | symbol, unknown> | undefined);
|
|
19
18
|
key?: string | undefined;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
key: z.ZodOptional<z.ZodString>;
|
|
24
|
-
data: z.ZodEffects<z.ZodString, UnknownRecord, string>;
|
|
25
|
-
snapshot: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
snapshot?: boolean | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
data: string;
|
|
27
22
|
name: string;
|
|
28
|
-
data: UnknownRecord;
|
|
29
23
|
key?: string | undefined;
|
|
30
24
|
snapshot?: boolean | undefined;
|
|
31
25
|
}, {
|
|
32
26
|
name: string;
|
|
33
|
-
data: string;
|
|
27
|
+
data: (string | Record<string | number | symbol, unknown>) & (string | Record<string | number | symbol, unknown> | undefined);
|
|
34
28
|
key?: string | undefined;
|
|
35
29
|
snapshot?: boolean | undefined;
|
|
36
30
|
}>;
|
|
37
|
-
export type
|
|
31
|
+
export type NewPID = z.input<typeof newPIDZ>;
|
|
38
32
|
export declare class Writer {
|
|
39
33
|
private readonly client;
|
|
40
34
|
constructor(client: UnaryClient);
|
|
41
|
-
create(workspace: string, pid:
|
|
35
|
+
create(workspace: string, pid: NewPID): Promise<PID>;
|
|
42
36
|
copy(key: Key, name: string, snapshot: boolean): Promise<PID>;
|
|
43
37
|
delete(params: Params): Promise<void>;
|
|
44
38
|
rename(pid: Key, name: string): Promise<void>;
|
|
@@ -2,20 +2,28 @@ import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
|
2
2
|
import { type UnknownRecord } from "@synnaxlabs/x";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { type Workspace } from "./payload";
|
|
5
|
-
declare const
|
|
5
|
+
declare const newWorkspaceZ: z.ZodEffects<z.ZodObject<{
|
|
6
6
|
name: z.ZodString;
|
|
7
7
|
key: z.ZodOptional<z.ZodString>;
|
|
8
|
-
layout: z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>;
|
|
8
|
+
layout: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
10
|
name: string;
|
|
11
|
-
layout: Record<string | number | symbol, unknown
|
|
11
|
+
layout: (UnknownRecord | Record<string | number | symbol, unknown>) & (UnknownRecord | Record<string | number | symbol, unknown> | undefined);
|
|
12
12
|
key?: string | undefined;
|
|
13
13
|
}, {
|
|
14
14
|
name: string;
|
|
15
|
-
layout: Record<string | number | symbol, unknown
|
|
15
|
+
layout: (string | Record<string | number | symbol, unknown>) & (string | Record<string | number | symbol, unknown> | undefined);
|
|
16
|
+
key?: string | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
layout: string;
|
|
19
|
+
name: string;
|
|
20
|
+
key?: string | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
name: string;
|
|
23
|
+
layout: (string | Record<string | number | symbol, unknown>) & (string | Record<string | number | symbol, unknown> | undefined);
|
|
16
24
|
key?: string | undefined;
|
|
17
25
|
}>;
|
|
18
|
-
export type
|
|
26
|
+
export type NewWorkspace = z.input<typeof newWorkspaceZ>;
|
|
19
27
|
declare const createResZ: z.ZodObject<{
|
|
20
28
|
workspaces: z.ZodArray<z.ZodObject<{
|
|
21
29
|
name: z.ZodString;
|
|
@@ -47,7 +55,7 @@ export type CreateResponse = z.infer<typeof createResZ>;
|
|
|
47
55
|
export declare class Writer {
|
|
48
56
|
private readonly client;
|
|
49
57
|
constructor(client: UnaryClient);
|
|
50
|
-
create(workspaces:
|
|
58
|
+
create(workspaces: NewWorkspace | NewWorkspace[]): Promise<Workspace[]>;
|
|
51
59
|
delete(keys: string | string[]): Promise<void>;
|
|
52
60
|
rename(key: string, name: string): Promise<void>;
|
|
53
61
|
setLayout(key: string, layout: UnknownRecord): Promise<void>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DataType, Synnax, TimeSpan, TimeStamp } from "@synnaxlabs/client";
|
|
2
|
+
|
|
3
|
+
const client = new Synnax({
|
|
4
|
+
host: "localhost",
|
|
5
|
+
port: 9090,
|
|
6
|
+
username: "synnax",
|
|
7
|
+
password: "seldon",
|
|
8
|
+
secure: false
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const time_channel = await client.channels.create({
|
|
12
|
+
name: "basic_read_write_time",
|
|
13
|
+
isIndex: true,
|
|
14
|
+
dataType: DataType.TIMESTAMP
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const data_channel = await client.channels.create({
|
|
18
|
+
name: "basic_read_write_data",
|
|
19
|
+
isIndex: false,
|
|
20
|
+
dataType: DataType.FLOAT32,
|
|
21
|
+
index: time_channel.key,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const N_SAMPLES = 500;
|
|
25
|
+
|
|
26
|
+
const start = TimeStamp.now();
|
|
27
|
+
|
|
28
|
+
console.log(BigInt(start.valueOf().toString()) - BigInt(start.bigInt.toString()))
|
|
29
|
+
|
|
30
|
+
const data = Float32Array.from({ length: N_SAMPLES }, (_, i) => Math.sin(i / 100));
|
|
31
|
+
const time = BigInt64Array.from({ length: N_SAMPLES }, (_, i) => BigInt(start.add(TimeSpan.milliseconds(i)).valueOf()));
|
|
32
|
+
console.log(time[0], start, Number(time[0]) - start.valueOf())
|
|
33
|
+
|
|
34
|
+
console.log(time_channel.key, data_channel.key)
|
|
35
|
+
|
|
36
|
+
// await client.telem.write(time_channel.key, start, time);
|
|
37
|
+
// await client.telem.write(data_channel.key, start, data);
|
|
38
|
+
|
|
39
|
+
const w1 = await client.telem.newWriter({
|
|
40
|
+
start,
|
|
41
|
+
channels: time_channel.key,
|
|
42
|
+
});
|
|
43
|
+
try {
|
|
44
|
+
await w1.write(time_channel.key, time);
|
|
45
|
+
console.log(await w1.commit());
|
|
46
|
+
} finally {
|
|
47
|
+
await w1.close();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const w = await client.telem.newWriter({
|
|
51
|
+
start,
|
|
52
|
+
channels: data_channel.key,
|
|
53
|
+
});
|
|
54
|
+
try {
|
|
55
|
+
await w.write(data_channel.key, data);
|
|
56
|
+
console.log(await w.commit());
|
|
57
|
+
} finally {
|
|
58
|
+
await w.close();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
// await client.telem.write(data_channel.key, start, data);
|
|
63
|
+
|
|
64
|
+
// console.log("HERE")
|
|
65
|
+
|
|
66
|
+
client.close();
|