@formant/data-sdk 1.5.4 → 1.6.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/dist/data-sdk.cjs.js +2 -2
- package/dist/data-sdk.cjs.js.map +1 -1
- package/dist/data-sdk.es.js +224 -211
- package/dist/data-sdk.es.js.map +1 -1
- package/dist/data-sdk.es6.js +2344 -2283
- package/dist/data-sdk.umd.js +27 -27
- package/dist/types/data-sdk/src/Fleet.d.ts +2 -0
- package/dist/types/data-sdk/src/api/createFleet.d.ts +2 -0
- package/package.json +3 -1
- /package/dist/types/{common → data-sdk/src/utils}/stringToArrayBuffer.d.ts +0 -0
package/dist/data-sdk.es.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var s = (a, e, t) => (
|
|
1
|
+
var re = Object.defineProperty;
|
|
2
|
+
var se = (a, e, t) => e in a ? re(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var s = (a, e, t) => (se(a, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { decode as J } from "base-64";
|
|
4
5
|
import * as u from "date-fns";
|
|
5
|
-
import { startOfMinute as
|
|
6
|
-
import { RtcClient as
|
|
7
|
-
import { EventEmitter as
|
|
8
|
-
import { deflate as
|
|
9
|
-
import { fromByteArray as
|
|
10
|
-
const
|
|
11
|
-
function
|
|
6
|
+
import { startOfMinute as ce, addMinutes as de, roundToNearestMinutes as he, addSeconds as le } from "date-fns";
|
|
7
|
+
import { RtcClient as D, SignalingPromiseClient as P } from "@formant/realtime-sdk";
|
|
8
|
+
import { EventEmitter as ue } from "eventemitter3";
|
|
9
|
+
import { deflate as me } from "pako";
|
|
10
|
+
import { fromByteArray as fe } from "base64-js";
|
|
11
|
+
const we = "https://api.formant.io";
|
|
12
|
+
function pe(a, e) {
|
|
12
13
|
try {
|
|
13
14
|
if (e.get("formant_stage"))
|
|
14
15
|
return "https://api-stage.formant.io";
|
|
@@ -29,15 +30,15 @@ function we(a, e) {
|
|
|
29
30
|
}
|
|
30
31
|
} catch {
|
|
31
32
|
}
|
|
32
|
-
return typeof a < "u" && "FORMANT_API_URL" in a && typeof a.FORMANT_API_URL == "string" ? a.FORMANT_API_URL :
|
|
33
|
+
return typeof a < "u" && "FORMANT_API_URL" in a && typeof a.FORMANT_API_URL == "string" ? a.FORMANT_API_URL : we;
|
|
33
34
|
}
|
|
34
|
-
const h =
|
|
35
|
+
const h = pe(
|
|
35
36
|
typeof window < "u" ? window : globalThis,
|
|
36
37
|
new URLSearchParams(
|
|
37
38
|
typeof window < "u" && window.location ? window.location.search : void 0
|
|
38
39
|
)
|
|
39
40
|
);
|
|
40
|
-
class
|
|
41
|
+
class ye {
|
|
41
42
|
constructor({
|
|
42
43
|
apiUrl: e,
|
|
43
44
|
refreshAuthToken: t,
|
|
@@ -101,7 +102,7 @@ class pe {
|
|
|
101
102
|
}
|
|
102
103
|
async loginWithToken(e, t) {
|
|
103
104
|
var i;
|
|
104
|
-
const n = JSON.parse(
|
|
105
|
+
const n = JSON.parse(J(e.split(".")[1]));
|
|
105
106
|
try {
|
|
106
107
|
let r;
|
|
107
108
|
if (this._isShareToken = n["formant:claims"] && n["formant:claims"].type == "share", n["formant:claims"] && (this._currentOrganization = n["formant:claims"].organizationId), n["custom:organization_id"] && (this._currentOrganization = n["custom:organization_id"]), this._isShareToken || (r = n.sub), n["formant:claims"] && n["formant:claims"].userId && (r = n["formant:claims"].userId), r && ((i = this._currentUser) == null ? void 0 : i.id) !== r) {
|
|
@@ -231,7 +232,7 @@ function T(a) {
|
|
|
231
232
|
throw new Error("cannot send message to non-existent parent");
|
|
232
233
|
window.parent.postMessage(a, "*");
|
|
233
234
|
}
|
|
234
|
-
function
|
|
235
|
+
function V() {
|
|
235
236
|
const a = k();
|
|
236
237
|
if (!a)
|
|
237
238
|
throw new Error("No module context");
|
|
@@ -240,7 +241,7 @@ function J() {
|
|
|
240
241
|
module: a
|
|
241
242
|
});
|
|
242
243
|
}
|
|
243
|
-
function
|
|
244
|
+
function F(a) {
|
|
244
245
|
function e(t) {
|
|
245
246
|
const n = t.data;
|
|
246
247
|
n.type === "auth_token" && a(n.token);
|
|
@@ -249,12 +250,12 @@ function V(a) {
|
|
|
249
250
|
window.removeEventListener("message", e);
|
|
250
251
|
};
|
|
251
252
|
}
|
|
252
|
-
const o = new
|
|
253
|
+
const o = new ye({
|
|
253
254
|
apiUrl: h,
|
|
254
|
-
refreshAuthToken:
|
|
255
|
-
addAccessTokenRefreshListener:
|
|
255
|
+
refreshAuthToken: V,
|
|
256
|
+
addAccessTokenRefreshListener: F
|
|
256
257
|
});
|
|
257
|
-
async function
|
|
258
|
+
async function ge(a) {
|
|
258
259
|
return (await (await fetch(
|
|
259
260
|
`${h}/v1/admin/module-configurations/${a}`,
|
|
260
261
|
{
|
|
@@ -265,24 +266,24 @@ async function ye(a) {
|
|
|
265
266
|
}
|
|
266
267
|
)).json()).configuration;
|
|
267
268
|
}
|
|
268
|
-
function
|
|
269
|
+
function ve() {
|
|
269
270
|
T({
|
|
270
271
|
type: "hide_analytics_date_picker"
|
|
271
272
|
});
|
|
272
273
|
}
|
|
273
|
-
function
|
|
274
|
+
function Te(a) {
|
|
274
275
|
T({
|
|
275
276
|
type: "go_to_device",
|
|
276
277
|
deviceId: a
|
|
277
278
|
});
|
|
278
279
|
}
|
|
279
|
-
function
|
|
280
|
+
function Ce(a) {
|
|
280
281
|
T({
|
|
281
282
|
type: "go_to_time",
|
|
282
283
|
time: a.getTime()
|
|
283
284
|
});
|
|
284
285
|
}
|
|
285
|
-
function
|
|
286
|
+
function Se() {
|
|
286
287
|
const a = k();
|
|
287
288
|
if (!a)
|
|
288
289
|
throw new Error("No module context");
|
|
@@ -291,7 +292,7 @@ function Ce() {
|
|
|
291
292
|
module: a
|
|
292
293
|
});
|
|
293
294
|
}
|
|
294
|
-
function
|
|
295
|
+
function Ee(a, e) {
|
|
295
296
|
const t = k();
|
|
296
297
|
if (!t)
|
|
297
298
|
throw new Error("No module context");
|
|
@@ -302,7 +303,7 @@ function Se(a, e) {
|
|
|
302
303
|
data: e
|
|
303
304
|
});
|
|
304
305
|
}
|
|
305
|
-
function
|
|
306
|
+
function ke(a, e) {
|
|
306
307
|
const t = k();
|
|
307
308
|
if (!t)
|
|
308
309
|
throw new Error("No module context");
|
|
@@ -313,7 +314,7 @@ function Ee(a, e) {
|
|
|
313
314
|
after: e || 0
|
|
314
315
|
});
|
|
315
316
|
}
|
|
316
|
-
function
|
|
317
|
+
function Oe(a) {
|
|
317
318
|
const e = k();
|
|
318
319
|
if (!e)
|
|
319
320
|
throw new Error("No module context");
|
|
@@ -323,10 +324,10 @@ function ke(a) {
|
|
|
323
324
|
menus: a
|
|
324
325
|
});
|
|
325
326
|
}
|
|
326
|
-
function
|
|
327
|
+
function Re(a) {
|
|
327
328
|
T({ type: "show_message", message: a });
|
|
328
329
|
}
|
|
329
|
-
function
|
|
330
|
+
function be(a, e) {
|
|
330
331
|
const t = (n) => {
|
|
331
332
|
const i = n.data;
|
|
332
333
|
i.type === "channel_data" && i.channel === a && e({
|
|
@@ -336,7 +337,7 @@ function Re(a, e) {
|
|
|
336
337
|
};
|
|
337
338
|
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
338
339
|
}
|
|
339
|
-
function
|
|
340
|
+
function Ae(a) {
|
|
340
341
|
const e = (t) => {
|
|
341
342
|
const n = t.data;
|
|
342
343
|
n.type === "module_menu_item_clicked" && a(n.menu);
|
|
@@ -350,7 +351,7 @@ function De(a) {
|
|
|
350
351
|
};
|
|
351
352
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
352
353
|
}
|
|
353
|
-
function
|
|
354
|
+
function Pe(a) {
|
|
354
355
|
const e = k();
|
|
355
356
|
e && T({ type: "request_module_data", module: e });
|
|
356
357
|
const t = (n) => {
|
|
@@ -363,7 +364,7 @@ function Ae(a) {
|
|
|
363
364
|
};
|
|
364
365
|
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
365
366
|
}
|
|
366
|
-
function
|
|
367
|
+
function Ne(a) {
|
|
367
368
|
T({ type: "request_devices" });
|
|
368
369
|
const e = (t) => {
|
|
369
370
|
const n = t.data;
|
|
@@ -371,20 +372,20 @@ function Pe(a) {
|
|
|
371
372
|
};
|
|
372
373
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
373
374
|
}
|
|
374
|
-
const
|
|
375
|
-
millisecond:
|
|
376
|
-
second:
|
|
377
|
-
minute:
|
|
378
|
-
hour:
|
|
375
|
+
const je = 1, W = 1e3, G = 60 * W, H = 60 * G, I = 24 * H, Ie = 7 * I, Le = 30 * I, _e = 365 * I, L = {
|
|
376
|
+
millisecond: je,
|
|
377
|
+
second: W,
|
|
378
|
+
minute: G,
|
|
379
|
+
hour: H,
|
|
379
380
|
day: I,
|
|
380
|
-
week:
|
|
381
|
-
month:
|
|
382
|
-
year:
|
|
381
|
+
week: Ie,
|
|
382
|
+
month: Le,
|
|
383
|
+
year: _e
|
|
383
384
|
};
|
|
384
|
-
function
|
|
385
|
+
function $e(a, e) {
|
|
385
386
|
return a.filter((t) => e.includes(t.type));
|
|
386
387
|
}
|
|
387
|
-
function
|
|
388
|
+
function ze(a, e, t) {
|
|
388
389
|
const n = e.getTime(), i = t.getTime();
|
|
389
390
|
return a.map((r) => ({
|
|
390
391
|
...r,
|
|
@@ -459,7 +460,7 @@ async function _(a) {
|
|
|
459
460
|
}
|
|
460
461
|
})).json()).items;
|
|
461
462
|
}
|
|
462
|
-
class
|
|
463
|
+
class Me {
|
|
463
464
|
constructor() {
|
|
464
465
|
s(this, "queryStoreCache", new x({
|
|
465
466
|
capacity: 1e4,
|
|
@@ -476,17 +477,17 @@ class ze {
|
|
|
476
477
|
names: [...t],
|
|
477
478
|
types: [...n]
|
|
478
479
|
}, p = this.query(d, i, r, c);
|
|
479
|
-
return p === void 0 || p === "too much data" ? p :
|
|
480
|
+
return p === void 0 || p === "too much data" ? p : $e(p, n);
|
|
480
481
|
}
|
|
481
482
|
query(e, t, n, i = !1) {
|
|
482
483
|
const r = {
|
|
483
484
|
...e,
|
|
484
|
-
start:
|
|
485
|
-
end: i ? n.toISOString() :
|
|
485
|
+
start: ce(t).toISOString(),
|
|
486
|
+
end: i ? n.toISOString() : de(he(n), 1).toISOString(),
|
|
486
487
|
latestOnly: i
|
|
487
|
-
}, c = n >
|
|
488
|
+
}, c = n > le(/* @__PURE__ */ new Date(), -20);
|
|
488
489
|
let d;
|
|
489
|
-
return c ? d = this.liveQueryCache(r) : d = this.queryCache(r), !d || d === "too much data" || i ? d :
|
|
490
|
+
return c ? d = this.liveQueryCache(r) : d = this.queryCache(r), !d || d === "too much data" || i ? d : ze(d, t, n);
|
|
490
491
|
}
|
|
491
492
|
queryCache(e) {
|
|
492
493
|
return this.queryStoreCache.get(e, async () => {
|
|
@@ -507,14 +508,14 @@ class ze {
|
|
|
507
508
|
});
|
|
508
509
|
}
|
|
509
510
|
}
|
|
510
|
-
const
|
|
511
|
-
function
|
|
511
|
+
const Be = new Me();
|
|
512
|
+
function qe(a, e, t) {
|
|
512
513
|
const n = (i) => {
|
|
513
514
|
const r = i.data;
|
|
514
515
|
if (r.type === "module_data") {
|
|
515
516
|
const { start: c, end: d } = r.queryRange;
|
|
516
517
|
t(
|
|
517
|
-
|
|
518
|
+
Be.moduleQuery(
|
|
518
519
|
{},
|
|
519
520
|
a,
|
|
520
521
|
e,
|
|
@@ -527,7 +528,7 @@ function Be(a, e, t) {
|
|
|
527
528
|
};
|
|
528
529
|
return window.addEventListener("message", n), () => window.removeEventListener("message", n);
|
|
529
530
|
}
|
|
530
|
-
async function
|
|
531
|
+
async function xe(a, e, t) {
|
|
531
532
|
return new Promise((n) => {
|
|
532
533
|
T({
|
|
533
534
|
type: "request_date",
|
|
@@ -542,7 +543,7 @@ async function qe(a, e, t) {
|
|
|
542
543
|
window.addEventListener("message", i);
|
|
543
544
|
});
|
|
544
545
|
}
|
|
545
|
-
async function
|
|
546
|
+
async function Ue(a, e) {
|
|
546
547
|
return new Promise((t) => {
|
|
547
548
|
const n = Math.random().toString();
|
|
548
549
|
T({
|
|
@@ -568,7 +569,7 @@ const q = class {
|
|
|
568
569
|
typeof window < "u" && window.location && (e = new URLSearchParams(window.location.search));
|
|
569
570
|
const t = e.get("configuration");
|
|
570
571
|
if (!(t === null || t.trim() === ""))
|
|
571
|
-
return
|
|
572
|
+
return ge(t.trim());
|
|
572
573
|
}
|
|
573
574
|
static get isOnline() {
|
|
574
575
|
return q._isOnline;
|
|
@@ -608,9 +609,9 @@ const q = class {
|
|
|
608
609
|
};
|
|
609
610
|
let y = q;
|
|
610
611
|
s(y, "getCurrentModuleContext", k), // senders
|
|
611
|
-
s(y, "disableAnalyticsBottomBar",
|
|
612
|
-
s(y, "addAccessTokenRefreshListener",
|
|
613
|
-
s(y, "getDate",
|
|
612
|
+
s(y, "disableAnalyticsBottomBar", ve), s(y, "goToDevice", Te), s(y, "goToTime", Ce), s(y, "refreshAuthToken", V), s(y, "requestModuleData", Se), s(y, "sendChannelData", Ee), s(y, "setModuleDateTimeRange", ke), s(y, "setupModuleMenus", Oe), s(y, "showMessage", Re), // listeners
|
|
613
|
+
s(y, "addAccessTokenRefreshListener", F), s(y, "addChannelDataListener", be), s(y, "addMenuListener", Ae), s(y, "addModuleConfigurationListener", De), s(y, "addModuleDataListener", Pe), s(y, "addOverviewDeviceListener", Ne), s(y, "addStreamListener", qe), // bidirectional
|
|
614
|
+
s(y, "getDate", xe), s(y, "prompt", Ue), s(y, "_isOnline", null);
|
|
614
615
|
function f(a, e) {
|
|
615
616
|
if (a !== void 0)
|
|
616
617
|
return a;
|
|
@@ -621,7 +622,7 @@ const g = {
|
|
|
621
622
|
TELEOP: 1,
|
|
622
623
|
PORT_FORWARD: 2,
|
|
623
624
|
OBSERVE: 3
|
|
624
|
-
},
|
|
625
|
+
}, Gt = {
|
|
625
626
|
...g,
|
|
626
627
|
Unknown: g.UNKNOWN,
|
|
627
628
|
Teleop: g.TELEOP,
|
|
@@ -632,10 +633,10 @@ const g = {
|
|
|
632
633
|
portForward: g.PORT_FORWARD,
|
|
633
634
|
observe: g.OBSERVE
|
|
634
635
|
}, O = Symbol("RtcClientPool.instance");
|
|
635
|
-
var
|
|
636
|
+
var Bt;
|
|
636
637
|
class N {
|
|
637
638
|
constructor(e) {
|
|
638
|
-
s(this,
|
|
639
|
+
s(this, Bt, null);
|
|
639
640
|
s(this, "createClient");
|
|
640
641
|
s(this, "ttlMs");
|
|
641
642
|
s(this, "proxyHandler");
|
|
@@ -690,11 +691,11 @@ class N {
|
|
|
690
691
|
}, this.ttlMs)), !0) : (console.warn("this instance has already been released!"), !1);
|
|
691
692
|
}
|
|
692
693
|
}
|
|
693
|
-
|
|
694
|
+
Bt = O;
|
|
694
695
|
const j = async () => f(o.token, "Realtime when user isn't authorized"), R = {
|
|
695
696
|
[g.UNKNOWN]: new N({
|
|
696
697
|
ttlMs: 2500,
|
|
697
|
-
createClient: (a) => new
|
|
698
|
+
createClient: (a) => new D({
|
|
698
699
|
signalingClient: new P(h),
|
|
699
700
|
getToken: j,
|
|
700
701
|
sessionType: g.UNKNOWN,
|
|
@@ -703,7 +704,7 @@ const j = async () => f(o.token, "Realtime when user isn't authorized"), R = {
|
|
|
703
704
|
}),
|
|
704
705
|
[g.TELEOP]: new N({
|
|
705
706
|
ttlMs: 2500,
|
|
706
|
-
createClient: (a) => new
|
|
707
|
+
createClient: (a) => new D({
|
|
707
708
|
signalingClient: new P(h),
|
|
708
709
|
getToken: j,
|
|
709
710
|
sessionType: g.TELEOP,
|
|
@@ -712,7 +713,7 @@ const j = async () => f(o.token, "Realtime when user isn't authorized"), R = {
|
|
|
712
713
|
}),
|
|
713
714
|
[g.PORT_FORWARD]: new N({
|
|
714
715
|
ttlMs: 2500,
|
|
715
|
-
createClient: (a) => new
|
|
716
|
+
createClient: (a) => new D({
|
|
716
717
|
signalingClient: new P(h),
|
|
717
718
|
getToken: j,
|
|
718
719
|
sessionType: g.PORT_FORWARD,
|
|
@@ -721,24 +722,24 @@ const j = async () => f(o.token, "Realtime when user isn't authorized"), R = {
|
|
|
721
722
|
}),
|
|
722
723
|
[g.OBSERVE]: new N({
|
|
723
724
|
ttlMs: 2500,
|
|
724
|
-
createClient: (a) => new
|
|
725
|
+
createClient: (a) => new D({
|
|
725
726
|
signalingClient: new P(h),
|
|
726
727
|
getToken: j,
|
|
727
728
|
sessionType: g.OBSERVE,
|
|
728
729
|
receive: a
|
|
729
730
|
})
|
|
730
731
|
})
|
|
731
|
-
},
|
|
732
|
+
}, Je = {
|
|
732
733
|
...R,
|
|
733
734
|
unknown: R[g.UNKNOWN],
|
|
734
735
|
teleop: R[g.TELEOP],
|
|
735
736
|
portForward: R[g.PORT_FORWARD],
|
|
736
737
|
observe: R[g.OBSERVE]
|
|
737
|
-
}, $ = R[g.TELEOP],
|
|
738
|
+
}, $ = R[g.TELEOP], Ve = (a) => {
|
|
738
739
|
const { sessionType: e } = a;
|
|
739
|
-
return e ?
|
|
740
|
+
return e ? Je[e] : $;
|
|
740
741
|
};
|
|
741
|
-
class
|
|
742
|
+
class Fe {
|
|
742
743
|
constructor(e) {
|
|
743
744
|
s(this, "token");
|
|
744
745
|
this.captureSession = e;
|
|
@@ -771,8 +772,8 @@ class Ve {
|
|
|
771
772
|
function b(a) {
|
|
772
773
|
return new Promise((e) => setTimeout(e, a));
|
|
773
774
|
}
|
|
774
|
-
const
|
|
775
|
-
class
|
|
775
|
+
const We = (a) => a !== void 0 && a.capabilities !== void 0 && a.capabilitySet !== void 0;
|
|
776
|
+
class Ge {
|
|
776
777
|
constructor(e) {
|
|
777
778
|
s(this, "ready", !1);
|
|
778
779
|
s(this, "listeners", []);
|
|
@@ -858,7 +859,7 @@ class We {
|
|
|
858
859
|
this.binaryListeners.splice(t, 1);
|
|
859
860
|
}
|
|
860
861
|
}
|
|
861
|
-
class
|
|
862
|
+
class He {
|
|
862
863
|
constructor(e, t) {
|
|
863
864
|
s(this, "currentListeners", []);
|
|
864
865
|
s(this, "onRealtimeMessage", (e, t) => {
|
|
@@ -882,7 +883,7 @@ class Ge {
|
|
|
882
883
|
this.currentListeners.push(e);
|
|
883
884
|
}
|
|
884
885
|
}
|
|
885
|
-
class
|
|
886
|
+
class K {
|
|
886
887
|
constructor(e, t, n) {
|
|
887
888
|
s(this, "channel");
|
|
888
889
|
s(this, "requestIdToResponseMap", /* @__PURE__ */ new Map());
|
|
@@ -913,7 +914,7 @@ class H {
|
|
|
913
914
|
);
|
|
914
915
|
}
|
|
915
916
|
}
|
|
916
|
-
class
|
|
917
|
+
class Ke extends K {
|
|
917
918
|
constructor() {
|
|
918
919
|
super(...arguments);
|
|
919
920
|
s(this, "RESPONSE_SUCCESS_BYTE", 0);
|
|
@@ -973,7 +974,7 @@ class He extends H {
|
|
|
973
974
|
}), new Error("Binary request data channel request timed out");
|
|
974
975
|
}
|
|
975
976
|
}
|
|
976
|
-
class
|
|
977
|
+
class Qe extends K {
|
|
977
978
|
generateTextId() {
|
|
978
979
|
return Math.random().toString(36).substring(2) + "-" + Math.random().toString(36).substring(2);
|
|
979
980
|
}
|
|
@@ -1021,7 +1022,7 @@ class Ke extends H {
|
|
|
1021
1022
|
}), new Error("Text request datachannel request timed out");
|
|
1022
1023
|
}
|
|
1023
1024
|
}
|
|
1024
|
-
class
|
|
1025
|
+
class Q extends ue {
|
|
1025
1026
|
constructor() {
|
|
1026
1027
|
super(...arguments);
|
|
1027
1028
|
s(this, "rtcClient");
|
|
@@ -1062,7 +1063,7 @@ class K extends le {
|
|
|
1062
1063
|
const t = await this.getConfiguration(), n = [];
|
|
1063
1064
|
for (const i of t.teleop.rosStreams ?? [])
|
|
1064
1065
|
i.topicType == "sensor_msgs/JointState" && n.push(
|
|
1065
|
-
new
|
|
1066
|
+
new He(this, {
|
|
1066
1067
|
currentJointStateStream: { name: i.topicName },
|
|
1067
1068
|
plannedJointStateStream: i.plannedTopic ? { name: i.plannedTopic } : void 0,
|
|
1068
1069
|
planValidStream: i.planValidTopic ? { name: i.planValidTopic } : void 0,
|
|
@@ -1094,10 +1095,10 @@ class K extends le {
|
|
|
1094
1095
|
return n;
|
|
1095
1096
|
}
|
|
1096
1097
|
createCustomRequestDataChannel(t, n = 3e3) {
|
|
1097
|
-
return new
|
|
1098
|
+
return new Qe(this, t, n);
|
|
1098
1099
|
}
|
|
1099
1100
|
createCustomBinaryRequestDataChannel(t, n = 3e3) {
|
|
1100
|
-
return new
|
|
1101
|
+
return new Ke(this, t, n);
|
|
1101
1102
|
}
|
|
1102
1103
|
async startListeningToRealtimeVideo(t) {
|
|
1103
1104
|
const n = f(
|
|
@@ -1189,7 +1190,7 @@ class K extends le {
|
|
|
1189
1190
|
},
|
|
1190
1191
|
!1,
|
|
1191
1192
|
(p, m) => {
|
|
1192
|
-
const w = new
|
|
1193
|
+
const w = new Ge(m);
|
|
1193
1194
|
d(w);
|
|
1194
1195
|
}
|
|
1195
1196
|
);
|
|
@@ -1223,13 +1224,13 @@ class K extends le {
|
|
|
1223
1224
|
return n;
|
|
1224
1225
|
}
|
|
1225
1226
|
}
|
|
1226
|
-
const
|
|
1227
|
+
const Xe = new TextEncoder();
|
|
1227
1228
|
new TextDecoder();
|
|
1228
|
-
function
|
|
1229
|
-
const e = JSON.stringify(a), t =
|
|
1230
|
-
return
|
|
1229
|
+
function Ye(a) {
|
|
1230
|
+
const e = JSON.stringify(a), t = Xe.encode(e), n = me(t);
|
|
1231
|
+
return fe(n);
|
|
1231
1232
|
}
|
|
1232
|
-
async function
|
|
1233
|
+
async function X() {
|
|
1233
1234
|
if (!o.token)
|
|
1234
1235
|
throw new Error("Not authenticated");
|
|
1235
1236
|
return (await (await fetch(`${h}/v1/admin/views`, {
|
|
@@ -1240,10 +1241,10 @@ async function Q() {
|
|
|
1240
1241
|
}
|
|
1241
1242
|
})).json()).items;
|
|
1242
1243
|
}
|
|
1243
|
-
async function
|
|
1244
|
+
async function Y(a, e) {
|
|
1244
1245
|
if (!o.token)
|
|
1245
1246
|
throw new Error("Not authenticated");
|
|
1246
|
-
const n = (await
|
|
1247
|
+
const n = (await X()).filter((d) => d.name === e);
|
|
1247
1248
|
if (n.length === 0)
|
|
1248
1249
|
return console.warn("View does not exist or it is misspell"), null;
|
|
1249
1250
|
const i = await fetch(`${h}/v1/admin/shares`, {
|
|
@@ -1254,11 +1255,11 @@ async function X(a, e) {
|
|
|
1254
1255
|
Authorization: "Bearer " + o.token
|
|
1255
1256
|
}
|
|
1256
1257
|
}), r = h.replace("api", "app"), { code: c } = await i.json();
|
|
1257
|
-
return `${r}/shares/${c}#${
|
|
1258
|
+
return `${r}/shares/${c}#${Ye({
|
|
1258
1259
|
viewId: n[0].id
|
|
1259
1260
|
})}`;
|
|
1260
1261
|
}
|
|
1261
|
-
const
|
|
1262
|
+
const Ht = [
|
|
1262
1263
|
"day",
|
|
1263
1264
|
"week",
|
|
1264
1265
|
"month",
|
|
@@ -1266,42 +1267,42 @@ const Ft = [
|
|
|
1266
1267
|
"hour",
|
|
1267
1268
|
"minute",
|
|
1268
1269
|
"quarter"
|
|
1269
|
-
],
|
|
1270
|
+
], Kt = [
|
|
1270
1271
|
"interval",
|
|
1271
1272
|
"start",
|
|
1272
1273
|
"end",
|
|
1273
1274
|
"sub",
|
|
1274
1275
|
"get"
|
|
1275
1276
|
];
|
|
1276
|
-
function Ye(a) {
|
|
1277
|
-
return a.count < 2 ? 0 : a.sumOfSquares / (a.count - 1);
|
|
1278
|
-
}
|
|
1279
1277
|
function Ze(a) {
|
|
1280
|
-
return
|
|
1278
|
+
return a.count < 2 ? 0 : a.sumOfSquares / (a.count - 1);
|
|
1281
1279
|
}
|
|
1282
1280
|
function et(a) {
|
|
1283
|
-
return a
|
|
1281
|
+
return Math.sqrt(Ze(a));
|
|
1284
1282
|
}
|
|
1285
1283
|
function tt(a) {
|
|
1286
|
-
return a.
|
|
1284
|
+
return a.max;
|
|
1287
1285
|
}
|
|
1288
1286
|
function nt(a) {
|
|
1289
|
-
return a.
|
|
1287
|
+
return a.min;
|
|
1290
1288
|
}
|
|
1291
1289
|
function at(a) {
|
|
1292
|
-
return a.sum;
|
|
1290
|
+
return a.count === 0 ? -1 : a.sum / a.count;
|
|
1293
1291
|
}
|
|
1294
1292
|
function it(a) {
|
|
1293
|
+
return a.sum;
|
|
1294
|
+
}
|
|
1295
|
+
function ot(a) {
|
|
1295
1296
|
return a.count;
|
|
1296
1297
|
}
|
|
1297
|
-
const
|
|
1298
|
-
min:
|
|
1299
|
-
max:
|
|
1300
|
-
"standard deviation":
|
|
1301
|
-
average:
|
|
1302
|
-
sum:
|
|
1303
|
-
count:
|
|
1304
|
-
},
|
|
1298
|
+
const Qt = {
|
|
1299
|
+
min: nt,
|
|
1300
|
+
max: tt,
|
|
1301
|
+
"standard deviation": et,
|
|
1302
|
+
average: at,
|
|
1303
|
+
sum: it,
|
|
1304
|
+
count: ot
|
|
1305
|
+
}, Z = {
|
|
1305
1306
|
day: {
|
|
1306
1307
|
interval: u.eachDayOfInterval,
|
|
1307
1308
|
start: u.startOfDay,
|
|
@@ -1351,7 +1352,7 @@ const Gt = {
|
|
|
1351
1352
|
sub: u.subQuarters,
|
|
1352
1353
|
get: u.getQuarter
|
|
1353
1354
|
}
|
|
1354
|
-
},
|
|
1355
|
+
}, rt = (a, e) => (
|
|
1355
1356
|
// FIXME this doesn't work for *a lot* locales, other than en-US
|
|
1356
1357
|
// en-GB: 'dd/mm/YYYY'
|
|
1357
1358
|
// ja-jp: 'YYYY/mm/dd'
|
|
@@ -1370,8 +1371,8 @@ async function z(a) {
|
|
|
1370
1371
|
}
|
|
1371
1372
|
})).json()).items;
|
|
1372
1373
|
}
|
|
1373
|
-
async function
|
|
1374
|
-
const r =
|
|
1374
|
+
async function ee(a, e, t, n, i) {
|
|
1375
|
+
const r = Z[e];
|
|
1375
1376
|
return await Promise.all(
|
|
1376
1377
|
Array(t).fill(0).map(async (c, d) => {
|
|
1377
1378
|
const p = new Date(n), m = r.sub(
|
|
@@ -1380,7 +1381,7 @@ async function Z(a, e, t, n, i) {
|
|
|
1380
1381
|
), w = r.sub(
|
|
1381
1382
|
r.end(p),
|
|
1382
1383
|
t - d - 1
|
|
1383
|
-
), v =
|
|
1384
|
+
), v = rt(
|
|
1384
1385
|
m.toLocaleDateString(),
|
|
1385
1386
|
w.toLocaleDateString()
|
|
1386
1387
|
), C = await z({
|
|
@@ -1404,8 +1405,8 @@ async function M(a, e) {
|
|
|
1404
1405
|
return d in r ? (r[d] += 1, r) : (r[d] = 1, r);
|
|
1405
1406
|
}, {});
|
|
1406
1407
|
}
|
|
1407
|
-
async function
|
|
1408
|
-
const { end: n, start: i } = a, c =
|
|
1408
|
+
async function te(a, e, t) {
|
|
1409
|
+
const { end: n, start: i } = a, c = Z[t].interval({
|
|
1409
1410
|
start: new Date(i),
|
|
1410
1411
|
end: new Date(n)
|
|
1411
1412
|
}), d = c.map((m, w) => {
|
|
@@ -1424,7 +1425,7 @@ async function ee(a, e, t) {
|
|
|
1424
1425
|
annotations: p[w]
|
|
1425
1426
|
}));
|
|
1426
1427
|
}
|
|
1427
|
-
async function
|
|
1428
|
+
async function ne(a, e, t, n, i) {
|
|
1428
1429
|
let r = a;
|
|
1429
1430
|
Array.isArray(a) || (r = [a]);
|
|
1430
1431
|
let c = e;
|
|
@@ -1443,7 +1444,7 @@ async function te(a, e, t, n, i) {
|
|
|
1443
1444
|
}
|
|
1444
1445
|
})).json()).items;
|
|
1445
1446
|
}
|
|
1446
|
-
async function
|
|
1447
|
+
async function ae() {
|
|
1447
1448
|
if (!o.token)
|
|
1448
1449
|
throw new Error("Not authenticated");
|
|
1449
1450
|
const a = $.get();
|
|
@@ -1453,7 +1454,7 @@ async function ne() {
|
|
|
1453
1454
|
await a.shutdown();
|
|
1454
1455
|
}
|
|
1455
1456
|
}
|
|
1456
|
-
async function
|
|
1457
|
+
async function ie() {
|
|
1457
1458
|
if (!o.token)
|
|
1458
1459
|
throw new Error("Not authenticated");
|
|
1459
1460
|
const a = $.get();
|
|
@@ -1463,7 +1464,7 @@ async function ae() {
|
|
|
1463
1464
|
await a.shutdown();
|
|
1464
1465
|
}
|
|
1465
1466
|
}
|
|
1466
|
-
async function
|
|
1467
|
+
async function st(a) {
|
|
1467
1468
|
if (!o.token)
|
|
1468
1469
|
throw new Error("Not authenticated");
|
|
1469
1470
|
return await (await fetch(`${h}/v1/admin/devices`, {
|
|
@@ -1475,7 +1476,7 @@ async function rt(a) {
|
|
|
1475
1476
|
}
|
|
1476
1477
|
})).json();
|
|
1477
1478
|
}
|
|
1478
|
-
async function
|
|
1479
|
+
async function ct(a, e) {
|
|
1479
1480
|
if (!o.token)
|
|
1480
1481
|
throw new Error("Not authenticated");
|
|
1481
1482
|
return await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
@@ -1487,7 +1488,7 @@ async function st(a, e) {
|
|
|
1487
1488
|
}
|
|
1488
1489
|
})).json();
|
|
1489
1490
|
}
|
|
1490
|
-
async function
|
|
1491
|
+
async function dt() {
|
|
1491
1492
|
if (!o.token)
|
|
1492
1493
|
throw new Error("Not authenticated");
|
|
1493
1494
|
return (await (await fetch(`${h}/v1/admin/device-details/query`, {
|
|
@@ -1499,7 +1500,7 @@ async function ct() {
|
|
|
1499
1500
|
}
|
|
1500
1501
|
})).json()).items;
|
|
1501
1502
|
}
|
|
1502
|
-
async function
|
|
1503
|
+
async function ht(a) {
|
|
1503
1504
|
if (!o.token)
|
|
1504
1505
|
throw new Error("Not authenticated");
|
|
1505
1506
|
return (await (await fetch(`${h}/v1/admin/devices/query`, {
|
|
@@ -1511,7 +1512,7 @@ async function dt(a) {
|
|
|
1511
1512
|
}
|
|
1512
1513
|
})).json()).items;
|
|
1513
1514
|
}
|
|
1514
|
-
class E extends
|
|
1515
|
+
class E extends Q {
|
|
1515
1516
|
constructor(e, t, n, i) {
|
|
1516
1517
|
super(), this.id = e, this.name = t, this.organizationId = n, this.tags = i;
|
|
1517
1518
|
}
|
|
@@ -1585,7 +1586,7 @@ class E extends K {
|
|
|
1585
1586
|
sessionType: t,
|
|
1586
1587
|
deadlineMs: n = 1e4,
|
|
1587
1588
|
maxConnectRetries: i = 3
|
|
1588
|
-
} = typeof e == "number" ? { sessionType: e } : e, c =
|
|
1589
|
+
} = typeof e == "number" ? { sessionType: e } : e, c = Ve({
|
|
1589
1590
|
sessionType: t
|
|
1590
1591
|
}).get(this.handleMessage);
|
|
1591
1592
|
let d = !1;
|
|
@@ -1604,7 +1605,7 @@ class E extends K {
|
|
|
1604
1605
|
const w = await this.getRemoteDevicePeerId(c);
|
|
1605
1606
|
this.assertNotCancelled(d);
|
|
1606
1607
|
let v;
|
|
1607
|
-
for (let
|
|
1608
|
+
for (let A = 0; A < i && (v = await c.connect(w), !v); A++)
|
|
1608
1609
|
b(100), this.assertNotCancelled(d);
|
|
1609
1610
|
if (!v)
|
|
1610
1611
|
throw new Error(
|
|
@@ -1630,7 +1631,7 @@ class E extends K {
|
|
|
1630
1631
|
}
|
|
1631
1632
|
async getRemoteDevicePeerId(e) {
|
|
1632
1633
|
const n = (await e.getPeers()).find((i) => i.deviceId === this.id);
|
|
1633
|
-
if (!
|
|
1634
|
+
if (!We(n))
|
|
1634
1635
|
throw new Error("Cannot find peer, is the robot offline?");
|
|
1635
1636
|
return n.id;
|
|
1636
1637
|
}
|
|
@@ -1674,7 +1675,7 @@ class E extends K {
|
|
|
1674
1675
|
throw new Error(`Realtime connection hasn't been started for ${this.id}`);
|
|
1675
1676
|
}
|
|
1676
1677
|
async isInRealtimeSession() {
|
|
1677
|
-
const e = await
|
|
1678
|
+
const e = await ie(), t = await ae(), n = e.find((i) => i.deviceId === this.id);
|
|
1678
1679
|
return n ? t[n.id].length > 0 : !1;
|
|
1679
1680
|
}
|
|
1680
1681
|
async getAvailableCommands() {
|
|
@@ -1752,10 +1753,10 @@ class E extends K {
|
|
|
1752
1753
|
Authorization: "Bearer " + o.token
|
|
1753
1754
|
}
|
|
1754
1755
|
})).json();
|
|
1755
|
-
return new
|
|
1756
|
+
return new Fe(n);
|
|
1756
1757
|
}
|
|
1757
1758
|
async getTelemetry(e, t, n, i) {
|
|
1758
|
-
return await
|
|
1759
|
+
return await ne(
|
|
1759
1760
|
this.id,
|
|
1760
1761
|
e,
|
|
1761
1762
|
t,
|
|
@@ -1823,24 +1824,24 @@ class E extends K {
|
|
|
1823
1824
|
return await M({ ...e, deviceIds: [this.id] }, t);
|
|
1824
1825
|
}
|
|
1825
1826
|
async getAnnotationCountByIntervals(e, t, n) {
|
|
1826
|
-
return await
|
|
1827
|
+
return await te(
|
|
1827
1828
|
{ ...e, deviceIds: [this.id] },
|
|
1828
1829
|
t,
|
|
1829
1830
|
n
|
|
1830
1831
|
);
|
|
1831
1832
|
}
|
|
1832
1833
|
async eventsCounter(e, t, n, i, r) {
|
|
1833
|
-
return await
|
|
1834
|
+
return await ee(e, t, n, i, {
|
|
1834
1835
|
...r,
|
|
1835
1836
|
deviceIds: [this.id]
|
|
1836
1837
|
});
|
|
1837
1838
|
}
|
|
1838
1839
|
async createShareLink(e, t) {
|
|
1839
|
-
return e.scope.deviceIds = [this.id], await
|
|
1840
|
+
return e.scope.deviceIds = [this.id], await Y(e, t);
|
|
1840
1841
|
}
|
|
1841
1842
|
}
|
|
1842
|
-
s(E, "createDevice",
|
|
1843
|
-
class
|
|
1843
|
+
s(E, "createDevice", st), s(E, "patchDevice", ct), s(E, "getDevicesData", dt), s(E, "queryDevicesData", ht);
|
|
1844
|
+
class lt extends Q {
|
|
1844
1845
|
constructor(t) {
|
|
1845
1846
|
super();
|
|
1846
1847
|
s(this, "id");
|
|
@@ -1880,8 +1881,8 @@ class ht extends K {
|
|
|
1880
1881
|
if (m.length > 0) {
|
|
1881
1882
|
const v = JSON.parse(m);
|
|
1882
1883
|
if ((w = v.result) != null && w.datapoint) {
|
|
1883
|
-
const C = v.result.datapoint,
|
|
1884
|
-
delete C.stream, this.streamTelemetry[
|
|
1884
|
+
const C = v.result.datapoint, A = C.stream;
|
|
1885
|
+
delete C.stream, this.streamTelemetry[A] = C;
|
|
1885
1886
|
}
|
|
1886
1887
|
}
|
|
1887
1888
|
});
|
|
@@ -1904,7 +1905,7 @@ class ht extends K {
|
|
|
1904
1905
|
this.rtcClient && console.warn(
|
|
1905
1906
|
"overwriting existing rtcClient due to missing connectionMonitorInterval"
|
|
1906
1907
|
);
|
|
1907
|
-
const n = new
|
|
1908
|
+
const n = new D({
|
|
1908
1909
|
lanOnlyMode: !0,
|
|
1909
1910
|
receive: this.handleMessage,
|
|
1910
1911
|
sessionType: t
|
|
@@ -1961,7 +1962,7 @@ class ht extends K {
|
|
|
1961
1962
|
});
|
|
1962
1963
|
}
|
|
1963
1964
|
}
|
|
1964
|
-
async function
|
|
1965
|
+
async function ut(a, e) {
|
|
1965
1966
|
if (!o.token)
|
|
1966
1967
|
throw new Error("Not authenticated");
|
|
1967
1968
|
return await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
@@ -1973,7 +1974,7 @@ async function lt(a, e) {
|
|
|
1973
1974
|
}
|
|
1974
1975
|
})).json();
|
|
1975
1976
|
}
|
|
1976
|
-
async function
|
|
1977
|
+
async function mt(a) {
|
|
1977
1978
|
if (!o.token)
|
|
1978
1979
|
throw new Error("Not authenticated");
|
|
1979
1980
|
return (await (await fetch(`${h}/v1/queries/queries`, {
|
|
@@ -1985,7 +1986,7 @@ async function ut(a) {
|
|
|
1985
1986
|
}
|
|
1986
1987
|
})).json()).aggregates;
|
|
1987
1988
|
}
|
|
1988
|
-
async function
|
|
1989
|
+
async function ft(a) {
|
|
1989
1990
|
if (!o.token)
|
|
1990
1991
|
throw new Error("Not authenticated");
|
|
1991
1992
|
await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
@@ -1996,7 +1997,7 @@ async function mt(a) {
|
|
|
1996
1997
|
}
|
|
1997
1998
|
});
|
|
1998
1999
|
}
|
|
1999
|
-
async function
|
|
2000
|
+
async function wt() {
|
|
2000
2001
|
if (!o.token)
|
|
2001
2002
|
throw new Error("Not authenticated");
|
|
2002
2003
|
return (await (await fetch(
|
|
@@ -2010,7 +2011,7 @@ async function ft() {
|
|
|
2010
2011
|
}
|
|
2011
2012
|
)).json()).items;
|
|
2012
2013
|
}
|
|
2013
|
-
async function
|
|
2014
|
+
async function pt() {
|
|
2014
2015
|
if (!o.token)
|
|
2015
2016
|
throw new Error("Not authenticated");
|
|
2016
2017
|
return (await (await fetch(
|
|
@@ -2024,7 +2025,7 @@ async function wt() {
|
|
|
2024
2025
|
}
|
|
2025
2026
|
)).json()).items;
|
|
2026
2027
|
}
|
|
2027
|
-
async function
|
|
2028
|
+
async function yt(a) {
|
|
2028
2029
|
if (!o.token)
|
|
2029
2030
|
throw new Error("Not authenticated");
|
|
2030
2031
|
return await (await fetch(`${h}/v1/queries/analytics/rows`, {
|
|
@@ -2036,7 +2037,7 @@ async function pt(a) {
|
|
|
2036
2037
|
}
|
|
2037
2038
|
})).json();
|
|
2038
2039
|
}
|
|
2039
|
-
async function
|
|
2040
|
+
async function oe(a) {
|
|
2040
2041
|
if (!o.token)
|
|
2041
2042
|
throw new Error("Not authenticated");
|
|
2042
2043
|
return (await (await fetch(`${h}/v1/admin/devices/query`, {
|
|
@@ -2050,7 +2051,7 @@ async function ie(a) {
|
|
|
2050
2051
|
(n) => new E(n.id, n.name, n.organizationId, n.tags)
|
|
2051
2052
|
);
|
|
2052
2053
|
}
|
|
2053
|
-
async function
|
|
2054
|
+
async function gt() {
|
|
2054
2055
|
if (!o.token)
|
|
2055
2056
|
throw new Error("Not authenticated");
|
|
2056
2057
|
let a = new URLSearchParams("");
|
|
@@ -2067,13 +2068,13 @@ async function yt() {
|
|
|
2067
2068
|
}
|
|
2068
2069
|
}
|
|
2069
2070
|
), { tagKey: n, tagValue: i } = await t.json();
|
|
2070
|
-
return await
|
|
2071
|
+
return await oe({
|
|
2071
2072
|
tags: { [n]: [i] },
|
|
2072
2073
|
enabled: !0,
|
|
2073
2074
|
type: "default"
|
|
2074
2075
|
});
|
|
2075
2076
|
}
|
|
2076
|
-
async function
|
|
2077
|
+
async function vt(a) {
|
|
2077
2078
|
if (!o.token)
|
|
2078
2079
|
throw new Error("Not authenticated");
|
|
2079
2080
|
const t = await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
@@ -2105,7 +2106,7 @@ async function B() {
|
|
|
2105
2106
|
)
|
|
2106
2107
|
);
|
|
2107
2108
|
}
|
|
2108
|
-
async function
|
|
2109
|
+
async function Tt(a) {
|
|
2109
2110
|
if (!o.token)
|
|
2110
2111
|
throw new Error("Not authenticated");
|
|
2111
2112
|
return (await (await fetch(
|
|
@@ -2119,7 +2120,7 @@ async function vt(a) {
|
|
|
2119
2120
|
}
|
|
2120
2121
|
)).json()).items;
|
|
2121
2122
|
}
|
|
2122
|
-
async function
|
|
2123
|
+
async function Ct(a) {
|
|
2123
2124
|
const t = await (await fetch(`${h}/v1/admin/files/query`, {
|
|
2124
2125
|
method: "POST",
|
|
2125
2126
|
body: JSON.stringify({
|
|
@@ -2134,7 +2135,7 @@ async function Tt(a) {
|
|
|
2134
2135
|
throw new Error("File not found");
|
|
2135
2136
|
return t.fileUrls[0];
|
|
2136
2137
|
}
|
|
2137
|
-
async function
|
|
2138
|
+
async function St(a) {
|
|
2138
2139
|
if (!o.token)
|
|
2139
2140
|
throw new Error("Not authenticated");
|
|
2140
2141
|
return await (await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
@@ -2145,7 +2146,7 @@ async function Ct(a) {
|
|
|
2145
2146
|
}
|
|
2146
2147
|
})).json();
|
|
2147
2148
|
}
|
|
2148
|
-
async function
|
|
2149
|
+
async function Et(a) {
|
|
2149
2150
|
if (!o.token)
|
|
2150
2151
|
throw new Error("Not authenticated");
|
|
2151
2152
|
return (await (await fetch(`${h}/v1/admin/fleets/${a}/devices`, {
|
|
@@ -2156,7 +2157,7 @@ async function St(a) {
|
|
|
2156
2157
|
}
|
|
2157
2158
|
})).json()).items;
|
|
2158
2159
|
}
|
|
2159
|
-
async function
|
|
2160
|
+
async function kt() {
|
|
2160
2161
|
if (!o.token)
|
|
2161
2162
|
throw new Error("Not authenticated");
|
|
2162
2163
|
return (await (await fetch(
|
|
@@ -2170,7 +2171,7 @@ async function Et() {
|
|
|
2170
2171
|
}
|
|
2171
2172
|
)).json()).items;
|
|
2172
2173
|
}
|
|
2173
|
-
async function
|
|
2174
|
+
async function Ot(...a) {
|
|
2174
2175
|
const e = a.flat().filter((i) => !!i);
|
|
2175
2176
|
return e.length === 0 ? [] : (await (await fetch(
|
|
2176
2177
|
`${h}/v1/queries/stream-current-value`,
|
|
@@ -2186,7 +2187,7 @@ async function kt(...a) {
|
|
|
2186
2187
|
}
|
|
2187
2188
|
)).json()).items;
|
|
2188
2189
|
}
|
|
2189
|
-
async function
|
|
2190
|
+
async function Rt() {
|
|
2190
2191
|
if (!o.token)
|
|
2191
2192
|
throw new Error("Not authenticated");
|
|
2192
2193
|
const t = (await (await fetch(`${h}/v1/queries/online-devices`, {
|
|
@@ -2198,7 +2199,7 @@ async function Ot() {
|
|
|
2198
2199
|
})).json()).items;
|
|
2199
2200
|
return (await B()).filter((i) => t.includes(i.id));
|
|
2200
2201
|
}
|
|
2201
|
-
async function
|
|
2202
|
+
async function bt() {
|
|
2202
2203
|
if (!o.token)
|
|
2203
2204
|
throw new Error("Not authenticated");
|
|
2204
2205
|
const t = (await (await fetch(`${h}/v1/signaling/peers`, {
|
|
@@ -2212,7 +2213,7 @@ async function Rt() {
|
|
|
2212
2213
|
);
|
|
2213
2214
|
return (await B()).filter((i) => t.includes(i.id));
|
|
2214
2215
|
}
|
|
2215
|
-
async function
|
|
2216
|
+
async function At() {
|
|
2216
2217
|
if (!o.token)
|
|
2217
2218
|
throw new Error("Not authenticated");
|
|
2218
2219
|
return (await (await fetch(`${h}/v1/admin/streams`, {
|
|
@@ -2240,7 +2241,7 @@ async function Dt(a) {
|
|
|
2240
2241
|
}
|
|
2241
2242
|
)).json();
|
|
2242
2243
|
}
|
|
2243
|
-
async function
|
|
2244
|
+
async function Pt() {
|
|
2244
2245
|
if (!o.token)
|
|
2245
2246
|
throw new Error("Not authenticated");
|
|
2246
2247
|
return (await (await fetch(
|
|
@@ -2254,7 +2255,7 @@ async function At() {
|
|
|
2254
2255
|
}
|
|
2255
2256
|
)).json()).items;
|
|
2256
2257
|
}
|
|
2257
|
-
async function
|
|
2258
|
+
async function Nt() {
|
|
2258
2259
|
if (!o.token)
|
|
2259
2260
|
throw new Error("Not authenticated");
|
|
2260
2261
|
return (await (await fetch(`${h}/v1/admin/fleets`, {
|
|
@@ -2265,7 +2266,7 @@ async function Pt() {
|
|
|
2265
2266
|
}
|
|
2266
2267
|
})).json()).items;
|
|
2267
2268
|
}
|
|
2268
|
-
async function
|
|
2269
|
+
async function jt(a, e) {
|
|
2269
2270
|
if (!o.token)
|
|
2270
2271
|
throw new Error("Not authenticated");
|
|
2271
2272
|
return await (await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
@@ -2277,7 +2278,7 @@ async function Nt(a, e) {
|
|
|
2277
2278
|
}
|
|
2278
2279
|
})).json();
|
|
2279
2280
|
}
|
|
2280
|
-
async function
|
|
2281
|
+
async function It(a) {
|
|
2281
2282
|
if (!o.token)
|
|
2282
2283
|
throw new Error("Not authenticated");
|
|
2283
2284
|
return await (await fetch(
|
|
@@ -2292,7 +2293,7 @@ async function jt(a) {
|
|
|
2292
2293
|
}
|
|
2293
2294
|
)).json();
|
|
2294
2295
|
}
|
|
2295
|
-
async function
|
|
2296
|
+
async function Lt(a) {
|
|
2296
2297
|
if (!o.token)
|
|
2297
2298
|
throw new Error("Not authenticated");
|
|
2298
2299
|
return await (await fetch(`${h}/v1/admin/views/${a.id}`, {
|
|
@@ -2304,7 +2305,7 @@ async function It(a) {
|
|
|
2304
2305
|
}
|
|
2305
2306
|
})).json();
|
|
2306
2307
|
}
|
|
2307
|
-
async function
|
|
2308
|
+
async function _t(a) {
|
|
2308
2309
|
if (!o.token)
|
|
2309
2310
|
throw new Error("Not authenticated");
|
|
2310
2311
|
return await (await fetch(`${h}/v1/queries/analytics`, {
|
|
@@ -2316,6 +2317,18 @@ async function Lt(a) {
|
|
|
2316
2317
|
}
|
|
2317
2318
|
})).json();
|
|
2318
2319
|
}
|
|
2320
|
+
async function $t(a) {
|
|
2321
|
+
if (!o.token)
|
|
2322
|
+
throw new Error("Not authenticated");
|
|
2323
|
+
return await (await fetch(`${h}/v1/admin/fleets`, {
|
|
2324
|
+
method: "POST",
|
|
2325
|
+
body: JSON.stringify(a),
|
|
2326
|
+
headers: {
|
|
2327
|
+
"Content-Type": "application/json",
|
|
2328
|
+
Authorization: "Bearer " + o.token
|
|
2329
|
+
}
|
|
2330
|
+
})).json();
|
|
2331
|
+
}
|
|
2319
2332
|
const S = class {
|
|
2320
2333
|
static async setDefaultDevice(e) {
|
|
2321
2334
|
S.defaultDeviceId = e;
|
|
@@ -2345,17 +2358,17 @@ const S = class {
|
|
|
2345
2358
|
return S.knownContext.push(new WeakRef(r)), r;
|
|
2346
2359
|
}
|
|
2347
2360
|
static async getPeerDevice(e) {
|
|
2348
|
-
const t = new
|
|
2361
|
+
const t = new lt(e);
|
|
2349
2362
|
return t.id = await t.getDeviceId(), t;
|
|
2350
2363
|
}
|
|
2351
2364
|
static async getDevice(e) {
|
|
2352
|
-
const t = await
|
|
2365
|
+
const t = await vt(e);
|
|
2353
2366
|
return S.knownContext.push(new WeakRef(t)), t;
|
|
2354
2367
|
}
|
|
2355
2368
|
};
|
|
2356
2369
|
let l = S;
|
|
2357
|
-
s(l, "defaultDeviceId"), s(l, "knownContext", []), s(l, "listFleets",
|
|
2358
|
-
class
|
|
2370
|
+
s(l, "defaultDeviceId"), s(l, "knownContext", []), s(l, "createFleet", $t), s(l, "listFleets", Nt), s(l, "getFleet", St), s(l, "patchFleet", jt), s(l, "deleteFleet", ft), s(l, "addDeviceToFleet", ut), s(l, "getFleetDevices", Et), s(l, "aggregateTelemetry", mt), s(l, "createShareLink", Y), s(l, "eventsCounter", ee), s(l, "getAnalyticStreams", wt), s(l, "getAnalyticsModules", pt), s(l, "getAnalyticsRows", yt), s(l, "getAnnotationCount", M), s(l, "getAnnotationCountByIntervals", te), s(l, "getCurrentGroup", gt), s(l, "getDevices", B), s(l, "getEvent", Tt), s(l, "getFileUrl", Ct), s(l, "getInterventions", kt), s(l, "getLatestTelemetry", Ot), s(l, "getOnlineDevices", Rt), s(l, "getPeers", ie), s(l, "getRealtimeDevices", bt), s(l, "getRealtimeSessions", ae), s(l, "getStreams", At), s(l, "getTaskReportRows", Dt), s(l, "getTaskReportTables", Pt), s(l, "getTelemetry", ne), s(l, "getViews", X), s(l, "patchStream", It), s(l, "patchView", Lt), s(l, "queryAnalytics", _t), s(l, "queryDevices", oe), s(l, "queryEvents", z), s(l, "queryTelemetry", _);
|
|
2371
|
+
class Xt {
|
|
2359
2372
|
static async set(e, t, n) {
|
|
2360
2373
|
try {
|
|
2361
2374
|
const i = await fetch(h + "/v1/admin/key-value", {
|
|
@@ -2431,15 +2444,15 @@ class Ht {
|
|
|
2431
2444
|
}
|
|
2432
2445
|
}
|
|
2433
2446
|
}
|
|
2434
|
-
function
|
|
2435
|
-
return Uint8Array.from(
|
|
2447
|
+
function zt(a) {
|
|
2448
|
+
return Uint8Array.from(J(a), (e) => e.charCodeAt(0));
|
|
2436
2449
|
}
|
|
2437
2450
|
function U() {
|
|
2438
2451
|
const { userAgent: a } = navigator;
|
|
2439
2452
|
return a ? a.includes("Firefox/") ? "Firefox" : a.includes("Edg/") ? "Edge" : a.includes("Chrome/") ? "Chrome" : a.includes("Safari/") ? "Safari" : a.includes("MSIE/") || a.includes("Trident/") ? "IE" : "Other" : "Other";
|
|
2440
2453
|
}
|
|
2441
|
-
const
|
|
2442
|
-
class
|
|
2454
|
+
const Mt = "audio-chunk";
|
|
2455
|
+
class Yt {
|
|
2443
2456
|
constructor(e, t) {
|
|
2444
2457
|
s(this, "muted", !1);
|
|
2445
2458
|
s(this, "hasReceivedData", !1);
|
|
@@ -2456,9 +2469,9 @@ class Kt {
|
|
|
2456
2469
|
return;
|
|
2457
2470
|
this.hasReceivedData || (this.hasReceivedData = !0);
|
|
2458
2471
|
const { audioContext: n, muted: i } = this;
|
|
2459
|
-
if (!n || e.header.stream.streamType !==
|
|
2472
|
+
if (!n || e.header.stream.streamType !== Mt || i !== !1)
|
|
2460
2473
|
return;
|
|
2461
|
-
const r =
|
|
2474
|
+
const r = zt(t);
|
|
2462
2475
|
try {
|
|
2463
2476
|
await n.decodeAudioData(
|
|
2464
2477
|
r.buffer,
|
|
@@ -2511,7 +2524,7 @@ class Kt {
|
|
|
2511
2524
|
(async () => await this.device.changeStreamAudioType(t.name, e))();
|
|
2512
2525
|
}
|
|
2513
2526
|
}
|
|
2514
|
-
class
|
|
2527
|
+
class Zt {
|
|
2515
2528
|
static async listAccounts() {
|
|
2516
2529
|
if (!o.token)
|
|
2517
2530
|
throw new Error("Not authenticated");
|
|
@@ -2584,7 +2597,7 @@ class Qt {
|
|
|
2584
2597
|
)).json();
|
|
2585
2598
|
}
|
|
2586
2599
|
}
|
|
2587
|
-
class
|
|
2600
|
+
class en {
|
|
2588
2601
|
static async listRoles() {
|
|
2589
2602
|
if (!o.token)
|
|
2590
2603
|
throw new Error("Not authenticated");
|
|
@@ -2643,7 +2656,7 @@ class Xt {
|
|
|
2643
2656
|
});
|
|
2644
2657
|
}
|
|
2645
2658
|
}
|
|
2646
|
-
class
|
|
2659
|
+
class tn {
|
|
2647
2660
|
static async listUsers() {
|
|
2648
2661
|
if (!o.token)
|
|
2649
2662
|
throw new Error("Not authenticated");
|
|
@@ -2703,14 +2716,14 @@ class Yt {
|
|
|
2703
2716
|
});
|
|
2704
2717
|
}
|
|
2705
2718
|
}
|
|
2706
|
-
const
|
|
2719
|
+
const nn = ["viewer", "operator", "administrator"], an = "viewer", on = "operator", rn = "administrator", sn = [
|
|
2707
2720
|
"year",
|
|
2708
2721
|
"month",
|
|
2709
2722
|
"week",
|
|
2710
2723
|
"day",
|
|
2711
2724
|
"hour",
|
|
2712
2725
|
"minute"
|
|
2713
|
-
],
|
|
2726
|
+
], cn = ["tag", "sheet", "user"], dn = [
|
|
2714
2727
|
"triggered-event",
|
|
2715
2728
|
"intervention-request",
|
|
2716
2729
|
"teleop-session-record",
|
|
@@ -2722,12 +2735,12 @@ const Zt = ["viewer", "operator", "administrator"], en = "viewer", tn = "operato
|
|
|
2722
2735
|
"comment",
|
|
2723
2736
|
"system",
|
|
2724
2737
|
"annotation"
|
|
2725
|
-
],
|
|
2738
|
+
], hn = [
|
|
2726
2739
|
"unknown",
|
|
2727
2740
|
"operational",
|
|
2728
2741
|
"offline",
|
|
2729
2742
|
"error"
|
|
2730
|
-
],
|
|
2743
|
+
], ln = ["selection", "labeling", "teleop"], un = ["info", "warning", "error", "critical"], mn = ["video/mp4"];
|
|
2731
2744
|
try {
|
|
2732
2745
|
const a = typeof window < "u" && window.location ? new URLSearchParams(window.location.search) : new URLSearchParams(""), e = a.get("device");
|
|
2733
2746
|
e && l.setDefaultDevice(e);
|
|
@@ -2736,44 +2749,44 @@ try {
|
|
|
2736
2749
|
} catch {
|
|
2737
2750
|
}
|
|
2738
2751
|
export {
|
|
2739
|
-
|
|
2752
|
+
Zt as Account,
|
|
2740
2753
|
y as App,
|
|
2741
|
-
|
|
2754
|
+
Yt as AudioPlayer,
|
|
2742
2755
|
o as Authentication,
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2756
|
+
Ke as BinaryRequestDataChannel,
|
|
2757
|
+
Fe as CaptureStream,
|
|
2758
|
+
Ge as DataChannel,
|
|
2746
2759
|
E as Device,
|
|
2747
2760
|
l as Fleet,
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2761
|
+
Xt as KeyValue,
|
|
2762
|
+
He as Manipulator,
|
|
2763
|
+
lt as PeerDevice,
|
|
2764
|
+
en as Role,
|
|
2765
|
+
Gt as SessionType,
|
|
2766
|
+
Qe as TextRequestDataChannel,
|
|
2767
|
+
tn as User,
|
|
2768
|
+
nn as accessLevels,
|
|
2769
|
+
rn as administrator,
|
|
2770
|
+
Z as aggregateByDateFunctions,
|
|
2771
|
+
Qt as aggregateFunctionMap,
|
|
2772
|
+
Kt as aggregateFunctions,
|
|
2773
|
+
sn as aggregateLevels,
|
|
2774
|
+
cn as annotationTypes,
|
|
2775
|
+
dn as eventTypes,
|
|
2776
|
+
rt as formatTimeFrameText,
|
|
2777
|
+
at as getAverage,
|
|
2778
|
+
ot as getCount,
|
|
2779
|
+
tt as getMax,
|
|
2780
|
+
nt as getMin,
|
|
2781
|
+
et as getStandardDeviation,
|
|
2782
|
+
it as getSum,
|
|
2783
|
+
Ze as getVariance,
|
|
2784
|
+
hn as healthStatuses,
|
|
2785
|
+
ln as interventionTypes,
|
|
2786
|
+
on as operator,
|
|
2787
|
+
un as severities,
|
|
2788
|
+
Ht as vailableAggregationIntervals,
|
|
2789
|
+
mn as videoMimeTypes,
|
|
2790
|
+
an as viewer
|
|
2778
2791
|
};
|
|
2779
2792
|
//# sourceMappingURL=data-sdk.es.js.map
|