@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
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { NewLinePlot } from './writer';
|
|
2
|
+
import { LinePlot, Key, Params } from './payload';
|
|
3
|
+
import { UnknownRecord } from '@synnaxlabs/x/record';
|
|
4
|
+
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
5
|
+
|
|
5
6
|
export declare class Client {
|
|
6
7
|
private readonly writer;
|
|
7
8
|
private readonly retriever;
|
|
8
9
|
constructor(client: UnaryClient);
|
|
9
|
-
create(workspace: string,
|
|
10
|
+
create(workspace: string, schematic: NewLinePlot): Promise<LinePlot>;
|
|
10
11
|
rename(key: Key, name: string): Promise<void>;
|
|
11
12
|
setData(key: Key, data: UnknownRecord): Promise<void>;
|
|
12
13
|
retrieve(key: Key): Promise<LinePlot>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/workspace/lineplot/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/workspace/lineplot/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEpF,OAAO,EAAE,KAAK,WAAW,EAAU,MAAM,6BAA6B,CAAC;AAEvE,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,MAAM,EAAE,WAAW;IAKzB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIpE,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;IAErC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAQ1C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UnknownRecord } from '@synnaxlabs/x/record';
|
|
3
|
+
|
|
3
4
|
export declare const keyZ: z.ZodString;
|
|
4
5
|
export type Key = z.infer<typeof keyZ>;
|
|
5
6
|
export type Params = Key | Key[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/workspace/lineplot/payload.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/workspace/lineplot/payload.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,IAAI,aAAoB,CAAC;AACtC,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,SAAS;;;;;;;;;;;;EAIpB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { LinePlot, Params } from './payload';
|
|
2
|
+
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
3
|
+
|
|
3
4
|
export declare class Retriever {
|
|
4
5
|
private readonly ENDPOINT;
|
|
5
6
|
private readonly client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retriever.d.ts","sourceRoot":"","sources":["../../../src/workspace/lineplot/retriever.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIvE,OAAO,
|
|
1
|
+
{"version":3,"file":"retriever.d.ts","sourceRoot":"","sources":["../../../src/workspace/lineplot/retriever.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIvE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAa,MAAM,8BAA8B,CAAC;AAYrF,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAC3D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAMpD"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { LinePlot, Params, Key } from './payload';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { UnknownRecord } from '@synnaxlabs/x/record';
|
|
4
|
+
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
5
|
+
|
|
5
6
|
export declare const newLinePlotZ: z.ZodEffects<z.ZodObject<{
|
|
6
7
|
name: z.ZodString;
|
|
7
8
|
key: z.ZodOptional<z.ZodString>;
|
|
@@ -29,7 +30,7 @@ export declare class Writer {
|
|
|
29
30
|
constructor(client: UnaryClient);
|
|
30
31
|
create(workspace: string, plot: NewLinePlot): Promise<LinePlot>;
|
|
31
32
|
delete(params: Params): Promise<void>;
|
|
32
|
-
rename(
|
|
33
|
-
setData(
|
|
33
|
+
rename(schematic: Key, name: string): Promise<void>;
|
|
34
|
+
setData(schematic: Key, data: UnknownRecord): Promise<void>;
|
|
34
35
|
}
|
|
35
36
|
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../../src/workspace/lineplot/writer.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../../src/workspace/lineplot/writer.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,MAAM,EAEX,KAAK,GAAG,EACT,MAAM,8BAA8B,CAAC;AAGtC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;EAGtB,CAAC;AAEJ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAoCvD,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAa/D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUnD,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CASlE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UnknownRecord } from '@synnaxlabs/x/record';
|
|
3
|
+
|
|
3
4
|
export declare const keyZ: z.ZodString;
|
|
4
5
|
export type Key = z.infer<typeof keyZ>;
|
|
5
6
|
export type Params = Key | Key[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/workspace/payload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/workspace/payload.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,IAAI,aAAoB,CAAC;AAEtC,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAEvC,MAAM,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;AAEjC,eAAO,MAAM,UAAU;;;;;;;;;;;;EAMrB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAE3B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Params, Workspace } from './payload';
|
|
2
|
+
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
3
|
+
|
|
3
4
|
export declare class Retriever {
|
|
4
5
|
private static readonly ENDPOINT;
|
|
5
6
|
private readonly client;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NewSchematic } from './writer';
|
|
2
|
+
import { Key, Params, Schematic } from './payload';
|
|
3
|
+
import { UnknownRecord } from '@synnaxlabs/x/record';
|
|
4
|
+
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
5
|
+
|
|
6
|
+
export declare class Client {
|
|
7
|
+
private readonly writer;
|
|
8
|
+
private readonly retriever;
|
|
9
|
+
constructor(client: UnaryClient);
|
|
10
|
+
create(workspace: string, schematic: NewSchematic): Promise<Schematic>;
|
|
11
|
+
rename(key: Key, name: string): Promise<void>;
|
|
12
|
+
setData(key: Key, data: UnknownRecord): Promise<void>;
|
|
13
|
+
retrieve(key: Key): Promise<Schematic>;
|
|
14
|
+
retrieve(keys: Key[]): Promise<Schematic[]>;
|
|
15
|
+
delete(keys: Params): Promise<void>;
|
|
16
|
+
copy(key: Key, name: string, snapshot: boolean): Promise<Schematic>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/workspace/schematic/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAEtF,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEzE,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,MAAM,EAAE,WAAW;IAKzB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC;IAItE,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC;IAEtC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAQ3C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;CAG1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/workspace/schematic/external.ts"],"names":[],"mappings":"AASA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/schematic/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,SAAS,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UnknownRecord } from '@synnaxlabs/x/record';
|
|
3
|
+
|
|
3
4
|
export declare const keyZ: z.ZodString;
|
|
4
5
|
export type Key = z.infer<typeof keyZ>;
|
|
5
6
|
export type Params = Key | Key[];
|
|
6
|
-
export declare const
|
|
7
|
+
export declare const schematicZ: z.ZodObject<{
|
|
7
8
|
key: z.ZodString;
|
|
8
9
|
name: z.ZodString;
|
|
9
10
|
data: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
|
|
@@ -19,7 +20,7 @@ export declare const pidZ: z.ZodObject<{
|
|
|
19
20
|
data: (string | Record<string | number | symbol, unknown>) & (string | Record<string | number | symbol, unknown> | undefined);
|
|
20
21
|
snapshot: boolean;
|
|
21
22
|
}>;
|
|
22
|
-
export declare const
|
|
23
|
+
export declare const schematicRemoteZ: z.ZodObject<{
|
|
23
24
|
key: z.ZodString;
|
|
24
25
|
name: z.ZodString;
|
|
25
26
|
snapshot: z.ZodBoolean;
|
|
@@ -35,5 +36,5 @@ export declare const pidRemoteZ: z.ZodObject<{
|
|
|
35
36
|
data: string;
|
|
36
37
|
snapshot: boolean;
|
|
37
38
|
}>;
|
|
38
|
-
export type
|
|
39
|
+
export type Schematic = z.infer<typeof schematicZ>;
|
|
39
40
|
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/workspace/schematic/payload.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,IAAI,aAAoB,CAAC;AACtC,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,UAAU;;;;;;;;;;;;;;;EAKrB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAK3B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Schematic, Params } from './payload';
|
|
2
|
+
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
3
|
+
|
|
4
|
+
export declare class Retriever {
|
|
5
|
+
private readonly ENDPOINT;
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: UnaryClient);
|
|
8
|
+
retrieve(params: Params): Promise<Schematic[]>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=retriever.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retriever.d.ts","sourceRoot":"","sources":["../../../src/workspace/schematic/retriever.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIvE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,EAAoB,MAAM,+BAA+B,CAAC;AAY9F,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmC;IAC5D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;CASrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schematic.spec.d.ts","sourceRoot":"","sources":["../../../src/workspace/schematic/schematic.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { Schematic, Params, Key } from './payload';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { UnknownRecord } from '@synnaxlabs/x/record';
|
|
4
|
+
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
5
|
+
|
|
6
|
+
export declare const newSchematicZ: z.ZodEffects<z.ZodObject<{
|
|
6
7
|
name: z.ZodString;
|
|
7
8
|
key: z.ZodOptional<z.ZodString>;
|
|
8
9
|
data: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
|
|
@@ -28,14 +29,14 @@ export declare const newPIDZ: z.ZodEffects<z.ZodObject<{
|
|
|
28
29
|
key?: string | undefined;
|
|
29
30
|
snapshot?: boolean | undefined;
|
|
30
31
|
}>;
|
|
31
|
-
export type
|
|
32
|
+
export type NewSchematic = z.input<typeof newSchematicZ>;
|
|
32
33
|
export declare class Writer {
|
|
33
34
|
private readonly client;
|
|
34
35
|
constructor(client: UnaryClient);
|
|
35
|
-
create(workspace: string,
|
|
36
|
-
copy(key: Key, name: string, snapshot: boolean): Promise<
|
|
36
|
+
create(workspace: string, schematic: NewSchematic): Promise<Schematic>;
|
|
37
|
+
copy(key: Key, name: string, snapshot: boolean): Promise<Schematic>;
|
|
37
38
|
delete(params: Params): Promise<void>;
|
|
38
|
-
rename(
|
|
39
|
-
setData(
|
|
39
|
+
rename(schematic: Key, name: string): Promise<void>;
|
|
40
|
+
setData(schematic: Key, data: UnknownRecord): Promise<void>;
|
|
40
41
|
}
|
|
41
42
|
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../../src/workspace/schematic/writer.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,MAAM,EAEX,KAAK,GAAG,EAET,MAAM,+BAA+B,CAAC;AAEvC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;EAGvB,CAAC;AAEJ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AA+CzD,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC;IAatE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;IAWnE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUnD,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CASlE"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Workspace } from './payload';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { UnknownRecord } from '@synnaxlabs/x/record';
|
|
4
|
+
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
5
|
+
|
|
5
6
|
declare const newWorkspaceZ: z.ZodEffects<z.ZodObject<{
|
|
6
7
|
name: z.ZodString;
|
|
7
8
|
key: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/workspace/writer.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/workspace/writer.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,qBAAqB,CAAC;AAE7B,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;EAGhB,CAAC;AAEJ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAMzD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;EAEd,CAAC;AAsBH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAOxD,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,MAAM,CAAC,UAAU,EAAE,YAAY,GAAG,YAAY,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAWvE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9C,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUhD,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CASnE"}
|
|
@@ -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.20.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/@grpc/grpc-js": {
|
|
@@ -3653,13 +3653,13 @@
|
|
|
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.20.0",
|
|
3657
|
+
"resolved": "https://registry.npmjs.org/@synnaxlabs/client/-/client-0.20.0.tgz",
|
|
3658
|
+
"integrity": "sha512-L4Qve63NTNmqdFiDlDy/rgM1yzAxkyaw6hf+SrsGLSb/u871Hwp/yUoUhYRpY1JjhvjL2N7YPXpr5Y+n8/y5iQ==",
|
|
3659
3659
|
"dependencies": {
|
|
3660
3660
|
"@synnaxlabs/freighter": "0.9.4",
|
|
3661
|
-
"@synnaxlabs/x": "0.
|
|
3662
|
-
"async-mutex": "^0.4.
|
|
3661
|
+
"@synnaxlabs/x": "0.16.0",
|
|
3662
|
+
"async-mutex": "^0.4.1",
|
|
3663
3663
|
"zod": "3.22.4"
|
|
3664
3664
|
}
|
|
3665
3665
|
},
|
|
@@ -3692,17 +3692,34 @@
|
|
|
3692
3692
|
}
|
|
3693
3693
|
},
|
|
3694
3694
|
"node_modules/@synnaxlabs/x": {
|
|
3695
|
-
"version": "0.
|
|
3696
|
-
"resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.
|
|
3697
|
-
"integrity": "sha512-
|
|
3695
|
+
"version": "0.16.0",
|
|
3696
|
+
"resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.16.0.tgz",
|
|
3697
|
+
"integrity": "sha512-7sJKLZfPR0I9Bpgfe3UYqiGoFhxQ7FgmsEXBwXggThbUdzEl8JsydSQfR6e4GC0OKZZVrGZc0gTdDeSdYQHCKw==",
|
|
3698
3698
|
"dependencies": {
|
|
3699
|
-
"async-mutex": "^0.4.
|
|
3699
|
+
"async-mutex": "^0.4.1",
|
|
3700
3700
|
"js-convert-case": "^4.2.0",
|
|
3701
|
-
"nanoid": "^
|
|
3702
|
-
"typescript": "^5.
|
|
3701
|
+
"nanoid": "^3.3.7",
|
|
3702
|
+
"typescript": "^5.4.5",
|
|
3703
3703
|
"zod": "3.22.4"
|
|
3704
3704
|
}
|
|
3705
3705
|
},
|
|
3706
|
+
"node_modules/@synnaxlabs/x/node_modules/nanoid": {
|
|
3707
|
+
"version": "3.3.7",
|
|
3708
|
+
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
|
|
3709
|
+
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
|
|
3710
|
+
"funding": [
|
|
3711
|
+
{
|
|
3712
|
+
"type": "github",
|
|
3713
|
+
"url": "https://github.com/sponsors/ai"
|
|
3714
|
+
}
|
|
3715
|
+
],
|
|
3716
|
+
"bin": {
|
|
3717
|
+
"nanoid": "bin/nanoid.cjs"
|
|
3718
|
+
},
|
|
3719
|
+
"engines": {
|
|
3720
|
+
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
|
3721
|
+
}
|
|
3722
|
+
},
|
|
3706
3723
|
"node_modules/@types/accepts": {
|
|
3707
3724
|
"version": "1.3.7",
|
|
3708
3725
|
"resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.7.tgz",
|
|
@@ -12,7 +12,6 @@ const client = new Synnax({
|
|
|
12
12
|
port: 9090,
|
|
13
13
|
username: "synnax",
|
|
14
14
|
password: "seldon",
|
|
15
|
-
secure: false
|
|
16
15
|
});
|
|
17
16
|
|
|
18
17
|
// Create an index channel that will be used to store our timestamps.
|
|
@@ -42,7 +41,7 @@ const start = TimeStamp.now();
|
|
|
42
41
|
|
|
43
42
|
// Set a rough rate of 20 Hz. This won't be exact because we're sleeping for a fixed
|
|
44
43
|
// amount of time, but it's close enough for demonstration purposes.
|
|
45
|
-
const roughRate = Rate.hz(
|
|
44
|
+
const roughRate = Rate.hz(25);
|
|
46
45
|
|
|
47
46
|
// Make the writer commit every 500 samples. This will make the data available for
|
|
48
47
|
// historical reads every 500 samples.
|
|
@@ -50,7 +49,7 @@ const commitInterval = 500;
|
|
|
50
49
|
|
|
51
50
|
const writer = await client.openWriter({
|
|
52
51
|
start,
|
|
53
|
-
channels: [timeChannel.key, dataChannel1.key, dataChannel2.key]
|
|
52
|
+
channels: [timeChannel.key, dataChannel1.key, dataChannel2.key],
|
|
54
53
|
});
|
|
55
54
|
|
|
56
55
|
try {
|
|
@@ -69,14 +68,12 @@ try {
|
|
|
69
68
|
|
|
70
69
|
if (i % 60 == 0)
|
|
71
70
|
console.log(`Writing sample ${i} at ${timestamp.toISOString()}`)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
break;
|
|
79
|
-
};
|
|
71
|
+
|
|
72
|
+
// Commit the writer. This method will return false if the commit fails i.e.
|
|
73
|
+
// we've mad an invalid write or someone has already written to this region.
|
|
74
|
+
if (i % commitInterval == 0 && !await writer.commit()) {
|
|
75
|
+
console.error("Failed to commit data");
|
|
76
|
+
break;
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
} finally {
|
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.22.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",
|
|
@@ -16,21 +16,22 @@
|
|
|
16
16
|
"control systems"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"async-mutex": "^0.
|
|
19
|
+
"async-mutex": "^0.5.0",
|
|
20
|
+
"nanoid": "^5.0.7",
|
|
20
21
|
"zod": "3.22.4",
|
|
21
|
-
"@synnaxlabs/freighter": "0.
|
|
22
|
+
"@synnaxlabs/freighter": "0.10.0",
|
|
22
23
|
"@synnaxlabs/x": "0.16.0"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@types/node": "^20.12.7",
|
|
26
|
-
"@vitest/coverage-v8": "1.
|
|
27
|
-
"eslint": "^
|
|
27
|
+
"@vitest/coverage-v8": "^1.5.0",
|
|
28
|
+
"eslint": "^9.0.0",
|
|
28
29
|
"typescript": "^5.4.5",
|
|
29
|
-
"vite": "5.
|
|
30
|
-
"vitest": "1.
|
|
30
|
+
"vite": "5.2.8",
|
|
31
|
+
"vitest": "^1.5.0",
|
|
31
32
|
"@synnaxlabs/tsconfig": "0.0.2",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
33
|
+
"eslint-config-synnaxlabs": "0.0.1",
|
|
34
|
+
"@synnaxlabs/vite-plugin": "0.0.1"
|
|
34
35
|
},
|
|
35
36
|
"main": "dist/client.cjs",
|
|
36
37
|
"module": "dist/client.js",
|
package/src/auth/auth.spec.ts
CHANGED
|
@@ -7,13 +7,21 @@
|
|
|
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 { URL } from "@synnaxlabs/x";
|
|
11
|
-
import { describe, expect, test } from "vitest";
|
|
10
|
+
import { URL } from "@synnaxlabs/x/url";
|
|
11
|
+
import { describe, expect, it, test } from "vitest";
|
|
12
12
|
|
|
13
13
|
import { auth } from "@/auth";
|
|
14
|
-
import { AuthError } from "@/errors";
|
|
14
|
+
import { AuthError, InvalidTokenError } from "@/errors";
|
|
15
15
|
import { HOST, PORT } from "@/setupspecs";
|
|
16
16
|
import { Transport } from "@/transport";
|
|
17
|
+
import { Context } from "@synnaxlabs/freighter";
|
|
18
|
+
|
|
19
|
+
const DUMMY_CTX: Context = {
|
|
20
|
+
target: "test",
|
|
21
|
+
role: "client",
|
|
22
|
+
protocol: "http",
|
|
23
|
+
params: {},
|
|
24
|
+
};
|
|
17
25
|
|
|
18
26
|
describe("auth", () => {
|
|
19
27
|
test("valid credentials", async () => {
|
|
@@ -22,8 +30,9 @@ describe("auth", () => {
|
|
|
22
30
|
username: "synnax",
|
|
23
31
|
password: "seldon",
|
|
24
32
|
});
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
const mw = client.middleware();
|
|
34
|
+
const res = await mw(DUMMY_CTX, async () => [DUMMY_CTX, null]);
|
|
35
|
+
expect(res).toEqual([DUMMY_CTX, null]);
|
|
27
36
|
});
|
|
28
37
|
|
|
29
38
|
test("invalid credentials", async () => {
|
|
@@ -32,15 +41,46 @@ describe("auth", () => {
|
|
|
32
41
|
username: "synnax",
|
|
33
42
|
password: "wrong",
|
|
34
43
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
const mw = client.middleware();
|
|
45
|
+
const [, err] = await mw(DUMMY_CTX, async () => [DUMMY_CTX, null]);
|
|
46
|
+
expect(err).toBeInstanceOf(AuthError);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe("invalid token retry", async () => {
|
|
50
|
+
it("should re-authenticate and retry the request", async () => {
|
|
51
|
+
const transport = new Transport(new URL({ host: HOST, port: PORT }));
|
|
52
|
+
const client = new auth.Client(transport.unary, {
|
|
53
|
+
username: "synnax",
|
|
54
|
+
password: "seldon",
|
|
55
|
+
});
|
|
56
|
+
const mw = client.middleware();
|
|
57
|
+
let isFirst = true;
|
|
58
|
+
let tkOne: string | undefined;
|
|
59
|
+
let tkTwo: string | undefined;
|
|
60
|
+
const [, err] = await mw(DUMMY_CTX, async (ctx) => {
|
|
61
|
+
if (isFirst) {
|
|
62
|
+
isFirst = false;
|
|
63
|
+
tkOne = client.token;
|
|
64
|
+
return [DUMMY_CTX, new InvalidTokenError()];
|
|
65
|
+
}
|
|
66
|
+
tkTwo = client.token;
|
|
67
|
+
return [DUMMY_CTX, null];
|
|
68
|
+
});
|
|
69
|
+
expect(err).toBeNull();
|
|
70
|
+
expect(tkOne).toBeDefined();
|
|
71
|
+
expect(tkTwo).toBeDefined();
|
|
72
|
+
});
|
|
73
|
+
it("should fail after MAX_RETRIES", async () => {
|
|
74
|
+
const transport = new Transport(new URL({ host: HOST, port: PORT }));
|
|
75
|
+
const client = new auth.Client(transport.unary, {
|
|
76
|
+
username: "synnax",
|
|
77
|
+
password: "seldon",
|
|
78
|
+
});
|
|
79
|
+
const mw = client.middleware();
|
|
80
|
+
const [, err] = await mw(DUMMY_CTX, async () =>
|
|
81
|
+
[DUMMY_CTX, new InvalidTokenError()]
|
|
82
|
+
);
|
|
83
|
+
expect(err).toBeInstanceOf(InvalidTokenError);
|
|
84
|
+
});
|
|
45
85
|
});
|
|
46
86
|
});
|