@synnaxlabs/client 0.24.0 → 0.26.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 +9 -10
- package/dist/access/access.spec.d.ts +2 -0
- package/dist/access/access.spec.d.ts.map +1 -0
- package/dist/access/client.d.ts +13 -0
- package/dist/access/client.d.ts.map +1 -0
- package/dist/access/external.d.ts +3 -0
- package/dist/access/external.d.ts.map +1 -0
- package/dist/access/index.d.ts +2 -0
- package/dist/access/index.d.ts.map +1 -0
- package/dist/access/payload.d.ts +105 -0
- package/dist/access/payload.d.ts.map +1 -0
- package/dist/auth/auth.d.ts +2 -2
- package/dist/auth/auth.d.ts.map +1 -1
- package/dist/channel/client.d.ts +8 -8
- package/dist/channel/creator.d.ts +1 -1
- package/dist/channel/payload.d.ts +18 -15
- package/dist/channel/payload.d.ts.map +1 -1
- package/dist/channel/retriever.d.ts +11 -11
- package/dist/channel/retriever.d.ts.map +1 -1
- package/dist/channel/writer.d.ts +3 -3
- package/dist/client.cjs +22 -22
- package/dist/client.d.ts +15 -11
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3124 -3776
- package/dist/connection/checker.d.ts +2 -2
- package/dist/control/client.d.ts +1 -1
- package/dist/control/state.d.ts +6 -6
- package/dist/control/state.d.ts.map +1 -1
- package/dist/errors.d.ts +12 -12
- package/dist/errors.d.ts.map +1 -1
- package/dist/framer/adapter.d.ts +3 -3
- package/dist/framer/client.d.ts +7 -7
- package/dist/framer/client.d.ts.map +1 -1
- package/dist/framer/deleter.d.ts +3 -3
- package/dist/framer/deleter.d.ts.map +1 -1
- package/dist/framer/frame.d.ts +2 -2
- package/dist/framer/iterator.d.ts +4 -4
- package/dist/framer/streamProxy.d.ts +1 -1
- package/dist/framer/streamer.d.ts +5 -5
- package/dist/framer/writer.d.ts +6 -6
- package/dist/hardware/client.d.ts +2 -2
- package/dist/hardware/device/client.d.ts +6 -71
- package/dist/hardware/device/client.d.ts.map +1 -1
- package/dist/hardware/device/external.d.ts +1 -0
- 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/device/payload.d.ts +73 -0
- package/dist/hardware/device/payload.d.ts.map +1 -0
- package/dist/hardware/rack/client.d.ts +6 -29
- package/dist/hardware/rack/client.d.ts.map +1 -1
- package/dist/hardware/rack/external.d.ts +1 -0
- package/dist/hardware/rack/external.d.ts.map +1 -1
- package/dist/hardware/rack/payload.d.ts +30 -0
- package/dist/hardware/rack/payload.d.ts.map +1 -0
- package/dist/hardware/task/client.d.ts +7 -151
- package/dist/hardware/task/client.d.ts.map +1 -1
- package/dist/hardware/task/external.d.ts +3 -0
- package/dist/hardware/task/external.d.ts.map +1 -0
- package/dist/hardware/task/index.d.ts +1 -1
- package/dist/hardware/task/index.d.ts.map +1 -1
- package/dist/hardware/task/payload.d.ts +151 -0
- package/dist/hardware/task/payload.d.ts.map +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/label/client.d.ts +6 -6
- package/dist/label/payload.d.ts +2 -1
- package/dist/label/payload.d.ts.map +1 -1
- package/dist/label/retriever.d.ts +2 -2
- package/dist/label/writer.d.ts +3 -3
- package/dist/ontology/client.d.ts +11 -11
- package/dist/ontology/group/client.d.ts +2 -2
- package/dist/ontology/group/writer.d.ts +2 -2
- package/dist/ontology/group/writer.d.ts.map +1 -1
- package/dist/ontology/payload.d.ts +47 -44
- package/dist/ontology/payload.d.ts.map +1 -1
- package/dist/ontology/writer.d.ts +1 -1
- package/dist/ranger/active.d.ts +1 -1
- package/dist/ranger/alias.d.ts +6 -6
- package/dist/ranger/client.d.ts +10 -10
- package/dist/ranger/kv.d.ts +2 -2
- package/dist/ranger/payload.d.ts +6 -1
- package/dist/ranger/payload.d.ts.map +1 -1
- package/dist/ranger/range.d.ts +8 -8
- package/dist/ranger/range.d.ts.map +1 -1
- package/dist/ranger/writer.d.ts +1 -1
- package/dist/setupspecs.d.ts.map +1 -1
- package/dist/signals/observable.d.ts +5 -5
- package/dist/signals/observable.d.ts.map +1 -1
- package/dist/transport.d.ts +1 -1
- package/dist/user/client.d.ts +9 -0
- package/dist/user/client.d.ts.map +1 -0
- package/dist/user/external.d.ts +3 -0
- package/dist/user/external.d.ts.map +1 -0
- package/dist/user/index.d.ts +1 -1
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user/payload.d.ts +5 -0
- package/dist/user/payload.d.ts.map +1 -1
- package/dist/util/retrieve.d.ts +1 -1
- package/dist/util/retrieve.d.ts.map +1 -1
- package/dist/util/zod.d.ts.map +1 -1
- package/dist/workspace/client.d.ts +6 -6
- package/dist/workspace/lineplot/client.d.ts +3 -3
- package/dist/workspace/lineplot/payload.d.ts +4 -1
- package/dist/workspace/lineplot/payload.d.ts.map +1 -1
- package/dist/workspace/lineplot/retriever.d.ts +1 -1
- package/dist/workspace/lineplot/writer.d.ts +3 -3
- package/dist/workspace/payload.d.ts +4 -1
- package/dist/workspace/payload.d.ts.map +1 -1
- package/dist/workspace/retriever.d.ts +1 -1
- package/dist/workspace/schematic/client.d.ts +3 -3
- package/dist/workspace/schematic/payload.d.ts +4 -1
- package/dist/workspace/schematic/payload.d.ts.map +1 -1
- package/dist/workspace/schematic/retriever.d.ts +1 -1
- package/dist/workspace/schematic/writer.d.ts +3 -3
- package/dist/workspace/writer.d.ts +3 -3
- package/examples/node/package.json +1 -1
- package/package.json +11 -12
- package/src/access/access.spec.ts +276 -0
- package/src/access/client.ts +86 -0
- package/src/access/external.ts +11 -0
- package/src/access/index.ts +10 -0
- package/src/access/payload.ts +35 -0
- package/src/auth/auth.ts +1 -1
- package/src/channel/payload.ts +7 -0
- package/src/client.ts +7 -1
- package/src/control/state.ts +3 -3
- package/src/errors.spec.ts +0 -1
- package/src/framer/client.ts +1 -0
- package/src/framer/deleter.ts +2 -4
- package/src/framer/writer.spec.ts +29 -1
- package/src/hardware/device/client.ts +8 -36
- package/src/hardware/device/external.ts +1 -0
- package/src/hardware/device/index.ts +1 -1
- package/src/hardware/device/payload.ts +44 -0
- package/src/hardware/rack/client.ts +10 -15
- package/src/hardware/rack/external.ts +1 -0
- package/src/hardware/rack/payload.ts +23 -0
- package/src/hardware/task/client.ts +3 -86
- package/src/hardware/task/external.ts +11 -0
- package/src/hardware/task/index.ts +1 -1
- package/src/hardware/task/payload.ts +92 -0
- package/src/hardware/task/task.spec.ts +2 -2
- package/src/index.ts +1 -2
- package/src/label/payload.ts +3 -1
- package/src/ontology/group/writer.ts +1 -1
- package/src/ontology/ontology.spec.ts +1 -1
- package/src/ontology/payload.ts +6 -1
- package/src/ranger/payload.ts +11 -0
- package/src/setupspecs.ts +4 -2
- package/src/signals/observable.ts +5 -3
- package/src/transport.ts +3 -3
- package/src/user/client.ts +37 -0
- package/src/user/external.ts +11 -0
- package/src/user/index.ts +1 -1
- package/src/user/payload.ts +11 -0
- package/src/workspace/lineplot/payload.ts +7 -0
- package/src/workspace/payload.ts +7 -0
- package/src/workspace/schematic/payload.ts +7 -0
- package/tsconfig.json +4 -2
package/src/setupspecs.ts
CHANGED
|
@@ -11,6 +11,8 @@ import Synnax, { type SynnaxProps } from "@/client";
|
|
|
11
11
|
|
|
12
12
|
export const HOST = "localhost";
|
|
13
13
|
export const PORT = 9090;
|
|
14
|
+
const USERNAME = "synnax"
|
|
15
|
+
const PASSWORD = "seldon"
|
|
14
16
|
|
|
15
17
|
export const newClient = (...props: SynnaxProps[]): Synnax => {
|
|
16
18
|
let _props = {};
|
|
@@ -18,8 +20,8 @@ export const newClient = (...props: SynnaxProps[]): Synnax => {
|
|
|
18
20
|
return new Synnax({
|
|
19
21
|
host: HOST,
|
|
20
22
|
port: PORT,
|
|
21
|
-
username:
|
|
22
|
-
password:
|
|
23
|
+
username: USERNAME,
|
|
24
|
+
password: PASSWORD,
|
|
23
25
|
..._props,
|
|
24
26
|
});
|
|
25
27
|
};
|
|
@@ -26,15 +26,17 @@ export const openObservable = async <K, V>(
|
|
|
26
26
|
client: framer.Client,
|
|
27
27
|
setChannel: channel.Key | channel.Name,
|
|
28
28
|
deleteChannel: channel.Key | channel.Name,
|
|
29
|
-
|
|
29
|
+
codec: Decoder<K, V>,
|
|
30
30
|
): Promise<Observable<K, V>> => {
|
|
31
31
|
const stream = await client.openStreamer([setChannel, deleteChannel] as channel.Keys);
|
|
32
32
|
const transform = (frame: framer.Frame): [Array<change.Change<K, V>>, boolean] => {
|
|
33
33
|
const changes: Array<change.Change<K, V>> = [];
|
|
34
34
|
if (deleteChannel != null)
|
|
35
|
-
changes.push(
|
|
35
|
+
changes.push(
|
|
36
|
+
...frame.get(deleteChannel).series.flatMap((s) => codec("delete", s)),
|
|
37
|
+
);
|
|
36
38
|
if (setChannel != null)
|
|
37
|
-
changes.push(...frame.get(setChannel).series.flatMap((s) =>
|
|
39
|
+
changes.push(...frame.get(setChannel).series.flatMap((s) => codec("set", s)));
|
|
38
40
|
return [changes, changes.length > 0];
|
|
39
41
|
};
|
|
40
42
|
return new framer.ObservableStreamer<Array<change.Change<K, V>>>(stream, transform);
|
package/src/transport.ts
CHANGED
|
@@ -28,9 +28,9 @@ export class Transport {
|
|
|
28
28
|
constructor(url: URL, secure: boolean = false) {
|
|
29
29
|
this.secure = secure;
|
|
30
30
|
this.url = url.child(baseAPIEndpoint);
|
|
31
|
-
const
|
|
32
|
-
this.unary = new HTTPClient(this.url,
|
|
33
|
-
this.stream = new WebSocketClient(this.url,
|
|
31
|
+
const codec = new binary.JSONCodec();
|
|
32
|
+
this.unary = new HTTPClient(this.url, codec, this.secure);
|
|
33
|
+
this.stream = new WebSocketClient(this.url, codec, this.secure);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
use(...middleware: Middleware[]): void {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
10
|
+
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
+
|
|
12
|
+
import { insecureCredentialsZ, tokenResponseZ } from "@/auth/auth";
|
|
13
|
+
import { Payload } from "@/user/payload";
|
|
14
|
+
|
|
15
|
+
const REGISTER_ENDPOINT = "/user/register";
|
|
16
|
+
|
|
17
|
+
export class Client {
|
|
18
|
+
private readonly client: UnaryClient;
|
|
19
|
+
|
|
20
|
+
constructor(client: UnaryClient) {
|
|
21
|
+
this.client = client;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async register(username: string, password: string): Promise<Payload> {
|
|
25
|
+
const { user } = await sendRequired<
|
|
26
|
+
typeof insecureCredentialsZ,
|
|
27
|
+
typeof tokenResponseZ
|
|
28
|
+
>(
|
|
29
|
+
this.client,
|
|
30
|
+
REGISTER_ENDPOINT,
|
|
31
|
+
{ username: username, password: password },
|
|
32
|
+
insecureCredentialsZ,
|
|
33
|
+
tokenResponseZ,
|
|
34
|
+
);
|
|
35
|
+
return user;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
10
|
+
export * from "@/user/client";
|
|
11
|
+
export * from "@/user/payload";
|
package/src/user/index.ts
CHANGED
package/src/user/payload.ts
CHANGED
|
@@ -9,9 +9,20 @@
|
|
|
9
9
|
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
|
|
12
|
+
import { ontology } from "@/ontology";
|
|
13
|
+
|
|
14
|
+
export const keyZ = z.string().uuid();
|
|
15
|
+
|
|
16
|
+
export type Key = z.infer<typeof keyZ>;
|
|
17
|
+
|
|
12
18
|
export const payloadZ = z.object({
|
|
13
19
|
key: z.string(),
|
|
14
20
|
username: z.string(),
|
|
15
21
|
});
|
|
16
22
|
|
|
17
23
|
export type Payload = z.infer<typeof payloadZ>;
|
|
24
|
+
|
|
25
|
+
export const UserOntologyType = "user" as ontology.ResourceType;
|
|
26
|
+
|
|
27
|
+
export const ontologyID = (key: Key): ontology.ID =>
|
|
28
|
+
new ontology.ID({ type: UserOntologyType, key });
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
import { type UnknownRecord, unknownRecordZ } from "@synnaxlabs/x/record";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
|
|
13
|
+
import { ontology } from "@/ontology";
|
|
14
|
+
|
|
13
15
|
export const keyZ = z.string().uuid();
|
|
14
16
|
export type Key = z.infer<typeof keyZ>;
|
|
15
17
|
export type Params = Key | Key[];
|
|
@@ -21,3 +23,8 @@ export const linePlotZ = z.object({
|
|
|
21
23
|
});
|
|
22
24
|
|
|
23
25
|
export type LinePlot = z.infer<typeof linePlotZ>;
|
|
26
|
+
|
|
27
|
+
export const LineplotOntologyType = "lineplot" as ontology.ResourceType;
|
|
28
|
+
|
|
29
|
+
export const ontologyID = (key: Key): ontology.ID =>
|
|
30
|
+
new ontology.ID({ type: LineplotOntologyType, key: key });
|
package/src/workspace/payload.ts
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
import { type UnknownRecord, unknownRecordZ } from "@synnaxlabs/x/record";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
|
|
13
|
+
import { ontology } from "@/ontology";
|
|
14
|
+
|
|
13
15
|
export const keyZ = z.string().uuid();
|
|
14
16
|
|
|
15
17
|
export type Key = z.infer<typeof keyZ>;
|
|
@@ -35,3 +37,8 @@ export const workspaceRemoteZ = workspaceZ.omit({ layout: true }).extend({
|
|
|
35
37
|
});
|
|
36
38
|
|
|
37
39
|
export type Workspace = z.infer<typeof workspaceZ>;
|
|
40
|
+
|
|
41
|
+
export const WorkspaceOntologyType = "workspace" as ontology.ResourceType;
|
|
42
|
+
|
|
43
|
+
export const ontologyID = (key: Key): ontology.ID =>
|
|
44
|
+
new ontology.ID({ type: WorkspaceOntologyType, key: key });
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
import { type UnknownRecord, unknownRecordZ } from "@synnaxlabs/x/record";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
|
|
13
|
+
import { ontology } from "@/ontology";
|
|
14
|
+
|
|
13
15
|
export const keyZ = z.string().uuid();
|
|
14
16
|
export type Key = z.infer<typeof keyZ>;
|
|
15
17
|
export type Params = Key | Key[];
|
|
@@ -29,3 +31,8 @@ export const schematicRemoteZ = z.object({
|
|
|
29
31
|
});
|
|
30
32
|
|
|
31
33
|
export type Schematic = z.infer<typeof schematicZ>;
|
|
34
|
+
|
|
35
|
+
export const SchematicOntologyType = "schematic" as ontology.ResourceType;
|
|
36
|
+
|
|
37
|
+
export const ontologyID = (key: Key): ontology.ID =>
|
|
38
|
+
new ontology.ID({ type: SchematicOntologyType, key: key });
|