@synnaxlabs/client 0.2.1 → 0.13.6
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/.eslintrc.cjs +18 -0
- package/.pytest_cache/README.md +8 -0
- package/.turbo/turbo-build.log +16 -0
- package/LICENSE +4 -21
- package/{build/module/lib → dist/auth}/auth.d.ts +16 -19
- package/dist/auth/index.d.ts +1 -0
- package/dist/cdc/external.d.ts +1 -0
- package/dist/cdc/index.d.ts +1 -0
- package/dist/cdc/observable.d.ts +17 -0
- package/dist/channel/client.d.ts +58 -0
- package/dist/channel/creator.d.ts +8 -0
- package/dist/channel/external.d.ts +4 -0
- package/dist/channel/index.d.ts +1 -0
- package/dist/channel/payload.d.ts +63 -0
- package/dist/channel/retriever.d.ts +49 -0
- package/dist/client.cjs.js +23050 -0
- package/dist/client.cjs.js.map +1 -0
- package/dist/client.d.ts +73 -0
- package/dist/client.es.js +23050 -0
- package/dist/client.es.js.map +1 -0
- package/dist/connection/checker.d.ts +66 -0
- package/dist/connection/index.d.ts +1 -0
- package/dist/control/authority.d.ts +6 -0
- package/dist/control/external.d.ts +2 -0
- package/dist/control/index.d.ts +1 -0
- package/dist/control/state.d.ts +81 -0
- package/{build/main/lib → dist}/errors.d.ts +6 -3
- package/dist/framer/adapter.d.ts +21 -0
- package/dist/framer/client.d.ts +44 -0
- package/dist/framer/external.d.ts +5 -0
- package/dist/framer/frame.d.ts +251 -0
- package/dist/framer/index.d.ts +1 -0
- package/{build/module/lib/segment → dist/framer}/iterator.d.ts +32 -64
- package/dist/framer/streamProxy.d.ts +12 -0
- package/dist/framer/streamer.d.ts +17 -0
- package/dist/framer/writer.d.ts +257 -0
- package/dist/index.d.ts +16 -0
- package/dist/label/client.d.ts +25 -0
- package/dist/label/external.d.ts +4 -0
- package/dist/label/index.d.ts +1 -0
- package/dist/label/payload.d.ts +20 -0
- package/dist/label/retriever.d.ts +13 -0
- package/dist/label/writer.d.ts +26 -0
- package/dist/ontology/cdc.d.ts +25 -0
- package/dist/ontology/client.d.ts +25 -0
- package/dist/ontology/external.d.ts +3 -0
- package/dist/ontology/group/client.d.ts +11 -0
- package/dist/ontology/group/external.d.ts +2 -0
- package/dist/ontology/group/group.d.ts +7 -0
- package/dist/ontology/group/index.d.ts +1 -0
- package/dist/ontology/group/payload.d.ts +40 -0
- package/dist/ontology/group/writer.d.ts +13 -0
- package/dist/ontology/index.d.ts +1 -0
- package/dist/ontology/ontology.spec.d.ts +1 -0
- package/dist/ontology/payload.d.ts +235 -0
- package/dist/ontology/retriever.d.ts +12 -0
- package/dist/ontology/signals.d.ts +25 -0
- package/dist/ontology/writer.d.ts +9 -0
- package/dist/ranger/active.d.ts +9 -0
- package/dist/ranger/alias.d.ts +32 -0
- package/dist/ranger/client.d.ts +31 -0
- package/dist/ranger/external.d.ts +6 -0
- package/dist/ranger/index.d.ts +1 -0
- package/dist/ranger/kv.d.ts +50 -0
- package/dist/ranger/payload.d.ts +94 -0
- package/dist/ranger/range.d.ts +29 -0
- package/dist/ranger/ranger.spec.d.ts +1 -0
- package/dist/ranger/retriever.d.ts +10 -0
- package/dist/ranger/writer.d.ts +9 -0
- package/{build/main → dist}/setupspecs.d.ts +2 -2
- package/dist/signals/external.d.ts +1 -0
- package/dist/signals/index.d.ts +1 -0
- package/dist/signals/observable.d.ts +17 -0
- package/dist/transport.d.ts +10 -0
- package/dist/user/index.d.ts +1 -0
- package/{build/main/lib → dist}/user/payload.d.ts +3 -3
- package/dist/util/telem.d.ts +2 -0
- package/dist/workspace/client.d.ts +22 -0
- package/dist/workspace/external.d.ts +2 -0
- package/dist/workspace/index.d.ts +1 -0
- package/dist/workspace/lineplot/client.d.ts +15 -0
- package/dist/workspace/lineplot/external.d.ts +2 -0
- package/dist/workspace/lineplot/index.d.ts +1 -0
- package/dist/workspace/lineplot/linePlot.spec.d.ts +1 -0
- package/dist/workspace/lineplot/payload.d.ts +31 -0
- package/dist/workspace/lineplot/retriever.d.ts +9 -0
- package/dist/workspace/lineplot/writer.d.ts +39 -0
- package/dist/workspace/payload.d.ts +31 -0
- package/dist/workspace/pid/client.d.ts +16 -0
- package/dist/workspace/pid/external.d.ts +2 -0
- package/dist/workspace/pid/index.d.ts +1 -0
- package/dist/workspace/pid/payload.d.ts +37 -0
- package/dist/workspace/pid/pid.spec.d.ts +1 -0
- package/dist/workspace/pid/retriever.d.ts +9 -0
- package/dist/workspace/pid/writer.d.ts +46 -0
- package/dist/workspace/retriever.d.ts +12 -0
- package/dist/workspace/workspace.spec.d.ts +1 -0
- package/dist/workspace/writer.d.ts +55 -0
- package/package.json +27 -98
- package/src/auth/auth.spec.ts +46 -0
- package/src/auth/auth.ts +83 -0
- package/src/auth/index.ts +10 -0
- package/src/channel/channel.spec.ts +82 -0
- package/src/channel/client.ts +209 -0
- package/src/channel/creator.ts +43 -0
- package/src/channel/external.ts +13 -0
- package/src/channel/index.ts +10 -0
- package/src/channel/payload.ts +52 -0
- package/src/channel/retriever.ts +160 -0
- package/src/client.ts +116 -0
- package/src/connection/checker.ts +104 -0
- package/src/connection/connection.spec.ts +35 -0
- package/src/connection/index.ts +10 -0
- package/src/control/authority.ts +26 -0
- package/src/control/external.ts +11 -0
- package/src/control/index.ts +10 -0
- package/src/control/state.spec.ts +24 -0
- package/src/control/state.ts +133 -0
- package/src/errors.ts +163 -0
- package/src/framer/adapter.ts +116 -0
- package/src/framer/client.ts +116 -0
- package/src/framer/external.ts +14 -0
- package/src/framer/frame.spec.ts +317 -0
- package/src/framer/frame.ts +412 -0
- package/src/framer/index.ts +10 -0
- package/src/framer/iterator.spec.ts +62 -0
- package/src/framer/iterator.ts +240 -0
- package/src/framer/streamProxy.ts +59 -0
- package/src/framer/streamer.spec.ts +42 -0
- package/src/framer/streamer.ts +86 -0
- package/src/framer/writer.spec.ts +52 -0
- package/src/framer/writer.ts +236 -0
- package/src/index.ts +53 -0
- package/src/label/client.ts +103 -0
- package/src/label/external.ts +13 -0
- package/src/label/index.ts +10 -0
- package/src/label/label.spec.ts +51 -0
- package/src/label/payload.ts +29 -0
- package/src/label/retriever.ts +65 -0
- package/src/label/writer.ts +90 -0
- package/src/ontology/client.ts +104 -0
- package/src/ontology/external.ts +12 -0
- package/src/ontology/group/client.ts +40 -0
- package/src/ontology/group/external.ts +11 -0
- package/src/ontology/group/group.spec.ts +46 -0
- package/src/ontology/group/group.ts +27 -0
- package/src/ontology/group/index.ts +10 -0
- package/src/ontology/group/payload.ts +65 -0
- package/src/ontology/group/writer.ts +48 -0
- package/src/ontology/index.ts +10 -0
- package/src/ontology/ontology.spec.ts +114 -0
- package/src/ontology/payload.ts +118 -0
- package/src/ontology/retriever.ts +91 -0
- package/src/ontology/signals.ts +135 -0
- package/src/ontology/writer.ts +49 -0
- package/src/ranger/active.ts +56 -0
- package/src/ranger/alias.ts +183 -0
- package/src/ranger/client.ts +129 -0
- package/src/ranger/external.ts +15 -0
- package/src/ranger/index.ts +10 -0
- package/src/ranger/kv.ts +91 -0
- package/src/ranger/payload.ts +70 -0
- package/src/ranger/range.ts +95 -0
- package/src/ranger/ranger.spec.ts +201 -0
- package/src/ranger/retriever.ts +50 -0
- package/src/ranger/writer.ts +80 -0
- package/src/setupspecs.ts +25 -0
- package/src/signals/external.ts +10 -0
- package/src/signals/index.ts +10 -0
- package/src/signals/observable.ts +80 -0
- package/src/transport.ts +39 -0
- package/src/user/index.ts +10 -0
- package/src/user/payload.ts +17 -0
- package/src/util/telem.ts +19 -0
- package/src/vite-env.d.ts +11 -0
- package/src/workspace/client.ts +75 -0
- package/src/workspace/external.ts +11 -0
- package/src/workspace/index.ts +10 -0
- package/src/workspace/lineplot/client.ts +51 -0
- package/src/workspace/lineplot/external.ts +11 -0
- package/src/workspace/lineplot/index.ts +10 -0
- package/src/workspace/lineplot/linePlot.spec.ts +78 -0
- package/src/workspace/lineplot/payload.ts +29 -0
- package/src/workspace/lineplot/retriever.ts +49 -0
- package/src/workspace/lineplot/writer.ts +109 -0
- package/src/workspace/payload.ts +29 -0
- package/src/workspace/pid/client.ts +55 -0
- package/src/workspace/pid/external.ts +11 -0
- package/src/workspace/pid/index.ts +10 -0
- package/src/workspace/pid/payload.ts +31 -0
- package/src/workspace/pid/pid.spec.ts +111 -0
- package/src/workspace/pid/retriever.ts +45 -0
- package/src/workspace/pid/writer.ts +130 -0
- package/src/workspace/retriever.ts +66 -0
- package/src/workspace/workspace.spec.ts +62 -0
- package/src/workspace/writer.ts +103 -0
- package/tsconfig.json +7 -0
- package/tsconfig.vite.json +4 -0
- package/vite.config.ts +25 -0
- package/CHANGELOG.md +0 -5
- package/build/main/index.d.ts +0 -4
- package/build/main/index.js +0 -35
- package/build/main/lib/auth.d.ts +0 -54
- package/build/main/lib/auth.js +0 -62
- package/build/main/lib/auth.spec.js +0 -39
- package/build/main/lib/channel/channel.spec.js +0 -49
- package/build/main/lib/channel/client.d.ts +0 -94
- package/build/main/lib/channel/client.js +0 -134
- package/build/main/lib/channel/creator.d.ts +0 -19
- package/build/main/lib/channel/creator.js +0 -44
- package/build/main/lib/channel/payload.d.ts +0 -25
- package/build/main/lib/channel/payload.js +0 -18
- package/build/main/lib/channel/registry.d.ts +0 -9
- package/build/main/lib/channel/registry.js +0 -37
- package/build/main/lib/channel/retriever.d.ts +0 -11
- package/build/main/lib/channel/retriever.js +0 -39
- package/build/main/lib/client.d.ts +0 -30
- package/build/main/lib/client.js +0 -46
- package/build/main/lib/errors.js +0 -122
- package/build/main/lib/segment/client.d.ts +0 -62
- package/build/main/lib/segment/client.js +0 -95
- package/build/main/lib/segment/iterator.d.ts +0 -134
- package/build/main/lib/segment/iterator.js +0 -253
- package/build/main/lib/segment/iterator.spec.js +0 -73
- package/build/main/lib/segment/payload.d.ts +0 -16
- package/build/main/lib/segment/payload.js +0 -13
- package/build/main/lib/segment/splitter.d.ts +0 -7
- package/build/main/lib/segment/splitter.js +0 -25
- package/build/main/lib/segment/typed.d.ts +0 -15
- package/build/main/lib/segment/typed.js +0 -49
- package/build/main/lib/segment/validator.d.ts +0 -22
- package/build/main/lib/segment/validator.js +0 -64
- package/build/main/lib/segment/writer.d.ts +0 -98
- package/build/main/lib/segment/writer.js +0 -183
- package/build/main/lib/segment/writer.spec.js +0 -90
- package/build/main/lib/telem.d.ts +0 -395
- package/build/main/lib/telem.js +0 -553
- package/build/main/lib/telem.spec.js +0 -152
- package/build/main/lib/transport.d.ts +0 -10
- package/build/main/lib/transport.js +0 -22
- package/build/main/lib/user/payload.js +0 -9
- package/build/main/lib/util/telem.d.ts +0 -2
- package/build/main/lib/util/telem.js +0 -13
- package/build/main/setupspecs.js +0 -17
- package/build/module/index.d.ts +0 -4
- package/build/module/index.js +0 -5
- package/build/module/lib/auth.js +0 -63
- package/build/module/lib/auth.spec.js +0 -34
- package/build/module/lib/channel/channel.spec.js +0 -44
- package/build/module/lib/channel/client.d.ts +0 -94
- package/build/module/lib/channel/client.js +0 -134
- package/build/module/lib/channel/creator.d.ts +0 -19
- package/build/module/lib/channel/creator.js +0 -42
- package/build/module/lib/channel/payload.d.ts +0 -25
- package/build/module/lib/channel/payload.js +0 -15
- package/build/module/lib/channel/registry.d.ts +0 -9
- package/build/module/lib/channel/registry.js +0 -36
- package/build/module/lib/channel/retriever.d.ts +0 -11
- package/build/module/lib/channel/retriever.js +0 -37
- package/build/module/lib/client.d.ts +0 -30
- package/build/module/lib/client.js +0 -44
- package/build/module/lib/errors.d.ts +0 -53
- package/build/module/lib/errors.js +0 -113
- package/build/module/lib/segment/client.d.ts +0 -62
- package/build/module/lib/segment/client.js +0 -94
- package/build/module/lib/segment/iterator.js +0 -248
- package/build/module/lib/segment/iterator.spec.js +0 -68
- package/build/module/lib/segment/payload.d.ts +0 -16
- package/build/module/lib/segment/payload.js +0 -10
- package/build/module/lib/segment/splitter.d.ts +0 -7
- package/build/module/lib/segment/splitter.js +0 -26
- package/build/module/lib/segment/typed.d.ts +0 -15
- package/build/module/lib/segment/typed.js +0 -49
- package/build/module/lib/segment/validator.d.ts +0 -22
- package/build/module/lib/segment/validator.js +0 -60
- package/build/module/lib/segment/writer.d.ts +0 -98
- package/build/module/lib/segment/writer.js +0 -183
- package/build/module/lib/segment/writer.spec.js +0 -85
- package/build/module/lib/telem.d.ts +0 -395
- package/build/module/lib/telem.js +0 -545
- package/build/module/lib/telem.spec.js +0 -147
- package/build/module/lib/transport.d.ts +0 -10
- package/build/module/lib/transport.js +0 -22
- package/build/module/lib/user/payload.d.ts +0 -12
- package/build/module/lib/user/payload.js +0 -6
- package/build/module/lib/util/telem.d.ts +0 -2
- package/build/module/lib/util/telem.js +0 -9
- package/build/module/setupspecs.d.ts +0 -4
- package/build/module/setupspecs.js +0 -16
- /package/{build/main/lib → dist/auth}/auth.spec.d.ts +0 -0
- /package/{build/main/lib → dist}/channel/channel.spec.d.ts +0 -0
- /package/{build/main/lib/segment/iterator.spec.d.ts → dist/connection/connection.spec.d.ts} +0 -0
- /package/{build/main/lib/segment/writer.spec.d.ts → dist/control/state.spec.d.ts} +0 -0
- /package/{build/main/lib/telem.spec.d.ts → dist/framer/frame.spec.d.ts} +0 -0
- /package/{build/module/lib/segment → dist/framer}/iterator.spec.d.ts +0 -0
- /package/{build/module/lib/auth.spec.d.ts → dist/framer/streamer.spec.d.ts} +0 -0
- /package/{build/module/lib/segment → dist/framer}/writer.spec.d.ts +0 -0
- /package/{build/module/lib/channel/channel.spec.d.ts → dist/label/label.spec.d.ts} +0 -0
- /package/{build/module/lib/telem.spec.d.ts → dist/ontology/group/group.spec.d.ts} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { StreamClient } from
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
import { type StreamClient } from "@synnaxlabs/freighter";
|
|
2
|
+
import { type CrudeTimeSpan, type CrudeTimeStamp, TimeRange, TimeSpan } from "@synnaxlabs/x";
|
|
3
|
+
import { type Params } from '../channel/payload';
|
|
4
|
+
import { type Retriever } from '../channel/retriever';
|
|
5
|
+
import { Frame } from '../framer/frame';
|
|
6
|
+
export declare const AUTO_SPAN: TimeSpan;
|
|
6
7
|
/**
|
|
7
8
|
* Used to iterate over a clusters telemetry in time-order. It should not be
|
|
8
9
|
* instantiated directly, and should instead be instantiated via the SegmentClient.
|
|
@@ -11,13 +12,12 @@ import TypedSegment from './typed';
|
|
|
11
12
|
* is relatively complex and difficult to use. If you're looking to retrieve
|
|
12
13
|
* telemetry between two timestamps, see the SegmentClient.read method.
|
|
13
14
|
*/
|
|
14
|
-
export declare class
|
|
15
|
-
private static ENDPOINT;
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
constructor(client: StreamClient, aggregate?: boolean);
|
|
15
|
+
export declare class Iterator {
|
|
16
|
+
private static readonly ENDPOINT;
|
|
17
|
+
private readonly stream;
|
|
18
|
+
private readonly adapter;
|
|
19
|
+
value: Frame;
|
|
20
|
+
private constructor();
|
|
21
21
|
/**
|
|
22
22
|
* Opens the iterator, configuring it to iterate over the telemetry in the
|
|
23
23
|
* channels with the given keys within the provided time range.
|
|
@@ -25,63 +25,35 @@ export declare class CoreIterator {
|
|
|
25
25
|
* @param tr - The time range to iterate over.
|
|
26
26
|
* @param keys - The keys of the channels to iterate over.
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Reads the next segment for each channel in the iterator.
|
|
31
|
-
*
|
|
32
|
-
* @returns false if the next segment can't be found for one or more channels or
|
|
33
|
-
* the iterator has accumulated an error.
|
|
34
|
-
*/
|
|
35
|
-
next(): Promise<boolean>;
|
|
36
|
-
/**
|
|
37
|
-
* Reads the previous segment for each channel in the iterator.
|
|
38
|
-
*
|
|
39
|
-
* @returns false if the next segment can't be found for one or more channels or
|
|
40
|
-
* the iterator has accumulated an error.
|
|
41
|
-
*/
|
|
42
|
-
prev(): Promise<boolean>;
|
|
43
|
-
/**
|
|
44
|
-
* Seeks to the beginning of the time range and reads the first segment of each
|
|
45
|
-
* channel in the iterator.
|
|
46
|
-
*
|
|
47
|
-
* @returns false if no segments exists in the time range for a particular channel
|
|
48
|
-
* or the iterator has accumulated an error.
|
|
49
|
-
*/
|
|
50
|
-
first(): Promise<boolean>;
|
|
51
|
-
/**
|
|
52
|
-
* Seeks to the end of the time range and reads the last segment of each channel
|
|
53
|
-
* in the iterator.
|
|
54
|
-
*
|
|
55
|
-
* @returns false if no segments exists in the time range for a particular channel,
|
|
56
|
-
* or the iterator has accumulated an error.
|
|
57
|
-
*/
|
|
58
|
-
last(): Promise<boolean>;
|
|
28
|
+
static _open(tr: TimeRange, channels: Params, retriever: Retriever, client: StreamClient): Promise<Iterator>;
|
|
59
29
|
/**
|
|
60
30
|
* Reads the next time span of telemetry for each channel in the iterator.
|
|
61
31
|
*
|
|
32
|
+
* @param span - The time span to read. A negative span is equivalent
|
|
33
|
+
* to calling prev with the absolute value of the span. If the span is
|
|
34
|
+
* AUTO_SPAN, the iterator will automatically determine the span to read.
|
|
35
|
+
* This is useful for iterating over an entire range efficiently.
|
|
36
|
+
*
|
|
62
37
|
* @returns false if a segment satisfying the request can't be found for a
|
|
63
38
|
* particular channel or the iterator has accumulated an error.
|
|
64
39
|
*/
|
|
65
|
-
|
|
40
|
+
next(span?: CrudeTimeSpan): Promise<boolean>;
|
|
66
41
|
/**
|
|
67
42
|
* Reads the previous time span of telemetry for each channel in the iterator.
|
|
68
43
|
*
|
|
69
|
-
* @
|
|
70
|
-
*
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Seeks the iterator to the start of the time range and reads the telemetry within
|
|
75
|
-
* the range for each channel.
|
|
44
|
+
* @param span - The time span to read. A negative span is equivalent
|
|
45
|
+
* to calling next with the absolute value of the span. If the span is
|
|
46
|
+
* AUTO_SPAN, the iterator will automatically determine the span to read.
|
|
47
|
+
* This is useful for iterating over an entire range efficiently.
|
|
76
48
|
*
|
|
77
|
-
* @returns
|
|
49
|
+
* @returns false if a segment satisfying the request can't be found for a particular
|
|
78
50
|
* channel or the iterator has accumulated an error.
|
|
79
51
|
*/
|
|
80
|
-
|
|
52
|
+
prev(span?: CrudeTimeSpan): Promise<boolean>;
|
|
81
53
|
/**
|
|
82
54
|
* Seeks the iterator to the first segment in the time range, but does not read
|
|
83
55
|
* it. Also invalidates the iterator. The iterator will not be considered valid
|
|
84
|
-
* until a call to
|
|
56
|
+
* until a call to next or prev.
|
|
85
57
|
*
|
|
86
58
|
* @returns false if the iterator is not pointing to a valid segment for a particular
|
|
87
59
|
* channel or has accumulated an error.
|
|
@@ -89,7 +61,7 @@ export declare class CoreIterator {
|
|
|
89
61
|
seekFirst(): Promise<boolean>;
|
|
90
62
|
/** Seeks the iterator to the last segment in the time range, but does not read it.
|
|
91
63
|
* Also invalidates the iterator. The iterator will not be considered valid
|
|
92
|
-
* until a call to
|
|
64
|
+
* until a call to next or prev.
|
|
93
65
|
*
|
|
94
66
|
* @returns false if the iterator is not pointing to a valid segment for a particular
|
|
95
67
|
* channel or has accumulated an error.
|
|
@@ -98,21 +70,21 @@ export declare class CoreIterator {
|
|
|
98
70
|
/**
|
|
99
71
|
* Seeks the iterator to the first segment whose start is less than or equal to
|
|
100
72
|
* the provided timestamp. Also invalidates the iterator. The iterator will not be
|
|
101
|
-
* considered valid until a call to
|
|
73
|
+
* considered valid until a call to next or prev.
|
|
102
74
|
*
|
|
103
75
|
* @returns false if the iterator is not pointing to a valid segment for a particular
|
|
104
76
|
* channel or has accumulated an error.
|
|
105
77
|
*/
|
|
106
|
-
|
|
78
|
+
seekLE(stamp: CrudeTimeStamp): Promise<boolean>;
|
|
107
79
|
/**
|
|
108
80
|
* Seeks the iterator to the first segment whose start is greater than or equal to
|
|
109
81
|
* the provided timestamp. Also invalidates the iterator. The iterator will not be
|
|
110
|
-
* considered valid until a call to
|
|
82
|
+
* considered valid until a call to next or prev.
|
|
111
83
|
*
|
|
112
84
|
* @returns false if the iterator is not pointing to a valid segment for a particular
|
|
113
85
|
* channel or has accumulated an error.
|
|
114
86
|
*/
|
|
115
|
-
seekGE(stamp:
|
|
87
|
+
seekGE(stamp: CrudeTimeStamp): Promise<boolean>;
|
|
116
88
|
/**
|
|
117
89
|
* @returns true if the iterator value contains a valid segment, and fale otherwise.
|
|
118
90
|
* valid most commonly returns false when the iterator is exhausted or has
|
|
@@ -125,10 +97,6 @@ export declare class CoreIterator {
|
|
|
125
97
|
* it may leak resources.
|
|
126
98
|
*/
|
|
127
99
|
close(): Promise<void>;
|
|
100
|
+
[Symbol.asyncIterator](): AsyncIterator<Frame, any, undefined>;
|
|
128
101
|
private execute;
|
|
129
102
|
}
|
|
130
|
-
export declare class TypedIterator extends CoreIterator {
|
|
131
|
-
channels: Registry;
|
|
132
|
-
constructor(client: StreamClient, channels: Registry, aggregate?: boolean);
|
|
133
|
-
value(): Promise<Record<string, TypedSegment>>;
|
|
134
|
-
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Stream } from "@synnaxlabs/freighter";
|
|
2
|
+
import { type z } from "zod";
|
|
3
|
+
export declare class StreamProxy<RQ extends z.ZodTypeAny, RS extends z.ZodTypeAny> {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
private readonly stream;
|
|
6
|
+
constructor(name: string, stream: Stream<RQ, RS>);
|
|
7
|
+
receive(): Promise<z.output<RS>>;
|
|
8
|
+
received(): boolean;
|
|
9
|
+
closeAndAck(): Promise<void>;
|
|
10
|
+
closeSend(): void;
|
|
11
|
+
send(req: z.input<RQ>): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type StreamClient } from "@synnaxlabs/freighter";
|
|
2
|
+
import { type CrudeTimeStamp } from "@synnaxlabs/x";
|
|
3
|
+
import { type Key, type Params } from '../channel/payload';
|
|
4
|
+
import { type Retriever } from '../channel/retriever';
|
|
5
|
+
import { Frame } from '../framer/frame';
|
|
6
|
+
export declare class Streamer implements AsyncIterator<Frame>, AsyncIterable<Frame> {
|
|
7
|
+
private readonly stream;
|
|
8
|
+
private readonly adapter;
|
|
9
|
+
private constructor();
|
|
10
|
+
get keys(): Key[];
|
|
11
|
+
static _open(start: CrudeTimeStamp, channels: Params, retriever: Retriever, client: StreamClient): Promise<Streamer>;
|
|
12
|
+
next(): Promise<IteratorResult<Frame, any>>;
|
|
13
|
+
read(): Promise<Frame>;
|
|
14
|
+
update(params: Params): Promise<void>;
|
|
15
|
+
close(): void;
|
|
16
|
+
[Symbol.asyncIterator](): AsyncIterator<Frame, any, undefined>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import type { StreamClient } from "@synnaxlabs/freighter";
|
|
2
|
+
import { type NativeTypedArray, TimeStamp, type CrudeTimeStamp } from "@synnaxlabs/x";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { type Key, type KeyOrName, type Params } from '../channel/payload';
|
|
5
|
+
import { type Retriever } from '../channel/retriever';
|
|
6
|
+
import { Authority } from '../control/authority';
|
|
7
|
+
import { type Subject as ControlSubject } from '../control/state';
|
|
8
|
+
import { type CrudeFrame } from '../framer/frame';
|
|
9
|
+
declare enum Command {
|
|
10
|
+
Open = 0,
|
|
11
|
+
Write = 1,
|
|
12
|
+
Commit = 2,
|
|
13
|
+
Error = 3,
|
|
14
|
+
SetAuthority = 4
|
|
15
|
+
}
|
|
16
|
+
declare const reqZ: z.ZodObject<{
|
|
17
|
+
command: z.ZodNativeEnum<typeof Command>;
|
|
18
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
start: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodType<Number, z.ZodTypeDef, Number>, TimeStamp, Number>, z.ZodEffects<z.ZodNumber, TimeStamp, number>, z.ZodType<TimeStamp, z.ZodTypeDef, TimeStamp>]>>;
|
|
20
|
+
controlSubject: z.ZodOptional<z.ZodObject<{
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
key: z.ZodString;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
name: string;
|
|
25
|
+
key: string;
|
|
26
|
+
}, {
|
|
27
|
+
name: string;
|
|
28
|
+
key: string;
|
|
29
|
+
}>>;
|
|
30
|
+
keys: z.ZodArray<z.ZodNumber, "many">;
|
|
31
|
+
authorities: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodType<Authority, z.ZodTypeDef, Authority>, z.ZodEffects<z.ZodNumber, Authority, number>, z.ZodEffects<z.ZodType<Number, z.ZodTypeDef, Number>, Authority, Number>]>, "many">>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
keys: number[];
|
|
34
|
+
start?: TimeStamp | undefined;
|
|
35
|
+
controlSubject?: {
|
|
36
|
+
name: string;
|
|
37
|
+
key: string;
|
|
38
|
+
} | undefined;
|
|
39
|
+
authorities?: Authority[] | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
keys: number[];
|
|
42
|
+
start?: number | Number | TimeStamp | undefined;
|
|
43
|
+
controlSubject?: {
|
|
44
|
+
name: string;
|
|
45
|
+
key: string;
|
|
46
|
+
} | undefined;
|
|
47
|
+
authorities?: (number | Number | Authority)[] | undefined;
|
|
48
|
+
}>>;
|
|
49
|
+
frame: z.ZodOptional<z.ZodObject<{
|
|
50
|
+
keys: z.ZodUnion<[z.ZodEffects<z.ZodNull, number[], null>, z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>>]>;
|
|
51
|
+
series: z.ZodUnion<[z.ZodEffects<z.ZodNull, {
|
|
52
|
+
dataType: import("@synnaxlabs/x").DataType;
|
|
53
|
+
data: (ArrayBuffer | SharedArrayBuffer) & (ArrayBuffer | SharedArrayBuffer | undefined);
|
|
54
|
+
timeRange?: import("@synnaxlabs/x").TimeRange | undefined;
|
|
55
|
+
alignment?: number | undefined;
|
|
56
|
+
}[], null>, z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
57
|
+
timeRange: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
|
58
|
+
start: z.ZodUnion<[z.ZodEffects<z.ZodType<Number, z.ZodTypeDef, Number>, TimeStamp, Number>, z.ZodEffects<z.ZodNumber, TimeStamp, number>, z.ZodType<TimeStamp, z.ZodTypeDef, TimeStamp>]>;
|
|
59
|
+
end: z.ZodUnion<[z.ZodEffects<z.ZodType<Number, z.ZodTypeDef, Number>, TimeStamp, Number>, z.ZodEffects<z.ZodNumber, TimeStamp, number>, z.ZodType<TimeStamp, z.ZodTypeDef, TimeStamp>]>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
start: TimeStamp;
|
|
62
|
+
end: TimeStamp;
|
|
63
|
+
}, {
|
|
64
|
+
start: (number | Number | TimeStamp) & (number | Number | TimeStamp | undefined);
|
|
65
|
+
end: (number | Number | TimeStamp) & (number | Number | TimeStamp | undefined);
|
|
66
|
+
}>, import("@synnaxlabs/x").TimeRange, {
|
|
67
|
+
start: (number | Number | TimeStamp) & (number | Number | TimeStamp | undefined);
|
|
68
|
+
end: (number | Number | TimeStamp) & (number | Number | TimeStamp | undefined);
|
|
69
|
+
}>, z.ZodType<import("@synnaxlabs/x").TimeRange, z.ZodTypeDef, import("@synnaxlabs/x").TimeRange>]>>;
|
|
70
|
+
alignment: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
dataType: z.ZodUnion<[z.ZodEffects<z.ZodString, import("@synnaxlabs/x").DataType, string>, z.ZodType<import("@synnaxlabs/x").DataType, z.ZodTypeDef, import("@synnaxlabs/x").DataType>]>;
|
|
72
|
+
data: z.ZodEffects<z.ZodString, ArrayBuffer | SharedArrayBuffer, string>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
dataType: import("@synnaxlabs/x").DataType;
|
|
75
|
+
data: (ArrayBuffer | SharedArrayBuffer) & (ArrayBuffer | SharedArrayBuffer | undefined);
|
|
76
|
+
timeRange?: import("@synnaxlabs/x").TimeRange | undefined;
|
|
77
|
+
alignment?: number | undefined;
|
|
78
|
+
}, {
|
|
79
|
+
dataType: (string | import("@synnaxlabs/x").DataType) & (string | import("@synnaxlabs/x").DataType | undefined);
|
|
80
|
+
data: string;
|
|
81
|
+
timeRange?: import("@synnaxlabs/x").TimeRange | {
|
|
82
|
+
start: (number | Number | TimeStamp) & (number | Number | TimeStamp | undefined);
|
|
83
|
+
end: (number | Number | TimeStamp) & (number | Number | TimeStamp | undefined);
|
|
84
|
+
} | undefined;
|
|
85
|
+
alignment?: number | undefined;
|
|
86
|
+
}>, "many">>>]>;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
keys: number[];
|
|
89
|
+
series: {
|
|
90
|
+
dataType: import("@synnaxlabs/x").DataType;
|
|
91
|
+
data: (ArrayBuffer | SharedArrayBuffer) & (ArrayBuffer | SharedArrayBuffer | undefined);
|
|
92
|
+
timeRange?: import("@synnaxlabs/x").TimeRange | undefined;
|
|
93
|
+
alignment?: number | undefined;
|
|
94
|
+
}[];
|
|
95
|
+
}, {
|
|
96
|
+
keys?: number[] | null | undefined;
|
|
97
|
+
series?: {
|
|
98
|
+
dataType: (string | import("@synnaxlabs/x").DataType) & (string | import("@synnaxlabs/x").DataType | undefined);
|
|
99
|
+
data: string;
|
|
100
|
+
timeRange?: import("@synnaxlabs/x").TimeRange | {
|
|
101
|
+
start: (number | Number | TimeStamp) & (number | Number | TimeStamp | undefined);
|
|
102
|
+
end: (number | Number | TimeStamp) & (number | Number | TimeStamp | undefined);
|
|
103
|
+
} | undefined;
|
|
104
|
+
alignment?: number | undefined;
|
|
105
|
+
}[] | null | undefined;
|
|
106
|
+
}>>;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
command: Command;
|
|
109
|
+
config?: {
|
|
110
|
+
keys: number[];
|
|
111
|
+
start?: TimeStamp | undefined;
|
|
112
|
+
controlSubject?: {
|
|
113
|
+
name: string;
|
|
114
|
+
key: string;
|
|
115
|
+
} | undefined;
|
|
116
|
+
authorities?: Authority[] | undefined;
|
|
117
|
+
} | undefined;
|
|
118
|
+
frame?: {
|
|
119
|
+
keys: number[];
|
|
120
|
+
series: {
|
|
121
|
+
dataType: import("@synnaxlabs/x").DataType;
|
|
122
|
+
data: (ArrayBuffer | SharedArrayBuffer) & (ArrayBuffer | SharedArrayBuffer | undefined);
|
|
123
|
+
timeRange?: import("@synnaxlabs/x").TimeRange | undefined;
|
|
124
|
+
alignment?: number | undefined;
|
|
125
|
+
}[];
|
|
126
|
+
} | undefined;
|
|
127
|
+
}, {
|
|
128
|
+
command: Command;
|
|
129
|
+
config?: {
|
|
130
|
+
keys: number[];
|
|
131
|
+
start?: number | Number | TimeStamp | undefined;
|
|
132
|
+
controlSubject?: {
|
|
133
|
+
name: string;
|
|
134
|
+
key: string;
|
|
135
|
+
} | undefined;
|
|
136
|
+
authorities?: (number | Number | Authority)[] | undefined;
|
|
137
|
+
} | undefined;
|
|
138
|
+
frame?: {
|
|
139
|
+
keys?: number[] | null | undefined;
|
|
140
|
+
series?: {
|
|
141
|
+
dataType: (string | import("@synnaxlabs/x").DataType) & (string | import("@synnaxlabs/x").DataType | undefined);
|
|
142
|
+
data: string;
|
|
143
|
+
timeRange?: import("@synnaxlabs/x").TimeRange | {
|
|
144
|
+
start: (number | Number | TimeStamp) & (number | Number | TimeStamp | undefined);
|
|
145
|
+
end: (number | Number | TimeStamp) & (number | Number | TimeStamp | undefined);
|
|
146
|
+
} | undefined;
|
|
147
|
+
alignment?: number | undefined;
|
|
148
|
+
}[] | null | undefined;
|
|
149
|
+
} | undefined;
|
|
150
|
+
}>;
|
|
151
|
+
type Request = z.infer<typeof reqZ>;
|
|
152
|
+
declare const resZ: z.ZodObject<{
|
|
153
|
+
ack: z.ZodBoolean;
|
|
154
|
+
command: z.ZodNativeEnum<typeof Command>;
|
|
155
|
+
error: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
156
|
+
type: z.ZodString;
|
|
157
|
+
data: z.ZodString;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
type: string;
|
|
160
|
+
data: string;
|
|
161
|
+
}, {
|
|
162
|
+
type: string;
|
|
163
|
+
data: string;
|
|
164
|
+
}>>>;
|
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
command: Command;
|
|
167
|
+
ack: boolean;
|
|
168
|
+
error?: {
|
|
169
|
+
type: string;
|
|
170
|
+
data: string;
|
|
171
|
+
} | null | undefined;
|
|
172
|
+
}, {
|
|
173
|
+
command: Command;
|
|
174
|
+
ack: boolean;
|
|
175
|
+
error?: {
|
|
176
|
+
type: string;
|
|
177
|
+
data: string;
|
|
178
|
+
} | null | undefined;
|
|
179
|
+
}>;
|
|
180
|
+
type Response = z.infer<typeof resZ>;
|
|
181
|
+
export interface WriterConfig {
|
|
182
|
+
start: CrudeTimeStamp;
|
|
183
|
+
channels: Params;
|
|
184
|
+
controlSubject?: ControlSubject;
|
|
185
|
+
authorities?: Authority | Authority[];
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Writer is used to write telemetry to a set of channels in time order.
|
|
189
|
+
* It should not be instantiated directly, and should instead be instantited via the
|
|
190
|
+
* FramerClient {@link FrameClient#openWriter}.
|
|
191
|
+
*
|
|
192
|
+
* The writer is a streaming protocol that is heavily optimized for prerformance. This
|
|
193
|
+
* comes at the cost of icnreased complexity, and should only be used directly when
|
|
194
|
+
* writing large volumes of data (such as recording telemetry from a sensor or ingsting
|
|
195
|
+
* data froma file). Simpler methods (such as the frame client's write method) should
|
|
196
|
+
* be used for most use cases.
|
|
197
|
+
*
|
|
198
|
+
* The protocol is as follows:
|
|
199
|
+
*
|
|
200
|
+
* 1. The writer is opened with a starting timestamp and a list of channel keys. The
|
|
201
|
+
* writer will fail to open if the starting timstamp overlaps with any existing telemetry
|
|
202
|
+
* for any channels specified. If the writer opens successfuly, the caller is then
|
|
203
|
+
* free to write frames to the writer.
|
|
204
|
+
*
|
|
205
|
+
* 2. To write a frame, the caller can use the write method and follow the validation
|
|
206
|
+
* rules described in its method's documentation. This process is asynchronous, meaning
|
|
207
|
+
* that write calls may return before teh frame has been written to the cluster. This
|
|
208
|
+
* also means that the writer can accumulate an error after write is called. If the writer
|
|
209
|
+
* accumulates an erorr, all subsequent write and commit calls will return False. The
|
|
210
|
+
* caller can check for errors by calling the error mehtod, which returns the accumulated
|
|
211
|
+
* error and resets the writer for future use. The caller can also check for errors by
|
|
212
|
+
* closing the writer, which will throw any accumulated error.
|
|
213
|
+
*
|
|
214
|
+
* 3. To commit the written frames to the cluster, the caller can call the commit method.
|
|
215
|
+
* Unlike write, commit is synchronous, meaning that it will not return until the frames
|
|
216
|
+
* have been written to the cluster. If the writer has accumulated an erorr, commit will
|
|
217
|
+
* return false. After the caller acknowledges the erorr, they can attempt to commit again.
|
|
218
|
+
* Commit can be called several times throughout a writer's lifetime, and will only
|
|
219
|
+
* commit the frames that have been written since the last commit.
|
|
220
|
+
*
|
|
221
|
+
* 4. A writer MUST be closed after use in order to prevent resource leaks. Close should
|
|
222
|
+
* typically be called in a 'finally' block. If the writer has accumulated an error,
|
|
223
|
+
* close will throw the error.
|
|
224
|
+
*/
|
|
225
|
+
export declare class Writer {
|
|
226
|
+
private static readonly ENDPOINT;
|
|
227
|
+
private readonly stream;
|
|
228
|
+
private readonly adapter;
|
|
229
|
+
private constructor();
|
|
230
|
+
static _open(retriever: Retriever, client: StreamClient, { channels, authorities, controlSubject: subject, start, }: WriterConfig): Promise<Writer>;
|
|
231
|
+
write(channel: KeyOrName, data: NativeTypedArray): Promise<boolean>;
|
|
232
|
+
write(frame: CrudeFrame): Promise<boolean>;
|
|
233
|
+
setAuthority(value: Record<Key, Authority>): Promise<boolean>;
|
|
234
|
+
/**
|
|
235
|
+
* Commits the written frames to the database. Commit is synchronous, meaning that it
|
|
236
|
+
* will not return until all frames have been commited to the database.
|
|
237
|
+
*
|
|
238
|
+
* @returns false if the commit failed due to an error. In this case, the caller
|
|
239
|
+
* should acknowledge the error by calling the error method or closing the writer.
|
|
240
|
+
* After the caller acknowledges the error, they can attempt to commit again.
|
|
241
|
+
*/
|
|
242
|
+
commit(): Promise<boolean>;
|
|
243
|
+
/**
|
|
244
|
+
* @returns The accumulated error, if any. This method will clear the writer's error
|
|
245
|
+
* state, allowing the writer to be used again.
|
|
246
|
+
*/
|
|
247
|
+
error(): Promise<Error | null>;
|
|
248
|
+
/**
|
|
249
|
+
* Closes the writer, raising any accumulated error encountered during operation.
|
|
250
|
+
* A writer MUST be closed after use, and this method should probably be placed
|
|
251
|
+
* in a 'finally' block.
|
|
252
|
+
*/
|
|
253
|
+
close(): Promise<void>;
|
|
254
|
+
execute(req: Request): Promise<Response>;
|
|
255
|
+
private get errorAccumulated();
|
|
256
|
+
}
|
|
257
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './channel';
|
|
2
|
+
export { default as Synnax, synnaxPropsZ } from './client';
|
|
3
|
+
export type { SynnaxProps } from './client';
|
|
4
|
+
export * from './connection';
|
|
5
|
+
export { Channel } from './channel/client';
|
|
6
|
+
export { AuthError, ContiguityError, GeneralError, ParseError, QueryError, RouteError, UnexpectedError, ValidationError, } from './errors';
|
|
7
|
+
export { framer } from './framer';
|
|
8
|
+
export { Frame } from './framer/frame';
|
|
9
|
+
export { ontology } from './ontology';
|
|
10
|
+
export { control } from './control';
|
|
11
|
+
export { Authority } from './control/authority';
|
|
12
|
+
export { DataType, Density, Rate, Series, TimeRange, TimeSpan, TimeStamp, } from "@synnaxlabs/x";
|
|
13
|
+
export type { NativeTypedArray, CrudeDataType, CrudeDensity, CrudeRate, CrudeSize, CrudeTimeSpan, CrudeTimeStamp, SampleValue, TimeStampStringFormat, TZInfo, } from "@synnaxlabs/x";
|
|
14
|
+
export { workspace } from './workspace';
|
|
15
|
+
export { ranger } from './ranger';
|
|
16
|
+
export { label } from './label';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
+
import { type AsyncTermSearcher } from "@synnaxlabs/x";
|
|
3
|
+
import { type framer } from '../framer';
|
|
4
|
+
import { type Key, type Label } from '../label/payload';
|
|
5
|
+
import { type NewLabelPayload } from '../label/writer';
|
|
6
|
+
import { type ontology } from '../ontology';
|
|
7
|
+
import { signals } from '../signals';
|
|
8
|
+
export declare class Client implements AsyncTermSearcher<string, Key, Label> {
|
|
9
|
+
private readonly retriever;
|
|
10
|
+
private readonly writer;
|
|
11
|
+
private readonly frameClient;
|
|
12
|
+
constructor(client: UnaryClient, frameClient: framer.Client);
|
|
13
|
+
search(term: string): Promise<Label[]>;
|
|
14
|
+
retrieve(key: Key): Promise<Label>;
|
|
15
|
+
retrieve(keys: Key[]): Promise<Label[]>;
|
|
16
|
+
retrieveFor(id: ontology.ID): Promise<Label[]>;
|
|
17
|
+
label(id: ontology.ID, labels: Key[]): Promise<void>;
|
|
18
|
+
removeLabels(id: ontology.ID, labels: Key[]): Promise<void>;
|
|
19
|
+
page(offset: number, limit: number): Promise<Label[]>;
|
|
20
|
+
create(label: NewLabelPayload): Promise<Label>;
|
|
21
|
+
create(labels: NewLabelPayload[]): Promise<Label[]>;
|
|
22
|
+
delete(key: Key): Promise<void>;
|
|
23
|
+
delete(keys: Key[]): Promise<void>;
|
|
24
|
+
openChangeTracker(): Promise<signals.Observable<string, Label>>;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as label from '../label/external';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ontology } from '../ontology';
|
|
3
|
+
export declare const keyZ: z.ZodString;
|
|
4
|
+
export type Key = z.infer<typeof keyZ>;
|
|
5
|
+
export type Params = Key | Key[];
|
|
6
|
+
export declare const labelZ: z.ZodObject<{
|
|
7
|
+
key: z.ZodString;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
color: z.ZodString;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
name: string;
|
|
12
|
+
key: string;
|
|
13
|
+
color: string;
|
|
14
|
+
}, {
|
|
15
|
+
name: string;
|
|
16
|
+
key: string;
|
|
17
|
+
color: string;
|
|
18
|
+
}>;
|
|
19
|
+
export type Label = z.infer<typeof labelZ>;
|
|
20
|
+
export declare const ontologyID: (key: Key) => ontology.ID;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
+
import { type Label, type Params } from '../label/payload';
|
|
3
|
+
import { ontology } from '../ontology';
|
|
4
|
+
export declare class Retriever {
|
|
5
|
+
private static readonly ENDPOINT;
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: UnaryClient);
|
|
8
|
+
retrieve(params: Params): Promise<Label[]>;
|
|
9
|
+
retrieveFor(id: ontology.ID): Promise<Label[]>;
|
|
10
|
+
search(term: string): Promise<Label[]>;
|
|
11
|
+
page(offset: number, limit: number): Promise<Label[]>;
|
|
12
|
+
private execute;
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { type Key, type Label } from '../label/payload';
|
|
4
|
+
import { ontology } from '../ontology';
|
|
5
|
+
export declare const newLabelPayloadZ: z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
color: z.ZodString;
|
|
8
|
+
key: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
name: string;
|
|
11
|
+
color: string;
|
|
12
|
+
key?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
name: string;
|
|
15
|
+
color: string;
|
|
16
|
+
key?: string | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export type NewLabelPayload = z.infer<typeof newLabelPayloadZ>;
|
|
19
|
+
export declare class Writer {
|
|
20
|
+
private readonly client;
|
|
21
|
+
constructor(client: UnaryClient);
|
|
22
|
+
create(labels: NewLabelPayload | NewLabelPayload[]): Promise<Label[]>;
|
|
23
|
+
delete(keys: Key | Key[]): Promise<void>;
|
|
24
|
+
set(id: ontology.ID, labels: Key[]): Promise<void>;
|
|
25
|
+
remove(id: ontology.ID, labels: Key[]): Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { observe, type change } from "@synnaxlabs/x";
|
|
2
|
+
import { type Client as FrameClient } from '../framer/client';
|
|
3
|
+
import { type Streamer as FrameStreamer } from '../framer/streamer';
|
|
4
|
+
import { ID, type Relationship, type Resource } from '../ontology/payload';
|
|
5
|
+
import { type Retriever } from '../ontology/retriever';
|
|
6
|
+
export type ResourceChange = change.Change<ID, Resource>;
|
|
7
|
+
export type RelationshipChange = change.Change<Relationship, undefined>;
|
|
8
|
+
export declare class ChangeTracker {
|
|
9
|
+
private readonly resourceObs;
|
|
10
|
+
private readonly relationshipObs;
|
|
11
|
+
readonly relationships: observe.Observable<RelationshipChange[]>;
|
|
12
|
+
readonly resources: observe.Observable<ResourceChange[]>;
|
|
13
|
+
private readonly streamer;
|
|
14
|
+
private readonly retriever;
|
|
15
|
+
private readonly closePromise;
|
|
16
|
+
constructor(streamer: FrameStreamer, retriever: Retriever);
|
|
17
|
+
close(): Promise<void>;
|
|
18
|
+
private start;
|
|
19
|
+
private update;
|
|
20
|
+
private parseRelationshipSets;
|
|
21
|
+
private parseRelationshipDeletes;
|
|
22
|
+
private parseResourceSets;
|
|
23
|
+
private parseResourceDeletes;
|
|
24
|
+
static open(client: FrameClient, retriever: Retriever): Promise<ChangeTracker>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
+
import { type AsyncTermSearcher } from "@synnaxlabs/x";
|
|
3
|
+
import { type Client as FrameClient } from '../framer/client';
|
|
4
|
+
import { group } from '../ontology/group';
|
|
5
|
+
import { type ID, type Resource } from '../ontology/payload';
|
|
6
|
+
import { Retriever } from '../ontology/retriever';
|
|
7
|
+
import { ChangeTracker } from '../ontology/signals';
|
|
8
|
+
/** The core client class for executing queries against a Synnax cluster ontology */
|
|
9
|
+
export declare class Client implements AsyncTermSearcher<string, string, Resource> {
|
|
10
|
+
groups: group.Client;
|
|
11
|
+
retriever: Retriever;
|
|
12
|
+
private readonly writer;
|
|
13
|
+
private readonly framer;
|
|
14
|
+
constructor(unary: UnaryClient, framer: FrameClient);
|
|
15
|
+
search(term: string): Promise<Resource[]>;
|
|
16
|
+
retrieve(id: ID | string, includeSchema?: boolean, includeFieldData?: boolean): Promise<Resource>;
|
|
17
|
+
retrieve(ids: ID[] | string[], includeSchema?: boolean, includeFieldData?: boolean): Promise<Resource[]>;
|
|
18
|
+
page(offset: number, limit: number): Promise<Resource[]>;
|
|
19
|
+
retrieveChildren(IDs: ID | ID[], includeSchema?: boolean, includeFieldData?: boolean): Promise<Resource[]>;
|
|
20
|
+
retrieveParents(IDs: ID | ID[], includeSchema?: boolean, includeFieldData?: boolean): Promise<Resource[]>;
|
|
21
|
+
addChildren(id: ID, ...children: ID[]): Promise<void>;
|
|
22
|
+
removeChildren(id: ID, ...children: ID[]): Promise<void>;
|
|
23
|
+
moveChildren(from: ID, to: ID, ...children: ID[]): Promise<void>;
|
|
24
|
+
openChangeTracker(): Promise<ChangeTracker>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
2
|
+
import { type ID } from '../../ontology/payload';
|
|
3
|
+
import { Group } from "./group";
|
|
4
|
+
export declare class Client {
|
|
5
|
+
private readonly creator;
|
|
6
|
+
constructor(unary: UnaryClient);
|
|
7
|
+
create(parent: ID, name: string): Promise<Group>;
|
|
8
|
+
rename(key: string, name: string): Promise<void>;
|
|
9
|
+
delete(...keys: string[]): Promise<void>;
|
|
10
|
+
private sugar;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as group from '../../ontology/group/external';
|