fcr-core 3.10.2 → 3.10.5

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.
Files changed (127) hide show
  1. package/lib/engine/index.js +102 -108
  2. package/lib/imports.js +1 -0
  3. package/lib/media-control/desktop.js +22 -13
  4. package/lib/media-control/mobile.js +27 -19
  5. package/lib/media-control/type.d.ts +3 -3
  6. package/lib/monitor-control/index.js +17 -7
  7. package/lib/peer-session/index.js +120 -121
  8. package/lib/plugins/chat/chatroom.js +119 -96
  9. package/lib/plugins/chat/connector.js +69 -48
  10. package/lib/remote-control/index.js +194 -216
  11. package/lib/room-control/ability-control/index.js +20 -10
  12. package/lib/room-control/application-control/index.js +82 -75
  13. package/lib/room-control/group-control/index.js +31 -30
  14. package/lib/room-control/helpers/board-init-info-helper.js +16 -10
  15. package/lib/room-control/helpers/validation-helper.js +1 -1
  16. package/lib/room-control/index.js +70 -51
  17. package/lib/room-control/infinity-room-control/index.js +27 -19
  18. package/lib/room-control/interpreter-control/index.js +77 -65
  19. package/lib/room-control/interpreter-control/room.js +6 -4
  20. package/lib/room-control/join-before-host-waitingroom-control/index.js +6 -4
  21. package/lib/room-control/mainroom-control/index.js +37 -25
  22. package/lib/room-control/privilege-control/helper.js +28 -13
  23. package/lib/room-control/privilege-control/index.js +36 -28
  24. package/lib/room-control/room-connector-control/index.js +52 -49
  25. package/lib/room-control/room-connector-control/type.d.ts +1 -1
  26. package/lib/room-control/room-control-factory.js +10 -12
  27. package/lib/room-control/room-session/index.js +77 -74
  28. package/lib/room-control/shared-cache.js +63 -56
  29. package/lib/room-control/sharing-control/index.js +65 -57
  30. package/lib/room-control/stream-control/index.js +197 -193
  31. package/lib/room-control/stt-control/de-compress-gzip.js +10 -0
  32. package/lib/room-control/stt-control/index.js +93 -86
  33. package/lib/room-control/user-control/index.js +162 -155
  34. package/lib/room-control/waitingroom-control/index.js +18 -9
  35. package/lib/room-control/whiteboard-control/utils.js +4 -2
  36. package/lib/room-control/whiteboard-control-v1/board-subwindow.js +2 -1
  37. package/lib/room-control/whiteboard-control-v1/board-window.js +120 -103
  38. package/lib/room-control/whiteboard-control-v1/factory.js +7 -4
  39. package/lib/room-control/whiteboard-control-v1/index.js +80 -67
  40. package/lib/room-control/whiteboard-control-v1/mount-manager.js +4 -2
  41. package/lib/room-control/whiteboard-control-v1/utils.js +17 -14
  42. package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +14 -10
  43. package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +17 -8
  44. package/lib/room-control/whiteboard-control-v2/base/index.js +61 -53
  45. package/lib/room-control/whiteboard-control-v2/base/main-window.js +39 -30
  46. package/lib/room-control/whiteboard-control-v2/utils.js +10 -10
  47. package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +45 -33
  48. package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +27 -11
  49. package/lib/room-control/widget-control/index.js +43 -33
  50. package/lib/room-router/index.js +66 -58
  51. package/lib/schema.d.ts +15 -15
  52. package/lib/service/api.js +446 -548
  53. package/lib/struct.js +5 -2
  54. package/lib/utilities/abortable-retry.js +3 -0
  55. package/lib/utilities/collection.js +15 -11
  56. package/lib/utilities/error-helpers.js +34 -27
  57. package/lib/utilities/error.js +4 -3
  58. package/lib/utilities/join-helper.js +37 -31
  59. package/lib/utilities/logger.js +8 -5
  60. package/lib/utilities/parameters.js +21 -10
  61. package/lib/utilities/retry-helpers.js +1 -0
  62. package/lib/utilities/stream.js +16 -11
  63. package/lib/utilities/user.js +4 -3
  64. package/lib/utilities/validate-params.js +1 -1
  65. package/lib/utilities/video-encoder-config.js +10 -5
  66. package/lib-es/engine/index.js +102 -108
  67. package/lib-es/media-control/desktop.js +22 -13
  68. package/lib-es/media-control/mobile.js +27 -19
  69. package/lib-es/monitor-control/index.js +16 -7
  70. package/lib-es/peer-session/index.js +120 -121
  71. package/lib-es/plugins/chat/chatroom.js +118 -95
  72. package/lib-es/plugins/chat/connector.js +67 -47
  73. package/lib-es/remote-control/index.js +194 -216
  74. package/lib-es/room-control/ability-control/index.js +19 -10
  75. package/lib-es/room-control/application-control/index.js +81 -75
  76. package/lib-es/room-control/group-control/index.js +31 -30
  77. package/lib-es/room-control/helpers/board-init-info-helper.js +15 -10
  78. package/lib-es/room-control/helpers/validation-helper.js +1 -1
  79. package/lib-es/room-control/index.js +69 -51
  80. package/lib-es/room-control/infinity-room-control/index.js +26 -19
  81. package/lib-es/room-control/interpreter-control/index.js +77 -65
  82. package/lib-es/room-control/interpreter-control/room.js +5 -4
  83. package/lib-es/room-control/join-before-host-waitingroom-control/index.js +5 -4
  84. package/lib-es/room-control/mainroom-control/index.js +37 -25
  85. package/lib-es/room-control/privilege-control/helper.js +27 -13
  86. package/lib-es/room-control/privilege-control/index.js +36 -28
  87. package/lib-es/room-control/room-connector-control/index.js +52 -49
  88. package/lib-es/room-control/room-control-factory.js +10 -12
  89. package/lib-es/room-control/room-session/index.js +77 -74
  90. package/lib-es/room-control/shared-cache.js +62 -56
  91. package/lib-es/room-control/sharing-control/index.js +64 -57
  92. package/lib-es/room-control/stream-control/index.js +197 -193
  93. package/lib-es/room-control/stt-control/de-compress-gzip.js +10 -0
  94. package/lib-es/room-control/stt-control/index.js +93 -86
  95. package/lib-es/room-control/user-control/index.js +162 -155
  96. package/lib-es/room-control/waitingroom-control/index.js +18 -9
  97. package/lib-es/room-control/whiteboard-control/utils.js +4 -2
  98. package/lib-es/room-control/whiteboard-control-v1/board-subwindow.js +2 -1
  99. package/lib-es/room-control/whiteboard-control-v1/board-window.js +120 -103
  100. package/lib-es/room-control/whiteboard-control-v1/factory.js +6 -4
  101. package/lib-es/room-control/whiteboard-control-v1/index.js +80 -67
  102. package/lib-es/room-control/whiteboard-control-v1/mount-manager.js +3 -2
  103. package/lib-es/room-control/whiteboard-control-v1/utils.js +17 -14
  104. package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +13 -10
  105. package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +16 -8
  106. package/lib-es/room-control/whiteboard-control-v2/base/index.js +60 -53
  107. package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +39 -30
  108. package/lib-es/room-control/whiteboard-control-v2/utils.js +10 -10
  109. package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +45 -33
  110. package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +26 -11
  111. package/lib-es/room-control/widget-control/index.js +42 -33
  112. package/lib-es/room-router/index.js +66 -58
  113. package/lib-es/service/api.js +445 -548
  114. package/lib-es/struct.js +4 -2
  115. package/lib-es/utilities/abortable-retry.js +3 -0
  116. package/lib-es/utilities/collection.js +14 -11
  117. package/lib-es/utilities/error-helpers.js +33 -26
  118. package/lib-es/utilities/error.js +4 -3
  119. package/lib-es/utilities/join-helper.js +36 -29
  120. package/lib-es/utilities/logger.js +7 -5
  121. package/lib-es/utilities/parameters.js +21 -10
  122. package/lib-es/utilities/retry-helpers.js +1 -0
  123. package/lib-es/utilities/stream.js +15 -11
  124. package/lib-es/utilities/user.js +4 -3
  125. package/lib-es/utilities/validate-params.js +1 -1
  126. package/lib-es/utilities/video-encoder-config.js +10 -5
  127. package/package.json +4 -4
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.symbol.description.js");
4
+ require("core-js/modules/es.error.cause.js");
3
5
  require("core-js/modules/es.array.push.js");
4
6
  require("core-js/modules/esnext.function.metadata.js");
7
+ require("core-js/modules/esnext.iterator.constructor.js");
8
+ require("core-js/modules/esnext.iterator.filter.js");
9
+ require("core-js/modules/esnext.iterator.for-each.js");
5
10
  require("core-js/modules/esnext.map.delete-all.js");
6
11
  require("core-js/modules/esnext.map.emplace.js");
7
12
  require("core-js/modules/esnext.map.every.js");
@@ -17,47 +22,52 @@ require("core-js/modules/esnext.map.reduce.js");
17
22
  require("core-js/modules/esnext.map.some.js");
18
23
  require("core-js/modules/esnext.map.update.js");
19
24
  require("core-js/modules/esnext.symbol.metadata.js");
25
+ require("core-js/modules/web.dom-collections.iterator.js");
20
26
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
21
27
  Object.defineProperty(exports, "__esModule", {
22
28
  value: true
23
29
  });
24
30
  exports.KEEPALIVE_TIMEOUT_MULTIPLIER = exports.FcrRemoteControlImpl = void 0;
25
31
  require("core-js/modules/es.json.stringify.js");
32
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
33
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
34
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
26
35
  var _type = require("./type");
27
36
  var _imports = require("../imports");
28
37
  var _validateParams = _interopRequireDefault(require("../utilities/validate-params"));
29
38
  var _logger = require("../utilities/logger");
30
39
  var _schema = require("../schema");
31
40
  var _error = require("../utilities/error");
32
- let _initProto, _startRemoteControlRequestDecs, _acceptRemoteControlRequestDecs, _rejectRemoteControlRequestDecs, _terminateRemoteControlDecs, _updateRemoteControlConnectionStateDecs;
41
+ const _excluded = ["action", "keepAlive"],
42
+ _excluded2 = ["action"];
43
+ var _FcrRemoteControlImpl;
44
+ let _initProto, _startRemoteControlRequestDecs, _acceptRemoteControlRequestDecs, _rejectRemoteControlRequestDecs, _terminateRemoteControlDecs, _updateRemoteControlConnectionStateDecs, _ref;
45
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
46
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
33
47
  function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
34
48
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
35
49
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
36
50
  function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
37
51
  function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
38
52
  const KEEPALIVE_TIMEOUT_MULTIPLIER = exports.KEEPALIVE_TIMEOUT_MULTIPLIER = 2;
53
+ _ref = (_startRemoteControlRequestDecs = [(0, _imports.trace)(['params']), (0, _validateParams.default)(_schema.fcrRemoteControlSessionParamsSchema)], _acceptRemoteControlRequestDecs = [(0, _imports.trace)(['sessionId', 'cause']), (0, _validateParams.default)(_schema.stringSchema, _schema.stringKeyUnknownValueSchema.optional())], _rejectRemoteControlRequestDecs = [(0, _imports.trace)(['sessionId', 'cause']), (0, _validateParams.default)(_schema.stringSchema, _schema.stringKeyUnknownValueSchema.optional())], _terminateRemoteControlDecs = [(0, _imports.trace)(['sessionId', 'cause']), (0, _validateParams.default)(_schema.stringSchema, _schema.stringKeyUnknownValueSchema.optional())], _updateRemoteControlConnectionStateDecs = [(0, _imports.trace)(['sessionId', 'state', 'cause']), (0, _validateParams.default)(_schema.stringSchema, _schema.fcrRemoteControlConnectionStateTypeSchema, _schema.stringKeyUnknownValueSchema.optional())], "logger");
39
54
  class FcrRemoteControlImpl {
40
- static {
41
- [_initProto] = _applyDecs(this, [[_startRemoteControlRequestDecs, 2, "startRemoteControlRequest"], [_acceptRemoteControlRequestDecs, 2, "acceptRemoteControlRequest"], [_rejectRemoteControlRequestDecs, 2, "rejectRemoteControlRequest"], [_terminateRemoteControlDecs, 2, "terminateRemoteControl"], [_updateRemoteControlConnectionStateDecs, 2, "updateRemoteControlConnectionState"], [_imports.trace, 2, "getRemoteControlState"], [_imports.bound, 2, "_notifyRemoteControlState"]], []).e;
42
- }
43
- [(_startRemoteControlRequestDecs = [(0, _imports.trace)(['params']), (0, _validateParams.default)(_schema.fcrRemoteControlSessionParamsSchema)], _acceptRemoteControlRequestDecs = [(0, _imports.trace)(['sessionId', 'cause']), (0, _validateParams.default)(_schema.stringSchema, _schema.stringKeyUnknownValueSchema.optional())], _rejectRemoteControlRequestDecs = [(0, _imports.trace)(['sessionId', 'cause']), (0, _validateParams.default)(_schema.stringSchema, _schema.stringKeyUnknownValueSchema.optional())], _terminateRemoteControlDecs = [(0, _imports.trace)(['sessionId', 'cause']), (0, _validateParams.default)(_schema.stringSchema, _schema.stringKeyUnknownValueSchema.optional())], _updateRemoteControlConnectionStateDecs = [(0, _imports.trace)(['sessionId', 'state', 'cause']), (0, _validateParams.default)(_schema.stringSchema, _schema.fcrRemoteControlConnectionStateTypeSchema, _schema.stringKeyUnknownValueSchema.optional())], "logger")] = (_initProto(this), (0, _logger.createLogger)({
44
- prefix: 'FcrRemoteControlImpl'
45
- }));
46
- _remoteControlSessionKey = 'remote-control';
47
- _observable = new _imports.AgoraObservable();
48
- //@internal
49
- _taskInterval = _imports.Duration.second(1);
50
- //@internal
51
-
52
- //@internal
53
- _engineObserver = {
54
- onPeerMessageReceived: this._handleRemoteControlMessage.bind(this)
55
- };
56
- //@internal 控制端会话信息
57
- _activeRemoteControlSession = null;
58
- //@internal 被控制端会话信息
59
- _receivedRemoteControlSession = null;
60
55
  constructor(_rteEngine, _api, _userId) {
56
+ (0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
57
+ prefix: 'FcrRemoteControlImpl'
58
+ })));
59
+ (0, _defineProperty2.default)(this, "_remoteControlSessionKey", 'remote-control');
60
+ (0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
61
+ //@internal
62
+ (0, _defineProperty2.default)(this, "_taskInterval", _imports.Duration.second(1));
63
+ //@internal
64
+ (0, _defineProperty2.default)(this, "_engineObserver", {
65
+ onPeerMessageReceived: this._handleRemoteControlMessage.bind(this)
66
+ });
67
+ //@internal 控制端会话信息
68
+ (0, _defineProperty2.default)(this, "_activeRemoteControlSession", null);
69
+ //@internal 被控制端会话信息
70
+ (0, _defineProperty2.default)(this, "_receivedRemoteControlSession", null);
61
71
  this._rteEngine = _rteEngine;
62
72
  this._api = _api;
63
73
  this._userId = _userId;
@@ -65,30 +75,27 @@ class FcrRemoteControlImpl {
65
75
  this._executeTask = this._executeTask.bind(this);
66
76
  this._rteEngine.addObserver(this._engineObserver);
67
77
  this._task = _imports.AgoraScheduler.shared.addPollingTask(this._executeTask, this._taskInterval, true, () => _imports.ActionWhenTaskFail.CONTINUE);
68
- this.logger.info(`remote control initialized FcrRemoteControlImpl userId: ${this._userId}`);
78
+ this.logger.info("remote control initialized FcrRemoteControlImpl userId: ".concat(this._userId));
69
79
  }
70
80
 
71
81
  //@internal
72
82
  async _handleRemoteControlMessage(message) {
73
- const {
74
- senderId,
75
- payload
76
- } = message;
77
- const {
78
- data,
79
- cmd
80
- } = payload;
81
- const logContext = `cmd=${cmd}, sessionKey=${data.sessionKey}, sessionId=${data.sessionUuid}, ` + `action=${String(data.action)}, senderId=${senderId}, keepAlive=${!!data.keepAlive}`;
83
+ const senderId = message.senderId,
84
+ payload = message.payload;
85
+ const _ref2 = payload,
86
+ data = _ref2.data,
87
+ cmd = _ref2.cmd;
88
+ const logContext = "cmd=".concat(cmd, ", sessionKey=").concat(data.sessionKey, ", sessionId=").concat(data.sessionUuid, ", ") + "action=".concat(String(data.action), ", senderId=").concat(senderId, ", keepAlive=").concat(!!data.keepAlive);
82
89
  if (data.sessionKey !== this._remoteControlSessionKey) {
83
- this.logger.info(`[RemoteControl] ignore peer message because sessionKey does not match remote-control: ${logContext}`);
90
+ this.logger.info("[RemoteControl] ignore peer message because sessionKey does not match remote-control: ".concat(logContext));
84
91
  return;
85
92
  }
86
93
  if (cmd === '1001') {
87
94
  if (!data.keepAlive) {
88
- this.logger.info(`[RemoteControl] ignore remote-control update without keepAlive: ${logContext}`);
95
+ this.logger.info("[RemoteControl] ignore remote-control update without keepAlive: ".concat(logContext));
89
96
  return;
90
97
  }
91
- this.logger.info(`[RemoteControl] forward update session for handling: ${logContext}`);
98
+ this.logger.info("[RemoteControl] forward update session for handling: ".concat(logContext));
92
99
  return await this._handleUpdateRemoteControlSession({
93
100
  senderId: senderId,
94
101
  sessionKey: data.sessionKey,
@@ -101,7 +108,7 @@ class FcrRemoteControlImpl {
101
108
  timestamp: message.timestamp
102
109
  });
103
110
  } else if (cmd === '1002') {
104
- this.logger.info(`[RemoteControl] forward delete session for handling: ${logContext}`);
111
+ this.logger.info("[RemoteControl] forward delete session for handling: ".concat(logContext));
105
112
  return await this._handleDeleteRemoteControlSession({
106
113
  senderId: senderId,
107
114
  sessionKey: data.sessionKey,
@@ -113,15 +120,13 @@ class FcrRemoteControlImpl {
113
120
  timestamp: message.timestamp
114
121
  });
115
122
  } else {
116
- this.logger.info(`[RemoteControl] ignore unsupported cmd: ${logContext}`);
123
+ this.logger.info("[RemoteControl] ignore unsupported cmd: ".concat(logContext));
117
124
  }
118
125
  }
119
126
  async _handleUpdateRemoteControlSession(data) {
120
- const {
121
- action,
122
- keepAlive,
123
- ...session
124
- } = data;
127
+ const action = data.action,
128
+ keepAlive = data.keepAlive,
129
+ session = (0, _objectWithoutProperties2.default)(data, _excluded);
125
130
  if (this._isSessionExpired({
126
131
  timestamp: session.timestamp,
127
132
  duration: session.duration
@@ -129,11 +134,10 @@ class FcrRemoteControlImpl {
129
134
  this.terminateRemoteControl(session.sessionId);
130
135
  return;
131
136
  }
132
- const {
133
- state,
134
- cause
135
- } = data.payload;
136
- const _cause = cause ?? {};
137
+ const _ref3 = data.payload,
138
+ state = _ref3.state,
139
+ cause = _ref3.cause;
140
+ const _cause = cause !== null && cause !== void 0 ? cause : {};
137
141
  switch (action) {
138
142
  case 0:
139
143
  {
@@ -153,7 +157,7 @@ class FcrRemoteControlImpl {
153
157
  },
154
158
  state
155
159
  };
156
- this.logger.info(`on received remote control session request ${JSON.stringify(session)}`);
160
+ this.logger.info("on received remote control session request ".concat(JSON.stringify(session)));
157
161
  this._notifyRemoteControlState(state, {
158
162
  sessionId: session.sessionId,
159
163
  fromUserId: session.senderId,
@@ -177,30 +181,28 @@ class FcrRemoteControlImpl {
177
181
  });
178
182
  }
179
183
  // 相同的状态则是维系心跳
180
- this._receivedRemoteControlSession.session = {
181
- ...this._receivedRemoteControlSession.session,
184
+ this._receivedRemoteControlSession.session = _objectSpread(_objectSpread({}, this._receivedRemoteControlSession.session), {}, {
182
185
  nextTs: Date.now() + session.interval,
183
186
  action
184
- };
187
+ });
185
188
  break;
186
189
  }
187
190
  case 1:
188
191
  {
189
192
  if (!this._activeRemoteControlSession && !this._receivedRemoteControlSession) {
190
- this.logger.error(`on upadte remote control session state: ${state}, session: ${JSON.stringify(session)}, but local remote control session not found`);
193
+ this.logger.error("on upadte remote control session state: ".concat(state, ", session: ").concat(JSON.stringify(session), ", but local remote control session not found"));
191
194
  return;
192
195
  }
193
- this.logger.info(`on upadte remote control session state: ${state}, session: ${JSON.stringify(session)}`);
196
+ this.logger.info("on upadte remote control session state: ".concat(state, ", session: ").concat(JSON.stringify(session)));
194
197
  if (this._receivedRemoteControlSession && this._receivedRemoteControlSession.sessionId === session.sessionId) {
195
198
  let oldState = this._receivedRemoteControlSession.state;
196
199
  this._receivedRemoteControlSession.state = state;
197
- this._receivedRemoteControlSession.session = {
198
- ...this._receivedRemoteControlSession.session,
200
+ this._receivedRemoteControlSession.session = _objectSpread(_objectSpread({}, this._receivedRemoteControlSession.session), {}, {
199
201
  cause: _cause,
200
202
  action,
201
203
  nextTs: Date.now() + session.interval,
202
204
  startTs: Date.now()
203
- };
205
+ });
204
206
  // 如果来自心跳,相同状态下就不要上报了
205
207
  if (oldState === state) {
206
208
  return;
@@ -216,11 +218,10 @@ class FcrRemoteControlImpl {
216
218
  } else if (this._activeRemoteControlSession && this._activeRemoteControlSession.sessionId === session.sessionId) {
217
219
  let oldState = this._activeRemoteControlSession.state;
218
220
  this._activeRemoteControlSession.state = state;
219
- this._activeRemoteControlSession.session = {
220
- ...this._activeRemoteControlSession.session,
221
+ this._activeRemoteControlSession.session = _objectSpread(_objectSpread({}, this._activeRemoteControlSession.session), {}, {
221
222
  cause: _cause,
222
223
  action
223
- };
224
+ });
224
225
  // 如果来自心跳,相同状态下就不要上报了
225
226
  if (oldState === state) {
226
227
  return;
@@ -239,15 +240,12 @@ class FcrRemoteControlImpl {
239
240
  }
240
241
  }
241
242
  async _handleDeleteRemoteControlSession(data) {
242
- const {
243
- action,
244
- ...session
245
- } = data;
246
- const {
247
- state,
248
- cause
249
- } = data.payload;
250
- const _cause = cause ?? {};
243
+ const action = data.action,
244
+ session = (0, _objectWithoutProperties2.default)(data, _excluded2);
245
+ const _ref4 = data.payload,
246
+ state = _ref4.state,
247
+ cause = _ref4.cause;
248
+ const _cause = cause !== null && cause !== void 0 ? cause : {};
251
249
  switch (action) {
252
250
  case 2:
253
251
  {
@@ -261,7 +259,7 @@ class FcrRemoteControlImpl {
261
259
  cause: _cause
262
260
  });
263
261
  this._activeRemoteControlSession = null;
264
- this.logger.info(`on reject remote control session state: ${state}, ${JSON.stringify(session)}`);
262
+ this.logger.info("on reject remote control session state: ".concat(state, ", ").concat(JSON.stringify(session)));
265
263
  }
266
264
  break;
267
265
  }
@@ -281,7 +279,7 @@ class FcrRemoteControlImpl {
281
279
  });
282
280
  this._activeRemoteControlSession = null;
283
281
  this._receivedRemoteControlSession = null;
284
- this.logger.info(`on delete remote control session state: ${state}, ${JSON.stringify(session)}`);
282
+ this.logger.info("on delete remote control session state: ".concat(state, ", ").concat(JSON.stringify(session)));
285
283
  }
286
284
  break;
287
285
  }
@@ -295,7 +293,7 @@ class FcrRemoteControlImpl {
295
293
  try {
296
294
  await this.terminateRemoteControl(sessionId);
297
295
  } catch (e) {
298
- this.logger.error(`remote control ${context}: ${e}`);
296
+ this.logger.error("remote control ".concat(context, ": ").concat(e));
299
297
  }
300
298
  }
301
299
 
@@ -303,67 +301,61 @@ class FcrRemoteControlImpl {
303
301
  async _executeTask() {
304
302
  // ping sessions (sender side)
305
303
  if (this._activeRemoteControlSession) {
306
- const {
307
- sessionId,
308
- session,
309
- state
310
- } = this._activeRemoteControlSession;
304
+ const _this$_activeRemoteCo = this._activeRemoteControlSession,
305
+ sessionId = _this$_activeRemoteCo.sessionId,
306
+ session = _this$_activeRemoteCo.session,
307
+ state = _this$_activeRemoteCo.state;
311
308
  if (this._isSessionExpired({
312
309
  duration: session.duration,
313
310
  timestamp: session.timestamp
314
311
  })) {
315
- this.logger.info(`remote control session expired, removed: ${sessionId}`);
312
+ this.logger.info("remote control session expired, removed: ".concat(sessionId));
316
313
  await this._terminateRemoteControlBestEffort(sessionId, 'terminate remote control session on active side expiry');
317
314
  return;
318
315
  }
319
316
  if (session.nextTs < Date.now()) {
320
- this.logger.info(`ping remote control session: ${sessionId}`);
317
+ this.logger.info("ping remote control session: ".concat(sessionId));
321
318
  try {
322
- const {
323
- data: {
324
- interval
325
- }
326
- } = await this._api.updatePeerSession({
327
- userId: this._userId,
328
- sessionId,
329
- sessionKey: this._remoteControlSessionKey,
330
- duration: session.duration,
331
- payload: {
332
- state,
333
- cause: session.cause
334
- },
335
- targetId: session.controlleeId,
336
- keepAlive: true,
337
- action: session.action
338
- });
319
+ const _await$this$_api$upda = await this._api.updatePeerSession({
320
+ userId: this._userId,
321
+ sessionId,
322
+ sessionKey: this._remoteControlSessionKey,
323
+ duration: session.duration,
324
+ payload: {
325
+ state,
326
+ cause: session.cause
327
+ },
328
+ targetId: session.controlleeId,
329
+ keepAlive: true,
330
+ action: session.action
331
+ }),
332
+ interval = _await$this$_api$upda.data.interval;
339
333
  const nextTs = Date.now() + interval;
340
- this._activeRemoteControlSession.session = {
341
- ...session,
334
+ this._activeRemoteControlSession.session = _objectSpread(_objectSpread({}, session), {}, {
342
335
  nextTs
343
- };
344
- this.logger.info(`refresh remote control session schedule: ${sessionId}, next ts: ${nextTs}`);
336
+ });
337
+ this.logger.info("refresh remote control session schedule: ".concat(sessionId, ", next ts: ").concat(nextTs));
345
338
  } catch (e) {
346
- this.logger.error(`ping remote control session failed: ${e}`);
339
+ this.logger.error("ping remote control session failed: ".concat(e));
347
340
  }
348
341
  }
349
342
  }
350
343
  if (this._receivedRemoteControlSession) {
351
- const {
352
- sessionId,
353
- session
354
- } = this._receivedRemoteControlSession;
344
+ const _this$_receivedRemote = this._receivedRemoteControlSession,
345
+ sessionId = _this$_receivedRemote.sessionId,
346
+ session = _this$_receivedRemote.session;
355
347
  if (this._isSessionExpired({
356
348
  duration: session.duration,
357
349
  timestamp: session.timestamp
358
350
  })) {
359
- this.logger.info(`remote control session expired, removed: ${sessionId}`);
351
+ this.logger.info("remote control session expired, removed: ".concat(sessionId));
360
352
  await this._terminateRemoteControlBestEffort(sessionId, 'terminate remote control session on received side expiry');
361
353
  return;
362
354
  }
363
355
  if (session.nextTs + session.interval * KEEPALIVE_TIMEOUT_MULTIPLIER < Date.now()) {
364
356
  await this._terminateRemoteControlBestEffort(sessionId, 'terminate remote control session on keepalive timeout');
365
357
  if (!this._receivedRemoteControlSession) {
366
- this.logger.info(`remote control session has not been pinged, removed: ${sessionId}`);
358
+ this.logger.info("remote control session has not been pinged, removed: ".concat(sessionId));
367
359
  }
368
360
  }
369
361
  }
@@ -377,6 +369,7 @@ class FcrRemoteControlImpl {
377
369
  //@internal
378
370
  async _rejectSession(session) {
379
371
  try {
372
+ var _session$payload$caus;
380
373
  await this._api.deletePeerSession({
381
374
  userId: this._userId,
382
375
  sessionId: session.sessionId,
@@ -384,7 +377,7 @@ class FcrRemoteControlImpl {
384
377
  receiverIds: [session.receiverId],
385
378
  action: 2,
386
379
  payload: {
387
- cause: session.payload.cause ?? {}
380
+ cause: (_session$payload$caus = session.payload.cause) !== null && _session$payload$caus !== void 0 ? _session$payload$caus : {}
388
381
  }
389
382
  });
390
383
  } catch (e) {
@@ -397,38 +390,35 @@ class FcrRemoteControlImpl {
397
390
  throw (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_REMOTE_CONTROL, _imports.DetailErrorCode.PEER_SESSION_ALREADY_EXISTS, 'remote control session already exists');
398
391
  }
399
392
  try {
393
+ var _params$cause;
400
394
  const _now = Date.now();
401
- const sessionId = (0, _imports.md5)(`${_now}`);
402
- const {
403
- data: {
404
- interval
405
- }
406
- } = await this._api.updatePeerSession({
407
- userId: this._userId,
408
- sessionId,
409
- sessionKey: this._remoteControlSessionKey,
410
- duration: params.duration,
411
- payload: {
412
- cause: params.cause ?? {},
413
- state: _type.FcrRemoteControlState.REQUEST_RECEIVED
414
- },
415
- targetId: params.controlleeId,
416
- keepAlive: true,
417
- action: 0
418
- });
395
+ const sessionId = (0, _imports.md5)("".concat(_now));
396
+ const _await$this$_api$upda2 = await this._api.updatePeerSession({
397
+ userId: this._userId,
398
+ sessionId,
399
+ sessionKey: this._remoteControlSessionKey,
400
+ duration: params.duration,
401
+ payload: {
402
+ cause: (_params$cause = params.cause) !== null && _params$cause !== void 0 ? _params$cause : {},
403
+ state: _type.FcrRemoteControlState.REQUEST_RECEIVED
404
+ },
405
+ targetId: params.controlleeId,
406
+ keepAlive: true,
407
+ action: 0
408
+ }),
409
+ interval = _await$this$_api$upda2.data.interval;
419
410
  const nextTs = _now + interval;
420
411
  this._activeRemoteControlSession = {
421
412
  sessionId,
422
- session: {
423
- ...params,
413
+ session: _objectSpread(_objectSpread({}, params), {}, {
424
414
  interval,
425
415
  nextTs,
426
416
  startTs: _now,
427
417
  action: 0
428
- },
418
+ }),
429
419
  state: _type.FcrRemoteControlState.REQUEST_RECEIVED
430
420
  };
431
- this.logger.info(`remote control put into session activeRemote: ${sessionId}, next ts: ${nextTs}, remain: ${interval}ms`);
421
+ this.logger.info("remote control put into session activeRemote: ".concat(sessionId, ", next ts: ").concat(nextTs, ", remain: ").concat(interval, "ms"));
432
422
  return sessionId;
433
423
  } catch (e) {
434
424
  throw (0, _error.generateFcrCoreServerError)(_imports.DetailErrorCode.LOCAL_HTTP_REQUEST_FAILED, 'start remote control session failed');
@@ -438,39 +428,34 @@ class FcrRemoteControlImpl {
438
428
  if (!this._receivedRemoteControlSession) {
439
429
  throw (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_REMOTE_CONTROL, _imports.DetailErrorCode.UNDEFINED, 'remote control session not found');
440
430
  }
441
- const {
442
- session,
443
- sessionId,
444
- state
445
- } = this._receivedRemoteControlSession;
431
+ const _this$_receivedRemote2 = this._receivedRemoteControlSession,
432
+ session = _this$_receivedRemote2.session,
433
+ sessionId = _this$_receivedRemote2.sessionId,
434
+ state = _this$_receivedRemote2.state;
446
435
  if (_sessionId !== sessionId) {
447
436
  return;
448
437
  }
449
438
  if (session && state === _type.FcrRemoteControlState.REQUEST_RECEIVED) {
450
- const {
451
- data: {
452
- interval
453
- }
454
- } = await this._api.updatePeerSession({
455
- userId: this._userId,
456
- sessionId,
457
- sessionKey: this._remoteControlSessionKey,
458
- duration: session.duration,
459
- payload: {
460
- cause: cause ?? {},
461
- state: _type.FcrRemoteControlState.REQUEST_ACCEPTED
462
- },
463
- targetId: session.controllerId,
464
- keepAlive: true,
465
- action: 1
466
- });
439
+ const _await$this$_api$upda3 = await this._api.updatePeerSession({
440
+ userId: this._userId,
441
+ sessionId,
442
+ sessionKey: this._remoteControlSessionKey,
443
+ duration: session.duration,
444
+ payload: {
445
+ cause: cause !== null && cause !== void 0 ? cause : {},
446
+ state: _type.FcrRemoteControlState.REQUEST_ACCEPTED
447
+ },
448
+ targetId: session.controllerId,
449
+ keepAlive: true,
450
+ action: 1
451
+ }),
452
+ interval = _await$this$_api$upda3.data.interval;
467
453
  const _now = Date.now();
468
- this._receivedRemoteControlSession.session = {
469
- ...session,
454
+ this._receivedRemoteControlSession.session = _objectSpread(_objectSpread({}, session), {}, {
470
455
  nextTs: _now + interval,
471
456
  startTs: _now,
472
457
  action: 1
473
- };
458
+ });
474
459
  this._receivedRemoteControlSession.state = _type.FcrRemoteControlState.REQUEST_ACCEPTED;
475
460
  this._notifyRemoteControlState(_type.FcrRemoteControlState.REQUEST_ACCEPTED, {
476
461
  sessionId,
@@ -478,7 +463,7 @@ class FcrRemoteControlImpl {
478
463
  receiverId: session.controllerId,
479
464
  controllerId: session.controllerId,
480
465
  controlleeId: session.controlleeId,
481
- cause: cause ?? {}
466
+ cause: cause !== null && cause !== void 0 ? cause : {}
482
467
  });
483
468
  return;
484
469
  }
@@ -487,10 +472,9 @@ class FcrRemoteControlImpl {
487
472
  if (!this._receivedRemoteControlSession) {
488
473
  throw (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_REMOTE_CONTROL, _imports.DetailErrorCode.UNDEFINED, 'remote control session not found');
489
474
  }
490
- const {
491
- session,
492
- sessionId
493
- } = this._receivedRemoteControlSession;
475
+ const _this$_receivedRemote3 = this._receivedRemoteControlSession,
476
+ session = _this$_receivedRemote3.session,
477
+ sessionId = _this$_receivedRemote3.sessionId;
494
478
  if (_sessionId !== sessionId) {
495
479
  return;
496
480
  }
@@ -498,10 +482,11 @@ class FcrRemoteControlImpl {
498
482
  sessionId,
499
483
  receiverId: session.controllerId,
500
484
  payload: {
501
- cause: cause ?? {}
485
+ cause: cause !== null && cause !== void 0 ? cause : {}
502
486
  },
503
487
  sessionKey: this._remoteControlSessionKey
504
488
  }).then(() => {
489
+ var _this$_receivedRemote4;
505
490
  this._notifyRemoteControlState(_type.FcrRemoteControlState.REQUEST_REJECTED, {
506
491
  sessionId,
507
492
  fromUserId: session.controlleeId,
@@ -510,7 +495,7 @@ class FcrRemoteControlImpl {
510
495
  controlleeId: session.controlleeId,
511
496
  cause
512
497
  });
513
- if (sessionId === this._receivedRemoteControlSession?.sessionId) {
498
+ if (sessionId === ((_this$_receivedRemote4 = this._receivedRemoteControlSession) === null || _this$_receivedRemote4 === void 0 ? void 0 : _this$_receivedRemote4.sessionId)) {
514
499
  this._receivedRemoteControlSession = null;
515
500
  }
516
501
  });
@@ -520,7 +505,7 @@ class FcrRemoteControlImpl {
520
505
  const isReceivedSession = this._receivedRemoteControlSession && this._receivedRemoteControlSession.sessionId === _sessionId;
521
506
  const session = isActiveSession ? this._activeRemoteControlSession : isReceivedSession ? this._receivedRemoteControlSession : null;
522
507
  if (session) {
523
- const _cause = cause ?? {};
508
+ const _cause = cause !== null && cause !== void 0 ? cause : {};
524
509
  try {
525
510
  return await this._api.deletePeerSession({
526
511
  userId: this._userId,
@@ -542,7 +527,7 @@ class FcrRemoteControlImpl {
542
527
  controllerId: session.session.controllerId,
543
528
  controlleeId: session.session.controlleeId
544
529
  });
545
- this.logger.info(`delete remote control session state: ${_type.FcrRemoteControlState.SESSION_ENDED}, ${JSON.stringify(session)}`);
530
+ this.logger.info("delete remote control session state: ".concat(_type.FcrRemoteControlState.SESSION_ENDED, ", ").concat(JSON.stringify(session)));
546
531
  }
547
532
  this._activeRemoteControlSession = null;
548
533
  this._receivedRemoteControlSession = null;
@@ -559,7 +544,7 @@ class FcrRemoteControlImpl {
559
544
  const sessionInfo = isActiveSession ? this._activeRemoteControlSession : isReceivedSession ? this._receivedRemoteControlSession : null;
560
545
  if (sessionInfo) {
561
546
  if (sessionInfo.state === _state) {
562
- throw (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_REMOTE_CONTROL, _imports.DetailErrorCode.REMOTE_CONTROL_SESSION_STATE_NOT_MATCH, `on update remote control session state: ${_state} already existed`);
547
+ throw (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_REMOTE_CONTROL, _imports.DetailErrorCode.REMOTE_CONTROL_SESSION_STATE_NOT_MATCH, "on update remote control session state: ".concat(_state, " already existed"));
563
548
  }
564
549
  switch (_state) {
565
550
  case _type.FcrRemoteControlState.CONNECT_INITIALIZED:
@@ -576,39 +561,33 @@ class FcrRemoteControlImpl {
576
561
 
577
562
  //@internal
578
563
  async _initializeRemoteControlConnection(_session, cause) {
579
- const {
580
- session,
581
- state,
582
- sessionId
583
- } = _session;
564
+ const session = _session.session,
565
+ state = _session.state,
566
+ sessionId = _session.sessionId;
584
567
  if (state !== _type.FcrRemoteControlState.REQUEST_ACCEPTED) {
585
568
  throw (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_REMOTE_CONTROL, _imports.DetailErrorCode.REMOTE_CONTROL_SESSION_STATE_NOT_MATCH, 'remote control session state not match for initialize connection, current state: ' + state + ', expected state: ' + _type.FcrRemoteControlState.REQUEST_ACCEPTED);
586
569
  }
587
570
  const targetId = this._userId === session.controlleeId ? session.controllerId : session.controlleeId;
588
- const {
589
- data: {
590
- interval
591
- }
592
- } = await this._api.updatePeerSession({
593
- userId: this._userId,
594
- sessionId,
595
- sessionKey: this._remoteControlSessionKey,
596
- duration: session.duration,
597
- payload: {
598
- cause: cause ?? {},
599
- state: _type.FcrRemoteControlState.CONNECT_INITIALIZED
600
- },
601
- targetId,
602
- keepAlive: true,
603
- action: 1
604
- });
571
+ const _await$this$_api$upda4 = await this._api.updatePeerSession({
572
+ userId: this._userId,
573
+ sessionId,
574
+ sessionKey: this._remoteControlSessionKey,
575
+ duration: session.duration,
576
+ payload: {
577
+ cause: cause !== null && cause !== void 0 ? cause : {},
578
+ state: _type.FcrRemoteControlState.CONNECT_INITIALIZED
579
+ },
580
+ targetId,
581
+ keepAlive: true,
582
+ action: 1
583
+ }),
584
+ interval = _await$this$_api$upda4.data.interval;
605
585
  const _now = Date.now();
606
- _session.session = {
607
- ...session,
586
+ _session.session = _objectSpread(_objectSpread({}, session), {}, {
608
587
  nextTs: _now + interval,
609
588
  startTs: _now,
610
589
  action: 1
611
- };
590
+ });
612
591
  _session.state = _type.FcrRemoteControlState.CONNECT_INITIALIZED;
613
592
  this._notifyRemoteControlState(_type.FcrRemoteControlState.CONNECT_INITIALIZED, {
614
593
  sessionId,
@@ -616,46 +595,40 @@ class FcrRemoteControlImpl {
616
595
  receiverId: targetId,
617
596
  controllerId: session.controllerId,
618
597
  controlleeId: session.controlleeId,
619
- cause: cause ?? {}
598
+ cause: cause !== null && cause !== void 0 ? cause : {}
620
599
  });
621
600
  return;
622
601
  }
623
602
 
624
603
  //@internal
625
604
  async _establishRemoteControlConnection(_session, cause) {
626
- const {
627
- session,
628
- state,
629
- sessionId
630
- } = _session;
605
+ const session = _session.session,
606
+ state = _session.state,
607
+ sessionId = _session.sessionId;
631
608
  if (state !== _type.FcrRemoteControlState.CONNECT_INITIALIZED) {
632
609
  throw (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_REMOTE_CONTROL, _imports.DetailErrorCode.REMOTE_CONTROL_SESSION_STATE_NOT_MATCH, 'remote control session state not match for establish connection, current state: ' + state + ', expected state: ' + _type.FcrRemoteControlState.CONNECT_INITIALIZED);
633
610
  }
634
611
  const targetId = this._userId === session.controlleeId ? session.controllerId : session.controlleeId;
635
- const {
636
- data: {
637
- interval
638
- }
639
- } = await this._api.updatePeerSession({
640
- userId: this._userId,
641
- sessionId,
642
- sessionKey: this._remoteControlSessionKey,
643
- duration: session.duration,
644
- payload: {
645
- cause: cause ?? {},
646
- state: _type.FcrRemoteControlState.CONNECT_ESTABLISHED
647
- },
648
- targetId,
649
- keepAlive: true,
650
- action: 1
651
- });
612
+ const _await$this$_api$upda5 = await this._api.updatePeerSession({
613
+ userId: this._userId,
614
+ sessionId,
615
+ sessionKey: this._remoteControlSessionKey,
616
+ duration: session.duration,
617
+ payload: {
618
+ cause: cause !== null && cause !== void 0 ? cause : {},
619
+ state: _type.FcrRemoteControlState.CONNECT_ESTABLISHED
620
+ },
621
+ targetId,
622
+ keepAlive: true,
623
+ action: 1
624
+ }),
625
+ interval = _await$this$_api$upda5.data.interval;
652
626
  const _now = Date.now();
653
- _session.session = {
654
- ...session,
627
+ _session.session = _objectSpread(_objectSpread({}, session), {}, {
655
628
  nextTs: _now + interval,
656
629
  startTs: _now,
657
630
  action: 1
658
- };
631
+ });
659
632
  _session.state = _type.FcrRemoteControlState.CONNECT_ESTABLISHED;
660
633
  this._notifyRemoteControlState(_type.FcrRemoteControlState.CONNECT_ESTABLISHED, {
661
634
  sessionId,
@@ -663,7 +636,7 @@ class FcrRemoteControlImpl {
663
636
  receiverId: targetId,
664
637
  controllerId: session.controllerId,
665
638
  controlleeId: session.controlleeId,
666
- cause: cause ?? {}
639
+ cause: cause !== null && cause !== void 0 ? cause : {}
667
640
  });
668
641
  return;
669
642
  }
@@ -706,4 +679,9 @@ class FcrRemoteControlImpl {
706
679
  this.addObserver((0, _logger.generateLogObserver)(this.logger, [['onRemoteControlStateChanged', ['state', 'extra']]]));
707
680
  }
708
681
  }
709
- exports.FcrRemoteControlImpl = FcrRemoteControlImpl;
682
+ exports.FcrRemoteControlImpl = FcrRemoteControlImpl;
683
+ _FcrRemoteControlImpl = FcrRemoteControlImpl;
684
+ var _applyDecs$e = _applyDecs(_FcrRemoteControlImpl, [[_startRemoteControlRequestDecs, 2, "startRemoteControlRequest"], [_acceptRemoteControlRequestDecs, 2, "acceptRemoteControlRequest"], [_rejectRemoteControlRequestDecs, 2, "rejectRemoteControlRequest"], [_terminateRemoteControlDecs, 2, "terminateRemoteControl"], [_updateRemoteControlConnectionStateDecs, 2, "updateRemoteControlConnectionState"], [_imports.trace, 2, "getRemoteControlState"], [_imports.bound, 2, "_notifyRemoteControlState"]], []).e;
685
+ var _applyDecs$e2 = (0, _slicedToArray2.default)(_applyDecs$e, 1);
686
+ _initProto = _applyDecs$e2[0];
687
+ _applyDecs$e;