@formant/data-sdk 1.5.2 → 1.5.4
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/README.md +2 -2
- package/dist/data-sdk.cjs.js +2 -2
- package/dist/data-sdk.cjs.js.map +1 -1
- package/dist/data-sdk.es.js +396 -368
- package/dist/data-sdk.es.js.map +1 -1
- package/dist/data-sdk.es6.js +54 -26
- package/dist/data-sdk.umd.js +1 -1
- package/dist/types/data-sdk/src/DataChannel.d.ts +1 -0
- package/dist/types/data-sdk/src/api/createDevice.d.ts +2 -0
- package/dist/types/data-sdk/src/api/getDevicesData.d.ts +2 -0
- package/dist/types/data-sdk/src/api/patchDevice.d.ts +2 -0
- package/dist/types/data-sdk/src/api/queryDevicesData.d.ts +3 -0
- package/dist/types/data-sdk/src/devices/Device.d.ts +8 -3
- package/dist/types/data-sdk/src/main.d.ts +6 -0
- package/package.json +1 -1
package/dist/data-sdk.es.js
CHANGED
|
@@ -3,7 +3,7 @@ var re = (a, e, t) => e in a ? oe(a, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var s = (a, e, t) => (re(a, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
4
|
import * as u from "date-fns";
|
|
5
5
|
import { startOfMinute as se, addMinutes as ce, roundToNearestMinutes as de, addSeconds as he } from "date-fns";
|
|
6
|
-
import { RtcClient as A, SignalingPromiseClient as
|
|
6
|
+
import { RtcClient as A, SignalingPromiseClient as P } from "@formant/realtime-sdk";
|
|
7
7
|
import { EventEmitter as le } from "eventemitter3";
|
|
8
8
|
import { deflate as ue } from "pako";
|
|
9
9
|
import { fromByteArray as me } from "base64-js";
|
|
@@ -103,9 +103,9 @@ class pe {
|
|
|
103
103
|
var i;
|
|
104
104
|
const n = JSON.parse(atob(e.split(".")[1]));
|
|
105
105
|
try {
|
|
106
|
-
let
|
|
107
|
-
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 || (
|
|
108
|
-
const c = await fetch(`${this._apiUrl}/v1/admin/users/${
|
|
106
|
+
let r;
|
|
107
|
+
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) {
|
|
108
|
+
const c = await fetch(`${this._apiUrl}/v1/admin/users/${r}`, {
|
|
109
109
|
method: "GET",
|
|
110
110
|
headers: {
|
|
111
111
|
"Content-Type": "application/json",
|
|
@@ -117,8 +117,8 @@ class pe {
|
|
|
117
117
|
this._currentUser = d;
|
|
118
118
|
}
|
|
119
119
|
this._token = e, this._waitingForAuth.forEach((c) => c(!0));
|
|
120
|
-
} catch (
|
|
121
|
-
console.error("loginWithToken() failed", { err:
|
|
120
|
+
} catch (r) {
|
|
121
|
+
console.error("loginWithToken() failed", { err: r }), this._waitingForAuth.forEach((c) => c(!1));
|
|
122
122
|
} finally {
|
|
123
123
|
this._waitingForAuth.clear();
|
|
124
124
|
}
|
|
@@ -223,7 +223,7 @@ class pe {
|
|
|
223
223
|
await this.loginWithToken(n.authentication.accessToken, e);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function k() {
|
|
227
227
|
return typeof window < "u" && window.location ? new URLSearchParams(window.location.search).get("module") : null;
|
|
228
228
|
}
|
|
229
229
|
function T(a) {
|
|
@@ -232,7 +232,7 @@ function T(a) {
|
|
|
232
232
|
window.parent.postMessage(a, "*");
|
|
233
233
|
}
|
|
234
234
|
function J() {
|
|
235
|
-
const a =
|
|
235
|
+
const a = k();
|
|
236
236
|
if (!a)
|
|
237
237
|
throw new Error("No module context");
|
|
238
238
|
T({
|
|
@@ -249,7 +249,7 @@ function V(a) {
|
|
|
249
249
|
window.removeEventListener("message", e);
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
const
|
|
252
|
+
const o = new pe({
|
|
253
253
|
apiUrl: h,
|
|
254
254
|
refreshAuthToken: J,
|
|
255
255
|
addAccessTokenRefreshListener: V
|
|
@@ -260,7 +260,7 @@ async function ye(a) {
|
|
|
260
260
|
{
|
|
261
261
|
headers: {
|
|
262
262
|
"Content-Type": "application/json",
|
|
263
|
-
Authorization: "Bearer " +
|
|
263
|
+
Authorization: "Bearer " + o.token
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
)).json()).configuration;
|
|
@@ -283,7 +283,7 @@ function Te(a) {
|
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
function Ce() {
|
|
286
|
-
const a =
|
|
286
|
+
const a = k();
|
|
287
287
|
if (!a)
|
|
288
288
|
throw new Error("No module context");
|
|
289
289
|
T({
|
|
@@ -292,7 +292,7 @@ function Ce() {
|
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
294
|
function Se(a, e) {
|
|
295
|
-
const t =
|
|
295
|
+
const t = k();
|
|
296
296
|
if (!t)
|
|
297
297
|
throw new Error("No module context");
|
|
298
298
|
T({
|
|
@@ -303,7 +303,7 @@ function Se(a, e) {
|
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
305
|
function Ee(a, e) {
|
|
306
|
-
const t =
|
|
306
|
+
const t = k();
|
|
307
307
|
if (!t)
|
|
308
308
|
throw new Error("No module context");
|
|
309
309
|
T({
|
|
@@ -314,7 +314,7 @@ function Ee(a, e) {
|
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
function ke(a) {
|
|
317
|
-
const e =
|
|
317
|
+
const e = k();
|
|
318
318
|
if (!e)
|
|
319
319
|
throw new Error("No module context");
|
|
320
320
|
T({
|
|
@@ -323,10 +323,10 @@ function ke(a) {
|
|
|
323
323
|
menus: a
|
|
324
324
|
});
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function Oe(a) {
|
|
327
327
|
T({ type: "show_message", message: a });
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function Re(a, e) {
|
|
330
330
|
const t = (n) => {
|
|
331
331
|
const i = n.data;
|
|
332
332
|
i.type === "channel_data" && i.channel === a && e({
|
|
@@ -343,15 +343,15 @@ function be(a) {
|
|
|
343
343
|
};
|
|
344
344
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function De(a) {
|
|
347
347
|
const e = (t) => {
|
|
348
348
|
const n = t.data;
|
|
349
349
|
n.type === "module_configuration" && a(n);
|
|
350
350
|
};
|
|
351
351
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
352
352
|
}
|
|
353
|
-
function
|
|
354
|
-
const e =
|
|
353
|
+
function Ae(a) {
|
|
354
|
+
const e = k();
|
|
355
355
|
e && T({ type: "request_module_data", module: e });
|
|
356
356
|
const t = (n) => {
|
|
357
357
|
const i = n.data;
|
|
@@ -371,27 +371,27 @@ function Pe(a) {
|
|
|
371
371
|
};
|
|
372
372
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
373
373
|
}
|
|
374
|
-
const Ne = 1, F = 1e3, W = 60 * F, G = 60 * W, I = 24 * G,
|
|
374
|
+
const Ne = 1, F = 1e3, W = 60 * F, G = 60 * W, I = 24 * G, je = 7 * I, Ie = 30 * I, Le = 365 * I, L = {
|
|
375
375
|
millisecond: Ne,
|
|
376
376
|
second: F,
|
|
377
377
|
minute: W,
|
|
378
378
|
hour: G,
|
|
379
379
|
day: I,
|
|
380
|
-
week:
|
|
381
|
-
month:
|
|
382
|
-
year:
|
|
380
|
+
week: je,
|
|
381
|
+
month: Ie,
|
|
382
|
+
year: Le
|
|
383
383
|
};
|
|
384
384
|
function _e(a, e) {
|
|
385
385
|
return a.filter((t) => e.includes(t.type));
|
|
386
386
|
}
|
|
387
387
|
function $e(a, e, t) {
|
|
388
388
|
const n = e.getTime(), i = t.getTime();
|
|
389
|
-
return a.map((
|
|
390
|
-
...
|
|
391
|
-
points:
|
|
389
|
+
return a.map((r) => ({
|
|
390
|
+
...r,
|
|
391
|
+
points: r.points.filter(
|
|
392
392
|
([c]) => c >= n && c < i
|
|
393
393
|
)
|
|
394
|
-
})).filter(({ points:
|
|
394
|
+
})).filter(({ points: r }) => r.length > 0);
|
|
395
395
|
}
|
|
396
396
|
class x {
|
|
397
397
|
constructor({
|
|
@@ -402,11 +402,11 @@ class x {
|
|
|
402
402
|
s(this, "metadata", /* @__PURE__ */ new Map());
|
|
403
403
|
s(this, "capacity");
|
|
404
404
|
s(this, "timeout");
|
|
405
|
-
this.capacity = e || 1e4, this.timeout = t ||
|
|
405
|
+
this.capacity = e || 1e4, this.timeout = t || L.minute;
|
|
406
406
|
}
|
|
407
407
|
get(e, t) {
|
|
408
|
-
const n = this.keyToCacheKey(e), i = this.entries.get(n),
|
|
409
|
-
return (i === void 0 ||
|
|
408
|
+
const n = this.keyToCacheKey(e), i = this.entries.get(n), r = this.metadata.get(n);
|
|
409
|
+
return (i === void 0 || r && (r == null ? void 0 : r.expiration.getTime()) < Date.now()) && !(r != null && r.generating) && t && this.generate(e, t()), i === void 0 && r && r.lastValue !== void 0 ? r.lastValue : i;
|
|
410
410
|
}
|
|
411
411
|
set(e, t) {
|
|
412
412
|
const n = this.keyToCacheKey(e);
|
|
@@ -429,7 +429,7 @@ class x {
|
|
|
429
429
|
if (this.metadata.size < 1)
|
|
430
430
|
return;
|
|
431
431
|
const [e] = [...this.metadata.entries()].reduce(
|
|
432
|
-
([t, n], [i,
|
|
432
|
+
([t, n], [i, r]) => r.expiration.getTime() < n.expiration.getTime() ? [i, r] : [t, n]
|
|
433
433
|
);
|
|
434
434
|
this.clearKey(e);
|
|
435
435
|
}
|
|
@@ -440,53 +440,53 @@ class x {
|
|
|
440
440
|
generating: !0,
|
|
441
441
|
expiration: new Date(Date.now() + this.timeout)
|
|
442
442
|
}), setTimeout(() => {
|
|
443
|
-
t.then((
|
|
443
|
+
t.then((r) => {
|
|
444
444
|
const c = this.metadata.get(n);
|
|
445
|
-
!(c != null && c.generating) || this.set(e,
|
|
445
|
+
!(c != null && c.generating) || this.set(e, r);
|
|
446
446
|
});
|
|
447
447
|
}, 0);
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
async function _(a) {
|
|
451
|
-
if (!
|
|
451
|
+
if (!o.token)
|
|
452
452
|
throw new Error("Not authenticated");
|
|
453
453
|
return (await (await fetch(`${h}/v1/queries/queries`, {
|
|
454
454
|
method: "POST",
|
|
455
455
|
body: JSON.stringify(a),
|
|
456
456
|
headers: {
|
|
457
457
|
"Content-Type": "application/json",
|
|
458
|
-
Authorization: "Bearer " +
|
|
458
|
+
Authorization: "Bearer " + o.token
|
|
459
459
|
}
|
|
460
460
|
})).json()).items;
|
|
461
461
|
}
|
|
462
|
-
class
|
|
462
|
+
class ze {
|
|
463
463
|
constructor() {
|
|
464
464
|
s(this, "queryStoreCache", new x({
|
|
465
465
|
capacity: 1e4,
|
|
466
|
-
timeout: 20 *
|
|
466
|
+
timeout: 20 * L.second
|
|
467
467
|
}));
|
|
468
468
|
s(this, "liveQueryStoreCache", new x({
|
|
469
469
|
capacity: 1e4,
|
|
470
|
-
timeout: 200 *
|
|
470
|
+
timeout: 200 * L.millisecond
|
|
471
471
|
}));
|
|
472
472
|
}
|
|
473
|
-
moduleQuery(e, t, n, i,
|
|
473
|
+
moduleQuery(e, t, n, i, r, c = !1) {
|
|
474
474
|
const d = {
|
|
475
475
|
...e,
|
|
476
476
|
names: [...t],
|
|
477
477
|
types: [...n]
|
|
478
|
-
}, p = this.query(d, i,
|
|
478
|
+
}, p = this.query(d, i, r, c);
|
|
479
479
|
return p === void 0 || p === "too much data" ? p : _e(p, n);
|
|
480
480
|
}
|
|
481
481
|
query(e, t, n, i = !1) {
|
|
482
|
-
const
|
|
482
|
+
const r = {
|
|
483
483
|
...e,
|
|
484
484
|
start: se(t).toISOString(),
|
|
485
485
|
end: i ? n.toISOString() : ce(de(n), 1).toISOString(),
|
|
486
486
|
latestOnly: i
|
|
487
487
|
}, c = n > he(/* @__PURE__ */ new Date(), -20);
|
|
488
488
|
let d;
|
|
489
|
-
return c ? d = this.liveQueryCache(
|
|
489
|
+
return c ? d = this.liveQueryCache(r) : d = this.queryCache(r), !d || d === "too much data" || i ? d : $e(d, t, n);
|
|
490
490
|
}
|
|
491
491
|
queryCache(e) {
|
|
492
492
|
return this.queryStoreCache.get(e, async () => {
|
|
@@ -507,14 +507,14 @@ class Me {
|
|
|
507
507
|
});
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
const
|
|
510
|
+
const Me = new ze();
|
|
511
511
|
function Be(a, e, t) {
|
|
512
512
|
const n = (i) => {
|
|
513
|
-
const
|
|
514
|
-
if (
|
|
515
|
-
const { start: c, end: d } =
|
|
513
|
+
const r = i.data;
|
|
514
|
+
if (r.type === "module_data") {
|
|
515
|
+
const { start: c, end: d } = r.queryRange;
|
|
516
516
|
t(
|
|
517
|
-
|
|
517
|
+
Me.moduleQuery(
|
|
518
518
|
{},
|
|
519
519
|
a,
|
|
520
520
|
e,
|
|
@@ -535,8 +535,8 @@ async function qe(a, e, t) {
|
|
|
535
535
|
maxTime: t,
|
|
536
536
|
time: a
|
|
537
537
|
});
|
|
538
|
-
const i = (
|
|
539
|
-
const c =
|
|
538
|
+
const i = (r) => {
|
|
539
|
+
const c = r.data;
|
|
540
540
|
c.type === "date_response" && (window.removeEventListener("message", i), n(c.data));
|
|
541
541
|
};
|
|
542
542
|
window.addEventListener("message", i);
|
|
@@ -552,8 +552,8 @@ async function xe(a, e) {
|
|
|
552
552
|
okText: e == null ? void 0 : e.okText,
|
|
553
553
|
cancelText: e == null ? void 0 : e.cancelText
|
|
554
554
|
});
|
|
555
|
-
const i = (
|
|
556
|
-
const c =
|
|
555
|
+
const i = (r) => {
|
|
556
|
+
const c = r.data;
|
|
557
557
|
c.type === "prompt_response" && c.promptId === n && t(c.data), window.removeEventListener("message", i);
|
|
558
558
|
};
|
|
559
559
|
window.addEventListener("message", i);
|
|
@@ -561,7 +561,7 @@ async function xe(a, e) {
|
|
|
561
561
|
}
|
|
562
562
|
const q = class {
|
|
563
563
|
static isModule() {
|
|
564
|
-
return
|
|
564
|
+
return k() !== null;
|
|
565
565
|
}
|
|
566
566
|
static async getCurrentModuleConfiguration() {
|
|
567
567
|
let e = new URLSearchParams("");
|
|
@@ -585,12 +585,12 @@ const q = class {
|
|
|
585
585
|
const i = setTimeout(
|
|
586
586
|
() => n(new Error("deadline expired: took too long")),
|
|
587
587
|
e
|
|
588
|
-
),
|
|
589
|
-
window.removeEventListener("message",
|
|
588
|
+
), r = (c) => {
|
|
589
|
+
window.removeEventListener("message", r), clearTimeout(i);
|
|
590
590
|
const { data: d } = c;
|
|
591
591
|
d.type === "formant_online" && (this._isOnline = d.online, t(d.online));
|
|
592
592
|
};
|
|
593
|
-
window.addEventListener("message",
|
|
593
|
+
window.addEventListener("message", r), T({ type: "formant_online" });
|
|
594
594
|
});
|
|
595
595
|
}
|
|
596
596
|
static waitForConnection(e = 5e3) {
|
|
@@ -599,17 +599,17 @@ const q = class {
|
|
|
599
599
|
setTimeout(() => {
|
|
600
600
|
t = !0, d(new Error("deadline expired: took too long"));
|
|
601
601
|
}, e);
|
|
602
|
-
}), i = (c) => new Promise((d) => setTimeout(d, c)),
|
|
602
|
+
}), i = (c) => new Promise((d) => setTimeout(d, c)), r = async () => {
|
|
603
603
|
for (await i(50); !t && !(this.isOnline || await this.checkConnection); )
|
|
604
604
|
await i(500);
|
|
605
605
|
};
|
|
606
|
-
return Promise.race([n,
|
|
606
|
+
return Promise.race([n, r()]);
|
|
607
607
|
}
|
|
608
608
|
};
|
|
609
609
|
let y = q;
|
|
610
|
-
s(y, "getCurrentModuleContext",
|
|
611
|
-
s(y, "disableAnalyticsBottomBar", ge), s(y, "goToDevice", ve), s(y, "goToTime", Te), s(y, "refreshAuthToken", J), s(y, "requestModuleData", Ce), s(y, "sendChannelData", Se), s(y, "setModuleDateTimeRange", Ee), s(y, "setupModuleMenus", ke), s(y, "showMessage",
|
|
612
|
-
s(y, "addAccessTokenRefreshListener", V), s(y, "addChannelDataListener",
|
|
610
|
+
s(y, "getCurrentModuleContext", k), // senders
|
|
611
|
+
s(y, "disableAnalyticsBottomBar", ge), s(y, "goToDevice", ve), s(y, "goToTime", Te), s(y, "refreshAuthToken", J), s(y, "requestModuleData", Ce), s(y, "sendChannelData", Se), s(y, "setModuleDateTimeRange", Ee), s(y, "setupModuleMenus", ke), s(y, "showMessage", Oe), // listeners
|
|
612
|
+
s(y, "addAccessTokenRefreshListener", V), s(y, "addChannelDataListener", Re), s(y, "addMenuListener", be), s(y, "addModuleConfigurationListener", De), s(y, "addModuleDataListener", Ae), s(y, "addOverviewDeviceListener", Pe), s(y, "addStreamListener", Be), // bidirectional
|
|
613
613
|
s(y, "getDate", qe), s(y, "prompt", xe), s(y, "_isOnline", null);
|
|
614
614
|
function f(a, e) {
|
|
615
615
|
if (a !== void 0)
|
|
@@ -621,7 +621,7 @@ const g = {
|
|
|
621
621
|
TELEOP: 1,
|
|
622
622
|
PORT_FORWARD: 2,
|
|
623
623
|
OBSERVE: 3
|
|
624
|
-
},
|
|
624
|
+
}, Vt = {
|
|
625
625
|
...g,
|
|
626
626
|
Unknown: g.UNKNOWN,
|
|
627
627
|
Teleop: g.TELEOP,
|
|
@@ -631,11 +631,11 @@ const g = {
|
|
|
631
631
|
teleop: g.TELEOP,
|
|
632
632
|
portForward: g.PORT_FORWARD,
|
|
633
633
|
observe: g.OBSERVE
|
|
634
|
-
},
|
|
635
|
-
var
|
|
636
|
-
class
|
|
634
|
+
}, O = Symbol("RtcClientPool.instance");
|
|
635
|
+
var zt;
|
|
636
|
+
class N {
|
|
637
637
|
constructor(e) {
|
|
638
|
-
s(this,
|
|
638
|
+
s(this, zt, null);
|
|
639
639
|
s(this, "createClient");
|
|
640
640
|
s(this, "ttlMs");
|
|
641
641
|
s(this, "proxyHandler");
|
|
@@ -646,18 +646,18 @@ class P {
|
|
|
646
646
|
});
|
|
647
647
|
const { createClient: t, ttlMs: n = 0 } = e;
|
|
648
648
|
this.createClient = t, this.ttlMs = Math.max(n, 0), this.proxyHandler = {
|
|
649
|
-
get: (i,
|
|
650
|
-
switch (
|
|
649
|
+
get: (i, r, c) => {
|
|
650
|
+
switch (r) {
|
|
651
651
|
case "shutdown":
|
|
652
652
|
return () => this.releaseInstance(c);
|
|
653
653
|
default:
|
|
654
|
-
return Reflect.get(i,
|
|
654
|
+
return Reflect.get(i, r, c);
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
657
|
};
|
|
658
658
|
}
|
|
659
659
|
get isActive() {
|
|
660
|
-
return this[
|
|
660
|
+
return this[O] !== null;
|
|
661
661
|
}
|
|
662
662
|
get size() {
|
|
663
663
|
return this.proxyReceivers.size;
|
|
@@ -667,13 +667,13 @@ class P {
|
|
|
667
667
|
return this.proxyReceivers.set(t, e ?? null), t;
|
|
668
668
|
}
|
|
669
669
|
allocate() {
|
|
670
|
-
if (this[
|
|
671
|
-
return this.teardownTimeout && (clearTimeout(this.teardownTimeout), this.teardownTimeout = null), this[
|
|
670
|
+
if (this[O])
|
|
671
|
+
return this.teardownTimeout && (clearTimeout(this.teardownTimeout), this.teardownTimeout = null), this[O];
|
|
672
672
|
const e = this.createClient(this.dispatch);
|
|
673
|
-
return this[
|
|
673
|
+
return this[O] = e, e;
|
|
674
674
|
}
|
|
675
675
|
async teardown() {
|
|
676
|
-
const e = this[
|
|
676
|
+
const e = this[O];
|
|
677
677
|
if (!e) {
|
|
678
678
|
console.warn("singleton has already been shutdown!");
|
|
679
679
|
return;
|
|
@@ -681,7 +681,7 @@ class P {
|
|
|
681
681
|
try {
|
|
682
682
|
await e.shutdown();
|
|
683
683
|
} finally {
|
|
684
|
-
this[
|
|
684
|
+
this[O] = null;
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
687
|
async releaseInstance(e) {
|
|
@@ -690,40 +690,40 @@ class P {
|
|
|
690
690
|
}, this.ttlMs)), !0) : (console.warn("this instance has already been released!"), !1);
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
|
-
|
|
694
|
-
const
|
|
695
|
-
[g.UNKNOWN]: new
|
|
693
|
+
zt = O;
|
|
694
|
+
const j = async () => f(o.token, "Realtime when user isn't authorized"), R = {
|
|
695
|
+
[g.UNKNOWN]: new N({
|
|
696
696
|
ttlMs: 2500,
|
|
697
697
|
createClient: (a) => new A({
|
|
698
|
-
signalingClient: new
|
|
699
|
-
getToken:
|
|
698
|
+
signalingClient: new P(h),
|
|
699
|
+
getToken: j,
|
|
700
700
|
sessionType: g.UNKNOWN,
|
|
701
701
|
receive: a
|
|
702
702
|
})
|
|
703
703
|
}),
|
|
704
|
-
[g.TELEOP]: new
|
|
704
|
+
[g.TELEOP]: new N({
|
|
705
705
|
ttlMs: 2500,
|
|
706
706
|
createClient: (a) => new A({
|
|
707
|
-
signalingClient: new
|
|
708
|
-
getToken:
|
|
707
|
+
signalingClient: new P(h),
|
|
708
|
+
getToken: j,
|
|
709
709
|
sessionType: g.TELEOP,
|
|
710
710
|
receive: a
|
|
711
711
|
})
|
|
712
712
|
}),
|
|
713
|
-
[g.PORT_FORWARD]: new
|
|
713
|
+
[g.PORT_FORWARD]: new N({
|
|
714
714
|
ttlMs: 2500,
|
|
715
715
|
createClient: (a) => new A({
|
|
716
|
-
signalingClient: new
|
|
717
|
-
getToken:
|
|
716
|
+
signalingClient: new P(h),
|
|
717
|
+
getToken: j,
|
|
718
718
|
sessionType: g.PORT_FORWARD,
|
|
719
719
|
receive: a
|
|
720
720
|
})
|
|
721
721
|
}),
|
|
722
|
-
[g.OBSERVE]: new
|
|
722
|
+
[g.OBSERVE]: new N({
|
|
723
723
|
ttlMs: 2500,
|
|
724
724
|
createClient: (a) => new A({
|
|
725
|
-
signalingClient: new
|
|
726
|
-
getToken:
|
|
725
|
+
signalingClient: new P(h),
|
|
726
|
+
getToken: j,
|
|
727
727
|
sessionType: g.OBSERVE,
|
|
728
728
|
receive: a
|
|
729
729
|
})
|
|
@@ -768,7 +768,7 @@ class Ve {
|
|
|
768
768
|
});
|
|
769
769
|
}
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function b(a) {
|
|
772
772
|
return new Promise((e) => setTimeout(e, a));
|
|
773
773
|
}
|
|
774
774
|
const Fe = (a) => a !== void 0 && a.capabilities !== void 0 && a.capabilitySet !== void 0;
|
|
@@ -783,20 +783,23 @@ class We {
|
|
|
783
783
|
s(this, "error");
|
|
784
784
|
s(this, "decoder", new TextDecoder());
|
|
785
785
|
this.dataChannel = e, this.dataChannel.binaryType = "arraybuffer", this.dataChannel.onopen = () => {
|
|
786
|
-
this.
|
|
786
|
+
this.setReady();
|
|
787
787
|
}, this.dataChannel.onclose = () => {
|
|
788
788
|
this.ready = !1, this.closeListeners.forEach((t) => t());
|
|
789
789
|
}, this.dataChannel.onerror = (t) => {
|
|
790
790
|
console.error(t), this.error = "An error occurred in DataChannel", this.errorListeners.forEach((n) => n(t));
|
|
791
791
|
}, this.dataChannel.onmessage = (t) => {
|
|
792
792
|
this.listeners.forEach((n) => {
|
|
793
|
-
const i = new Uint8Array(t.data),
|
|
794
|
-
n(
|
|
793
|
+
const i = new Uint8Array(t.data), r = this.decoder.decode(i);
|
|
794
|
+
n(r);
|
|
795
795
|
}), this.binaryListeners.forEach((n) => {
|
|
796
796
|
n(new Uint8Array(t.data));
|
|
797
797
|
});
|
|
798
798
|
};
|
|
799
799
|
}
|
|
800
|
+
setReady() {
|
|
801
|
+
this.ready = !0, this.openListeners.forEach((e) => e());
|
|
802
|
+
}
|
|
800
803
|
addOpenListener(e) {
|
|
801
804
|
this.openListeners.push(e);
|
|
802
805
|
}
|
|
@@ -818,7 +821,7 @@ class We {
|
|
|
818
821
|
async waitTilReady() {
|
|
819
822
|
return this.ready ? !0 : new Promise((t, n) => {
|
|
820
823
|
let i = setInterval(() => {
|
|
821
|
-
this.ready && (clearInterval(i), t(!0)), this.error && n(this.error);
|
|
824
|
+
this.dataChannel.readyState === "open" && this.setReady(), this.ready && (clearInterval(i), t(!0)), this.error && n(this.error);
|
|
822
825
|
}, 10);
|
|
823
826
|
});
|
|
824
827
|
}
|
|
@@ -936,22 +939,22 @@ class He extends H {
|
|
|
936
939
|
const i = t.slice(0, 16).toString();
|
|
937
940
|
if (i.length === 0)
|
|
938
941
|
throw new Error("Invalid response");
|
|
939
|
-
const
|
|
940
|
-
if (
|
|
942
|
+
const r = t.slice(16);
|
|
943
|
+
if (r.length === 0)
|
|
941
944
|
throw new Error("Invalid response");
|
|
942
|
-
this.requestIdToResponseMap.has(i) && this.requestIdToResponseMap.set(i,
|
|
945
|
+
this.requestIdToResponseMap.has(i) && this.requestIdToResponseMap.set(i, r);
|
|
943
946
|
});
|
|
944
947
|
}
|
|
945
948
|
async request(t) {
|
|
946
949
|
if (this.channel || await this.initialize(), !this.channel)
|
|
947
950
|
throw new Error("Failed to create channel");
|
|
948
|
-
const { channel: n, requestIdToResponseMap: i, timeout:
|
|
951
|
+
const { channel: n, requestIdToResponseMap: i, timeout: r } = this;
|
|
949
952
|
await n.waitTilReady();
|
|
950
953
|
const c = this.generateBinaryId(), d = c.toString();
|
|
951
954
|
i.set(d, !0), n.sendBinary(new Uint8Array([...c, ...t]));
|
|
952
955
|
const p = (/* @__PURE__ */ new Date()).getTime();
|
|
953
|
-
for (; (/* @__PURE__ */ new Date()).getTime() < p +
|
|
954
|
-
if (await
|
|
956
|
+
for (; (/* @__PURE__ */ new Date()).getTime() < p + r; )
|
|
957
|
+
if (await b(50), i.has(d)) {
|
|
955
958
|
const m = i.get(d);
|
|
956
959
|
if (m !== !0) {
|
|
957
960
|
i.delete(d);
|
|
@@ -966,7 +969,7 @@ class He extends H {
|
|
|
966
969
|
}
|
|
967
970
|
throw i.delete(d), console.error({
|
|
968
971
|
name: "TimeoutError",
|
|
969
|
-
message: `Request timed out after ${
|
|
972
|
+
message: `Request timed out after ${r / 1e3} seconds`
|
|
970
973
|
}), new Error("Binary request data channel request timed out");
|
|
971
974
|
}
|
|
972
975
|
}
|
|
@@ -976,10 +979,10 @@ class Ke extends H {
|
|
|
976
979
|
}
|
|
977
980
|
async initialize() {
|
|
978
981
|
this.channel = await this.device.createCustomDataChannel(this.channel_name), this.channel.addListener((e) => {
|
|
979
|
-
const t = JSON.parse(e), { id: n, data: i, error:
|
|
982
|
+
const t = JSON.parse(e), { id: n, data: i, error: r } = t;
|
|
980
983
|
if (!n)
|
|
981
984
|
throw new Error("Invalid response");
|
|
982
|
-
if (!i && !
|
|
985
|
+
if (!i && !r)
|
|
983
986
|
throw new Error("Invalid response");
|
|
984
987
|
this.requestIdToResponseMap.has(n) && this.requestIdToResponseMap.set(n, t);
|
|
985
988
|
});
|
|
@@ -989,19 +992,19 @@ class Ke extends H {
|
|
|
989
992
|
throw new Error("Failed to create channel");
|
|
990
993
|
const { channel: t, requestIdToResponseMap: n, timeout: i } = this;
|
|
991
994
|
await t.waitTilReady();
|
|
992
|
-
const
|
|
993
|
-
n.set(
|
|
995
|
+
const r = this.generateTextId();
|
|
996
|
+
n.set(r, !0), t.send(
|
|
994
997
|
JSON.stringify({
|
|
995
|
-
id:
|
|
998
|
+
id: r,
|
|
996
999
|
data: e
|
|
997
1000
|
})
|
|
998
1001
|
);
|
|
999
1002
|
const c = (/* @__PURE__ */ new Date()).getTime();
|
|
1000
1003
|
for (; (/* @__PURE__ */ new Date()).getTime() < c + i; )
|
|
1001
|
-
if (await
|
|
1002
|
-
const d = n.get(
|
|
1004
|
+
if (await b(50), n.has(r)) {
|
|
1005
|
+
const d = n.get(r);
|
|
1003
1006
|
if (d !== !0) {
|
|
1004
|
-
n.delete(
|
|
1007
|
+
n.delete(r);
|
|
1005
1008
|
const { data: p, error: m } = d;
|
|
1006
1009
|
if (p)
|
|
1007
1010
|
return p;
|
|
@@ -1012,7 +1015,7 @@ class Ke extends H {
|
|
|
1012
1015
|
}), new Error("Text request datachannel adapter error");
|
|
1013
1016
|
}
|
|
1014
1017
|
}
|
|
1015
|
-
throw n.delete(
|
|
1018
|
+
throw n.delete(r), console.error({
|
|
1016
1019
|
name: "TimeoutError",
|
|
1017
1020
|
message: `Request timed out after ${i / 1e3} seconds`
|
|
1018
1021
|
}), new Error("Text request datachannel request timed out");
|
|
@@ -1072,13 +1075,13 @@ class K extends le {
|
|
|
1072
1075
|
return n;
|
|
1073
1076
|
}
|
|
1074
1077
|
async getRealtimeVideoStreams() {
|
|
1075
|
-
var i,
|
|
1078
|
+
var i, r, c;
|
|
1076
1079
|
const t = await this.getConfiguration(), n = [];
|
|
1077
1080
|
for (const d of ((i = t.teleop) == null ? void 0 : i.hardwareStreams) ?? [])
|
|
1078
1081
|
d.rtcStreamType === "h264-video-frame" && n.push({
|
|
1079
1082
|
name: d.name
|
|
1080
1083
|
});
|
|
1081
|
-
for (const d of ((
|
|
1084
|
+
for (const d of ((r = t.teleop) == null ? void 0 : r.rosStreams) ?? [])
|
|
1082
1085
|
d.topicType == "formant/H264VideoFrame" && n.push({
|
|
1083
1086
|
name: d.topicName
|
|
1084
1087
|
}), (d.topicType === "sensor_msgs/Image" || d.topicType === "sensor_msgs/CompressedImage") && d.encodeVideo && n.push({
|
|
@@ -1166,8 +1169,8 @@ class K extends le {
|
|
|
1166
1169
|
const i = f(
|
|
1167
1170
|
this.rtcClient,
|
|
1168
1171
|
"Realtime connection has not been started"
|
|
1169
|
-
),
|
|
1170
|
-
i.controlRemoteStream(f(
|
|
1172
|
+
), r = await this.getRemotePeer();
|
|
1173
|
+
i.controlRemoteStream(f(r).id, {
|
|
1171
1174
|
streamName: t,
|
|
1172
1175
|
setAudioFormat: n
|
|
1173
1176
|
});
|
|
@@ -1176,9 +1179,9 @@ class K extends le {
|
|
|
1176
1179
|
const i = f(
|
|
1177
1180
|
this.rtcClient,
|
|
1178
1181
|
"Realtime connection has not been started"
|
|
1179
|
-
),
|
|
1182
|
+
), r = await this.getRemotePeer(), c = await new Promise((d) => {
|
|
1180
1183
|
i.createCustomDataChannel(
|
|
1181
|
-
f(
|
|
1184
|
+
f(r).id,
|
|
1182
1185
|
t,
|
|
1183
1186
|
{
|
|
1184
1187
|
ordered: !0,
|
|
@@ -1199,17 +1202,17 @@ class K extends le {
|
|
|
1199
1202
|
const i = f(
|
|
1200
1203
|
this.rtcClient,
|
|
1201
1204
|
"Realtime connection has not been started"
|
|
1202
|
-
),
|
|
1203
|
-
i.send(f(
|
|
1205
|
+
), r = await this.getRemotePeer();
|
|
1206
|
+
i.send(f(r).id, t, n);
|
|
1204
1207
|
}
|
|
1205
1208
|
async getRealtimeAudioStreams() {
|
|
1206
|
-
var i,
|
|
1209
|
+
var i, r, c;
|
|
1207
1210
|
const t = await this.getConfiguration(), n = [];
|
|
1208
1211
|
for (const d of ((i = t.teleop) == null ? void 0 : i.hardwareStreams) ?? [])
|
|
1209
1212
|
d.rtcStreamType === "audio-chunk" && n.push({
|
|
1210
1213
|
name: d.name
|
|
1211
1214
|
});
|
|
1212
|
-
for (const d of ((
|
|
1215
|
+
for (const d of ((r = t.teleop) == null ? void 0 : r.rosStreams) ?? [])
|
|
1213
1216
|
d.topicType == "audio_common_msgs/AudioData" && n.push({
|
|
1214
1217
|
name: d.topicName
|
|
1215
1218
|
});
|
|
@@ -1227,18 +1230,18 @@ function Xe(a) {
|
|
|
1227
1230
|
return me(n);
|
|
1228
1231
|
}
|
|
1229
1232
|
async function Q() {
|
|
1230
|
-
if (!
|
|
1233
|
+
if (!o.token)
|
|
1231
1234
|
throw new Error("Not authenticated");
|
|
1232
1235
|
return (await (await fetch(`${h}/v1/admin/views`, {
|
|
1233
1236
|
method: "GET",
|
|
1234
1237
|
headers: {
|
|
1235
1238
|
"Content-Type": "application/json",
|
|
1236
|
-
Authorization: "Bearer " +
|
|
1239
|
+
Authorization: "Bearer " + o.token
|
|
1237
1240
|
}
|
|
1238
1241
|
})).json()).items;
|
|
1239
1242
|
}
|
|
1240
1243
|
async function X(a, e) {
|
|
1241
|
-
if (!
|
|
1244
|
+
if (!o.token)
|
|
1242
1245
|
throw new Error("Not authenticated");
|
|
1243
1246
|
const n = (await Q()).filter((d) => d.name === e);
|
|
1244
1247
|
if (n.length === 0)
|
|
@@ -1248,14 +1251,14 @@ async function X(a, e) {
|
|
|
1248
1251
|
body: JSON.stringify(a),
|
|
1249
1252
|
headers: {
|
|
1250
1253
|
"Content-Type": "application/json",
|
|
1251
|
-
Authorization: "Bearer " +
|
|
1254
|
+
Authorization: "Bearer " + o.token
|
|
1252
1255
|
}
|
|
1253
|
-
}),
|
|
1254
|
-
return `${
|
|
1256
|
+
}), r = h.replace("api", "app"), { code: c } = await i.json();
|
|
1257
|
+
return `${r}/shares/${c}#${Xe({
|
|
1255
1258
|
viewId: n[0].id
|
|
1256
1259
|
})}`;
|
|
1257
1260
|
}
|
|
1258
|
-
const
|
|
1261
|
+
const Ft = [
|
|
1259
1262
|
"day",
|
|
1260
1263
|
"week",
|
|
1261
1264
|
"month",
|
|
@@ -1263,7 +1266,7 @@ const xt = [
|
|
|
1263
1266
|
"hour",
|
|
1264
1267
|
"minute",
|
|
1265
1268
|
"quarter"
|
|
1266
|
-
],
|
|
1269
|
+
], Wt = [
|
|
1267
1270
|
"interval",
|
|
1268
1271
|
"start",
|
|
1269
1272
|
"end",
|
|
@@ -1291,7 +1294,7 @@ function at(a) {
|
|
|
1291
1294
|
function it(a) {
|
|
1292
1295
|
return a.count;
|
|
1293
1296
|
}
|
|
1294
|
-
const
|
|
1297
|
+
const Gt = {
|
|
1295
1298
|
min: tt,
|
|
1296
1299
|
max: et,
|
|
1297
1300
|
"standard deviation": Ze,
|
|
@@ -1355,32 +1358,32 @@ const Jt = {
|
|
|
1355
1358
|
// bg-BG: 'dd.mm.YYYY'
|
|
1356
1359
|
a.split("/")[0] + "/" + a.split("/")[1] + "–" + e.split("/")[0] + "/" + e.split("/")[1]
|
|
1357
1360
|
);
|
|
1358
|
-
async function
|
|
1359
|
-
if (!
|
|
1361
|
+
async function z(a) {
|
|
1362
|
+
if (!o.token)
|
|
1360
1363
|
throw new Error("Not authenticated");
|
|
1361
1364
|
return (await (await fetch(`${h}/v1/admin/events/query`, {
|
|
1362
1365
|
method: "POST",
|
|
1363
1366
|
body: JSON.stringify(a),
|
|
1364
1367
|
headers: {
|
|
1365
1368
|
"Content-Type": "application/json",
|
|
1366
|
-
Authorization: "Bearer " +
|
|
1369
|
+
Authorization: "Bearer " + o.token
|
|
1367
1370
|
}
|
|
1368
1371
|
})).json()).items;
|
|
1369
1372
|
}
|
|
1370
1373
|
async function Z(a, e, t, n, i) {
|
|
1371
|
-
const
|
|
1374
|
+
const r = Y[e];
|
|
1372
1375
|
return await Promise.all(
|
|
1373
1376
|
Array(t).fill(0).map(async (c, d) => {
|
|
1374
|
-
const p = new Date(n), m =
|
|
1375
|
-
|
|
1377
|
+
const p = new Date(n), m = r.sub(
|
|
1378
|
+
r.start(p),
|
|
1376
1379
|
t - d - 1
|
|
1377
|
-
), w =
|
|
1378
|
-
|
|
1380
|
+
), w = r.sub(
|
|
1381
|
+
r.end(p),
|
|
1379
1382
|
t - d - 1
|
|
1380
1383
|
), v = ot(
|
|
1381
1384
|
m.toLocaleDateString(),
|
|
1382
1385
|
w.toLocaleDateString()
|
|
1383
|
-
), C = await
|
|
1386
|
+
), C = await z({
|
|
1384
1387
|
...i,
|
|
1385
1388
|
eventTypes: a,
|
|
1386
1389
|
start: new Date(m).toISOString(),
|
|
@@ -1390,15 +1393,15 @@ async function Z(a, e, t, n, i) {
|
|
|
1390
1393
|
})
|
|
1391
1394
|
);
|
|
1392
1395
|
}
|
|
1393
|
-
async function
|
|
1394
|
-
return (await
|
|
1396
|
+
async function M(a, e) {
|
|
1397
|
+
return (await z({
|
|
1395
1398
|
...a,
|
|
1396
1399
|
eventTypes: ["annotation"]
|
|
1397
1400
|
})).filter(
|
|
1398
|
-
(
|
|
1399
|
-
).reduce((
|
|
1401
|
+
(r) => !!r.tags && Object.keys(r.tags).includes(e)
|
|
1402
|
+
).reduce((r, c) => {
|
|
1400
1403
|
const d = c.tags[e];
|
|
1401
|
-
return d in
|
|
1404
|
+
return d in r ? (r[d] += 1, r) : (r[d] = 1, r);
|
|
1402
1405
|
}, {});
|
|
1403
1406
|
}
|
|
1404
1407
|
async function ee(a, e, t) {
|
|
@@ -1407,7 +1410,7 @@ async function ee(a, e, t) {
|
|
|
1407
1410
|
end: new Date(n)
|
|
1408
1411
|
}), d = c.map((m, w) => {
|
|
1409
1412
|
const v = new Date(m).toISOString(), C = w === c.length - 1 ? new Date(Date.now()).toISOString() : new Date(c[w + 1]);
|
|
1410
|
-
return
|
|
1413
|
+
return M(
|
|
1411
1414
|
{
|
|
1412
1415
|
...a,
|
|
1413
1416
|
start: v,
|
|
@@ -1422,13 +1425,13 @@ async function ee(a, e, t) {
|
|
|
1422
1425
|
}));
|
|
1423
1426
|
}
|
|
1424
1427
|
async function te(a, e, t, n, i) {
|
|
1425
|
-
let
|
|
1426
|
-
Array.isArray(a) || (
|
|
1428
|
+
let r = a;
|
|
1429
|
+
Array.isArray(a) || (r = [a]);
|
|
1427
1430
|
let c = e;
|
|
1428
1431
|
return Array.isArray(e) || (c = [e]), (await (await fetch(`${h}/v1/queries/queries`, {
|
|
1429
1432
|
method: "POST",
|
|
1430
1433
|
body: JSON.stringify({
|
|
1431
|
-
deviceIds:
|
|
1434
|
+
deviceIds: r,
|
|
1432
1435
|
end: n.toISOString(),
|
|
1433
1436
|
names: c,
|
|
1434
1437
|
start: t.toISOString(),
|
|
@@ -1436,12 +1439,12 @@ async function te(a, e, t, n, i) {
|
|
|
1436
1439
|
}),
|
|
1437
1440
|
headers: {
|
|
1438
1441
|
"Content-Type": "application/json",
|
|
1439
|
-
Authorization: "Bearer " +
|
|
1442
|
+
Authorization: "Bearer " + o.token
|
|
1440
1443
|
}
|
|
1441
1444
|
})).json()).items;
|
|
1442
1445
|
}
|
|
1443
1446
|
async function ne() {
|
|
1444
|
-
if (!
|
|
1447
|
+
if (!o.token)
|
|
1445
1448
|
throw new Error("Not authenticated");
|
|
1446
1449
|
const a = $.get();
|
|
1447
1450
|
try {
|
|
@@ -1451,7 +1454,7 @@ async function ne() {
|
|
|
1451
1454
|
}
|
|
1452
1455
|
}
|
|
1453
1456
|
async function ae() {
|
|
1454
|
-
if (!
|
|
1457
|
+
if (!o.token)
|
|
1455
1458
|
throw new Error("Not authenticated");
|
|
1456
1459
|
const a = $.get();
|
|
1457
1460
|
try {
|
|
@@ -1460,7 +1463,55 @@ async function ae() {
|
|
|
1460
1463
|
await a.shutdown();
|
|
1461
1464
|
}
|
|
1462
1465
|
}
|
|
1463
|
-
|
|
1466
|
+
async function rt(a) {
|
|
1467
|
+
if (!o.token)
|
|
1468
|
+
throw new Error("Not authenticated");
|
|
1469
|
+
return await (await fetch(`${h}/v1/admin/devices`, {
|
|
1470
|
+
method: "POST",
|
|
1471
|
+
body: JSON.stringify(a),
|
|
1472
|
+
headers: {
|
|
1473
|
+
"Content-Type": "application/json",
|
|
1474
|
+
Authorization: "Bearer " + o.token
|
|
1475
|
+
}
|
|
1476
|
+
})).json();
|
|
1477
|
+
}
|
|
1478
|
+
async function st(a, e) {
|
|
1479
|
+
if (!o.token)
|
|
1480
|
+
throw new Error("Not authenticated");
|
|
1481
|
+
return await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
1482
|
+
method: "PATCH",
|
|
1483
|
+
body: JSON.stringify(e),
|
|
1484
|
+
headers: {
|
|
1485
|
+
"Content-Type": "application/json",
|
|
1486
|
+
Authorization: "Bearer " + o.token
|
|
1487
|
+
}
|
|
1488
|
+
})).json();
|
|
1489
|
+
}
|
|
1490
|
+
async function ct() {
|
|
1491
|
+
if (!o.token)
|
|
1492
|
+
throw new Error("Not authenticated");
|
|
1493
|
+
return (await (await fetch(`${h}/v1/admin/device-details/query`, {
|
|
1494
|
+
method: "POST",
|
|
1495
|
+
body: JSON.stringify({ enabled: !0, type: "default" }),
|
|
1496
|
+
headers: {
|
|
1497
|
+
"Content-Type": "application/json",
|
|
1498
|
+
Authorization: "Bearer " + o.token
|
|
1499
|
+
}
|
|
1500
|
+
})).json()).items;
|
|
1501
|
+
}
|
|
1502
|
+
async function dt(a) {
|
|
1503
|
+
if (!o.token)
|
|
1504
|
+
throw new Error("Not authenticated");
|
|
1505
|
+
return (await (await fetch(`${h}/v1/admin/devices/query`, {
|
|
1506
|
+
method: "POST",
|
|
1507
|
+
body: JSON.stringify(a),
|
|
1508
|
+
headers: {
|
|
1509
|
+
"Content-Type": "application/json",
|
|
1510
|
+
Authorization: "Bearer " + o.token
|
|
1511
|
+
}
|
|
1512
|
+
})).json()).items;
|
|
1513
|
+
}
|
|
1514
|
+
class E extends K {
|
|
1464
1515
|
constructor(e, t, n, i) {
|
|
1465
1516
|
super(), this.id = e, this.name = t, this.organizationId = n, this.tags = i;
|
|
1466
1517
|
}
|
|
@@ -1474,7 +1525,7 @@ class L extends K {
|
|
|
1474
1525
|
}),
|
|
1475
1526
|
headers: {
|
|
1476
1527
|
"Content-Type": "application/json",
|
|
1477
|
-
Authorization: "Bearer " +
|
|
1528
|
+
Authorization: "Bearer " + o.token
|
|
1478
1529
|
}
|
|
1479
1530
|
}
|
|
1480
1531
|
)).json()).items;
|
|
@@ -1484,7 +1535,7 @@ class L extends K {
|
|
|
1484
1535
|
method: "GET",
|
|
1485
1536
|
headers: {
|
|
1486
1537
|
"Content-Type": "application/json",
|
|
1487
|
-
Authorization: "Bearer " +
|
|
1538
|
+
Authorization: "Bearer " + o.token
|
|
1488
1539
|
}
|
|
1489
1540
|
});
|
|
1490
1541
|
const t = await e.json();
|
|
@@ -1499,7 +1550,7 @@ class L extends K {
|
|
|
1499
1550
|
method: "GET",
|
|
1500
1551
|
headers: {
|
|
1501
1552
|
"Content-Type": "application/json",
|
|
1502
|
-
Authorization: "Bearer " +
|
|
1553
|
+
Authorization: "Bearer " + o.token
|
|
1503
1554
|
}
|
|
1504
1555
|
}
|
|
1505
1556
|
), (await e.json()).document;
|
|
@@ -1512,7 +1563,7 @@ class L extends K {
|
|
|
1512
1563
|
}),
|
|
1513
1564
|
headers: {
|
|
1514
1565
|
"Content-Type": "application/json",
|
|
1515
|
-
Authorization: "Bearer " +
|
|
1566
|
+
Authorization: "Bearer " + o.token
|
|
1516
1567
|
}
|
|
1517
1568
|
})).json()).fileUrls;
|
|
1518
1569
|
}
|
|
@@ -1549,19 +1600,19 @@ class L extends K {
|
|
|
1549
1600
|
), m = async () => {
|
|
1550
1601
|
if ("isReady" in c)
|
|
1551
1602
|
for (; !c.isReady(); )
|
|
1552
|
-
this.assertNotCancelled(d), await
|
|
1603
|
+
this.assertNotCancelled(d), await b(100);
|
|
1553
1604
|
const w = await this.getRemoteDevicePeerId(c);
|
|
1554
1605
|
this.assertNotCancelled(d);
|
|
1555
1606
|
let v;
|
|
1556
|
-
for (let
|
|
1557
|
-
|
|
1607
|
+
for (let D = 0; D < i && (v = await c.connect(w), !v); D++)
|
|
1608
|
+
b(100), this.assertNotCancelled(d);
|
|
1558
1609
|
if (!v)
|
|
1559
1610
|
throw new Error(
|
|
1560
1611
|
`Session could not be created: exhausted ${i} retries`
|
|
1561
1612
|
);
|
|
1562
1613
|
let C = 0;
|
|
1563
1614
|
for (; !d && c.getConnectionStatus(w) !== "connected"; )
|
|
1564
|
-
await
|
|
1615
|
+
await b(100), C += 1;
|
|
1565
1616
|
return this.assertNotCancelled(d), console.debug(
|
|
1566
1617
|
`${(/* @__PURE__ */ new Date()).toISOString()} :: Connection completed after ${C} retries`
|
|
1567
1618
|
), w;
|
|
@@ -1633,7 +1684,7 @@ class L extends K {
|
|
|
1633
1684
|
method: "GET",
|
|
1634
1685
|
headers: {
|
|
1635
1686
|
"Content-Type": "application/json",
|
|
1636
|
-
Authorization: "Bearer " +
|
|
1687
|
+
Authorization: "Bearer " + o.token
|
|
1637
1688
|
}
|
|
1638
1689
|
}
|
|
1639
1690
|
)).json()).items.map((n) => ({
|
|
@@ -1671,11 +1722,11 @@ class L extends K {
|
|
|
1671
1722
|
deviceId: this.id,
|
|
1672
1723
|
command: c.command,
|
|
1673
1724
|
parameter: p,
|
|
1674
|
-
userId: (w =
|
|
1725
|
+
userId: (w = o.currentUser) == null ? void 0 : w.id
|
|
1675
1726
|
}),
|
|
1676
1727
|
headers: {
|
|
1677
1728
|
"Content-Type": "application/json",
|
|
1678
|
-
Authorization: "Bearer " +
|
|
1729
|
+
Authorization: "Bearer " + o.token
|
|
1679
1730
|
}
|
|
1680
1731
|
});
|
|
1681
1732
|
}
|
|
@@ -1684,7 +1735,7 @@ class L extends K {
|
|
|
1684
1735
|
method: "GET",
|
|
1685
1736
|
headers: {
|
|
1686
1737
|
"Content-Type": "application/json",
|
|
1687
|
-
Authorization: "Bearer " +
|
|
1738
|
+
Authorization: "Bearer " + o.token
|
|
1688
1739
|
}
|
|
1689
1740
|
});
|
|
1690
1741
|
}
|
|
@@ -1698,7 +1749,7 @@ class L extends K {
|
|
|
1698
1749
|
}),
|
|
1699
1750
|
headers: {
|
|
1700
1751
|
"Content-Type": "application/json",
|
|
1701
|
-
Authorization: "Bearer " +
|
|
1752
|
+
Authorization: "Bearer " + o.token
|
|
1702
1753
|
}
|
|
1703
1754
|
})).json();
|
|
1704
1755
|
return new Ve(n);
|
|
@@ -1723,7 +1774,7 @@ class L extends K {
|
|
|
1723
1774
|
}),
|
|
1724
1775
|
headers: {
|
|
1725
1776
|
"Content-Type": "application/json",
|
|
1726
|
-
Authorization: "Bearer " +
|
|
1777
|
+
Authorization: "Bearer " + o.token
|
|
1727
1778
|
}
|
|
1728
1779
|
}
|
|
1729
1780
|
), n = [], i = [];
|
|
@@ -1746,7 +1797,7 @@ class L extends K {
|
|
|
1746
1797
|
}),
|
|
1747
1798
|
headers: {
|
|
1748
1799
|
"Content-Type": "application/json",
|
|
1749
|
-
Authorization: "Bearer " +
|
|
1800
|
+
Authorization: "Bearer " + o.token
|
|
1750
1801
|
}
|
|
1751
1802
|
}
|
|
1752
1803
|
)).json();
|
|
@@ -1763,13 +1814,13 @@ class L extends K {
|
|
|
1763
1814
|
}),
|
|
1764
1815
|
headers: {
|
|
1765
1816
|
"Content-Type": "application/json",
|
|
1766
|
-
Authorization: "Bearer " +
|
|
1817
|
+
Authorization: "Bearer " + o.token
|
|
1767
1818
|
}
|
|
1768
1819
|
}
|
|
1769
1820
|
)).json();
|
|
1770
1821
|
}
|
|
1771
1822
|
async getAnnotationCount(e, t) {
|
|
1772
|
-
return await
|
|
1823
|
+
return await M({ ...e, deviceIds: [this.id] }, t);
|
|
1773
1824
|
}
|
|
1774
1825
|
async getAnnotationCountByIntervals(e, t, n) {
|
|
1775
1826
|
return await ee(
|
|
@@ -1778,41 +1829,18 @@ class L extends K {
|
|
|
1778
1829
|
n
|
|
1779
1830
|
);
|
|
1780
1831
|
}
|
|
1781
|
-
async eventsCounter(e, t, n, i,
|
|
1832
|
+
async eventsCounter(e, t, n, i, r) {
|
|
1782
1833
|
return await Z(e, t, n, i, {
|
|
1783
|
-
...
|
|
1834
|
+
...r,
|
|
1784
1835
|
deviceIds: [this.id]
|
|
1785
1836
|
});
|
|
1786
1837
|
}
|
|
1787
1838
|
async createShareLink(e, t) {
|
|
1788
1839
|
return e.scope.deviceIds = [this.id], await X(e, t);
|
|
1789
1840
|
}
|
|
1790
|
-
async createDevice(e) {
|
|
1791
|
-
if (!r.token)
|
|
1792
|
-
throw new Error("Not authenticated");
|
|
1793
|
-
return await (await fetch(`${h}/v1/admin/devices`, {
|
|
1794
|
-
method: "POST",
|
|
1795
|
-
body: JSON.stringify(e),
|
|
1796
|
-
headers: {
|
|
1797
|
-
"Content-Type": "application/json",
|
|
1798
|
-
Authorization: "Bearer " + r.token
|
|
1799
|
-
}
|
|
1800
|
-
})).json();
|
|
1801
|
-
}
|
|
1802
|
-
async patchDevice(e, t) {
|
|
1803
|
-
if (!r.token)
|
|
1804
|
-
throw new Error("Not authenticated");
|
|
1805
|
-
return await (await fetch(`${h}/v1/admin/devices/${e}`, {
|
|
1806
|
-
method: "PATCH",
|
|
1807
|
-
body: JSON.stringify(t),
|
|
1808
|
-
headers: {
|
|
1809
|
-
"Content-Type": "application/json",
|
|
1810
|
-
Authorization: "Bearer " + r.token
|
|
1811
|
-
}
|
|
1812
|
-
})).json();
|
|
1813
|
-
}
|
|
1814
1841
|
}
|
|
1815
|
-
|
|
1842
|
+
s(E, "createDevice", rt), s(E, "patchDevice", st), s(E, "getDevicesData", ct), s(E, "queryDevicesData", dt);
|
|
1843
|
+
class ht extends K {
|
|
1816
1844
|
constructor(t) {
|
|
1817
1845
|
super();
|
|
1818
1846
|
s(this, "id");
|
|
@@ -1823,12 +1851,12 @@ class rt extends K {
|
|
|
1823
1851
|
async getLatestTelemetry() {
|
|
1824
1852
|
this.telemetryStreamActive || this.subscribeToTelemetry();
|
|
1825
1853
|
const t = this.streamTelemetry;
|
|
1826
|
-
return Object.entries(t).map(([i,
|
|
1854
|
+
return Object.entries(t).map(([i, r]) => ({
|
|
1827
1855
|
deviceId: this.id,
|
|
1828
1856
|
streamName: i,
|
|
1829
1857
|
streamType: "json",
|
|
1830
|
-
currentValue:
|
|
1831
|
-
currentValueTime:
|
|
1858
|
+
currentValue: r,
|
|
1859
|
+
currentValueTime: r.timestamp,
|
|
1832
1860
|
tags: {}
|
|
1833
1861
|
}));
|
|
1834
1862
|
}
|
|
@@ -1845,15 +1873,15 @@ class rt extends K {
|
|
|
1845
1873
|
}), n.addEventListener("readystatechange", (i) => {
|
|
1846
1874
|
n.readyState === XMLHttpRequest.DONE && this.handleXHRError("closed");
|
|
1847
1875
|
}), n.addEventListener("progress", (i) => {
|
|
1848
|
-
const
|
|
1849
|
-
t =
|
|
1876
|
+
const r = i.loaded, c = r - t;
|
|
1877
|
+
t = r, n.responseText.substr(-c).split(`
|
|
1850
1878
|
`).forEach((m) => {
|
|
1851
1879
|
var w;
|
|
1852
1880
|
if (m.length > 0) {
|
|
1853
1881
|
const v = JSON.parse(m);
|
|
1854
1882
|
if ((w = v.result) != null && w.datapoint) {
|
|
1855
|
-
const C = v.result.datapoint,
|
|
1856
|
-
delete C.stream, this.streamTelemetry[
|
|
1883
|
+
const C = v.result.datapoint, D = C.stream;
|
|
1884
|
+
delete C.stream, this.streamTelemetry[D] = C;
|
|
1857
1885
|
}
|
|
1858
1886
|
}
|
|
1859
1887
|
});
|
|
@@ -1882,7 +1910,7 @@ class rt extends K {
|
|
|
1882
1910
|
sessionType: t
|
|
1883
1911
|
});
|
|
1884
1912
|
for (await n.connectLan(this.peerUrl); n.getConnectionStatus(this.peerUrl) !== "connected"; )
|
|
1885
|
-
await
|
|
1913
|
+
await b(100);
|
|
1886
1914
|
this.rtcClient = n, this.initConnectionMonitoring();
|
|
1887
1915
|
}
|
|
1888
1916
|
initConnectionMonitoring() {
|
|
@@ -1915,11 +1943,11 @@ class rt extends K {
|
|
|
1915
1943
|
if (t)
|
|
1916
1944
|
throw new Error(`Realtime connection hasn't been started for ${this.id}`);
|
|
1917
1945
|
}
|
|
1918
|
-
async sendCommand(t, n, i,
|
|
1946
|
+
async sendCommand(t, n, i, r) {
|
|
1919
1947
|
const c = {
|
|
1920
1948
|
value: n,
|
|
1921
1949
|
scrubberTime: (i || /* @__PURE__ */ new Date()).toISOString(),
|
|
1922
|
-
meta:
|
|
1950
|
+
meta: r
|
|
1923
1951
|
};
|
|
1924
1952
|
return await fetch(`${this.peerUrl}/v1/enqueue-command`, {
|
|
1925
1953
|
method: "POST",
|
|
@@ -1933,43 +1961,43 @@ class rt extends K {
|
|
|
1933
1961
|
});
|
|
1934
1962
|
}
|
|
1935
1963
|
}
|
|
1936
|
-
async function
|
|
1937
|
-
if (!
|
|
1964
|
+
async function lt(a, e) {
|
|
1965
|
+
if (!o.token)
|
|
1938
1966
|
throw new Error("Not authenticated");
|
|
1939
1967
|
return await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
1940
1968
|
method: "PATCH",
|
|
1941
1969
|
body: JSON.stringify({ fleetId: e }),
|
|
1942
1970
|
headers: {
|
|
1943
1971
|
"Content-Type": "application/json",
|
|
1944
|
-
Authorization: "Bearer " +
|
|
1972
|
+
Authorization: "Bearer " + o.token
|
|
1945
1973
|
}
|
|
1946
1974
|
})).json();
|
|
1947
1975
|
}
|
|
1948
|
-
async function
|
|
1949
|
-
if (!
|
|
1976
|
+
async function ut(a) {
|
|
1977
|
+
if (!o.token)
|
|
1950
1978
|
throw new Error("Not authenticated");
|
|
1951
1979
|
return (await (await fetch(`${h}/v1/queries/queries`, {
|
|
1952
1980
|
method: "POST",
|
|
1953
1981
|
body: JSON.stringify(a),
|
|
1954
1982
|
headers: {
|
|
1955
1983
|
"Content-Type": "application/json",
|
|
1956
|
-
Authorization: "Bearer " +
|
|
1984
|
+
Authorization: "Bearer " + o.token
|
|
1957
1985
|
}
|
|
1958
1986
|
})).json()).aggregates;
|
|
1959
1987
|
}
|
|
1960
|
-
async function
|
|
1961
|
-
if (!
|
|
1988
|
+
async function mt(a) {
|
|
1989
|
+
if (!o.token)
|
|
1962
1990
|
throw new Error("Not authenticated");
|
|
1963
1991
|
await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
1964
1992
|
method: "DELETE",
|
|
1965
1993
|
headers: {
|
|
1966
1994
|
"Content-Type": "application/json",
|
|
1967
|
-
Authorization: "Bearer " +
|
|
1995
|
+
Authorization: "Bearer " + o.token
|
|
1968
1996
|
}
|
|
1969
1997
|
});
|
|
1970
1998
|
}
|
|
1971
|
-
async function
|
|
1972
|
-
if (!
|
|
1999
|
+
async function ft() {
|
|
2000
|
+
if (!o.token)
|
|
1973
2001
|
throw new Error("Not authenticated");
|
|
1974
2002
|
return (await (await fetch(
|
|
1975
2003
|
`${h}/v1/queries/analytics/streams`,
|
|
@@ -1977,13 +2005,13 @@ async function ht() {
|
|
|
1977
2005
|
method: "GET",
|
|
1978
2006
|
headers: {
|
|
1979
2007
|
"Content-Type": "application/json",
|
|
1980
|
-
Authorization: "Bearer " +
|
|
2008
|
+
Authorization: "Bearer " + o.token
|
|
1981
2009
|
}
|
|
1982
2010
|
}
|
|
1983
2011
|
)).json()).items;
|
|
1984
2012
|
}
|
|
1985
|
-
async function
|
|
1986
|
-
if (!
|
|
2013
|
+
async function wt() {
|
|
2014
|
+
if (!o.token)
|
|
1987
2015
|
throw new Error("Not authenticated");
|
|
1988
2016
|
return (await (await fetch(
|
|
1989
2017
|
`${h}/v1/admin/analytics-modules`,
|
|
@@ -1991,39 +2019,39 @@ async function lt() {
|
|
|
1991
2019
|
method: "GET",
|
|
1992
2020
|
headers: {
|
|
1993
2021
|
"Content-Type": "application/json",
|
|
1994
|
-
Authorization: "Bearer " +
|
|
2022
|
+
Authorization: "Bearer " + o.token
|
|
1995
2023
|
}
|
|
1996
2024
|
}
|
|
1997
2025
|
)).json()).items;
|
|
1998
2026
|
}
|
|
1999
|
-
async function
|
|
2000
|
-
if (!
|
|
2027
|
+
async function pt(a) {
|
|
2028
|
+
if (!o.token)
|
|
2001
2029
|
throw new Error("Not authenticated");
|
|
2002
2030
|
return await (await fetch(`${h}/v1/queries/analytics/rows`, {
|
|
2003
2031
|
method: "POST",
|
|
2004
2032
|
body: JSON.stringify(a),
|
|
2005
2033
|
headers: {
|
|
2006
2034
|
"Content-Type": "application/json",
|
|
2007
|
-
Authorization: "Bearer " +
|
|
2035
|
+
Authorization: "Bearer " + o.token
|
|
2008
2036
|
}
|
|
2009
2037
|
})).json();
|
|
2010
2038
|
}
|
|
2011
2039
|
async function ie(a) {
|
|
2012
|
-
if (!
|
|
2040
|
+
if (!o.token)
|
|
2013
2041
|
throw new Error("Not authenticated");
|
|
2014
2042
|
return (await (await fetch(`${h}/v1/admin/devices/query`, {
|
|
2015
2043
|
method: "POST",
|
|
2016
2044
|
body: JSON.stringify(a),
|
|
2017
2045
|
headers: {
|
|
2018
2046
|
"Content-Type": "application/json",
|
|
2019
|
-
Authorization: "Bearer " +
|
|
2047
|
+
Authorization: "Bearer " + o.token
|
|
2020
2048
|
}
|
|
2021
2049
|
})).json()).items.map(
|
|
2022
|
-
(n) => new
|
|
2050
|
+
(n) => new E(n.id, n.name, n.organizationId, n.tags)
|
|
2023
2051
|
);
|
|
2024
2052
|
}
|
|
2025
|
-
async function
|
|
2026
|
-
if (!
|
|
2053
|
+
async function yt() {
|
|
2054
|
+
if (!o.token)
|
|
2027
2055
|
throw new Error("Not authenticated");
|
|
2028
2056
|
let a = new URLSearchParams("");
|
|
2029
2057
|
typeof window < "u" && window.location && (a = new URLSearchParams(window.location.search));
|
|
@@ -2035,7 +2063,7 @@ async function mt() {
|
|
|
2035
2063
|
{
|
|
2036
2064
|
headers: {
|
|
2037
2065
|
"Content-Type": "application/json",
|
|
2038
|
-
Authorization: "Bearer " +
|
|
2066
|
+
Authorization: "Bearer " + o.token
|
|
2039
2067
|
}
|
|
2040
2068
|
}
|
|
2041
2069
|
), { tagKey: n, tagValue: i } = await t.json();
|
|
@@ -2045,31 +2073,31 @@ async function mt() {
|
|
|
2045
2073
|
type: "default"
|
|
2046
2074
|
});
|
|
2047
2075
|
}
|
|
2048
|
-
async function
|
|
2049
|
-
if (!
|
|
2076
|
+
async function gt(a) {
|
|
2077
|
+
if (!o.token)
|
|
2050
2078
|
throw new Error("Not authenticated");
|
|
2051
2079
|
const t = await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
2052
2080
|
method: "GET",
|
|
2053
2081
|
headers: {
|
|
2054
2082
|
"Content-Type": "application/json",
|
|
2055
|
-
Authorization: "Bearer " +
|
|
2083
|
+
Authorization: "Bearer " + o.token
|
|
2056
2084
|
}
|
|
2057
2085
|
})).json(), n = t.name;
|
|
2058
|
-
return new
|
|
2086
|
+
return new E(a, n, t.organizationId, t.tags);
|
|
2059
2087
|
}
|
|
2060
2088
|
async function B() {
|
|
2061
|
-
if (!
|
|
2089
|
+
if (!o.token)
|
|
2062
2090
|
throw new Error("Not authenticated");
|
|
2063
2091
|
const e = await (await fetch(`${h}/v1/admin/device-details/query`, {
|
|
2064
2092
|
method: "POST",
|
|
2065
2093
|
body: JSON.stringify({ enabled: !0, type: "default" }),
|
|
2066
2094
|
headers: {
|
|
2067
2095
|
"Content-Type": "application/json",
|
|
2068
|
-
Authorization: "Bearer " +
|
|
2096
|
+
Authorization: "Bearer " + o.token
|
|
2069
2097
|
}
|
|
2070
2098
|
})).json();
|
|
2071
2099
|
return e.items, e.items.map(
|
|
2072
|
-
(t) => new
|
|
2100
|
+
(t) => new E(
|
|
2073
2101
|
t.id,
|
|
2074
2102
|
t.name,
|
|
2075
2103
|
t.organizationId,
|
|
@@ -2077,8 +2105,8 @@ async function B() {
|
|
|
2077
2105
|
)
|
|
2078
2106
|
);
|
|
2079
2107
|
}
|
|
2080
|
-
async function
|
|
2081
|
-
if (!
|
|
2108
|
+
async function vt(a) {
|
|
2109
|
+
if (!o.token)
|
|
2082
2110
|
throw new Error("Not authenticated");
|
|
2083
2111
|
return (await (await fetch(
|
|
2084
2112
|
`${h}/v1/admin/events/query/id=${a}`,
|
|
@@ -2086,12 +2114,12 @@ async function wt(a) {
|
|
|
2086
2114
|
method: "GET",
|
|
2087
2115
|
headers: {
|
|
2088
2116
|
"Content-Type": "application/json",
|
|
2089
|
-
Authorization: "Bearer " +
|
|
2117
|
+
Authorization: "Bearer " + o.token
|
|
2090
2118
|
}
|
|
2091
2119
|
}
|
|
2092
2120
|
)).json()).items;
|
|
2093
2121
|
}
|
|
2094
|
-
async function
|
|
2122
|
+
async function Tt(a) {
|
|
2095
2123
|
const t = await (await fetch(`${h}/v1/admin/files/query`, {
|
|
2096
2124
|
method: "POST",
|
|
2097
2125
|
body: JSON.stringify({
|
|
@@ -2099,37 +2127,37 @@ async function pt(a) {
|
|
|
2099
2127
|
}),
|
|
2100
2128
|
headers: {
|
|
2101
2129
|
"Content-Type": "application/json",
|
|
2102
|
-
Authorization: "Bearer " +
|
|
2130
|
+
Authorization: "Bearer " + o.token
|
|
2103
2131
|
}
|
|
2104
2132
|
})).json();
|
|
2105
2133
|
if (t.fileUrls.length === 0)
|
|
2106
2134
|
throw new Error("File not found");
|
|
2107
2135
|
return t.fileUrls[0];
|
|
2108
2136
|
}
|
|
2109
|
-
async function
|
|
2110
|
-
if (!
|
|
2137
|
+
async function Ct(a) {
|
|
2138
|
+
if (!o.token)
|
|
2111
2139
|
throw new Error("Not authenticated");
|
|
2112
2140
|
return await (await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
2113
2141
|
method: "GET",
|
|
2114
2142
|
headers: {
|
|
2115
2143
|
"Content-Type": "application/json",
|
|
2116
|
-
Authorization: "Bearer " +
|
|
2144
|
+
Authorization: "Bearer " + o.token
|
|
2117
2145
|
}
|
|
2118
2146
|
})).json();
|
|
2119
2147
|
}
|
|
2120
|
-
async function
|
|
2121
|
-
if (!
|
|
2148
|
+
async function St(a) {
|
|
2149
|
+
if (!o.token)
|
|
2122
2150
|
throw new Error("Not authenticated");
|
|
2123
2151
|
return (await (await fetch(`${h}/v1/admin/fleets/${a}/devices`, {
|
|
2124
2152
|
method: "GET",
|
|
2125
2153
|
headers: {
|
|
2126
2154
|
"Content-Type": "application/json",
|
|
2127
|
-
Authorization: "Bearer " +
|
|
2155
|
+
Authorization: "Bearer " + o.token
|
|
2128
2156
|
}
|
|
2129
2157
|
})).json()).items;
|
|
2130
2158
|
}
|
|
2131
|
-
async function
|
|
2132
|
-
if (!
|
|
2159
|
+
async function Et() {
|
|
2160
|
+
if (!o.token)
|
|
2133
2161
|
throw new Error("Not authenticated");
|
|
2134
2162
|
return (await (await fetch(
|
|
2135
2163
|
`${h}/v1/admin/intervention-requests`,
|
|
@@ -2137,12 +2165,12 @@ async function vt() {
|
|
|
2137
2165
|
method: "GET",
|
|
2138
2166
|
headers: {
|
|
2139
2167
|
"Content-Type": "application/json",
|
|
2140
|
-
Authorization: "Bearer " +
|
|
2168
|
+
Authorization: "Bearer " + o.token
|
|
2141
2169
|
}
|
|
2142
2170
|
}
|
|
2143
2171
|
)).json()).items;
|
|
2144
2172
|
}
|
|
2145
|
-
async function
|
|
2173
|
+
async function kt(...a) {
|
|
2146
2174
|
const e = a.flat().filter((i) => !!i);
|
|
2147
2175
|
return e.length === 0 ? [] : (await (await fetch(
|
|
2148
2176
|
`${h}/v1/queries/stream-current-value`,
|
|
@@ -2153,52 +2181,52 @@ async function Tt(...a) {
|
|
|
2153
2181
|
}),
|
|
2154
2182
|
headers: {
|
|
2155
2183
|
"Content-Type": "application/json",
|
|
2156
|
-
Authorization: "Bearer " +
|
|
2184
|
+
Authorization: "Bearer " + o.token
|
|
2157
2185
|
}
|
|
2158
2186
|
}
|
|
2159
2187
|
)).json()).items;
|
|
2160
2188
|
}
|
|
2161
|
-
async function
|
|
2162
|
-
if (!
|
|
2189
|
+
async function Ot() {
|
|
2190
|
+
if (!o.token)
|
|
2163
2191
|
throw new Error("Not authenticated");
|
|
2164
2192
|
const t = (await (await fetch(`${h}/v1/queries/online-devices`, {
|
|
2165
2193
|
method: "GET",
|
|
2166
2194
|
headers: {
|
|
2167
2195
|
"Content-Type": "application/json",
|
|
2168
|
-
Authorization: "Bearer " +
|
|
2196
|
+
Authorization: "Bearer " + o.token
|
|
2169
2197
|
}
|
|
2170
2198
|
})).json()).items;
|
|
2171
2199
|
return (await B()).filter((i) => t.includes(i.id));
|
|
2172
2200
|
}
|
|
2173
|
-
async function
|
|
2174
|
-
if (!
|
|
2201
|
+
async function Rt() {
|
|
2202
|
+
if (!o.token)
|
|
2175
2203
|
throw new Error("Not authenticated");
|
|
2176
2204
|
const t = (await (await fetch(`${h}/v1/signaling/peers`, {
|
|
2177
2205
|
method: "GET",
|
|
2178
2206
|
headers: {
|
|
2179
2207
|
"Content-Type": "application/json",
|
|
2180
|
-
Authorization: "Bearer " +
|
|
2208
|
+
Authorization: "Bearer " + o.token
|
|
2181
2209
|
}
|
|
2182
2210
|
})).json()).items.map(
|
|
2183
2211
|
(i) => i.deviceId
|
|
2184
2212
|
);
|
|
2185
2213
|
return (await B()).filter((i) => t.includes(i.id));
|
|
2186
2214
|
}
|
|
2187
|
-
async function
|
|
2188
|
-
if (!
|
|
2215
|
+
async function bt() {
|
|
2216
|
+
if (!o.token)
|
|
2189
2217
|
throw new Error("Not authenticated");
|
|
2190
2218
|
return (await (await fetch(`${h}/v1/admin/streams`, {
|
|
2191
2219
|
method: "GET",
|
|
2192
2220
|
headers: {
|
|
2193
2221
|
"Content-Type": "application/json",
|
|
2194
|
-
Authorization: "Bearer " +
|
|
2222
|
+
Authorization: "Bearer " + o.token
|
|
2195
2223
|
}
|
|
2196
2224
|
})).json()).items.filter(
|
|
2197
2225
|
(t) => t.enabled
|
|
2198
2226
|
);
|
|
2199
2227
|
}
|
|
2200
|
-
async function
|
|
2201
|
-
if (!
|
|
2228
|
+
async function Dt(a) {
|
|
2229
|
+
if (!o.token)
|
|
2202
2230
|
throw new Error("Not authenticated");
|
|
2203
2231
|
return await (await fetch(
|
|
2204
2232
|
`${h}/v1/queries/analytics/task-report-rows`,
|
|
@@ -2207,13 +2235,13 @@ async function kt(a) {
|
|
|
2207
2235
|
body: JSON.stringify(a),
|
|
2208
2236
|
headers: {
|
|
2209
2237
|
"Content-Type": "application/json",
|
|
2210
|
-
Authorization: "Bearer " +
|
|
2238
|
+
Authorization: "Bearer " + o.token
|
|
2211
2239
|
}
|
|
2212
2240
|
}
|
|
2213
2241
|
)).json();
|
|
2214
2242
|
}
|
|
2215
|
-
async function
|
|
2216
|
-
if (!
|
|
2243
|
+
async function At() {
|
|
2244
|
+
if (!o.token)
|
|
2217
2245
|
throw new Error("Not authenticated");
|
|
2218
2246
|
return (await (await fetch(
|
|
2219
2247
|
`${h}/v1/queries/analytics/task-reports`,
|
|
@@ -2221,36 +2249,36 @@ async function Rt() {
|
|
|
2221
2249
|
method: "GET",
|
|
2222
2250
|
headers: {
|
|
2223
2251
|
"Content-Type": "application/json",
|
|
2224
|
-
Authorization: "Bearer " +
|
|
2252
|
+
Authorization: "Bearer " + o.token
|
|
2225
2253
|
}
|
|
2226
2254
|
}
|
|
2227
2255
|
)).json()).items;
|
|
2228
2256
|
}
|
|
2229
|
-
async function
|
|
2230
|
-
if (!
|
|
2257
|
+
async function Pt() {
|
|
2258
|
+
if (!o.token)
|
|
2231
2259
|
throw new Error("Not authenticated");
|
|
2232
2260
|
return (await (await fetch(`${h}/v1/admin/fleets`, {
|
|
2233
2261
|
method: "GET",
|
|
2234
2262
|
headers: {
|
|
2235
2263
|
"Content-Type": "application/json",
|
|
2236
|
-
Authorization: "Bearer " +
|
|
2264
|
+
Authorization: "Bearer " + o.token
|
|
2237
2265
|
}
|
|
2238
2266
|
})).json()).items;
|
|
2239
2267
|
}
|
|
2240
|
-
async function
|
|
2241
|
-
if (!
|
|
2268
|
+
async function Nt(a, e) {
|
|
2269
|
+
if (!o.token)
|
|
2242
2270
|
throw new Error("Not authenticated");
|
|
2243
2271
|
return await (await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
2244
2272
|
method: "PATCH",
|
|
2245
2273
|
body: JSON.stringify(e),
|
|
2246
2274
|
headers: {
|
|
2247
2275
|
"Content-Type": "application/json",
|
|
2248
|
-
Authorization: "Bearer " +
|
|
2276
|
+
Authorization: "Bearer " + o.token
|
|
2249
2277
|
}
|
|
2250
2278
|
})).json();
|
|
2251
2279
|
}
|
|
2252
|
-
async function
|
|
2253
|
-
if (!
|
|
2280
|
+
async function jt(a) {
|
|
2281
|
+
if (!o.token)
|
|
2254
2282
|
throw new Error("Not authenticated");
|
|
2255
2283
|
return await (await fetch(
|
|
2256
2284
|
`${h}/v1/admin/streams/${a.id}`,
|
|
@@ -2259,32 +2287,32 @@ async function At(a) {
|
|
|
2259
2287
|
body: JSON.stringify(a),
|
|
2260
2288
|
headers: {
|
|
2261
2289
|
"Content-Type": "application/json",
|
|
2262
|
-
Authorization: "Bearer " +
|
|
2290
|
+
Authorization: "Bearer " + o.token
|
|
2263
2291
|
}
|
|
2264
2292
|
}
|
|
2265
2293
|
)).json();
|
|
2266
2294
|
}
|
|
2267
|
-
async function
|
|
2268
|
-
if (!
|
|
2295
|
+
async function It(a) {
|
|
2296
|
+
if (!o.token)
|
|
2269
2297
|
throw new Error("Not authenticated");
|
|
2270
2298
|
return await (await fetch(`${h}/v1/admin/views/${a.id}`, {
|
|
2271
2299
|
method: "PATCH",
|
|
2272
2300
|
body: JSON.stringify(a),
|
|
2273
2301
|
headers: {
|
|
2274
2302
|
"Content-Type": "application/json",
|
|
2275
|
-
Authorization: "Bearer " +
|
|
2303
|
+
Authorization: "Bearer " + o.token
|
|
2276
2304
|
}
|
|
2277
2305
|
})).json();
|
|
2278
2306
|
}
|
|
2279
|
-
async function
|
|
2280
|
-
if (!
|
|
2307
|
+
async function Lt(a) {
|
|
2308
|
+
if (!o.token)
|
|
2281
2309
|
throw new Error("Not authenticated");
|
|
2282
2310
|
return await (await fetch(`${h}/v1/queries/analytics`, {
|
|
2283
2311
|
method: "POST",
|
|
2284
2312
|
body: JSON.stringify(a),
|
|
2285
2313
|
headers: {
|
|
2286
2314
|
"Content-Type": "application/json",
|
|
2287
|
-
Authorization: "Bearer " +
|
|
2315
|
+
Authorization: "Bearer " + o.token
|
|
2288
2316
|
}
|
|
2289
2317
|
})).json();
|
|
2290
2318
|
}
|
|
@@ -2293,7 +2321,7 @@ const S = class {
|
|
|
2293
2321
|
S.defaultDeviceId = e;
|
|
2294
2322
|
}
|
|
2295
2323
|
static async getCurrentDevice() {
|
|
2296
|
-
if (!
|
|
2324
|
+
if (!o.token)
|
|
2297
2325
|
throw new Error("Not authenticated");
|
|
2298
2326
|
if (!S.defaultDeviceId)
|
|
2299
2327
|
throw new Error("No known default device");
|
|
@@ -2303,48 +2331,48 @@ const S = class {
|
|
|
2303
2331
|
method: "POST",
|
|
2304
2332
|
headers: {
|
|
2305
2333
|
"Content-Type": "application/json",
|
|
2306
|
-
Authorization: "Bearer " +
|
|
2334
|
+
Authorization: "Bearer " + o.token
|
|
2307
2335
|
}
|
|
2308
2336
|
}
|
|
2309
2337
|
)).json()).items.find(
|
|
2310
2338
|
(c) => c.id === S.defaultDeviceId
|
|
2311
|
-
), i = n.name,
|
|
2339
|
+
), i = n.name, r = new E(
|
|
2312
2340
|
S.defaultDeviceId,
|
|
2313
2341
|
i,
|
|
2314
|
-
f(
|
|
2342
|
+
f(o.currentOrganization),
|
|
2315
2343
|
n.tags
|
|
2316
2344
|
);
|
|
2317
|
-
return S.knownContext.push(new WeakRef(
|
|
2345
|
+
return S.knownContext.push(new WeakRef(r)), r;
|
|
2318
2346
|
}
|
|
2319
2347
|
static async getPeerDevice(e) {
|
|
2320
|
-
const t = new
|
|
2348
|
+
const t = new ht(e);
|
|
2321
2349
|
return t.id = await t.getDeviceId(), t;
|
|
2322
2350
|
}
|
|
2323
2351
|
static async getDevice(e) {
|
|
2324
|
-
const t = await
|
|
2352
|
+
const t = await gt(e);
|
|
2325
2353
|
return S.knownContext.push(new WeakRef(t)), t;
|
|
2326
2354
|
}
|
|
2327
2355
|
};
|
|
2328
2356
|
let l = S;
|
|
2329
|
-
s(l, "defaultDeviceId"), s(l, "knownContext", []), s(l, "listFleets",
|
|
2330
|
-
class
|
|
2357
|
+
s(l, "defaultDeviceId"), s(l, "knownContext", []), s(l, "listFleets", Pt), s(l, "getFleet", Ct), s(l, "patchFleet", Nt), s(l, "deleteFleet", mt), s(l, "addDeviceToFleet", lt), s(l, "getFleetDevices", St), s(l, "aggregateTelemetry", ut), s(l, "createShareLink", X), s(l, "eventsCounter", Z), s(l, "getAnalyticStreams", ft), s(l, "getAnalyticsModules", wt), s(l, "getAnalyticsRows", pt), s(l, "getAnnotationCount", M), s(l, "getAnnotationCountByIntervals", ee), s(l, "getCurrentGroup", yt), s(l, "getDevices", B), s(l, "getEvent", vt), s(l, "getFileUrl", Tt), s(l, "getInterventions", Et), s(l, "getLatestTelemetry", kt), s(l, "getOnlineDevices", Ot), s(l, "getPeers", ae), s(l, "getRealtimeDevices", Rt), s(l, "getRealtimeSessions", ne), s(l, "getStreams", bt), s(l, "getTaskReportRows", Dt), s(l, "getTaskReportTables", At), s(l, "getTelemetry", te), s(l, "getViews", Q), s(l, "patchStream", jt), s(l, "patchView", It), s(l, "queryAnalytics", Lt), s(l, "queryDevices", ie), s(l, "queryEvents", z), s(l, "queryTelemetry", _);
|
|
2358
|
+
class Ht {
|
|
2331
2359
|
static async set(e, t, n) {
|
|
2332
2360
|
try {
|
|
2333
2361
|
const i = await fetch(h + "/v1/admin/key-value", {
|
|
2334
2362
|
method: "POST",
|
|
2335
2363
|
body: JSON.stringify({
|
|
2336
|
-
organizationId: f(
|
|
2364
|
+
organizationId: f(o.currentUser).organizationId,
|
|
2337
2365
|
key: e,
|
|
2338
2366
|
value: t,
|
|
2339
2367
|
tags: n
|
|
2340
2368
|
}),
|
|
2341
2369
|
headers: {
|
|
2342
2370
|
"Content-Type": "application/json",
|
|
2343
|
-
Authorization: "Bearer " +
|
|
2371
|
+
Authorization: "Bearer " + o.token
|
|
2344
2372
|
}
|
|
2345
|
-
}),
|
|
2373
|
+
}), r = await i.json();
|
|
2346
2374
|
if (i.status !== 200)
|
|
2347
|
-
throw new Error(
|
|
2375
|
+
throw new Error(r.message);
|
|
2348
2376
|
} catch (i) {
|
|
2349
2377
|
throw i;
|
|
2350
2378
|
}
|
|
@@ -2357,7 +2385,7 @@ class Vt {
|
|
|
2357
2385
|
method: "GET",
|
|
2358
2386
|
headers: {
|
|
2359
2387
|
"Content-Type": "application/json",
|
|
2360
|
-
Authorization: "Bearer " +
|
|
2388
|
+
Authorization: "Bearer " + o.token
|
|
2361
2389
|
}
|
|
2362
2390
|
}
|
|
2363
2391
|
), n = await t.json();
|
|
@@ -2374,7 +2402,7 @@ class Vt {
|
|
|
2374
2402
|
method: "GET",
|
|
2375
2403
|
headers: {
|
|
2376
2404
|
"Content-Type": "application/json",
|
|
2377
|
-
Authorization: "Bearer " +
|
|
2405
|
+
Authorization: "Bearer " + o.token
|
|
2378
2406
|
}
|
|
2379
2407
|
}), t = await e.json();
|
|
2380
2408
|
if (e.status !== 200)
|
|
@@ -2392,7 +2420,7 @@ class Vt {
|
|
|
2392
2420
|
method: "DELETE",
|
|
2393
2421
|
headers: {
|
|
2394
2422
|
"Content-Type": "application/json",
|
|
2395
|
-
Authorization: "Bearer " +
|
|
2423
|
+
Authorization: "Bearer " + o.token
|
|
2396
2424
|
}
|
|
2397
2425
|
}
|
|
2398
2426
|
)).ok)
|
|
@@ -2403,15 +2431,15 @@ class Vt {
|
|
|
2403
2431
|
}
|
|
2404
2432
|
}
|
|
2405
2433
|
}
|
|
2406
|
-
function
|
|
2434
|
+
function _t(a) {
|
|
2407
2435
|
return Uint8Array.from(atob(a), (e) => e.charCodeAt(0));
|
|
2408
2436
|
}
|
|
2409
2437
|
function U() {
|
|
2410
2438
|
const { userAgent: a } = navigator;
|
|
2411
2439
|
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";
|
|
2412
2440
|
}
|
|
2413
|
-
const
|
|
2414
|
-
class
|
|
2441
|
+
const $t = "audio-chunk";
|
|
2442
|
+
class Kt {
|
|
2415
2443
|
constructor(e, t) {
|
|
2416
2444
|
s(this, "muted", !1);
|
|
2417
2445
|
s(this, "hasReceivedData", !1);
|
|
@@ -2428,12 +2456,12 @@ class Ft {
|
|
|
2428
2456
|
return;
|
|
2429
2457
|
this.hasReceivedData || (this.hasReceivedData = !0);
|
|
2430
2458
|
const { audioContext: n, muted: i } = this;
|
|
2431
|
-
if (!n || e.header.stream.streamType !==
|
|
2459
|
+
if (!n || e.header.stream.streamType !== $t || i !== !1)
|
|
2432
2460
|
return;
|
|
2433
|
-
const
|
|
2461
|
+
const r = _t(t);
|
|
2434
2462
|
try {
|
|
2435
2463
|
await n.decodeAudioData(
|
|
2436
|
-
|
|
2464
|
+
r.buffer,
|
|
2437
2465
|
this.scheduleChunk
|
|
2438
2466
|
);
|
|
2439
2467
|
} catch (d) {
|
|
@@ -2453,8 +2481,8 @@ class Ft {
|
|
|
2453
2481
|
const n = this.createChunk(e);
|
|
2454
2482
|
n && n.buffer && (this.isPlaying === !1 && (this.startTime = t.currentTime, this.lastChunkOffset = 0, this.isPlaying = !0), n.start(this.startTime + this.lastChunkOffset, 0, e.duration), this.lastChunkOffset += n.buffer.duration, this.chunks.push(n));
|
|
2455
2483
|
});
|
|
2456
|
-
this.device = e, this.stream = t, this.device.startListeningToRealtimeDataStream(t), this.device.addRealtimeListener((i,
|
|
2457
|
-
this.receive(
|
|
2484
|
+
this.device = e, this.stream = t, this.device.startListeningToRealtimeDataStream(t), this.device.addRealtimeListener((i, r) => {
|
|
2485
|
+
this.receive(r);
|
|
2458
2486
|
}), U() === "Safari" || U() === "IE" ? this.changeAudioWireFormat("wav") : this.changeAudioWireFormat("opus");
|
|
2459
2487
|
const n = window.AudioContext || window.webkitAudioContext;
|
|
2460
2488
|
this.audioContext = new n();
|
|
@@ -2483,66 +2511,66 @@ class Ft {
|
|
|
2483
2511
|
(async () => await this.device.changeStreamAudioType(t.name, e))();
|
|
2484
2512
|
}
|
|
2485
2513
|
}
|
|
2486
|
-
class
|
|
2514
|
+
class Qt {
|
|
2487
2515
|
static async listAccounts() {
|
|
2488
|
-
if (!
|
|
2516
|
+
if (!o.token)
|
|
2489
2517
|
throw new Error("Not authenticated");
|
|
2490
2518
|
return (await (await fetch(`${h}/v1/admin/accounts`, {
|
|
2491
2519
|
method: "GET",
|
|
2492
2520
|
headers: {
|
|
2493
2521
|
"Content-Type": "application/json",
|
|
2494
|
-
Authorization: "Bearer " +
|
|
2522
|
+
Authorization: "Bearer " + o.token
|
|
2495
2523
|
}
|
|
2496
2524
|
})).json()).items;
|
|
2497
2525
|
}
|
|
2498
2526
|
static async createAccounts(e) {
|
|
2499
|
-
if (!
|
|
2527
|
+
if (!o.token)
|
|
2500
2528
|
throw new Error("Not authenticated");
|
|
2501
2529
|
return await (await fetch(`${h}/v1/admin/accounts`, {
|
|
2502
2530
|
method: "POST",
|
|
2503
2531
|
body: JSON.stringify(e),
|
|
2504
2532
|
headers: {
|
|
2505
2533
|
"Content-Type": "application/json",
|
|
2506
|
-
Authorization: "Bearer " +
|
|
2534
|
+
Authorization: "Bearer " + o.token
|
|
2507
2535
|
}
|
|
2508
2536
|
})).json();
|
|
2509
2537
|
}
|
|
2510
2538
|
static async getAccount(e) {
|
|
2511
|
-
if (!
|
|
2539
|
+
if (!o.token)
|
|
2512
2540
|
throw new Error("Not authenticated");
|
|
2513
2541
|
return await (await fetch(`${h}/v1/admin/accounts/${e}`, {
|
|
2514
2542
|
method: "GET",
|
|
2515
2543
|
headers: {
|
|
2516
2544
|
"Content-Type": "application/json",
|
|
2517
|
-
Authorization: "Bearer " +
|
|
2545
|
+
Authorization: "Bearer " + o.token
|
|
2518
2546
|
}
|
|
2519
2547
|
})).json();
|
|
2520
2548
|
}
|
|
2521
2549
|
static async patchAccount(e, t) {
|
|
2522
|
-
if (!
|
|
2550
|
+
if (!o.token)
|
|
2523
2551
|
throw new Error("Not authenticated");
|
|
2524
2552
|
return await (await fetch(`${h}/v1/admin/accounts/${e}`, {
|
|
2525
2553
|
method: "PATCH",
|
|
2526
2554
|
body: JSON.stringify(t),
|
|
2527
2555
|
headers: {
|
|
2528
2556
|
"Content-Type": "application/json",
|
|
2529
|
-
Authorization: "Bearer " +
|
|
2557
|
+
Authorization: "Bearer " + o.token
|
|
2530
2558
|
}
|
|
2531
2559
|
})).json();
|
|
2532
2560
|
}
|
|
2533
2561
|
static async deleteAccount(e) {
|
|
2534
|
-
if (!
|
|
2562
|
+
if (!o.token)
|
|
2535
2563
|
throw new Error("Not authenticated");
|
|
2536
2564
|
await fetch(`${h}/v1/admin/accounts/${e}`, {
|
|
2537
2565
|
method: "DELETE",
|
|
2538
2566
|
headers: {
|
|
2539
2567
|
"Content-Type": "application/json",
|
|
2540
|
-
Authorization: "Bearer " +
|
|
2568
|
+
Authorization: "Bearer " + o.token
|
|
2541
2569
|
}
|
|
2542
2570
|
});
|
|
2543
2571
|
}
|
|
2544
2572
|
static async getAccountTree(e) {
|
|
2545
|
-
if (!
|
|
2573
|
+
if (!o.token)
|
|
2546
2574
|
throw new Error("Not authenticated");
|
|
2547
2575
|
return await (await fetch(
|
|
2548
2576
|
`${h}/v1/admin/accounts/${e}/tree`,
|
|
@@ -2550,139 +2578,139 @@ class Wt {
|
|
|
2550
2578
|
method: "GET",
|
|
2551
2579
|
headers: {
|
|
2552
2580
|
"Content-Type": "application/json",
|
|
2553
|
-
Authorization: "Bearer " +
|
|
2581
|
+
Authorization: "Bearer " + o.token
|
|
2554
2582
|
}
|
|
2555
2583
|
}
|
|
2556
2584
|
)).json();
|
|
2557
2585
|
}
|
|
2558
2586
|
}
|
|
2559
|
-
class
|
|
2587
|
+
class Xt {
|
|
2560
2588
|
static async listRoles() {
|
|
2561
|
-
if (!
|
|
2589
|
+
if (!o.token)
|
|
2562
2590
|
throw new Error("Not authenticated");
|
|
2563
2591
|
return (await (await fetch(`${h}/v1/admin/roles`, {
|
|
2564
2592
|
method: "GET",
|
|
2565
2593
|
headers: {
|
|
2566
2594
|
"Content-Type": "application/json",
|
|
2567
|
-
Authorization: "Bearer " +
|
|
2595
|
+
Authorization: "Bearer " + o.token
|
|
2568
2596
|
}
|
|
2569
2597
|
})).json()).items;
|
|
2570
2598
|
}
|
|
2571
2599
|
static async createRole(e) {
|
|
2572
|
-
if (!
|
|
2600
|
+
if (!o.token)
|
|
2573
2601
|
throw new Error("Not authenticated");
|
|
2574
2602
|
return await (await fetch(`${h}/v1/admin/roles`, {
|
|
2575
2603
|
method: "POST",
|
|
2576
2604
|
body: JSON.stringify(e),
|
|
2577
2605
|
headers: {
|
|
2578
2606
|
"Content-Type": "application/json",
|
|
2579
|
-
Authorization: "Bearer " +
|
|
2607
|
+
Authorization: "Bearer " + o.token
|
|
2580
2608
|
}
|
|
2581
2609
|
})).json();
|
|
2582
2610
|
}
|
|
2583
2611
|
static async getRole(e) {
|
|
2584
|
-
if (!
|
|
2612
|
+
if (!o.token)
|
|
2585
2613
|
throw new Error("Not authenticated");
|
|
2586
2614
|
return await (await fetch(`${h}/v1/admin/roles/${e}`, {
|
|
2587
2615
|
method: "GET",
|
|
2588
2616
|
headers: {
|
|
2589
2617
|
"Content-Type": "application/json",
|
|
2590
|
-
Authorization: "Bearer " +
|
|
2618
|
+
Authorization: "Bearer " + o.token
|
|
2591
2619
|
}
|
|
2592
2620
|
})).json();
|
|
2593
2621
|
}
|
|
2594
2622
|
static async patchRole(e, t) {
|
|
2595
|
-
if (!
|
|
2623
|
+
if (!o.token)
|
|
2596
2624
|
throw new Error("Not authenticated");
|
|
2597
2625
|
return await (await fetch(`${h}/v1/admin/roles/${e}`, {
|
|
2598
2626
|
method: "PATCH",
|
|
2599
2627
|
body: JSON.stringify(t),
|
|
2600
2628
|
headers: {
|
|
2601
2629
|
"Content-Type": "application/json",
|
|
2602
|
-
Authorization: "Bearer " +
|
|
2630
|
+
Authorization: "Bearer " + o.token
|
|
2603
2631
|
}
|
|
2604
2632
|
})).json();
|
|
2605
2633
|
}
|
|
2606
2634
|
static async deleteRole(e) {
|
|
2607
|
-
if (!
|
|
2635
|
+
if (!o.token)
|
|
2608
2636
|
throw new Error("Not authenticated");
|
|
2609
2637
|
await fetch(`${h}/v1/admin/roles/${e}`, {
|
|
2610
2638
|
method: "DELETE",
|
|
2611
2639
|
headers: {
|
|
2612
2640
|
"Content-Type": "application/json",
|
|
2613
|
-
Authorization: "Bearer " +
|
|
2641
|
+
Authorization: "Bearer " + o.token
|
|
2614
2642
|
}
|
|
2615
2643
|
});
|
|
2616
2644
|
}
|
|
2617
2645
|
}
|
|
2618
|
-
class
|
|
2646
|
+
class Yt {
|
|
2619
2647
|
static async listUsers() {
|
|
2620
|
-
if (!
|
|
2648
|
+
if (!o.token)
|
|
2621
2649
|
throw new Error("Not authenticated");
|
|
2622
2650
|
return (await (await fetch(`${h}/v1/admin/users`, {
|
|
2623
2651
|
method: "GET",
|
|
2624
2652
|
headers: {
|
|
2625
2653
|
"Content-Type": "application/json",
|
|
2626
|
-
Authorization: "Bearer " +
|
|
2654
|
+
Authorization: "Bearer " + o.token
|
|
2627
2655
|
}
|
|
2628
2656
|
})).json()).items;
|
|
2629
2657
|
}
|
|
2630
2658
|
static async createUser(e) {
|
|
2631
|
-
if (!
|
|
2659
|
+
if (!o.token)
|
|
2632
2660
|
throw new Error("Not authenticated");
|
|
2633
2661
|
return await (await fetch(`${h}/v1/admin/users`, {
|
|
2634
2662
|
method: "POST",
|
|
2635
2663
|
body: JSON.stringify(e),
|
|
2636
2664
|
headers: {
|
|
2637
2665
|
"Content-Type": "application/json",
|
|
2638
|
-
Authorization: "Bearer " +
|
|
2666
|
+
Authorization: "Bearer " + o.token
|
|
2639
2667
|
}
|
|
2640
2668
|
})).json();
|
|
2641
2669
|
}
|
|
2642
2670
|
static async getUser(e) {
|
|
2643
|
-
if (!
|
|
2671
|
+
if (!o.token)
|
|
2644
2672
|
throw new Error("Not authenticated");
|
|
2645
2673
|
return await (await fetch(`${h}/v1/admin/users/${e}`, {
|
|
2646
2674
|
method: "GET",
|
|
2647
2675
|
headers: {
|
|
2648
2676
|
"Content-Type": "application/json",
|
|
2649
|
-
Authorization: "Bearer " +
|
|
2677
|
+
Authorization: "Bearer " + o.token
|
|
2650
2678
|
}
|
|
2651
2679
|
})).json();
|
|
2652
2680
|
}
|
|
2653
2681
|
static async patchUser(e, t) {
|
|
2654
|
-
if (!
|
|
2682
|
+
if (!o.token)
|
|
2655
2683
|
throw new Error("Not authenticated");
|
|
2656
2684
|
return await (await fetch(`${h}/v1/admin/users/${e}`, {
|
|
2657
2685
|
method: "PATCH",
|
|
2658
2686
|
body: JSON.stringify(t),
|
|
2659
2687
|
headers: {
|
|
2660
2688
|
"Content-Type": "application/json",
|
|
2661
|
-
Authorization: "Bearer " +
|
|
2689
|
+
Authorization: "Bearer " + o.token
|
|
2662
2690
|
}
|
|
2663
2691
|
})).json();
|
|
2664
2692
|
}
|
|
2665
2693
|
static async deleteUser(e) {
|
|
2666
|
-
if (!
|
|
2694
|
+
if (!o.token)
|
|
2667
2695
|
throw new Error("Not authenticated");
|
|
2668
2696
|
await fetch(`${h}/v1/admin/users/${e}`, {
|
|
2669
2697
|
method: "PATCH",
|
|
2670
2698
|
body: JSON.stringify({ enabled: !1, roleId: null, teamId: null }),
|
|
2671
2699
|
headers: {
|
|
2672
2700
|
"Content-Type": "application/json",
|
|
2673
|
-
Authorization: "Bearer " +
|
|
2701
|
+
Authorization: "Bearer " + o.token
|
|
2674
2702
|
}
|
|
2675
2703
|
});
|
|
2676
2704
|
}
|
|
2677
2705
|
}
|
|
2678
|
-
const
|
|
2706
|
+
const Zt = ["viewer", "operator", "administrator"], en = "viewer", tn = "operator", nn = "administrator", an = [
|
|
2679
2707
|
"year",
|
|
2680
2708
|
"month",
|
|
2681
2709
|
"week",
|
|
2682
2710
|
"day",
|
|
2683
2711
|
"hour",
|
|
2684
2712
|
"minute"
|
|
2685
|
-
],
|
|
2713
|
+
], on = ["tag", "sheet", "user"], rn = [
|
|
2686
2714
|
"triggered-event",
|
|
2687
2715
|
"intervention-request",
|
|
2688
2716
|
"teleop-session-record",
|
|
@@ -2694,44 +2722,44 @@ const Kt = ["viewer", "operator", "administrator"], Qt = "viewer", Xt = "operato
|
|
|
2694
2722
|
"comment",
|
|
2695
2723
|
"system",
|
|
2696
2724
|
"annotation"
|
|
2697
|
-
],
|
|
2725
|
+
], sn = [
|
|
2698
2726
|
"unknown",
|
|
2699
2727
|
"operational",
|
|
2700
2728
|
"offline",
|
|
2701
2729
|
"error"
|
|
2702
|
-
],
|
|
2730
|
+
], cn = ["selection", "labeling", "teleop"], dn = ["info", "warning", "error", "critical"], hn = ["video/mp4"];
|
|
2703
2731
|
try {
|
|
2704
2732
|
const a = typeof window < "u" && window.location ? new URLSearchParams(window.location.search) : new URLSearchParams(""), e = a.get("device");
|
|
2705
2733
|
e && l.setDefaultDevice(e);
|
|
2706
2734
|
const t = a.get("auth");
|
|
2707
|
-
t &&
|
|
2735
|
+
t && o.loginWithToken(t), a.get("module") && o.listenForRefresh(), typeof window < "u" && y.listenForConnectionEvents();
|
|
2708
2736
|
} catch {
|
|
2709
2737
|
}
|
|
2710
2738
|
export {
|
|
2711
|
-
|
|
2739
|
+
Qt as Account,
|
|
2712
2740
|
y as App,
|
|
2713
|
-
|
|
2714
|
-
|
|
2741
|
+
Kt as AudioPlayer,
|
|
2742
|
+
o as Authentication,
|
|
2715
2743
|
He as BinaryRequestDataChannel,
|
|
2716
2744
|
Ve as CaptureStream,
|
|
2717
2745
|
We as DataChannel,
|
|
2718
|
-
|
|
2746
|
+
E as Device,
|
|
2719
2747
|
l as Fleet,
|
|
2720
|
-
|
|
2748
|
+
Ht as KeyValue,
|
|
2721
2749
|
Ge as Manipulator,
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2750
|
+
ht as PeerDevice,
|
|
2751
|
+
Xt as Role,
|
|
2752
|
+
Vt as SessionType,
|
|
2725
2753
|
Ke as TextRequestDataChannel,
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2754
|
+
Yt as User,
|
|
2755
|
+
Zt as accessLevels,
|
|
2756
|
+
nn as administrator,
|
|
2729
2757
|
Y as aggregateByDateFunctions,
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2758
|
+
Gt as aggregateFunctionMap,
|
|
2759
|
+
Wt as aggregateFunctions,
|
|
2760
|
+
an as aggregateLevels,
|
|
2761
|
+
on as annotationTypes,
|
|
2762
|
+
rn as eventTypes,
|
|
2735
2763
|
ot as formatTimeFrameText,
|
|
2736
2764
|
nt as getAverage,
|
|
2737
2765
|
it as getCount,
|
|
@@ -2740,12 +2768,12 @@ export {
|
|
|
2740
2768
|
Ze as getStandardDeviation,
|
|
2741
2769
|
at as getSum,
|
|
2742
2770
|
Ye as getVariance,
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2771
|
+
sn as healthStatuses,
|
|
2772
|
+
cn as interventionTypes,
|
|
2773
|
+
tn as operator,
|
|
2774
|
+
dn as severities,
|
|
2775
|
+
Ft as vailableAggregationIntervals,
|
|
2776
|
+
hn as videoMimeTypes,
|
|
2777
|
+
en as viewer
|
|
2750
2778
|
};
|
|
2751
2779
|
//# sourceMappingURL=data-sdk.es.js.map
|