@formant/data-sdk 1.36.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,7 +24237,7 @@ class Device extends BaseDevice {
24236
24237
  })).json();
24237
24238
  return new CaptureStream(r);
24238
24239
  }
24239
- async getTelemetry(t, n, r, l, s, c) {
24240
+ async getTelemetry(t, n, r, l, s, c, o) {
24240
24241
  if (s !== void 0 || c !== void 0)
24241
24242
  throw new Error("Limit and offset are not supported in this method");
24242
24243
  return await getTelemetry(
@@ -24244,7 +24245,8 @@ class Device extends BaseDevice {
24244
24245
  t,
24245
24246
  n,
24246
24247
  r,
24247
- l
24248
+ l,
24249
+ o
24248
24250
  );
24249
24251
  }
24250
24252
  async getTelemetryStreams() {
@@ -24344,13 +24346,17 @@ class PeerDevice extends BaseDevice {
24344
24346
  tags: {}
24345
24347
  }));
24346
24348
  }
24347
- async getTelemetry(n, r, l, s, c, o) {
24349
+ async getTelemetry(n, r, l, s, c, o, d) {
24348
24350
  if (Array.isArray(n))
24349
24351
  throw new Error("Multiple stream names not supported");
24350
24352
  if (s)
24351
24353
  throw new Error("Tags not supported");
24352
- let d = `${this.peerUrl}/v1/querydatapoints?stream_name=${n}&start=${r.toISOString()}&end=${l.toISOString()}`;
24353
- return c != null && c > 0 && (d += `&limit=${c}`), o != null && o >= 0 && (d += `&offset=${o}`), (await (await fetch(d)).json()).results;
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;
24354
24360
  }
24355
24361
  subscribeToTelemetry() {
24356
24362
  this.telemetryStreamActive = !0;