@acrobits/ipc-sdk 0.8.1-alpha.2 → 0.8.1-alpha.20
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/docs/assets/search.js +1 -1
- package/docs/classes/IPCManager.html +21 -19
- package/docs/interfaces/CloudUsernameContactItem.html +3 -3
- package/docs/interfaces/DetailedContactItem.html +8 -8
- package/docs/interfaces/DetailedContactURI.html +3 -3
- package/docs/interfaces/UriContactItem.html +3 -3
- package/docs/types/ContactItem.html +1 -1
- package/docs/types/ContactLabel.html +1 -1
- package/docs/types/ContactType.html +1 -1
- package/docs/types/ContactURI.html +1 -1
- package/docs/types/HostType.html +1 -1
- package/docs/types/IpcProtocolVersion.html +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/ipc-sdk.js +222 -231
- package/lib/ipc-sdk.js.map +1 -1
- package/lib/ipc-sdk.umd.cjs +3 -3
- package/lib/ipc-sdk.umd.cjs.map +1 -1
- package/package.json +2 -2
package/lib/ipc-sdk.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Pe = Object.defineProperty;
|
|
2
2
|
var _e = (n, t, e) => t in n ? Pe(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
-
var
|
|
3
|
+
var x = (n, t, e) => (_e(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
4
|
var w = /* @__PURE__ */ ((n) => (n.BadgeQuery = "BADGE QUERY", n.Lifecycle = "LIFECYCLE", n.PushToken = "PUSH TOKEN", n))(w || {}), q = function(n, t) {
|
|
5
5
|
return q = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
|
|
6
6
|
e.__proto__ = r;
|
|
@@ -56,7 +56,7 @@ function D(n, t, e) {
|
|
|
56
56
|
(i || !(r in t)) && (i || (i = Array.prototype.slice.call(t, 0, r)), i[r] = t[r]);
|
|
57
57
|
return n.concat(i || Array.prototype.slice.call(t));
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function S(n) {
|
|
60
60
|
return typeof n == "function";
|
|
61
61
|
}
|
|
62
62
|
function X(n) {
|
|
@@ -96,8 +96,8 @@ var R = function() {
|
|
|
96
96
|
var u = c.value;
|
|
97
97
|
u.remove(this);
|
|
98
98
|
}
|
|
99
|
-
} catch (
|
|
100
|
-
t = { error:
|
|
99
|
+
} catch (y) {
|
|
100
|
+
t = { error: y };
|
|
101
101
|
} finally {
|
|
102
102
|
try {
|
|
103
103
|
c && !c.done && (e = a.return) && e.call(a);
|
|
@@ -108,30 +108,30 @@ var R = function() {
|
|
|
108
108
|
}
|
|
109
109
|
else
|
|
110
110
|
o.remove(this);
|
|
111
|
-
var
|
|
112
|
-
if (
|
|
111
|
+
var h = this.initialTeardown;
|
|
112
|
+
if (S(h))
|
|
113
113
|
try {
|
|
114
|
-
|
|
115
|
-
} catch (
|
|
116
|
-
i =
|
|
114
|
+
h();
|
|
115
|
+
} catch (y) {
|
|
116
|
+
i = y instanceof N ? y.errors : [y];
|
|
117
117
|
}
|
|
118
|
-
var
|
|
119
|
-
if (
|
|
118
|
+
var l = this._finalizers;
|
|
119
|
+
if (l) {
|
|
120
120
|
this._finalizers = null;
|
|
121
121
|
try {
|
|
122
|
-
for (var
|
|
123
|
-
var k =
|
|
122
|
+
for (var b = G(l), v = b.next(); !v.done; v = b.next()) {
|
|
123
|
+
var k = v.value;
|
|
124
124
|
try {
|
|
125
125
|
se(k);
|
|
126
|
-
} catch (
|
|
127
|
-
i = i ?? [],
|
|
126
|
+
} catch (y) {
|
|
127
|
+
i = i ?? [], y instanceof N ? i = D(D([], $(i)), $(y.errors)) : i.push(y);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
} catch (
|
|
131
|
-
r = { error:
|
|
130
|
+
} catch (y) {
|
|
131
|
+
r = { error: y };
|
|
132
132
|
} finally {
|
|
133
133
|
try {
|
|
134
|
-
|
|
134
|
+
v && !v.done && (s = b.return) && s.call(b);
|
|
135
135
|
} finally {
|
|
136
136
|
if (r)
|
|
137
137
|
throw r.error;
|
|
@@ -172,10 +172,10 @@ var R = function() {
|
|
|
172
172
|
}(), n;
|
|
173
173
|
}(), be = R.EMPTY;
|
|
174
174
|
function me(n) {
|
|
175
|
-
return n instanceof R || n && "closed" in n &&
|
|
175
|
+
return n instanceof R || n && "closed" in n && S(n.remove) && S(n.add) && S(n.unsubscribe);
|
|
176
176
|
}
|
|
177
177
|
function se(n) {
|
|
178
|
-
|
|
178
|
+
S(n) ? n() : n.unsubscribe();
|
|
179
179
|
}
|
|
180
180
|
var we = {
|
|
181
181
|
onUnhandledError: null,
|
|
@@ -183,20 +183,20 @@ var we = {
|
|
|
183
183
|
Promise: void 0,
|
|
184
184
|
useDeprecatedSynchronousErrorHandling: !1,
|
|
185
185
|
useDeprecatedNextContext: !1
|
|
186
|
-
},
|
|
186
|
+
}, Se = {
|
|
187
187
|
setTimeout: function(n, t) {
|
|
188
188
|
for (var e = [], r = 2; r < arguments.length; r++)
|
|
189
189
|
e[r - 2] = arguments[r];
|
|
190
190
|
return setTimeout.apply(void 0, D([n, t], $(e)));
|
|
191
191
|
},
|
|
192
192
|
clearTimeout: function(n) {
|
|
193
|
-
var t =
|
|
193
|
+
var t = Se.delegate;
|
|
194
194
|
return ((t == null ? void 0 : t.clearTimeout) || clearTimeout)(n);
|
|
195
195
|
},
|
|
196
196
|
delegate: void 0
|
|
197
197
|
};
|
|
198
198
|
function Ae(n) {
|
|
199
|
-
|
|
199
|
+
Se.setTimeout(function() {
|
|
200
200
|
throw n;
|
|
201
201
|
});
|
|
202
202
|
}
|
|
@@ -275,7 +275,7 @@ var Le = function() {
|
|
|
275
275
|
M(t, n);
|
|
276
276
|
function t(e, r, s) {
|
|
277
277
|
var i = n.call(this) || this, o;
|
|
278
|
-
if (
|
|
278
|
+
if (S(e) || !e)
|
|
279
279
|
o = {
|
|
280
280
|
next: e ?? void 0,
|
|
281
281
|
error: r ?? void 0,
|
|
@@ -309,11 +309,11 @@ var $e = {
|
|
|
309
309
|
}, De = function() {
|
|
310
310
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
311
311
|
}();
|
|
312
|
-
function
|
|
312
|
+
function Ee(n) {
|
|
313
313
|
return n;
|
|
314
314
|
}
|
|
315
315
|
function Fe(n) {
|
|
316
|
-
return n.length === 0 ?
|
|
316
|
+
return n.length === 0 ? Ee : n.length === 1 ? n[0] : function(e) {
|
|
317
317
|
return n.reduce(function(r, s) {
|
|
318
318
|
return s(r);
|
|
319
319
|
}, e);
|
|
@@ -384,13 +384,13 @@ function oe(n) {
|
|
|
384
384
|
return (t = n ?? we.Promise) !== null && t !== void 0 ? t : Promise;
|
|
385
385
|
}
|
|
386
386
|
function He(n) {
|
|
387
|
-
return n &&
|
|
387
|
+
return n && S(n.next) && S(n.error) && S(n.complete);
|
|
388
388
|
}
|
|
389
389
|
function ke(n) {
|
|
390
390
|
return n && n instanceof Z || He(n) && me(n);
|
|
391
391
|
}
|
|
392
392
|
function Ne(n) {
|
|
393
|
-
return
|
|
393
|
+
return S(n == null ? void 0 : n.lift);
|
|
394
394
|
}
|
|
395
395
|
function Ce(n) {
|
|
396
396
|
return function(t) {
|
|
@@ -415,14 +415,14 @@ var Ve = function(n) {
|
|
|
415
415
|
return c.onFinalize = o, c.shouldUnsubscribe = a, c._next = r ? function(u) {
|
|
416
416
|
try {
|
|
417
417
|
r(u);
|
|
418
|
-
} catch (
|
|
419
|
-
e.error(
|
|
418
|
+
} catch (h) {
|
|
419
|
+
e.error(h);
|
|
420
420
|
}
|
|
421
421
|
} : n.prototype._next, c._error = i ? function(u) {
|
|
422
422
|
try {
|
|
423
423
|
i(u);
|
|
424
|
-
} catch (
|
|
425
|
-
e.error(
|
|
424
|
+
} catch (h) {
|
|
425
|
+
e.error(h);
|
|
426
426
|
} finally {
|
|
427
427
|
this.unsubscribe();
|
|
428
428
|
}
|
|
@@ -646,7 +646,7 @@ var Ve = function(n) {
|
|
|
646
646
|
}, t;
|
|
647
647
|
}(ce), Ye = new Be(Ge), ze = Ye;
|
|
648
648
|
function We(n) {
|
|
649
|
-
return n &&
|
|
649
|
+
return n && S(n.schedule);
|
|
650
650
|
}
|
|
651
651
|
var Ke = X(function(n) {
|
|
652
652
|
return function() {
|
|
@@ -692,7 +692,7 @@ function Xe(n, t, e) {
|
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
694
|
function Ze(n, t, e) {
|
|
695
|
-
var r =
|
|
695
|
+
var r = S(n) || t || e ? { next: n, error: t, complete: e } : n;
|
|
696
696
|
return r ? Ce(function(s, i) {
|
|
697
697
|
var o;
|
|
698
698
|
(o = r.subscribe) === null || o === void 0 || o.call(r);
|
|
@@ -710,15 +710,15 @@ function Ze(n, t, e) {
|
|
|
710
710
|
var c, u;
|
|
711
711
|
a && ((c = r.unsubscribe) === null || c === void 0 || c.call(r)), (u = r.finalize) === null || u === void 0 || u.call(r);
|
|
712
712
|
}));
|
|
713
|
-
}) :
|
|
713
|
+
}) : Ee;
|
|
714
714
|
}
|
|
715
715
|
var et = Object.defineProperty, tt = (n, t, e) => t in n ? et(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, C = (n, t, e) => (tt(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
716
|
-
class
|
|
716
|
+
class d extends Error {
|
|
717
717
|
constructor(t) {
|
|
718
718
|
super(`Incorrect context (${t}). Cannot perform the requested operation.`), C(this, "context"), this.context = t;
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
|
-
class
|
|
721
|
+
class I extends Error {
|
|
722
722
|
constructor(t, e, r) {
|
|
723
723
|
super(`Invalid parameter (${t}). ${r}`), this.param = t, this.value = e, this.reason = r;
|
|
724
724
|
}
|
|
@@ -746,11 +746,11 @@ class le extends Error {
|
|
|
746
746
|
e && (r += ` Minimum version supported is ${e}.`), super(r), this.version = t;
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
|
-
function
|
|
749
|
+
function E(n) {
|
|
750
750
|
return typeof n == "function";
|
|
751
751
|
}
|
|
752
752
|
function st(n) {
|
|
753
|
-
return
|
|
753
|
+
return E(n == null ? void 0 : n.lift);
|
|
754
754
|
}
|
|
755
755
|
function P(n) {
|
|
756
756
|
return function(t) {
|
|
@@ -857,8 +857,8 @@ var te = function() {
|
|
|
857
857
|
var u = c.value;
|
|
858
858
|
u.remove(this);
|
|
859
859
|
}
|
|
860
|
-
} catch (
|
|
861
|
-
t = { error:
|
|
860
|
+
} catch (y) {
|
|
861
|
+
t = { error: y };
|
|
862
862
|
} finally {
|
|
863
863
|
try {
|
|
864
864
|
c && !c.done && (e = a.return) && e.call(a);
|
|
@@ -869,30 +869,30 @@ var te = function() {
|
|
|
869
869
|
}
|
|
870
870
|
else
|
|
871
871
|
o.remove(this);
|
|
872
|
-
var
|
|
873
|
-
if (
|
|
872
|
+
var h = this.initialTeardown;
|
|
873
|
+
if (E(h))
|
|
874
874
|
try {
|
|
875
|
-
|
|
876
|
-
} catch (
|
|
877
|
-
i =
|
|
875
|
+
h();
|
|
876
|
+
} catch (y) {
|
|
877
|
+
i = y instanceof j ? y.errors : [y];
|
|
878
878
|
}
|
|
879
|
-
var
|
|
880
|
-
if (
|
|
879
|
+
var l = this._finalizers;
|
|
880
|
+
if (l) {
|
|
881
881
|
this._finalizers = null;
|
|
882
882
|
try {
|
|
883
|
-
for (var
|
|
884
|
-
var k =
|
|
883
|
+
for (var b = he(l), v = b.next(); !v.done; v = b.next()) {
|
|
884
|
+
var k = v.value;
|
|
885
885
|
try {
|
|
886
886
|
pe(k);
|
|
887
|
-
} catch (
|
|
888
|
-
i = i ?? [],
|
|
887
|
+
} catch (y) {
|
|
888
|
+
i = i ?? [], y instanceof j ? i = K(K([], W(i)), W(y.errors)) : i.push(y);
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
|
-
} catch (
|
|
892
|
-
r = { error:
|
|
891
|
+
} catch (y) {
|
|
892
|
+
r = { error: y };
|
|
893
893
|
} finally {
|
|
894
894
|
try {
|
|
895
|
-
|
|
895
|
+
v && !v.done && (s = b.return) && s.call(b);
|
|
896
896
|
} finally {
|
|
897
897
|
if (r)
|
|
898
898
|
throw r.error;
|
|
@@ -934,10 +934,10 @@ var te = function() {
|
|
|
934
934
|
}();
|
|
935
935
|
te.EMPTY;
|
|
936
936
|
function Ie(n) {
|
|
937
|
-
return n instanceof te || n && "closed" in n &&
|
|
937
|
+
return n instanceof te || n && "closed" in n && E(n.remove) && E(n.add) && E(n.unsubscribe);
|
|
938
938
|
}
|
|
939
939
|
function pe(n) {
|
|
940
|
-
|
|
940
|
+
E(n) ? n() : n.unsubscribe();
|
|
941
941
|
}
|
|
942
942
|
var Te = {
|
|
943
943
|
onUnhandledError: null,
|
|
@@ -1036,7 +1036,7 @@ var lt = function() {
|
|
|
1036
1036
|
ee(t, n);
|
|
1037
1037
|
function t(e, r, s) {
|
|
1038
1038
|
var i = n.call(this) || this, o;
|
|
1039
|
-
if (
|
|
1039
|
+
if (E(e) || !e)
|
|
1040
1040
|
o = {
|
|
1041
1041
|
next: e ?? void 0,
|
|
1042
1042
|
error: r ?? void 0,
|
|
@@ -1145,7 +1145,7 @@ function ge(n) {
|
|
|
1145
1145
|
return (t = n ?? Te.Promise) !== null && t !== void 0 ? t : Promise;
|
|
1146
1146
|
}
|
|
1147
1147
|
function vt(n) {
|
|
1148
|
-
return n &&
|
|
1148
|
+
return n && E(n.next) && E(n.error) && E(n.complete);
|
|
1149
1149
|
}
|
|
1150
1150
|
function yt(n) {
|
|
1151
1151
|
return n && n instanceof re || vt(n) && Ie(n);
|
|
@@ -1160,14 +1160,14 @@ var bt = function(n) {
|
|
|
1160
1160
|
return c.onFinalize = o, c.shouldUnsubscribe = a, c._next = r ? function(u) {
|
|
1161
1161
|
try {
|
|
1162
1162
|
r(u);
|
|
1163
|
-
} catch (
|
|
1164
|
-
e.error(
|
|
1163
|
+
} catch (h) {
|
|
1164
|
+
e.error(h);
|
|
1165
1165
|
}
|
|
1166
1166
|
} : n.prototype._next, c._error = i ? function(u) {
|
|
1167
1167
|
try {
|
|
1168
1168
|
i(u);
|
|
1169
|
-
} catch (
|
|
1170
|
-
e.error(
|
|
1169
|
+
} catch (h) {
|
|
1170
|
+
e.error(h);
|
|
1171
1171
|
} finally {
|
|
1172
1172
|
this.unsubscribe();
|
|
1173
1173
|
}
|
|
@@ -1228,7 +1228,7 @@ function wt(n, t) {
|
|
|
1228
1228
|
});
|
|
1229
1229
|
}
|
|
1230
1230
|
function f(n, t, e) {
|
|
1231
|
-
var r =
|
|
1231
|
+
var r = E(n) || t || e ? { next: n, error: t, complete: e } : n;
|
|
1232
1232
|
return r ? P(function(s, i) {
|
|
1233
1233
|
var o;
|
|
1234
1234
|
(o = r.subscribe) === null || o === void 0 || o.call(r);
|
|
@@ -1248,17 +1248,17 @@ function f(n, t, e) {
|
|
|
1248
1248
|
}));
|
|
1249
1249
|
}) : Re;
|
|
1250
1250
|
}
|
|
1251
|
-
const
|
|
1252
|
-
function
|
|
1251
|
+
const St = /^(\d+)\.(\d+)$/;
|
|
1252
|
+
function Et(n) {
|
|
1253
1253
|
if (typeof n == "string") {
|
|
1254
|
-
const t = n.match(
|
|
1254
|
+
const t = n.match(St);
|
|
1255
1255
|
if (t)
|
|
1256
1256
|
return `${t[1]}.${t[2]}`;
|
|
1257
1257
|
}
|
|
1258
1258
|
throw new nt(n);
|
|
1259
1259
|
}
|
|
1260
1260
|
function ve(n) {
|
|
1261
|
-
const t =
|
|
1261
|
+
const t = Et(n), [e, r] = t.split("."), [s, i] = [parseInt(e), parseInt(r)];
|
|
1262
1262
|
return [s, i];
|
|
1263
1263
|
}
|
|
1264
1264
|
function ne(n, t) {
|
|
@@ -1333,13 +1333,13 @@ class xt {
|
|
|
1333
1333
|
*/
|
|
1334
1334
|
openBridge() {
|
|
1335
1335
|
if (!this.isEmbedded())
|
|
1336
|
-
throw new
|
|
1336
|
+
throw new d(this.currentContext);
|
|
1337
1337
|
const t = "HELLO", e = this.createMessage(t);
|
|
1338
1338
|
e.protocolVersions = this.supportedVersions, this.logCreated(t, e);
|
|
1339
1339
|
const r = this.incomingMessages$.pipe(
|
|
1340
1340
|
g((s) => s.type === t && s.replyTo === e.id),
|
|
1341
1341
|
p((s) => s),
|
|
1342
|
-
f(this.logReceived(
|
|
1342
|
+
f(this.logReceived()),
|
|
1343
1343
|
p((s) => {
|
|
1344
1344
|
if (this.supportedVersions.some((i) => Ct(i, s.protocolVersion)))
|
|
1345
1345
|
throw new le(s.protocolVersion, this.supportedVersions[0]);
|
|
@@ -1363,13 +1363,13 @@ class xt {
|
|
|
1363
1363
|
*/
|
|
1364
1364
|
requestSSOToken() {
|
|
1365
1365
|
if (!this.isEmbedded())
|
|
1366
|
-
throw new
|
|
1366
|
+
throw new d(this.currentContext);
|
|
1367
1367
|
const t = "TOKEN", e = this.createMessage(t);
|
|
1368
1368
|
this.logCreated(t, e);
|
|
1369
1369
|
const r = this.incomingMessages$.pipe(
|
|
1370
1370
|
g((s) => s.type === t && s.replyTo === e.id),
|
|
1371
1371
|
p((s) => s),
|
|
1372
|
-
f(this.logReceived(
|
|
1372
|
+
f(this.logReceived()),
|
|
1373
1373
|
m(1)
|
|
1374
1374
|
);
|
|
1375
1375
|
return this.logService.debug(`Created ${t} Reply handler`), this.port2.postMessage(e), this.logSent(t, e), r;
|
|
@@ -1389,7 +1389,7 @@ class xt {
|
|
|
1389
1389
|
*/
|
|
1390
1390
|
sendJoiningRoomMessage(t) {
|
|
1391
1391
|
if (!this.isEmbedded())
|
|
1392
|
-
throw new
|
|
1392
|
+
throw new d(this.currentContext);
|
|
1393
1393
|
const {
|
|
1394
1394
|
roomName: e,
|
|
1395
1395
|
roomInvite: r,
|
|
@@ -1399,8 +1399,8 @@ class xt {
|
|
|
1399
1399
|
region: a,
|
|
1400
1400
|
joinMicMuted: c,
|
|
1401
1401
|
joinWithoutCamera: u
|
|
1402
|
-
} = t,
|
|
1403
|
-
|
|
1402
|
+
} = t, h = "JOINING ROOM", l = this.createMessage(h, !1);
|
|
1403
|
+
l.roomName = e, l.jwtToken = i, l.serverUrl = o, l.region = a, l.roomInvite = r, l.joinMicMuted = c ?? !1, l.joinWithoutCamera = u ?? !1, l.displayName = s, this.logCreated(h, l), this.port2.postMessage(l), this.logSent(h, l);
|
|
1404
1404
|
}
|
|
1405
1405
|
/**
|
|
1406
1406
|
* Sends a {@link LeavingRoomMessage} lifecycle message to the Host app.
|
|
@@ -1415,7 +1415,7 @@ class xt {
|
|
|
1415
1415
|
*/
|
|
1416
1416
|
sendLeavingRoomMessage(t) {
|
|
1417
1417
|
if (!this.isEmbedded())
|
|
1418
|
-
throw new
|
|
1418
|
+
throw new d(this.currentContext);
|
|
1419
1419
|
const e = "LEAVING ROOM", r = this.createMessage(e, !1);
|
|
1420
1420
|
r.roomName = t, this.logCreated(e, r), this.port2.postMessage(r), this.logSent(e, r);
|
|
1421
1421
|
}
|
|
@@ -1447,12 +1447,12 @@ class xt {
|
|
|
1447
1447
|
*/
|
|
1448
1448
|
onJoinRoomMessage() {
|
|
1449
1449
|
if (!this.isEmbedded())
|
|
1450
|
-
throw new
|
|
1450
|
+
throw new d(this.currentContext);
|
|
1451
1451
|
const t = "JOIN ROOM";
|
|
1452
1452
|
return this.incomingMessages$.pipe(
|
|
1453
1453
|
g((e) => e.type === t && e.target === "client"),
|
|
1454
1454
|
p((e) => e),
|
|
1455
|
-
f(this.logReceived(
|
|
1455
|
+
f(this.logReceived()),
|
|
1456
1456
|
p((e) => e)
|
|
1457
1457
|
);
|
|
1458
1458
|
}
|
|
@@ -1483,12 +1483,12 @@ class xt {
|
|
|
1483
1483
|
*/
|
|
1484
1484
|
onLeaveRoomMessage() {
|
|
1485
1485
|
if (!this.isEmbedded())
|
|
1486
|
-
throw new
|
|
1486
|
+
throw new d(this.currentContext);
|
|
1487
1487
|
const t = "LEAVE ROOM";
|
|
1488
1488
|
return this.incomingMessages$.pipe(
|
|
1489
1489
|
g((e) => e.type === t && e.target === "client"),
|
|
1490
1490
|
p((e) => e),
|
|
1491
|
-
f(this.logReceived(
|
|
1491
|
+
f(this.logReceived()),
|
|
1492
1492
|
p((e) => e)
|
|
1493
1493
|
);
|
|
1494
1494
|
}
|
|
@@ -1520,12 +1520,12 @@ class xt {
|
|
|
1520
1520
|
*/
|
|
1521
1521
|
onConfigMessage() {
|
|
1522
1522
|
if (!this.isEmbedded())
|
|
1523
|
-
throw new
|
|
1523
|
+
throw new d(this.currentContext);
|
|
1524
1524
|
const t = "CONFIG";
|
|
1525
1525
|
return this.incomingMessages$.pipe(
|
|
1526
1526
|
g((e) => e.type === t && e.target === "client"),
|
|
1527
1527
|
p((e) => e),
|
|
1528
|
-
f(this.logReceived(
|
|
1528
|
+
f(this.logReceived()),
|
|
1529
1529
|
p((e) => ({
|
|
1530
1530
|
preferredCameraType: e.preferredCameraType,
|
|
1531
1531
|
preferredMicType: e.preferredMicType,
|
|
@@ -1542,13 +1542,13 @@ class xt {
|
|
|
1542
1542
|
}
|
|
1543
1543
|
sendScreenshareSourceMessage(t) {
|
|
1544
1544
|
if (!this.isEmbedded())
|
|
1545
|
-
throw new
|
|
1545
|
+
throw new d(this.currentContext);
|
|
1546
1546
|
const e = "SCREENSHARE SOURCE", r = this.createMessage(e);
|
|
1547
1547
|
r.sourceTypes = t, this.logCreated(e, r);
|
|
1548
1548
|
const s = this.incomingMessages$.pipe(
|
|
1549
1549
|
g((i) => i.type === e && i.replyTo === r.id),
|
|
1550
1550
|
p((i) => i),
|
|
1551
|
-
f(this.logReceived(
|
|
1551
|
+
f(this.logReceived()),
|
|
1552
1552
|
p((i) => i),
|
|
1553
1553
|
m(1)
|
|
1554
1554
|
);
|
|
@@ -1556,13 +1556,13 @@ class xt {
|
|
|
1556
1556
|
}
|
|
1557
1557
|
layoutChange(t, e, r) {
|
|
1558
1558
|
if (!this.isEmbedded())
|
|
1559
|
-
throw new
|
|
1559
|
+
throw new d(this.currentContext);
|
|
1560
1560
|
const s = "LAYOUT CHANGE";
|
|
1561
1561
|
let i, o;
|
|
1562
1562
|
if (e && r ? (i = this.createMessage(s, !1, r), i.result = e) : (i = this.createMessage(s), o = this.incomingMessages$.pipe(
|
|
1563
1563
|
g((a) => a.type === s && a.replyTo === i.id),
|
|
1564
1564
|
p((a) => a),
|
|
1565
|
-
f(this.logReceived(
|
|
1565
|
+
f(this.logReceived()),
|
|
1566
1566
|
p((a) => a),
|
|
1567
1567
|
m(1)
|
|
1568
1568
|
), this.logService.debug(`Created ${s} Reply handler`)), i.layout = t, this.logCreated(s, i), this.port2.postMessage(i), this.logSent(s, i), o)
|
|
@@ -1601,46 +1601,46 @@ class xt {
|
|
|
1601
1601
|
*/
|
|
1602
1602
|
onLayoutChangeMessage() {
|
|
1603
1603
|
if (!this.isEmbedded())
|
|
1604
|
-
throw new
|
|
1604
|
+
throw new d(this.currentContext);
|
|
1605
1605
|
const t = "LAYOUT CHANGE";
|
|
1606
1606
|
return this.incomingMessages$.pipe(
|
|
1607
1607
|
g((e) => e.type === t && e.target === "client" && e.replyTo === null),
|
|
1608
1608
|
p((e) => e),
|
|
1609
|
-
f(this.logReceived(
|
|
1609
|
+
f(this.logReceived()),
|
|
1610
1610
|
p((e) => e)
|
|
1611
1611
|
);
|
|
1612
1612
|
}
|
|
1613
1613
|
requestOAuthToken(t) {
|
|
1614
1614
|
if (!this.isEmbedded())
|
|
1615
|
-
throw new
|
|
1615
|
+
throw new d(this.currentContext);
|
|
1616
1616
|
Array.isArray(t) || (t = [t]);
|
|
1617
1617
|
const e = "OAUTH TOKEN", r = this.createMessage(e);
|
|
1618
1618
|
r.providerTypes = t, this.logCreated(e, r);
|
|
1619
1619
|
const s = this.incomingMessages$.pipe(
|
|
1620
1620
|
g((i) => i.type === e && i.replyTo === r.id),
|
|
1621
1621
|
p((i) => i),
|
|
1622
|
-
f(this.logReceived(
|
|
1622
|
+
f(this.logReceived()),
|
|
1623
1623
|
m(1)
|
|
1624
1624
|
);
|
|
1625
1625
|
return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(r), this.logSent(e, r), s;
|
|
1626
1626
|
}
|
|
1627
1627
|
openUrl(t, e) {
|
|
1628
1628
|
if (!this.isEmbedded())
|
|
1629
|
-
throw new
|
|
1629
|
+
throw new d(this.currentContext);
|
|
1630
1630
|
const r = "OPEN URL", s = this.createMessage(r, !1);
|
|
1631
1631
|
s.url = t, s.data = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
1632
1632
|
}
|
|
1633
1633
|
selectContacts(t, e, r, s) {
|
|
1634
1634
|
if (!this.isEmbedded())
|
|
1635
|
-
throw new
|
|
1635
|
+
throw new d(this.currentContext);
|
|
1636
1636
|
if (e === "group" && s === void 0)
|
|
1637
|
-
throw new
|
|
1637
|
+
throw new I(
|
|
1638
1638
|
"currentContacts",
|
|
1639
1639
|
s,
|
|
1640
1640
|
"currentContacts is required for group streams"
|
|
1641
1641
|
);
|
|
1642
1642
|
if (e === "direct" && s !== void 0)
|
|
1643
|
-
throw new
|
|
1643
|
+
throw new I(
|
|
1644
1644
|
"currentContacts",
|
|
1645
1645
|
s,
|
|
1646
1646
|
"currentContacts should not be passed for direct streams"
|
|
@@ -1649,7 +1649,7 @@ class xt {
|
|
|
1649
1649
|
o.streamType = e, o.streamId = t, o.contactType = r, o.currentContacts = s, this.logCreated(i, o);
|
|
1650
1650
|
const a = this.incomingMessages$.pipe(
|
|
1651
1651
|
g((c) => c.type === i && c.replyTo === o.id),
|
|
1652
|
-
f(this.logReceived(
|
|
1652
|
+
f(this.logReceived()),
|
|
1653
1653
|
// validate if `streamId` is the same as we sent
|
|
1654
1654
|
p((c) => {
|
|
1655
1655
|
const u = c;
|
|
@@ -1671,14 +1671,14 @@ class xt {
|
|
|
1671
1671
|
*/
|
|
1672
1672
|
matchContacts(t) {
|
|
1673
1673
|
if (!this.isEmbedded())
|
|
1674
|
-
throw new
|
|
1674
|
+
throw new d(this.currentContext);
|
|
1675
1675
|
if (!t.length)
|
|
1676
|
-
throw new
|
|
1676
|
+
throw new I("contacts", t, "At least one contact is required");
|
|
1677
1677
|
const e = "MATCH CONTACTS", r = this.createMessage(e);
|
|
1678
1678
|
r.contacts = [...t], this.logCreated(e, r);
|
|
1679
1679
|
const s = this.incomingMessages$.pipe(
|
|
1680
1680
|
g((i) => i.type === e && i.replyTo === r.id),
|
|
1681
|
-
f(this.logReceived(
|
|
1681
|
+
f(this.logReceived()),
|
|
1682
1682
|
p((i) => i),
|
|
1683
1683
|
m(1)
|
|
1684
1684
|
);
|
|
@@ -1712,12 +1712,12 @@ class xt {
|
|
|
1712
1712
|
*/
|
|
1713
1713
|
onPushMessageMessage() {
|
|
1714
1714
|
if (!this.isEmbedded())
|
|
1715
|
-
throw new
|
|
1715
|
+
throw new d(this.currentContext);
|
|
1716
1716
|
const t = "PUSH MESSAGE";
|
|
1717
1717
|
return this.incomingMessages$.pipe(
|
|
1718
1718
|
g((e) => e.type === t && e.target === "client"),
|
|
1719
1719
|
p((e) => e),
|
|
1720
|
-
f(this.logReceived(
|
|
1720
|
+
f(this.logReceived())
|
|
1721
1721
|
);
|
|
1722
1722
|
}
|
|
1723
1723
|
/**
|
|
@@ -1731,12 +1731,12 @@ class xt {
|
|
|
1731
1731
|
*/
|
|
1732
1732
|
requestPushToken() {
|
|
1733
1733
|
if (!this.isEmbedded())
|
|
1734
|
-
throw new
|
|
1734
|
+
throw new d(this.currentContext);
|
|
1735
1735
|
const t = "PUSH TOKEN", e = this.createMessage(t);
|
|
1736
1736
|
this.logCreated(t, e);
|
|
1737
1737
|
const r = this.incomingMessages$.pipe(
|
|
1738
1738
|
g((s) => s.type === t && s.replyTo === e.id),
|
|
1739
|
-
f(this.logReceived(
|
|
1739
|
+
f(this.logReceived()),
|
|
1740
1740
|
p((s) => s),
|
|
1741
1741
|
m(1)
|
|
1742
1742
|
);
|
|
@@ -1771,7 +1771,7 @@ class xt {
|
|
|
1771
1771
|
*/
|
|
1772
1772
|
onPushTokenMessage() {
|
|
1773
1773
|
if (!this.isEmbedded())
|
|
1774
|
-
throw new
|
|
1774
|
+
throw new d(this.currentContext);
|
|
1775
1775
|
const t = "PUSH TOKEN";
|
|
1776
1776
|
return this.incomingMessages$.pipe(
|
|
1777
1777
|
g(
|
|
@@ -1783,7 +1783,7 @@ class xt {
|
|
|
1783
1783
|
throw new Error("PushTokenMessage is missing required PushTokenPayload fields");
|
|
1784
1784
|
}),
|
|
1785
1785
|
f((e) => e.pushToken),
|
|
1786
|
-
f(this.logReceived(
|
|
1786
|
+
f(this.logReceived())
|
|
1787
1787
|
);
|
|
1788
1788
|
}
|
|
1789
1789
|
/**
|
|
@@ -1795,12 +1795,12 @@ class xt {
|
|
|
1795
1795
|
*/
|
|
1796
1796
|
onBadgeQueryMessage() {
|
|
1797
1797
|
if (!this.isEmbedded())
|
|
1798
|
-
throw new
|
|
1798
|
+
throw new d(this.currentContext);
|
|
1799
1799
|
const t = "BADGE QUERY";
|
|
1800
1800
|
return this.incomingMessages$.pipe(
|
|
1801
1801
|
g((e) => e.type === t && e.target === "client"),
|
|
1802
1802
|
p((e) => e),
|
|
1803
|
-
f(this.logReceived(
|
|
1803
|
+
f(this.logReceived())
|
|
1804
1804
|
);
|
|
1805
1805
|
}
|
|
1806
1806
|
/**
|
|
@@ -1817,7 +1817,7 @@ class xt {
|
|
|
1817
1817
|
*/
|
|
1818
1818
|
sendBadgeUpdateMessage(t, e, r) {
|
|
1819
1819
|
if (!this.isEmbedded())
|
|
1820
|
-
throw new
|
|
1820
|
+
throw new d(this.currentContext);
|
|
1821
1821
|
const s = "BADGE UPDATE", i = this.createMessage(s, !1, r);
|
|
1822
1822
|
i.count = t, i.activity = e ?? !1, this.logCreated(s, i), this.port2.postMessage(i), this.logSent(s, i);
|
|
1823
1823
|
}
|
|
@@ -1836,7 +1836,7 @@ class xt {
|
|
|
1836
1836
|
*/
|
|
1837
1837
|
sendLifecycleMessage(t, e) {
|
|
1838
1838
|
if (!this.isEmbedded())
|
|
1839
|
-
throw new
|
|
1839
|
+
throw new d(this.currentContext);
|
|
1840
1840
|
const r = "LIFECYCLE", s = this.createMessage(r, !1);
|
|
1841
1841
|
s.eventName = t, s.payload = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
1842
1842
|
}
|
|
@@ -1853,12 +1853,12 @@ class xt {
|
|
|
1853
1853
|
*/
|
|
1854
1854
|
onLifecycleMessage() {
|
|
1855
1855
|
if (!this.isEmbedded())
|
|
1856
|
-
throw new
|
|
1856
|
+
throw new d(this.currentContext);
|
|
1857
1857
|
const t = "LIFECYCLE";
|
|
1858
1858
|
return this.incomingMessages$.pipe(
|
|
1859
1859
|
g((e) => e.type === t && e.target === "client"),
|
|
1860
1860
|
p((e) => e),
|
|
1861
|
-
f(this.logReceived(
|
|
1861
|
+
f(this.logReceived())
|
|
1862
1862
|
);
|
|
1863
1863
|
}
|
|
1864
1864
|
/**
|
|
@@ -1875,7 +1875,7 @@ class xt {
|
|
|
1875
1875
|
*/
|
|
1876
1876
|
sendLogMessage(t, e) {
|
|
1877
1877
|
if (!this.isEmbedded())
|
|
1878
|
-
throw new
|
|
1878
|
+
throw new d(this.currentContext);
|
|
1879
1879
|
const r = "LOG", s = this.createMessage(r, !1);
|
|
1880
1880
|
s.level = t, s.message = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
1881
1881
|
}
|
|
@@ -1893,12 +1893,12 @@ class xt {
|
|
|
1893
1893
|
*/
|
|
1894
1894
|
onRequestLogsMessage() {
|
|
1895
1895
|
if (!this.isEmbedded())
|
|
1896
|
-
throw new
|
|
1896
|
+
throw new d(this.currentContext);
|
|
1897
1897
|
const t = "REQUEST LOGS";
|
|
1898
1898
|
return this.incomingMessages$.pipe(
|
|
1899
1899
|
g((e) => e.type === t && e.target === "client"),
|
|
1900
1900
|
p((e) => e),
|
|
1901
|
-
f(this.logReceived(
|
|
1901
|
+
f(this.logReceived())
|
|
1902
1902
|
);
|
|
1903
1903
|
}
|
|
1904
1904
|
/**
|
|
@@ -1916,7 +1916,7 @@ class xt {
|
|
|
1916
1916
|
*/
|
|
1917
1917
|
sendViewTransitionMessage(t, e) {
|
|
1918
1918
|
if (!this.isEmbedded())
|
|
1919
|
-
throw new
|
|
1919
|
+
throw new d(this.currentContext);
|
|
1920
1920
|
const r = "VIEW TRANSITION", s = this.createMessage(r, !1);
|
|
1921
1921
|
s.transitionType = t, s.targetView = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
1922
1922
|
}
|
|
@@ -1963,11 +1963,11 @@ class xt {
|
|
|
1963
1963
|
*/
|
|
1964
1964
|
sendFileRequestMessage(t, e, r, s, i) {
|
|
1965
1965
|
if (!this.isEmbedded())
|
|
1966
|
-
throw new
|
|
1966
|
+
throw new d(this.currentContext);
|
|
1967
1967
|
const o = "FILE REQUEST", a = this.createMessage(o);
|
|
1968
1968
|
if (a.fileId = t, a.fileHash = e.toLowerCase(), a.intent = r, a.maxChunkSizeInBytes = i, r === "attachment") {
|
|
1969
1969
|
if (!s)
|
|
1970
|
-
throw new
|
|
1970
|
+
throw new I(
|
|
1971
1971
|
"streamId",
|
|
1972
1972
|
s,
|
|
1973
1973
|
"streamId is required for attachment intent"
|
|
@@ -1978,12 +1978,12 @@ class xt {
|
|
|
1978
1978
|
let c = 0;
|
|
1979
1979
|
const u = this.incomingMessages$.pipe(
|
|
1980
1980
|
g(
|
|
1981
|
-
(
|
|
1981
|
+
(h) => h.type === o && h.replyTo === a.id
|
|
1982
1982
|
),
|
|
1983
|
-
f(this.logReceived(
|
|
1983
|
+
f(this.logReceived()),
|
|
1984
1984
|
f(() => c++),
|
|
1985
|
-
p((
|
|
1986
|
-
wt((
|
|
1985
|
+
p((h) => (h.result === "success" && (h.chunkHash = h.chunkHash.toLowerCase(), h.fileHash = h.fileHash.toLowerCase()), h)),
|
|
1986
|
+
wt((h) => h.result === "success" && c < h.totalChunks, !0)
|
|
1987
1987
|
);
|
|
1988
1988
|
return this.port2.postMessage(a), this.logSent(o, a), u;
|
|
1989
1989
|
}
|
|
@@ -2008,7 +2008,7 @@ class xt {
|
|
|
2008
2008
|
*/
|
|
2009
2009
|
sendFileRequestMessageReply(t, e) {
|
|
2010
2010
|
if (!this.isEmbedded())
|
|
2011
|
-
throw new
|
|
2011
|
+
throw new d(this.currentContext);
|
|
2012
2012
|
const r = "FILE REQUEST", s = Object.assign(
|
|
2013
2013
|
e,
|
|
2014
2014
|
this.createMessage(r, !1, t.id)
|
|
@@ -2029,14 +2029,14 @@ class xt {
|
|
|
2029
2029
|
*/
|
|
2030
2030
|
onFileRequestMessage() {
|
|
2031
2031
|
if (!this.isEmbedded())
|
|
2032
|
-
throw new
|
|
2032
|
+
throw new d(this.currentContext);
|
|
2033
2033
|
const t = "FILE REQUEST";
|
|
2034
2034
|
return this.incomingMessages$.pipe(
|
|
2035
2035
|
g(
|
|
2036
2036
|
(e) => e.type === t && e.target === "client" && e.replyTo === null
|
|
2037
2037
|
),
|
|
2038
2038
|
p((e) => (e.fileHash = e.fileHash.toLowerCase(), e)),
|
|
2039
|
-
f(this.logReceived(
|
|
2039
|
+
f(this.logReceived())
|
|
2040
2040
|
);
|
|
2041
2041
|
}
|
|
2042
2042
|
/**
|
|
@@ -2063,17 +2063,17 @@ class xt {
|
|
|
2063
2063
|
*/
|
|
2064
2064
|
sendFileSelectionMessage(t = "attachment", e, r, s, i, o) {
|
|
2065
2065
|
if (!this.isEmbedded())
|
|
2066
|
-
throw new
|
|
2066
|
+
throw new d(this.currentContext);
|
|
2067
2067
|
const a = "FILE SELECTION", c = this.createMessage(a);
|
|
2068
2068
|
if (c.intent = t, c.maxCount = s, c.maxFileSizeInBytes = i, c.mimeTypes = o, t === "attachment") {
|
|
2069
2069
|
if (!e)
|
|
2070
|
-
throw new
|
|
2070
|
+
throw new I(
|
|
2071
2071
|
"streamId",
|
|
2072
2072
|
e,
|
|
2073
2073
|
"streamId is required for attachment intent"
|
|
2074
2074
|
);
|
|
2075
2075
|
if (!r)
|
|
2076
|
-
throw new
|
|
2076
|
+
throw new I(
|
|
2077
2077
|
"correlationId",
|
|
2078
2078
|
r,
|
|
2079
2079
|
"correlationId is required for attachment intent"
|
|
@@ -2083,44 +2083,17 @@ class xt {
|
|
|
2083
2083
|
this.logCreated(a, c);
|
|
2084
2084
|
const u = this.incomingMessages$.pipe(
|
|
2085
2085
|
g(
|
|
2086
|
-
(
|
|
2086
|
+
(h) => h.type === a && h.replyTo === c.id
|
|
2087
2087
|
),
|
|
2088
|
-
p((
|
|
2089
|
-
var
|
|
2090
|
-
return
|
|
2088
|
+
p((h) => {
|
|
2089
|
+
var l;
|
|
2090
|
+
return h.files = (l = h.files) == null ? void 0 : l.map((b) => (b.original.fileHash = b.original.fileHash.toLowerCase(), b.preview && (b.preview.fileHash = b.preview.fileHash.toLowerCase()), b)), h;
|
|
2091
2091
|
}),
|
|
2092
|
-
f(this.logReceived(
|
|
2092
|
+
f(this.logReceived()),
|
|
2093
2093
|
m(1)
|
|
2094
2094
|
);
|
|
2095
2095
|
return this.port2.postMessage(c), this.logSent(a, c), u;
|
|
2096
2096
|
}
|
|
2097
|
-
/**
|
|
2098
|
-
* Sends a {@link FileDownloadMessage} to the Host app, to request the download of a file.
|
|
2099
|
-
*
|
|
2100
|
-
* @remarks
|
|
2101
|
-
* The file at the specified `url` is encrypted using the provided `key` and the Host app needs
|
|
2102
|
-
* to decrypt it.
|
|
2103
|
-
*
|
|
2104
|
-
* @param url - The URL to download the file from
|
|
2105
|
-
* @param key - The decryption key for the file stream
|
|
2106
|
-
* @param fileName - The name of the file to download
|
|
2107
|
-
* @param mimeType - The MIME type of the file to download
|
|
2108
|
-
* @returns An observable which emits a {@link FileDownloadMessageReply} instance containing the
|
|
2109
|
-
* file ID and the file size in bytes. Emits once.
|
|
2110
|
-
*/
|
|
2111
|
-
sendFileDownloadMessage(t, e, r, s) {
|
|
2112
|
-
if (!this.isEmbedded())
|
|
2113
|
-
throw new h(this.currentContext);
|
|
2114
|
-
const i = "FILE DOWNLOAD", o = this.createMessage(i);
|
|
2115
|
-
o.url = t, o.key = e, o.fileName = r, o.mimeType = s, this.logCreated(i, o);
|
|
2116
|
-
const a = this.incomingMessages$.pipe(
|
|
2117
|
-
g((c) => c.type === i && c.replyTo === o.id),
|
|
2118
|
-
f(this.logReceived(i)),
|
|
2119
|
-
p((c) => c),
|
|
2120
|
-
m(1)
|
|
2121
|
-
);
|
|
2122
|
-
return this.port2.postMessage(o), this.logSent(i, o), a;
|
|
2123
|
-
}
|
|
2124
2097
|
/**
|
|
2125
2098
|
* Sends a {@link FileDownloadProgressQueryMessage} to the Host app, to query the progress of a
|
|
2126
2099
|
* file download that was initiated by a {@link FileDownloadMessage}.
|
|
@@ -2133,25 +2106,26 @@ class xt {
|
|
|
2133
2106
|
* The `Host` app should reply with a {@link FileDownloadProgressUpdateMessage} containing the
|
|
2134
2107
|
* progress of the file download.
|
|
2135
2108
|
*
|
|
2136
|
-
* @param correlationId - A UUIDv4 string to identify the message this file was attached to.
|
|
2137
2109
|
* @param fileHash - SHA256 hash of the decrypted file.
|
|
2138
2110
|
* @param url - URL of the file being downloaded.
|
|
2111
|
+
* @param correlationId - _Optional_. A UUIDv4 string to identify the message this file was
|
|
2112
|
+
* attached to.
|
|
2139
2113
|
* @returns An observable which emits a {@link FileDownloadProgressUpdateMessage} instance
|
|
2140
2114
|
* containing the progress of the file download. Emits once.
|
|
2141
2115
|
*/
|
|
2142
2116
|
sendFileDownloadProgressQueryMessage(t, e, r) {
|
|
2143
2117
|
if (!this.isEmbedded())
|
|
2144
|
-
throw new
|
|
2118
|
+
throw new d(this.currentContext);
|
|
2145
2119
|
const s = "FILE DOWNLOAD PROGRESS QUERY", i = this.createMessage(
|
|
2146
2120
|
s,
|
|
2147
2121
|
!0
|
|
2148
2122
|
);
|
|
2149
|
-
i.
|
|
2123
|
+
i.fileHash = t.toLowerCase(), i.url = e, i.correlationId = r, this.logCreated(s, i);
|
|
2150
2124
|
const o = this.incomingMessages$.pipe(
|
|
2151
2125
|
g(
|
|
2152
2126
|
(a) => a.type === "FILE DOWNLOAD PROGRESS UPDATE" && a.replyTo === i.id
|
|
2153
2127
|
),
|
|
2154
|
-
f(this.logReceived(
|
|
2128
|
+
f((a) => this.logReceived(a)),
|
|
2155
2129
|
p((a) => (a.fileHash && (a.fileHash = a.fileHash.toLowerCase()), a)),
|
|
2156
2130
|
m(1)
|
|
2157
2131
|
);
|
|
@@ -2159,21 +2133,21 @@ class xt {
|
|
|
2159
2133
|
}
|
|
2160
2134
|
/**
|
|
2161
2135
|
* Setup listener for {@link FileDownloadProgressQueryMessage}, which can be sent by a `Host` app
|
|
2162
|
-
* to update the progress of a file download which was initiated by a {@link
|
|
2136
|
+
* to update the progress of a file download which was initiated by a {@link FileDownloadMessage}.
|
|
2163
2137
|
*
|
|
2164
2138
|
* @returns An observable which emits a {@link FileDownloadProgressUpdateMessage} instance
|
|
2165
2139
|
* containing the progress of the file download. Emits once.
|
|
2166
2140
|
*/
|
|
2167
2141
|
onFileDownloadProgressUpdateMessage() {
|
|
2168
2142
|
if (!this.isEmbedded())
|
|
2169
|
-
throw new
|
|
2143
|
+
throw new d(this.currentContext);
|
|
2170
2144
|
const t = "FILE DOWNLOAD PROGRESS UPDATE";
|
|
2171
2145
|
return this.incomingMessages$.pipe(
|
|
2172
2146
|
g(
|
|
2173
2147
|
(e) => e.type === t && e.target === "client" && e.replyTo === null
|
|
2174
2148
|
),
|
|
2175
2149
|
p((e) => (e.fileHash && (e.fileHash = e.fileHash.toLowerCase()), e)),
|
|
2176
|
-
f(this.logReceived(
|
|
2150
|
+
f(this.logReceived())
|
|
2177
2151
|
);
|
|
2178
2152
|
}
|
|
2179
2153
|
/**
|
|
@@ -2184,25 +2158,25 @@ class xt {
|
|
|
2184
2158
|
* The `host` app should reply with a {@link FileUploadProgressUpdateMessage} containing the
|
|
2185
2159
|
* progress of the file upload.
|
|
2186
2160
|
*
|
|
2187
|
-
* @param correlationId - A UUIDv4 string to identify the message this file was attached to.
|
|
2188
2161
|
* @param fileHash - SHA256 hash of the decrypted file.
|
|
2189
2162
|
* @param fileId - ID of the original file being uploaded.
|
|
2163
|
+
* @param correlationId - _Optional_. A UUIDv4 string to identify the message this file was attached to.
|
|
2190
2164
|
* @returns An observable which emits a {@link FileUploadProgressUpdateMessage} instance
|
|
2191
2165
|
* containing the progress of the file upload. Emits once.
|
|
2192
2166
|
*/
|
|
2193
2167
|
sendFileUploadProgressQueryMessage(t, e, r) {
|
|
2194
2168
|
if (!this.isEmbedded())
|
|
2195
|
-
throw new
|
|
2169
|
+
throw new d(this.currentContext);
|
|
2196
2170
|
const s = "FILE UPLOAD PROGRESS QUERY", i = this.createMessage(
|
|
2197
2171
|
s,
|
|
2198
2172
|
!0
|
|
2199
2173
|
);
|
|
2200
|
-
i.
|
|
2174
|
+
i.fileHash = t.toLowerCase(), i.fileId = e, i.correlationId = r, this.logCreated(s, i);
|
|
2201
2175
|
const o = this.incomingMessages$.pipe(
|
|
2202
2176
|
g(
|
|
2203
|
-
(a) => a.type === "FILE
|
|
2177
|
+
(a) => a.type === "FILE UPLOAD PROGRESS UPDATE" && a.replyTo === i.id
|
|
2204
2178
|
),
|
|
2205
|
-
f(this.logReceived(
|
|
2179
|
+
f(this.logReceived()),
|
|
2206
2180
|
p((a) => (a.fileHash && (a.fileHash = a.fileHash.toLowerCase()), a)),
|
|
2207
2181
|
m(1)
|
|
2208
2182
|
);
|
|
@@ -2221,61 +2195,67 @@ class xt {
|
|
|
2221
2195
|
*/
|
|
2222
2196
|
onFileUploadProgressUpdateMessage() {
|
|
2223
2197
|
if (!this.isEmbedded())
|
|
2224
|
-
throw new
|
|
2198
|
+
throw new d(this.currentContext);
|
|
2225
2199
|
const t = "FILE UPLOAD PROGRESS UPDATE";
|
|
2226
2200
|
return this.incomingMessages$.pipe(
|
|
2227
2201
|
g(
|
|
2228
2202
|
(e) => e.type === t && e.target === "client" && e.replyTo === null
|
|
2229
2203
|
),
|
|
2230
2204
|
p((e) => (e.fileHash && (e.fileHash = e.fileHash.toLowerCase()), e)),
|
|
2231
|
-
f(this.logReceived(
|
|
2205
|
+
f(this.logReceived())
|
|
2232
2206
|
);
|
|
2233
2207
|
}
|
|
2234
2208
|
/**
|
|
2235
|
-
* Sends a {@link
|
|
2236
|
-
* have in it's storage.
|
|
2209
|
+
* Sends a {@link FileDownloadMessage} to the Host app, to download a file.
|
|
2237
2210
|
*
|
|
2238
2211
|
* @remarks
|
|
2239
2212
|
* The `fileHash` parameter is the SHA256 hash of the decrypted file, which is used as an
|
|
2240
2213
|
* identifier for the target file in the `Host` app as well as to verify the integrity of the
|
|
2241
2214
|
* file.
|
|
2242
2215
|
*
|
|
2243
|
-
*
|
|
2244
|
-
* @
|
|
2245
|
-
*
|
|
2246
|
-
* @param url -
|
|
2216
|
+
* If the `host` already has the file in it's storage, it can reply with a
|
|
2217
|
+
* {@link FileDownloadSkippedResult} to notify the client that the download was skipped.
|
|
2218
|
+
*
|
|
2219
|
+
* @param url - URL from where the host should download the file if it isn't in storage.
|
|
2220
|
+
* @param key - Key used to encrypt the original attachment.
|
|
2221
|
+
* @param fileHash - The SHA256 hash of the file to download.
|
|
2222
|
+
* @param mimeType - The MIME type of the file to download.
|
|
2223
|
+
* @param fileName - _Optional_. The name of the file to download.
|
|
2224
|
+
* @param streamId - _Optional_. ID of the message stream from which the file is downloaded from.
|
|
2247
2225
|
* @param correlationId - _Optional_. Correlation ID of the message this file was attached to.
|
|
2248
|
-
* @param key - _Optional_. Key used to encrypt the original attachment.
|
|
2249
2226
|
* @param sender - _Optional_. The {@link ContactItem} of the sender of the file.
|
|
2227
|
+
* @param intent - _Optional_. The intent of the file download. Can be either `download` or
|
|
2228
|
+
* `open`. Defaults to `download`.
|
|
2250
2229
|
*
|
|
2251
|
-
* @returns An observable which emits a {@link
|
|
2230
|
+
* @returns An observable which emits a {@link FileDownloadMessageReply} instance containing the
|
|
2252
2231
|
* result of the request. Emits once.
|
|
2253
2232
|
*/
|
|
2254
|
-
|
|
2233
|
+
sendFileDownloadMessage(t, e, r, s, i, o, a, c, u) {
|
|
2255
2234
|
if (!this.isEmbedded())
|
|
2256
|
-
throw new
|
|
2257
|
-
const
|
|
2258
|
-
|
|
2259
|
-
const
|
|
2260
|
-
g((
|
|
2261
|
-
f(this.logReceived(
|
|
2262
|
-
p((
|
|
2235
|
+
throw new d(this.currentContext);
|
|
2236
|
+
const h = "FILE DOWNLOAD", l = this.createMessage(h, !0);
|
|
2237
|
+
l.url = t, l.key = e, l.fileHash = r.toLowerCase(), l.mimeType = s, l.fileName = i, l.streamId = o, l.correlationId = a, l.sender = c, l.intent = u ?? "download", this.logCreated(h, l);
|
|
2238
|
+
const b = this.incomingMessages$.pipe(
|
|
2239
|
+
g((v) => v.type === h && v.replyTo === l.id),
|
|
2240
|
+
f(this.logReceived()),
|
|
2241
|
+
p((v) => v),
|
|
2263
2242
|
m(1)
|
|
2264
2243
|
);
|
|
2265
|
-
return this.port2.postMessage(
|
|
2244
|
+
return this.port2.postMessage(l), this.logSent(h, l), b;
|
|
2266
2245
|
}
|
|
2267
2246
|
/**
|
|
2268
|
-
* Sends a {@link
|
|
2269
|
-
* that was initiated by a {@link
|
|
2247
|
+
* Sends a {@link CancelFileDownloadMessage} to the Host app, to cancel downloading of a file
|
|
2248
|
+
* that was initiated by a {@link FileDownloadMessage} previously.
|
|
2270
2249
|
*
|
|
2271
|
-
* @param
|
|
2272
|
-
* @param
|
|
2250
|
+
* @param fileHash - SHA256 hash of the file to cancel downloading.
|
|
2251
|
+
* @param url - URL of the file to cancel download.
|
|
2252
|
+
* @param correlationId - _Optional_. UUIDv4 string to identify the message this file was attached to.
|
|
2273
2253
|
*/
|
|
2274
|
-
|
|
2254
|
+
sendCancelFileDownloadMessage(t, e, r) {
|
|
2275
2255
|
if (!this.isEmbedded())
|
|
2276
|
-
throw new
|
|
2277
|
-
const
|
|
2278
|
-
|
|
2256
|
+
throw new d(this.currentContext);
|
|
2257
|
+
const s = "CANCEL FILE DOWNLOAD", i = this.createMessage(s, !1);
|
|
2258
|
+
i.fileHash = t.toLowerCase(), i.url = e, i.correlationId = r, this.logCreated(s, i), this.port2.postMessage(i), this.logSent(s, i);
|
|
2279
2259
|
}
|
|
2280
2260
|
/**
|
|
2281
2261
|
* Sends a {@link FileRemoveMessage} to the Host app, to request removal of a file from the
|
|
@@ -2294,12 +2274,12 @@ class xt {
|
|
|
2294
2274
|
*/
|
|
2295
2275
|
sendFileRemoveMessage(t, e) {
|
|
2296
2276
|
if (!this.isEmbedded())
|
|
2297
|
-
throw new
|
|
2277
|
+
throw new d(this.currentContext);
|
|
2298
2278
|
const r = "FILE REMOVE", s = this.createMessage(r, !0);
|
|
2299
2279
|
s.hash = t.toLowerCase(), s.streamId = e, this.logCreated(r, s);
|
|
2300
2280
|
const i = this.incomingMessages$.pipe(
|
|
2301
2281
|
g((o) => o.type === r && o.replyTo === s.id),
|
|
2302
|
-
f(this.logReceived(
|
|
2282
|
+
f(this.logReceived()),
|
|
2303
2283
|
p((o) => o),
|
|
2304
2284
|
m(1)
|
|
2305
2285
|
);
|
|
@@ -2320,7 +2300,7 @@ class xt {
|
|
|
2320
2300
|
*/
|
|
2321
2301
|
sendAppResetMessage() {
|
|
2322
2302
|
if (!this.isEmbedded())
|
|
2323
|
-
throw new
|
|
2303
|
+
throw new d(this.currentContext);
|
|
2324
2304
|
const t = "APP RESET", e = this.createMessage(t, !1);
|
|
2325
2305
|
this.logCreated(t, e), this.port2.postMessage(e), this.logSent(t, e);
|
|
2326
2306
|
}
|
|
@@ -2344,7 +2324,7 @@ class xt {
|
|
|
2344
2324
|
*/
|
|
2345
2325
|
sendMessageSentMessage(t, e) {
|
|
2346
2326
|
if (!this.isEmbedded())
|
|
2347
|
-
throw new
|
|
2327
|
+
throw new d(this.currentContext);
|
|
2348
2328
|
const r = "MESSAGE SENT", s = this.createMessage(r, !1);
|
|
2349
2329
|
s.streamId = t, s.correlationId = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
2350
2330
|
}
|
|
@@ -2363,20 +2343,21 @@ class xt {
|
|
|
2363
2343
|
* @param setCursors - _Optional_. Whether to set the cursors for the message. Defaults to `true`.
|
|
2364
2344
|
* @param threadId - _Optional_. The ID of the thread the message is being sent to.
|
|
2365
2345
|
*
|
|
2366
|
-
* @returns
|
|
2346
|
+
* @returns An observable which emits a {@link SendMessageMessageReply} instance containing the
|
|
2347
|
+
* result of the request. Emits once.
|
|
2367
2348
|
*/
|
|
2368
2349
|
sendSendMessageMessage(t, e, r, s = "TEXT", i, o, a, c = !0, u) {
|
|
2369
2350
|
if (!this.isEmbedded())
|
|
2370
|
-
throw new
|
|
2371
|
-
const
|
|
2372
|
-
|
|
2373
|
-
const
|
|
2374
|
-
g((
|
|
2375
|
-
f(this.logReceived(
|
|
2376
|
-
p((
|
|
2351
|
+
throw new d(this.currentContext);
|
|
2352
|
+
const h = "SEND MESSAGE", l = this.createMessage(h, !0);
|
|
2353
|
+
l.streamId = t, l.correlationId = e, l.body = r, l.messageType = s, l.mentions = i ?? [], l.attachments = (o == null ? void 0 : o.map((v) => v.toLowerCase())) ?? [], l.relatedMessageId = a, l.setCursors = c, l.threadId = u, this.logCreated(h, l);
|
|
2354
|
+
const b = this.incomingMessages$.pipe(
|
|
2355
|
+
g((v) => v.type === h && v.replyTo === l.id),
|
|
2356
|
+
f(this.logReceived()),
|
|
2357
|
+
p((v) => v),
|
|
2377
2358
|
m(1)
|
|
2378
2359
|
);
|
|
2379
|
-
return this.port2.postMessage(
|
|
2360
|
+
return this.port2.postMessage(l), this.logSent(h, l), b;
|
|
2380
2361
|
}
|
|
2381
2362
|
/**
|
|
2382
2363
|
* Sends a {@link CancelSendMessageMessage} to the Host app, to cancel a message that was being
|
|
@@ -2389,21 +2370,21 @@ class xt {
|
|
|
2389
2370
|
*/
|
|
2390
2371
|
sendCancelSendMessageMessage(t, e) {
|
|
2391
2372
|
if (!this.isEmbedded())
|
|
2392
|
-
throw new
|
|
2373
|
+
throw new d(this.currentContext);
|
|
2393
2374
|
const r = "CANCEL SEND MESSAGE", s = this.createMessage(r, !1);
|
|
2394
2375
|
s.streamId = t, s.correlationId = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
2395
2376
|
}
|
|
2396
2377
|
/**
|
|
2397
|
-
* Sends a {@link
|
|
2378
|
+
* Sends a {@link MessageDeletedMessage} to the Host app, to notify deletion of a message from the
|
|
2398
2379
|
* specified stream.
|
|
2399
2380
|
*
|
|
2400
2381
|
* @param correlationId - UUIDv4 string of the message to be deleted.
|
|
2401
2382
|
* @param streamId - ID of the stream the message was sent to.
|
|
2402
2383
|
*/
|
|
2403
|
-
|
|
2384
|
+
sendMessageDeletedMessage(t, e) {
|
|
2404
2385
|
if (!this.isEmbedded())
|
|
2405
|
-
throw new
|
|
2406
|
-
const r = "
|
|
2386
|
+
throw new d(this.currentContext);
|
|
2387
|
+
const r = "MESSAGE DELETED", s = this.createMessage(r, !1);
|
|
2407
2388
|
s.correlationId = t, s.streamId = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
|
|
2408
2389
|
}
|
|
2409
2390
|
/**
|
|
@@ -2421,14 +2402,14 @@ class xt {
|
|
|
2421
2402
|
*/
|
|
2422
2403
|
sendSendMessageStatusQueryMessage(t, e) {
|
|
2423
2404
|
if (!this.isEmbedded())
|
|
2424
|
-
throw new
|
|
2405
|
+
throw new d(this.currentContext);
|
|
2425
2406
|
const r = "SEND MESSAGE STATUS QUERY", s = this.createMessage(r, !0);
|
|
2426
2407
|
s.correlationId = t, s.streamId = e, this.logCreated(r, s);
|
|
2427
2408
|
const i = this.incomingMessages$.pipe(
|
|
2428
2409
|
g(
|
|
2429
2410
|
(o) => o.type === "SEND MESSAGE STATUS UPDATE" && o.replyTo === s.id
|
|
2430
2411
|
),
|
|
2431
|
-
f(this.logReceived(
|
|
2412
|
+
f(this.logReceived()),
|
|
2432
2413
|
p((o) => o),
|
|
2433
2414
|
m(1)
|
|
2434
2415
|
);
|
|
@@ -2443,12 +2424,12 @@ class xt {
|
|
|
2443
2424
|
*/
|
|
2444
2425
|
onSendMessageStatusUpdateMessage() {
|
|
2445
2426
|
if (!this.isEmbedded())
|
|
2446
|
-
throw new
|
|
2427
|
+
throw new d(this.currentContext);
|
|
2447
2428
|
const t = "SEND MESSAGE STATUS UPDATE";
|
|
2448
2429
|
return this.incomingMessages$.pipe(
|
|
2449
2430
|
g((e) => e.type === t && e.target === "client" && e.replyTo === null),
|
|
2450
2431
|
p((e) => e),
|
|
2451
|
-
f(this.logReceived(
|
|
2432
|
+
f(this.logReceived())
|
|
2452
2433
|
);
|
|
2453
2434
|
}
|
|
2454
2435
|
/**
|
|
@@ -2459,7 +2440,7 @@ class xt {
|
|
|
2459
2440
|
*/
|
|
2460
2441
|
sendSipCallMessage(t) {
|
|
2461
2442
|
if (!this.isEmbedded())
|
|
2462
|
-
throw new
|
|
2443
|
+
throw new d(this.currentContext);
|
|
2463
2444
|
const e = "SIP CALL", r = this.createMessage(e, !1);
|
|
2464
2445
|
r.contact = t, this.logCreated(e, r), this.port2.postMessage(r), this.logSent(e, r);
|
|
2465
2446
|
}
|
|
@@ -2502,10 +2483,16 @@ class xt {
|
|
|
2502
2483
|
compareVersion(t) {
|
|
2503
2484
|
return ne(this.negotiatedProtocolVersion, t);
|
|
2504
2485
|
}
|
|
2505
|
-
logReceived(t
|
|
2506
|
-
e
|
|
2507
|
-
|
|
2508
|
-
|
|
2486
|
+
logReceived(t) {
|
|
2487
|
+
const e = (r) => this.logService.debug(
|
|
2488
|
+
`[IPC] Received ${r.type} message${r.replyTo ? " reply" : ""}`,
|
|
2489
|
+
r
|
|
2490
|
+
);
|
|
2491
|
+
if (t) {
|
|
2492
|
+
It(t) && (t = { ...t, data: "..." }), e(t);
|
|
2493
|
+
return;
|
|
2494
|
+
} else
|
|
2495
|
+
return e;
|
|
2509
2496
|
}
|
|
2510
2497
|
logSent(t, e) {
|
|
2511
2498
|
e.type === "FILE REQUEST" && e.result === "success" && (e = { ...e, data: "..." }), this.logService.debug(`[IPC] Sent ${t} message`, e);
|
|
@@ -2565,14 +2552,18 @@ class Pt {
|
|
|
2565
2552
|
/**
|
|
2566
2553
|
* The type of the `Host` app the `Client` is embedded in.
|
|
2567
2554
|
*/
|
|
2568
|
-
|
|
2555
|
+
x(this, "host");
|
|
2569
2556
|
/**
|
|
2570
2557
|
* The cloud ID of the `Host` app the `Client` is embedded in.
|
|
2571
2558
|
*/
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2559
|
+
x(this, "cloudId");
|
|
2560
|
+
/**
|
|
2561
|
+
* The cloud username of the logged in user.
|
|
2562
|
+
*/
|
|
2563
|
+
x(this, "cloudUsername");
|
|
2564
|
+
x(this, "logger");
|
|
2565
|
+
x(this, "helper");
|
|
2566
|
+
x(this, "listeners");
|
|
2576
2567
|
this.logger = t ?? console, this.helper = new xt(Tt, this.logger), this.listeners = /* @__PURE__ */ new Map(), this.listeners.set(w.BadgeQuery, /* @__PURE__ */ new Set()), this.listeners.set(w.Lifecycle, /* @__PURE__ */ new Set()), this.listeners.set(w.PushToken, /* @__PURE__ */ new Set());
|
|
2577
2568
|
}
|
|
2578
2569
|
/**
|
|
@@ -2627,7 +2618,7 @@ class Pt {
|
|
|
2627
2618
|
this.logger.debug("Received Push Token: ", e);
|
|
2628
2619
|
for (const s of ((r = this.listeners.get(w.PushToken)) == null ? void 0 : r.values()) ?? [])
|
|
2629
2620
|
s(e.pushToken, e.appId, e.selector);
|
|
2630
|
-
}), this.cloudId = t.cloudId, this.host = t.host;
|
|
2621
|
+
}), this.cloudId = t.cloudId, this.cloudUsername = t.cloudUsername, this.host = t.host;
|
|
2631
2622
|
}),
|
|
2632
2623
|
O(() => {
|
|
2633
2624
|
})
|
|
@@ -2639,7 +2630,7 @@ class Pt {
|
|
|
2639
2630
|
let i;
|
|
2640
2631
|
if (e === "multi") {
|
|
2641
2632
|
if (!r || !Array.isArray(r))
|
|
2642
|
-
throw new
|
|
2633
|
+
throw new I(
|
|
2643
2634
|
"currentContacts",
|
|
2644
2635
|
r,
|
|
2645
2636
|
"currentContacts is required for group streams"
|