@formant/data-sdk 1.18.0 → 1.19.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 +120 -120
- package/dist/data-sdk.es.js.map +1 -1
- package/dist/data-sdk.es6.js +1759 -1758
- package/dist/data-sdk.umd.js +27 -27
- package/dist/types/data-sdk/src/main.d.ts +1 -0
- package/package.json +1 -1
package/dist/data-sdk.es.js
CHANGED
|
@@ -4,7 +4,7 @@ var s = (a, e, t) => (de(a, typeof e != "symbol" ? e + "" : e, t), t);
|
|
|
4
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
|
|
7
|
+
import { RtcClient as R, SignalingPromiseClient as j } 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";
|
|
@@ -38,14 +38,14 @@ const h = ge(
|
|
|
38
38
|
typeof window < "u" && window.location ? window.location.search : void 0
|
|
39
39
|
)
|
|
40
40
|
);
|
|
41
|
-
class
|
|
41
|
+
class U extends Error {
|
|
42
42
|
constructor(t) {
|
|
43
43
|
super("login failed");
|
|
44
44
|
s(this, "reason");
|
|
45
45
|
this.reason = t, this.name = "LoginFailureError", Object.setPrototypeOf(this, new.target.prototype);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
class
|
|
48
|
+
class _ extends Error {
|
|
49
49
|
constructor(t) {
|
|
50
50
|
super("login challenged");
|
|
51
51
|
s(this, "challenge");
|
|
@@ -106,9 +106,9 @@ class ve {
|
|
|
106
106
|
}
|
|
107
107
|
}), c = await o.json();
|
|
108
108
|
if (o.status !== 200)
|
|
109
|
-
throw new
|
|
109
|
+
throw new U(c.message);
|
|
110
110
|
if ("challenge" in c)
|
|
111
|
-
throw new
|
|
111
|
+
throw new _(c.challenge);
|
|
112
112
|
const { authentication: d } = c;
|
|
113
113
|
return await this.loginWithToken(
|
|
114
114
|
d.accessToken,
|
|
@@ -120,12 +120,12 @@ class ve {
|
|
|
120
120
|
} catch (o) {
|
|
121
121
|
if (i || console.error("login() failed", { err: o }), this._waitingForAuth.forEach((c) => c(!1)), this._waitingForAuth.clear(), !i)
|
|
122
122
|
throw o;
|
|
123
|
-
return o instanceof
|
|
123
|
+
return o instanceof _ ? {
|
|
124
124
|
result: "challenged",
|
|
125
125
|
challenge: o.challenge
|
|
126
126
|
} : {
|
|
127
127
|
result: "failure",
|
|
128
|
-
reason: o instanceof
|
|
128
|
+
reason: o instanceof U ? o.reason : o instanceof Error ? o.message : String(o)
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
}
|
|
@@ -280,7 +280,7 @@ class ve {
|
|
|
280
280
|
);
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function E() {
|
|
284
284
|
return typeof window < "u" && window.location ? new URLSearchParams(window.location.search).get("module") : null;
|
|
285
285
|
}
|
|
286
286
|
function T(a) {
|
|
@@ -289,7 +289,7 @@ function T(a) {
|
|
|
289
289
|
window.parent.postMessage(a, "*");
|
|
290
290
|
}
|
|
291
291
|
function F() {
|
|
292
|
-
const a =
|
|
292
|
+
const a = E();
|
|
293
293
|
if (!a)
|
|
294
294
|
throw new Error("No module context");
|
|
295
295
|
T({
|
|
@@ -340,7 +340,7 @@ function Ee(a) {
|
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
342
|
function ke() {
|
|
343
|
-
const a =
|
|
343
|
+
const a = E();
|
|
344
344
|
if (!a)
|
|
345
345
|
throw new Error("No module context");
|
|
346
346
|
T({
|
|
@@ -349,7 +349,7 @@ function ke() {
|
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
351
|
function Oe(a, e) {
|
|
352
|
-
const t =
|
|
352
|
+
const t = E();
|
|
353
353
|
if (!t)
|
|
354
354
|
throw new Error("No module context");
|
|
355
355
|
T({
|
|
@@ -360,7 +360,7 @@ function Oe(a, e) {
|
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
362
|
function Re(a, e) {
|
|
363
|
-
const t =
|
|
363
|
+
const t = E();
|
|
364
364
|
if (!t)
|
|
365
365
|
throw new Error("No module context");
|
|
366
366
|
T({
|
|
@@ -371,7 +371,7 @@ function Re(a, e) {
|
|
|
371
371
|
});
|
|
372
372
|
}
|
|
373
373
|
function Ae(a) {
|
|
374
|
-
const e =
|
|
374
|
+
const e = E();
|
|
375
375
|
if (!e)
|
|
376
376
|
throw new Error("No module context");
|
|
377
377
|
T({
|
|
@@ -408,7 +408,7 @@ function De(a) {
|
|
|
408
408
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
409
409
|
}
|
|
410
410
|
function Pe(a) {
|
|
411
|
-
const e =
|
|
411
|
+
const e = E();
|
|
412
412
|
e && T({ type: "request_module_data", module: e });
|
|
413
413
|
const t = (n) => {
|
|
414
414
|
const i = n.data;
|
|
@@ -428,20 +428,20 @@ function Le(a) {
|
|
|
428
428
|
};
|
|
429
429
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
430
430
|
}
|
|
431
|
-
const Ie = 1, W = 1e3, K = 60 * W, Q = 60 * K,
|
|
431
|
+
const Ie = 1, W = 1e3, K = 60 * W, Q = 60 * K, P = 24 * Q, $e = 7 * P, ze = 30 * P, Me = 365 * P, L = {
|
|
432
432
|
millisecond: Ie,
|
|
433
433
|
second: W,
|
|
434
434
|
minute: K,
|
|
435
435
|
hour: Q,
|
|
436
|
-
day:
|
|
437
|
-
week:
|
|
438
|
-
month:
|
|
439
|
-
year:
|
|
436
|
+
day: P,
|
|
437
|
+
week: $e,
|
|
438
|
+
month: ze,
|
|
439
|
+
year: Me
|
|
440
440
|
};
|
|
441
|
-
function
|
|
441
|
+
function Be(a, e) {
|
|
442
442
|
return a.filter((t) => e.includes(t.type));
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function qe(a, e, t) {
|
|
445
445
|
const n = e.getTime(), i = t.getTime();
|
|
446
446
|
return a.map((o) => ({
|
|
447
447
|
...o,
|
|
@@ -459,7 +459,7 @@ class J {
|
|
|
459
459
|
s(this, "metadata", /* @__PURE__ */ new Map());
|
|
460
460
|
s(this, "capacity");
|
|
461
461
|
s(this, "staleIntervalMs");
|
|
462
|
-
this.capacity = e || 1e4, this.staleIntervalMs = t ||
|
|
462
|
+
this.capacity = e || 1e4, this.staleIntervalMs = t || L.minute;
|
|
463
463
|
}
|
|
464
464
|
get(e, t) {
|
|
465
465
|
const n = this.keyToCacheKey(e);
|
|
@@ -513,7 +513,7 @@ class J {
|
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
async function
|
|
516
|
+
async function I(a) {
|
|
517
517
|
if (!r.token)
|
|
518
518
|
throw new Error("Not authenticated");
|
|
519
519
|
return (await (await fetch(`${h}/v1/queries/queries`, {
|
|
@@ -525,15 +525,15 @@ async function _(a) {
|
|
|
525
525
|
}
|
|
526
526
|
})).json()).items;
|
|
527
527
|
}
|
|
528
|
-
class
|
|
528
|
+
class xe {
|
|
529
529
|
constructor() {
|
|
530
530
|
s(this, "queryStoreCache", new J({
|
|
531
531
|
capacity: 1e4,
|
|
532
|
-
timeout: 20 *
|
|
532
|
+
timeout: 20 * L.second
|
|
533
533
|
}));
|
|
534
534
|
s(this, "liveQueryStoreCache", new J({
|
|
535
535
|
capacity: 1e4,
|
|
536
|
-
timeout: 200 *
|
|
536
|
+
timeout: 200 * L.millisecond
|
|
537
537
|
}));
|
|
538
538
|
}
|
|
539
539
|
moduleQuery(e, t, n, i, o, c = !1) {
|
|
@@ -542,7 +542,7 @@ class qe {
|
|
|
542
542
|
names: [...t],
|
|
543
543
|
types: [...n]
|
|
544
544
|
}, y = this.query(d, i, o, c);
|
|
545
|
-
return y === void 0 || y === "too much data" ? y :
|
|
545
|
+
return y === void 0 || y === "too much data" ? y : Be(y, n);
|
|
546
546
|
}
|
|
547
547
|
query(e, t, n, i = !1) {
|
|
548
548
|
const o = {
|
|
@@ -552,12 +552,12 @@ class qe {
|
|
|
552
552
|
latestOnly: i
|
|
553
553
|
}, c = n > me(/* @__PURE__ */ new Date(), -20);
|
|
554
554
|
let d;
|
|
555
|
-
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 : qe(d, t, n);
|
|
556
556
|
}
|
|
557
557
|
queryCache(e) {
|
|
558
558
|
return this.queryStoreCache.get(e, async () => {
|
|
559
559
|
try {
|
|
560
|
-
return await
|
|
560
|
+
return await I(e);
|
|
561
561
|
} catch (t) {
|
|
562
562
|
throw t;
|
|
563
563
|
}
|
|
@@ -566,21 +566,21 @@ class qe {
|
|
|
566
566
|
liveQueryCache(e) {
|
|
567
567
|
return this.liveQueryStoreCache.get(e, async () => {
|
|
568
568
|
try {
|
|
569
|
-
return await
|
|
569
|
+
return await I(e);
|
|
570
570
|
} catch (t) {
|
|
571
571
|
throw t;
|
|
572
572
|
}
|
|
573
573
|
});
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
-
const
|
|
577
|
-
function
|
|
576
|
+
const Ue = new xe();
|
|
577
|
+
function _e(a, e, t) {
|
|
578
578
|
const n = (i) => {
|
|
579
579
|
const o = i.data;
|
|
580
580
|
if (o.type === "module_data") {
|
|
581
581
|
const { start: c, end: d } = o.queryRange;
|
|
582
582
|
t(
|
|
583
|
-
|
|
583
|
+
Ue.moduleQuery(
|
|
584
584
|
{},
|
|
585
585
|
a,
|
|
586
586
|
e,
|
|
@@ -625,9 +625,9 @@ async function Ge(a, e) {
|
|
|
625
625
|
window.addEventListener("message", i);
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
|
-
const
|
|
628
|
+
const g = class g {
|
|
629
629
|
static isModule() {
|
|
630
|
-
return
|
|
630
|
+
return E() !== null;
|
|
631
631
|
}
|
|
632
632
|
static async getCurrentModuleConfiguration() {
|
|
633
633
|
let e = new URLSearchParams("");
|
|
@@ -637,7 +637,7 @@ const q = class {
|
|
|
637
637
|
return Te(t.trim());
|
|
638
638
|
}
|
|
639
639
|
static get isOnline() {
|
|
640
|
-
return
|
|
640
|
+
return g._isOnline;
|
|
641
641
|
}
|
|
642
642
|
static listenForConnectionEvents() {
|
|
643
643
|
const e = (t) => {
|
|
@@ -672,11 +672,11 @@ const q = class {
|
|
|
672
672
|
return Promise.race([n, o()]);
|
|
673
673
|
}
|
|
674
674
|
};
|
|
675
|
-
|
|
676
|
-
s(g, "getCurrentModuleContext", k), // senders
|
|
675
|
+
s(g, "getCurrentModuleContext", E), // senders
|
|
677
676
|
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",
|
|
677
|
+
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", _e), // bidirectional
|
|
679
678
|
s(g, "getDate", Je), s(g, "prompt", Ge), s(g, "_isOnline", null);
|
|
679
|
+
let $ = g;
|
|
680
680
|
function f(a, e) {
|
|
681
681
|
if (a !== void 0)
|
|
682
682
|
return a;
|
|
@@ -700,9 +700,9 @@ const p = {
|
|
|
700
700
|
portForward: p.PORT_FORWARD,
|
|
701
701
|
observe: p.OBSERVE,
|
|
702
702
|
headless: p.HEADLESS
|
|
703
|
-
},
|
|
703
|
+
}, k = Symbol("RtcClientPool.instance");
|
|
704
704
|
var Vt;
|
|
705
|
-
class
|
|
705
|
+
class N {
|
|
706
706
|
constructor(e) {
|
|
707
707
|
s(this, Vt, null);
|
|
708
708
|
s(this, "createClient");
|
|
@@ -726,7 +726,7 @@ class D {
|
|
|
726
726
|
};
|
|
727
727
|
}
|
|
728
728
|
get isActive() {
|
|
729
|
-
return this[
|
|
729
|
+
return this[k] !== null;
|
|
730
730
|
}
|
|
731
731
|
get size() {
|
|
732
732
|
return this.proxyReceivers.size;
|
|
@@ -736,13 +736,13 @@ class D {
|
|
|
736
736
|
return this.proxyReceivers.set(t, e ?? null), t;
|
|
737
737
|
}
|
|
738
738
|
allocate() {
|
|
739
|
-
if (this[
|
|
740
|
-
return this.teardownTimeout && (clearTimeout(this.teardownTimeout), this.teardownTimeout = null), this[
|
|
739
|
+
if (this[k])
|
|
740
|
+
return this.teardownTimeout && (clearTimeout(this.teardownTimeout), this.teardownTimeout = null), this[k];
|
|
741
741
|
const e = this.createClient(this.dispatch);
|
|
742
|
-
return this[
|
|
742
|
+
return this[k] = e, e;
|
|
743
743
|
}
|
|
744
744
|
async teardown() {
|
|
745
|
-
const e = this[
|
|
745
|
+
const e = this[k];
|
|
746
746
|
if (!e) {
|
|
747
747
|
console.warn("singleton has already been shutdown!");
|
|
748
748
|
return;
|
|
@@ -750,7 +750,7 @@ class D {
|
|
|
750
750
|
try {
|
|
751
751
|
await e.shutdown();
|
|
752
752
|
} finally {
|
|
753
|
-
this[
|
|
753
|
+
this[k] = null;
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
756
|
async releaseInstance(e) {
|
|
@@ -759,63 +759,63 @@ class D {
|
|
|
759
759
|
}, this.ttlMs)), !0) : (console.warn("this instance has already been released!"), !1);
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
Vt =
|
|
763
|
-
const
|
|
764
|
-
[p.UNKNOWN]: new
|
|
762
|
+
Vt = k;
|
|
763
|
+
const D = async () => f(r.token, "Realtime when user isn't authorized"), O = {
|
|
764
|
+
[p.UNKNOWN]: new N({
|
|
765
765
|
ttlMs: 2500,
|
|
766
|
-
createClient: (a) => new
|
|
767
|
-
signalingClient: new
|
|
768
|
-
getToken:
|
|
766
|
+
createClient: (a) => new R({
|
|
767
|
+
signalingClient: new j(h),
|
|
768
|
+
getToken: D,
|
|
769
769
|
sessionType: p.UNKNOWN,
|
|
770
770
|
receive: a
|
|
771
771
|
})
|
|
772
772
|
}),
|
|
773
|
-
[p.TELEOP]: new
|
|
773
|
+
[p.TELEOP]: new N({
|
|
774
774
|
ttlMs: 2500,
|
|
775
|
-
createClient: (a) => new
|
|
776
|
-
signalingClient: new
|
|
777
|
-
getToken:
|
|
775
|
+
createClient: (a) => new R({
|
|
776
|
+
signalingClient: new j(h),
|
|
777
|
+
getToken: D,
|
|
778
778
|
sessionType: p.TELEOP,
|
|
779
779
|
receive: a
|
|
780
780
|
})
|
|
781
781
|
}),
|
|
782
|
-
[p.PORT_FORWARD]: new
|
|
782
|
+
[p.PORT_FORWARD]: new N({
|
|
783
783
|
ttlMs: 2500,
|
|
784
|
-
createClient: (a) => new
|
|
785
|
-
signalingClient: new
|
|
786
|
-
getToken:
|
|
784
|
+
createClient: (a) => new R({
|
|
785
|
+
signalingClient: new j(h),
|
|
786
|
+
getToken: D,
|
|
787
787
|
sessionType: p.PORT_FORWARD,
|
|
788
788
|
receive: a
|
|
789
789
|
})
|
|
790
790
|
}),
|
|
791
|
-
[p.OBSERVE]: new
|
|
791
|
+
[p.OBSERVE]: new N({
|
|
792
792
|
ttlMs: 2500,
|
|
793
|
-
createClient: (a) => new
|
|
794
|
-
signalingClient: new
|
|
795
|
-
getToken:
|
|
793
|
+
createClient: (a) => new R({
|
|
794
|
+
signalingClient: new j(h),
|
|
795
|
+
getToken: D,
|
|
796
796
|
sessionType: p.OBSERVE,
|
|
797
797
|
receive: a
|
|
798
798
|
})
|
|
799
799
|
}),
|
|
800
|
-
[p.HEADLESS]: new
|
|
800
|
+
[p.HEADLESS]: new N({
|
|
801
801
|
ttlMs: 2500,
|
|
802
|
-
createClient: (a) => new
|
|
803
|
-
signalingClient: new
|
|
804
|
-
getToken:
|
|
802
|
+
createClient: (a) => new R({
|
|
803
|
+
signalingClient: new j(h),
|
|
804
|
+
getToken: D,
|
|
805
805
|
sessionType: p.HEADLESS,
|
|
806
806
|
receive: a
|
|
807
807
|
})
|
|
808
808
|
})
|
|
809
809
|
}, Ve = {
|
|
810
|
-
...
|
|
811
|
-
unknown:
|
|
812
|
-
teleop:
|
|
813
|
-
portForward:
|
|
814
|
-
observe:
|
|
815
|
-
headless:
|
|
816
|
-
},
|
|
810
|
+
...O,
|
|
811
|
+
unknown: O[p.UNKNOWN],
|
|
812
|
+
teleop: O[p.TELEOP],
|
|
813
|
+
portForward: O[p.PORT_FORWARD],
|
|
814
|
+
observe: O[p.OBSERVE],
|
|
815
|
+
headless: O[p.HEADLESS]
|
|
816
|
+
}, M = O[p.TELEOP], Fe = (a) => {
|
|
817
817
|
const { sessionType: e } = a;
|
|
818
|
-
return e ? Ve[e] :
|
|
818
|
+
return e ? Ve[e] : M;
|
|
819
819
|
};
|
|
820
820
|
class He {
|
|
821
821
|
constructor(e) {
|
|
@@ -847,7 +847,7 @@ class He {
|
|
|
847
847
|
});
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function A(a) {
|
|
851
851
|
return new Promise((e) => setTimeout(e, a));
|
|
852
852
|
}
|
|
853
853
|
const We = (a) => a !== void 0 && a.capabilities !== void 0 && a.capabilitySet !== void 0;
|
|
@@ -1033,7 +1033,7 @@ class Xe extends X {
|
|
|
1033
1033
|
i.set(d, !0), n.sendBinary(new Uint8Array([...c, ...t]));
|
|
1034
1034
|
const y = (/* @__PURE__ */ new Date()).getTime();
|
|
1035
1035
|
for (; (/* @__PURE__ */ new Date()).getTime() < y + o; )
|
|
1036
|
-
if (await
|
|
1036
|
+
if (await A(50), i.has(d)) {
|
|
1037
1037
|
const m = i.get(d);
|
|
1038
1038
|
if (m !== !0) {
|
|
1039
1039
|
i.delete(d);
|
|
@@ -1080,7 +1080,7 @@ class Ye extends X {
|
|
|
1080
1080
|
);
|
|
1081
1081
|
const c = (/* @__PURE__ */ new Date()).getTime();
|
|
1082
1082
|
for (; (/* @__PURE__ */ new Date()).getTime() < c + i; )
|
|
1083
|
-
if (await
|
|
1083
|
+
if (await A(50), n.has(o)) {
|
|
1084
1084
|
const d = n.get(o);
|
|
1085
1085
|
if (d !== !0) {
|
|
1086
1086
|
n.delete(o);
|
|
@@ -1437,7 +1437,7 @@ const nn = {
|
|
|
1437
1437
|
// bg-BG: 'dd.mm.YYYY'
|
|
1438
1438
|
a.split("/")[0] + "/" + a.split("/")[1] + "–" + e.split("/")[0] + "/" + e.split("/")[1]
|
|
1439
1439
|
);
|
|
1440
|
-
async function
|
|
1440
|
+
async function B(a) {
|
|
1441
1441
|
if (!r.token)
|
|
1442
1442
|
throw new Error("Not authenticated");
|
|
1443
1443
|
return (await (await fetch(`${h}/v1/admin/events/query`, {
|
|
@@ -1462,7 +1462,7 @@ async function ne(a, e, t, n, i) {
|
|
|
1462
1462
|
), v = ct(
|
|
1463
1463
|
m.toLocaleDateString(),
|
|
1464
1464
|
w.toLocaleDateString()
|
|
1465
|
-
), C = await
|
|
1465
|
+
), C = await B({
|
|
1466
1466
|
...i,
|
|
1467
1467
|
eventTypes: a,
|
|
1468
1468
|
start: new Date(m).toISOString(),
|
|
@@ -1472,8 +1472,8 @@ async function ne(a, e, t, n, i) {
|
|
|
1472
1472
|
})
|
|
1473
1473
|
);
|
|
1474
1474
|
}
|
|
1475
|
-
async function
|
|
1476
|
-
return (await
|
|
1475
|
+
async function q(a, e) {
|
|
1476
|
+
return (await B({
|
|
1477
1477
|
...a,
|
|
1478
1478
|
eventTypes: ["annotation"]
|
|
1479
1479
|
})).filter(
|
|
@@ -1489,7 +1489,7 @@ async function ae(a, e, t) {
|
|
|
1489
1489
|
end: new Date(n)
|
|
1490
1490
|
}), d = c.map((m, w) => {
|
|
1491
1491
|
const v = new Date(m).toISOString(), C = w === c.length - 1 ? new Date(Date.now()).toISOString() : new Date(c[w + 1]);
|
|
1492
|
-
return
|
|
1492
|
+
return q(
|
|
1493
1493
|
{
|
|
1494
1494
|
...a,
|
|
1495
1495
|
start: v,
|
|
@@ -1525,7 +1525,7 @@ async function ie(a, e, t, n, i) {
|
|
|
1525
1525
|
async function re() {
|
|
1526
1526
|
if (!r.token)
|
|
1527
1527
|
throw new Error("Not authenticated");
|
|
1528
|
-
const a =
|
|
1528
|
+
const a = M.get();
|
|
1529
1529
|
try {
|
|
1530
1530
|
return await a.getSessions();
|
|
1531
1531
|
} finally {
|
|
@@ -1535,7 +1535,7 @@ async function re() {
|
|
|
1535
1535
|
async function oe() {
|
|
1536
1536
|
if (!r.token)
|
|
1537
1537
|
throw new Error("Not authenticated");
|
|
1538
|
-
const a =
|
|
1538
|
+
const a = M.get();
|
|
1539
1539
|
try {
|
|
1540
1540
|
return await a.getPeers();
|
|
1541
1541
|
} finally {
|
|
@@ -1717,19 +1717,19 @@ class S extends Y {
|
|
|
1717
1717
|
), m = async () => {
|
|
1718
1718
|
if ("isReady" in c)
|
|
1719
1719
|
for (; !c.isReady(); )
|
|
1720
|
-
this.assertNotCancelled(d), await
|
|
1720
|
+
this.assertNotCancelled(d), await A(100);
|
|
1721
1721
|
const w = await this.getRemoteDevicePeerId(c);
|
|
1722
1722
|
this.assertNotCancelled(d);
|
|
1723
1723
|
let v;
|
|
1724
|
-
for (let
|
|
1725
|
-
|
|
1724
|
+
for (let b = 0; b < i && (v = await c.connect(w), !v); b++)
|
|
1725
|
+
A(100), this.assertNotCancelled(d);
|
|
1726
1726
|
if (!v)
|
|
1727
1727
|
throw new Error(
|
|
1728
1728
|
`Session could not be created: exhausted ${i} retries`
|
|
1729
1729
|
);
|
|
1730
1730
|
let C = 0;
|
|
1731
1731
|
for (; !d && c.getConnectionStatus(w) !== "connected"; )
|
|
1732
|
-
await
|
|
1732
|
+
await A(100), C += 1;
|
|
1733
1733
|
return this.assertNotCancelled(d), console.debug(
|
|
1734
1734
|
`${(/* @__PURE__ */ new Date()).toISOString()} :: Connection completed after ${C} retries`
|
|
1735
1735
|
), w;
|
|
@@ -1937,7 +1937,7 @@ class S extends Y {
|
|
|
1937
1937
|
)).json();
|
|
1938
1938
|
}
|
|
1939
1939
|
async getAnnotationCount(e, t) {
|
|
1940
|
-
return await
|
|
1940
|
+
return await q({ ...e, deviceIds: [this.id] }, t);
|
|
1941
1941
|
}
|
|
1942
1942
|
async getAnnotationCountByIntervals(e, t, n) {
|
|
1943
1943
|
return await ae(
|
|
@@ -1997,8 +1997,8 @@ class ft extends Y {
|
|
|
1997
1997
|
if (m.length > 0) {
|
|
1998
1998
|
const v = JSON.parse(m);
|
|
1999
1999
|
if ((w = v.result) != null && w.datapoint) {
|
|
2000
|
-
const C = v.result.datapoint,
|
|
2001
|
-
delete C.stream, this.streamTelemetry[
|
|
2000
|
+
const C = v.result.datapoint, b = C.stream;
|
|
2001
|
+
delete C.stream, this.streamTelemetry[b] = C;
|
|
2002
2002
|
}
|
|
2003
2003
|
}
|
|
2004
2004
|
});
|
|
@@ -2021,13 +2021,13 @@ class ft extends Y {
|
|
|
2021
2021
|
this.rtcClient && console.warn(
|
|
2022
2022
|
"overwriting existing rtcClient due to missing connectionMonitorInterval"
|
|
2023
2023
|
);
|
|
2024
|
-
const n = new
|
|
2024
|
+
const n = new R({
|
|
2025
2025
|
lanOnlyMode: !0,
|
|
2026
2026
|
receive: this.handleMessage,
|
|
2027
2027
|
sessionType: t
|
|
2028
2028
|
});
|
|
2029
2029
|
for (await n.connectLan(this.peerUrl); n.getConnectionStatus(this.peerUrl) !== "connected"; )
|
|
2030
|
-
await
|
|
2030
|
+
await A(100);
|
|
2031
2031
|
this.rtcClient = n, this.initConnectionMonitoring();
|
|
2032
2032
|
}
|
|
2033
2033
|
initConnectionMonitoring() {
|
|
@@ -2202,7 +2202,7 @@ async function St(a) {
|
|
|
2202
2202
|
})).json(), n = t.name;
|
|
2203
2203
|
return new S(a, n, t.organizationId, t.tags);
|
|
2204
2204
|
}
|
|
2205
|
-
async function
|
|
2205
|
+
async function x() {
|
|
2206
2206
|
if (!r.token)
|
|
2207
2207
|
throw new Error("Not authenticated");
|
|
2208
2208
|
const e = await (await fetch(`${h}/v1/admin/device-details/query`, {
|
|
@@ -2313,7 +2313,7 @@ async function jt() {
|
|
|
2313
2313
|
Authorization: "Bearer " + r.token
|
|
2314
2314
|
}
|
|
2315
2315
|
})).json()).items;
|
|
2316
|
-
return (await
|
|
2316
|
+
return (await x()).filter((i) => t.includes(i.id));
|
|
2317
2317
|
}
|
|
2318
2318
|
async function Nt() {
|
|
2319
2319
|
if (!r.token)
|
|
@@ -2327,7 +2327,7 @@ async function Nt() {
|
|
|
2327
2327
|
})).json()).items.map(
|
|
2328
2328
|
(i) => i.deviceId
|
|
2329
2329
|
);
|
|
2330
|
-
return (await
|
|
2330
|
+
return (await x()).filter((i) => t.includes(i.id));
|
|
2331
2331
|
}
|
|
2332
2332
|
async function Dt() {
|
|
2333
2333
|
if (!r.token)
|
|
@@ -2382,7 +2382,7 @@ async function It() {
|
|
|
2382
2382
|
}
|
|
2383
2383
|
})).json()).items;
|
|
2384
2384
|
}
|
|
2385
|
-
async function
|
|
2385
|
+
async function $t(a, e) {
|
|
2386
2386
|
if (!r.token)
|
|
2387
2387
|
throw new Error("Not authenticated");
|
|
2388
2388
|
return await (await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
@@ -2394,7 +2394,7 @@ async function _t(a, e) {
|
|
|
2394
2394
|
}
|
|
2395
2395
|
})).json();
|
|
2396
2396
|
}
|
|
2397
|
-
async function
|
|
2397
|
+
async function zt(a) {
|
|
2398
2398
|
if (!r.token)
|
|
2399
2399
|
throw new Error("Not authenticated");
|
|
2400
2400
|
return await (await fetch(
|
|
@@ -2409,7 +2409,7 @@ async function $t(a) {
|
|
|
2409
2409
|
}
|
|
2410
2410
|
)).json();
|
|
2411
2411
|
}
|
|
2412
|
-
async function
|
|
2412
|
+
async function Mt(a) {
|
|
2413
2413
|
if (!r.token)
|
|
2414
2414
|
throw new Error("Not authenticated");
|
|
2415
2415
|
return await (await fetch(`${h}/v1/admin/views/${a.id}`, {
|
|
@@ -2421,7 +2421,7 @@ async function zt(a) {
|
|
|
2421
2421
|
}
|
|
2422
2422
|
})).json();
|
|
2423
2423
|
}
|
|
2424
|
-
async function
|
|
2424
|
+
async function Bt(a) {
|
|
2425
2425
|
if (!r.token)
|
|
2426
2426
|
throw new Error("Not authenticated");
|
|
2427
2427
|
return await (await fetch(`${h}/v1/queries/analytics`, {
|
|
@@ -2433,7 +2433,7 @@ async function Mt(a) {
|
|
|
2433
2433
|
}
|
|
2434
2434
|
})).json();
|
|
2435
2435
|
}
|
|
2436
|
-
async function
|
|
2436
|
+
async function qt(a) {
|
|
2437
2437
|
if (!r.token)
|
|
2438
2438
|
throw new Error("Not authenticated");
|
|
2439
2439
|
return await (await fetch(`${h}/v1/admin/fleets`, {
|
|
@@ -2445,7 +2445,7 @@ async function Bt(a) {
|
|
|
2445
2445
|
}
|
|
2446
2446
|
})).json();
|
|
2447
2447
|
}
|
|
2448
|
-
async function
|
|
2448
|
+
async function xt() {
|
|
2449
2449
|
if (!r.token)
|
|
2450
2450
|
throw new Error("Not authenticated");
|
|
2451
2451
|
return (await (await fetch(`${h}/v1/admin/event-trigger-groups`, {
|
|
@@ -2456,7 +2456,7 @@ async function qt() {
|
|
|
2456
2456
|
}
|
|
2457
2457
|
})).json()).items;
|
|
2458
2458
|
}
|
|
2459
|
-
async function
|
|
2459
|
+
async function Ut(a) {
|
|
2460
2460
|
if (!r.token)
|
|
2461
2461
|
throw new Error("Not authenticated");
|
|
2462
2462
|
return await (await fetch(
|
|
@@ -2470,7 +2470,7 @@ async function xt(a) {
|
|
|
2470
2470
|
}
|
|
2471
2471
|
)).json();
|
|
2472
2472
|
}
|
|
2473
|
-
async function
|
|
2473
|
+
async function _t(a, e) {
|
|
2474
2474
|
if (!r.token)
|
|
2475
2475
|
throw new Error("Not authenticated");
|
|
2476
2476
|
return await (await fetch(
|
|
@@ -2485,14 +2485,14 @@ async function Ut(a, e) {
|
|
|
2485
2485
|
}
|
|
2486
2486
|
)).json();
|
|
2487
2487
|
}
|
|
2488
|
-
const
|
|
2488
|
+
const l = class l {
|
|
2489
2489
|
static async setDefaultDevice(e) {
|
|
2490
|
-
|
|
2490
|
+
l.defaultDeviceId = e;
|
|
2491
2491
|
}
|
|
2492
2492
|
static async getCurrentDevice() {
|
|
2493
2493
|
if (!r.token)
|
|
2494
2494
|
throw new Error("Not authenticated");
|
|
2495
|
-
if (!
|
|
2495
|
+
if (!l.defaultDeviceId)
|
|
2496
2496
|
throw new Error("No known default device");
|
|
2497
2497
|
const n = (await (await fetch(
|
|
2498
2498
|
`${h}/v1/admin/device-details/query`,
|
|
@@ -2504,14 +2504,14 @@ const E = class {
|
|
|
2504
2504
|
}
|
|
2505
2505
|
}
|
|
2506
2506
|
)).json()).items.find(
|
|
2507
|
-
(c) => c.id ===
|
|
2507
|
+
(c) => c.id === l.defaultDeviceId
|
|
2508
2508
|
), i = n.name, o = new S(
|
|
2509
|
-
|
|
2509
|
+
l.defaultDeviceId,
|
|
2510
2510
|
i,
|
|
2511
2511
|
f(r.currentOrganization),
|
|
2512
2512
|
n.tags
|
|
2513
2513
|
);
|
|
2514
|
-
return
|
|
2514
|
+
return l.knownContext.push(new WeakRef(o)), o;
|
|
2515
2515
|
}
|
|
2516
2516
|
static async getPeerDevice(e) {
|
|
2517
2517
|
const t = new ft(e);
|
|
@@ -2519,11 +2519,11 @@ const E = class {
|
|
|
2519
2519
|
}
|
|
2520
2520
|
static async getDevice(e) {
|
|
2521
2521
|
const t = await St(e);
|
|
2522
|
-
return
|
|
2522
|
+
return l.knownContext.push(new WeakRef(t)), t;
|
|
2523
2523
|
}
|
|
2524
2524
|
};
|
|
2525
|
-
|
|
2526
|
-
|
|
2525
|
+
s(l, "defaultDeviceId"), s(l, "knownContext", []), s(l, "createFleet", qt), 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", q), s(l, "getAnnotationCountByIntervals", ae), s(l, "getCurrentGroup", Ct), s(l, "getDevices", x), 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", zt), s(l, "patchView", Mt), s(l, "queryAnalytics", Bt), s(l, "queryDevices", se), s(l, "queryEvents", B), s(l, "queryTelemetry", I), s(l, "getAllEventTriggerGroup", xt), s(l, "getEventTriggerGroup", Ut), s(l, "patchEventTriggergroup", _t);
|
|
2526
|
+
let z = l;
|
|
2527
2527
|
class an {
|
|
2528
2528
|
static async set(e, t, n) {
|
|
2529
2529
|
try {
|
|
@@ -2920,21 +2920,21 @@ const dn = ["viewer", "operator", "administrator"], hn = "viewer", ln = "operato
|
|
|
2920
2920
|
], yn = ["selection", "labeling", "teleop"], gn = ["info", "warning", "error", "critical"], vn = ["video/mp4"], Tn = (a) => new Promise((e) => setTimeout(e, a * 1e3));
|
|
2921
2921
|
try {
|
|
2922
2922
|
const a = typeof window < "u" && window.location ? new URLSearchParams(window.location.search) : new URLSearchParams(""), e = a.get("device");
|
|
2923
|
-
e &&
|
|
2923
|
+
e && z.setDefaultDevice(e);
|
|
2924
2924
|
const t = a.get("auth");
|
|
2925
|
-
t && r.loginWithToken(t), a.get("module") && r.listenForRefresh(), typeof window < "u" &&
|
|
2925
|
+
t && r.loginWithToken(t), a.get("module") && r.listenForRefresh(), typeof window < "u" && $.listenForConnectionEvents();
|
|
2926
2926
|
} catch {
|
|
2927
2927
|
}
|
|
2928
2928
|
export {
|
|
2929
2929
|
on as Account,
|
|
2930
|
-
|
|
2930
|
+
$ as App,
|
|
2931
2931
|
rn as AudioPlayer,
|
|
2932
2932
|
r as Authentication,
|
|
2933
2933
|
Xe as BinaryRequestDataChannel,
|
|
2934
2934
|
He as CaptureStream,
|
|
2935
2935
|
Ke as DataChannel,
|
|
2936
2936
|
S as Device,
|
|
2937
|
-
|
|
2937
|
+
z as Fleet,
|
|
2938
2938
|
an as KeyValue,
|
|
2939
2939
|
Qe as Manipulator,
|
|
2940
2940
|
ft as PeerDevice,
|