@synnaxlabs/client 0.18.0 → 0.18.1

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.
@@ -24,15 +24,16 @@ const read_from = [
24
24
  "stream_write_example_data_2"
25
25
  ]
26
26
 
27
- const streamer = await client.telem.newStreamer(read_from);
27
+ const streamer = await client.telem.openStreamer(read_from);
28
28
 
29
29
  // It's very important that we close the streamer when we're done with it to release
30
30
  // network connections and other resources, so we wrap the streaming loop in a try-finally
31
31
  // block.
32
32
  try {
33
33
  // Loop through the frames in the streamer. Each iteration will block until a new
34
- // frame is available, and then we'll just print it out.
35
- for await (const frame of streamer) console.log(frame.latest());
34
+ // frame is available, and then we'll just print out the last sample for each
35
+ // channel in the frame.
36
+ for await (const frame of streamer) console.log(frame.at(-1));
36
37
  } finally {
37
38
  streamer.close();
38
39
  // Close the client when we're done with it.
@@ -9,7 +9,7 @@
9
9
  "version": "1.0.0",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "@synnaxlabs/client": "^0.17.5"
12
+ "@synnaxlabs/client": "^0.18.0"
13
13
  }
14
14
  },
15
15
  "node_modules/@grpc/grpc-js": {
@@ -3653,23 +3653,23 @@
3653
3653
  }
3654
3654
  },
3655
3655
  "node_modules/@synnaxlabs/client": {
3656
- "version": "0.17.5",
3657
- "resolved": "https://registry.npmjs.org/@synnaxlabs/client/-/client-0.17.5.tgz",
3658
- "integrity": "sha512-HyQ/lzX4lekh5pg84A59tNjMHAYact3uvV+DUUJma+C3w4fgl4hT0U1DZ3IABiI02pNJEaiahMszg+2E9g358A==",
3656
+ "version": "0.18.0",
3657
+ "resolved": "https://registry.npmjs.org/@synnaxlabs/client/-/client-0.18.0.tgz",
3658
+ "integrity": "sha512-o53rR0awYUCcdSCENzo+6VjsEEt30ExHG0B1FLOk3+865eIJkvazS4RrRYpitrIxuzAGIK12v0vZ/qj8sGzlfA==",
3659
3659
  "dependencies": {
3660
- "@synnaxlabs/freighter": "0.9.2",
3661
- "@synnaxlabs/x": "0.14.2",
3660
+ "@synnaxlabs/freighter": "0.9.3",
3661
+ "@synnaxlabs/x": "0.15.0",
3662
3662
  "async-mutex": "^0.4.0",
3663
3663
  "zod": "3.22.4"
3664
3664
  }
3665
3665
  },
3666
3666
  "node_modules/@synnaxlabs/freighter": {
3667
- "version": "0.9.2",
3668
- "resolved": "https://registry.npmjs.org/@synnaxlabs/freighter/-/freighter-0.9.2.tgz",
3669
- "integrity": "sha512-GJ63tGtSKlqiDLI+82keEIKwKmCsMI7y5ibI1DGKS/cXgeYJFUmG4BjJFM4HfVQxt56o94UP+qP4acZcLDZwGg==",
3667
+ "version": "0.9.3",
3668
+ "resolved": "https://registry.npmjs.org/@synnaxlabs/freighter/-/freighter-0.9.3.tgz",
3669
+ "integrity": "sha512-H8a4HePVykwlkQMw8yClJ/BpydMDieBD2HHC2bBcvfJKZ3w32uiAqvhqezy14aU2XgNG92hU65IBi2FT6esBng==",
3670
3670
  "dependencies": {
3671
3671
  "@synnaxlabs/alamos": "0.3.0",
3672
- "@synnaxlabs/x": "0.14.2",
3672
+ "@synnaxlabs/x": "0.15.0",
3673
3673
  "js-convert-case": "^4.2.0",
3674
3674
  "node-fetch": "2.6.11",
3675
3675
  "ws": "^8.15.1",
@@ -3680,9 +3680,9 @@
3680
3680
  }
3681
3681
  },
3682
3682
  "node_modules/@synnaxlabs/x": {
3683
- "version": "0.14.2",
3684
- "resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.14.2.tgz",
3685
- "integrity": "sha512-Js5czEi7oMhaQkDe3xGuGLbho7xBMoNIWJmrXI20lu+VbB/FyO1wVtfcdIIIZOLc3tUAdNw9ceuZXMOieRoH1g==",
3683
+ "version": "0.15.0",
3684
+ "resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.15.0.tgz",
3685
+ "integrity": "sha512-baowvPsc0oKeMscKHh/5u0WVRB7J3ylIYzkx8feyP67QkjE8PCQpf0gmdThMGg6r0HwUbubzTcD0N64TNvahWw==",
3686
3686
  "dependencies": {
3687
3687
  "async-mutex": "^0.4.0",
3688
3688
  "js-convert-case": "^4.2.0",
@@ -3886,9 +3886,9 @@
3886
3886
  }
3887
3887
  },
3888
3888
  "node_modules/@types/node": {
3889
- "version": "20.12.3",
3890
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.3.tgz",
3891
- "integrity": "sha512-sD+ia2ubTeWrOu+YMF+MTAB7E+O7qsMqAbMfW7DG3K1URwhZ5hN1pLlRVGbf4wDFzSfikL05M17EyorS86jShw==",
3889
+ "version": "20.12.4",
3890
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.4.tgz",
3891
+ "integrity": "sha512-E+Fa9z3wSQpzgYQdYmme5X3OTuejnnTx88A6p6vkkJosR3KBz+HpE3kqNm98VE6cfLFcISx7zW7MsJkH6KwbTw==",
3892
3892
  "dependencies": {
3893
3893
  "undici-types": "~5.26.4"
3894
3894
  }
@@ -11,6 +11,6 @@
11
11
  "author": "",
12
12
  "license": "ISC",
13
13
  "dependencies": {
14
- "@synnaxlabs/client": "^0.17.5"
14
+ "@synnaxlabs/client": "^0.18.0"
15
15
  }
16
16
  }
@@ -0,0 +1,37 @@
1
+ import { Series } from "@synnaxlabs/client";
2
+
3
+ // Construct a series from an array of numbers. In this case, the series will
4
+ // automatically be of type float64.
5
+ let series = new Series([1, 2, 3, 4, 5]);
6
+
7
+ // Construct a series from an array of numbers, but this time we specify the type
8
+ // explicitly.
9
+ series = new Series({ data: [1, 2, 3, 4, 5], dataType: "float32" });
10
+
11
+ // Construct a series from an array of strings. In this case, the series will
12
+ // automatically be of type string.
13
+ series = new Series(["apple", "banana", "cherry"]);
14
+
15
+ // Construct a series from a Float32Array. This is the most efficient way to
16
+ // construct a series from a large amount of data.
17
+ series = new Series(new Float32Array([1, 2, 3, 4, 5]));
18
+
19
+ // Construct a series from a JSON object. This is useful when you have a series
20
+ // that has been serialized to JSON.
21
+ series = new Series([{ red: "cherry" }, { yellow: "banana" }, {orange: "orange" }]);
22
+
23
+ series = new Series([1, "a", 3, "b", 5]);
24
+
25
+ series = new Series([1, 2, 3, 4, 5]);
26
+
27
+ console.log(series.at(0)); // 1
28
+ console.log(series.at(-1)); // 5
29
+
30
+ series = new Series([1, 2, 3, 4, 5]);
31
+ // Is it a number? Is it a string? Who knows?
32
+ let v = series.at(0);
33
+
34
+ series = new Series([1, 2, 3, 4, 5]);
35
+ let easierSeries = series.as("number");
36
+ // Now we have a guarantee that this is a series of numbers.
37
+ v = easierSeries.at(0);
@@ -48,7 +48,7 @@ const roughRate = Rate.hz(40);
48
48
  // historical reads every 500 samples.
49
49
  const commitInterval = 500;
50
50
 
51
- const writer = await client.telem.newWriter({
51
+ const writer = await client.telem.openWriter({
52
52
  start,
53
53
  channels: [timeChannel.key, dataChannel1.key, dataChannel2.key]
54
54
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@synnaxlabs/client",
3
3
  "private": false,
4
- "version": "0.18.0",
4
+ "version": "0.18.1",
5
5
  "type": "module",
6
6
  "description": "The Client Library for Synnax",
7
7
  "repository": "https://github.com/synnaxlabs/synnax/tree/main/client/ts",
@@ -19,7 +19,7 @@
19
19
  "async-mutex": "^0.4.0",
20
20
  "zod": "3.22.4",
21
21
  "@synnaxlabs/freighter": "0.9.3",
22
- "@synnaxlabs/x": "0.15.0"
22
+ "@synnaxlabs/x": "0.15.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^20.10.5",