@synnaxlabs/client 0.44.3 → 0.45.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 +6 -6
- package/dist/access/policy/client.d.ts +28 -22
- package/dist/access/policy/client.d.ts.map +1 -1
- package/dist/access/policy/payload.d.ts +16 -10
- package/dist/access/policy/payload.d.ts.map +1 -1
- package/dist/channel/client.d.ts +1 -0
- package/dist/channel/client.d.ts.map +1 -1
- package/dist/channel/payload.d.ts +15 -15
- package/dist/channel/payload.d.ts.map +1 -1
- package/dist/channel/retriever.d.ts +1 -1
- package/dist/channel/writer.d.ts +2 -2
- package/dist/channel/writer.d.ts.map +1 -1
- package/dist/client.cjs +22 -22
- package/dist/client.js +2928 -2539
- package/dist/control/state.d.ts +4 -4
- package/dist/framer/deleter.d.ts +1 -1
- package/dist/framer/streamer.d.ts +14 -14
- package/dist/framer/writer.d.ts +17 -17
- package/dist/label/client.d.ts +6 -3
- package/dist/label/client.d.ts.map +1 -1
- package/dist/ontology/client.d.ts +3 -1
- package/dist/ontology/client.d.ts.map +1 -1
- package/dist/ontology/group/client.d.ts +2 -0
- package/dist/ontology/group/client.d.ts.map +1 -1
- package/dist/ontology/payload.d.ts +17 -12
- package/dist/ontology/payload.d.ts.map +1 -1
- package/dist/ranger/alias.d.ts +1 -1
- package/dist/ranger/alias.d.ts.map +1 -1
- package/dist/ranger/writer.d.ts +2 -1
- package/dist/ranger/writer.d.ts.map +1 -1
- package/dist/workspace/schematic/client.d.ts +2 -0
- package/dist/workspace/schematic/client.d.ts.map +1 -1
- package/dist/workspace/schematic/external.d.ts +1 -0
- package/dist/workspace/schematic/external.d.ts.map +1 -1
- package/dist/workspace/schematic/symbol/client.d.ts +57 -0
- package/dist/workspace/schematic/symbol/client.d.ts.map +1 -0
- package/dist/workspace/schematic/symbol/client.spec.d.ts +2 -0
- package/dist/workspace/schematic/symbol/client.spec.d.ts.map +1 -0
- package/dist/workspace/schematic/symbol/external.d.ts +3 -0
- package/dist/workspace/schematic/symbol/external.d.ts.map +1 -0
- package/dist/workspace/schematic/symbol/index.d.ts +2 -0
- package/dist/workspace/schematic/symbol/index.d.ts.map +1 -0
- package/dist/workspace/schematic/symbol/payload.d.ts +169 -0
- package/dist/workspace/schematic/symbol/payload.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/channel/client.ts +5 -3
- package/src/channel/payload.ts +10 -2
- package/src/channel/writer.ts +2 -1
- package/src/ontology/group/client.ts +3 -0
- package/src/ontology/payload.ts +1 -0
- package/src/ranger/alias.ts +1 -4
- package/src/workspace/schematic/client.ts +3 -0
- package/src/workspace/schematic/external.ts +1 -0
- package/src/workspace/schematic/symbol/client.spec.ts +133 -0
- package/src/workspace/schematic/symbol/client.ts +146 -0
- package/src/workspace/schematic/symbol/external.ts +11 -0
- package/src/workspace/schematic/symbol/index.ts +10 -0
- package/src/workspace/schematic/symbol/payload.ts +70 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ontology } from '../../../ontology';
|
|
4
|
+
import { group } from '../../../ontology/group';
|
|
5
|
+
import { Key, New, Symbol } from './payload';
|
|
6
|
+
declare const retrieveRequestZ: z.ZodObject<{
|
|
7
|
+
keys: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
8
|
+
searchTerm: z.ZodOptional<z.ZodString>;
|
|
9
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
declare const singleRetrieveArgsZ: z.ZodPipe<z.ZodObject<{
|
|
13
|
+
key: z.ZodUUID;
|
|
14
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
15
|
+
keys: string[];
|
|
16
|
+
}, {
|
|
17
|
+
key: string;
|
|
18
|
+
}>>;
|
|
19
|
+
declare const retrieveArgsZ: z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
|
|
20
|
+
key: z.ZodUUID;
|
|
21
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
22
|
+
keys: string[];
|
|
23
|
+
}, {
|
|
24
|
+
key: string;
|
|
25
|
+
}>>, z.ZodObject<{
|
|
26
|
+
keys: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
27
|
+
searchTerm: z.ZodOptional<z.ZodString>;
|
|
28
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strip>]>;
|
|
31
|
+
export type RetrieveArgs = z.input<typeof retrieveArgsZ>;
|
|
32
|
+
export type SingleRetrieveArgs = z.input<typeof singleRetrieveArgsZ>;
|
|
33
|
+
export type MultiRetrieveArgs = z.input<typeof retrieveRequestZ>;
|
|
34
|
+
export declare const SET_CHANNEL_NAME = "sy_schematic_symbol_set";
|
|
35
|
+
export declare const DELETE_CHANNEL_NAME = "sy_schematic_symbol_delete";
|
|
36
|
+
export interface CreateArgs extends New {
|
|
37
|
+
parent: ontology.ID;
|
|
38
|
+
}
|
|
39
|
+
export interface CreateMultipleArgs {
|
|
40
|
+
symbols: New[];
|
|
41
|
+
parent: ontology.ID;
|
|
42
|
+
}
|
|
43
|
+
export declare class Client {
|
|
44
|
+
private readonly client;
|
|
45
|
+
constructor(client: UnaryClient);
|
|
46
|
+
create(options: CreateArgs): Promise<Symbol>;
|
|
47
|
+
create(options: CreateMultipleArgs): Promise<Symbol[]>;
|
|
48
|
+
rename(key: Key, name: string): Promise<void>;
|
|
49
|
+
retrieve(args: SingleRetrieveArgs): Promise<Symbol>;
|
|
50
|
+
retrieve(args: MultiRetrieveArgs): Promise<Symbol[]>;
|
|
51
|
+
delete(key: Key): Promise<void>;
|
|
52
|
+
delete(keys: Key[]): Promise<void>;
|
|
53
|
+
retrieveGroup(): Promise<group.Payload>;
|
|
54
|
+
}
|
|
55
|
+
export declare const ontologyID: (key: Key) => ontology.ID;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/workspace/schematic/symbol/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EACL,KAAK,GAAG,EAER,KAAK,GAAG,EAER,KAAK,MAAM,EAEZ,MAAM,sCAAsC,CAAC;AAY9C,QAAA,MAAM,gBAAgB;;;;;iBAKpB,CAAC;AAEH,QAAA,MAAM,mBAAmB;;;;;;GAEmB,CAAC;AAE7C,QAAA,MAAM,aAAa;;;;;;;;;;;mBAAmD,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACzD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAQjE,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAC1D,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAEhE,MAAM,WAAW,UAAW,SAAQ,GAAG;IACrC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;CACrB;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAC5C,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IActD,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7C,QAAQ,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IACnD,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAcpD,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAC/B,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWlC,aAAa,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;CAU9C;AAED,eAAO,MAAM,UAAU,GAAI,KAAK,GAAG,KAAG,QAAQ,CAAC,EAG7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.spec.d.ts","sourceRoot":"","sources":["../../../../src/workspace/schematic/symbol/client.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../../src/workspace/schematic/symbol/external.ts"],"names":[],"mappings":"AASA,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/workspace/schematic/symbol/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,MAAM,MAAM,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const keyZ: z.ZodUUID;
|
|
3
|
+
export type Key = z.infer<typeof keyZ>;
|
|
4
|
+
export type Params = Key | Key[];
|
|
5
|
+
export declare const regionZ: z.ZodObject<{
|
|
6
|
+
key: z.ZodString;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
selectors: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
9
|
+
strokeColor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
fillColor: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export interface Region extends z.infer<typeof regionZ> {
|
|
13
|
+
}
|
|
14
|
+
export declare const stateZ: z.ZodObject<{
|
|
15
|
+
key: z.ZodString;
|
|
16
|
+
name: z.ZodString;
|
|
17
|
+
regions: z.ZodArray<z.ZodObject<{
|
|
18
|
+
key: z.ZodString;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
selectors: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
21
|
+
strokeColor: z.ZodOptional<z.ZodString>;
|
|
22
|
+
fillColor: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export interface State extends z.infer<typeof stateZ> {
|
|
26
|
+
}
|
|
27
|
+
export declare const handleZ: z.ZodObject<{
|
|
28
|
+
key: z.ZodString;
|
|
29
|
+
position: z.ZodObject<{
|
|
30
|
+
x: z.ZodNumber;
|
|
31
|
+
y: z.ZodNumber;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
orientation: z.ZodEnum<{
|
|
34
|
+
top: "top";
|
|
35
|
+
right: "right";
|
|
36
|
+
bottom: "bottom";
|
|
37
|
+
left: "left";
|
|
38
|
+
}>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export interface Handle extends z.infer<typeof handleZ> {
|
|
41
|
+
}
|
|
42
|
+
export declare const specZ: z.ZodObject<{
|
|
43
|
+
svg: z.ZodString;
|
|
44
|
+
states: z.ZodArray<z.ZodObject<{
|
|
45
|
+
key: z.ZodString;
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
regions: z.ZodArray<z.ZodObject<{
|
|
48
|
+
key: z.ZodString;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
selectors: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
51
|
+
strokeColor: z.ZodOptional<z.ZodString>;
|
|
52
|
+
fillColor: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
variant: z.ZodString;
|
|
56
|
+
handles: z.ZodArray<z.ZodObject<{
|
|
57
|
+
key: z.ZodString;
|
|
58
|
+
position: z.ZodObject<{
|
|
59
|
+
x: z.ZodNumber;
|
|
60
|
+
y: z.ZodNumber;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
orientation: z.ZodEnum<{
|
|
63
|
+
top: "top";
|
|
64
|
+
right: "right";
|
|
65
|
+
bottom: "bottom";
|
|
66
|
+
left: "left";
|
|
67
|
+
}>;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
scale: z.ZodDefault<z.ZodNumber>;
|
|
70
|
+
scaleStroke: z.ZodDefault<z.ZodBoolean>;
|
|
71
|
+
previewViewport: z.ZodDefault<z.ZodObject<{
|
|
72
|
+
zoom: z.ZodDefault<z.ZodNumber>;
|
|
73
|
+
position: z.ZodObject<{
|
|
74
|
+
x: z.ZodNumber;
|
|
75
|
+
y: z.ZodNumber;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
export interface Spec extends z.infer<typeof specZ> {
|
|
80
|
+
}
|
|
81
|
+
export declare const symbolZ: z.ZodObject<{
|
|
82
|
+
key: z.ZodUUID;
|
|
83
|
+
version: z.ZodDefault<z.ZodOptional<z.ZodLiteral<1>>>;
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
data: z.ZodObject<{
|
|
86
|
+
svg: z.ZodString;
|
|
87
|
+
states: z.ZodArray<z.ZodObject<{
|
|
88
|
+
key: z.ZodString;
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
regions: z.ZodArray<z.ZodObject<{
|
|
91
|
+
key: z.ZodString;
|
|
92
|
+
name: z.ZodString;
|
|
93
|
+
selectors: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
94
|
+
strokeColor: z.ZodOptional<z.ZodString>;
|
|
95
|
+
fillColor: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
}, z.core.$strip>>;
|
|
98
|
+
variant: z.ZodString;
|
|
99
|
+
handles: z.ZodArray<z.ZodObject<{
|
|
100
|
+
key: z.ZodString;
|
|
101
|
+
position: z.ZodObject<{
|
|
102
|
+
x: z.ZodNumber;
|
|
103
|
+
y: z.ZodNumber;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
orientation: z.ZodEnum<{
|
|
106
|
+
top: "top";
|
|
107
|
+
right: "right";
|
|
108
|
+
bottom: "bottom";
|
|
109
|
+
left: "left";
|
|
110
|
+
}>;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
scale: z.ZodDefault<z.ZodNumber>;
|
|
113
|
+
scaleStroke: z.ZodDefault<z.ZodBoolean>;
|
|
114
|
+
previewViewport: z.ZodDefault<z.ZodObject<{
|
|
115
|
+
zoom: z.ZodDefault<z.ZodNumber>;
|
|
116
|
+
position: z.ZodObject<{
|
|
117
|
+
x: z.ZodNumber;
|
|
118
|
+
y: z.ZodNumber;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
}, z.core.$strip>>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
export declare const newZ: z.ZodObject<{
|
|
124
|
+
key: z.ZodOptional<z.ZodUUID>;
|
|
125
|
+
version: z.ZodDefault<z.ZodOptional<z.ZodLiteral<1>>>;
|
|
126
|
+
name: z.ZodString;
|
|
127
|
+
data: z.ZodObject<{
|
|
128
|
+
svg: z.ZodString;
|
|
129
|
+
states: z.ZodArray<z.ZodObject<{
|
|
130
|
+
key: z.ZodString;
|
|
131
|
+
name: z.ZodString;
|
|
132
|
+
regions: z.ZodArray<z.ZodObject<{
|
|
133
|
+
key: z.ZodString;
|
|
134
|
+
name: z.ZodString;
|
|
135
|
+
selectors: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
136
|
+
strokeColor: z.ZodOptional<z.ZodString>;
|
|
137
|
+
fillColor: z.ZodOptional<z.ZodString>;
|
|
138
|
+
}, z.core.$strip>>;
|
|
139
|
+
}, z.core.$strip>>;
|
|
140
|
+
variant: z.ZodString;
|
|
141
|
+
handles: z.ZodArray<z.ZodObject<{
|
|
142
|
+
key: z.ZodString;
|
|
143
|
+
position: z.ZodObject<{
|
|
144
|
+
x: z.ZodNumber;
|
|
145
|
+
y: z.ZodNumber;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
orientation: z.ZodEnum<{
|
|
148
|
+
top: "top";
|
|
149
|
+
right: "right";
|
|
150
|
+
bottom: "bottom";
|
|
151
|
+
left: "left";
|
|
152
|
+
}>;
|
|
153
|
+
}, z.core.$strip>>;
|
|
154
|
+
scale: z.ZodDefault<z.ZodNumber>;
|
|
155
|
+
scaleStroke: z.ZodDefault<z.ZodBoolean>;
|
|
156
|
+
previewViewport: z.ZodDefault<z.ZodObject<{
|
|
157
|
+
zoom: z.ZodDefault<z.ZodNumber>;
|
|
158
|
+
position: z.ZodObject<{
|
|
159
|
+
x: z.ZodNumber;
|
|
160
|
+
y: z.ZodNumber;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
}, z.core.$strip>>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
export interface New extends z.input<typeof newZ> {
|
|
166
|
+
}
|
|
167
|
+
export interface Symbol extends z.infer<typeof symbolZ> {
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../../src/workspace/schematic/symbol/payload.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AACvC,MAAM,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;AAEjC,eAAO,MAAM,OAAO;;;;;;iBAMlB,CAAC;AAEH,MAAM,WAAW,MAAO,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC;CAAG;AAE1D,eAAO,MAAM,MAAM;;;;;;;;;;iBAIjB,CAAC;AAEH,MAAM,WAAW,KAAM,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC;CAAG;AAExD,eAAO,MAAM,OAAO;;;;;;;;;;;;iBAIlB,CAAC;AAEH,MAAM,WAAW,MAAO,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC;CAAG;AAO1D,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQhB,CAAC;AAEH,MAAM,WAAW,IAAK,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC;CAAG;AAEtD,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAiC,CAAC;AACnD,MAAM,WAAW,GAAI,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC;CAAG;AAEpD,MAAM,WAAW,MAAO,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC;CAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "The Synnax Client Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"synnax",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"async-mutex": "^0.5.0",
|
|
28
28
|
"zod": "^4.0.2",
|
|
29
|
-
"@synnaxlabs/
|
|
30
|
-
"@synnaxlabs/
|
|
29
|
+
"@synnaxlabs/freighter": "^0.45.0",
|
|
30
|
+
"@synnaxlabs/x": "^0.45.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@vitest/coverage-v8": "^3.2.4",
|
package/src/channel/client.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { z } from "zod";
|
|
|
22
22
|
import {
|
|
23
23
|
type Key,
|
|
24
24
|
type KeyOrName,
|
|
25
|
+
keyZ,
|
|
25
26
|
type Name,
|
|
26
27
|
type New,
|
|
27
28
|
type Params,
|
|
@@ -135,21 +136,22 @@ export class Channel {
|
|
|
135
136
|
expression = "",
|
|
136
137
|
requires = [],
|
|
137
138
|
}: New & {
|
|
139
|
+
internal?: boolean;
|
|
138
140
|
frameClient?: framer.Client;
|
|
139
141
|
density?: CrudeDensity;
|
|
140
142
|
status?: status.Crude;
|
|
141
143
|
}) {
|
|
142
|
-
this.key = key;
|
|
144
|
+
this.key = keyZ.parse(key);
|
|
143
145
|
this.name = name;
|
|
144
146
|
this.dataType = new DataType(dataType);
|
|
145
147
|
this.leaseholder = leaseholder;
|
|
146
|
-
this.index = index;
|
|
148
|
+
this.index = keyZ.parse(index);
|
|
147
149
|
this.isIndex = isIndex;
|
|
148
150
|
this.internal = internal;
|
|
149
151
|
this.alias = alias;
|
|
150
152
|
this.virtual = virtual;
|
|
151
153
|
this.expression = expression;
|
|
152
|
-
this.requires = requires ?? [];
|
|
154
|
+
this.requires = keyZ.array().parse(requires ?? []);
|
|
153
155
|
if (argsStatus != null) this.status = status.create(argsStatus);
|
|
154
156
|
this._frameClient = frameClient ?? null;
|
|
155
157
|
}
|
package/src/channel/payload.ts
CHANGED
|
@@ -12,7 +12,14 @@ import { z } from "zod";
|
|
|
12
12
|
|
|
13
13
|
import { nullableArrayZ } from "@/util/zod";
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const errorMessage = "Channel key must be a valid uint32.";
|
|
16
|
+
export const keyZ = z.uint32().or(
|
|
17
|
+
z
|
|
18
|
+
.string()
|
|
19
|
+
.refine((val) => !isNaN(Number(val)), { message: errorMessage })
|
|
20
|
+
.transform(Number)
|
|
21
|
+
.refine((val) => val < 2 ** 32 - 1, { message: errorMessage }),
|
|
22
|
+
);
|
|
16
23
|
export type Key = z.infer<typeof keyZ>;
|
|
17
24
|
export type Keys = Key[];
|
|
18
25
|
export const nameZ = z.string();
|
|
@@ -51,7 +58,8 @@ export const newZ = payloadZ.extend({
|
|
|
51
58
|
requires: nullableArrayZ(keyZ).optional().default([]),
|
|
52
59
|
});
|
|
53
60
|
|
|
54
|
-
export interface New
|
|
61
|
+
export interface New
|
|
62
|
+
extends Omit<z.input<typeof newZ>, "dataType" | "status" | "internal"> {
|
|
55
63
|
dataType: CrudeDataType;
|
|
56
64
|
}
|
|
57
65
|
|
package/src/channel/writer.ts
CHANGED
|
@@ -71,6 +71,7 @@ export class Writer {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
async delete(props: DeleteProps): Promise<void> {
|
|
74
|
+
const keys = keyZ.array().parse(props.keys ?? []);
|
|
74
75
|
await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
|
|
75
76
|
this.client,
|
|
76
77
|
DELETE_ENDPOINT,
|
|
@@ -78,7 +79,7 @@ export class Writer {
|
|
|
78
79
|
deleteReqZ,
|
|
79
80
|
deleteResZ,
|
|
80
81
|
);
|
|
81
|
-
if (
|
|
82
|
+
if (keys.length > 0) this.cache.delete(keys);
|
|
82
83
|
if (props.names != null) this.cache.delete(props.names);
|
|
83
84
|
}
|
|
84
85
|
|
|
@@ -14,6 +14,9 @@ import { Group } from "@/ontology/group/group";
|
|
|
14
14
|
import { type Key, type Name, type Payload } from "@/ontology/group/payload";
|
|
15
15
|
import { Writer } from "@/ontology/group/writer";
|
|
16
16
|
|
|
17
|
+
export const SET_CHANNEL_NAME = "sy_group_set";
|
|
18
|
+
export const DELETE_CHANNEL_NAME = "sy_group_delete";
|
|
19
|
+
|
|
17
20
|
export class Client {
|
|
18
21
|
private readonly creator: Writer;
|
|
19
22
|
|
package/src/ontology/payload.ts
CHANGED
package/src/ranger/alias.ts
CHANGED
|
@@ -23,10 +23,7 @@ const resolveReqZ = z.object({ range: keyZ, aliases: z.string().array() });
|
|
|
23
23
|
|
|
24
24
|
const resolveResZ = z.object({ aliases: z.record(z.string(), channel.keyZ) });
|
|
25
25
|
|
|
26
|
-
const setReqZ = z.object({
|
|
27
|
-
range: keyZ,
|
|
28
|
-
aliases: z.record(channel.keyZ.or(z.string()), z.string()),
|
|
29
|
-
});
|
|
26
|
+
const setReqZ = z.object({ range: keyZ, aliases: z.record(channel.keyZ, z.string()) });
|
|
30
27
|
|
|
31
28
|
const setResZ = z.unknown();
|
|
32
29
|
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
type Schematic,
|
|
25
25
|
schematicZ,
|
|
26
26
|
} from "@/workspace/schematic/payload";
|
|
27
|
+
import { symbol } from "@/workspace/schematic/symbol";
|
|
27
28
|
|
|
28
29
|
const RETRIEVE_ENDPOINT = "/workspace/schematic/retrieve";
|
|
29
30
|
const CREATE_ENDPOINT = "/workspace/schematic/create";
|
|
@@ -45,10 +46,12 @@ const copyResZ = z.object({ schematic: schematicZ });
|
|
|
45
46
|
const emptyResZ = z.object({});
|
|
46
47
|
|
|
47
48
|
export class Client {
|
|
49
|
+
readonly symbols: symbol.Client;
|
|
48
50
|
private readonly client: UnaryClient;
|
|
49
51
|
|
|
50
52
|
constructor(client: UnaryClient) {
|
|
51
53
|
this.client = client;
|
|
54
|
+
this.symbols = new symbol.Client(client);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
async create(workspace: WorkspaceKey, schematic: New): Promise<Schematic>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Copyright 2025 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 { beforeAll, describe, expect, it } from "vitest";
|
|
11
|
+
|
|
12
|
+
import { ontology } from "@/ontology";
|
|
13
|
+
import { type group } from "@/ontology/group";
|
|
14
|
+
import { createTestClient } from "@/testutil/client";
|
|
15
|
+
|
|
16
|
+
const client = createTestClient();
|
|
17
|
+
|
|
18
|
+
describe("Symbol Client", () => {
|
|
19
|
+
let group: group.Group;
|
|
20
|
+
beforeAll(async () => {
|
|
21
|
+
group = await client.ontology.groups.create(ontology.ROOT_ID, "Test Symbols");
|
|
22
|
+
});
|
|
23
|
+
describe("create", () => {
|
|
24
|
+
it("should create a single symbol", async () => {
|
|
25
|
+
const symbol = await client.workspaces.schematic.symbols.create({
|
|
26
|
+
name: "Test Symbol",
|
|
27
|
+
data: {
|
|
28
|
+
svg: "<svg></svg>",
|
|
29
|
+
states: [],
|
|
30
|
+
handles: [],
|
|
31
|
+
variant: "sensor",
|
|
32
|
+
},
|
|
33
|
+
parent: group.ontologyID,
|
|
34
|
+
});
|
|
35
|
+
expect(symbol.name).toBe("Test Symbol");
|
|
36
|
+
expect(symbol.key).toBeDefined();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("should create multiple symbols", async () => {
|
|
40
|
+
const symbols = await client.workspaces.schematic.symbols.create({
|
|
41
|
+
symbols: [
|
|
42
|
+
{
|
|
43
|
+
name: "Symbol 1",
|
|
44
|
+
data: { svg: "<svg></svg>", states: [], handles: [], variant: "sensor" },
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "Symbol 2",
|
|
48
|
+
data: { svg: "<svg></svg>", states: [], handles: [], variant: "sensor" },
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
parent: group.ontologyID,
|
|
52
|
+
});
|
|
53
|
+
expect(symbols).toHaveLength(2);
|
|
54
|
+
expect(symbols[0].name).toBe("Symbol 1");
|
|
55
|
+
expect(symbols[1].name).toBe("Symbol 2");
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe("retrieve", () => {
|
|
60
|
+
it("should retrieve a single symbol by key", async () => {
|
|
61
|
+
const created = await client.workspaces.schematic.symbols.create({
|
|
62
|
+
name: "Retrieve Test",
|
|
63
|
+
data: { svg: "<svg></svg>", states: [], handles: [], variant: "sensor" },
|
|
64
|
+
parent: group.ontologyID,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const retrieved = await client.workspaces.schematic.symbols.retrieve({
|
|
68
|
+
key: created.key,
|
|
69
|
+
});
|
|
70
|
+
expect(retrieved.key).toBe(created.key);
|
|
71
|
+
expect(retrieved.name).toBe("Retrieve Test");
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("should retrieve multiple symbols by keys", async () => {
|
|
75
|
+
const created1 = await client.workspaces.schematic.symbols.create({
|
|
76
|
+
name: "Multi Test 1",
|
|
77
|
+
data: { svg: "<svg></svg>", states: [], handles: [], variant: "sensor" },
|
|
78
|
+
parent: group.ontologyID,
|
|
79
|
+
});
|
|
80
|
+
const created2 = await client.workspaces.schematic.symbols.create({
|
|
81
|
+
name: "Multi Test 2",
|
|
82
|
+
data: { svg: "<svg></svg>", states: [], handles: [], variant: "sensor" },
|
|
83
|
+
parent: group.ontologyID,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const retrieved = await client.workspaces.schematic.symbols.retrieve({
|
|
87
|
+
keys: [created1.key, created2.key],
|
|
88
|
+
});
|
|
89
|
+
expect(retrieved).toHaveLength(2);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe("rename", () => {
|
|
94
|
+
it("should rename a symbol", async () => {
|
|
95
|
+
const symbol = await client.workspaces.schematic.symbols.create({
|
|
96
|
+
name: "Original Name",
|
|
97
|
+
data: { svg: "<svg></svg>", states: [], handles: [], variant: "sensor" },
|
|
98
|
+
parent: group.ontologyID,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
await client.workspaces.schematic.symbols.rename(symbol.key, "New Name");
|
|
102
|
+
|
|
103
|
+
const retrieved = await client.workspaces.schematic.symbols.retrieve({
|
|
104
|
+
key: symbol.key,
|
|
105
|
+
});
|
|
106
|
+
expect(retrieved.name).toBe("New Name");
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe("delete", () => {
|
|
111
|
+
it("should delete a single symbol", async () => {
|
|
112
|
+
const symbol = await client.workspaces.schematic.symbols.create({
|
|
113
|
+
name: "Delete Test",
|
|
114
|
+
data: { svg: "<svg></svg>", states: [], handles: [], variant: "sensor" },
|
|
115
|
+
parent: group.ontologyID,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
await client.workspaces.schematic.symbols.delete(symbol.key);
|
|
119
|
+
|
|
120
|
+
await expect(
|
|
121
|
+
client.workspaces.schematic.symbols.retrieve({ key: symbol.key }),
|
|
122
|
+
).rejects.toThrow();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
describe("retrieveGroup", () => {
|
|
127
|
+
it("should retrieve the symbol group", async () => {
|
|
128
|
+
const group = await client.workspaces.schematic.symbols.retrieveGroup();
|
|
129
|
+
expect(group.key).toBeDefined();
|
|
130
|
+
expect(group.name).toBe("Schematic Symbols");
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
});
|