@formant/data-sdk 1.12.0 → 1.13.1
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 +576 -544
- package/dist/data-sdk.es.js.map +1 -1
- package/dist/data-sdk.es6.js +44 -12
- package/dist/data-sdk.umd.js +1 -1
- package/dist/types/data-sdk/src/model/IChallenge.d.ts +6 -0
- package/dist/types/data-sdk/src/stores/AuthenticationErrors.d.ts +9 -0
- package/dist/types/data-sdk/src/stores/AuthenticationResult.d.ts +15 -0
- package/dist/types/data-sdk/src/stores/AuthenticationStore.d.ts +5 -1
- package/dist/types/data-sdk/src/stores/IAuthenticationStore.d.ts +1 -1
- package/package.json +1 -1
package/dist/data-sdk.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { decode as
|
|
5
|
-
import * as
|
|
6
|
-
import { startOfMinute as
|
|
1
|
+
var ce = Object.defineProperty;
|
|
2
|
+
var de = (a, e, t) => e in a ? ce(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var s = (a, e, t) => (de(a, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { decode as G } from "base-64";
|
|
5
|
+
import * as u from "date-fns";
|
|
6
|
+
import { startOfMinute as he, addMinutes as le, roundToNearestMinutes as ue, addSeconds as me } from "date-fns";
|
|
7
7
|
import { RtcClient as A, SignalingPromiseClient as j } from "@formant/realtime-sdk";
|
|
8
|
-
import { EventEmitter as
|
|
9
|
-
import { deflate as
|
|
10
|
-
import { fromByteArray as
|
|
11
|
-
const
|
|
12
|
-
function
|
|
8
|
+
import { EventEmitter as fe } from "eventemitter3";
|
|
9
|
+
import { deflate as we } from "pako";
|
|
10
|
+
import { fromByteArray as pe } from "base64-js";
|
|
11
|
+
const ye = "https://api.formant.io";
|
|
12
|
+
function ge(a, e) {
|
|
13
13
|
try {
|
|
14
14
|
if (e.get("formant_stage"))
|
|
15
15
|
return "https://api-stage.formant.io";
|
|
@@ -30,31 +30,45 @@ function pe(a, e) {
|
|
|
30
30
|
}
|
|
31
31
|
} catch {
|
|
32
32
|
}
|
|
33
|
-
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 : ye;
|
|
34
34
|
}
|
|
35
|
-
const h =
|
|
35
|
+
const h = ge(
|
|
36
36
|
typeof window < "u" ? window : globalThis,
|
|
37
37
|
new URLSearchParams(
|
|
38
38
|
typeof window < "u" && window.location ? window.location.search : void 0
|
|
39
39
|
)
|
|
40
40
|
);
|
|
41
|
-
class
|
|
41
|
+
class x extends Error {
|
|
42
|
+
constructor(t) {
|
|
43
|
+
super("login failed");
|
|
44
|
+
s(this, "reason");
|
|
45
|
+
this.reason = t, this.name = "LoginFailureError", Object.setPrototypeOf(this, new.target.prototype);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
class U extends Error {
|
|
49
|
+
constructor(t) {
|
|
50
|
+
super("login challenged");
|
|
51
|
+
s(this, "challenge");
|
|
52
|
+
this.challenge = t, this.name = "LoginChallengedError", Object.setPrototypeOf(this, new.target.prototype);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
class ve {
|
|
42
56
|
constructor({
|
|
43
57
|
apiUrl: e,
|
|
44
58
|
refreshAuthToken: t,
|
|
45
59
|
addAccessTokenRefreshListener: n
|
|
46
60
|
}) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
s(this, "_refreshToken");
|
|
62
|
+
s(this, "_isShareToken", !1);
|
|
63
|
+
s(this, "_currentOrganization");
|
|
64
|
+
s(this, "_currentUser");
|
|
65
|
+
s(this, "_defaultDeviceId");
|
|
66
|
+
s(this, "_token");
|
|
67
|
+
s(this, "_waitingForAuth", /* @__PURE__ */ new Set());
|
|
68
|
+
s(this, "_refreshTimer");
|
|
69
|
+
s(this, "_apiUrl");
|
|
70
|
+
s(this, "_refreshAuthToken");
|
|
71
|
+
s(this, "_addAccessTokenRefreshListener");
|
|
58
72
|
this._apiUrl = e, this._refreshAuthToken = t, this._addAccessTokenRefreshListener = n;
|
|
59
73
|
}
|
|
60
74
|
get token() {
|
|
@@ -81,32 +95,47 @@ class ye {
|
|
|
81
95
|
get isShareToken() {
|
|
82
96
|
return this._isShareToken;
|
|
83
97
|
}
|
|
84
|
-
async login(e, t) {
|
|
98
|
+
async login(e, t, n = {}) {
|
|
99
|
+
const { advanced: i = !1 } = n;
|
|
85
100
|
try {
|
|
86
|
-
const
|
|
101
|
+
const o = await fetch(`${this._apiUrl}/v1/admin/auth/login`, {
|
|
87
102
|
method: "POST",
|
|
88
103
|
body: JSON.stringify({ email: e, password: t }),
|
|
89
104
|
headers: {
|
|
90
105
|
"Content-Type": "application/json"
|
|
91
106
|
}
|
|
92
|
-
}),
|
|
93
|
-
if (
|
|
94
|
-
throw new
|
|
107
|
+
}), c = await o.json();
|
|
108
|
+
if (o.status !== 200)
|
|
109
|
+
throw new x(c.message);
|
|
110
|
+
if ("challenge" in c)
|
|
111
|
+
throw new U(c.challenge);
|
|
112
|
+
const { authentication: d } = c;
|
|
95
113
|
return await this.loginWithToken(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
), i
|
|
99
|
-
|
|
100
|
-
|
|
114
|
+
d.accessToken,
|
|
115
|
+
d.refreshToken
|
|
116
|
+
), i ? {
|
|
117
|
+
result: "success",
|
|
118
|
+
authentication: d
|
|
119
|
+
} : d;
|
|
120
|
+
} catch (o) {
|
|
121
|
+
if (i || console.error("login() failed", { err: o }), this._waitingForAuth.forEach((c) => c(!1)), this._waitingForAuth.clear(), !i)
|
|
122
|
+
throw o;
|
|
123
|
+
return o instanceof U ? {
|
|
124
|
+
result: "challenged",
|
|
125
|
+
challenge: o.challenge
|
|
126
|
+
} : {
|
|
127
|
+
result: "failure",
|
|
128
|
+
reason: o instanceof x ? o.reason : o instanceof Error ? o.message : String(o)
|
|
129
|
+
};
|
|
101
130
|
}
|
|
102
131
|
}
|
|
103
132
|
async loginWithToken(e, t) {
|
|
104
133
|
var i;
|
|
105
|
-
const n = JSON.parse(
|
|
134
|
+
const n = JSON.parse(G(e.split(".")[1]));
|
|
106
135
|
try {
|
|
107
|
-
let
|
|
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 || (
|
|
109
|
-
const c = await fetch(`${this._apiUrl}/v1/admin/users/${
|
|
136
|
+
let o;
|
|
137
|
+
if (this._isShareToken = n["formant:claims"] && n["formant:claims"].type == "share", n["formant:claims"] && (this._currentOrganization = n["formant:claims"].organizationId), n["custom:organization_id"] && (this._currentOrganization = n["custom:organization_id"]), this._isShareToken || (o = n.sub), n["formant:claims"] && n["formant:claims"].userId && (o = n["formant:claims"].userId), o && ((i = this._currentUser) == null ? void 0 : i.id) !== o) {
|
|
138
|
+
const c = await fetch(`${this._apiUrl}/v1/admin/users/${o}`, {
|
|
110
139
|
method: "GET",
|
|
111
140
|
headers: {
|
|
112
141
|
"Content-Type": "application/json",
|
|
@@ -118,8 +147,8 @@ class ye {
|
|
|
118
147
|
this._currentUser = d;
|
|
119
148
|
}
|
|
120
149
|
this._token = e, this._waitingForAuth.forEach((c) => c(!0));
|
|
121
|
-
} catch (
|
|
122
|
-
console.error("loginWithToken() failed", { err:
|
|
150
|
+
} catch (o) {
|
|
151
|
+
console.error("loginWithToken() failed", { err: o }), this._waitingForAuth.forEach((c) => c(!1));
|
|
123
152
|
} finally {
|
|
124
153
|
this._waitingForAuth.clear();
|
|
125
154
|
}
|
|
@@ -191,7 +220,7 @@ class ye {
|
|
|
191
220
|
)).ok;
|
|
192
221
|
}
|
|
193
222
|
async respondToNewPasswordRequiredChallenge(e) {
|
|
194
|
-
|
|
223
|
+
const t = await fetch(
|
|
195
224
|
`${this._apiUrl}/v1/admin/auth/respond-to-new-password-required-challenge`,
|
|
196
225
|
{
|
|
197
226
|
method: "POST",
|
|
@@ -200,7 +229,10 @@ class ye {
|
|
|
200
229
|
"Content-Type": "application/json"
|
|
201
230
|
}
|
|
202
231
|
}
|
|
203
|
-
)
|
|
232
|
+
);
|
|
233
|
+
if (t.ok)
|
|
234
|
+
return await t.json();
|
|
235
|
+
throw new Error("respond-to-new-password-required-challenge failed");
|
|
204
236
|
}
|
|
205
237
|
async loginWithGoogle(e) {
|
|
206
238
|
return await (await fetch(`${this._apiUrl}/v1/admin/auth/login-google`, {
|
|
@@ -232,7 +264,7 @@ function T(a) {
|
|
|
232
264
|
throw new Error("cannot send message to non-existent parent");
|
|
233
265
|
window.parent.postMessage(a, "*");
|
|
234
266
|
}
|
|
235
|
-
function
|
|
267
|
+
function H() {
|
|
236
268
|
const a = k();
|
|
237
269
|
if (!a)
|
|
238
270
|
throw new Error("No module context");
|
|
@@ -241,7 +273,7 @@ function V() {
|
|
|
241
273
|
module: a
|
|
242
274
|
});
|
|
243
275
|
}
|
|
244
|
-
function
|
|
276
|
+
function F(a) {
|
|
245
277
|
function e(t) {
|
|
246
278
|
const n = t.data;
|
|
247
279
|
n.type === "auth_token" && a(n.token);
|
|
@@ -250,40 +282,40 @@ function G(a) {
|
|
|
250
282
|
window.removeEventListener("message", e);
|
|
251
283
|
};
|
|
252
284
|
}
|
|
253
|
-
const
|
|
285
|
+
const r = new ve({
|
|
254
286
|
apiUrl: h,
|
|
255
|
-
refreshAuthToken:
|
|
256
|
-
addAccessTokenRefreshListener:
|
|
287
|
+
refreshAuthToken: H,
|
|
288
|
+
addAccessTokenRefreshListener: F
|
|
257
289
|
});
|
|
258
|
-
async function
|
|
290
|
+
async function Te(a) {
|
|
259
291
|
return (await (await fetch(
|
|
260
292
|
`${h}/v1/admin/module-configurations/${a}`,
|
|
261
293
|
{
|
|
262
294
|
headers: {
|
|
263
295
|
"Content-Type": "application/json",
|
|
264
|
-
Authorization: "Bearer " +
|
|
296
|
+
Authorization: "Bearer " + r.token
|
|
265
297
|
}
|
|
266
298
|
}
|
|
267
299
|
)).json()).configuration;
|
|
268
300
|
}
|
|
269
|
-
function
|
|
301
|
+
function Ce() {
|
|
270
302
|
T({
|
|
271
303
|
type: "hide_analytics_date_picker"
|
|
272
304
|
});
|
|
273
305
|
}
|
|
274
|
-
function
|
|
306
|
+
function Se(a) {
|
|
275
307
|
T({
|
|
276
308
|
type: "go_to_device",
|
|
277
309
|
deviceId: a
|
|
278
310
|
});
|
|
279
311
|
}
|
|
280
|
-
function
|
|
312
|
+
function Ee(a) {
|
|
281
313
|
T({
|
|
282
314
|
type: "go_to_time",
|
|
283
315
|
time: a.getTime()
|
|
284
316
|
});
|
|
285
317
|
}
|
|
286
|
-
function
|
|
318
|
+
function ke() {
|
|
287
319
|
const a = k();
|
|
288
320
|
if (!a)
|
|
289
321
|
throw new Error("No module context");
|
|
@@ -292,7 +324,7 @@ function Se() {
|
|
|
292
324
|
module: a
|
|
293
325
|
});
|
|
294
326
|
}
|
|
295
|
-
function
|
|
327
|
+
function Oe(a, e) {
|
|
296
328
|
const t = k();
|
|
297
329
|
if (!t)
|
|
298
330
|
throw new Error("No module context");
|
|
@@ -303,7 +335,7 @@ function Ee(a, e) {
|
|
|
303
335
|
data: e
|
|
304
336
|
});
|
|
305
337
|
}
|
|
306
|
-
function
|
|
338
|
+
function Re(a, e) {
|
|
307
339
|
const t = k();
|
|
308
340
|
if (!t)
|
|
309
341
|
throw new Error("No module context");
|
|
@@ -314,7 +346,7 @@ function ke(a, e) {
|
|
|
314
346
|
after: e || 0
|
|
315
347
|
});
|
|
316
348
|
}
|
|
317
|
-
function
|
|
349
|
+
function Ae(a) {
|
|
318
350
|
const e = k();
|
|
319
351
|
if (!e)
|
|
320
352
|
throw new Error("No module context");
|
|
@@ -324,10 +356,10 @@ function Oe(a) {
|
|
|
324
356
|
menus: a
|
|
325
357
|
});
|
|
326
358
|
}
|
|
327
|
-
function
|
|
359
|
+
function be(a) {
|
|
328
360
|
T({ type: "show_message", message: a });
|
|
329
361
|
}
|
|
330
|
-
function
|
|
362
|
+
function De(a, e) {
|
|
331
363
|
const t = (n) => {
|
|
332
364
|
const i = n.data;
|
|
333
365
|
i.type === "channel_data" && i.channel === a && e({
|
|
@@ -337,21 +369,21 @@ function Ae(a, e) {
|
|
|
337
369
|
};
|
|
338
370
|
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
339
371
|
}
|
|
340
|
-
function
|
|
372
|
+
function je(a) {
|
|
341
373
|
const e = (t) => {
|
|
342
374
|
const n = t.data;
|
|
343
375
|
n.type === "module_menu_item_clicked" && a(n.menu);
|
|
344
376
|
};
|
|
345
377
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
346
378
|
}
|
|
347
|
-
function
|
|
379
|
+
function Ne(a) {
|
|
348
380
|
const e = (t) => {
|
|
349
381
|
const n = t.data;
|
|
350
382
|
n.type === "module_configuration" && a(n);
|
|
351
383
|
};
|
|
352
384
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
353
385
|
}
|
|
354
|
-
function
|
|
386
|
+
function Pe(a) {
|
|
355
387
|
const e = k();
|
|
356
388
|
e && T({ type: "request_module_data", module: e });
|
|
357
389
|
const t = (n) => {
|
|
@@ -364,7 +396,7 @@ function je(a) {
|
|
|
364
396
|
};
|
|
365
397
|
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
366
398
|
}
|
|
367
|
-
function
|
|
399
|
+
function Le(a) {
|
|
368
400
|
T({ type: "request_devices" });
|
|
369
401
|
const e = (t) => {
|
|
370
402
|
const n = t.data;
|
|
@@ -372,42 +404,42 @@ function Ne(a) {
|
|
|
372
404
|
};
|
|
373
405
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
374
406
|
}
|
|
375
|
-
const
|
|
376
|
-
millisecond:
|
|
377
|
-
second:
|
|
378
|
-
minute:
|
|
379
|
-
hour:
|
|
407
|
+
const Ie = 1, W = 1e3, K = 60 * W, Q = 60 * K, L = 24 * Q, _e = 7 * L, $e = 30 * L, ze = 365 * L, I = {
|
|
408
|
+
millisecond: Ie,
|
|
409
|
+
second: W,
|
|
410
|
+
minute: K,
|
|
411
|
+
hour: Q,
|
|
380
412
|
day: L,
|
|
381
|
-
week:
|
|
382
|
-
month:
|
|
383
|
-
year:
|
|
413
|
+
week: _e,
|
|
414
|
+
month: $e,
|
|
415
|
+
year: ze
|
|
384
416
|
};
|
|
385
|
-
function
|
|
417
|
+
function Be(a, e) {
|
|
386
418
|
return a.filter((t) => e.includes(t.type));
|
|
387
419
|
}
|
|
388
|
-
function
|
|
420
|
+
function Me(a, e, t) {
|
|
389
421
|
const n = e.getTime(), i = t.getTime();
|
|
390
|
-
return a.map((
|
|
391
|
-
...
|
|
392
|
-
points:
|
|
422
|
+
return a.map((o) => ({
|
|
423
|
+
...o,
|
|
424
|
+
points: o.points.filter(
|
|
393
425
|
([c]) => c >= n && c < i
|
|
394
426
|
)
|
|
395
|
-
})).filter(({ points:
|
|
427
|
+
})).filter(({ points: o }) => o.length > 0);
|
|
396
428
|
}
|
|
397
|
-
class
|
|
429
|
+
class J {
|
|
398
430
|
constructor({
|
|
399
431
|
capacity: e,
|
|
400
432
|
timeout: t
|
|
401
433
|
} = {}) {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
434
|
+
s(this, "entries", /* @__PURE__ */ new Map());
|
|
435
|
+
s(this, "metadata", /* @__PURE__ */ new Map());
|
|
436
|
+
s(this, "capacity");
|
|
437
|
+
s(this, "timeout");
|
|
406
438
|
this.capacity = e || 1e4, this.timeout = t || I.minute;
|
|
407
439
|
}
|
|
408
440
|
get(e, t) {
|
|
409
|
-
const n = this.keyToCacheKey(e), i = this.entries.get(n),
|
|
410
|
-
return (i === void 0 ||
|
|
441
|
+
const n = this.keyToCacheKey(e), i = this.entries.get(n), o = this.metadata.get(n);
|
|
442
|
+
return (i === void 0 || o && (o == null ? void 0 : o.expiration.getTime()) < Date.now()) && !(o != null && o.generating) && t && this.generate(e, t()), i === void 0 && o && o.lastValue !== void 0 ? o.lastValue : i;
|
|
411
443
|
}
|
|
412
444
|
set(e, t) {
|
|
413
445
|
const n = this.keyToCacheKey(e);
|
|
@@ -430,7 +462,7 @@ class x {
|
|
|
430
462
|
if (this.metadata.size < 1)
|
|
431
463
|
return;
|
|
432
464
|
const [e] = [...this.metadata.entries()].reduce(
|
|
433
|
-
([t, n], [i,
|
|
465
|
+
([t, n], [i, o]) => o.expiration.getTime() < n.expiration.getTime() ? [i, o] : [t, n]
|
|
434
466
|
);
|
|
435
467
|
this.clearKey(e);
|
|
436
468
|
}
|
|
@@ -441,53 +473,53 @@ class x {
|
|
|
441
473
|
generating: !0,
|
|
442
474
|
expiration: new Date(Date.now() + this.timeout)
|
|
443
475
|
}), setTimeout(() => {
|
|
444
|
-
t.then((
|
|
476
|
+
t.then((o) => {
|
|
445
477
|
const c = this.metadata.get(n);
|
|
446
|
-
!(c != null && c.generating) || this.set(e,
|
|
478
|
+
!(c != null && c.generating) || this.set(e, o);
|
|
447
479
|
});
|
|
448
480
|
}, 0);
|
|
449
481
|
}
|
|
450
482
|
}
|
|
451
483
|
async function _(a) {
|
|
452
|
-
if (!
|
|
484
|
+
if (!r.token)
|
|
453
485
|
throw new Error("Not authenticated");
|
|
454
486
|
return (await (await fetch(`${h}/v1/queries/queries`, {
|
|
455
487
|
method: "POST",
|
|
456
488
|
body: JSON.stringify(a),
|
|
457
489
|
headers: {
|
|
458
490
|
"Content-Type": "application/json",
|
|
459
|
-
Authorization: "Bearer " +
|
|
491
|
+
Authorization: "Bearer " + r.token
|
|
460
492
|
}
|
|
461
493
|
})).json()).items;
|
|
462
494
|
}
|
|
463
|
-
class
|
|
495
|
+
class qe {
|
|
464
496
|
constructor() {
|
|
465
|
-
|
|
497
|
+
s(this, "queryStoreCache", new J({
|
|
466
498
|
capacity: 1e4,
|
|
467
499
|
timeout: 20 * I.second
|
|
468
500
|
}));
|
|
469
|
-
|
|
501
|
+
s(this, "liveQueryStoreCache", new J({
|
|
470
502
|
capacity: 1e4,
|
|
471
503
|
timeout: 200 * I.millisecond
|
|
472
504
|
}));
|
|
473
505
|
}
|
|
474
|
-
moduleQuery(e, t, n, i,
|
|
506
|
+
moduleQuery(e, t, n, i, o, c = !1) {
|
|
475
507
|
const d = {
|
|
476
508
|
...e,
|
|
477
509
|
names: [...t],
|
|
478
510
|
types: [...n]
|
|
479
|
-
}, y = this.query(d, i,
|
|
480
|
-
return y === void 0 || y === "too much data" ? y :
|
|
511
|
+
}, y = this.query(d, i, o, c);
|
|
512
|
+
return y === void 0 || y === "too much data" ? y : Be(y, n);
|
|
481
513
|
}
|
|
482
514
|
query(e, t, n, i = !1) {
|
|
483
|
-
const
|
|
515
|
+
const o = {
|
|
484
516
|
...e,
|
|
485
|
-
start:
|
|
486
|
-
end: i ? n.toISOString() :
|
|
517
|
+
start: he(t).toISOString(),
|
|
518
|
+
end: i ? n.toISOString() : le(ue(n), 1).toISOString(),
|
|
487
519
|
latestOnly: i
|
|
488
|
-
}, c = n >
|
|
520
|
+
}, c = n > me(/* @__PURE__ */ new Date(), -20);
|
|
489
521
|
let d;
|
|
490
|
-
return c ? d = this.liveQueryCache(
|
|
522
|
+
return c ? d = this.liveQueryCache(o) : d = this.queryCache(o), !d || d === "too much data" || i ? d : Me(d, t, n);
|
|
491
523
|
}
|
|
492
524
|
queryCache(e) {
|
|
493
525
|
return this.queryStoreCache.get(e, async () => {
|
|
@@ -508,14 +540,14 @@ class Be {
|
|
|
508
540
|
});
|
|
509
541
|
}
|
|
510
542
|
}
|
|
511
|
-
const
|
|
512
|
-
function
|
|
543
|
+
const xe = new qe();
|
|
544
|
+
function Ue(a, e, t) {
|
|
513
545
|
const n = (i) => {
|
|
514
|
-
const
|
|
515
|
-
if (
|
|
516
|
-
const { start: c, end: d } =
|
|
546
|
+
const o = i.data;
|
|
547
|
+
if (o.type === "module_data") {
|
|
548
|
+
const { start: c, end: d } = o.queryRange;
|
|
517
549
|
t(
|
|
518
|
-
|
|
550
|
+
xe.moduleQuery(
|
|
519
551
|
{},
|
|
520
552
|
a,
|
|
521
553
|
e,
|
|
@@ -528,7 +560,7 @@ function qe(a, e, t) {
|
|
|
528
560
|
};
|
|
529
561
|
return window.addEventListener("message", n), () => window.removeEventListener("message", n);
|
|
530
562
|
}
|
|
531
|
-
async function
|
|
563
|
+
async function Je(a, e, t) {
|
|
532
564
|
return new Promise((n) => {
|
|
533
565
|
T({
|
|
534
566
|
type: "request_date",
|
|
@@ -536,14 +568,14 @@ async function xe(a, e, t) {
|
|
|
536
568
|
maxTime: t,
|
|
537
569
|
time: a
|
|
538
570
|
});
|
|
539
|
-
const i = (
|
|
540
|
-
const c =
|
|
571
|
+
const i = (o) => {
|
|
572
|
+
const c = o.data;
|
|
541
573
|
c.type === "date_response" && (window.removeEventListener("message", i), n(c.data));
|
|
542
574
|
};
|
|
543
575
|
window.addEventListener("message", i);
|
|
544
576
|
});
|
|
545
577
|
}
|
|
546
|
-
async function
|
|
578
|
+
async function Ve(a, e) {
|
|
547
579
|
return new Promise((t) => {
|
|
548
580
|
const n = Math.random().toString();
|
|
549
581
|
T({
|
|
@@ -553,8 +585,8 @@ async function Ue(a, e) {
|
|
|
553
585
|
okText: e == null ? void 0 : e.okText,
|
|
554
586
|
cancelText: e == null ? void 0 : e.cancelText
|
|
555
587
|
});
|
|
556
|
-
const i = (
|
|
557
|
-
const c =
|
|
588
|
+
const i = (o) => {
|
|
589
|
+
const c = o.data;
|
|
558
590
|
c.type === "prompt_response" && c.promptId === n && t(c.data), window.removeEventListener("message", i);
|
|
559
591
|
};
|
|
560
592
|
window.addEventListener("message", i);
|
|
@@ -569,7 +601,7 @@ const q = class {
|
|
|
569
601
|
typeof window < "u" && window.location && (e = new URLSearchParams(window.location.search));
|
|
570
602
|
const t = e.get("configuration");
|
|
571
603
|
if (!(t === null || t.trim() === ""))
|
|
572
|
-
return
|
|
604
|
+
return Te(t.trim());
|
|
573
605
|
}
|
|
574
606
|
static get isOnline() {
|
|
575
607
|
return q._isOnline;
|
|
@@ -586,12 +618,12 @@ const q = class {
|
|
|
586
618
|
const i = setTimeout(
|
|
587
619
|
() => n(new Error("deadline expired: took too long")),
|
|
588
620
|
e
|
|
589
|
-
),
|
|
590
|
-
window.removeEventListener("message",
|
|
621
|
+
), o = (c) => {
|
|
622
|
+
window.removeEventListener("message", o), clearTimeout(i);
|
|
591
623
|
const { data: d } = c;
|
|
592
624
|
d.type === "formant_online" && (this._isOnline = d.online, t(d.online));
|
|
593
625
|
};
|
|
594
|
-
window.addEventListener("message",
|
|
626
|
+
window.addEventListener("message", o), T({ type: "formant_online" });
|
|
595
627
|
});
|
|
596
628
|
}
|
|
597
629
|
static waitForConnection(e = 5e3) {
|
|
@@ -600,18 +632,18 @@ const q = class {
|
|
|
600
632
|
setTimeout(() => {
|
|
601
633
|
t = !0, d(new Error("deadline expired: took too long"));
|
|
602
634
|
}, e);
|
|
603
|
-
}), i = (c) => new Promise((d) => setTimeout(d, c)),
|
|
635
|
+
}), i = (c) => new Promise((d) => setTimeout(d, c)), o = async () => {
|
|
604
636
|
for (await i(50); !t && !(this.isOnline || await this.checkConnection); )
|
|
605
637
|
await i(500);
|
|
606
638
|
};
|
|
607
|
-
return Promise.race([n,
|
|
639
|
+
return Promise.race([n, o()]);
|
|
608
640
|
}
|
|
609
641
|
};
|
|
610
642
|
let g = q;
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
643
|
+
s(g, "getCurrentModuleContext", k), // senders
|
|
644
|
+
s(g, "disableAnalyticsBottomBar", Ce), s(g, "goToDevice", Se), s(g, "goToTime", Ee), s(g, "refreshAuthToken", H), s(g, "requestModuleData", ke), s(g, "sendChannelData", Oe), s(g, "setModuleDateTimeRange", Re), s(g, "setupModuleMenus", Ae), s(g, "showMessage", be), // listeners
|
|
645
|
+
s(g, "addAccessTokenRefreshListener", F), s(g, "addChannelDataListener", De), s(g, "addMenuListener", je), s(g, "addModuleConfigurationListener", Ne), s(g, "addModuleDataListener", Pe), s(g, "addOverviewDeviceListener", Le), s(g, "addStreamListener", Ue), // bidirectional
|
|
646
|
+
s(g, "getDate", Je), s(g, "prompt", Ve), s(g, "_isOnline", null);
|
|
615
647
|
function f(a, e) {
|
|
616
648
|
if (a !== void 0)
|
|
617
649
|
return a;
|
|
@@ -623,7 +655,7 @@ const p = {
|
|
|
623
655
|
PORT_FORWARD: 2,
|
|
624
656
|
OBSERVE: 3,
|
|
625
657
|
HEADLESS: 4
|
|
626
|
-
},
|
|
658
|
+
}, Zt = {
|
|
627
659
|
...p,
|
|
628
660
|
Unknown: p.UNKNOWN,
|
|
629
661
|
Teleop: p.TELEOP,
|
|
@@ -636,26 +668,26 @@ const p = {
|
|
|
636
668
|
observe: p.OBSERVE,
|
|
637
669
|
headless: p.HEADLESS
|
|
638
670
|
}, O = Symbol("RtcClientPool.instance");
|
|
639
|
-
var
|
|
671
|
+
var Gt;
|
|
640
672
|
class N {
|
|
641
673
|
constructor(e) {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
674
|
+
s(this, Gt, null);
|
|
675
|
+
s(this, "createClient");
|
|
676
|
+
s(this, "ttlMs");
|
|
677
|
+
s(this, "proxyHandler");
|
|
678
|
+
s(this, "proxyReceivers", /* @__PURE__ */ new Map());
|
|
679
|
+
s(this, "teardownTimeout", null);
|
|
680
|
+
s(this, "dispatch", (e, t) => {
|
|
649
681
|
this.proxyReceivers.forEach((n) => n == null ? void 0 : n(e, t));
|
|
650
682
|
});
|
|
651
683
|
const { createClient: t, ttlMs: n = 0 } = e;
|
|
652
684
|
this.createClient = t, this.ttlMs = Math.max(n, 0), this.proxyHandler = {
|
|
653
|
-
get: (i,
|
|
654
|
-
switch (
|
|
685
|
+
get: (i, o, c) => {
|
|
686
|
+
switch (o) {
|
|
655
687
|
case "shutdown":
|
|
656
688
|
return () => this.releaseInstance(c);
|
|
657
689
|
default:
|
|
658
|
-
return Reflect.get(i,
|
|
690
|
+
return Reflect.get(i, o, c);
|
|
659
691
|
}
|
|
660
692
|
}
|
|
661
693
|
};
|
|
@@ -694,8 +726,8 @@ class N {
|
|
|
694
726
|
}, this.ttlMs)), !0) : (console.warn("this instance has already been released!"), !1);
|
|
695
727
|
}
|
|
696
728
|
}
|
|
697
|
-
|
|
698
|
-
const P = async () => f(
|
|
729
|
+
Gt = O;
|
|
730
|
+
const P = async () => f(r.token, "Realtime when user isn't authorized"), R = {
|
|
699
731
|
[p.UNKNOWN]: new N({
|
|
700
732
|
ttlMs: 2500,
|
|
701
733
|
createClient: (a) => new A({
|
|
@@ -741,20 +773,20 @@ const P = async () => f(o.token, "Realtime when user isn't authorized"), R = {
|
|
|
741
773
|
receive: a
|
|
742
774
|
})
|
|
743
775
|
})
|
|
744
|
-
},
|
|
776
|
+
}, Ge = {
|
|
745
777
|
...R,
|
|
746
778
|
unknown: R[p.UNKNOWN],
|
|
747
779
|
teleop: R[p.TELEOP],
|
|
748
780
|
portForward: R[p.PORT_FORWARD],
|
|
749
781
|
observe: R[p.OBSERVE],
|
|
750
782
|
headless: R[p.HEADLESS]
|
|
751
|
-
}, $ = R[p.TELEOP],
|
|
783
|
+
}, $ = R[p.TELEOP], He = (a) => {
|
|
752
784
|
const { sessionType: e } = a;
|
|
753
|
-
return e ?
|
|
785
|
+
return e ? Ge[e] : $;
|
|
754
786
|
};
|
|
755
|
-
class
|
|
787
|
+
class Fe {
|
|
756
788
|
constructor(e) {
|
|
757
|
-
|
|
789
|
+
s(this, "token");
|
|
758
790
|
this.captureSession = e;
|
|
759
791
|
}
|
|
760
792
|
async ingestJSON(e) {
|
|
@@ -785,17 +817,17 @@ class Ge {
|
|
|
785
817
|
function b(a) {
|
|
786
818
|
return new Promise((e) => setTimeout(e, a));
|
|
787
819
|
}
|
|
788
|
-
const
|
|
789
|
-
class
|
|
820
|
+
const We = (a) => a !== void 0 && a.capabilities !== void 0 && a.capabilitySet !== void 0;
|
|
821
|
+
class Ke {
|
|
790
822
|
constructor(e) {
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
823
|
+
s(this, "ready", !1);
|
|
824
|
+
s(this, "listeners", []);
|
|
825
|
+
s(this, "openListeners", []);
|
|
826
|
+
s(this, "closeListeners", []);
|
|
827
|
+
s(this, "errorListeners", []);
|
|
828
|
+
s(this, "binaryListeners", []);
|
|
829
|
+
s(this, "error");
|
|
830
|
+
s(this, "decoder", new TextDecoder());
|
|
799
831
|
this.dataChannel = e, this.dataChannel.binaryType = "arraybuffer", this.dataChannel.onopen = () => {
|
|
800
832
|
this.setReady();
|
|
801
833
|
}, this.dataChannel.onclose = () => {
|
|
@@ -804,8 +836,8 @@ class Fe {
|
|
|
804
836
|
console.error(t), this.error = "An error occurred in DataChannel", this.errorListeners.forEach((n) => n(t));
|
|
805
837
|
}, this.dataChannel.onmessage = (t) => {
|
|
806
838
|
this.listeners.forEach((n) => {
|
|
807
|
-
const i = new Uint8Array(t.data),
|
|
808
|
-
n(
|
|
839
|
+
const i = new Uint8Array(t.data), o = this.decoder.decode(i);
|
|
840
|
+
n(o);
|
|
809
841
|
}), this.binaryListeners.forEach((n) => {
|
|
810
842
|
n(new Uint8Array(t.data));
|
|
811
843
|
});
|
|
@@ -872,10 +904,10 @@ class Fe {
|
|
|
872
904
|
this.binaryListeners.splice(t, 1);
|
|
873
905
|
}
|
|
874
906
|
}
|
|
875
|
-
class
|
|
907
|
+
class Qe {
|
|
876
908
|
constructor(e, t) {
|
|
877
|
-
|
|
878
|
-
|
|
909
|
+
s(this, "currentListeners", []);
|
|
910
|
+
s(this, "onRealtimeMessage", (e, t) => {
|
|
879
911
|
t.payload.jointState && this.currentListeners.forEach((n) => {
|
|
880
912
|
t.payload.jointState && n(t.payload.jointState);
|
|
881
913
|
});
|
|
@@ -896,10 +928,10 @@ class We {
|
|
|
896
928
|
this.currentListeners.push(e);
|
|
897
929
|
}
|
|
898
930
|
}
|
|
899
|
-
class
|
|
931
|
+
class X {
|
|
900
932
|
constructor(e, t, n) {
|
|
901
|
-
|
|
902
|
-
|
|
933
|
+
s(this, "channel");
|
|
934
|
+
s(this, "requestIdToResponseMap", /* @__PURE__ */ new Map());
|
|
903
935
|
this.device = e, this.channel_name = t, this.timeout = n;
|
|
904
936
|
}
|
|
905
937
|
addOpenListener(e) {
|
|
@@ -927,11 +959,11 @@ class K {
|
|
|
927
959
|
);
|
|
928
960
|
}
|
|
929
961
|
}
|
|
930
|
-
class
|
|
962
|
+
class Xe extends X {
|
|
931
963
|
constructor() {
|
|
932
964
|
super(...arguments);
|
|
933
|
-
|
|
934
|
-
|
|
965
|
+
s(this, "RESPONSE_SUCCESS_BYTE", 0);
|
|
966
|
+
s(this, "decoder", new TextDecoder());
|
|
935
967
|
}
|
|
936
968
|
/*
|
|
937
969
|
Request binary payload layout:
|
|
@@ -953,21 +985,21 @@ class Ke extends K {
|
|
|
953
985
|
const i = t.slice(0, 16).toString();
|
|
954
986
|
if (i.length === 0)
|
|
955
987
|
throw new Error("Invalid response");
|
|
956
|
-
const
|
|
957
|
-
if (
|
|
988
|
+
const o = t.slice(16);
|
|
989
|
+
if (o.length === 0)
|
|
958
990
|
throw new Error("Invalid response");
|
|
959
|
-
this.requestIdToResponseMap.has(i) && this.requestIdToResponseMap.set(i,
|
|
991
|
+
this.requestIdToResponseMap.has(i) && this.requestIdToResponseMap.set(i, o);
|
|
960
992
|
});
|
|
961
993
|
}
|
|
962
994
|
async request(t) {
|
|
963
995
|
if (this.channel || await this.initialize(), !this.channel)
|
|
964
996
|
throw new Error("Failed to create channel");
|
|
965
|
-
const { channel: n, requestIdToResponseMap: i, timeout:
|
|
997
|
+
const { channel: n, requestIdToResponseMap: i, timeout: o } = this;
|
|
966
998
|
await n.waitTilReady();
|
|
967
999
|
const c = this.generateBinaryId(), d = c.toString();
|
|
968
1000
|
i.set(d, !0), n.sendBinary(new Uint8Array([...c, ...t]));
|
|
969
1001
|
const y = (/* @__PURE__ */ new Date()).getTime();
|
|
970
|
-
for (; (/* @__PURE__ */ new Date()).getTime() < y +
|
|
1002
|
+
for (; (/* @__PURE__ */ new Date()).getTime() < y + o; )
|
|
971
1003
|
if (await b(50), i.has(d)) {
|
|
972
1004
|
const m = i.get(d);
|
|
973
1005
|
if (m !== !0) {
|
|
@@ -983,20 +1015,20 @@ class Ke extends K {
|
|
|
983
1015
|
}
|
|
984
1016
|
throw i.delete(d), console.error({
|
|
985
1017
|
name: "TimeoutError",
|
|
986
|
-
message: `Request timed out after ${
|
|
1018
|
+
message: `Request timed out after ${o / 1e3} seconds`
|
|
987
1019
|
}), new Error("Binary request data channel request timed out");
|
|
988
1020
|
}
|
|
989
1021
|
}
|
|
990
|
-
class
|
|
1022
|
+
class Ye extends X {
|
|
991
1023
|
generateTextId() {
|
|
992
1024
|
return Math.random().toString(36).substring(2) + "-" + Math.random().toString(36).substring(2);
|
|
993
1025
|
}
|
|
994
1026
|
async initialize() {
|
|
995
1027
|
this.channel = await this.device.createCustomDataChannel(this.channel_name), this.channel.addListener((e) => {
|
|
996
|
-
const t = JSON.parse(e), { id: n, data: i, error:
|
|
1028
|
+
const t = JSON.parse(e), { id: n, data: i, error: o } = t;
|
|
997
1029
|
if (!n)
|
|
998
1030
|
throw new Error("Invalid response");
|
|
999
|
-
if (!i && !
|
|
1031
|
+
if (!i && !o)
|
|
1000
1032
|
throw new Error("Invalid response");
|
|
1001
1033
|
this.requestIdToResponseMap.has(n) && this.requestIdToResponseMap.set(n, t);
|
|
1002
1034
|
});
|
|
@@ -1006,19 +1038,19 @@ class Qe extends K {
|
|
|
1006
1038
|
throw new Error("Failed to create channel");
|
|
1007
1039
|
const { channel: t, requestIdToResponseMap: n, timeout: i } = this;
|
|
1008
1040
|
await t.waitTilReady();
|
|
1009
|
-
const
|
|
1010
|
-
n.set(
|
|
1041
|
+
const o = this.generateTextId();
|
|
1042
|
+
n.set(o, !0), t.send(
|
|
1011
1043
|
JSON.stringify({
|
|
1012
|
-
id:
|
|
1044
|
+
id: o,
|
|
1013
1045
|
data: e
|
|
1014
1046
|
})
|
|
1015
1047
|
);
|
|
1016
1048
|
const c = (/* @__PURE__ */ new Date()).getTime();
|
|
1017
1049
|
for (; (/* @__PURE__ */ new Date()).getTime() < c + i; )
|
|
1018
|
-
if (await b(50), n.has(
|
|
1019
|
-
const d = n.get(
|
|
1050
|
+
if (await b(50), n.has(o)) {
|
|
1051
|
+
const d = n.get(o);
|
|
1020
1052
|
if (d !== !0) {
|
|
1021
|
-
n.delete(
|
|
1053
|
+
n.delete(o);
|
|
1022
1054
|
const { data: y, error: m } = d;
|
|
1023
1055
|
if (y)
|
|
1024
1056
|
return y;
|
|
@@ -1029,20 +1061,20 @@ class Qe extends K {
|
|
|
1029
1061
|
}), new Error("Text request datachannel adapter error");
|
|
1030
1062
|
}
|
|
1031
1063
|
}
|
|
1032
|
-
throw n.delete(
|
|
1064
|
+
throw n.delete(o), console.error({
|
|
1033
1065
|
name: "TimeoutError",
|
|
1034
1066
|
message: `Request timed out after ${i / 1e3} seconds`
|
|
1035
1067
|
}), new Error("Text request datachannel request timed out");
|
|
1036
1068
|
}
|
|
1037
1069
|
}
|
|
1038
|
-
class
|
|
1070
|
+
class Y extends fe {
|
|
1039
1071
|
constructor() {
|
|
1040
1072
|
super(...arguments);
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1073
|
+
s(this, "rtcClient");
|
|
1074
|
+
s(this, "remoteDevicePeerId", null);
|
|
1075
|
+
s(this, "realtimeListeners", []);
|
|
1076
|
+
s(this, "connectionMonitorInterval");
|
|
1077
|
+
s(this, "handleMessage", (t, n) => {
|
|
1046
1078
|
this.realtimeListeners.forEach((i) => i(t, n));
|
|
1047
1079
|
});
|
|
1048
1080
|
}
|
|
@@ -1076,7 +1108,7 @@ class Q extends le {
|
|
|
1076
1108
|
const t = await this.getConfiguration(), n = [];
|
|
1077
1109
|
for (const i of t.teleop.rosStreams ?? [])
|
|
1078
1110
|
i.topicType == "sensor_msgs/JointState" && n.push(
|
|
1079
|
-
new
|
|
1111
|
+
new Qe(this, {
|
|
1080
1112
|
currentJointStateStream: { name: i.topicName },
|
|
1081
1113
|
plannedJointStateStream: i.plannedTopic ? { name: i.plannedTopic } : void 0,
|
|
1082
1114
|
planValidStream: i.planValidTopic ? { name: i.planValidTopic } : void 0,
|
|
@@ -1089,13 +1121,13 @@ class Q extends le {
|
|
|
1089
1121
|
return n;
|
|
1090
1122
|
}
|
|
1091
1123
|
async getRealtimeVideoStreams() {
|
|
1092
|
-
var i,
|
|
1124
|
+
var i, o, c;
|
|
1093
1125
|
const t = await this.getConfiguration(), n = [];
|
|
1094
1126
|
for (const d of ((i = t.teleop) == null ? void 0 : i.hardwareStreams) ?? [])
|
|
1095
1127
|
d.rtcStreamType === "h264-video-frame" && n.push({
|
|
1096
1128
|
name: d.name
|
|
1097
1129
|
});
|
|
1098
|
-
for (const d of ((
|
|
1130
|
+
for (const d of ((o = t.teleop) == null ? void 0 : o.rosStreams) ?? [])
|
|
1099
1131
|
d.topicType == "formant/H264VideoFrame" && n.push({
|
|
1100
1132
|
name: d.topicName
|
|
1101
1133
|
}), (d.topicType === "sensor_msgs/Image" || d.topicType === "sensor_msgs/CompressedImage") && d.encodeVideo && n.push({
|
|
@@ -1108,10 +1140,10 @@ class Q extends le {
|
|
|
1108
1140
|
return n;
|
|
1109
1141
|
}
|
|
1110
1142
|
createCustomRequestDataChannel(t, n = 3e3) {
|
|
1111
|
-
return new
|
|
1143
|
+
return new Ye(this, t, n);
|
|
1112
1144
|
}
|
|
1113
1145
|
createCustomBinaryRequestDataChannel(t, n = 3e3) {
|
|
1114
|
-
return new
|
|
1146
|
+
return new Xe(this, t, n);
|
|
1115
1147
|
}
|
|
1116
1148
|
async startListeningToRealtimeVideo(t) {
|
|
1117
1149
|
const n = f(
|
|
@@ -1183,8 +1215,8 @@ class Q extends le {
|
|
|
1183
1215
|
const i = f(
|
|
1184
1216
|
this.rtcClient,
|
|
1185
1217
|
"Realtime connection has not been started"
|
|
1186
|
-
),
|
|
1187
|
-
i.controlRemoteStream(f(
|
|
1218
|
+
), o = await this.getRemotePeer();
|
|
1219
|
+
i.controlRemoteStream(f(o).id, {
|
|
1188
1220
|
streamName: t,
|
|
1189
1221
|
setAudioFormat: n
|
|
1190
1222
|
});
|
|
@@ -1193,9 +1225,9 @@ class Q extends le {
|
|
|
1193
1225
|
const i = f(
|
|
1194
1226
|
this.rtcClient,
|
|
1195
1227
|
"Realtime connection has not been started"
|
|
1196
|
-
),
|
|
1228
|
+
), o = await this.getRemotePeer(), c = await new Promise((d) => {
|
|
1197
1229
|
i.createCustomDataChannel(
|
|
1198
|
-
f(
|
|
1230
|
+
f(o).id,
|
|
1199
1231
|
t,
|
|
1200
1232
|
{
|
|
1201
1233
|
ordered: !0,
|
|
@@ -1203,7 +1235,7 @@ class Q extends le {
|
|
|
1203
1235
|
},
|
|
1204
1236
|
!1,
|
|
1205
1237
|
(y, m) => {
|
|
1206
|
-
const w = new
|
|
1238
|
+
const w = new Ke(m);
|
|
1207
1239
|
d(w);
|
|
1208
1240
|
}
|
|
1209
1241
|
);
|
|
@@ -1216,17 +1248,17 @@ class Q extends le {
|
|
|
1216
1248
|
const i = f(
|
|
1217
1249
|
this.rtcClient,
|
|
1218
1250
|
"Realtime connection has not been started"
|
|
1219
|
-
),
|
|
1220
|
-
i.send(f(
|
|
1251
|
+
), o = await this.getRemotePeer();
|
|
1252
|
+
i.send(f(o).id, t, n);
|
|
1221
1253
|
}
|
|
1222
1254
|
async getRealtimeAudioStreams() {
|
|
1223
|
-
var i,
|
|
1255
|
+
var i, o, c;
|
|
1224
1256
|
const t = await this.getConfiguration(), n = [];
|
|
1225
1257
|
for (const d of ((i = t.teleop) == null ? void 0 : i.hardwareStreams) ?? [])
|
|
1226
1258
|
d.rtcStreamType === "audio-chunk" && n.push({
|
|
1227
1259
|
name: d.name
|
|
1228
1260
|
});
|
|
1229
|
-
for (const d of ((
|
|
1261
|
+
for (const d of ((o = t.teleop) == null ? void 0 : o.rosStreams) ?? [])
|
|
1230
1262
|
d.topicType == "audio_common_msgs/AudioData" && n.push({
|
|
1231
1263
|
name: d.topicName
|
|
1232
1264
|
});
|
|
@@ -1237,27 +1269,27 @@ class Q extends le {
|
|
|
1237
1269
|
return n;
|
|
1238
1270
|
}
|
|
1239
1271
|
}
|
|
1240
|
-
const
|
|
1272
|
+
const Ze = new TextEncoder();
|
|
1241
1273
|
new TextDecoder();
|
|
1242
|
-
function
|
|
1243
|
-
const e = JSON.stringify(a), t =
|
|
1244
|
-
return
|
|
1274
|
+
function et(a) {
|
|
1275
|
+
const e = JSON.stringify(a), t = Ze.encode(e), n = we(t);
|
|
1276
|
+
return pe(n);
|
|
1245
1277
|
}
|
|
1246
|
-
async function
|
|
1247
|
-
if (!
|
|
1278
|
+
async function Z() {
|
|
1279
|
+
if (!r.token)
|
|
1248
1280
|
throw new Error("Not authenticated");
|
|
1249
1281
|
return (await (await fetch(`${h}/v1/admin/views`, {
|
|
1250
1282
|
method: "GET",
|
|
1251
1283
|
headers: {
|
|
1252
1284
|
"Content-Type": "application/json",
|
|
1253
|
-
Authorization: "Bearer " +
|
|
1285
|
+
Authorization: "Bearer " + r.token
|
|
1254
1286
|
}
|
|
1255
1287
|
})).json()).items;
|
|
1256
1288
|
}
|
|
1257
|
-
async function
|
|
1258
|
-
if (!
|
|
1289
|
+
async function ee(a, e) {
|
|
1290
|
+
if (!r.token)
|
|
1259
1291
|
throw new Error("Not authenticated");
|
|
1260
|
-
const n = (await
|
|
1292
|
+
const n = (await Z()).filter((d) => d.name === e);
|
|
1261
1293
|
if (n.length === 0)
|
|
1262
1294
|
return console.warn("View does not exist or it is misspell"), null;
|
|
1263
1295
|
const i = await fetch(`${h}/v1/admin/shares`, {
|
|
@@ -1265,14 +1297,14 @@ async function Y(a, e) {
|
|
|
1265
1297
|
body: JSON.stringify(a),
|
|
1266
1298
|
headers: {
|
|
1267
1299
|
"Content-Type": "application/json",
|
|
1268
|
-
Authorization: "Bearer " +
|
|
1300
|
+
Authorization: "Bearer " + r.token
|
|
1269
1301
|
}
|
|
1270
|
-
}),
|
|
1271
|
-
return `${
|
|
1302
|
+
}), o = h.replace("api", "app"), { code: c } = await i.json();
|
|
1303
|
+
return `${o}/shares/${c}#${et({
|
|
1272
1304
|
viewId: n[0].id
|
|
1273
1305
|
})}`;
|
|
1274
1306
|
}
|
|
1275
|
-
const
|
|
1307
|
+
const en = [
|
|
1276
1308
|
"day",
|
|
1277
1309
|
"week",
|
|
1278
1310
|
"month",
|
|
@@ -1280,92 +1312,92 @@ const Yt = [
|
|
|
1280
1312
|
"hour",
|
|
1281
1313
|
"minute",
|
|
1282
1314
|
"quarter"
|
|
1283
|
-
],
|
|
1315
|
+
], tn = [
|
|
1284
1316
|
"interval",
|
|
1285
1317
|
"start",
|
|
1286
1318
|
"end",
|
|
1287
1319
|
"sub",
|
|
1288
1320
|
"get"
|
|
1289
1321
|
];
|
|
1290
|
-
function
|
|
1322
|
+
function tt(a) {
|
|
1291
1323
|
return a.count < 2 ? 0 : a.sumOfSquares / (a.count - 1);
|
|
1292
1324
|
}
|
|
1293
|
-
function
|
|
1294
|
-
return Math.sqrt(
|
|
1325
|
+
function nt(a) {
|
|
1326
|
+
return Math.sqrt(tt(a));
|
|
1295
1327
|
}
|
|
1296
|
-
function
|
|
1328
|
+
function at(a) {
|
|
1297
1329
|
return a.max;
|
|
1298
1330
|
}
|
|
1299
|
-
function
|
|
1331
|
+
function it(a) {
|
|
1300
1332
|
return a.min;
|
|
1301
1333
|
}
|
|
1302
|
-
function
|
|
1334
|
+
function ot(a) {
|
|
1303
1335
|
return a.count === 0 ? -1 : a.sum / a.count;
|
|
1304
1336
|
}
|
|
1305
|
-
function
|
|
1337
|
+
function rt(a) {
|
|
1306
1338
|
return a.sum;
|
|
1307
1339
|
}
|
|
1308
|
-
function
|
|
1340
|
+
function st(a) {
|
|
1309
1341
|
return a.count;
|
|
1310
1342
|
}
|
|
1311
|
-
const
|
|
1312
|
-
min:
|
|
1313
|
-
max:
|
|
1314
|
-
"standard deviation":
|
|
1315
|
-
average:
|
|
1316
|
-
sum:
|
|
1317
|
-
count:
|
|
1318
|
-
},
|
|
1343
|
+
const nn = {
|
|
1344
|
+
min: it,
|
|
1345
|
+
max: at,
|
|
1346
|
+
"standard deviation": nt,
|
|
1347
|
+
average: ot,
|
|
1348
|
+
sum: rt,
|
|
1349
|
+
count: st
|
|
1350
|
+
}, te = {
|
|
1319
1351
|
day: {
|
|
1320
|
-
interval:
|
|
1321
|
-
start:
|
|
1322
|
-
end:
|
|
1323
|
-
sub:
|
|
1324
|
-
get:
|
|
1352
|
+
interval: u.eachDayOfInterval,
|
|
1353
|
+
start: u.startOfDay,
|
|
1354
|
+
end: u.endOfDay,
|
|
1355
|
+
sub: u.subDays,
|
|
1356
|
+
get: u.getDay
|
|
1325
1357
|
},
|
|
1326
1358
|
week: {
|
|
1327
|
-
interval:
|
|
1328
|
-
start:
|
|
1329
|
-
end:
|
|
1330
|
-
sub:
|
|
1331
|
-
get:
|
|
1359
|
+
interval: u.eachWeekOfInterval,
|
|
1360
|
+
start: u.startOfWeek,
|
|
1361
|
+
end: u.endOfWeek,
|
|
1362
|
+
sub: u.subWeeks,
|
|
1363
|
+
get: u.getWeek
|
|
1332
1364
|
},
|
|
1333
1365
|
month: {
|
|
1334
|
-
interval:
|
|
1335
|
-
start:
|
|
1336
|
-
end:
|
|
1337
|
-
sub:
|
|
1338
|
-
get:
|
|
1366
|
+
interval: u.eachMonthOfInterval,
|
|
1367
|
+
start: u.startOfMonth,
|
|
1368
|
+
end: u.endOfMonth,
|
|
1369
|
+
sub: u.subMonths,
|
|
1370
|
+
get: u.getMonth
|
|
1339
1371
|
},
|
|
1340
1372
|
year: {
|
|
1341
|
-
interval:
|
|
1342
|
-
start:
|
|
1343
|
-
end:
|
|
1344
|
-
sub:
|
|
1345
|
-
get:
|
|
1373
|
+
interval: u.eachYearOfInterval,
|
|
1374
|
+
start: u.startOfYear,
|
|
1375
|
+
end: u.endOfYear,
|
|
1376
|
+
sub: u.subYears,
|
|
1377
|
+
get: u.getYear
|
|
1346
1378
|
},
|
|
1347
1379
|
hour: {
|
|
1348
|
-
interval:
|
|
1349
|
-
start:
|
|
1350
|
-
end:
|
|
1351
|
-
sub:
|
|
1352
|
-
get:
|
|
1380
|
+
interval: u.eachHourOfInterval,
|
|
1381
|
+
start: u.startOfHour,
|
|
1382
|
+
end: u.endOfHour,
|
|
1383
|
+
sub: u.subHours,
|
|
1384
|
+
get: u.getHours
|
|
1353
1385
|
},
|
|
1354
1386
|
minute: {
|
|
1355
|
-
interval:
|
|
1356
|
-
start:
|
|
1357
|
-
end:
|
|
1358
|
-
sub:
|
|
1359
|
-
get:
|
|
1387
|
+
interval: u.eachMinuteOfInterval,
|
|
1388
|
+
start: u.startOfMinute,
|
|
1389
|
+
end: u.endOfMinute,
|
|
1390
|
+
sub: u.subMinutes,
|
|
1391
|
+
get: u.getMinutes
|
|
1360
1392
|
},
|
|
1361
1393
|
quarter: {
|
|
1362
|
-
interval:
|
|
1363
|
-
start:
|
|
1364
|
-
end:
|
|
1365
|
-
sub:
|
|
1366
|
-
get:
|
|
1394
|
+
interval: u.eachQuarterOfInterval,
|
|
1395
|
+
start: u.startOfQuarter,
|
|
1396
|
+
end: u.endOfQuarter,
|
|
1397
|
+
sub: u.subQuarters,
|
|
1398
|
+
get: u.getQuarter
|
|
1367
1399
|
}
|
|
1368
|
-
},
|
|
1400
|
+
}, ct = (a, e) => (
|
|
1369
1401
|
// FIXME this doesn't work for *a lot* locales, other than en-US
|
|
1370
1402
|
// en-GB: 'dd/mm/YYYY'
|
|
1371
1403
|
// ja-jp: 'YYYY/mm/dd'
|
|
@@ -1373,28 +1405,28 @@ const en = {
|
|
|
1373
1405
|
a.split("/")[0] + "/" + a.split("/")[1] + "–" + e.split("/")[0] + "/" + e.split("/")[1]
|
|
1374
1406
|
);
|
|
1375
1407
|
async function z(a) {
|
|
1376
|
-
if (!
|
|
1408
|
+
if (!r.token)
|
|
1377
1409
|
throw new Error("Not authenticated");
|
|
1378
1410
|
return (await (await fetch(`${h}/v1/admin/events/query`, {
|
|
1379
1411
|
method: "POST",
|
|
1380
1412
|
body: JSON.stringify(a),
|
|
1381
1413
|
headers: {
|
|
1382
1414
|
"Content-Type": "application/json",
|
|
1383
|
-
Authorization: "Bearer " +
|
|
1415
|
+
Authorization: "Bearer " + r.token
|
|
1384
1416
|
}
|
|
1385
1417
|
})).json()).items;
|
|
1386
1418
|
}
|
|
1387
|
-
async function
|
|
1388
|
-
const
|
|
1419
|
+
async function ne(a, e, t, n, i) {
|
|
1420
|
+
const o = te[e];
|
|
1389
1421
|
return await Promise.all(
|
|
1390
1422
|
Array(t).fill(0).map(async (c, d) => {
|
|
1391
|
-
const y = new Date(n), m =
|
|
1392
|
-
|
|
1423
|
+
const y = new Date(n), m = o.sub(
|
|
1424
|
+
o.start(y),
|
|
1393
1425
|
t - d - 1
|
|
1394
|
-
), w =
|
|
1395
|
-
|
|
1426
|
+
), w = o.sub(
|
|
1427
|
+
o.end(y),
|
|
1396
1428
|
t - d - 1
|
|
1397
|
-
), v =
|
|
1429
|
+
), v = ct(
|
|
1398
1430
|
m.toLocaleDateString(),
|
|
1399
1431
|
w.toLocaleDateString()
|
|
1400
1432
|
), C = await z({
|
|
@@ -1412,14 +1444,14 @@ async function B(a, e) {
|
|
|
1412
1444
|
...a,
|
|
1413
1445
|
eventTypes: ["annotation"]
|
|
1414
1446
|
})).filter(
|
|
1415
|
-
(
|
|
1416
|
-
).reduce((
|
|
1447
|
+
(o) => !!o.tags && Object.keys(o.tags).includes(e)
|
|
1448
|
+
).reduce((o, c) => {
|
|
1417
1449
|
const d = c.tags[e];
|
|
1418
|
-
return d in
|
|
1450
|
+
return d in o ? (o[d] += 1, o) : (o[d] = 1, o);
|
|
1419
1451
|
}, {});
|
|
1420
1452
|
}
|
|
1421
|
-
async function
|
|
1422
|
-
const { end: n, start: i } = a, c =
|
|
1453
|
+
async function ae(a, e, t) {
|
|
1454
|
+
const { end: n, start: i } = a, c = te[t].interval({
|
|
1423
1455
|
start: new Date(i),
|
|
1424
1456
|
end: new Date(n)
|
|
1425
1457
|
}), d = c.map((m, w) => {
|
|
@@ -1438,14 +1470,14 @@ async function te(a, e, t) {
|
|
|
1438
1470
|
annotations: y[w]
|
|
1439
1471
|
}));
|
|
1440
1472
|
}
|
|
1441
|
-
async function
|
|
1442
|
-
let
|
|
1443
|
-
Array.isArray(a) || (
|
|
1473
|
+
async function ie(a, e, t, n, i) {
|
|
1474
|
+
let o = a;
|
|
1475
|
+
Array.isArray(a) || (o = [a]);
|
|
1444
1476
|
let c = e;
|
|
1445
1477
|
return Array.isArray(e) || (c = [e]), (await (await fetch(`${h}/v1/queries/queries`, {
|
|
1446
1478
|
method: "POST",
|
|
1447
1479
|
body: JSON.stringify({
|
|
1448
|
-
deviceIds:
|
|
1480
|
+
deviceIds: o,
|
|
1449
1481
|
end: n.toISOString(),
|
|
1450
1482
|
names: c,
|
|
1451
1483
|
start: t.toISOString(),
|
|
@@ -1453,12 +1485,12 @@ async function ne(a, e, t, n, i) {
|
|
|
1453
1485
|
}),
|
|
1454
1486
|
headers: {
|
|
1455
1487
|
"Content-Type": "application/json",
|
|
1456
|
-
Authorization: "Bearer " +
|
|
1488
|
+
Authorization: "Bearer " + r.token
|
|
1457
1489
|
}
|
|
1458
1490
|
})).json()).items;
|
|
1459
1491
|
}
|
|
1460
|
-
async function
|
|
1461
|
-
if (!
|
|
1492
|
+
async function oe() {
|
|
1493
|
+
if (!r.token)
|
|
1462
1494
|
throw new Error("Not authenticated");
|
|
1463
1495
|
const a = $.get();
|
|
1464
1496
|
try {
|
|
@@ -1467,8 +1499,8 @@ async function ae() {
|
|
|
1467
1499
|
await a.shutdown();
|
|
1468
1500
|
}
|
|
1469
1501
|
}
|
|
1470
|
-
async function
|
|
1471
|
-
if (!
|
|
1502
|
+
async function re() {
|
|
1503
|
+
if (!r.token)
|
|
1472
1504
|
throw new Error("Not authenticated");
|
|
1473
1505
|
const a = $.get();
|
|
1474
1506
|
try {
|
|
@@ -1477,56 +1509,56 @@ async function ie() {
|
|
|
1477
1509
|
await a.shutdown();
|
|
1478
1510
|
}
|
|
1479
1511
|
}
|
|
1480
|
-
async function
|
|
1481
|
-
if (!
|
|
1512
|
+
async function dt(a) {
|
|
1513
|
+
if (!r.token)
|
|
1482
1514
|
throw new Error("Not authenticated");
|
|
1483
1515
|
return await (await fetch(`${h}/v1/admin/devices`, {
|
|
1484
1516
|
method: "POST",
|
|
1485
1517
|
body: JSON.stringify(a),
|
|
1486
1518
|
headers: {
|
|
1487
1519
|
"Content-Type": "application/json",
|
|
1488
|
-
Authorization: "Bearer " +
|
|
1520
|
+
Authorization: "Bearer " + r.token
|
|
1489
1521
|
}
|
|
1490
1522
|
})).json();
|
|
1491
1523
|
}
|
|
1492
|
-
async function
|
|
1493
|
-
if (!
|
|
1524
|
+
async function ht(a, e) {
|
|
1525
|
+
if (!r.token)
|
|
1494
1526
|
throw new Error("Not authenticated");
|
|
1495
1527
|
return await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
1496
1528
|
method: "PATCH",
|
|
1497
1529
|
body: JSON.stringify(e),
|
|
1498
1530
|
headers: {
|
|
1499
1531
|
"Content-Type": "application/json",
|
|
1500
|
-
Authorization: "Bearer " +
|
|
1532
|
+
Authorization: "Bearer " + r.token
|
|
1501
1533
|
}
|
|
1502
1534
|
})).json();
|
|
1503
1535
|
}
|
|
1504
|
-
async function
|
|
1505
|
-
if (!
|
|
1536
|
+
async function lt() {
|
|
1537
|
+
if (!r.token)
|
|
1506
1538
|
throw new Error("Not authenticated");
|
|
1507
1539
|
return (await (await fetch(`${h}/v1/admin/device-details/query`, {
|
|
1508
1540
|
method: "POST",
|
|
1509
1541
|
body: JSON.stringify({ enabled: !0, type: "default" }),
|
|
1510
1542
|
headers: {
|
|
1511
1543
|
"Content-Type": "application/json",
|
|
1512
|
-
Authorization: "Bearer " +
|
|
1544
|
+
Authorization: "Bearer " + r.token
|
|
1513
1545
|
}
|
|
1514
1546
|
})).json()).items;
|
|
1515
1547
|
}
|
|
1516
|
-
async function
|
|
1517
|
-
if (!
|
|
1548
|
+
async function ut(a) {
|
|
1549
|
+
if (!r.token)
|
|
1518
1550
|
throw new Error("Not authenticated");
|
|
1519
1551
|
return (await (await fetch(`${h}/v1/admin/devices/query`, {
|
|
1520
1552
|
method: "POST",
|
|
1521
1553
|
body: JSON.stringify(a),
|
|
1522
1554
|
headers: {
|
|
1523
1555
|
"Content-Type": "application/json",
|
|
1524
|
-
Authorization: "Bearer " +
|
|
1556
|
+
Authorization: "Bearer " + r.token
|
|
1525
1557
|
}
|
|
1526
1558
|
})).json()).items;
|
|
1527
1559
|
}
|
|
1528
|
-
async function
|
|
1529
|
-
if (!
|
|
1560
|
+
async function mt(a) {
|
|
1561
|
+
if (!r.token)
|
|
1530
1562
|
throw new Error("Not authenticated");
|
|
1531
1563
|
return await (await fetch(
|
|
1532
1564
|
`${h}/v1/admin/devices/${a}/disable`,
|
|
@@ -1534,12 +1566,12 @@ async function ut(a) {
|
|
|
1534
1566
|
method: "POST",
|
|
1535
1567
|
headers: {
|
|
1536
1568
|
"Content-Type": "application/json",
|
|
1537
|
-
Authorization: "Bearer " +
|
|
1569
|
+
Authorization: "Bearer " + r.token
|
|
1538
1570
|
}
|
|
1539
1571
|
}
|
|
1540
1572
|
)).json();
|
|
1541
1573
|
}
|
|
1542
|
-
class S extends
|
|
1574
|
+
class S extends Y {
|
|
1543
1575
|
constructor(e, t, n, i) {
|
|
1544
1576
|
super(), this.id = e, this.name = t, this.organizationId = n, this.tags = i;
|
|
1545
1577
|
}
|
|
@@ -1553,7 +1585,7 @@ class S extends Q {
|
|
|
1553
1585
|
}),
|
|
1554
1586
|
headers: {
|
|
1555
1587
|
"Content-Type": "application/json",
|
|
1556
|
-
Authorization: "Bearer " +
|
|
1588
|
+
Authorization: "Bearer " + r.token
|
|
1557
1589
|
}
|
|
1558
1590
|
}
|
|
1559
1591
|
)).json()).items;
|
|
@@ -1563,7 +1595,7 @@ class S extends Q {
|
|
|
1563
1595
|
method: "GET",
|
|
1564
1596
|
headers: {
|
|
1565
1597
|
"Content-Type": "application/json",
|
|
1566
|
-
Authorization: "Bearer " +
|
|
1598
|
+
Authorization: "Bearer " + r.token
|
|
1567
1599
|
}
|
|
1568
1600
|
});
|
|
1569
1601
|
const t = await e.json();
|
|
@@ -1578,7 +1610,7 @@ class S extends Q {
|
|
|
1578
1610
|
method: "GET",
|
|
1579
1611
|
headers: {
|
|
1580
1612
|
"Content-Type": "application/json",
|
|
1581
|
-
Authorization: "Bearer " +
|
|
1613
|
+
Authorization: "Bearer " + r.token
|
|
1582
1614
|
}
|
|
1583
1615
|
}
|
|
1584
1616
|
), (await e.json()).document;
|
|
@@ -1591,7 +1623,7 @@ class S extends Q {
|
|
|
1591
1623
|
}),
|
|
1592
1624
|
headers: {
|
|
1593
1625
|
"Content-Type": "application/json",
|
|
1594
|
-
Authorization: "Bearer " +
|
|
1626
|
+
Authorization: "Bearer " + r.token
|
|
1595
1627
|
}
|
|
1596
1628
|
})).json()).fileUrls;
|
|
1597
1629
|
}
|
|
@@ -1613,7 +1645,7 @@ class S extends Q {
|
|
|
1613
1645
|
sessionType: t,
|
|
1614
1646
|
deadlineMs: n = 1e4,
|
|
1615
1647
|
maxConnectRetries: i = 3
|
|
1616
|
-
} = typeof e == "number" ? { sessionType: e } : e, c =
|
|
1648
|
+
} = typeof e == "number" ? { sessionType: e } : e, c = He({
|
|
1617
1649
|
sessionType: t
|
|
1618
1650
|
}).get(this.handleMessage);
|
|
1619
1651
|
let d = !1;
|
|
@@ -1658,7 +1690,7 @@ class S extends Q {
|
|
|
1658
1690
|
}
|
|
1659
1691
|
async getRemoteDevicePeerId(e) {
|
|
1660
1692
|
const n = (await e.getPeers()).find((i) => i.deviceId === this.id);
|
|
1661
|
-
if (!
|
|
1693
|
+
if (!We(n))
|
|
1662
1694
|
throw new Error("Cannot find peer, is the robot offline?");
|
|
1663
1695
|
return n.id;
|
|
1664
1696
|
}
|
|
@@ -1702,7 +1734,7 @@ class S extends Q {
|
|
|
1702
1734
|
throw new Error(`Realtime connection hasn't been started for ${this.id}`);
|
|
1703
1735
|
}
|
|
1704
1736
|
async isInRealtimeSession() {
|
|
1705
|
-
const e = await
|
|
1737
|
+
const e = await re(), t = await oe(), n = e.find((i) => i.deviceId === this.id);
|
|
1706
1738
|
return n ? t[n.id].length > 0 : !1;
|
|
1707
1739
|
}
|
|
1708
1740
|
async getAvailableCommands() {
|
|
@@ -1712,7 +1744,7 @@ class S extends Q {
|
|
|
1712
1744
|
method: "GET",
|
|
1713
1745
|
headers: {
|
|
1714
1746
|
"Content-Type": "application/json",
|
|
1715
|
-
Authorization: "Bearer " +
|
|
1747
|
+
Authorization: "Bearer " + r.token
|
|
1716
1748
|
}
|
|
1717
1749
|
}
|
|
1718
1750
|
)).json()).items.map((n) => ({
|
|
@@ -1750,11 +1782,11 @@ class S extends Q {
|
|
|
1750
1782
|
deviceId: this.id,
|
|
1751
1783
|
command: c.command,
|
|
1752
1784
|
parameter: y,
|
|
1753
|
-
userId: (w =
|
|
1785
|
+
userId: (w = r.currentUser) == null ? void 0 : w.id
|
|
1754
1786
|
}),
|
|
1755
1787
|
headers: {
|
|
1756
1788
|
"Content-Type": "application/json",
|
|
1757
|
-
Authorization: "Bearer " +
|
|
1789
|
+
Authorization: "Bearer " + r.token
|
|
1758
1790
|
}
|
|
1759
1791
|
});
|
|
1760
1792
|
}
|
|
@@ -1763,7 +1795,7 @@ class S extends Q {
|
|
|
1763
1795
|
method: "GET",
|
|
1764
1796
|
headers: {
|
|
1765
1797
|
"Content-Type": "application/json",
|
|
1766
|
-
Authorization: "Bearer " +
|
|
1798
|
+
Authorization: "Bearer " + r.token
|
|
1767
1799
|
}
|
|
1768
1800
|
});
|
|
1769
1801
|
}
|
|
@@ -1777,13 +1809,13 @@ class S extends Q {
|
|
|
1777
1809
|
}),
|
|
1778
1810
|
headers: {
|
|
1779
1811
|
"Content-Type": "application/json",
|
|
1780
|
-
Authorization: "Bearer " +
|
|
1812
|
+
Authorization: "Bearer " + r.token
|
|
1781
1813
|
}
|
|
1782
1814
|
})).json();
|
|
1783
|
-
return new
|
|
1815
|
+
return new Fe(n);
|
|
1784
1816
|
}
|
|
1785
1817
|
async getTelemetry(e, t, n, i) {
|
|
1786
|
-
return await
|
|
1818
|
+
return await ie(
|
|
1787
1819
|
this.id,
|
|
1788
1820
|
e,
|
|
1789
1821
|
t,
|
|
@@ -1802,7 +1834,7 @@ class S extends Q {
|
|
|
1802
1834
|
}),
|
|
1803
1835
|
headers: {
|
|
1804
1836
|
"Content-Type": "application/json",
|
|
1805
|
-
Authorization: "Bearer " +
|
|
1837
|
+
Authorization: "Bearer " + r.token
|
|
1806
1838
|
}
|
|
1807
1839
|
}
|
|
1808
1840
|
), n = [], i = [];
|
|
@@ -1825,7 +1857,7 @@ class S extends Q {
|
|
|
1825
1857
|
}),
|
|
1826
1858
|
headers: {
|
|
1827
1859
|
"Content-Type": "application/json",
|
|
1828
|
-
Authorization: "Bearer " +
|
|
1860
|
+
Authorization: "Bearer " + r.token
|
|
1829
1861
|
}
|
|
1830
1862
|
}
|
|
1831
1863
|
)).json();
|
|
@@ -1842,7 +1874,7 @@ class S extends Q {
|
|
|
1842
1874
|
}),
|
|
1843
1875
|
headers: {
|
|
1844
1876
|
"Content-Type": "application/json",
|
|
1845
|
-
Authorization: "Bearer " +
|
|
1877
|
+
Authorization: "Bearer " + r.token
|
|
1846
1878
|
}
|
|
1847
1879
|
}
|
|
1848
1880
|
)).json();
|
|
@@ -1851,40 +1883,40 @@ class S extends Q {
|
|
|
1851
1883
|
return await B({ ...e, deviceIds: [this.id] }, t);
|
|
1852
1884
|
}
|
|
1853
1885
|
async getAnnotationCountByIntervals(e, t, n) {
|
|
1854
|
-
return await
|
|
1886
|
+
return await ae(
|
|
1855
1887
|
{ ...e, deviceIds: [this.id] },
|
|
1856
1888
|
t,
|
|
1857
1889
|
n
|
|
1858
1890
|
);
|
|
1859
1891
|
}
|
|
1860
|
-
async eventsCounter(e, t, n, i,
|
|
1861
|
-
return await
|
|
1862
|
-
...
|
|
1892
|
+
async eventsCounter(e, t, n, i, o) {
|
|
1893
|
+
return await ne(e, t, n, i, {
|
|
1894
|
+
...o,
|
|
1863
1895
|
deviceIds: [this.id]
|
|
1864
1896
|
});
|
|
1865
1897
|
}
|
|
1866
1898
|
async createShareLink(e, t) {
|
|
1867
|
-
return e.scope.deviceIds = [this.id], await
|
|
1899
|
+
return e.scope.deviceIds = [this.id], await ee(e, t);
|
|
1868
1900
|
}
|
|
1869
1901
|
}
|
|
1870
|
-
|
|
1871
|
-
class
|
|
1902
|
+
s(S, "createDevice", dt), s(S, "patchDevice", ht), s(S, "getDevicesData", lt), s(S, "queryDevicesData", ut), s(S, "disableDevice", mt);
|
|
1903
|
+
class ft extends Y {
|
|
1872
1904
|
constructor(t) {
|
|
1873
1905
|
super();
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1906
|
+
s(this, "id");
|
|
1907
|
+
s(this, "telemetryStreamActive", !1);
|
|
1908
|
+
s(this, "streamTelemetry", {});
|
|
1877
1909
|
this.peerUrl = t;
|
|
1878
1910
|
}
|
|
1879
1911
|
async getLatestTelemetry() {
|
|
1880
1912
|
this.telemetryStreamActive || this.subscribeToTelemetry();
|
|
1881
1913
|
const t = this.streamTelemetry;
|
|
1882
|
-
return Object.entries(t).map(([i,
|
|
1914
|
+
return Object.entries(t).map(([i, o]) => ({
|
|
1883
1915
|
deviceId: this.id,
|
|
1884
1916
|
streamName: i,
|
|
1885
1917
|
streamType: "json",
|
|
1886
|
-
currentValue:
|
|
1887
|
-
currentValueTime:
|
|
1918
|
+
currentValue: o,
|
|
1919
|
+
currentValueTime: o.timestamp,
|
|
1888
1920
|
tags: {}
|
|
1889
1921
|
}));
|
|
1890
1922
|
}
|
|
@@ -1901,8 +1933,8 @@ class lt extends Q {
|
|
|
1901
1933
|
}), n.addEventListener("readystatechange", (i) => {
|
|
1902
1934
|
n.readyState === XMLHttpRequest.DONE && this.handleXHRError("closed");
|
|
1903
1935
|
}), n.addEventListener("progress", (i) => {
|
|
1904
|
-
const
|
|
1905
|
-
t =
|
|
1936
|
+
const o = i.loaded, c = o - t;
|
|
1937
|
+
t = o, n.responseText.substr(-c).split(`
|
|
1906
1938
|
`).forEach((m) => {
|
|
1907
1939
|
var w;
|
|
1908
1940
|
if (m.length > 0) {
|
|
@@ -1971,11 +2003,11 @@ class lt extends Q {
|
|
|
1971
2003
|
if (t)
|
|
1972
2004
|
throw new Error(`Realtime connection hasn't been started for ${this.id}`);
|
|
1973
2005
|
}
|
|
1974
|
-
async sendCommand(t, n, i,
|
|
2006
|
+
async sendCommand(t, n, i, o) {
|
|
1975
2007
|
const c = {
|
|
1976
2008
|
value: n,
|
|
1977
2009
|
scrubberTime: (i || /* @__PURE__ */ new Date()).toISOString(),
|
|
1978
|
-
meta:
|
|
2010
|
+
meta: o
|
|
1979
2011
|
};
|
|
1980
2012
|
return await fetch(`${this.peerUrl}/v1/enqueue-command`, {
|
|
1981
2013
|
method: "POST",
|
|
@@ -1989,43 +2021,43 @@ class lt extends Q {
|
|
|
1989
2021
|
});
|
|
1990
2022
|
}
|
|
1991
2023
|
}
|
|
1992
|
-
async function
|
|
1993
|
-
if (!
|
|
2024
|
+
async function wt(a, e) {
|
|
2025
|
+
if (!r.token)
|
|
1994
2026
|
throw new Error("Not authenticated");
|
|
1995
2027
|
return await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
1996
2028
|
method: "PATCH",
|
|
1997
2029
|
body: JSON.stringify({ fleetId: e }),
|
|
1998
2030
|
headers: {
|
|
1999
2031
|
"Content-Type": "application/json",
|
|
2000
|
-
Authorization: "Bearer " +
|
|
2032
|
+
Authorization: "Bearer " + r.token
|
|
2001
2033
|
}
|
|
2002
2034
|
})).json();
|
|
2003
2035
|
}
|
|
2004
|
-
async function
|
|
2005
|
-
if (!
|
|
2036
|
+
async function pt(a) {
|
|
2037
|
+
if (!r.token)
|
|
2006
2038
|
throw new Error("Not authenticated");
|
|
2007
2039
|
return (await (await fetch(`${h}/v1/queries/queries`, {
|
|
2008
2040
|
method: "POST",
|
|
2009
2041
|
body: JSON.stringify(a),
|
|
2010
2042
|
headers: {
|
|
2011
2043
|
"Content-Type": "application/json",
|
|
2012
|
-
Authorization: "Bearer " +
|
|
2044
|
+
Authorization: "Bearer " + r.token
|
|
2013
2045
|
}
|
|
2014
2046
|
})).json()).aggregates;
|
|
2015
2047
|
}
|
|
2016
|
-
async function
|
|
2017
|
-
if (!
|
|
2048
|
+
async function yt(a) {
|
|
2049
|
+
if (!r.token)
|
|
2018
2050
|
throw new Error("Not authenticated");
|
|
2019
2051
|
await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
2020
2052
|
method: "DELETE",
|
|
2021
2053
|
headers: {
|
|
2022
2054
|
"Content-Type": "application/json",
|
|
2023
|
-
Authorization: "Bearer " +
|
|
2055
|
+
Authorization: "Bearer " + r.token
|
|
2024
2056
|
}
|
|
2025
2057
|
});
|
|
2026
2058
|
}
|
|
2027
|
-
async function
|
|
2028
|
-
if (!
|
|
2059
|
+
async function gt() {
|
|
2060
|
+
if (!r.token)
|
|
2029
2061
|
throw new Error("Not authenticated");
|
|
2030
2062
|
return (await (await fetch(
|
|
2031
2063
|
`${h}/v1/queries/analytics/streams`,
|
|
@@ -2033,13 +2065,13 @@ async function pt() {
|
|
|
2033
2065
|
method: "GET",
|
|
2034
2066
|
headers: {
|
|
2035
2067
|
"Content-Type": "application/json",
|
|
2036
|
-
Authorization: "Bearer " +
|
|
2068
|
+
Authorization: "Bearer " + r.token
|
|
2037
2069
|
}
|
|
2038
2070
|
}
|
|
2039
2071
|
)).json()).items;
|
|
2040
2072
|
}
|
|
2041
|
-
async function
|
|
2042
|
-
if (!
|
|
2073
|
+
async function vt() {
|
|
2074
|
+
if (!r.token)
|
|
2043
2075
|
throw new Error("Not authenticated");
|
|
2044
2076
|
return (await (await fetch(
|
|
2045
2077
|
`${h}/v1/admin/analytics-modules`,
|
|
@@ -2047,39 +2079,39 @@ async function yt() {
|
|
|
2047
2079
|
method: "GET",
|
|
2048
2080
|
headers: {
|
|
2049
2081
|
"Content-Type": "application/json",
|
|
2050
|
-
Authorization: "Bearer " +
|
|
2082
|
+
Authorization: "Bearer " + r.token
|
|
2051
2083
|
}
|
|
2052
2084
|
}
|
|
2053
2085
|
)).json()).items;
|
|
2054
2086
|
}
|
|
2055
|
-
async function
|
|
2056
|
-
if (!
|
|
2087
|
+
async function Tt(a) {
|
|
2088
|
+
if (!r.token)
|
|
2057
2089
|
throw new Error("Not authenticated");
|
|
2058
2090
|
return await (await fetch(`${h}/v1/queries/analytics/rows`, {
|
|
2059
2091
|
method: "POST",
|
|
2060
2092
|
body: JSON.stringify(a),
|
|
2061
2093
|
headers: {
|
|
2062
2094
|
"Content-Type": "application/json",
|
|
2063
|
-
Authorization: "Bearer " +
|
|
2095
|
+
Authorization: "Bearer " + r.token
|
|
2064
2096
|
}
|
|
2065
2097
|
})).json();
|
|
2066
2098
|
}
|
|
2067
|
-
async function
|
|
2068
|
-
if (!
|
|
2099
|
+
async function se(a) {
|
|
2100
|
+
if (!r.token)
|
|
2069
2101
|
throw new Error("Not authenticated");
|
|
2070
2102
|
return (await (await fetch(`${h}/v1/admin/devices/query`, {
|
|
2071
2103
|
method: "POST",
|
|
2072
2104
|
body: JSON.stringify(a),
|
|
2073
2105
|
headers: {
|
|
2074
2106
|
"Content-Type": "application/json",
|
|
2075
|
-
Authorization: "Bearer " +
|
|
2107
|
+
Authorization: "Bearer " + r.token
|
|
2076
2108
|
}
|
|
2077
2109
|
})).json()).items.map(
|
|
2078
2110
|
(n) => new S(n.id, n.name, n.organizationId, n.tags)
|
|
2079
2111
|
);
|
|
2080
2112
|
}
|
|
2081
|
-
async function
|
|
2082
|
-
if (!
|
|
2113
|
+
async function Ct() {
|
|
2114
|
+
if (!r.token)
|
|
2083
2115
|
throw new Error("Not authenticated");
|
|
2084
2116
|
let a = new URLSearchParams("");
|
|
2085
2117
|
typeof window < "u" && window.location && (a = new URLSearchParams(window.location.search));
|
|
@@ -2091,37 +2123,37 @@ async function vt() {
|
|
|
2091
2123
|
{
|
|
2092
2124
|
headers: {
|
|
2093
2125
|
"Content-Type": "application/json",
|
|
2094
|
-
Authorization: "Bearer " +
|
|
2126
|
+
Authorization: "Bearer " + r.token
|
|
2095
2127
|
}
|
|
2096
2128
|
}
|
|
2097
2129
|
), { tagKey: n, tagValue: i } = await t.json();
|
|
2098
|
-
return await
|
|
2130
|
+
return await se({
|
|
2099
2131
|
tags: { [n]: [i] },
|
|
2100
2132
|
enabled: !0,
|
|
2101
2133
|
type: "default"
|
|
2102
2134
|
});
|
|
2103
2135
|
}
|
|
2104
|
-
async function
|
|
2105
|
-
if (!
|
|
2136
|
+
async function St(a) {
|
|
2137
|
+
if (!r.token)
|
|
2106
2138
|
throw new Error("Not authenticated");
|
|
2107
2139
|
const t = await (await fetch(`${h}/v1/admin/devices/${a}`, {
|
|
2108
2140
|
method: "GET",
|
|
2109
2141
|
headers: {
|
|
2110
2142
|
"Content-Type": "application/json",
|
|
2111
|
-
Authorization: "Bearer " +
|
|
2143
|
+
Authorization: "Bearer " + r.token
|
|
2112
2144
|
}
|
|
2113
2145
|
})).json(), n = t.name;
|
|
2114
2146
|
return new S(a, n, t.organizationId, t.tags);
|
|
2115
2147
|
}
|
|
2116
2148
|
async function M() {
|
|
2117
|
-
if (!
|
|
2149
|
+
if (!r.token)
|
|
2118
2150
|
throw new Error("Not authenticated");
|
|
2119
2151
|
const e = await (await fetch(`${h}/v1/admin/device-details/query`, {
|
|
2120
2152
|
method: "POST",
|
|
2121
2153
|
body: JSON.stringify({ enabled: !0, type: "default" }),
|
|
2122
2154
|
headers: {
|
|
2123
2155
|
"Content-Type": "application/json",
|
|
2124
|
-
Authorization: "Bearer " +
|
|
2156
|
+
Authorization: "Bearer " + r.token
|
|
2125
2157
|
}
|
|
2126
2158
|
})).json();
|
|
2127
2159
|
return e.items, e.items.map(
|
|
@@ -2133,8 +2165,8 @@ async function M() {
|
|
|
2133
2165
|
)
|
|
2134
2166
|
);
|
|
2135
2167
|
}
|
|
2136
|
-
async function
|
|
2137
|
-
if (!
|
|
2168
|
+
async function Et(a) {
|
|
2169
|
+
if (!r.token)
|
|
2138
2170
|
throw new Error("Not authenticated");
|
|
2139
2171
|
return (await (await fetch(
|
|
2140
2172
|
`${h}/v1/admin/events/query/id=${a}`,
|
|
@@ -2142,12 +2174,12 @@ async function Ct(a) {
|
|
|
2142
2174
|
method: "GET",
|
|
2143
2175
|
headers: {
|
|
2144
2176
|
"Content-Type": "application/json",
|
|
2145
|
-
Authorization: "Bearer " +
|
|
2177
|
+
Authorization: "Bearer " + r.token
|
|
2146
2178
|
}
|
|
2147
2179
|
}
|
|
2148
2180
|
)).json()).items;
|
|
2149
2181
|
}
|
|
2150
|
-
async function
|
|
2182
|
+
async function kt(a) {
|
|
2151
2183
|
const t = await (await fetch(`${h}/v1/admin/files/query`, {
|
|
2152
2184
|
method: "POST",
|
|
2153
2185
|
body: JSON.stringify({
|
|
@@ -2155,37 +2187,37 @@ async function St(a) {
|
|
|
2155
2187
|
}),
|
|
2156
2188
|
headers: {
|
|
2157
2189
|
"Content-Type": "application/json",
|
|
2158
|
-
Authorization: "Bearer " +
|
|
2190
|
+
Authorization: "Bearer " + r.token
|
|
2159
2191
|
}
|
|
2160
2192
|
})).json();
|
|
2161
2193
|
if (t.fileUrls.length === 0)
|
|
2162
2194
|
throw new Error("File not found");
|
|
2163
2195
|
return t.fileUrls[0];
|
|
2164
2196
|
}
|
|
2165
|
-
async function
|
|
2166
|
-
if (!
|
|
2197
|
+
async function Ot(a) {
|
|
2198
|
+
if (!r.token)
|
|
2167
2199
|
throw new Error("Not authenticated");
|
|
2168
2200
|
return await (await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
2169
2201
|
method: "GET",
|
|
2170
2202
|
headers: {
|
|
2171
2203
|
"Content-Type": "application/json",
|
|
2172
|
-
Authorization: "Bearer " +
|
|
2204
|
+
Authorization: "Bearer " + r.token
|
|
2173
2205
|
}
|
|
2174
2206
|
})).json();
|
|
2175
2207
|
}
|
|
2176
|
-
async function
|
|
2177
|
-
if (!
|
|
2208
|
+
async function Rt(a) {
|
|
2209
|
+
if (!r.token)
|
|
2178
2210
|
throw new Error("Not authenticated");
|
|
2179
2211
|
return (await (await fetch(`${h}/v1/admin/fleets/${a}/devices`, {
|
|
2180
2212
|
method: "GET",
|
|
2181
2213
|
headers: {
|
|
2182
2214
|
"Content-Type": "application/json",
|
|
2183
|
-
Authorization: "Bearer " +
|
|
2215
|
+
Authorization: "Bearer " + r.token
|
|
2184
2216
|
}
|
|
2185
2217
|
})).json()).items;
|
|
2186
2218
|
}
|
|
2187
|
-
async function
|
|
2188
|
-
if (!
|
|
2219
|
+
async function At() {
|
|
2220
|
+
if (!r.token)
|
|
2189
2221
|
throw new Error("Not authenticated");
|
|
2190
2222
|
return (await (await fetch(
|
|
2191
2223
|
`${h}/v1/admin/intervention-requests`,
|
|
@@ -2193,12 +2225,12 @@ async function Ot() {
|
|
|
2193
2225
|
method: "GET",
|
|
2194
2226
|
headers: {
|
|
2195
2227
|
"Content-Type": "application/json",
|
|
2196
|
-
Authorization: "Bearer " +
|
|
2228
|
+
Authorization: "Bearer " + r.token
|
|
2197
2229
|
}
|
|
2198
2230
|
}
|
|
2199
2231
|
)).json()).items;
|
|
2200
2232
|
}
|
|
2201
|
-
async function
|
|
2233
|
+
async function bt(...a) {
|
|
2202
2234
|
const e = a.flat().filter((i) => !!i);
|
|
2203
2235
|
return e.length === 0 ? [] : (await (await fetch(
|
|
2204
2236
|
`${h}/v1/queries/stream-current-value`,
|
|
@@ -2209,52 +2241,52 @@ async function Rt(...a) {
|
|
|
2209
2241
|
}),
|
|
2210
2242
|
headers: {
|
|
2211
2243
|
"Content-Type": "application/json",
|
|
2212
|
-
Authorization: "Bearer " +
|
|
2244
|
+
Authorization: "Bearer " + r.token
|
|
2213
2245
|
}
|
|
2214
2246
|
}
|
|
2215
2247
|
)).json()).items;
|
|
2216
2248
|
}
|
|
2217
|
-
async function
|
|
2218
|
-
if (!
|
|
2249
|
+
async function Dt() {
|
|
2250
|
+
if (!r.token)
|
|
2219
2251
|
throw new Error("Not authenticated");
|
|
2220
2252
|
const t = (await (await fetch(`${h}/v1/queries/online-devices`, {
|
|
2221
2253
|
method: "GET",
|
|
2222
2254
|
headers: {
|
|
2223
2255
|
"Content-Type": "application/json",
|
|
2224
|
-
Authorization: "Bearer " +
|
|
2256
|
+
Authorization: "Bearer " + r.token
|
|
2225
2257
|
}
|
|
2226
2258
|
})).json()).items;
|
|
2227
2259
|
return (await M()).filter((i) => t.includes(i.id));
|
|
2228
2260
|
}
|
|
2229
|
-
async function
|
|
2230
|
-
if (!
|
|
2261
|
+
async function jt() {
|
|
2262
|
+
if (!r.token)
|
|
2231
2263
|
throw new Error("Not authenticated");
|
|
2232
2264
|
const t = (await (await fetch(`${h}/v1/signaling/peers`, {
|
|
2233
2265
|
method: "GET",
|
|
2234
2266
|
headers: {
|
|
2235
2267
|
"Content-Type": "application/json",
|
|
2236
|
-
Authorization: "Bearer " +
|
|
2268
|
+
Authorization: "Bearer " + r.token
|
|
2237
2269
|
}
|
|
2238
2270
|
})).json()).items.map(
|
|
2239
2271
|
(i) => i.deviceId
|
|
2240
2272
|
);
|
|
2241
2273
|
return (await M()).filter((i) => t.includes(i.id));
|
|
2242
2274
|
}
|
|
2243
|
-
async function
|
|
2244
|
-
if (!
|
|
2275
|
+
async function Nt() {
|
|
2276
|
+
if (!r.token)
|
|
2245
2277
|
throw new Error("Not authenticated");
|
|
2246
2278
|
return (await (await fetch(`${h}/v1/admin/streams`, {
|
|
2247
2279
|
method: "GET",
|
|
2248
2280
|
headers: {
|
|
2249
2281
|
"Content-Type": "application/json",
|
|
2250
|
-
Authorization: "Bearer " +
|
|
2282
|
+
Authorization: "Bearer " + r.token
|
|
2251
2283
|
}
|
|
2252
2284
|
})).json()).items.filter(
|
|
2253
2285
|
(t) => t.enabled
|
|
2254
2286
|
);
|
|
2255
2287
|
}
|
|
2256
|
-
async function
|
|
2257
|
-
if (!
|
|
2288
|
+
async function Pt(a) {
|
|
2289
|
+
if (!r.token)
|
|
2258
2290
|
throw new Error("Not authenticated");
|
|
2259
2291
|
return await (await fetch(
|
|
2260
2292
|
`${h}/v1/queries/analytics/task-report-rows`,
|
|
@@ -2263,13 +2295,13 @@ async function jt(a) {
|
|
|
2263
2295
|
body: JSON.stringify(a),
|
|
2264
2296
|
headers: {
|
|
2265
2297
|
"Content-Type": "application/json",
|
|
2266
|
-
Authorization: "Bearer " +
|
|
2298
|
+
Authorization: "Bearer " + r.token
|
|
2267
2299
|
}
|
|
2268
2300
|
}
|
|
2269
2301
|
)).json();
|
|
2270
2302
|
}
|
|
2271
|
-
async function
|
|
2272
|
-
if (!
|
|
2303
|
+
async function Lt() {
|
|
2304
|
+
if (!r.token)
|
|
2273
2305
|
throw new Error("Not authenticated");
|
|
2274
2306
|
return (await (await fetch(
|
|
2275
2307
|
`${h}/v1/queries/analytics/task-reports`,
|
|
@@ -2277,36 +2309,36 @@ async function Nt() {
|
|
|
2277
2309
|
method: "GET",
|
|
2278
2310
|
headers: {
|
|
2279
2311
|
"Content-Type": "application/json",
|
|
2280
|
-
Authorization: "Bearer " +
|
|
2312
|
+
Authorization: "Bearer " + r.token
|
|
2281
2313
|
}
|
|
2282
2314
|
}
|
|
2283
2315
|
)).json()).items;
|
|
2284
2316
|
}
|
|
2285
|
-
async function
|
|
2286
|
-
if (!
|
|
2317
|
+
async function It() {
|
|
2318
|
+
if (!r.token)
|
|
2287
2319
|
throw new Error("Not authenticated");
|
|
2288
2320
|
return (await (await fetch(`${h}/v1/admin/fleets`, {
|
|
2289
2321
|
method: "GET",
|
|
2290
2322
|
headers: {
|
|
2291
2323
|
"Content-Type": "application/json",
|
|
2292
|
-
Authorization: "Bearer " +
|
|
2324
|
+
Authorization: "Bearer " + r.token
|
|
2293
2325
|
}
|
|
2294
2326
|
})).json()).items;
|
|
2295
2327
|
}
|
|
2296
|
-
async function
|
|
2297
|
-
if (!
|
|
2328
|
+
async function _t(a, e) {
|
|
2329
|
+
if (!r.token)
|
|
2298
2330
|
throw new Error("Not authenticated");
|
|
2299
2331
|
return await (await fetch(`${h}/v1/admin/fleets/${a}`, {
|
|
2300
2332
|
method: "PATCH",
|
|
2301
2333
|
body: JSON.stringify(e),
|
|
2302
2334
|
headers: {
|
|
2303
2335
|
"Content-Type": "application/json",
|
|
2304
|
-
Authorization: "Bearer " +
|
|
2336
|
+
Authorization: "Bearer " + r.token
|
|
2305
2337
|
}
|
|
2306
2338
|
})).json();
|
|
2307
2339
|
}
|
|
2308
|
-
async function
|
|
2309
|
-
if (!
|
|
2340
|
+
async function $t(a) {
|
|
2341
|
+
if (!r.token)
|
|
2310
2342
|
throw new Error("Not authenticated");
|
|
2311
2343
|
return await (await fetch(
|
|
2312
2344
|
`${h}/v1/admin/streams/${a.id}`,
|
|
@@ -2315,60 +2347,60 @@ async function It(a) {
|
|
|
2315
2347
|
body: JSON.stringify(a),
|
|
2316
2348
|
headers: {
|
|
2317
2349
|
"Content-Type": "application/json",
|
|
2318
|
-
Authorization: "Bearer " +
|
|
2350
|
+
Authorization: "Bearer " + r.token
|
|
2319
2351
|
}
|
|
2320
2352
|
}
|
|
2321
2353
|
)).json();
|
|
2322
2354
|
}
|
|
2323
|
-
async function
|
|
2324
|
-
if (!
|
|
2355
|
+
async function zt(a) {
|
|
2356
|
+
if (!r.token)
|
|
2325
2357
|
throw new Error("Not authenticated");
|
|
2326
2358
|
return await (await fetch(`${h}/v1/admin/views/${a.id}`, {
|
|
2327
2359
|
method: "PATCH",
|
|
2328
2360
|
body: JSON.stringify(a),
|
|
2329
2361
|
headers: {
|
|
2330
2362
|
"Content-Type": "application/json",
|
|
2331
|
-
Authorization: "Bearer " +
|
|
2363
|
+
Authorization: "Bearer " + r.token
|
|
2332
2364
|
}
|
|
2333
2365
|
})).json();
|
|
2334
2366
|
}
|
|
2335
|
-
async function
|
|
2336
|
-
if (!
|
|
2367
|
+
async function Bt(a) {
|
|
2368
|
+
if (!r.token)
|
|
2337
2369
|
throw new Error("Not authenticated");
|
|
2338
2370
|
return await (await fetch(`${h}/v1/queries/analytics`, {
|
|
2339
2371
|
method: "POST",
|
|
2340
2372
|
body: JSON.stringify(a),
|
|
2341
2373
|
headers: {
|
|
2342
2374
|
"Content-Type": "application/json",
|
|
2343
|
-
Authorization: "Bearer " +
|
|
2375
|
+
Authorization: "Bearer " + r.token
|
|
2344
2376
|
}
|
|
2345
2377
|
})).json();
|
|
2346
2378
|
}
|
|
2347
|
-
async function
|
|
2348
|
-
if (!
|
|
2379
|
+
async function Mt(a) {
|
|
2380
|
+
if (!r.token)
|
|
2349
2381
|
throw new Error("Not authenticated");
|
|
2350
2382
|
return await (await fetch(`${h}/v1/admin/fleets`, {
|
|
2351
2383
|
method: "POST",
|
|
2352
2384
|
body: JSON.stringify(a),
|
|
2353
2385
|
headers: {
|
|
2354
2386
|
"Content-Type": "application/json",
|
|
2355
|
-
Authorization: "Bearer " +
|
|
2387
|
+
Authorization: "Bearer " + r.token
|
|
2356
2388
|
}
|
|
2357
2389
|
})).json();
|
|
2358
2390
|
}
|
|
2359
|
-
async function
|
|
2360
|
-
if (!
|
|
2391
|
+
async function qt() {
|
|
2392
|
+
if (!r.token)
|
|
2361
2393
|
throw new Error("Not authenticated");
|
|
2362
2394
|
return (await (await fetch(`${h}/v1/admin/event-trigger-groups`, {
|
|
2363
2395
|
method: "GET",
|
|
2364
2396
|
headers: {
|
|
2365
2397
|
"Content-Type": "application/json",
|
|
2366
|
-
Authorization: "Bearer " +
|
|
2398
|
+
Authorization: "Bearer " + r.token
|
|
2367
2399
|
}
|
|
2368
2400
|
})).json()).items;
|
|
2369
2401
|
}
|
|
2370
|
-
async function
|
|
2371
|
-
if (!
|
|
2402
|
+
async function xt(a) {
|
|
2403
|
+
if (!r.token)
|
|
2372
2404
|
throw new Error("Not authenticated");
|
|
2373
2405
|
return await (await fetch(
|
|
2374
2406
|
`${h}/v1/admin/event-trigger-groups/${a}`,
|
|
@@ -2376,13 +2408,13 @@ async function Mt(a) {
|
|
|
2376
2408
|
method: "GET",
|
|
2377
2409
|
headers: {
|
|
2378
2410
|
"Content-Type": "application/json",
|
|
2379
|
-
Authorization: "Bearer " +
|
|
2411
|
+
Authorization: "Bearer " + r.token
|
|
2380
2412
|
}
|
|
2381
2413
|
}
|
|
2382
2414
|
)).json();
|
|
2383
2415
|
}
|
|
2384
|
-
async function
|
|
2385
|
-
if (!
|
|
2416
|
+
async function Ut(a, e) {
|
|
2417
|
+
if (!r.token)
|
|
2386
2418
|
throw new Error("Not authenticated");
|
|
2387
2419
|
return await (await fetch(
|
|
2388
2420
|
`${h}/v1/admin/event-trigger-groups/${a}`,
|
|
@@ -2391,7 +2423,7 @@ async function qt(a, e) {
|
|
|
2391
2423
|
body: JSON.stringify(e),
|
|
2392
2424
|
headers: {
|
|
2393
2425
|
"Content-Type": "application/json",
|
|
2394
|
-
Authorization: "Bearer " +
|
|
2426
|
+
Authorization: "Bearer " + r.token
|
|
2395
2427
|
}
|
|
2396
2428
|
}
|
|
2397
2429
|
)).json();
|
|
@@ -2401,7 +2433,7 @@ const E = class {
|
|
|
2401
2433
|
E.defaultDeviceId = e;
|
|
2402
2434
|
}
|
|
2403
2435
|
static async getCurrentDevice() {
|
|
2404
|
-
if (!
|
|
2436
|
+
if (!r.token)
|
|
2405
2437
|
throw new Error("Not authenticated");
|
|
2406
2438
|
if (!E.defaultDeviceId)
|
|
2407
2439
|
throw new Error("No known default device");
|
|
@@ -2411,48 +2443,48 @@ const E = class {
|
|
|
2411
2443
|
method: "POST",
|
|
2412
2444
|
headers: {
|
|
2413
2445
|
"Content-Type": "application/json",
|
|
2414
|
-
Authorization: "Bearer " +
|
|
2446
|
+
Authorization: "Bearer " + r.token
|
|
2415
2447
|
}
|
|
2416
2448
|
}
|
|
2417
2449
|
)).json()).items.find(
|
|
2418
2450
|
(c) => c.id === E.defaultDeviceId
|
|
2419
|
-
), i = n.name,
|
|
2451
|
+
), i = n.name, o = new S(
|
|
2420
2452
|
E.defaultDeviceId,
|
|
2421
2453
|
i,
|
|
2422
|
-
f(
|
|
2454
|
+
f(r.currentOrganization),
|
|
2423
2455
|
n.tags
|
|
2424
2456
|
);
|
|
2425
|
-
return E.knownContext.push(new WeakRef(
|
|
2457
|
+
return E.knownContext.push(new WeakRef(o)), o;
|
|
2426
2458
|
}
|
|
2427
2459
|
static async getPeerDevice(e) {
|
|
2428
|
-
const t = new
|
|
2460
|
+
const t = new ft(e);
|
|
2429
2461
|
return t.id = await t.getDeviceId(), t;
|
|
2430
2462
|
}
|
|
2431
2463
|
static async getDevice(e) {
|
|
2432
|
-
const t = await
|
|
2464
|
+
const t = await St(e);
|
|
2433
2465
|
return E.knownContext.push(new WeakRef(t)), t;
|
|
2434
2466
|
}
|
|
2435
2467
|
};
|
|
2436
|
-
let
|
|
2437
|
-
|
|
2438
|
-
class
|
|
2468
|
+
let l = E;
|
|
2469
|
+
s(l, "defaultDeviceId"), s(l, "knownContext", []), s(l, "createFleet", Mt), s(l, "listFleets", It), s(l, "getFleet", Ot), s(l, "patchFleet", _t), s(l, "deleteFleet", yt), s(l, "addDeviceToFleet", wt), s(l, "getFleetDevices", Rt), s(l, "aggregateTelemetry", pt), s(l, "createShareLink", ee), s(l, "eventsCounter", ne), s(l, "getAnalyticStreams", gt), s(l, "getAnalyticsModules", vt), s(l, "getAnalyticsRows", Tt), s(l, "getAnnotationCount", B), s(l, "getAnnotationCountByIntervals", ae), s(l, "getCurrentGroup", Ct), s(l, "getDevices", M), s(l, "getEvent", Et), s(l, "getFileUrl", kt), s(l, "getInterventions", At), s(l, "getLatestTelemetry", bt), s(l, "getOnlineDevices", Dt), s(l, "getPeers", re), s(l, "getRealtimeDevices", jt), s(l, "getRealtimeSessions", oe), s(l, "getStreams", Nt), s(l, "getTaskReportRows", Pt), s(l, "getTaskReportTables", Lt), s(l, "getTelemetry", ie), s(l, "getViews", Z), s(l, "patchStream", $t), s(l, "patchView", zt), s(l, "queryAnalytics", Bt), s(l, "queryDevices", se), s(l, "queryEvents", z), s(l, "queryTelemetry", _), s(l, "getAllEventTriggerGroup", qt), s(l, "getEventTriggerGroup", xt), s(l, "patchEventTriggergroup", Ut);
|
|
2470
|
+
class an {
|
|
2439
2471
|
static async set(e, t, n) {
|
|
2440
2472
|
try {
|
|
2441
2473
|
const i = await fetch(h + "/v1/admin/key-value", {
|
|
2442
2474
|
method: "POST",
|
|
2443
2475
|
body: JSON.stringify({
|
|
2444
|
-
organizationId: f(
|
|
2476
|
+
organizationId: f(r.currentUser).organizationId,
|
|
2445
2477
|
key: e,
|
|
2446
2478
|
value: t,
|
|
2447
2479
|
tags: n
|
|
2448
2480
|
}),
|
|
2449
2481
|
headers: {
|
|
2450
2482
|
"Content-Type": "application/json",
|
|
2451
|
-
Authorization: "Bearer " +
|
|
2483
|
+
Authorization: "Bearer " + r.token
|
|
2452
2484
|
}
|
|
2453
|
-
}),
|
|
2485
|
+
}), o = await i.json();
|
|
2454
2486
|
if (i.status !== 200)
|
|
2455
|
-
throw new Error(
|
|
2487
|
+
throw new Error(o.message);
|
|
2456
2488
|
} catch (i) {
|
|
2457
2489
|
throw i;
|
|
2458
2490
|
}
|
|
@@ -2465,7 +2497,7 @@ class tn {
|
|
|
2465
2497
|
method: "GET",
|
|
2466
2498
|
headers: {
|
|
2467
2499
|
"Content-Type": "application/json",
|
|
2468
|
-
Authorization: "Bearer " +
|
|
2500
|
+
Authorization: "Bearer " + r.token
|
|
2469
2501
|
}
|
|
2470
2502
|
}
|
|
2471
2503
|
), n = await t.json();
|
|
@@ -2482,7 +2514,7 @@ class tn {
|
|
|
2482
2514
|
method: "GET",
|
|
2483
2515
|
headers: {
|
|
2484
2516
|
"Content-Type": "application/json",
|
|
2485
|
-
Authorization: "Bearer " +
|
|
2517
|
+
Authorization: "Bearer " + r.token
|
|
2486
2518
|
}
|
|
2487
2519
|
}), t = await e.json();
|
|
2488
2520
|
if (e.status !== 200)
|
|
@@ -2500,7 +2532,7 @@ class tn {
|
|
|
2500
2532
|
method: "DELETE",
|
|
2501
2533
|
headers: {
|
|
2502
2534
|
"Content-Type": "application/json",
|
|
2503
|
-
Authorization: "Bearer " +
|
|
2535
|
+
Authorization: "Bearer " + r.token
|
|
2504
2536
|
}
|
|
2505
2537
|
}
|
|
2506
2538
|
)).ok)
|
|
@@ -2519,7 +2551,7 @@ class tn {
|
|
|
2519
2551
|
body: JSON.stringify({ keys: e }),
|
|
2520
2552
|
headers: {
|
|
2521
2553
|
"Content-Type": "application/json",
|
|
2522
|
-
Authorization: "Bearer " +
|
|
2554
|
+
Authorization: "Bearer " + r.token
|
|
2523
2555
|
}
|
|
2524
2556
|
}
|
|
2525
2557
|
);
|
|
@@ -2531,37 +2563,37 @@ class tn {
|
|
|
2531
2563
|
}
|
|
2532
2564
|
}
|
|
2533
2565
|
}
|
|
2534
|
-
function
|
|
2535
|
-
return Uint8Array.from(
|
|
2566
|
+
function Jt(a) {
|
|
2567
|
+
return Uint8Array.from(G(a), (e) => e.charCodeAt(0));
|
|
2536
2568
|
}
|
|
2537
|
-
function
|
|
2569
|
+
function V() {
|
|
2538
2570
|
const { userAgent: a } = navigator;
|
|
2539
2571
|
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";
|
|
2540
2572
|
}
|
|
2541
|
-
const
|
|
2542
|
-
class
|
|
2573
|
+
const Vt = "audio-chunk";
|
|
2574
|
+
class on {
|
|
2543
2575
|
constructor(e, t) {
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2576
|
+
s(this, "muted", !1);
|
|
2577
|
+
s(this, "hasReceivedData", !1);
|
|
2578
|
+
s(this, "audioContext");
|
|
2579
|
+
s(this, "chunks", []);
|
|
2580
|
+
s(this, "isPlaying", !1);
|
|
2581
|
+
s(this, "startTime", 0);
|
|
2582
|
+
s(this, "lastChunkOffset", 0);
|
|
2583
|
+
s(this, "bufferSize", 3);
|
|
2584
|
+
s(this, "receive", async (e) => {
|
|
2553
2585
|
var c;
|
|
2554
2586
|
const t = (c = e.payload.audioChunk) == null ? void 0 : c.chunk_data;
|
|
2555
2587
|
if (!t)
|
|
2556
2588
|
return;
|
|
2557
2589
|
this.hasReceivedData || (this.hasReceivedData = !0);
|
|
2558
2590
|
const { audioContext: n, muted: i } = this;
|
|
2559
|
-
if (!n || e.header.stream.streamType !==
|
|
2591
|
+
if (!n || e.header.stream.streamType !== Vt || i !== !1)
|
|
2560
2592
|
return;
|
|
2561
|
-
const
|
|
2593
|
+
const o = Jt(t);
|
|
2562
2594
|
try {
|
|
2563
2595
|
await n.decodeAudioData(
|
|
2564
|
-
|
|
2596
|
+
o.buffer,
|
|
2565
2597
|
this.scheduleChunk
|
|
2566
2598
|
);
|
|
2567
2599
|
} catch (d) {
|
|
@@ -2571,7 +2603,7 @@ class nn {
|
|
|
2571
2603
|
), this.changeAudioWireFormat("wav");
|
|
2572
2604
|
}
|
|
2573
2605
|
});
|
|
2574
|
-
|
|
2606
|
+
s(this, "scheduleChunk", (e) => {
|
|
2575
2607
|
const { audioContext: t } = this;
|
|
2576
2608
|
if (!t)
|
|
2577
2609
|
return;
|
|
@@ -2581,9 +2613,9 @@ class nn {
|
|
|
2581
2613
|
const n = this.createChunk(e);
|
|
2582
2614
|
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));
|
|
2583
2615
|
});
|
|
2584
|
-
this.device = e, this.stream = t, this.device.startListeningToRealtimeDataStream(t), this.device.addRealtimeListener((i,
|
|
2585
|
-
this.receive(
|
|
2586
|
-
}),
|
|
2616
|
+
this.device = e, this.stream = t, this.device.startListeningToRealtimeDataStream(t), this.device.addRealtimeListener((i, o) => {
|
|
2617
|
+
this.receive(o);
|
|
2618
|
+
}), V() === "Safari" || V() === "IE" ? this.changeAudioWireFormat("wav") : this.changeAudioWireFormat("opus");
|
|
2587
2619
|
const n = window.AudioContext || window.webkitAudioContext;
|
|
2588
2620
|
this.audioContext = new n();
|
|
2589
2621
|
}
|
|
@@ -2611,66 +2643,66 @@ class nn {
|
|
|
2611
2643
|
(async () => await this.device.changeStreamAudioType(t.name, e))();
|
|
2612
2644
|
}
|
|
2613
2645
|
}
|
|
2614
|
-
class
|
|
2646
|
+
class rn {
|
|
2615
2647
|
static async listAccounts() {
|
|
2616
|
-
if (!
|
|
2648
|
+
if (!r.token)
|
|
2617
2649
|
throw new Error("Not authenticated");
|
|
2618
2650
|
return (await (await fetch(`${h}/v1/admin/accounts`, {
|
|
2619
2651
|
method: "GET",
|
|
2620
2652
|
headers: {
|
|
2621
2653
|
"Content-Type": "application/json",
|
|
2622
|
-
Authorization: "Bearer " +
|
|
2654
|
+
Authorization: "Bearer " + r.token
|
|
2623
2655
|
}
|
|
2624
2656
|
})).json()).items;
|
|
2625
2657
|
}
|
|
2626
2658
|
static async createAccounts(e) {
|
|
2627
|
-
if (!
|
|
2659
|
+
if (!r.token)
|
|
2628
2660
|
throw new Error("Not authenticated");
|
|
2629
2661
|
return await (await fetch(`${h}/v1/admin/accounts`, {
|
|
2630
2662
|
method: "POST",
|
|
2631
2663
|
body: JSON.stringify(e),
|
|
2632
2664
|
headers: {
|
|
2633
2665
|
"Content-Type": "application/json",
|
|
2634
|
-
Authorization: "Bearer " +
|
|
2666
|
+
Authorization: "Bearer " + r.token
|
|
2635
2667
|
}
|
|
2636
2668
|
})).json();
|
|
2637
2669
|
}
|
|
2638
2670
|
static async getAccount(e) {
|
|
2639
|
-
if (!
|
|
2671
|
+
if (!r.token)
|
|
2640
2672
|
throw new Error("Not authenticated");
|
|
2641
2673
|
return await (await fetch(`${h}/v1/admin/accounts/${e}`, {
|
|
2642
2674
|
method: "GET",
|
|
2643
2675
|
headers: {
|
|
2644
2676
|
"Content-Type": "application/json",
|
|
2645
|
-
Authorization: "Bearer " +
|
|
2677
|
+
Authorization: "Bearer " + r.token
|
|
2646
2678
|
}
|
|
2647
2679
|
})).json();
|
|
2648
2680
|
}
|
|
2649
2681
|
static async patchAccount(e, t) {
|
|
2650
|
-
if (!
|
|
2682
|
+
if (!r.token)
|
|
2651
2683
|
throw new Error("Not authenticated");
|
|
2652
2684
|
return await (await fetch(`${h}/v1/admin/accounts/${e}`, {
|
|
2653
2685
|
method: "PATCH",
|
|
2654
2686
|
body: JSON.stringify(t),
|
|
2655
2687
|
headers: {
|
|
2656
2688
|
"Content-Type": "application/json",
|
|
2657
|
-
Authorization: "Bearer " +
|
|
2689
|
+
Authorization: "Bearer " + r.token
|
|
2658
2690
|
}
|
|
2659
2691
|
})).json();
|
|
2660
2692
|
}
|
|
2661
2693
|
static async deleteAccount(e) {
|
|
2662
|
-
if (!
|
|
2694
|
+
if (!r.token)
|
|
2663
2695
|
throw new Error("Not authenticated");
|
|
2664
2696
|
await fetch(`${h}/v1/admin/accounts/${e}`, {
|
|
2665
2697
|
method: "DELETE",
|
|
2666
2698
|
headers: {
|
|
2667
2699
|
"Content-Type": "application/json",
|
|
2668
|
-
Authorization: "Bearer " +
|
|
2700
|
+
Authorization: "Bearer " + r.token
|
|
2669
2701
|
}
|
|
2670
2702
|
});
|
|
2671
2703
|
}
|
|
2672
2704
|
static async getAccountTree(e) {
|
|
2673
|
-
if (!
|
|
2705
|
+
if (!r.token)
|
|
2674
2706
|
throw new Error("Not authenticated");
|
|
2675
2707
|
return await (await fetch(
|
|
2676
2708
|
`${h}/v1/admin/accounts/${e}/tree`,
|
|
@@ -2678,139 +2710,139 @@ class an {
|
|
|
2678
2710
|
method: "GET",
|
|
2679
2711
|
headers: {
|
|
2680
2712
|
"Content-Type": "application/json",
|
|
2681
|
-
Authorization: "Bearer " +
|
|
2713
|
+
Authorization: "Bearer " + r.token
|
|
2682
2714
|
}
|
|
2683
2715
|
}
|
|
2684
2716
|
)).json();
|
|
2685
2717
|
}
|
|
2686
2718
|
}
|
|
2687
|
-
class
|
|
2719
|
+
class sn {
|
|
2688
2720
|
static async listRoles() {
|
|
2689
|
-
if (!
|
|
2721
|
+
if (!r.token)
|
|
2690
2722
|
throw new Error("Not authenticated");
|
|
2691
2723
|
return (await (await fetch(`${h}/v1/admin/roles`, {
|
|
2692
2724
|
method: "GET",
|
|
2693
2725
|
headers: {
|
|
2694
2726
|
"Content-Type": "application/json",
|
|
2695
|
-
Authorization: "Bearer " +
|
|
2727
|
+
Authorization: "Bearer " + r.token
|
|
2696
2728
|
}
|
|
2697
2729
|
})).json()).items;
|
|
2698
2730
|
}
|
|
2699
2731
|
static async createRole(e) {
|
|
2700
|
-
if (!
|
|
2732
|
+
if (!r.token)
|
|
2701
2733
|
throw new Error("Not authenticated");
|
|
2702
2734
|
return await (await fetch(`${h}/v1/admin/roles`, {
|
|
2703
2735
|
method: "POST",
|
|
2704
2736
|
body: JSON.stringify(e),
|
|
2705
2737
|
headers: {
|
|
2706
2738
|
"Content-Type": "application/json",
|
|
2707
|
-
Authorization: "Bearer " +
|
|
2739
|
+
Authorization: "Bearer " + r.token
|
|
2708
2740
|
}
|
|
2709
2741
|
})).json();
|
|
2710
2742
|
}
|
|
2711
2743
|
static async getRole(e) {
|
|
2712
|
-
if (!
|
|
2744
|
+
if (!r.token)
|
|
2713
2745
|
throw new Error("Not authenticated");
|
|
2714
2746
|
return await (await fetch(`${h}/v1/admin/roles/${e}`, {
|
|
2715
2747
|
method: "GET",
|
|
2716
2748
|
headers: {
|
|
2717
2749
|
"Content-Type": "application/json",
|
|
2718
|
-
Authorization: "Bearer " +
|
|
2750
|
+
Authorization: "Bearer " + r.token
|
|
2719
2751
|
}
|
|
2720
2752
|
})).json();
|
|
2721
2753
|
}
|
|
2722
2754
|
static async patchRole(e, t) {
|
|
2723
|
-
if (!
|
|
2755
|
+
if (!r.token)
|
|
2724
2756
|
throw new Error("Not authenticated");
|
|
2725
2757
|
return await (await fetch(`${h}/v1/admin/roles/${e}`, {
|
|
2726
2758
|
method: "PATCH",
|
|
2727
2759
|
body: JSON.stringify(t),
|
|
2728
2760
|
headers: {
|
|
2729
2761
|
"Content-Type": "application/json",
|
|
2730
|
-
Authorization: "Bearer " +
|
|
2762
|
+
Authorization: "Bearer " + r.token
|
|
2731
2763
|
}
|
|
2732
2764
|
})).json();
|
|
2733
2765
|
}
|
|
2734
2766
|
static async deleteRole(e) {
|
|
2735
|
-
if (!
|
|
2767
|
+
if (!r.token)
|
|
2736
2768
|
throw new Error("Not authenticated");
|
|
2737
2769
|
await fetch(`${h}/v1/admin/roles/${e}`, {
|
|
2738
2770
|
method: "DELETE",
|
|
2739
2771
|
headers: {
|
|
2740
2772
|
"Content-Type": "application/json",
|
|
2741
|
-
Authorization: "Bearer " +
|
|
2773
|
+
Authorization: "Bearer " + r.token
|
|
2742
2774
|
}
|
|
2743
2775
|
});
|
|
2744
2776
|
}
|
|
2745
2777
|
}
|
|
2746
|
-
class
|
|
2778
|
+
class cn {
|
|
2747
2779
|
static async listUsers() {
|
|
2748
|
-
if (!
|
|
2780
|
+
if (!r.token)
|
|
2749
2781
|
throw new Error("Not authenticated");
|
|
2750
2782
|
return (await (await fetch(`${h}/v1/admin/users`, {
|
|
2751
2783
|
method: "GET",
|
|
2752
2784
|
headers: {
|
|
2753
2785
|
"Content-Type": "application/json",
|
|
2754
|
-
Authorization: "Bearer " +
|
|
2786
|
+
Authorization: "Bearer " + r.token
|
|
2755
2787
|
}
|
|
2756
2788
|
})).json()).items;
|
|
2757
2789
|
}
|
|
2758
2790
|
static async createUser(e) {
|
|
2759
|
-
if (!
|
|
2791
|
+
if (!r.token)
|
|
2760
2792
|
throw new Error("Not authenticated");
|
|
2761
2793
|
return await (await fetch(`${h}/v1/admin/users`, {
|
|
2762
2794
|
method: "POST",
|
|
2763
2795
|
body: JSON.stringify(e),
|
|
2764
2796
|
headers: {
|
|
2765
2797
|
"Content-Type": "application/json",
|
|
2766
|
-
Authorization: "Bearer " +
|
|
2798
|
+
Authorization: "Bearer " + r.token
|
|
2767
2799
|
}
|
|
2768
2800
|
})).json();
|
|
2769
2801
|
}
|
|
2770
2802
|
static async getUser(e) {
|
|
2771
|
-
if (!
|
|
2803
|
+
if (!r.token)
|
|
2772
2804
|
throw new Error("Not authenticated");
|
|
2773
2805
|
return await (await fetch(`${h}/v1/admin/users/${e}`, {
|
|
2774
2806
|
method: "GET",
|
|
2775
2807
|
headers: {
|
|
2776
2808
|
"Content-Type": "application/json",
|
|
2777
|
-
Authorization: "Bearer " +
|
|
2809
|
+
Authorization: "Bearer " + r.token
|
|
2778
2810
|
}
|
|
2779
2811
|
})).json();
|
|
2780
2812
|
}
|
|
2781
2813
|
static async patchUser(e, t) {
|
|
2782
|
-
if (!
|
|
2814
|
+
if (!r.token)
|
|
2783
2815
|
throw new Error("Not authenticated");
|
|
2784
2816
|
return await (await fetch(`${h}/v1/admin/users/${e}`, {
|
|
2785
2817
|
method: "PATCH",
|
|
2786
2818
|
body: JSON.stringify(t),
|
|
2787
2819
|
headers: {
|
|
2788
2820
|
"Content-Type": "application/json",
|
|
2789
|
-
Authorization: "Bearer " +
|
|
2821
|
+
Authorization: "Bearer " + r.token
|
|
2790
2822
|
}
|
|
2791
2823
|
})).json();
|
|
2792
2824
|
}
|
|
2793
2825
|
static async deleteUser(e) {
|
|
2794
|
-
if (!
|
|
2826
|
+
if (!r.token)
|
|
2795
2827
|
throw new Error("Not authenticated");
|
|
2796
2828
|
await fetch(`${h}/v1/admin/users/${e}`, {
|
|
2797
2829
|
method: "PATCH",
|
|
2798
2830
|
body: JSON.stringify({ enabled: !1, roleId: null, teamId: null }),
|
|
2799
2831
|
headers: {
|
|
2800
2832
|
"Content-Type": "application/json",
|
|
2801
|
-
Authorization: "Bearer " +
|
|
2833
|
+
Authorization: "Bearer " + r.token
|
|
2802
2834
|
}
|
|
2803
2835
|
});
|
|
2804
2836
|
}
|
|
2805
2837
|
}
|
|
2806
|
-
const
|
|
2838
|
+
const dn = ["viewer", "operator", "administrator"], hn = "viewer", ln = "operator", un = "administrator", mn = [
|
|
2807
2839
|
"year",
|
|
2808
2840
|
"month",
|
|
2809
2841
|
"week",
|
|
2810
2842
|
"day",
|
|
2811
2843
|
"hour",
|
|
2812
2844
|
"minute"
|
|
2813
|
-
],
|
|
2845
|
+
], fn = ["tag", "sheet", "user"], wn = [
|
|
2814
2846
|
"triggered-event",
|
|
2815
2847
|
"intervention-request",
|
|
2816
2848
|
"teleop-session-record",
|
|
@@ -2822,59 +2854,59 @@ const sn = ["viewer", "operator", "administrator"], cn = "viewer", dn = "operato
|
|
|
2822
2854
|
"comment",
|
|
2823
2855
|
"system",
|
|
2824
2856
|
"annotation"
|
|
2825
|
-
],
|
|
2857
|
+
], pn = [
|
|
2826
2858
|
"unknown",
|
|
2827
2859
|
"operational",
|
|
2828
2860
|
"offline",
|
|
2829
2861
|
"error"
|
|
2830
|
-
],
|
|
2862
|
+
], yn = ["selection", "labeling", "teleop"], gn = ["info", "warning", "error", "critical"], vn = ["video/mp4"], Tn = (a) => new Promise((e) => setTimeout(e, a * 1e3));
|
|
2831
2863
|
try {
|
|
2832
2864
|
const a = typeof window < "u" && window.location ? new URLSearchParams(window.location.search) : new URLSearchParams(""), e = a.get("device");
|
|
2833
|
-
e &&
|
|
2865
|
+
e && l.setDefaultDevice(e);
|
|
2834
2866
|
const t = a.get("auth");
|
|
2835
|
-
t &&
|
|
2867
|
+
t && r.loginWithToken(t), a.get("module") && r.listenForRefresh(), typeof window < "u" && g.listenForConnectionEvents();
|
|
2836
2868
|
} catch {
|
|
2837
2869
|
}
|
|
2838
2870
|
export {
|
|
2839
|
-
|
|
2871
|
+
rn as Account,
|
|
2840
2872
|
g as App,
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2873
|
+
on as AudioPlayer,
|
|
2874
|
+
r as Authentication,
|
|
2875
|
+
Xe as BinaryRequestDataChannel,
|
|
2876
|
+
Fe as CaptureStream,
|
|
2877
|
+
Ke as DataChannel,
|
|
2846
2878
|
S as Device,
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
+
l as Fleet,
|
|
2880
|
+
an as KeyValue,
|
|
2881
|
+
Qe as Manipulator,
|
|
2882
|
+
ft as PeerDevice,
|
|
2883
|
+
sn as Role,
|
|
2884
|
+
Zt as SessionType,
|
|
2885
|
+
Ye as TextRequestDataChannel,
|
|
2886
|
+
cn as User,
|
|
2887
|
+
dn as accessLevels,
|
|
2888
|
+
un as administrator,
|
|
2889
|
+
te as aggregateByDateFunctions,
|
|
2890
|
+
nn as aggregateFunctionMap,
|
|
2891
|
+
tn as aggregateFunctions,
|
|
2892
|
+
mn as aggregateLevels,
|
|
2893
|
+
fn as annotationTypes,
|
|
2894
|
+
wn as eventTypes,
|
|
2895
|
+
ct as formatTimeFrameText,
|
|
2896
|
+
ot as getAverage,
|
|
2897
|
+
st as getCount,
|
|
2898
|
+
at as getMax,
|
|
2899
|
+
it as getMin,
|
|
2900
|
+
nt as getStandardDeviation,
|
|
2901
|
+
rt as getSum,
|
|
2902
|
+
tt as getVariance,
|
|
2903
|
+
pn as healthStatuses,
|
|
2904
|
+
yn as interventionTypes,
|
|
2905
|
+
ln as operator,
|
|
2906
|
+
gn as severities,
|
|
2907
|
+
Tn as timeout,
|
|
2908
|
+
en as vailableAggregationIntervals,
|
|
2909
|
+
vn as videoMimeTypes,
|
|
2910
|
+
hn as viewer
|
|
2879
2911
|
};
|
|
2880
2912
|
//# sourceMappingURL=data-sdk.es.js.map
|