@synnaxlabs/client 0.23.1 → 0.24.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 +5 -5
- package/dist/auth/auth.d.ts +2 -2
- package/dist/channel/client.d.ts +7 -0
- package/dist/channel/client.d.ts.map +1 -1
- package/dist/channel/retriever.d.ts +5 -3
- package/dist/channel/retriever.d.ts.map +1 -1
- package/dist/channel/writer.d.ts +3 -1
- package/dist/channel/writer.d.ts.map +1 -1
- package/dist/client.cjs +22 -18
- package/dist/client.d.ts +1 -1
- package/dist/client.js +4024 -3757
- package/dist/errors.d.ts +33 -8
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.spec.d.ts +2 -0
- package/dist/errors.spec.d.ts.map +1 -0
- package/dist/framer/client.d.ts +6 -5
- package/dist/framer/client.d.ts.map +1 -1
- package/dist/framer/iterator.d.ts +12 -2
- package/dist/framer/iterator.d.ts.map +1 -1
- package/dist/hardware/device/client.d.ts.map +1 -1
- package/dist/hardware/task/client.d.ts +13 -2
- package/dist/hardware/task/client.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/ontology/client.d.ts +4 -4
- package/dist/ontology/group/external.d.ts +1 -0
- package/dist/ontology/group/external.d.ts.map +1 -1
- package/dist/ontology/group/payload.d.ts +2 -2
- package/dist/ontology/group/payload.d.ts.map +1 -1
- package/dist/ontology/group/writer.d.ts.map +1 -1
- package/dist/ontology/payload.d.ts +34 -34
- package/dist/ranger/active.d.ts.map +1 -1
- package/examples/node/basicReadWrite.js +4 -4
- package/examples/node/package-lock.json +8 -8
- package/package.json +5 -5
- package/src/auth/auth.ts +1 -1
- package/src/channel/channel.spec.ts +6 -5
- package/src/channel/client.ts +30 -1
- package/src/channel/retriever.ts +60 -10
- package/src/channel/writer.ts +13 -10
- package/src/client.ts +2 -2
- package/src/errors.spec.ts +40 -0
- package/src/errors.ts +35 -7
- package/src/framer/client.spec.ts +6 -0
- package/src/framer/client.ts +25 -18
- package/src/framer/deleter.spec.ts +39 -38
- package/src/framer/iterator.spec.ts +26 -1
- package/src/framer/iterator.ts +15 -1
- package/src/framer/streamProxy.ts +1 -1
- package/src/framer/streamer.ts +1 -1
- package/src/hardware/device/client.ts +2 -2
- package/src/hardware/task/client.ts +43 -4
- package/src/hardware/task/task.spec.ts +12 -0
- package/src/index.ts +2 -0
- package/src/ontology/group/external.ts +1 -0
- package/src/ontology/group/payload.ts +2 -2
- package/src/ontology/group/writer.ts +2 -2
- package/src/ranger/active.ts +2 -2
|
@@ -14,28 +14,28 @@ export declare const idZ: z.ZodObject<{
|
|
|
14
14
|
key: z.ZodString;
|
|
15
15
|
}, "strip", z.ZodTypeAny, {
|
|
16
16
|
key: string;
|
|
17
|
-
type: "
|
|
17
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
18
18
|
}, {
|
|
19
19
|
key: string;
|
|
20
|
-
type: "
|
|
20
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
21
21
|
}>;
|
|
22
22
|
export type IDPayload = z.infer<typeof idZ>;
|
|
23
23
|
export declare const stringIDZ: z.ZodEffects<z.ZodString, {
|
|
24
|
-
type: "
|
|
24
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
25
25
|
key: string;
|
|
26
26
|
}, string>;
|
|
27
27
|
export declare const crudeIDZ: z.ZodUnion<[z.ZodEffects<z.ZodString, {
|
|
28
|
-
type: "
|
|
28
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
29
29
|
key: string;
|
|
30
30
|
}, string>, z.ZodObject<{
|
|
31
31
|
type: z.ZodUnion<[z.ZodLiteral<"label">, z.ZodLiteral<"builtin">, z.ZodLiteral<"cluster">, z.ZodLiteral<"channel">, z.ZodLiteral<"node">, z.ZodLiteral<"group">, z.ZodLiteral<"range">, z.ZodLiteral<"range-alias">, z.ZodLiteral<"user">, z.ZodLiteral<"workspace">, z.ZodLiteral<"schematic">, z.ZodLiteral<"lineplot">, z.ZodLiteral<"rack">, z.ZodLiteral<"device">, z.ZodLiteral<"task">]>;
|
|
32
32
|
key: z.ZodString;
|
|
33
33
|
}, "strip", z.ZodTypeAny, {
|
|
34
34
|
key: string;
|
|
35
|
-
type: "
|
|
35
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
36
36
|
}, {
|
|
37
37
|
key: string;
|
|
38
|
-
type: "
|
|
38
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
39
39
|
}>]>;
|
|
40
40
|
export declare class ID {
|
|
41
41
|
type: ResourceType;
|
|
@@ -44,20 +44,20 @@ export declare class ID {
|
|
|
44
44
|
toString(): string;
|
|
45
45
|
get payload(): z.infer<typeof idZ>;
|
|
46
46
|
static readonly z: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, {
|
|
47
|
-
type: "
|
|
47
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
48
48
|
key: string;
|
|
49
49
|
}, string>, z.ZodObject<{
|
|
50
50
|
type: z.ZodUnion<[z.ZodLiteral<"label">, z.ZodLiteral<"builtin">, z.ZodLiteral<"cluster">, z.ZodLiteral<"channel">, z.ZodLiteral<"node">, z.ZodLiteral<"group">, z.ZodLiteral<"range">, z.ZodLiteral<"range-alias">, z.ZodLiteral<"user">, z.ZodLiteral<"workspace">, z.ZodLiteral<"schematic">, z.ZodLiteral<"lineplot">, z.ZodLiteral<"rack">, z.ZodLiteral<"device">, z.ZodLiteral<"task">]>;
|
|
51
51
|
key: z.ZodString;
|
|
52
52
|
}, "strip", z.ZodTypeAny, {
|
|
53
53
|
key: string;
|
|
54
|
-
type: "
|
|
54
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
55
55
|
}, {
|
|
56
56
|
key: string;
|
|
57
|
-
type: "
|
|
57
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
58
58
|
}>]>, z.ZodType<ID, z.ZodTypeDef, ID>]>, ID, string | ID | {
|
|
59
59
|
key: string;
|
|
60
|
-
type: "
|
|
60
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
61
61
|
}>;
|
|
62
62
|
}
|
|
63
63
|
export declare const Root: ID;
|
|
@@ -79,12 +79,12 @@ export declare const schemaZ: z.ZodObject<{
|
|
|
79
79
|
type: number;
|
|
80
80
|
}>>;
|
|
81
81
|
}, "strip", z.ZodTypeAny, {
|
|
82
|
-
type: "
|
|
82
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
83
83
|
fields: Record<string, {
|
|
84
84
|
type: number;
|
|
85
85
|
}>;
|
|
86
86
|
}, {
|
|
87
|
-
type: "
|
|
87
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
88
88
|
fields: Record<string, {
|
|
89
89
|
type: number;
|
|
90
90
|
}>;
|
|
@@ -92,20 +92,20 @@ export declare const schemaZ: z.ZodObject<{
|
|
|
92
92
|
export type Schema = z.infer<typeof schemaZ>;
|
|
93
93
|
export declare const resourceSchemaZ: z.ZodEffects<z.ZodObject<{
|
|
94
94
|
id: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, {
|
|
95
|
-
type: "
|
|
95
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
96
96
|
key: string;
|
|
97
97
|
}, string>, z.ZodObject<{
|
|
98
98
|
type: z.ZodUnion<[z.ZodLiteral<"label">, z.ZodLiteral<"builtin">, z.ZodLiteral<"cluster">, z.ZodLiteral<"channel">, z.ZodLiteral<"node">, z.ZodLiteral<"group">, z.ZodLiteral<"range">, z.ZodLiteral<"range-alias">, z.ZodLiteral<"user">, z.ZodLiteral<"workspace">, z.ZodLiteral<"schematic">, z.ZodLiteral<"lineplot">, z.ZodLiteral<"rack">, z.ZodLiteral<"device">, z.ZodLiteral<"task">]>;
|
|
99
99
|
key: z.ZodString;
|
|
100
100
|
}, "strip", z.ZodTypeAny, {
|
|
101
101
|
key: string;
|
|
102
|
-
type: "
|
|
102
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
103
103
|
}, {
|
|
104
104
|
key: string;
|
|
105
|
-
type: "
|
|
105
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
106
106
|
}>]>, z.ZodType<ID, z.ZodTypeDef, ID>]>, ID, string | ID | {
|
|
107
107
|
key: string;
|
|
108
|
-
type: "
|
|
108
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
109
109
|
}>;
|
|
110
110
|
name: z.ZodString;
|
|
111
111
|
schema: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -118,12 +118,12 @@ export declare const resourceSchemaZ: z.ZodEffects<z.ZodObject<{
|
|
|
118
118
|
type: number;
|
|
119
119
|
}>>;
|
|
120
120
|
}, "strip", z.ZodTypeAny, {
|
|
121
|
-
type: "
|
|
121
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
122
122
|
fields: Record<string, {
|
|
123
123
|
type: number;
|
|
124
124
|
}>;
|
|
125
125
|
}, {
|
|
126
|
-
type: "
|
|
126
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
127
127
|
fields: Record<string, {
|
|
128
128
|
type: number;
|
|
129
129
|
}>;
|
|
@@ -134,7 +134,7 @@ export declare const resourceSchemaZ: z.ZodEffects<z.ZodObject<{
|
|
|
134
134
|
id: ID;
|
|
135
135
|
data?: Record<string, unknown> | null | undefined;
|
|
136
136
|
schema?: {
|
|
137
|
-
type: "
|
|
137
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
138
138
|
fields: Record<string, {
|
|
139
139
|
type: number;
|
|
140
140
|
}>;
|
|
@@ -143,11 +143,11 @@ export declare const resourceSchemaZ: z.ZodEffects<z.ZodObject<{
|
|
|
143
143
|
name: string;
|
|
144
144
|
id: string | ID | {
|
|
145
145
|
key: string;
|
|
146
|
-
type: "
|
|
146
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
147
147
|
};
|
|
148
148
|
data?: Record<string, unknown> | null | undefined;
|
|
149
149
|
schema?: {
|
|
150
|
-
type: "
|
|
150
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
151
151
|
fields: Record<string, {
|
|
152
152
|
type: number;
|
|
153
153
|
}>;
|
|
@@ -157,7 +157,7 @@ export declare const resourceSchemaZ: z.ZodEffects<z.ZodObject<{
|
|
|
157
157
|
id: ID;
|
|
158
158
|
data?: Record<string, unknown> | null | undefined;
|
|
159
159
|
schema?: {
|
|
160
|
-
type: "
|
|
160
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
161
161
|
fields: Record<string, {
|
|
162
162
|
type: number;
|
|
163
163
|
}>;
|
|
@@ -167,11 +167,11 @@ export declare const resourceSchemaZ: z.ZodEffects<z.ZodObject<{
|
|
|
167
167
|
name: string;
|
|
168
168
|
id: string | ID | {
|
|
169
169
|
key: string;
|
|
170
|
-
type: "
|
|
170
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
171
171
|
};
|
|
172
172
|
data?: Record<string, unknown> | null | undefined;
|
|
173
173
|
schema?: {
|
|
174
|
-
type: "
|
|
174
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
175
175
|
fields: Record<string, {
|
|
176
176
|
type: number;
|
|
177
177
|
}>;
|
|
@@ -182,37 +182,37 @@ export type Resource<T extends UnknownRecord = UnknownRecord> = Omit<z.output<ty
|
|
|
182
182
|
};
|
|
183
183
|
export declare const relationshipSchemaZ: z.ZodObject<{
|
|
184
184
|
from: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, {
|
|
185
|
-
type: "
|
|
185
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
186
186
|
key: string;
|
|
187
187
|
}, string>, z.ZodObject<{
|
|
188
188
|
type: z.ZodUnion<[z.ZodLiteral<"label">, z.ZodLiteral<"builtin">, z.ZodLiteral<"cluster">, z.ZodLiteral<"channel">, z.ZodLiteral<"node">, z.ZodLiteral<"group">, z.ZodLiteral<"range">, z.ZodLiteral<"range-alias">, z.ZodLiteral<"user">, z.ZodLiteral<"workspace">, z.ZodLiteral<"schematic">, z.ZodLiteral<"lineplot">, z.ZodLiteral<"rack">, z.ZodLiteral<"device">, z.ZodLiteral<"task">]>;
|
|
189
189
|
key: z.ZodString;
|
|
190
190
|
}, "strip", z.ZodTypeAny, {
|
|
191
191
|
key: string;
|
|
192
|
-
type: "
|
|
192
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
193
193
|
}, {
|
|
194
194
|
key: string;
|
|
195
|
-
type: "
|
|
195
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
196
196
|
}>]>, z.ZodType<ID, z.ZodTypeDef, ID>]>, ID, string | ID | {
|
|
197
197
|
key: string;
|
|
198
|
-
type: "
|
|
198
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
199
199
|
}>;
|
|
200
200
|
type: z.ZodString;
|
|
201
201
|
to: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, {
|
|
202
|
-
type: "
|
|
202
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
203
203
|
key: string;
|
|
204
204
|
}, string>, z.ZodObject<{
|
|
205
205
|
type: z.ZodUnion<[z.ZodLiteral<"label">, z.ZodLiteral<"builtin">, z.ZodLiteral<"cluster">, z.ZodLiteral<"channel">, z.ZodLiteral<"node">, z.ZodLiteral<"group">, z.ZodLiteral<"range">, z.ZodLiteral<"range-alias">, z.ZodLiteral<"user">, z.ZodLiteral<"workspace">, z.ZodLiteral<"schematic">, z.ZodLiteral<"lineplot">, z.ZodLiteral<"rack">, z.ZodLiteral<"device">, z.ZodLiteral<"task">]>;
|
|
206
206
|
key: z.ZodString;
|
|
207
207
|
}, "strip", z.ZodTypeAny, {
|
|
208
208
|
key: string;
|
|
209
|
-
type: "
|
|
209
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
210
210
|
}, {
|
|
211
211
|
key: string;
|
|
212
|
-
type: "
|
|
212
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
213
213
|
}>]>, z.ZodType<ID, z.ZodTypeDef, ID>]>, ID, string | ID | {
|
|
214
214
|
key: string;
|
|
215
|
-
type: "
|
|
215
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
216
216
|
}>;
|
|
217
217
|
}, "strip", z.ZodTypeAny, {
|
|
218
218
|
type: string;
|
|
@@ -222,11 +222,11 @@ export declare const relationshipSchemaZ: z.ZodObject<{
|
|
|
222
222
|
type: string;
|
|
223
223
|
from: string | ID | {
|
|
224
224
|
key: string;
|
|
225
|
-
type: "
|
|
225
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
226
226
|
};
|
|
227
227
|
to: string | ID | {
|
|
228
228
|
key: string;
|
|
229
|
-
type: "
|
|
229
|
+
type: "label" | "builtin" | "cluster" | "channel" | "node" | "group" | "range" | "range-alias" | "user" | "workspace" | "schematic" | "lineplot" | "rack" | "device" | "task";
|
|
230
230
|
};
|
|
231
231
|
}>;
|
|
232
232
|
export type Relationship = z.infer<typeof relationshipSchemaZ>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active.d.ts","sourceRoot":"","sources":["../../src/ranger/active.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIvE,OAAO,EAAE,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"active.d.ts","sourceRoot":"","sources":["../../src/ranger/active.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIvE,OAAO,EAAE,KAAK,GAAG,EAAQ,KAAK,OAAO,EAAY,MAAM,kBAAkB,CAAC;AAsB1E,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAUpC,cAAc,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAYzC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAS7C"}
|
|
@@ -30,7 +30,7 @@ const timeChannel = await client.channels.create({
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
// Create a channel that will be used to store our data.
|
|
33
|
-
const
|
|
33
|
+
const dataChannel = await client.channels.create({
|
|
34
34
|
name: "basic_read_write_data",
|
|
35
35
|
isIndex: false,
|
|
36
36
|
dataType: DataType.FLOAT32,
|
|
@@ -54,14 +54,14 @@ const data = Float32Array.from({ length: N_SAMPLES }, (_, i) => Math.sin(i / 100
|
|
|
54
54
|
// otherwise writing the data will fail. Notice how we align the writes with the 'start'
|
|
55
55
|
// timestamp.
|
|
56
56
|
await timeChannel.write(start, time);
|
|
57
|
-
await
|
|
57
|
+
await dataChannel.write(start, data);
|
|
58
58
|
|
|
59
59
|
// Define the time range to read the data back from
|
|
60
60
|
const tr = new TimeRange(start, start.add(TimeSpan.milliseconds(N_SAMPLES)));
|
|
61
61
|
|
|
62
62
|
// Read the data back. The order doesn't matter here.
|
|
63
63
|
const readTime = await timeChannel.read(tr);
|
|
64
|
-
const readData = await
|
|
64
|
+
const readData = await dataChannel.read(tr);
|
|
65
65
|
|
|
66
66
|
// Print out some information.
|
|
67
67
|
console.log({
|
|
@@ -73,4 +73,4 @@ console.log({
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
// Make sure to close the client when you're done.
|
|
76
|
-
client.close();
|
|
76
|
+
client.close();
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@synnaxlabs/client": "^0.
|
|
12
|
+
"@synnaxlabs/client": "^0.21.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/@grpc/grpc-js": {
|
|
@@ -3653,12 +3653,12 @@
|
|
|
3653
3653
|
}
|
|
3654
3654
|
},
|
|
3655
3655
|
"node_modules/@synnaxlabs/client": {
|
|
3656
|
-
"version": "0.
|
|
3657
|
-
"resolved": "https://registry.npmjs.org/@synnaxlabs/client/-/client-0.
|
|
3658
|
-
"integrity": "sha512-
|
|
3656
|
+
"version": "0.21.0",
|
|
3657
|
+
"resolved": "https://registry.npmjs.org/@synnaxlabs/client/-/client-0.21.0.tgz",
|
|
3658
|
+
"integrity": "sha512-WZ5TQ7TaSZgE2AVQSVdj/4XX5mEIEr5fGLzrfI6kSi1vqm8l1Jo9nmpr/81AN8PLz1THMCd5lkz20qmSGtcx8g==",
|
|
3659
3659
|
"dependencies": {
|
|
3660
3660
|
"@synnaxlabs/freighter": "0.9.4",
|
|
3661
|
-
"@synnaxlabs/x": "0.16.
|
|
3661
|
+
"@synnaxlabs/x": "0.16.1",
|
|
3662
3662
|
"async-mutex": "^0.4.1",
|
|
3663
3663
|
"zod": "3.22.4"
|
|
3664
3664
|
}
|
|
@@ -3692,9 +3692,9 @@
|
|
|
3692
3692
|
}
|
|
3693
3693
|
},
|
|
3694
3694
|
"node_modules/@synnaxlabs/x": {
|
|
3695
|
-
"version": "0.16.
|
|
3696
|
-
"resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.16.
|
|
3697
|
-
"integrity": "sha512-
|
|
3695
|
+
"version": "0.16.1",
|
|
3696
|
+
"resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.16.1.tgz",
|
|
3697
|
+
"integrity": "sha512-vIqspjkkOregeriSQotu56NQPuX8xLV/7usudYILS3tKLzOCQQ2nR2r3lkVLseSMeiNxw3nLeY+roH3KxK13pA==",
|
|
3698
3698
|
"dependencies": {
|
|
3699
3699
|
"async-mutex": "^0.4.1",
|
|
3700
3700
|
"js-convert-case": "^4.2.0",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/client",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.24.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "The Client Library for Synnax",
|
|
7
7
|
"repository": "https://github.com/synnaxlabs/synnax/tree/main/client/ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"async-mutex": "^0.5.0",
|
|
20
20
|
"nanoid": "^3.0.0",
|
|
21
21
|
"zod": "3.23.8",
|
|
22
|
-
"@synnaxlabs/
|
|
23
|
-
"@synnaxlabs/
|
|
22
|
+
"@synnaxlabs/freighter": "0.24.0",
|
|
23
|
+
"@synnaxlabs/x": "0.24.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^20.12.7",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"vite": "5.2.11",
|
|
31
31
|
"vitest": "^1.5.0",
|
|
32
32
|
"@synnaxlabs/vite-plugin": "0.0.1",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"eslint-config-synnaxlabs": "0.0.1",
|
|
34
|
+
"@synnaxlabs/tsconfig": "0.0.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"zod": "^3.23.8"
|
package/src/auth/auth.ts
CHANGED
|
@@ -73,7 +73,7 @@ export class Client {
|
|
|
73
73
|
}
|
|
74
74
|
reqCtx.params.Authorization = `Bearer ${this.token}`;
|
|
75
75
|
const [resCtx, err] = await next(reqCtx);
|
|
76
|
-
if (err
|
|
76
|
+
if (InvalidTokenError.matches(err) && this.retryCount < MAX_RETRIES) {
|
|
77
77
|
this.authenticated = false;
|
|
78
78
|
this.authenticating = undefined;
|
|
79
79
|
this.retryCount += 1;
|
|
@@ -246,14 +246,15 @@ describe("Channel", () => {
|
|
|
246
246
|
dataType: DataType.FLOAT32,
|
|
247
247
|
},
|
|
248
248
|
]);
|
|
249
|
+
// Retrieve channels here to ensure we check for cache invalidation
|
|
250
|
+
const initial = await client.channels.retrieve(channels.map((c) => c.key));
|
|
251
|
+
expect(initial[0].name).toEqual("test1");
|
|
252
|
+
expect(initial[1].name).toEqual("test2");
|
|
249
253
|
await client.channels.rename(
|
|
250
|
-
|
|
254
|
+
channels.map((c) => c.key),
|
|
251
255
|
["test3", "test4"],
|
|
252
256
|
);
|
|
253
|
-
const renamed = await client.channels.retrieve(
|
|
254
|
-
channels[0].key,
|
|
255
|
-
channels[1].key,
|
|
256
|
-
]);
|
|
257
|
+
const renamed = await client.channels.retrieve(channels.map((c) => c.key));
|
|
257
258
|
expect(renamed[0].name).toEqual("test3");
|
|
258
259
|
expect(renamed[1].name).toEqual("test4");
|
|
259
260
|
});
|
package/src/channel/client.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
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 UnaryClient } from "@synnaxlabs/freighter";
|
|
10
|
+
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
11
|
import { type AsyncTermSearcher } from "@synnaxlabs/x/search";
|
|
12
12
|
import {
|
|
13
13
|
type CrudeDensity,
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
type TypedArray,
|
|
20
20
|
} from "@synnaxlabs/x/telem";
|
|
21
21
|
import { toArray } from "@synnaxlabs/x/toArray";
|
|
22
|
+
import { z } from "zod";
|
|
22
23
|
|
|
23
24
|
import {
|
|
24
25
|
type Key,
|
|
@@ -39,6 +40,8 @@ import {
|
|
|
39
40
|
import { type Writer } from "@/channel/writer";
|
|
40
41
|
import { ValidationError } from "@/errors";
|
|
41
42
|
import { type framer } from "@/framer";
|
|
43
|
+
import { ontology } from "@/ontology";
|
|
44
|
+
import { group } from "@/ontology/group";
|
|
42
45
|
import { checkForMultipleOrNoResults } from "@/util/retrieve";
|
|
43
46
|
|
|
44
47
|
interface CreateOptions {
|
|
@@ -150,6 +153,13 @@ export class Channel {
|
|
|
150
153
|
});
|
|
151
154
|
}
|
|
152
155
|
|
|
156
|
+
/***
|
|
157
|
+
* @returns the ontology ID of the channel
|
|
158
|
+
*/
|
|
159
|
+
get ontologyID(): ontology.ID {
|
|
160
|
+
return new ontology.ID({ type: "channel", key: this.key.toString() });
|
|
161
|
+
}
|
|
162
|
+
|
|
153
163
|
/**
|
|
154
164
|
* Reads telemetry from the channel between the two timestamps.
|
|
155
165
|
*
|
|
@@ -172,6 +182,14 @@ export class Channel {
|
|
|
172
182
|
}
|
|
173
183
|
}
|
|
174
184
|
|
|
185
|
+
const RETRIEVE_GROUP_ENDPOINT = "/channel/retrieve-group";
|
|
186
|
+
|
|
187
|
+
const retrieveGroupReqZ = z.object({});
|
|
188
|
+
|
|
189
|
+
const retrieveGroupResZ = z.object({
|
|
190
|
+
group: group.groupZ,
|
|
191
|
+
});
|
|
192
|
+
|
|
175
193
|
/**
|
|
176
194
|
* The core client class for executing channel operations against a Synnax
|
|
177
195
|
* cluster. This class should not be instantiated directly, and instead should be used
|
|
@@ -382,4 +400,15 @@ export class Client implements AsyncTermSearcher<string, Key, Channel> {
|
|
|
382
400
|
const { frameClient } = this;
|
|
383
401
|
return payloads.map((p) => new Channel({ ...p, frameClient }));
|
|
384
402
|
}
|
|
403
|
+
|
|
404
|
+
async retrieveGroup(): Promise<group.Group> {
|
|
405
|
+
const res = await sendRequired(
|
|
406
|
+
this.client,
|
|
407
|
+
RETRIEVE_GROUP_ENDPOINT,
|
|
408
|
+
{},
|
|
409
|
+
retrieveGroupReqZ,
|
|
410
|
+
retrieveGroupResZ,
|
|
411
|
+
);
|
|
412
|
+
return new group.Group(res.group.name, res.group.key);
|
|
413
|
+
}
|
|
385
414
|
}
|
package/src/channel/retriever.ts
CHANGED
|
@@ -103,7 +103,7 @@ export class ClusterRetriever implements Retriever {
|
|
|
103
103
|
|
|
104
104
|
export class CacheRetriever implements Retriever {
|
|
105
105
|
private readonly cache: Map<number, Payload>;
|
|
106
|
-
private readonly namesToKeys: Map<string, number
|
|
106
|
+
private readonly namesToKeys: Map<string, Set<number>>;
|
|
107
107
|
private readonly wrapped: Retriever;
|
|
108
108
|
|
|
109
109
|
constructor(wrapped: Retriever) {
|
|
@@ -128,27 +128,77 @@ export class CacheRetriever implements Retriever {
|
|
|
128
128
|
const results: Payload[] = [];
|
|
129
129
|
const toFetch: KeysOrNames = [];
|
|
130
130
|
normalized.forEach((keyOrName) => {
|
|
131
|
-
const c = this.
|
|
132
|
-
if (c != null) results.push(c);
|
|
131
|
+
const c = this.get(keyOrName);
|
|
132
|
+
if (c != null) results.push(...c);
|
|
133
133
|
else toFetch.push(keyOrName as never);
|
|
134
134
|
});
|
|
135
135
|
if (toFetch.length === 0) return results;
|
|
136
136
|
const fetched = await this.wrapped.retrieve(toFetch, options);
|
|
137
|
-
this.
|
|
137
|
+
this.set(fetched);
|
|
138
138
|
return results.concat(fetched);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
delete(channels: Params): void {
|
|
142
|
+
const { variant, normalized } = analyzeChannelParams(channels);
|
|
143
|
+
if (variant === "names")
|
|
144
|
+
(normalized as string[]).forEach((name) => {
|
|
145
|
+
const keys = this.namesToKeys.get(name);
|
|
146
|
+
if (keys == null) return;
|
|
147
|
+
keys.forEach((k) => this.cache.delete(k));
|
|
148
|
+
this.namesToKeys.delete(name);
|
|
149
|
+
});
|
|
150
|
+
else
|
|
151
|
+
(normalized as number[]).forEach((key) => {
|
|
152
|
+
const channel = this.cache.get(key);
|
|
153
|
+
if (channel == null) return;
|
|
154
|
+
this.cache.delete(key);
|
|
155
|
+
this.namesToKeys.delete(channel.name);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
rename(keys: Key[], names: string[]): void {
|
|
160
|
+
keys.forEach((key, i) => {
|
|
161
|
+
const name = names[i];
|
|
162
|
+
const ch = this.cache.get(key);
|
|
163
|
+
if (ch == null) return;
|
|
164
|
+
this.cache.delete(key);
|
|
165
|
+
const keys = this.namesToKeys.get(ch.name);
|
|
166
|
+
if (keys != null) {
|
|
167
|
+
keys.delete(key);
|
|
168
|
+
if (keys.size === 0) this.namesToKeys.delete(ch.name);
|
|
169
|
+
}
|
|
170
|
+
ch.name = name;
|
|
171
|
+
this.cache.set(key, ch);
|
|
172
|
+
const newKeys = this.namesToKeys.get(name);
|
|
173
|
+
if (newKeys == null) this.namesToKeys.set(name, new Set([key]));
|
|
174
|
+
else newKeys.add(key);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
set(channels: Payload[]): void {
|
|
142
179
|
channels.forEach((channel) => {
|
|
143
180
|
this.cache.set(channel.key, channel);
|
|
144
|
-
this.namesToKeys.
|
|
181
|
+
const keys = this.namesToKeys.get(channel.name);
|
|
182
|
+
if (keys == null) this.namesToKeys.set(channel.name, new Set([channel.key]));
|
|
183
|
+
else keys.add(channel.key);
|
|
145
184
|
});
|
|
146
185
|
}
|
|
147
186
|
|
|
148
|
-
private
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
187
|
+
private get(channel: KeyOrName): Payload[] | undefined {
|
|
188
|
+
if (typeof channel === "number") {
|
|
189
|
+
const ch = this.cache.get(channel);
|
|
190
|
+
if (ch == null) return undefined;
|
|
191
|
+
return [ch];
|
|
192
|
+
}
|
|
193
|
+
const keys = this.namesToKeys.get(channel);
|
|
194
|
+
if (keys == null) return undefined;
|
|
195
|
+
const channels: Payload[] = [];
|
|
196
|
+
keys.forEach((key) => {
|
|
197
|
+
const ch = this.cache.get(key);
|
|
198
|
+
if (ch != null) channels.push(ch);
|
|
199
|
+
});
|
|
200
|
+
if (channels.length === 0) return undefined;
|
|
201
|
+
return channels;
|
|
152
202
|
}
|
|
153
203
|
}
|
|
154
204
|
|
package/src/channel/writer.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
type Payload,
|
|
19
19
|
payload,
|
|
20
20
|
} from "@/channel/payload";
|
|
21
|
+
import { CacheRetriever } from "@/channel/retriever";
|
|
21
22
|
|
|
22
23
|
const createReqZ = z.object({ channels: newPayload.array() });
|
|
23
24
|
const createResZ = z.object({ channels: payload.array() });
|
|
@@ -43,21 +44,20 @@ export type RenameProps = z.input<typeof renameReqZ>;
|
|
|
43
44
|
|
|
44
45
|
export class Writer {
|
|
45
46
|
private readonly client: UnaryClient;
|
|
47
|
+
private readonly cache: CacheRetriever;
|
|
46
48
|
|
|
47
|
-
constructor(client: UnaryClient) {
|
|
49
|
+
constructor(client: UnaryClient, cache: CacheRetriever) {
|
|
48
50
|
this.client = client;
|
|
51
|
+
this.cache = cache;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
async create(channels: NewPayload[]): Promise<Payload[]> {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
createResZ,
|
|
59
|
-
)
|
|
60
|
-
).channels;
|
|
55
|
+
const { channels: created } = await sendRequired<
|
|
56
|
+
typeof createReqZ,
|
|
57
|
+
typeof createResZ
|
|
58
|
+
>(this.client, CREATE_ENDPOINT, { channels }, createReqZ, createResZ);
|
|
59
|
+
this.cache.set(created);
|
|
60
|
+
return created;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
async delete(props: DeleteProps): Promise<void> {
|
|
@@ -68,6 +68,8 @@ export class Writer {
|
|
|
68
68
|
deleteReqZ,
|
|
69
69
|
deleteResZ,
|
|
70
70
|
);
|
|
71
|
+
if (props.keys != null) this.cache.delete(props.keys);
|
|
72
|
+
if (props.names != null) this.cache.delete(props.names);
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
async rename(keys: Key[], names: string[]): Promise<void> {
|
|
@@ -78,5 +80,6 @@ export class Writer {
|
|
|
78
80
|
renameReqZ,
|
|
79
81
|
renameResZ,
|
|
80
82
|
);
|
|
83
|
+
this.cache.rename(keys, names);
|
|
81
84
|
}
|
|
82
85
|
}
|