@formant/data-sdk 1.16.0 → 1.18.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 +130 -97
- package/dist/data-sdk.es.js.map +1 -1
- package/dist/data-sdk.es6.js +58 -25
- package/dist/data-sdk.umd.js +2 -2
- package/dist/types/data-sdk/src/cache/StoreCache.d.ts +4 -2
- package/dist/types/data-sdk/src/stores/AuthenticationStore.d.ts +3 -0
- package/dist/types/data-sdk/src/stores/ICheckSsoResult.d.ts +5 -0
- package/package.json +2 -2
package/dist/data-sdk.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var ce = Object.defineProperty;
|
|
2
2
|
var de = (a, e, t) => e in a ? ce(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
3
|
var s = (a, e, t) => (de(a, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import { decode as
|
|
4
|
+
import { decode as V } from "base-64";
|
|
5
5
|
import * as u from "date-fns";
|
|
6
6
|
import { startOfMinute as he, addMinutes as le, roundToNearestMinutes as ue, addSeconds as me } from "date-fns";
|
|
7
|
-
import { RtcClient as A, SignalingPromiseClient as
|
|
7
|
+
import { RtcClient as A, SignalingPromiseClient as N } from "@formant/realtime-sdk";
|
|
8
8
|
import { EventEmitter as fe } from "eventemitter3";
|
|
9
9
|
import { deflate as we } from "pako";
|
|
10
10
|
import { fromByteArray as pe } from "base64-js";
|
|
@@ -131,7 +131,7 @@ class ve {
|
|
|
131
131
|
}
|
|
132
132
|
async loginWithToken(e, t) {
|
|
133
133
|
var i;
|
|
134
|
-
const n = JSON.parse(
|
|
134
|
+
const n = JSON.parse(V(e.split(".")[1]));
|
|
135
135
|
try {
|
|
136
136
|
let o;
|
|
137
137
|
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 || (o = n.sub), n["formant:claims"] && n["formant:claims"].userId && (o = n["formant:claims"].userId), o && ((i = this._currentUser) == null ? void 0 : i.id) !== o) {
|
|
@@ -255,6 +255,30 @@ class ve {
|
|
|
255
255
|
})).json();
|
|
256
256
|
await this.loginWithToken(n.authentication.accessToken, e);
|
|
257
257
|
}
|
|
258
|
+
async checkSso(e, t) {
|
|
259
|
+
return await (await fetch(`${this._apiUrl}/v1/admin/auth/check-sso`, {
|
|
260
|
+
method: "POST",
|
|
261
|
+
body: JSON.stringify({ email: e, allowUserAutoCreation: t }),
|
|
262
|
+
headers: {
|
|
263
|
+
"Content-Type": "application/json"
|
|
264
|
+
}
|
|
265
|
+
})).json();
|
|
266
|
+
}
|
|
267
|
+
async loginWithSso(e, t) {
|
|
268
|
+
const i = await (await fetch(`${this._apiUrl}/v1/admin/auth/login-sso`, {
|
|
269
|
+
method: "POST",
|
|
270
|
+
body: JSON.stringify({ token: e, refreshToken: t }),
|
|
271
|
+
headers: {
|
|
272
|
+
"Content-Type": "application/json"
|
|
273
|
+
}
|
|
274
|
+
})).json();
|
|
275
|
+
if (!i.authentication)
|
|
276
|
+
throw new Error("Failed to login with SSO");
|
|
277
|
+
return await this.loginWithToken(
|
|
278
|
+
i.authentication.accessToken,
|
|
279
|
+
i.authentication.refreshToken
|
|
280
|
+
);
|
|
281
|
+
}
|
|
258
282
|
}
|
|
259
283
|
function k() {
|
|
260
284
|
return typeof window < "u" && window.location ? new URLSearchParams(window.location.search).get("module") : null;
|
|
@@ -264,7 +288,7 @@ function T(a) {
|
|
|
264
288
|
throw new Error("cannot send message to non-existent parent");
|
|
265
289
|
window.parent.postMessage(a, "*");
|
|
266
290
|
}
|
|
267
|
-
function
|
|
291
|
+
function F() {
|
|
268
292
|
const a = k();
|
|
269
293
|
if (!a)
|
|
270
294
|
throw new Error("No module context");
|
|
@@ -273,7 +297,7 @@ function H() {
|
|
|
273
297
|
module: a
|
|
274
298
|
});
|
|
275
299
|
}
|
|
276
|
-
function
|
|
300
|
+
function H(a) {
|
|
277
301
|
function e(t) {
|
|
278
302
|
const n = t.data;
|
|
279
303
|
n.type === "auth_token" && a(n.token);
|
|
@@ -284,8 +308,8 @@ function F(a) {
|
|
|
284
308
|
}
|
|
285
309
|
const r = new ve({
|
|
286
310
|
apiUrl: h,
|
|
287
|
-
refreshAuthToken:
|
|
288
|
-
addAccessTokenRefreshListener:
|
|
311
|
+
refreshAuthToken: F,
|
|
312
|
+
addAccessTokenRefreshListener: H
|
|
289
313
|
});
|
|
290
314
|
async function Te(a) {
|
|
291
315
|
return (await (await fetch(
|
|
@@ -303,13 +327,13 @@ function Ce() {
|
|
|
303
327
|
type: "hide_analytics_date_picker"
|
|
304
328
|
});
|
|
305
329
|
}
|
|
306
|
-
function
|
|
330
|
+
function Se(a) {
|
|
307
331
|
T({
|
|
308
332
|
type: "go_to_device",
|
|
309
333
|
deviceId: a
|
|
310
334
|
});
|
|
311
335
|
}
|
|
312
|
-
function
|
|
336
|
+
function Ee(a) {
|
|
313
337
|
T({
|
|
314
338
|
type: "go_to_time",
|
|
315
339
|
time: a.getTime()
|
|
@@ -369,14 +393,14 @@ function je(a, e) {
|
|
|
369
393
|
};
|
|
370
394
|
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
371
395
|
}
|
|
372
|
-
function
|
|
396
|
+
function Ne(a) {
|
|
373
397
|
const e = (t) => {
|
|
374
398
|
const n = t.data;
|
|
375
399
|
n.type === "module_menu_item_clicked" && a(n.menu);
|
|
376
400
|
};
|
|
377
401
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
378
402
|
}
|
|
379
|
-
function
|
|
403
|
+
function De(a) {
|
|
380
404
|
const e = (t) => {
|
|
381
405
|
const n = t.data;
|
|
382
406
|
n.type === "module_configuration" && a(n);
|
|
@@ -414,10 +438,10 @@ const Ie = 1, W = 1e3, K = 60 * W, Q = 60 * K, L = 24 * Q, _e = 7 * L, $e = 30 *
|
|
|
414
438
|
month: $e,
|
|
415
439
|
year: ze
|
|
416
440
|
};
|
|
417
|
-
function
|
|
441
|
+
function Me(a, e) {
|
|
418
442
|
return a.filter((t) => e.includes(t.type));
|
|
419
443
|
}
|
|
420
|
-
function
|
|
444
|
+
function Be(a, e, t) {
|
|
421
445
|
const n = e.getTime(), i = t.getTime();
|
|
422
446
|
return a.map((o) => ({
|
|
423
447
|
...o,
|
|
@@ -434,20 +458,21 @@ class J {
|
|
|
434
458
|
s(this, "entries", /* @__PURE__ */ new Map());
|
|
435
459
|
s(this, "metadata", /* @__PURE__ */ new Map());
|
|
436
460
|
s(this, "capacity");
|
|
437
|
-
s(this, "
|
|
438
|
-
this.capacity = e || 1e4, this.
|
|
461
|
+
s(this, "staleIntervalMs");
|
|
462
|
+
this.capacity = e || 1e4, this.staleIntervalMs = t || I.minute;
|
|
439
463
|
}
|
|
440
464
|
get(e, t) {
|
|
441
|
-
const n = this.keyToCacheKey(e)
|
|
442
|
-
return
|
|
465
|
+
const n = this.keyToCacheKey(e);
|
|
466
|
+
return this.isStale(n) && !this.isGenerating(n) && t && this.generate(e, t), this.entries.get(n);
|
|
443
467
|
}
|
|
444
468
|
set(e, t) {
|
|
445
469
|
const n = this.keyToCacheKey(e);
|
|
446
470
|
this.metadata.set(n, {
|
|
447
471
|
generating: !1,
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
472
|
+
staleAt: performance.now() + this.staleIntervalMs
|
|
473
|
+
});
|
|
474
|
+
const i = this.entries.get(n);
|
|
475
|
+
JSON.stringify(i) === JSON.stringify(t) || (this.entries.set(n, t), this.enforceMaxSize());
|
|
451
476
|
}
|
|
452
477
|
clear() {
|
|
453
478
|
this.entries.clear(), [...this.metadata.values()].forEach((e) => e.generating = !1);
|
|
@@ -458,26 +483,34 @@ class J {
|
|
|
458
483
|
keyToCacheKey(e) {
|
|
459
484
|
return JSON.stringify(e);
|
|
460
485
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
486
|
+
enforceMaxSize() {
|
|
487
|
+
for (; this.metadata.size > this.capacity && this.metadata.size > 0; ) {
|
|
488
|
+
const [e] = [...this.metadata.entries()].reduce(
|
|
489
|
+
([t, n], [i, o]) => o.staleAt < n.staleAt ? [i, o] : [t, n]
|
|
490
|
+
);
|
|
491
|
+
this.clearKey(e);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
isStale(e) {
|
|
495
|
+
const t = this.metadata.get(e);
|
|
496
|
+
return t ? (t == null ? void 0 : t.staleAt) < performance.now() : !0;
|
|
497
|
+
}
|
|
498
|
+
isGenerating(e) {
|
|
499
|
+
const t = this.metadata.get(e);
|
|
500
|
+
return t ? t.generating : !1;
|
|
468
501
|
}
|
|
469
502
|
generate(e, t) {
|
|
470
|
-
const n = this.keyToCacheKey(e), i = this.metadata.get(n) || {}
|
|
503
|
+
const n = this.keyToCacheKey(e), i = this.metadata.get(n) || {}, o = t().then((c) => {
|
|
504
|
+
const d = this.metadata.get(n);
|
|
505
|
+
return (d == null ? void 0 : d.generating) !== o || this.set(e, c), c;
|
|
506
|
+
}).catch((c) => {
|
|
507
|
+
throw this.metadata.delete(n), c;
|
|
508
|
+
});
|
|
471
509
|
this.metadata.set(n, {
|
|
472
510
|
...i,
|
|
473
|
-
generating:
|
|
474
|
-
|
|
475
|
-
})
|
|
476
|
-
t.then((o) => {
|
|
477
|
-
const c = this.metadata.get(n);
|
|
478
|
-
!(c != null && c.generating) || this.set(e, o);
|
|
479
|
-
});
|
|
480
|
-
}, 0);
|
|
511
|
+
generating: o,
|
|
512
|
+
staleAt: performance.now() + this.staleIntervalMs
|
|
513
|
+
});
|
|
481
514
|
}
|
|
482
515
|
}
|
|
483
516
|
async function _(a) {
|
|
@@ -509,7 +542,7 @@ class qe {
|
|
|
509
542
|
names: [...t],
|
|
510
543
|
types: [...n]
|
|
511
544
|
}, y = this.query(d, i, o, c);
|
|
512
|
-
return y === void 0 || y === "too much data" ? y :
|
|
545
|
+
return y === void 0 || y === "too much data" ? y : Me(y, n);
|
|
513
546
|
}
|
|
514
547
|
query(e, t, n, i = !1) {
|
|
515
548
|
const o = {
|
|
@@ -519,7 +552,7 @@ class qe {
|
|
|
519
552
|
latestOnly: i
|
|
520
553
|
}, c = n > me(/* @__PURE__ */ new Date(), -20);
|
|
521
554
|
let d;
|
|
522
|
-
return c ? d = this.liveQueryCache(o) : d = this.queryCache(o), !d || d === "too much data" || i ? d :
|
|
555
|
+
return c ? d = this.liveQueryCache(o) : d = this.queryCache(o), !d || d === "too much data" || i ? d : Be(d, t, n);
|
|
523
556
|
}
|
|
524
557
|
queryCache(e) {
|
|
525
558
|
return this.queryStoreCache.get(e, async () => {
|
|
@@ -575,7 +608,7 @@ async function Je(a, e, t) {
|
|
|
575
608
|
window.addEventListener("message", i);
|
|
576
609
|
});
|
|
577
610
|
}
|
|
578
|
-
async function
|
|
611
|
+
async function Ge(a, e) {
|
|
579
612
|
return new Promise((t) => {
|
|
580
613
|
const n = Math.random().toString();
|
|
581
614
|
T({
|
|
@@ -641,9 +674,9 @@ const q = class {
|
|
|
641
674
|
};
|
|
642
675
|
let g = q;
|
|
643
676
|
s(g, "getCurrentModuleContext", k), // senders
|
|
644
|
-
s(g, "disableAnalyticsBottomBar", Ce), s(g, "goToDevice",
|
|
645
|
-
s(g, "addAccessTokenRefreshListener",
|
|
646
|
-
s(g, "getDate", Je), s(g, "prompt",
|
|
677
|
+
s(g, "disableAnalyticsBottomBar", Ce), s(g, "goToDevice", Se), s(g, "goToTime", Ee), s(g, "refreshAuthToken", F), s(g, "requestModuleData", ke), s(g, "sendChannelData", Oe), s(g, "setModuleDateTimeRange", Re), s(g, "setupModuleMenus", Ae), s(g, "showMessage", be), // listeners
|
|
678
|
+
s(g, "addAccessTokenRefreshListener", H), s(g, "addChannelDataListener", je), s(g, "addMenuListener", Ne), s(g, "addModuleConfigurationListener", De), s(g, "addModuleDataListener", Pe), s(g, "addOverviewDeviceListener", Le), s(g, "addStreamListener", Ue), // bidirectional
|
|
679
|
+
s(g, "getDate", Je), s(g, "prompt", Ge), s(g, "_isOnline", null);
|
|
647
680
|
function f(a, e) {
|
|
648
681
|
if (a !== void 0)
|
|
649
682
|
return a;
|
|
@@ -668,10 +701,10 @@ const p = {
|
|
|
668
701
|
observe: p.OBSERVE,
|
|
669
702
|
headless: p.HEADLESS
|
|
670
703
|
}, O = Symbol("RtcClientPool.instance");
|
|
671
|
-
var
|
|
672
|
-
class
|
|
704
|
+
var Vt;
|
|
705
|
+
class D {
|
|
673
706
|
constructor(e) {
|
|
674
|
-
s(this,
|
|
707
|
+
s(this, Vt, null);
|
|
675
708
|
s(this, "createClient");
|
|
676
709
|
s(this, "ttlMs");
|
|
677
710
|
s(this, "proxyHandler");
|
|
@@ -726,65 +759,65 @@ class N {
|
|
|
726
759
|
}, this.ttlMs)), !0) : (console.warn("this instance has already been released!"), !1);
|
|
727
760
|
}
|
|
728
761
|
}
|
|
729
|
-
|
|
762
|
+
Vt = O;
|
|
730
763
|
const P = async () => f(r.token, "Realtime when user isn't authorized"), R = {
|
|
731
|
-
[p.UNKNOWN]: new
|
|
764
|
+
[p.UNKNOWN]: new D({
|
|
732
765
|
ttlMs: 2500,
|
|
733
766
|
createClient: (a) => new A({
|
|
734
|
-
signalingClient: new
|
|
767
|
+
signalingClient: new N(h),
|
|
735
768
|
getToken: P,
|
|
736
769
|
sessionType: p.UNKNOWN,
|
|
737
770
|
receive: a
|
|
738
771
|
})
|
|
739
772
|
}),
|
|
740
|
-
[p.TELEOP]: new
|
|
773
|
+
[p.TELEOP]: new D({
|
|
741
774
|
ttlMs: 2500,
|
|
742
775
|
createClient: (a) => new A({
|
|
743
|
-
signalingClient: new
|
|
776
|
+
signalingClient: new N(h),
|
|
744
777
|
getToken: P,
|
|
745
778
|
sessionType: p.TELEOP,
|
|
746
779
|
receive: a
|
|
747
780
|
})
|
|
748
781
|
}),
|
|
749
|
-
[p.PORT_FORWARD]: new
|
|
782
|
+
[p.PORT_FORWARD]: new D({
|
|
750
783
|
ttlMs: 2500,
|
|
751
784
|
createClient: (a) => new A({
|
|
752
|
-
signalingClient: new
|
|
785
|
+
signalingClient: new N(h),
|
|
753
786
|
getToken: P,
|
|
754
787
|
sessionType: p.PORT_FORWARD,
|
|
755
788
|
receive: a
|
|
756
789
|
})
|
|
757
790
|
}),
|
|
758
|
-
[p.OBSERVE]: new
|
|
791
|
+
[p.OBSERVE]: new D({
|
|
759
792
|
ttlMs: 2500,
|
|
760
793
|
createClient: (a) => new A({
|
|
761
|
-
signalingClient: new
|
|
794
|
+
signalingClient: new N(h),
|
|
762
795
|
getToken: P,
|
|
763
796
|
sessionType: p.OBSERVE,
|
|
764
797
|
receive: a
|
|
765
798
|
})
|
|
766
799
|
}),
|
|
767
|
-
[p.HEADLESS]: new
|
|
800
|
+
[p.HEADLESS]: new D({
|
|
768
801
|
ttlMs: 2500,
|
|
769
802
|
createClient: (a) => new A({
|
|
770
|
-
signalingClient: new
|
|
803
|
+
signalingClient: new N(h),
|
|
771
804
|
getToken: P,
|
|
772
805
|
sessionType: p.HEADLESS,
|
|
773
806
|
receive: a
|
|
774
807
|
})
|
|
775
808
|
})
|
|
776
|
-
},
|
|
809
|
+
}, Ve = {
|
|
777
810
|
...R,
|
|
778
811
|
unknown: R[p.UNKNOWN],
|
|
779
812
|
teleop: R[p.TELEOP],
|
|
780
813
|
portForward: R[p.PORT_FORWARD],
|
|
781
814
|
observe: R[p.OBSERVE],
|
|
782
815
|
headless: R[p.HEADLESS]
|
|
783
|
-
}, $ = R[p.TELEOP],
|
|
816
|
+
}, $ = R[p.TELEOP], Fe = (a) => {
|
|
784
817
|
const { sessionType: e } = a;
|
|
785
|
-
return e ?
|
|
818
|
+
return e ? Ve[e] : $;
|
|
786
819
|
};
|
|
787
|
-
class
|
|
820
|
+
class He {
|
|
788
821
|
constructor(e) {
|
|
789
822
|
s(this, "token");
|
|
790
823
|
this.captureSession = e;
|
|
@@ -1439,7 +1472,7 @@ async function ne(a, e, t, n, i) {
|
|
|
1439
1472
|
})
|
|
1440
1473
|
);
|
|
1441
1474
|
}
|
|
1442
|
-
async function
|
|
1475
|
+
async function M(a, e) {
|
|
1443
1476
|
return (await z({
|
|
1444
1477
|
...a,
|
|
1445
1478
|
eventTypes: ["annotation"]
|
|
@@ -1456,7 +1489,7 @@ async function ae(a, e, t) {
|
|
|
1456
1489
|
end: new Date(n)
|
|
1457
1490
|
}), d = c.map((m, w) => {
|
|
1458
1491
|
const v = new Date(m).toISOString(), C = w === c.length - 1 ? new Date(Date.now()).toISOString() : new Date(c[w + 1]);
|
|
1459
|
-
return
|
|
1492
|
+
return M(
|
|
1460
1493
|
{
|
|
1461
1494
|
...a,
|
|
1462
1495
|
start: v,
|
|
@@ -1571,7 +1604,7 @@ async function mt(a) {
|
|
|
1571
1604
|
}
|
|
1572
1605
|
)).json();
|
|
1573
1606
|
}
|
|
1574
|
-
class
|
|
1607
|
+
class S extends Y {
|
|
1575
1608
|
constructor(e, t, n, i) {
|
|
1576
1609
|
super(), this.id = e, this.name = t, this.organizationId = n, this.tags = i;
|
|
1577
1610
|
}
|
|
@@ -1669,7 +1702,7 @@ class E extends Y {
|
|
|
1669
1702
|
sessionType: t,
|
|
1670
1703
|
deadlineMs: n = 1e4,
|
|
1671
1704
|
maxConnectRetries: i = 3
|
|
1672
|
-
} = typeof e == "number" ? { sessionType: e } : e, c =
|
|
1705
|
+
} = typeof e == "number" ? { sessionType: e } : e, c = Fe({
|
|
1673
1706
|
sessionType: t
|
|
1674
1707
|
}).get(this.handleMessage);
|
|
1675
1708
|
let d = !1;
|
|
@@ -1836,7 +1869,7 @@ class E extends Y {
|
|
|
1836
1869
|
Authorization: "Bearer " + r.token
|
|
1837
1870
|
}
|
|
1838
1871
|
})).json();
|
|
1839
|
-
return new
|
|
1872
|
+
return new He(n);
|
|
1840
1873
|
}
|
|
1841
1874
|
async getTelemetry(e, t, n, i) {
|
|
1842
1875
|
return await ie(
|
|
@@ -1904,7 +1937,7 @@ class E extends Y {
|
|
|
1904
1937
|
)).json();
|
|
1905
1938
|
}
|
|
1906
1939
|
async getAnnotationCount(e, t) {
|
|
1907
|
-
return await
|
|
1940
|
+
return await M({ ...e, deviceIds: [this.id] }, t);
|
|
1908
1941
|
}
|
|
1909
1942
|
async getAnnotationCountByIntervals(e, t, n) {
|
|
1910
1943
|
return await ae(
|
|
@@ -1923,7 +1956,7 @@ class E extends Y {
|
|
|
1923
1956
|
return e.scope.deviceIds = [this.id], await ee(e, t);
|
|
1924
1957
|
}
|
|
1925
1958
|
}
|
|
1926
|
-
s(
|
|
1959
|
+
s(S, "createDevice", dt), s(S, "patchDevice", ht), s(S, "getDevicesData", lt), s(S, "queryDevicesData", ut), s(S, "disableDevice", mt);
|
|
1927
1960
|
class ft extends Y {
|
|
1928
1961
|
constructor(t) {
|
|
1929
1962
|
super();
|
|
@@ -2131,7 +2164,7 @@ async function se(a) {
|
|
|
2131
2164
|
Authorization: "Bearer " + r.token
|
|
2132
2165
|
}
|
|
2133
2166
|
})).json()).items.map(
|
|
2134
|
-
(n) => new
|
|
2167
|
+
(n) => new S(n.id, n.name, n.organizationId, n.tags)
|
|
2135
2168
|
);
|
|
2136
2169
|
}
|
|
2137
2170
|
async function Ct() {
|
|
@@ -2157,7 +2190,7 @@ async function Ct() {
|
|
|
2157
2190
|
type: "default"
|
|
2158
2191
|
});
|
|
2159
2192
|
}
|
|
2160
|
-
async function
|
|
2193
|
+
async function St(a) {
|
|
2161
2194
|
if (!r.token)
|
|
2162
2195
|
throw new Error("Not authenticated");
|
|
2163
2196
|
const t = await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
@@ -2167,9 +2200,9 @@ async function Et(a) {
|
|
|
2167
2200
|
Authorization: "Bearer " + r.token
|
|
2168
2201
|
}
|
|
2169
2202
|
})).json(), n = t.name;
|
|
2170
|
-
return new
|
|
2203
|
+
return new S(a, n, t.organizationId, t.tags);
|
|
2171
2204
|
}
|
|
2172
|
-
async function
|
|
2205
|
+
async function B() {
|
|
2173
2206
|
if (!r.token)
|
|
2174
2207
|
throw new Error("Not authenticated");
|
|
2175
2208
|
const e = await (await fetch(`${h}/v1/admin/device-details/query`, {
|
|
@@ -2181,7 +2214,7 @@ async function M() {
|
|
|
2181
2214
|
}
|
|
2182
2215
|
})).json();
|
|
2183
2216
|
return e.items, e.items.map(
|
|
2184
|
-
(t) => new
|
|
2217
|
+
(t) => new S(
|
|
2185
2218
|
t.id,
|
|
2186
2219
|
t.name,
|
|
2187
2220
|
f(r.currentOrganization),
|
|
@@ -2189,7 +2222,7 @@ async function M() {
|
|
|
2189
2222
|
)
|
|
2190
2223
|
);
|
|
2191
2224
|
}
|
|
2192
|
-
async function
|
|
2225
|
+
async function Et(a) {
|
|
2193
2226
|
if (!r.token)
|
|
2194
2227
|
throw new Error("Not authenticated");
|
|
2195
2228
|
return (await (await fetch(
|
|
@@ -2280,9 +2313,9 @@ async function jt() {
|
|
|
2280
2313
|
Authorization: "Bearer " + r.token
|
|
2281
2314
|
}
|
|
2282
2315
|
})).json()).items;
|
|
2283
|
-
return (await
|
|
2316
|
+
return (await B()).filter((i) => t.includes(i.id));
|
|
2284
2317
|
}
|
|
2285
|
-
async function
|
|
2318
|
+
async function Nt() {
|
|
2286
2319
|
if (!r.token)
|
|
2287
2320
|
throw new Error("Not authenticated");
|
|
2288
2321
|
const t = (await (await fetch(`${h}/v1/signaling/peers`, {
|
|
@@ -2294,9 +2327,9 @@ async function Dt() {
|
|
|
2294
2327
|
})).json()).items.map(
|
|
2295
2328
|
(i) => i.deviceId
|
|
2296
2329
|
);
|
|
2297
|
-
return (await
|
|
2330
|
+
return (await B()).filter((i) => t.includes(i.id));
|
|
2298
2331
|
}
|
|
2299
|
-
async function
|
|
2332
|
+
async function Dt() {
|
|
2300
2333
|
if (!r.token)
|
|
2301
2334
|
throw new Error("Not authenticated");
|
|
2302
2335
|
return (await (await fetch(`${h}/v1/admin/streams`, {
|
|
@@ -2388,7 +2421,7 @@ async function zt(a) {
|
|
|
2388
2421
|
}
|
|
2389
2422
|
})).json();
|
|
2390
2423
|
}
|
|
2391
|
-
async function
|
|
2424
|
+
async function Mt(a) {
|
|
2392
2425
|
if (!r.token)
|
|
2393
2426
|
throw new Error("Not authenticated");
|
|
2394
2427
|
return await (await fetch(`${h}/v1/queries/analytics`, {
|
|
@@ -2400,7 +2433,7 @@ async function Bt(a) {
|
|
|
2400
2433
|
}
|
|
2401
2434
|
})).json();
|
|
2402
2435
|
}
|
|
2403
|
-
async function
|
|
2436
|
+
async function Bt(a) {
|
|
2404
2437
|
if (!r.token)
|
|
2405
2438
|
throw new Error("Not authenticated");
|
|
2406
2439
|
return await (await fetch(`${h}/v1/admin/fleets`, {
|
|
@@ -2452,14 +2485,14 @@ async function Ut(a, e) {
|
|
|
2452
2485
|
}
|
|
2453
2486
|
)).json();
|
|
2454
2487
|
}
|
|
2455
|
-
const
|
|
2488
|
+
const E = class {
|
|
2456
2489
|
static async setDefaultDevice(e) {
|
|
2457
|
-
|
|
2490
|
+
E.defaultDeviceId = e;
|
|
2458
2491
|
}
|
|
2459
2492
|
static async getCurrentDevice() {
|
|
2460
2493
|
if (!r.token)
|
|
2461
2494
|
throw new Error("Not authenticated");
|
|
2462
|
-
if (!
|
|
2495
|
+
if (!E.defaultDeviceId)
|
|
2463
2496
|
throw new Error("No known default device");
|
|
2464
2497
|
const n = (await (await fetch(
|
|
2465
2498
|
`${h}/v1/admin/device-details/query`,
|
|
@@ -2471,26 +2504,26 @@ const S = class {
|
|
|
2471
2504
|
}
|
|
2472
2505
|
}
|
|
2473
2506
|
)).json()).items.find(
|
|
2474
|
-
(c) => c.id ===
|
|
2475
|
-
), i = n.name, o = new
|
|
2476
|
-
|
|
2507
|
+
(c) => c.id === E.defaultDeviceId
|
|
2508
|
+
), i = n.name, o = new S(
|
|
2509
|
+
E.defaultDeviceId,
|
|
2477
2510
|
i,
|
|
2478
2511
|
f(r.currentOrganization),
|
|
2479
2512
|
n.tags
|
|
2480
2513
|
);
|
|
2481
|
-
return
|
|
2514
|
+
return E.knownContext.push(new WeakRef(o)), o;
|
|
2482
2515
|
}
|
|
2483
2516
|
static async getPeerDevice(e) {
|
|
2484
2517
|
const t = new ft(e);
|
|
2485
2518
|
return t.id = await t.getDeviceId(), t;
|
|
2486
2519
|
}
|
|
2487
2520
|
static async getDevice(e) {
|
|
2488
|
-
const t = await
|
|
2489
|
-
return
|
|
2521
|
+
const t = await St(e);
|
|
2522
|
+
return E.knownContext.push(new WeakRef(t)), t;
|
|
2490
2523
|
}
|
|
2491
2524
|
};
|
|
2492
|
-
let l =
|
|
2493
|
-
s(l, "defaultDeviceId"), s(l, "knownContext", []), s(l, "createFleet",
|
|
2525
|
+
let l = E;
|
|
2526
|
+
s(l, "defaultDeviceId"), s(l, "knownContext", []), s(l, "createFleet", Bt), s(l, "listFleets", It), s(l, "getFleet", Ot), s(l, "patchFleet", _t), s(l, "deleteFleet", yt), s(l, "addDeviceToFleet", wt), s(l, "getFleetDevices", Rt), s(l, "aggregateTelemetry", pt), s(l, "createShareLink", ee), s(l, "eventsCounter", ne), s(l, "getAnalyticStreams", gt), s(l, "getAnalyticsModules", vt), s(l, "getAnalyticsRows", Tt), s(l, "getAnnotationCount", M), s(l, "getAnnotationCountByIntervals", ae), s(l, "getCurrentGroup", Ct), s(l, "getDevices", B), s(l, "getEvent", Et), s(l, "getFileUrl", kt), s(l, "getInterventions", At), s(l, "getLatestTelemetry", bt), s(l, "getOnlineDevices", jt), s(l, "getPeers", oe), s(l, "getRealtimeDevices", Nt), s(l, "getRealtimeSessions", re), s(l, "getStreams", Dt), s(l, "getTaskReportRows", Pt), s(l, "getTaskReportTables", Lt), s(l, "getTelemetry", ie), s(l, "getViews", Z), s(l, "patchStream", $t), s(l, "patchView", zt), s(l, "queryAnalytics", Mt), s(l, "queryDevices", se), s(l, "queryEvents", z), s(l, "queryTelemetry", _), s(l, "getAllEventTriggerGroup", qt), s(l, "getEventTriggerGroup", xt), s(l, "patchEventTriggergroup", Ut);
|
|
2494
2527
|
class an {
|
|
2495
2528
|
static async set(e, t, n) {
|
|
2496
2529
|
try {
|
|
@@ -2588,13 +2621,13 @@ class an {
|
|
|
2588
2621
|
}
|
|
2589
2622
|
}
|
|
2590
2623
|
function Jt(a) {
|
|
2591
|
-
return Uint8Array.from(
|
|
2624
|
+
return Uint8Array.from(V(a), (e) => e.charCodeAt(0));
|
|
2592
2625
|
}
|
|
2593
|
-
function
|
|
2626
|
+
function G() {
|
|
2594
2627
|
const { userAgent: a } = navigator;
|
|
2595
2628
|
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";
|
|
2596
2629
|
}
|
|
2597
|
-
const
|
|
2630
|
+
const Gt = "audio-chunk";
|
|
2598
2631
|
class rn {
|
|
2599
2632
|
constructor(e, t) {
|
|
2600
2633
|
s(this, "muted", !1);
|
|
@@ -2612,7 +2645,7 @@ class rn {
|
|
|
2612
2645
|
return;
|
|
2613
2646
|
this.hasReceivedData || (this.hasReceivedData = !0);
|
|
2614
2647
|
const { audioContext: n, muted: i } = this;
|
|
2615
|
-
if (!n || e.header.stream.streamType !==
|
|
2648
|
+
if (!n || e.header.stream.streamType !== Gt || i !== !1)
|
|
2616
2649
|
return;
|
|
2617
2650
|
const o = Jt(t);
|
|
2618
2651
|
try {
|
|
@@ -2639,7 +2672,7 @@ class rn {
|
|
|
2639
2672
|
});
|
|
2640
2673
|
this.device = e, this.stream = t, this.device.startListeningToRealtimeDataStream(t), this.device.addRealtimeListener((i, o) => {
|
|
2641
2674
|
this.receive(o);
|
|
2642
|
-
}),
|
|
2675
|
+
}), G() === "Safari" || G() === "IE" ? this.changeAudioWireFormat("wav") : this.changeAudioWireFormat("opus");
|
|
2643
2676
|
const n = window.AudioContext || window.webkitAudioContext;
|
|
2644
2677
|
this.audioContext = new n();
|
|
2645
2678
|
}
|
|
@@ -2898,9 +2931,9 @@ export {
|
|
|
2898
2931
|
rn as AudioPlayer,
|
|
2899
2932
|
r as Authentication,
|
|
2900
2933
|
Xe as BinaryRequestDataChannel,
|
|
2901
|
-
|
|
2934
|
+
He as CaptureStream,
|
|
2902
2935
|
Ke as DataChannel,
|
|
2903
|
-
|
|
2936
|
+
S as Device,
|
|
2904
2937
|
l as Fleet,
|
|
2905
2938
|
an as KeyValue,
|
|
2906
2939
|
Qe as Manipulator,
|