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