@synnaxlabs/client 0.22.1 → 0.23.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 -6
- package/dist/auth/auth.d.ts.map +1 -1
- package/dist/channel/client.d.ts +14 -4
- package/dist/channel/client.d.ts.map +1 -1
- package/dist/channel/creator.d.ts +1 -1
- package/dist/channel/creator.d.ts.map +1 -1
- package/dist/channel/external.d.ts +1 -1
- package/dist/channel/external.d.ts.map +1 -1
- package/dist/channel/payload.d.ts +21 -8
- package/dist/channel/payload.d.ts.map +1 -1
- package/dist/channel/retriever.d.ts +6 -6
- package/dist/channel/retriever.d.ts.map +1 -1
- package/dist/channel/writer.d.ts +13 -1
- package/dist/channel/writer.d.ts.map +1 -1
- package/dist/client.cjs +17 -18
- package/dist/client.d.ts +4 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5487 -13615
- package/dist/connection/checker.d.ts +4 -4
- package/dist/control/client.d.ts +9 -0
- package/dist/control/client.d.ts.map +1 -0
- package/dist/control/external.d.ts +1 -1
- package/dist/control/external.d.ts.map +1 -1
- package/dist/control/state.d.ts +17 -52
- package/dist/control/state.d.ts.map +1 -1
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/framer/adapter.d.ts +1 -1
- package/dist/framer/adapter.d.ts.map +1 -1
- package/dist/framer/client.d.ts +7 -5
- package/dist/framer/client.d.ts.map +1 -1
- package/dist/framer/deleter.d.ts +68 -0
- package/dist/framer/deleter.d.ts.map +1 -0
- package/dist/framer/deleter.spec.d.ts +2 -0
- package/dist/framer/deleter.spec.d.ts.map +1 -0
- package/dist/framer/frame.d.ts +45 -241
- package/dist/framer/frame.d.ts.map +1 -1
- package/dist/framer/iterator.d.ts +1 -1
- package/dist/framer/iterator.d.ts.map +1 -1
- package/dist/framer/streamProxy.d.ts.map +1 -1
- package/dist/framer/streamer.d.ts.map +1 -1
- package/dist/framer/writer.d.ts +86 -231
- package/dist/framer/writer.d.ts.map +1 -1
- package/dist/hardware/device/client.d.ts +9 -7
- package/dist/hardware/device/client.d.ts.map +1 -1
- package/dist/hardware/task/client.d.ts +17 -14
- package/dist/hardware/task/client.d.ts.map +1 -1
- package/dist/index.d.ts +12 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/label/client.d.ts.map +1 -1
- package/dist/label/external.d.ts +2 -2
- package/dist/label/external.d.ts.map +1 -1
- package/dist/label/writer.d.ts +4 -2
- package/dist/label/writer.d.ts.map +1 -1
- package/dist/ontology/client.d.ts +8 -8
- package/dist/ontology/client.d.ts.map +1 -1
- package/dist/ontology/group/client.d.ts +1 -1
- package/dist/ontology/group/client.d.ts.map +1 -1
- package/dist/ontology/group/external.d.ts +1 -1
- package/dist/ontology/group/external.d.ts.map +1 -1
- package/dist/ontology/group/writer.d.ts +1 -1
- package/dist/ontology/group/writer.d.ts.map +1 -1
- package/dist/ontology/payload.d.ts +14 -26
- package/dist/ontology/payload.d.ts.map +1 -1
- package/dist/ontology/writer.d.ts.map +1 -1
- package/dist/ranger/active.d.ts +1 -1
- package/dist/ranger/active.d.ts.map +1 -1
- package/dist/ranger/alias.d.ts.map +1 -1
- package/dist/ranger/client.d.ts +16 -100
- package/dist/ranger/client.d.ts.map +1 -1
- package/dist/ranger/external.d.ts +2 -2
- package/dist/ranger/external.d.ts.map +1 -1
- package/dist/ranger/kv.d.ts.map +1 -1
- package/dist/ranger/payload.d.ts +34 -270
- package/dist/ranger/payload.d.ts.map +1 -1
- package/dist/ranger/range.d.ts +1 -1
- package/dist/ranger/range.d.ts.map +1 -1
- package/dist/ranger/writer.d.ts.map +1 -1
- package/dist/transport.d.ts.map +1 -1
- package/dist/util/retrieve.d.ts.map +1 -1
- package/dist/util/zod.d.ts.map +1 -1
- package/dist/workspace/client.d.ts.map +1 -1
- package/dist/workspace/external.d.ts +1 -1
- package/dist/workspace/external.d.ts.map +1 -1
- package/dist/workspace/lineplot/client.d.ts +1 -1
- package/dist/workspace/lineplot/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/external.d.ts +1 -1
- package/dist/workspace/lineplot/external.d.ts.map +1 -1
- package/dist/workspace/lineplot/payload.d.ts +2 -2
- package/dist/workspace/lineplot/retriever.d.ts.map +1 -1
- package/dist/workspace/lineplot/writer.d.ts +4 -4
- package/dist/workspace/lineplot/writer.d.ts.map +1 -1
- package/dist/workspace/payload.d.ts +6 -4
- package/dist/workspace/payload.d.ts.map +1 -1
- package/dist/workspace/retriever.d.ts.map +1 -1
- package/dist/workspace/schematic/client.d.ts.map +1 -1
- package/dist/workspace/schematic/external.d.ts +1 -1
- package/dist/workspace/schematic/external.d.ts.map +1 -1
- package/dist/workspace/schematic/payload.d.ts +2 -2
- package/dist/workspace/schematic/retriever.d.ts +1 -1
- package/dist/workspace/schematic/retriever.d.ts.map +1 -1
- package/dist/workspace/schematic/writer.d.ts +4 -4
- package/dist/workspace/schematic/writer.d.ts.map +1 -1
- package/dist/workspace/writer.d.ts +7 -5
- package/dist/workspace/writer.d.ts.map +1 -1
- package/eslint.config.js +12 -0
- package/examples/node/basicReadWrite.js +11 -2
- package/examples/node/liveStream.js +13 -4
- package/examples/node/seriesAndFrames.js +12 -3
- package/examples/node/streamWrite.js +15 -6
- package/package.json +11 -8
- package/src/auth/auth.spec.ts +7 -6
- package/src/auth/auth.ts +17 -13
- package/src/auth/index.ts +1 -1
- package/src/channel/batchRetriever.spec.ts +16 -5
- package/src/channel/channel.spec.ts +42 -4
- package/src/channel/client.ts +26 -9
- package/src/channel/creator.ts +2 -2
- package/src/channel/external.ts +2 -2
- package/src/channel/index.ts +1 -1
- package/src/channel/payload.ts +3 -1
- package/src/channel/retriever.ts +6 -4
- package/src/channel/writer.ts +23 -4
- package/src/client.ts +5 -3
- package/src/connection/checker.ts +1 -1
- package/src/connection/connection.spec.ts +1 -1
- package/src/connection/index.ts +1 -1
- package/src/control/client.ts +17 -0
- package/src/control/external.ts +2 -2
- package/src/control/index.ts +1 -1
- package/src/control/state.spec.ts +2 -3
- package/src/control/state.ts +20 -84
- package/src/errors.ts +18 -7
- package/src/framer/adapter.spec.ts +9 -0
- package/src/framer/adapter.ts +3 -3
- package/src/framer/client.spec.ts +1 -1
- package/src/framer/client.ts +30 -12
- package/src/framer/deleter.spec.ts +129 -0
- package/src/framer/deleter.ts +49 -0
- package/src/framer/external.ts +1 -1
- package/src/framer/frame.spec.ts +1 -1
- package/src/framer/frame.ts +14 -14
- package/src/framer/index.ts +1 -1
- package/src/framer/iterator.spec.ts +2 -2
- package/src/framer/iterator.ts +2 -2
- package/src/framer/streamProxy.ts +2 -4
- package/src/framer/streamer.spec.ts +2 -2
- package/src/framer/streamer.ts +6 -5
- package/src/framer/writer.spec.ts +18 -1
- package/src/framer/writer.ts +19 -27
- package/src/hardware/device/client.ts +2 -2
- package/src/hardware/device/index.ts +1 -1
- package/src/hardware/external.ts +1 -1
- package/src/hardware/index.ts +1 -1
- package/src/hardware/rack/rack.spec.ts +1 -1
- package/src/hardware/task/client.ts +3 -3
- package/src/hardware/task/task.spec.ts +2 -2
- package/src/index.ts +26 -25
- package/src/label/client.ts +2 -2
- package/src/label/external.ts +3 -3
- package/src/label/index.ts +1 -1
- package/src/label/label.spec.ts +1 -1
- package/src/label/payload.ts +1 -1
- package/src/label/retriever.ts +1 -1
- package/src/label/writer.ts +1 -1
- package/src/ontology/client.ts +7 -7
- package/src/ontology/external.ts +1 -1
- package/src/ontology/group/client.ts +3 -3
- package/src/ontology/group/external.ts +2 -2
- package/src/ontology/group/group.spec.ts +2 -2
- package/src/ontology/group/group.ts +1 -1
- package/src/ontology/group/index.ts +1 -1
- package/src/ontology/group/payload.ts +1 -1
- package/src/ontology/group/writer.ts +22 -6
- package/src/ontology/index.ts +1 -1
- package/src/ontology/ontology.spec.ts +2 -2
- package/src/ontology/payload.ts +3 -3
- package/src/ontology/writer.ts +2 -2
- package/src/ranger/active.ts +2 -2
- package/src/ranger/alias.ts +2 -2
- package/src/ranger/client.ts +15 -16
- package/src/ranger/external.ts +3 -3
- package/src/ranger/index.ts +1 -1
- package/src/ranger/kv.ts +2 -2
- package/src/ranger/payload.ts +1 -1
- package/src/ranger/range.ts +2 -2
- package/src/ranger/ranger.spec.ts +1 -1
- package/src/ranger/writer.ts +3 -3
- package/src/setupspecs.ts +1 -1
- package/src/signals/external.ts +1 -1
- package/src/signals/index.ts +1 -1
- package/src/signals/observable.ts +1 -1
- package/src/transport.ts +2 -2
- package/src/user/index.ts +1 -1
- package/src/user/payload.ts +1 -1
- package/src/util/retrieve.spec.ts +1 -1
- package/src/util/retrieve.ts +1 -1
- package/src/util/telem.ts +1 -1
- package/src/util/zod.ts +9 -0
- package/src/vite-env.d.ts +2 -2
- package/src/workspace/client.ts +2 -2
- package/src/workspace/external.ts +2 -2
- package/src/workspace/index.ts +1 -1
- package/src/workspace/lineplot/client.ts +2 -2
- package/src/workspace/lineplot/external.ts +2 -2
- package/src/workspace/lineplot/index.ts +1 -1
- package/src/workspace/lineplot/linePlot.spec.ts +2 -2
- package/src/workspace/lineplot/payload.ts +1 -1
- package/src/workspace/lineplot/retriever.ts +4 -10
- package/src/workspace/lineplot/writer.ts +4 -4
- package/src/workspace/payload.ts +3 -6
- package/src/workspace/retriever.ts +4 -8
- package/src/workspace/schematic/client.ts +2 -2
- package/src/workspace/schematic/external.ts +2 -2
- package/src/workspace/schematic/index.ts +1 -1
- package/src/workspace/schematic/payload.ts +1 -1
- package/src/workspace/schematic/retriever.ts +17 -18
- package/src/workspace/schematic/schematic.spec.ts +2 -2
- package/src/workspace/schematic/writer.ts +5 -5
- package/src/workspace/workspace.spec.ts +2 -2
- package/src/workspace/writer.ts +3 -3
- package/vite.config.ts +3 -4
- package/.eslintrc.cjs +0 -18
- package/dist/client.cjs.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/control/authority.d.ts +0 -8
- package/dist/control/authority.d.ts.map +0 -1
- package/src/control/authority.ts +0 -26
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Key, Params, Schematic } from './payload';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { UnknownRecord } from '@synnaxlabs/x/record';
|
|
4
4
|
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
@@ -10,12 +10,12 @@ export declare const newSchematicZ: z.ZodEffects<z.ZodObject<{
|
|
|
10
10
|
snapshot: z.ZodOptional<z.ZodBoolean>;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
12
|
name: string;
|
|
13
|
-
data:
|
|
13
|
+
data: UnknownRecord | Record<string | number | symbol, unknown>;
|
|
14
14
|
key?: string | undefined;
|
|
15
15
|
snapshot?: boolean | undefined;
|
|
16
16
|
}, {
|
|
17
17
|
name: string;
|
|
18
|
-
data:
|
|
18
|
+
data: string | Record<string | number | symbol, unknown>;
|
|
19
19
|
key?: string | undefined;
|
|
20
20
|
snapshot?: boolean | undefined;
|
|
21
21
|
}>, {
|
|
@@ -25,7 +25,7 @@ export declare const newSchematicZ: z.ZodEffects<z.ZodObject<{
|
|
|
25
25
|
snapshot?: boolean | undefined;
|
|
26
26
|
}, {
|
|
27
27
|
name: string;
|
|
28
|
-
data:
|
|
28
|
+
data: string | Record<string | number | symbol, unknown>;
|
|
29
29
|
key?: string | undefined;
|
|
30
30
|
snapshot?: boolean | undefined;
|
|
31
31
|
}>;
|
|
@@ -1 +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,
|
|
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,EACL,KAAK,GAAG,EAER,KAAK,MAAM,EACX,KAAK,SAAS,EAGf,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"}
|
|
@@ -9,11 +9,11 @@ declare const newWorkspaceZ: z.ZodEffects<z.ZodObject<{
|
|
|
9
9
|
layout: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
name: string;
|
|
12
|
-
layout:
|
|
12
|
+
layout: UnknownRecord | Record<string | number | symbol, unknown>;
|
|
13
13
|
key?: string | undefined;
|
|
14
14
|
}, {
|
|
15
15
|
name: string;
|
|
16
|
-
layout:
|
|
16
|
+
layout: string | Record<string | number | symbol, unknown>;
|
|
17
17
|
key?: string | undefined;
|
|
18
18
|
}>, {
|
|
19
19
|
layout: string;
|
|
@@ -21,16 +21,18 @@ declare const newWorkspaceZ: z.ZodEffects<z.ZodObject<{
|
|
|
21
21
|
key?: string | undefined;
|
|
22
22
|
}, {
|
|
23
23
|
name: string;
|
|
24
|
-
layout:
|
|
24
|
+
layout: string | Record<string | number | symbol, unknown>;
|
|
25
25
|
key?: string | undefined;
|
|
26
26
|
}>;
|
|
27
27
|
export type NewWorkspace = z.input<typeof newWorkspaceZ>;
|
|
28
28
|
declare const createResZ: z.ZodObject<{
|
|
29
|
-
workspaces: z.ZodArray<z.ZodObject<{
|
|
29
|
+
workspaces: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
30
30
|
name: z.ZodString;
|
|
31
31
|
key: z.ZodString;
|
|
32
|
+
layout: z.ZodUnion<[z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>, z.ZodEffects<z.ZodString, UnknownRecord, string>]>;
|
|
33
|
+
}, "layout">, {
|
|
32
34
|
layout: z.ZodEffects<z.ZodString, UnknownRecord, string>;
|
|
33
|
-
}
|
|
35
|
+
}>, "strip", z.ZodTypeAny, {
|
|
34
36
|
name: string;
|
|
35
37
|
key: string;
|
|
36
38
|
layout: UnknownRecord;
|
|
@@ -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,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,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,EAEL,KAAK,SAAS,EAGf,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"}
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
10
|
+
import synnaxConfig from "eslint-config-synnaxlabs";
|
|
11
|
+
|
|
12
|
+
export default synnaxConfig;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
1
10
|
import { DataType, Synnax, TimeRange, TimeSpan, TimeStamp } from "@synnaxlabs/client";
|
|
2
11
|
|
|
3
12
|
// This example demonstrates the basics of reading and writing data from an index and data
|
|
@@ -32,7 +41,7 @@ const indexChannel = await client.channels.create({
|
|
|
32
41
|
|
|
33
42
|
const N_SAMPLES = 5000;
|
|
34
43
|
|
|
35
|
-
// We'll start our write at the current time. This timestamp should be the same as or
|
|
44
|
+
// We'll start our write at the current time. This timestamp should be the same as or
|
|
36
45
|
// just before the first timestamp we write.
|
|
37
46
|
const start = TimeStamp.now();
|
|
38
47
|
|
|
@@ -64,4 +73,4 @@ console.log({
|
|
|
64
73
|
});
|
|
65
74
|
|
|
66
75
|
// Make sure to close the client when you're done.
|
|
67
|
-
client.close();
|
|
76
|
+
client.close();
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
1
10
|
import { Synnax, TimeStamp } from "@synnaxlabs/client";
|
|
2
11
|
|
|
3
12
|
// This example demonstrates how to stream live data from a channel in Synnax.
|
|
@@ -19,18 +28,18 @@ const client = new Synnax({
|
|
|
19
28
|
|
|
20
29
|
// We can just specify the names of the channels we'd like to stream from.
|
|
21
30
|
const read_from = [
|
|
22
|
-
"stream_write_example_time",
|
|
23
|
-
"stream_write_example_data_1",
|
|
31
|
+
"stream_write_example_time",
|
|
32
|
+
"stream_write_example_data_1",
|
|
24
33
|
"stream_write_example_data_2"
|
|
25
34
|
]
|
|
26
35
|
|
|
27
36
|
const streamer = await client.openStreamer(read_from);
|
|
28
37
|
|
|
29
|
-
// It's very important that we close the streamer when we're done with it to release
|
|
38
|
+
// It's very important that we close the streamer when we're done with it to release
|
|
30
39
|
// network connections and other resources, so we wrap the streaming loop in a try-finally
|
|
31
40
|
// block.
|
|
32
41
|
try {
|
|
33
|
-
// Loop through the frames in the streamer. Each iteration will block until a new
|
|
42
|
+
// Loop through the frames in the streamer. Each iteration will block until a new
|
|
34
43
|
// frame is available, and then we'll just print out the last sample for each
|
|
35
44
|
// channel in the frame.
|
|
36
45
|
for await (const frame of streamer) console.log(frame.at(-1));
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
1
10
|
import { Series } from "@synnaxlabs/client";
|
|
2
11
|
|
|
3
|
-
// Construct a series from an array of numbers. In this case, the series will
|
|
12
|
+
// Construct a series from an array of numbers. In this case, the series will
|
|
4
13
|
// automatically be of type float64.
|
|
5
14
|
let series = new Series([1, 2, 3, 4, 5]);
|
|
6
15
|
|
|
@@ -159,5 +168,5 @@ frame = new Frame({
|
|
|
159
168
|
try {
|
|
160
169
|
obj = frame.at(3, true); // Throws an error
|
|
161
170
|
} catch (e) {
|
|
162
|
-
console.log(e.message); // no value at index
|
|
163
|
-
}
|
|
171
|
+
console.log(e.message); // no value at index
|
|
172
|
+
}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
1
10
|
// This example demonstrates how to write data to an index channel and its corresponding
|
|
2
11
|
// data channel in Synnax in a streaming fashion. Streaming data is ideal for live
|
|
3
12
|
// applications (such as data acquisition from a sensor) or for very large datasets that
|
|
@@ -35,20 +44,20 @@ const dataChannel2 = await client.channels.create({
|
|
|
35
44
|
}, { retrieveIfNameExists: true });
|
|
36
45
|
|
|
37
46
|
|
|
38
|
-
// We'll start our write at the current time. This timestamps should be the same as or
|
|
47
|
+
// We'll start our write at the current time. This timestamps should be the same as or
|
|
39
48
|
// just before the first timestamp we write.
|
|
40
49
|
const start = TimeStamp.now();
|
|
41
50
|
|
|
42
|
-
// Set a rough rate of 20 Hz. This won't be exact because we're sleeping for a fixed
|
|
51
|
+
// Set a rough rate of 20 Hz. This won't be exact because we're sleeping for a fixed
|
|
43
52
|
// amount of time, but it's close enough for demonstration purposes.
|
|
44
53
|
const roughRate = Rate.hz(25);
|
|
45
54
|
|
|
46
|
-
// Make the writer commit every 500 samples. This will make the data available for
|
|
55
|
+
// Make the writer commit every 500 samples. This will make the data available for
|
|
47
56
|
// historical reads every 500 samples.
|
|
48
57
|
const commitInterval = 500;
|
|
49
58
|
|
|
50
59
|
const writer = await client.openWriter({
|
|
51
|
-
start,
|
|
60
|
+
start,
|
|
52
61
|
channels: [timeChannel.key, dataChannel1.key, dataChannel2.key],
|
|
53
62
|
});
|
|
54
63
|
|
|
@@ -66,9 +75,9 @@ try {
|
|
|
66
75
|
[dataChannel2.key]: data2,
|
|
67
76
|
});
|
|
68
77
|
|
|
69
|
-
if (i % 60 == 0)
|
|
78
|
+
if (i % 60 == 0)
|
|
70
79
|
console.log(`Writing sample ${i} at ${timestamp.toISOString()}`)
|
|
71
|
-
|
|
80
|
+
|
|
72
81
|
// Commit the writer. This method will return false if the commit fails i.e.
|
|
73
82
|
// we've mad an invalid write or someone has already written to this region.
|
|
74
83
|
if (i % commitInterval == 0 && !await writer.commit()) {
|
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.23.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",
|
|
@@ -17,21 +17,24 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"async-mutex": "^0.5.0",
|
|
20
|
-
"nanoid": "^
|
|
21
|
-
"zod": "3.
|
|
22
|
-
"@synnaxlabs/
|
|
23
|
-
"@synnaxlabs/
|
|
20
|
+
"nanoid": "^3.0.0",
|
|
21
|
+
"zod": "3.23.8",
|
|
22
|
+
"@synnaxlabs/freighter": "0.23.0",
|
|
23
|
+
"@synnaxlabs/x": "0.23.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^20.12.7",
|
|
27
27
|
"@vitest/coverage-v8": "^1.5.0",
|
|
28
28
|
"eslint": "^9.0.0",
|
|
29
29
|
"typescript": "^5.4.5",
|
|
30
|
-
"vite": "5.2.
|
|
30
|
+
"vite": "5.2.11",
|
|
31
31
|
"vitest": "^1.5.0",
|
|
32
32
|
"@synnaxlabs/tsconfig": "0.0.2",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"@synnaxlabs/vite-plugin": "0.0.1",
|
|
34
|
+
"eslint-config-synnaxlabs": "0.0.1"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"zod": "^3.23.8"
|
|
35
38
|
},
|
|
36
39
|
"main": "dist/client.cjs",
|
|
37
40
|
"module": "dist/client.js",
|
package/src/auth/auth.spec.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,6 +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 { Context } from "@synnaxlabs/freighter";
|
|
10
11
|
import { URL } from "@synnaxlabs/x/url";
|
|
11
12
|
import { describe, expect, it, test } from "vitest";
|
|
12
13
|
|
|
@@ -14,7 +15,6 @@ import { auth } from "@/auth";
|
|
|
14
15
|
import { AuthError, InvalidTokenError } from "@/errors";
|
|
15
16
|
import { HOST, PORT } from "@/setupspecs";
|
|
16
17
|
import { Transport } from "@/transport";
|
|
17
|
-
import { Context } from "@synnaxlabs/freighter";
|
|
18
18
|
|
|
19
19
|
const DUMMY_CTX: Context = {
|
|
20
20
|
target: "test",
|
|
@@ -57,7 +57,7 @@ describe("auth", () => {
|
|
|
57
57
|
let isFirst = true;
|
|
58
58
|
let tkOne: string | undefined;
|
|
59
59
|
let tkTwo: string | undefined;
|
|
60
|
-
const [, err] = await mw(DUMMY_CTX, async (
|
|
60
|
+
const [, err] = await mw(DUMMY_CTX, async () => {
|
|
61
61
|
if (isFirst) {
|
|
62
62
|
isFirst = false;
|
|
63
63
|
tkOne = client.token;
|
|
@@ -77,9 +77,10 @@ describe("auth", () => {
|
|
|
77
77
|
password: "seldon",
|
|
78
78
|
});
|
|
79
79
|
const mw = client.middleware();
|
|
80
|
-
const [, err] = await mw(DUMMY_CTX, async () =>
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
const [, err] = await mw(DUMMY_CTX, async () => [
|
|
81
|
+
DUMMY_CTX,
|
|
82
|
+
new InvalidTokenError(),
|
|
83
|
+
]);
|
|
83
84
|
expect(err).toBeInstanceOf(InvalidTokenError);
|
|
84
85
|
});
|
|
85
86
|
});
|
package/src/auth/auth.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -50,19 +50,23 @@ export class Client {
|
|
|
50
50
|
const mw: Middleware = async (reqCtx, next) => {
|
|
51
51
|
if (!this.authenticated && !reqCtx.target.endsWith(LOGIN_ENDPOINT)) {
|
|
52
52
|
if (this.authenticating == null)
|
|
53
|
-
this.authenticating = new Promise(
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
this.authenticating = new Promise((resolve, reject) => {
|
|
54
|
+
this.client
|
|
55
|
+
.send(
|
|
56
|
+
LOGIN_ENDPOINT,
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
this.credentials,
|
|
59
|
+
insecureCredentialsZ,
|
|
60
|
+
tokenResponseZ,
|
|
61
|
+
)
|
|
62
|
+
.then(([res, err]) => {
|
|
63
|
+
if (err != null) return resolve(err);
|
|
64
|
+
this.token = res?.token;
|
|
65
|
+
this.user = res?.user;
|
|
66
|
+
this.authenticated = true;
|
|
67
|
+
resolve(null);
|
|
68
|
+
})
|
|
69
|
+
.catch(reject);
|
|
66
70
|
});
|
|
67
71
|
const err = await this.authenticating;
|
|
68
72
|
if (err != null) return [reqCtx, err];
|
package/src/auth/index.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
1
10
|
import { DataType, Rate } from "@synnaxlabs/x/telem";
|
|
2
11
|
import { describe, expect, it, vi } from "vitest";
|
|
3
12
|
|
|
4
13
|
import { type Params, type Payload } from "@/channel/payload";
|
|
5
14
|
import {
|
|
15
|
+
analyzeChannelParams,
|
|
6
16
|
DebouncedBatchRetriever,
|
|
7
|
-
type Retriever,
|
|
8
17
|
type RetrieveOptions,
|
|
9
|
-
|
|
18
|
+
type Retriever,
|
|
10
19
|
} from "@/channel/retriever";
|
|
11
20
|
|
|
12
21
|
class MockRetriever implements Retriever {
|
|
@@ -18,11 +27,11 @@ class MockRetriever implements Retriever {
|
|
|
18
27
|
this.func = func;
|
|
19
28
|
}
|
|
20
29
|
|
|
21
|
-
async search(
|
|
30
|
+
async search(): Promise<Payload[]> {
|
|
22
31
|
throw new Error("Method not implemented.");
|
|
23
32
|
}
|
|
24
33
|
|
|
25
|
-
async page(
|
|
34
|
+
async page(): Promise<Payload[]> {
|
|
26
35
|
throw new Error("Method not implemented.");
|
|
27
36
|
}
|
|
28
37
|
|
|
@@ -41,6 +50,7 @@ describe("channelRetriever", () => {
|
|
|
41
50
|
key: key as number,
|
|
42
51
|
name: `channel-${key}`,
|
|
43
52
|
dataType: DataType.FLOAT32,
|
|
53
|
+
internal: false,
|
|
44
54
|
isIndex: false,
|
|
45
55
|
rate: Rate.hz(1),
|
|
46
56
|
leaseholder: 1,
|
|
@@ -66,6 +76,7 @@ describe("channelRetriever", () => {
|
|
|
66
76
|
key: key as number,
|
|
67
77
|
name: `channel-${key}`,
|
|
68
78
|
dataType: DataType.FLOAT32,
|
|
79
|
+
internal: false,
|
|
69
80
|
isIndex: false,
|
|
70
81
|
rate: Rate.hz(1),
|
|
71
82
|
leaseholder: 1,
|
|
@@ -83,7 +94,7 @@ describe("channelRetriever", () => {
|
|
|
83
94
|
expect(res.map((r) => r.map((c) => c.key))).toEqual([[1], [2], [1, 2]]);
|
|
84
95
|
});
|
|
85
96
|
it("should throw an error if the fetch fails", async () => {
|
|
86
|
-
const base = new MockRetriever(async (
|
|
97
|
+
const base = new MockRetriever(async (): Promise<Payload[]> => {
|
|
87
98
|
throw new Error("failed to fetch");
|
|
88
99
|
});
|
|
89
100
|
const retriever = new DebouncedBatchRetriever(base, 10);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { DataType, Rate, TimeStamp } from "@synnaxlabs/x/telem";
|
|
11
|
-
import { describe, expect,
|
|
11
|
+
import { describe, expect, it, test } from "vitest";
|
|
12
12
|
|
|
13
13
|
import { Channel } from "@/channel/client";
|
|
14
14
|
import { NotFoundError, QueryError } from "@/errors";
|
|
@@ -87,8 +87,7 @@ describe("Channel", () => {
|
|
|
87
87
|
dataType: DataType.FLOAT32,
|
|
88
88
|
index: timeIndexChannel.key,
|
|
89
89
|
});
|
|
90
|
-
|
|
91
|
-
const sensors = await client.channels.create([sensorOne, sensorTwo, sensorThree]);
|
|
90
|
+
await client.channels.create([sensorOne, sensorTwo, sensorThree]);
|
|
92
91
|
});
|
|
93
92
|
describe("retrieveIfNameExists", () => {
|
|
94
93
|
it("should retrieve the existing channel when it exists", async () => {
|
|
@@ -220,4 +219,43 @@ describe("Channel", () => {
|
|
|
220
219
|
).rejects.toThrow(QueryError);
|
|
221
220
|
});
|
|
222
221
|
});
|
|
222
|
+
describe("rename", async () => {
|
|
223
|
+
test("single rename", async () => {
|
|
224
|
+
const channel = await client.channels.create({
|
|
225
|
+
name: "test",
|
|
226
|
+
leaseholder: 1,
|
|
227
|
+
rate: Rate.hz(1),
|
|
228
|
+
dataType: DataType.FLOAT32,
|
|
229
|
+
});
|
|
230
|
+
await client.channels.rename(channel.key, "test2");
|
|
231
|
+
const renamed = await client.channels.retrieve(channel.key);
|
|
232
|
+
expect(renamed.name).toEqual("test2");
|
|
233
|
+
});
|
|
234
|
+
test("multiple rename", async () => {
|
|
235
|
+
const channels = await client.channels.create([
|
|
236
|
+
{
|
|
237
|
+
name: "test1",
|
|
238
|
+
leaseholder: 1,
|
|
239
|
+
rate: Rate.hz(1),
|
|
240
|
+
dataType: DataType.FLOAT32,
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: "test2",
|
|
244
|
+
leaseholder: 1,
|
|
245
|
+
rate: Rate.hz(1),
|
|
246
|
+
dataType: DataType.FLOAT32,
|
|
247
|
+
},
|
|
248
|
+
]);
|
|
249
|
+
await client.channels.rename(
|
|
250
|
+
[channels[0].key, channels[1].key],
|
|
251
|
+
["test3", "test4"],
|
|
252
|
+
);
|
|
253
|
+
const renamed = await client.channels.retrieve([
|
|
254
|
+
channels[0].key,
|
|
255
|
+
channels[1].key,
|
|
256
|
+
]);
|
|
257
|
+
expect(renamed[0].name).toEqual("test3");
|
|
258
|
+
expect(renamed[1].name).toEqual("test4");
|
|
259
|
+
});
|
|
260
|
+
});
|
|
223
261
|
});
|
package/src/channel/client.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -10,35 +10,34 @@
|
|
|
10
10
|
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
11
|
import { type AsyncTermSearcher } from "@synnaxlabs/x/search";
|
|
12
12
|
import {
|
|
13
|
-
DataType,
|
|
14
|
-
Rate,
|
|
15
|
-
type TypedArray,
|
|
16
13
|
type CrudeDensity,
|
|
17
|
-
type TimeRange,
|
|
18
14
|
type CrudeTimeStamp,
|
|
15
|
+
DataType,
|
|
19
16
|
type MultiSeries,
|
|
17
|
+
Rate,
|
|
18
|
+
type TimeRange,
|
|
19
|
+
type TypedArray,
|
|
20
20
|
} from "@synnaxlabs/x/telem";
|
|
21
21
|
import { toArray } from "@synnaxlabs/x/toArray";
|
|
22
22
|
|
|
23
23
|
import {
|
|
24
24
|
type Key,
|
|
25
25
|
type KeyOrName,
|
|
26
|
+
type NewPayload,
|
|
26
27
|
type Params,
|
|
27
28
|
type Payload,
|
|
28
29
|
payload,
|
|
29
|
-
type NewPayload,
|
|
30
30
|
} from "@/channel/payload";
|
|
31
31
|
import {
|
|
32
32
|
analyzeChannelParams,
|
|
33
33
|
CacheRetriever,
|
|
34
34
|
ClusterRetriever,
|
|
35
35
|
DebouncedBatchRetriever,
|
|
36
|
-
type Retriever,
|
|
37
|
-
type PageOptions,
|
|
38
36
|
type RetrieveOptions,
|
|
37
|
+
type Retriever,
|
|
39
38
|
} from "@/channel/retriever";
|
|
40
39
|
import { type Writer } from "@/channel/writer";
|
|
41
|
-
import {
|
|
40
|
+
import { ValidationError } from "@/errors";
|
|
42
41
|
import { type framer } from "@/framer";
|
|
43
42
|
import { checkForMultipleOrNoResults } from "@/util/retrieve";
|
|
44
43
|
|
|
@@ -90,6 +89,10 @@ export class Channel {
|
|
|
90
89
|
* This is set to true if the channel is an index channel, and false otherwise.
|
|
91
90
|
*/
|
|
92
91
|
readonly isIndex: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* This is set to true if the channel is an internal channel, and false otherwise.
|
|
94
|
+
*/
|
|
95
|
+
readonly internal: boolean;
|
|
93
96
|
/**
|
|
94
97
|
* An alias for the channel under a specific range. This parameter is unstable and
|
|
95
98
|
* should not be relied upon in the current version of Synnax.
|
|
@@ -104,6 +107,7 @@ export class Channel {
|
|
|
104
107
|
key = 0,
|
|
105
108
|
isIndex = false,
|
|
106
109
|
index = 0,
|
|
110
|
+
internal = false,
|
|
107
111
|
frameClient,
|
|
108
112
|
alias,
|
|
109
113
|
}: NewPayload & {
|
|
@@ -117,6 +121,7 @@ export class Channel {
|
|
|
117
121
|
this.leaseholder = leaseholder;
|
|
118
122
|
this.index = index;
|
|
119
123
|
this.isIndex = isIndex;
|
|
124
|
+
this.internal = internal;
|
|
120
125
|
this.alias = alias;
|
|
121
126
|
this._frameClient = frameClient ?? null;
|
|
122
127
|
}
|
|
@@ -141,6 +146,7 @@ export class Channel {
|
|
|
141
146
|
leaseholder: this.leaseholder,
|
|
142
147
|
index: this.index,
|
|
143
148
|
isIndex: this.isIndex,
|
|
149
|
+
internal: this.internal,
|
|
144
150
|
});
|
|
145
151
|
}
|
|
146
152
|
|
|
@@ -328,6 +334,10 @@ export class Client implements AsyncTermSearcher<string, Key, Channel> {
|
|
|
328
334
|
return this.sugar(await this.retriever.search(term, options));
|
|
329
335
|
}
|
|
330
336
|
|
|
337
|
+
/***
|
|
338
|
+
* Deletes channels from the database using the given keys or names.
|
|
339
|
+
* @param channels - The keys or names of the channels to delete.
|
|
340
|
+
*/
|
|
331
341
|
async delete(channels: Params): Promise<void> {
|
|
332
342
|
const { normalized, variant } = analyzeChannelParams(channels);
|
|
333
343
|
if (variant === "keys")
|
|
@@ -335,6 +345,13 @@ export class Client implements AsyncTermSearcher<string, Key, Channel> {
|
|
|
335
345
|
return await this.writer.delete({ names: normalized as string[] });
|
|
336
346
|
}
|
|
337
347
|
|
|
348
|
+
async rename(key: Key, name: string): Promise<void>;
|
|
349
|
+
async rename(keys: Key[], names: string[]): Promise<void>;
|
|
350
|
+
|
|
351
|
+
async rename(keys: Key | Key[], names: string | string[]): Promise<void> {
|
|
352
|
+
return await this.writer.rename(toArray(keys), toArray(names));
|
|
353
|
+
}
|
|
354
|
+
|
|
338
355
|
newSearcherWithOptions(
|
|
339
356
|
options: RetrieveOptions,
|
|
340
357
|
): AsyncTermSearcher<string, Key, Channel> {
|
package/src/channel/creator.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import type { UnaryClient } from "@synnaxlabs/freighter";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
|
|
13
|
-
import { type
|
|
13
|
+
import { type NewPayload,newPayload, type Payload, payload } from "@/channel/payload";
|
|
14
14
|
|
|
15
15
|
const reqZ = z.object({ channels: newPayload.array() });
|
|
16
16
|
|
package/src/channel/external.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -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
|
-
export * from "@/channel/writer";
|
|
11
10
|
export * from "@/channel/client";
|
|
12
11
|
export * from "@/channel/payload";
|
|
13
12
|
export * from "@/channel/retriever";
|
|
13
|
+
export * from "@/channel/writer";
|
package/src/channel/index.ts
CHANGED