@formant/data-sdk 1.35.0 → 1.37.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.
@@ -23868,18 +23868,19 @@ async function getAnnotationCountByIntervals(e, t, n) {
23868
23868
  annotations: d[U]
23869
23869
  }));
23870
23870
  }
23871
- async function getTelemetry(e, t, n, r, l) {
23872
- let s = e;
23873
- Array.isArray(e) || (s = [e]);
23874
- let c = t;
23875
- return Array.isArray(t) || (c = [t]), (await (await fetch(`${FORMANT_API_URL}/v1/queries/queries`, {
23871
+ async function getTelemetry(e, t, n, r, l, s) {
23872
+ let c = e;
23873
+ Array.isArray(e) || (c = [e]);
23874
+ let o = t;
23875
+ return Array.isArray(t) || (o = [t]), (await (await fetch(`${FORMANT_API_URL}/v1/queries/queries`, {
23876
23876
  method: "POST",
23877
23877
  body: JSON.stringify({
23878
- deviceIds: s,
23878
+ deviceIds: c,
23879
23879
  end: r.toISOString(),
23880
- names: c,
23880
+ names: o,
23881
23881
  start: n.toISOString(),
23882
- tags: l
23882
+ tags: l,
23883
+ latestOnly: s
23883
23884
  }),
23884
23885
  headers: {
23885
23886
  "Content-Type": "application/json",
@@ -24236,13 +24237,16 @@ class Device extends BaseDevice {
24236
24237
  })).json();
24237
24238
  return new CaptureStream(r);
24238
24239
  }
24239
- async getTelemetry(t, n, r, l) {
24240
+ async getTelemetry(t, n, r, l, s, c, o) {
24241
+ if (s !== void 0 || c !== void 0)
24242
+ throw new Error("Limit and offset are not supported in this method");
24240
24243
  return await getTelemetry(
24241
24244
  this.id,
24242
24245
  t,
24243
24246
  n,
24244
24247
  r,
24245
- l
24248
+ l,
24249
+ o
24246
24250
  );
24247
24251
  }
24248
24252
  async getTelemetryStreams() {
@@ -24342,6 +24346,18 @@ class PeerDevice extends BaseDevice {
24342
24346
  tags: {}
24343
24347
  }));
24344
24348
  }
24349
+ async getTelemetry(n, r, l, s, c, o, d) {
24350
+ if (Array.isArray(n))
24351
+ throw new Error("Multiple stream names not supported");
24352
+ if (s)
24353
+ throw new Error("Tags not supported");
24354
+ if (d && c === void 0)
24355
+ c = 1;
24356
+ else if (d && c !== void 0)
24357
+ throw new Error("latestOnly and limit cannot be used together");
24358
+ let u = `${this.peerUrl}/v1/querydatapoints?stream_name=${n}&start=${r.toISOString()}&end=${l.toISOString()}`;
24359
+ return c != null && c > 0 && (u += `&limit=${c}`), o != null && o >= 0 && (u += `&offset=${o}`), (await (await fetch(u)).json()).results;
24360
+ }
24345
24361
  subscribeToTelemetry() {
24346
24362
  this.telemetryStreamActive = !0;
24347
24363
  let n = 0;