@formant/data-sdk 1.5.4 → 1.7.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 +258 -230
- package/dist/data-sdk.es.js.map +1 -1
- package/dist/data-sdk.es6.js +2361 -2285
- 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/dist/types/data-sdk/src/api/disableDevice.d.ts +2 -0
- package/dist/types/data-sdk/src/devices/Device.d.ts +2 -0
- package/dist/types/data-sdk/src/main.d.ts +1 -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 Be {
|
|
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,8 +508,8 @@ class ze {
|
|
|
507
508
|
});
|
|
508
509
|
}
|
|
509
510
|
}
|
|
510
|
-
const Me = new
|
|
511
|
-
function
|
|
511
|
+
const Me = new Be();
|
|
512
|
+
function qe(a, e, t) {
|
|
512
513
|
const n = (i) => {
|
|
513
514
|
const r = i.data;
|
|
514
515
|
if (r.type === "module_data") {
|
|
@@ -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
|
+
}, Ht = {
|
|
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 qt;
|
|
636
637
|
class N {
|
|
637
638
|
constructor(e) {
|
|
638
|
-
s(this,
|
|
639
|
+
s(this, qt, 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
|
+
qt = 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 Kt = [
|
|
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
|
+
], Qt = [
|
|
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 Xt = {
|
|
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({
|
|
@@ -1393,7 +1394,7 @@ async function Z(a, e, t, n, i) {
|
|
|
1393
1394
|
})
|
|
1394
1395
|
);
|
|
1395
1396
|
}
|
|
1396
|
-
async function
|
|
1397
|
+
async function B(a, e) {
|
|
1397
1398
|
return (await z({
|
|
1398
1399
|
...a,
|
|
1399
1400
|
eventTypes: ["annotation"]
|
|
@@ -1404,13 +1405,13 @@ 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) => {
|
|
1412
1413
|
const v = new Date(m).toISOString(), C = w === c.length - 1 ? new Date(Date.now()).toISOString() : new Date(c[w + 1]);
|
|
1413
|
-
return
|
|
1414
|
+
return B(
|
|
1414
1415
|
{
|
|
1415
1416
|
...a,
|
|
1416
1417
|
start: v,
|
|
@@ -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,21 @@ async function dt(a) {
|
|
|
1511
1512
|
}
|
|
1512
1513
|
})).json()).items;
|
|
1513
1514
|
}
|
|
1514
|
-
|
|
1515
|
+
async function lt(a) {
|
|
1516
|
+
if (!o.token)
|
|
1517
|
+
throw new Error("Not authenticated");
|
|
1518
|
+
return await (await fetch(
|
|
1519
|
+
`${h}/v1/admin/devices/${a}/disable`,
|
|
1520
|
+
{
|
|
1521
|
+
method: "POST",
|
|
1522
|
+
headers: {
|
|
1523
|
+
"Content-Type": "application/json",
|
|
1524
|
+
Authorization: "Bearer " + o.token
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
)).json();
|
|
1528
|
+
}
|
|
1529
|
+
class S extends Q {
|
|
1515
1530
|
constructor(e, t, n, i) {
|
|
1516
1531
|
super(), this.id = e, this.name = t, this.organizationId = n, this.tags = i;
|
|
1517
1532
|
}
|
|
@@ -1585,7 +1600,7 @@ class E extends K {
|
|
|
1585
1600
|
sessionType: t,
|
|
1586
1601
|
deadlineMs: n = 1e4,
|
|
1587
1602
|
maxConnectRetries: i = 3
|
|
1588
|
-
} = typeof e == "number" ? { sessionType: e } : e, c =
|
|
1603
|
+
} = typeof e == "number" ? { sessionType: e } : e, c = Ve({
|
|
1589
1604
|
sessionType: t
|
|
1590
1605
|
}).get(this.handleMessage);
|
|
1591
1606
|
let d = !1;
|
|
@@ -1604,7 +1619,7 @@ class E extends K {
|
|
|
1604
1619
|
const w = await this.getRemoteDevicePeerId(c);
|
|
1605
1620
|
this.assertNotCancelled(d);
|
|
1606
1621
|
let v;
|
|
1607
|
-
for (let
|
|
1622
|
+
for (let A = 0; A < i && (v = await c.connect(w), !v); A++)
|
|
1608
1623
|
b(100), this.assertNotCancelled(d);
|
|
1609
1624
|
if (!v)
|
|
1610
1625
|
throw new Error(
|
|
@@ -1630,7 +1645,7 @@ class E extends K {
|
|
|
1630
1645
|
}
|
|
1631
1646
|
async getRemoteDevicePeerId(e) {
|
|
1632
1647
|
const n = (await e.getPeers()).find((i) => i.deviceId === this.id);
|
|
1633
|
-
if (!
|
|
1648
|
+
if (!We(n))
|
|
1634
1649
|
throw new Error("Cannot find peer, is the robot offline?");
|
|
1635
1650
|
return n.id;
|
|
1636
1651
|
}
|
|
@@ -1674,7 +1689,7 @@ class E extends K {
|
|
|
1674
1689
|
throw new Error(`Realtime connection hasn't been started for ${this.id}`);
|
|
1675
1690
|
}
|
|
1676
1691
|
async isInRealtimeSession() {
|
|
1677
|
-
const e = await
|
|
1692
|
+
const e = await ie(), t = await ae(), n = e.find((i) => i.deviceId === this.id);
|
|
1678
1693
|
return n ? t[n.id].length > 0 : !1;
|
|
1679
1694
|
}
|
|
1680
1695
|
async getAvailableCommands() {
|
|
@@ -1752,10 +1767,10 @@ class E extends K {
|
|
|
1752
1767
|
Authorization: "Bearer " + o.token
|
|
1753
1768
|
}
|
|
1754
1769
|
})).json();
|
|
1755
|
-
return new
|
|
1770
|
+
return new Fe(n);
|
|
1756
1771
|
}
|
|
1757
1772
|
async getTelemetry(e, t, n, i) {
|
|
1758
|
-
return await
|
|
1773
|
+
return await ne(
|
|
1759
1774
|
this.id,
|
|
1760
1775
|
e,
|
|
1761
1776
|
t,
|
|
@@ -1820,27 +1835,27 @@ class E extends K {
|
|
|
1820
1835
|
)).json();
|
|
1821
1836
|
}
|
|
1822
1837
|
async getAnnotationCount(e, t) {
|
|
1823
|
-
return await
|
|
1838
|
+
return await B({ ...e, deviceIds: [this.id] }, t);
|
|
1824
1839
|
}
|
|
1825
1840
|
async getAnnotationCountByIntervals(e, t, n) {
|
|
1826
|
-
return await
|
|
1841
|
+
return await te(
|
|
1827
1842
|
{ ...e, deviceIds: [this.id] },
|
|
1828
1843
|
t,
|
|
1829
1844
|
n
|
|
1830
1845
|
);
|
|
1831
1846
|
}
|
|
1832
1847
|
async eventsCounter(e, t, n, i, r) {
|
|
1833
|
-
return await
|
|
1848
|
+
return await ee(e, t, n, i, {
|
|
1834
1849
|
...r,
|
|
1835
1850
|
deviceIds: [this.id]
|
|
1836
1851
|
});
|
|
1837
1852
|
}
|
|
1838
1853
|
async createShareLink(e, t) {
|
|
1839
|
-
return e.scope.deviceIds = [this.id], await
|
|
1854
|
+
return e.scope.deviceIds = [this.id], await Y(e, t);
|
|
1840
1855
|
}
|
|
1841
1856
|
}
|
|
1842
|
-
s(
|
|
1843
|
-
class
|
|
1857
|
+
s(S, "createDevice", st), s(S, "patchDevice", ct), s(S, "getDevicesData", dt), s(S, "queryDevicesData", ht), s(S, "disableDevice", lt);
|
|
1858
|
+
class ut extends Q {
|
|
1844
1859
|
constructor(t) {
|
|
1845
1860
|
super();
|
|
1846
1861
|
s(this, "id");
|
|
@@ -1880,8 +1895,8 @@ class ht extends K {
|
|
|
1880
1895
|
if (m.length > 0) {
|
|
1881
1896
|
const v = JSON.parse(m);
|
|
1882
1897
|
if ((w = v.result) != null && w.datapoint) {
|
|
1883
|
-
const C = v.result.datapoint,
|
|
1884
|
-
delete C.stream, this.streamTelemetry[
|
|
1898
|
+
const C = v.result.datapoint, A = C.stream;
|
|
1899
|
+
delete C.stream, this.streamTelemetry[A] = C;
|
|
1885
1900
|
}
|
|
1886
1901
|
}
|
|
1887
1902
|
});
|
|
@@ -1904,7 +1919,7 @@ class ht extends K {
|
|
|
1904
1919
|
this.rtcClient && console.warn(
|
|
1905
1920
|
"overwriting existing rtcClient due to missing connectionMonitorInterval"
|
|
1906
1921
|
);
|
|
1907
|
-
const n = new
|
|
1922
|
+
const n = new D({
|
|
1908
1923
|
lanOnlyMode: !0,
|
|
1909
1924
|
receive: this.handleMessage,
|
|
1910
1925
|
sessionType: t
|
|
@@ -1961,7 +1976,7 @@ class ht extends K {
|
|
|
1961
1976
|
});
|
|
1962
1977
|
}
|
|
1963
1978
|
}
|
|
1964
|
-
async function
|
|
1979
|
+
async function mt(a, e) {
|
|
1965
1980
|
if (!o.token)
|
|
1966
1981
|
throw new Error("Not authenticated");
|
|
1967
1982
|
return await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
@@ -1973,7 +1988,7 @@ async function lt(a, e) {
|
|
|
1973
1988
|
}
|
|
1974
1989
|
})).json();
|
|
1975
1990
|
}
|
|
1976
|
-
async function
|
|
1991
|
+
async function ft(a) {
|
|
1977
1992
|
if (!o.token)
|
|
1978
1993
|
throw new Error("Not authenticated");
|
|
1979
1994
|
return (await (await fetch(`${h}/v1/queries/queries`, {
|
|
@@ -1985,7 +2000,7 @@ async function ut(a) {
|
|
|
1985
2000
|
}
|
|
1986
2001
|
})).json()).aggregates;
|
|
1987
2002
|
}
|
|
1988
|
-
async function
|
|
2003
|
+
async function wt(a) {
|
|
1989
2004
|
if (!o.token)
|
|
1990
2005
|
throw new Error("Not authenticated");
|
|
1991
2006
|
await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
@@ -1996,7 +2011,7 @@ async function mt(a) {
|
|
|
1996
2011
|
}
|
|
1997
2012
|
});
|
|
1998
2013
|
}
|
|
1999
|
-
async function
|
|
2014
|
+
async function pt() {
|
|
2000
2015
|
if (!o.token)
|
|
2001
2016
|
throw new Error("Not authenticated");
|
|
2002
2017
|
return (await (await fetch(
|
|
@@ -2010,7 +2025,7 @@ async function ft() {
|
|
|
2010
2025
|
}
|
|
2011
2026
|
)).json()).items;
|
|
2012
2027
|
}
|
|
2013
|
-
async function
|
|
2028
|
+
async function yt() {
|
|
2014
2029
|
if (!o.token)
|
|
2015
2030
|
throw new Error("Not authenticated");
|
|
2016
2031
|
return (await (await fetch(
|
|
@@ -2024,7 +2039,7 @@ async function wt() {
|
|
|
2024
2039
|
}
|
|
2025
2040
|
)).json()).items;
|
|
2026
2041
|
}
|
|
2027
|
-
async function
|
|
2042
|
+
async function gt(a) {
|
|
2028
2043
|
if (!o.token)
|
|
2029
2044
|
throw new Error("Not authenticated");
|
|
2030
2045
|
return await (await fetch(`${h}/v1/queries/analytics/rows`, {
|
|
@@ -2036,7 +2051,7 @@ async function pt(a) {
|
|
|
2036
2051
|
}
|
|
2037
2052
|
})).json();
|
|
2038
2053
|
}
|
|
2039
|
-
async function
|
|
2054
|
+
async function oe(a) {
|
|
2040
2055
|
if (!o.token)
|
|
2041
2056
|
throw new Error("Not authenticated");
|
|
2042
2057
|
return (await (await fetch(`${h}/v1/admin/devices/query`, {
|
|
@@ -2047,10 +2062,10 @@ async function ie(a) {
|
|
|
2047
2062
|
Authorization: "Bearer " + o.token
|
|
2048
2063
|
}
|
|
2049
2064
|
})).json()).items.map(
|
|
2050
|
-
(n) => new
|
|
2065
|
+
(n) => new S(n.id, n.name, n.organizationId, n.tags)
|
|
2051
2066
|
);
|
|
2052
2067
|
}
|
|
2053
|
-
async function
|
|
2068
|
+
async function vt() {
|
|
2054
2069
|
if (!o.token)
|
|
2055
2070
|
throw new Error("Not authenticated");
|
|
2056
2071
|
let a = new URLSearchParams("");
|
|
@@ -2067,13 +2082,13 @@ async function yt() {
|
|
|
2067
2082
|
}
|
|
2068
2083
|
}
|
|
2069
2084
|
), { tagKey: n, tagValue: i } = await t.json();
|
|
2070
|
-
return await
|
|
2085
|
+
return await oe({
|
|
2071
2086
|
tags: { [n]: [i] },
|
|
2072
2087
|
enabled: !0,
|
|
2073
2088
|
type: "default"
|
|
2074
2089
|
});
|
|
2075
2090
|
}
|
|
2076
|
-
async function
|
|
2091
|
+
async function Tt(a) {
|
|
2077
2092
|
if (!o.token)
|
|
2078
2093
|
throw new Error("Not authenticated");
|
|
2079
2094
|
const t = await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
@@ -2083,9 +2098,9 @@ async function gt(a) {
|
|
|
2083
2098
|
Authorization: "Bearer " + o.token
|
|
2084
2099
|
}
|
|
2085
2100
|
})).json(), n = t.name;
|
|
2086
|
-
return new
|
|
2101
|
+
return new S(a, n, t.organizationId, t.tags);
|
|
2087
2102
|
}
|
|
2088
|
-
async function
|
|
2103
|
+
async function M() {
|
|
2089
2104
|
if (!o.token)
|
|
2090
2105
|
throw new Error("Not authenticated");
|
|
2091
2106
|
const e = await (await fetch(`${h}/v1/admin/device-details/query`, {
|
|
@@ -2097,7 +2112,7 @@ async function B() {
|
|
|
2097
2112
|
}
|
|
2098
2113
|
})).json();
|
|
2099
2114
|
return e.items, e.items.map(
|
|
2100
|
-
(t) => new
|
|
2115
|
+
(t) => new S(
|
|
2101
2116
|
t.id,
|
|
2102
2117
|
t.name,
|
|
2103
2118
|
t.organizationId,
|
|
@@ -2105,7 +2120,7 @@ async function B() {
|
|
|
2105
2120
|
)
|
|
2106
2121
|
);
|
|
2107
2122
|
}
|
|
2108
|
-
async function
|
|
2123
|
+
async function Ct(a) {
|
|
2109
2124
|
if (!o.token)
|
|
2110
2125
|
throw new Error("Not authenticated");
|
|
2111
2126
|
return (await (await fetch(
|
|
@@ -2119,7 +2134,7 @@ async function vt(a) {
|
|
|
2119
2134
|
}
|
|
2120
2135
|
)).json()).items;
|
|
2121
2136
|
}
|
|
2122
|
-
async function
|
|
2137
|
+
async function St(a) {
|
|
2123
2138
|
const t = await (await fetch(`${h}/v1/admin/files/query`, {
|
|
2124
2139
|
method: "POST",
|
|
2125
2140
|
body: JSON.stringify({
|
|
@@ -2134,7 +2149,7 @@ async function Tt(a) {
|
|
|
2134
2149
|
throw new Error("File not found");
|
|
2135
2150
|
return t.fileUrls[0];
|
|
2136
2151
|
}
|
|
2137
|
-
async function
|
|
2152
|
+
async function Et(a) {
|
|
2138
2153
|
if (!o.token)
|
|
2139
2154
|
throw new Error("Not authenticated");
|
|
2140
2155
|
return await (await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
@@ -2145,7 +2160,7 @@ async function Ct(a) {
|
|
|
2145
2160
|
}
|
|
2146
2161
|
})).json();
|
|
2147
2162
|
}
|
|
2148
|
-
async function
|
|
2163
|
+
async function kt(a) {
|
|
2149
2164
|
if (!o.token)
|
|
2150
2165
|
throw new Error("Not authenticated");
|
|
2151
2166
|
return (await (await fetch(`${h}/v1/admin/fleets/${a}/devices`, {
|
|
@@ -2156,7 +2171,7 @@ async function St(a) {
|
|
|
2156
2171
|
}
|
|
2157
2172
|
})).json()).items;
|
|
2158
2173
|
}
|
|
2159
|
-
async function
|
|
2174
|
+
async function Ot() {
|
|
2160
2175
|
if (!o.token)
|
|
2161
2176
|
throw new Error("Not authenticated");
|
|
2162
2177
|
return (await (await fetch(
|
|
@@ -2170,7 +2185,7 @@ async function Et() {
|
|
|
2170
2185
|
}
|
|
2171
2186
|
)).json()).items;
|
|
2172
2187
|
}
|
|
2173
|
-
async function
|
|
2188
|
+
async function Rt(...a) {
|
|
2174
2189
|
const e = a.flat().filter((i) => !!i);
|
|
2175
2190
|
return e.length === 0 ? [] : (await (await fetch(
|
|
2176
2191
|
`${h}/v1/queries/stream-current-value`,
|
|
@@ -2186,7 +2201,7 @@ async function kt(...a) {
|
|
|
2186
2201
|
}
|
|
2187
2202
|
)).json()).items;
|
|
2188
2203
|
}
|
|
2189
|
-
async function
|
|
2204
|
+
async function bt() {
|
|
2190
2205
|
if (!o.token)
|
|
2191
2206
|
throw new Error("Not authenticated");
|
|
2192
2207
|
const t = (await (await fetch(`${h}/v1/queries/online-devices`, {
|
|
@@ -2196,9 +2211,9 @@ async function Ot() {
|
|
|
2196
2211
|
Authorization: "Bearer " + o.token
|
|
2197
2212
|
}
|
|
2198
2213
|
})).json()).items;
|
|
2199
|
-
return (await
|
|
2214
|
+
return (await M()).filter((i) => t.includes(i.id));
|
|
2200
2215
|
}
|
|
2201
|
-
async function
|
|
2216
|
+
async function At() {
|
|
2202
2217
|
if (!o.token)
|
|
2203
2218
|
throw new Error("Not authenticated");
|
|
2204
2219
|
const t = (await (await fetch(`${h}/v1/signaling/peers`, {
|
|
@@ -2210,9 +2225,9 @@ async function Rt() {
|
|
|
2210
2225
|
})).json()).items.map(
|
|
2211
2226
|
(i) => i.deviceId
|
|
2212
2227
|
);
|
|
2213
|
-
return (await
|
|
2228
|
+
return (await M()).filter((i) => t.includes(i.id));
|
|
2214
2229
|
}
|
|
2215
|
-
async function
|
|
2230
|
+
async function Dt() {
|
|
2216
2231
|
if (!o.token)
|
|
2217
2232
|
throw new Error("Not authenticated");
|
|
2218
2233
|
return (await (await fetch(`${h}/v1/admin/streams`, {
|
|
@@ -2225,7 +2240,7 @@ async function bt() {
|
|
|
2225
2240
|
(t) => t.enabled
|
|
2226
2241
|
);
|
|
2227
2242
|
}
|
|
2228
|
-
async function
|
|
2243
|
+
async function Pt(a) {
|
|
2229
2244
|
if (!o.token)
|
|
2230
2245
|
throw new Error("Not authenticated");
|
|
2231
2246
|
return await (await fetch(
|
|
@@ -2240,7 +2255,7 @@ async function Dt(a) {
|
|
|
2240
2255
|
}
|
|
2241
2256
|
)).json();
|
|
2242
2257
|
}
|
|
2243
|
-
async function
|
|
2258
|
+
async function Nt() {
|
|
2244
2259
|
if (!o.token)
|
|
2245
2260
|
throw new Error("Not authenticated");
|
|
2246
2261
|
return (await (await fetch(
|
|
@@ -2254,7 +2269,7 @@ async function At() {
|
|
|
2254
2269
|
}
|
|
2255
2270
|
)).json()).items;
|
|
2256
2271
|
}
|
|
2257
|
-
async function
|
|
2272
|
+
async function jt() {
|
|
2258
2273
|
if (!o.token)
|
|
2259
2274
|
throw new Error("Not authenticated");
|
|
2260
2275
|
return (await (await fetch(`${h}/v1/admin/fleets`, {
|
|
@@ -2265,7 +2280,7 @@ async function Pt() {
|
|
|
2265
2280
|
}
|
|
2266
2281
|
})).json()).items;
|
|
2267
2282
|
}
|
|
2268
|
-
async function
|
|
2283
|
+
async function It(a, e) {
|
|
2269
2284
|
if (!o.token)
|
|
2270
2285
|
throw new Error("Not authenticated");
|
|
2271
2286
|
return await (await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
@@ -2277,7 +2292,7 @@ async function Nt(a, e) {
|
|
|
2277
2292
|
}
|
|
2278
2293
|
})).json();
|
|
2279
2294
|
}
|
|
2280
|
-
async function
|
|
2295
|
+
async function Lt(a) {
|
|
2281
2296
|
if (!o.token)
|
|
2282
2297
|
throw new Error("Not authenticated");
|
|
2283
2298
|
return await (await fetch(
|
|
@@ -2292,7 +2307,7 @@ async function jt(a) {
|
|
|
2292
2307
|
}
|
|
2293
2308
|
)).json();
|
|
2294
2309
|
}
|
|
2295
|
-
async function
|
|
2310
|
+
async function _t(a) {
|
|
2296
2311
|
if (!o.token)
|
|
2297
2312
|
throw new Error("Not authenticated");
|
|
2298
2313
|
return await (await fetch(`${h}/v1/admin/views/${a.id}`, {
|
|
@@ -2304,7 +2319,7 @@ async function It(a) {
|
|
|
2304
2319
|
}
|
|
2305
2320
|
})).json();
|
|
2306
2321
|
}
|
|
2307
|
-
async function
|
|
2322
|
+
async function $t(a) {
|
|
2308
2323
|
if (!o.token)
|
|
2309
2324
|
throw new Error("Not authenticated");
|
|
2310
2325
|
return await (await fetch(`${h}/v1/queries/analytics`, {
|
|
@@ -2316,14 +2331,26 @@ async function Lt(a) {
|
|
|
2316
2331
|
}
|
|
2317
2332
|
})).json();
|
|
2318
2333
|
}
|
|
2319
|
-
|
|
2334
|
+
async function zt(a) {
|
|
2335
|
+
if (!o.token)
|
|
2336
|
+
throw new Error("Not authenticated");
|
|
2337
|
+
return await (await fetch(`${h}/v1/admin/fleets`, {
|
|
2338
|
+
method: "POST",
|
|
2339
|
+
body: JSON.stringify(a),
|
|
2340
|
+
headers: {
|
|
2341
|
+
"Content-Type": "application/json",
|
|
2342
|
+
Authorization: "Bearer " + o.token
|
|
2343
|
+
}
|
|
2344
|
+
})).json();
|
|
2345
|
+
}
|
|
2346
|
+
const E = class {
|
|
2320
2347
|
static async setDefaultDevice(e) {
|
|
2321
|
-
|
|
2348
|
+
E.defaultDeviceId = e;
|
|
2322
2349
|
}
|
|
2323
2350
|
static async getCurrentDevice() {
|
|
2324
2351
|
if (!o.token)
|
|
2325
2352
|
throw new Error("Not authenticated");
|
|
2326
|
-
if (!
|
|
2353
|
+
if (!E.defaultDeviceId)
|
|
2327
2354
|
throw new Error("No known default device");
|
|
2328
2355
|
const n = (await (await fetch(
|
|
2329
2356
|
`${h}/v1/admin/device-details/query`,
|
|
@@ -2335,27 +2362,27 @@ const S = class {
|
|
|
2335
2362
|
}
|
|
2336
2363
|
}
|
|
2337
2364
|
)).json()).items.find(
|
|
2338
|
-
(c) => c.id ===
|
|
2339
|
-
), i = n.name, r = new
|
|
2340
|
-
|
|
2365
|
+
(c) => c.id === E.defaultDeviceId
|
|
2366
|
+
), i = n.name, r = new S(
|
|
2367
|
+
E.defaultDeviceId,
|
|
2341
2368
|
i,
|
|
2342
2369
|
f(o.currentOrganization),
|
|
2343
2370
|
n.tags
|
|
2344
2371
|
);
|
|
2345
|
-
return
|
|
2372
|
+
return E.knownContext.push(new WeakRef(r)), r;
|
|
2346
2373
|
}
|
|
2347
2374
|
static async getPeerDevice(e) {
|
|
2348
|
-
const t = new
|
|
2375
|
+
const t = new ut(e);
|
|
2349
2376
|
return t.id = await t.getDeviceId(), t;
|
|
2350
2377
|
}
|
|
2351
2378
|
static async getDevice(e) {
|
|
2352
|
-
const t = await
|
|
2353
|
-
return
|
|
2379
|
+
const t = await Tt(e);
|
|
2380
|
+
return E.knownContext.push(new WeakRef(t)), t;
|
|
2354
2381
|
}
|
|
2355
2382
|
};
|
|
2356
|
-
let l =
|
|
2357
|
-
s(l, "defaultDeviceId"), s(l, "knownContext", []), s(l, "listFleets",
|
|
2358
|
-
class
|
|
2383
|
+
let l = E;
|
|
2384
|
+
s(l, "defaultDeviceId"), s(l, "knownContext", []), s(l, "createFleet", zt), s(l, "listFleets", jt), s(l, "getFleet", Et), s(l, "patchFleet", It), s(l, "deleteFleet", wt), s(l, "addDeviceToFleet", mt), s(l, "getFleetDevices", kt), s(l, "aggregateTelemetry", ft), s(l, "createShareLink", Y), s(l, "eventsCounter", ee), s(l, "getAnalyticStreams", pt), s(l, "getAnalyticsModules", yt), s(l, "getAnalyticsRows", gt), s(l, "getAnnotationCount", B), s(l, "getAnnotationCountByIntervals", te), s(l, "getCurrentGroup", vt), s(l, "getDevices", M), s(l, "getEvent", Ct), s(l, "getFileUrl", St), s(l, "getInterventions", Ot), s(l, "getLatestTelemetry", Rt), s(l, "getOnlineDevices", bt), s(l, "getPeers", ie), s(l, "getRealtimeDevices", At), s(l, "getRealtimeSessions", ae), s(l, "getStreams", Dt), s(l, "getTaskReportRows", Pt), s(l, "getTaskReportTables", Nt), s(l, "getTelemetry", ne), s(l, "getViews", X), s(l, "patchStream", Lt), s(l, "patchView", _t), s(l, "queryAnalytics", $t), s(l, "queryDevices", oe), s(l, "queryEvents", z), s(l, "queryTelemetry", _);
|
|
2385
|
+
class Yt {
|
|
2359
2386
|
static async set(e, t, n) {
|
|
2360
2387
|
try {
|
|
2361
2388
|
const i = await fetch(h + "/v1/admin/key-value", {
|
|
@@ -2431,15 +2458,15 @@ class Ht {
|
|
|
2431
2458
|
}
|
|
2432
2459
|
}
|
|
2433
2460
|
}
|
|
2434
|
-
function
|
|
2435
|
-
return Uint8Array.from(
|
|
2461
|
+
function Bt(a) {
|
|
2462
|
+
return Uint8Array.from(J(a), (e) => e.charCodeAt(0));
|
|
2436
2463
|
}
|
|
2437
2464
|
function U() {
|
|
2438
2465
|
const { userAgent: a } = navigator;
|
|
2439
2466
|
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
2467
|
}
|
|
2441
|
-
const
|
|
2442
|
-
class
|
|
2468
|
+
const Mt = "audio-chunk";
|
|
2469
|
+
class Zt {
|
|
2443
2470
|
constructor(e, t) {
|
|
2444
2471
|
s(this, "muted", !1);
|
|
2445
2472
|
s(this, "hasReceivedData", !1);
|
|
@@ -2456,9 +2483,9 @@ class Kt {
|
|
|
2456
2483
|
return;
|
|
2457
2484
|
this.hasReceivedData || (this.hasReceivedData = !0);
|
|
2458
2485
|
const { audioContext: n, muted: i } = this;
|
|
2459
|
-
if (!n || e.header.stream.streamType !==
|
|
2486
|
+
if (!n || e.header.stream.streamType !== Mt || i !== !1)
|
|
2460
2487
|
return;
|
|
2461
|
-
const r =
|
|
2488
|
+
const r = Bt(t);
|
|
2462
2489
|
try {
|
|
2463
2490
|
await n.decodeAudioData(
|
|
2464
2491
|
r.buffer,
|
|
@@ -2511,7 +2538,7 @@ class Kt {
|
|
|
2511
2538
|
(async () => await this.device.changeStreamAudioType(t.name, e))();
|
|
2512
2539
|
}
|
|
2513
2540
|
}
|
|
2514
|
-
class
|
|
2541
|
+
class en {
|
|
2515
2542
|
static async listAccounts() {
|
|
2516
2543
|
if (!o.token)
|
|
2517
2544
|
throw new Error("Not authenticated");
|
|
@@ -2584,7 +2611,7 @@ class Qt {
|
|
|
2584
2611
|
)).json();
|
|
2585
2612
|
}
|
|
2586
2613
|
}
|
|
2587
|
-
class
|
|
2614
|
+
class tn {
|
|
2588
2615
|
static async listRoles() {
|
|
2589
2616
|
if (!o.token)
|
|
2590
2617
|
throw new Error("Not authenticated");
|
|
@@ -2643,7 +2670,7 @@ class Xt {
|
|
|
2643
2670
|
});
|
|
2644
2671
|
}
|
|
2645
2672
|
}
|
|
2646
|
-
class
|
|
2673
|
+
class nn {
|
|
2647
2674
|
static async listUsers() {
|
|
2648
2675
|
if (!o.token)
|
|
2649
2676
|
throw new Error("Not authenticated");
|
|
@@ -2703,14 +2730,14 @@ class Yt {
|
|
|
2703
2730
|
});
|
|
2704
2731
|
}
|
|
2705
2732
|
}
|
|
2706
|
-
const
|
|
2733
|
+
const an = ["viewer", "operator", "administrator"], on = "viewer", rn = "operator", sn = "administrator", cn = [
|
|
2707
2734
|
"year",
|
|
2708
2735
|
"month",
|
|
2709
2736
|
"week",
|
|
2710
2737
|
"day",
|
|
2711
2738
|
"hour",
|
|
2712
2739
|
"minute"
|
|
2713
|
-
],
|
|
2740
|
+
], dn = ["tag", "sheet", "user"], hn = [
|
|
2714
2741
|
"triggered-event",
|
|
2715
2742
|
"intervention-request",
|
|
2716
2743
|
"teleop-session-record",
|
|
@@ -2722,12 +2749,12 @@ const Zt = ["viewer", "operator", "administrator"], en = "viewer", tn = "operato
|
|
|
2722
2749
|
"comment",
|
|
2723
2750
|
"system",
|
|
2724
2751
|
"annotation"
|
|
2725
|
-
],
|
|
2752
|
+
], ln = [
|
|
2726
2753
|
"unknown",
|
|
2727
2754
|
"operational",
|
|
2728
2755
|
"offline",
|
|
2729
2756
|
"error"
|
|
2730
|
-
],
|
|
2757
|
+
], un = ["selection", "labeling", "teleop"], mn = ["info", "warning", "error", "critical"], fn = ["video/mp4"], wn = (a) => new Promise((e) => setTimeout(e, a * 1e3));
|
|
2731
2758
|
try {
|
|
2732
2759
|
const a = typeof window < "u" && window.location ? new URLSearchParams(window.location.search) : new URLSearchParams(""), e = a.get("device");
|
|
2733
2760
|
e && l.setDefaultDevice(e);
|
|
@@ -2736,44 +2763,45 @@ try {
|
|
|
2736
2763
|
} catch {
|
|
2737
2764
|
}
|
|
2738
2765
|
export {
|
|
2739
|
-
|
|
2766
|
+
en as Account,
|
|
2740
2767
|
y as App,
|
|
2741
|
-
|
|
2768
|
+
Zt as AudioPlayer,
|
|
2742
2769
|
o as Authentication,
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2770
|
+
Ke as BinaryRequestDataChannel,
|
|
2771
|
+
Fe as CaptureStream,
|
|
2772
|
+
Ge as DataChannel,
|
|
2773
|
+
S as Device,
|
|
2747
2774
|
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
|
-
|
|
2775
|
+
Yt as KeyValue,
|
|
2776
|
+
He as Manipulator,
|
|
2777
|
+
ut as PeerDevice,
|
|
2778
|
+
tn as Role,
|
|
2779
|
+
Ht as SessionType,
|
|
2780
|
+
Qe as TextRequestDataChannel,
|
|
2781
|
+
nn as User,
|
|
2782
|
+
an as accessLevels,
|
|
2783
|
+
sn as administrator,
|
|
2784
|
+
Z as aggregateByDateFunctions,
|
|
2785
|
+
Xt as aggregateFunctionMap,
|
|
2786
|
+
Qt as aggregateFunctions,
|
|
2787
|
+
cn as aggregateLevels,
|
|
2788
|
+
dn as annotationTypes,
|
|
2789
|
+
hn as eventTypes,
|
|
2790
|
+
rt as formatTimeFrameText,
|
|
2791
|
+
at as getAverage,
|
|
2792
|
+
ot as getCount,
|
|
2793
|
+
tt as getMax,
|
|
2794
|
+
nt as getMin,
|
|
2795
|
+
et as getStandardDeviation,
|
|
2796
|
+
it as getSum,
|
|
2797
|
+
Ze as getVariance,
|
|
2798
|
+
ln as healthStatuses,
|
|
2799
|
+
un as interventionTypes,
|
|
2800
|
+
rn as operator,
|
|
2801
|
+
mn as severities,
|
|
2802
|
+
wn as timeout,
|
|
2803
|
+
Kt as vailableAggregationIntervals,
|
|
2804
|
+
fn as videoMimeTypes,
|
|
2805
|
+
on as viewer
|
|
2778
2806
|
};
|
|
2779
2807
|
//# sourceMappingURL=data-sdk.es.js.map
|