fcr-core 3.6.2 → 3.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/lib/chat-connection/index.js +23 -41
  2. package/lib/engine/index.js +66 -65
  3. package/lib/imports.js +1 -3
  4. package/lib/media-control/desktop.js +7 -15
  5. package/lib/media-control/mobile.js +11 -18
  6. package/lib/monitor-control/index.js +3 -10
  7. package/lib/peer-session/index.js +37 -50
  8. package/lib/plugins/chatroom.js +184 -203
  9. package/lib/room-control/ability-control/index.js +7 -14
  10. package/lib/room-control/ability-control/type.d.ts +2 -1
  11. package/lib/room-control/ability-control/type.js +1 -0
  12. package/lib/room-control/group-control/index.js +14 -23
  13. package/lib/room-control/index.js +57 -84
  14. package/lib/room-control/interpreter-control/index.js +17 -25
  15. package/lib/room-control/interpreter-control/room.js +4 -6
  16. package/lib/room-control/join-before-host-waitingroom-control/index.js +4 -6
  17. package/lib/room-control/mainroom-control/index.js +10 -20
  18. package/lib/room-control/privilege-control/helper.js +5 -10
  19. package/lib/room-control/privilege-control/index.js +17 -29
  20. package/lib/room-control/privilege-control/type.js +1 -0
  21. package/lib/room-control/room-connector-control/index.js +14 -25
  22. package/lib/room-control/room-session/index.js +37 -50
  23. package/lib/room-control/shared-cache.js +19 -26
  24. package/lib/room-control/sharing-control/index.js +22 -33
  25. package/lib/room-control/stream-control/index.js +164 -176
  26. package/lib/room-control/user-control/index.js +131 -146
  27. package/lib/room-control/waitingroom-control/index.js +8 -15
  28. package/lib/room-control/whiteboard-control/board-window.js +52 -60
  29. package/lib/room-control/whiteboard-control/enums.js +84 -0
  30. package/lib/room-control/whiteboard-control/index.js +26 -40
  31. package/lib/room-control/whiteboard-control/mount-manager.js +2 -4
  32. package/lib/room-control/whiteboard-control/utils.js +14 -17
  33. package/lib/room-control/whiteboard-control-v2/annotation-control/index.d.ts +1 -1
  34. package/lib/room-control/whiteboard-control-v2/annotation-control/index.js +20 -27
  35. package/lib/room-control/whiteboard-control-v2/index.d.ts +1 -1
  36. package/lib/room-control/whiteboard-control-v2/index.js +51 -55
  37. package/lib/room-control/whiteboard-control-v2/main-window.d.ts +2 -0
  38. package/lib/room-control/whiteboard-control-v2/main-window.js +32 -41
  39. package/lib/room-router/index.js +52 -70
  40. package/lib/schema.d.ts +15 -15
  41. package/lib/schema.js +0 -1
  42. package/lib/service/api.js +113 -117
  43. package/lib/type.js +4 -2
  44. package/lib/utilities/collection.js +2 -3
  45. package/lib/utilities/error.js +4 -6
  46. package/lib/utilities/logger.js +2 -3
  47. package/lib/utilities/parameters.js +4 -8
  48. package/lib/utilities/stream.js +12 -20
  49. package/lib/utilities/user.js +2 -3
  50. package/lib/utilities/validate-params.js +1 -2
  51. package/package.json +4 -4
  52. package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.d.ts +0 -38
  53. package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +0 -261
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol.description.js");
4
- require("core-js/modules/es.error.cause.js");
5
3
  require("core-js/modules/es.array.push.js");
6
4
  require("core-js/modules/esnext.function.metadata.js");
7
5
  require("core-js/modules/esnext.map.delete-all.js");
@@ -24,9 +22,6 @@ Object.defineProperty(exports, "__esModule", {
24
22
  value: true
25
23
  });
26
24
  exports.FcrMainRoomControlImpl = void 0;
27
- require("core-js/modules/es.json.stringify.js");
28
- require("core-js/modules/web.dom-collections.iterator.js");
29
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
30
25
  var _imports = require("../../imports");
31
26
  var _ = require("..");
32
27
  var _groupControl = require("../group-control");
@@ -38,8 +33,7 @@ var _interpreterControl = require("../interpreter-control");
38
33
  var _schema = require("../../schema");
39
34
  var _logger = require("../../utilities/logger");
40
35
  var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
41
- var _FcrMainRoomControlImpl;
42
- let _initProto, _enableWaitingRoomDecs, _moveToWaitingRoomByUserIdsDecs, _ref;
36
+ let _initProto, _enableWaitingRoomDecs, _moveToWaitingRoomByUserIdsDecs;
43
37
  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)]; } }; }
44
38
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
45
39
  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); }
@@ -52,17 +46,17 @@ const {
52
46
  /**
53
47
  * @internal
54
48
  */
55
- _ref = (_enableWaitingRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringArraySchema)], "logger");
56
49
  class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
50
+ static #_ = (() => [_initProto] = _applyDecs(this, [[_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [_imports.trace, 2, "moveToWaitingRoomByUserRoles"], [_imports.bound, 2, "_getToken"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e)();
51
+ //@internal
52
+ [(_enableWaitingRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringArraySchema)], "logger")] = (() => (_initProto(this), (0, _logger.createLogger)({
53
+ prefix: 'FcrMainRoomControlImpl'
54
+ })))();
57
55
  get _mainRoomObservable() {
58
56
  return this._observable;
59
57
  }
60
58
  constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl, whitBoardControl) {
61
59
  super(engine, scene, api, config, _type.FcrRoomType.Mainroom, chatConnection, sharedCache, chatRoomControl, whitBoardControl);
62
- //@internal
63
- (0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
64
- prefix: 'FcrMainRoomControlImpl'
65
- })));
66
60
  this._groupControl = new _groupControl.FcrGroupControl(engine, scene, api, sharedCache);
67
61
  this._interpreterControl = new _interpreterControl.FcrInterpreterControlImpl(api, scene, config, engine, chatConnection, sharedCache);
68
62
  this._addLogObserver();
@@ -99,8 +93,7 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
99
93
  try {
100
94
  return await super.leave();
101
95
  } finally {
102
- var _this$_logUploadTask;
103
- (_this$_logUploadTask = this._logUploadTask) === null || _this$_logUploadTask === void 0 || _this$_logUploadTask.stop();
96
+ this._logUploadTask?.stop();
104
97
  this._engine.getMonitor().uploadLog({
105
98
  userUuid: this._config.userId,
106
99
  roomUuid: this._scene.sceneId
@@ -122,10 +115,9 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
122
115
  async moveToWaitingRoomByUserIds(userIds) {
123
116
  const [error] = await (0, _imports.to)(this._api.moveToWaitingRoomByUserIds(userIds, this._scene.sceneId));
124
117
  if (error) {
125
- this.logger.error("[RoomControl] move to waiting room failed, ".concat(error.message, "-").concat(JSON.stringify(error)));
118
+ this.logger.error(`[RoomControl] move to waiting room failed, ${error.message}-${JSON.stringify(error)}`);
126
119
  if (error instanceof _imports.AgoraRestfulClientError) {
127
- var _error$serviceCode;
128
- throw (0, _error.generateFcrCoreServerError)((_error$serviceCode = error.serviceCode) !== null && _error$serviceCode !== void 0 ? _error$serviceCode : -1, error.message, error);
120
+ throw (0, _error.generateFcrCoreServerError)(error.serviceCode ?? -1, error.message, error);
129
121
  }
130
122
  throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'move to waiting room failed', error);
131
123
  }
@@ -154,6 +146,4 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
154
146
  'onRoomMessageReceived', 'onRoomPropertiesDeleted', 'onRoomPropertiesUpdated', 'onRoomStateUpdated']));
155
147
  }
156
148
  }
157
- exports.FcrMainRoomControlImpl = FcrMainRoomControlImpl;
158
- _FcrMainRoomControlImpl = FcrMainRoomControlImpl;
159
- [_initProto] = _applyDecs(_FcrMainRoomControlImpl, [[_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [_imports.trace, 2, "moveToWaitingRoomByUserRoles"], [_imports.bound, 2, "_getToken"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
149
+ exports.FcrMainRoomControlImpl = FcrMainRoomControlImpl;
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getLocalUserPermissionInfo = exports.addLocalUserPermissionObserver = exports.FcrPermission = void 0;
7
- require("core-js/modules/esnext.async-iterator.find.js");
8
- require("core-js/modules/esnext.async-iterator.map.js");
9
7
  require("core-js/modules/esnext.iterator.constructor.js");
10
8
  require("core-js/modules/esnext.iterator.find.js");
11
9
  require("core-js/modules/esnext.iterator.map.js");
12
- require("core-js/modules/web.dom-collections.iterator.js");
13
10
  var _type = require("./type");
14
11
  var _user = require("../../utilities/user");
15
12
  // 初始化权限策略表达式:{module}:{action}-{k1=v1|v2;k2=v3}>{role1|role2}
@@ -49,7 +46,7 @@ class FcrPermission {
49
46
  }
50
47
  exports.FcrPermission = FcrPermission;
51
48
  const getLocalUserPermissionInfo = (scene, action) => {
52
- const permissionStringArray = scene.getUserPropertiesByKeyPath("permission.list", scene.localUser.getLocalUserId());
49
+ const permissionStringArray = scene.getUserPropertiesByKeyPath(`permission.list`, scene.localUser.getLocalUserId());
53
50
  const permissionString = permissionStringArray.find(permission => permission.startsWith(action));
54
51
  if (!permissionString) {
55
52
  return {
@@ -73,7 +70,7 @@ const convertPermissionInfo = (permission, operateType) => {
73
70
  enable: operateType === _type.FcrOperatePermissionType.ADD || operateType === _type.FcrOperatePermissionType.GET ? true : false,
74
71
  info: {
75
72
  targetRoles: permission.targetRoles.map(role => (0, _user.convertStringPrivilegeRoleToFcrPrivilegeRole)(role)),
76
- action: "".concat(module, ":").concat(action),
73
+ action: `${module}:${action}`,
77
74
  params: permission.conditions
78
75
  }
79
76
  };
@@ -82,13 +79,11 @@ const convertPermissionInfo = (permission, operateType) => {
82
79
  const addLocalUserPermissionObserver = (scene, observer, cache) => {
83
80
  scene.addObserver({
84
81
  onUserPropertiesUpdated: (sceneId, event) => {
85
- var _event$cause;
86
- if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 3200) {
82
+ if (event.cause?.cmd === 3200) {
87
83
  if (event.modifiedUser.userId === scene.localUser.getLocalUserId()) {
88
- var _data$addPermissions, _data$removePermissio;
89
84
  const data = event.cause.data;
90
- const addedPermissions = (_data$addPermissions = data.addPermissions) === null || _data$addPermissions === void 0 ? void 0 : _data$addPermissions.map(p => convertPermissionInfo(FcrPermission.fromString(p), _type.FcrOperatePermissionType.ADD));
91
- const removedPermissions = (_data$removePermissio = data.removePermissions) === null || _data$removePermissio === void 0 ? void 0 : _data$removePermissio.map(p => convertPermissionInfo(FcrPermission.fromString(p), _type.FcrOperatePermissionType.DELETE));
85
+ const addedPermissions = data.addPermissions?.map(p => convertPermissionInfo(FcrPermission.fromString(p), _type.FcrOperatePermissionType.ADD));
86
+ const removedPermissions = data.removePermissions?.map(p => convertPermissionInfo(FcrPermission.fromString(p), _type.FcrOperatePermissionType.DELETE));
92
87
  if (removedPermissions && removedPermissions.length > 0) {
93
88
  observer.onLocalUserPermissionInfoDeleted && observer.onLocalUserPermissionInfoDeleted(sceneId, {
94
89
  permissionInfo: removedPermissions,
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol.description.js");
4
- require("core-js/modules/es.error.cause.js");
5
3
  require("core-js/modules/es.array.push.js");
6
- require("core-js/modules/esnext.async-iterator.filter.js");
7
4
  require("core-js/modules/esnext.function.metadata.js");
8
- require("core-js/modules/esnext.iterator.filter.js");
9
5
  require("core-js/modules/esnext.map.delete-all.js");
10
6
  require("core-js/modules/esnext.map.emplace.js");
11
7
  require("core-js/modules/esnext.map.every.js");
@@ -26,13 +22,9 @@ Object.defineProperty(exports, "__esModule", {
26
22
  value: true
27
23
  });
28
24
  exports.FcrPrivilegeControlImpl = void 0;
29
- require("core-js/modules/esnext.async-iterator.for-each.js");
30
- require("core-js/modules/esnext.async-iterator.map.js");
31
25
  require("core-js/modules/esnext.iterator.constructor.js");
32
26
  require("core-js/modules/esnext.iterator.for-each.js");
33
27
  require("core-js/modules/esnext.iterator.map.js");
34
- require("core-js/modules/web.dom-collections.iterator.js");
35
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
36
28
  var _imports = require("../../imports");
37
29
  var _type = require("../../type");
38
30
  var _user = require("../../utilities/user");
@@ -42,26 +34,23 @@ var _logger = require("../../utilities/logger");
42
34
  var _error = require("../../utilities/error");
43
35
  var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
44
36
  var _schema = require("../../schema");
45
- var _FcrPrivilegeControlImpl;
46
- let _initProto, _getSecurityInfoDecs, _getLocalUserPermissionInfoDecs, _enableLockedRoomDecs, _allowShareAndWriteDecs, _allowWriteBoardDecs, _allowSendChatDecs, _allowStartAudioDecs, _allowStartVideoDecs, _allowJoinWithMutedAudioDecs, _allowJoinWithMutedVideoDecs, _allowWatermarkDecs, _allowChangeUserNameDecs, _ref;
47
- 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; }
48
- 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; }
37
+ let _initProto, _getSecurityInfoDecs, _getLocalUserPermissionInfoDecs, _enableLockedRoomDecs, _allowShareAndWriteDecs, _allowWriteBoardDecs, _allowSendChatDecs, _allowStartAudioDecs, _allowStartVideoDecs, _allowJoinWithMutedAudioDecs, _allowJoinWithMutedVideoDecs, _allowWatermarkDecs, _allowChangeUserNameDecs;
49
38
  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)]; } }; }
50
39
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
51
40
  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); }
52
41
  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; }
53
42
  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; }
54
- _ref = (_getSecurityInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSecurityActionSchema)], _getLocalUserPermissionInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrPermissionActionSchema)], _enableLockedRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowShareAndWriteDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowWriteBoardDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowSendChatDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema, _schema.fcrSecuritySendChatPayloadSchema)], _allowStartAudioDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowStartVideoDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedAudioDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedVideoDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowWatermarkDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema, _schema.fcrLineTypeSchema.optional())], _allowChangeUserNameDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], "logger");
55
43
  /**
56
44
  * @internal
57
45
  */
58
46
  class FcrPrivilegeControlImpl {
47
+ static #_ = (() => [_initProto] = _applyDecs(this, [[_imports.trace, 2, "allowWriteAnnotation"], [_getSecurityInfoDecs, 2, "getSecurityInfo"], [_getLocalUserPermissionInfoDecs, 2, "getLocalUserPermissionInfo"], [_enableLockedRoomDecs, 2, "enableLockedRoom"], [_allowShareAndWriteDecs, 2, "allowShareAndWrite"], [_allowWriteBoardDecs, 2, "allowWriteBoard"], [_allowSendChatDecs, 2, "allowSendChat"], [_allowStartAudioDecs, 2, "allowStartAudio"], [_allowStartVideoDecs, 2, "allowStartVideo"], [_allowJoinWithMutedAudioDecs, 2, "allowJoinWithMutedAudio"], [_allowJoinWithMutedVideoDecs, 2, "allowJoinWithMutedVideo"], [_allowWatermarkDecs, 2, "allowWatermark"], [_allowChangeUserNameDecs, 2, "allowChangeUserName"]], []).e)();
48
+ //@internal
49
+ [(_getSecurityInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSecurityActionSchema)], _getLocalUserPermissionInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrPermissionActionSchema)], _enableLockedRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowShareAndWriteDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowWriteBoardDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowSendChatDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema, _schema.fcrSecuritySendChatPayloadSchema)], _allowStartAudioDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowStartVideoDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedAudioDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedVideoDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowWatermarkDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema, _schema.fcrLineTypeSchema.optional())], _allowChangeUserNameDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], "logger")] = (() => (_initProto(this), (0, _logger.createLogger)({
50
+ prefix: 'FcrPrivilegeControlImpl'
51
+ })))();
52
+ _observable = (() => new _imports.AgoraObservable())();
59
53
  constructor(_engine, _scene, _api, _sharedCache) {
60
- //@internal
61
- (0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
62
- prefix: 'FcrPrivilegeControlImpl'
63
- })));
64
- (0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
65
54
  this._engine = _engine;
66
55
  this._scene = _scene;
67
56
  this._api = _api;
@@ -81,7 +70,7 @@ class FcrPrivilegeControlImpl {
81
70
  }), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'allow annotation failed');
82
71
  }
83
72
  getSecurityInfo(action) {
84
- const info = this._scene.getScenePropertiesByKeyPath("security.".concat(action));
73
+ const info = this._scene.getScenePropertiesByKeyPath(`security.${action}`);
85
74
  return this._convertSecurityInfo(info, action);
86
75
  }
87
76
  // @trace
@@ -109,7 +98,7 @@ class FcrPrivilegeControlImpl {
109
98
 
110
99
  // @trace
111
100
  getAllLocalUserPermissionInfo() {
112
- const permissionStringArray = this._scene.getUserPropertiesByKeyPath("permission.list", this._scene.localUser.getLocalUserId());
101
+ const permissionStringArray = this._scene.getUserPropertiesByKeyPath(`permission.list`, this._scene.localUser.getLocalUserId());
113
102
  return permissionStringArray.map(permissionString => this._convertPermissionInfo(_helper.FcrPermission.fromString(permissionString), _type2.FcrOperatePermissionType.GET));
114
103
  }
115
104
  async enableLockedRoom(enable, targetRoles) {
@@ -203,7 +192,7 @@ class FcrPrivilegeControlImpl {
203
192
  enable,
204
193
  targetRoles: targetRoles.map(role => _type2.FcrPrivilegeUserRoleToStringMap[role]),
205
194
  payload: {
206
- lineType: lineType !== null && lineType !== void 0 ? lineType : _type.FcrLineType.SINGLE_ROW
195
+ lineType: lineType ?? _type.FcrLineType.SINGLE_ROW
207
196
  }
208
197
  }), _error.FcrErrorModuleCode.ROOM_PRIVILEGE, 'allow water mark failed');
209
198
  }
@@ -231,12 +220,13 @@ class FcrPrivilegeControlImpl {
231
220
  payload
232
221
  } = security;
233
222
  if (action === _type2.FcrSecurityAction.Annotation) {
234
- return _objectSpread({
223
+ return {
235
224
  info: {
236
225
  action: action,
237
226
  payload
238
- }
239
- }, security);
227
+ },
228
+ ...security
229
+ };
240
230
  }
241
231
  return {
242
232
  enable: !!security.enable,
@@ -261,7 +251,7 @@ class FcrPrivilegeControlImpl {
261
251
  enable: operateType === _type2.FcrOperatePermissionType.ADD || operateType === _type2.FcrOperatePermissionType.GET ? true : false,
262
252
  info: {
263
253
  targetRoles: permission.targetRoles.map(role => (0, _user.convertStringPrivilegeRoleToFcrPrivilegeRole)(role)),
264
- action: "".concat(module, ":").concat(action),
254
+ action: `${module}:${action}`,
265
255
  params: permission.conditions
266
256
  }
267
257
  };
@@ -273,7 +263,7 @@ class FcrPrivilegeControlImpl {
273
263
  if ('security' in event.changedProperties) {
274
264
  const securityChangedKeys = Object.keys(event.changedProperties.security);
275
265
  securityChangedKeys.forEach(key => {
276
- const infoObj = (0, _imports.get)(event.changedProperties, "security.".concat(key));
266
+ const infoObj = (0, _imports.get)(event.changedProperties, `security.${key}`);
277
267
  this._observable.notifyObservers('onSecurityInfoUpdated', sceneId, {
278
268
  securityInfo: this._convertSecurityInfo(infoObj, key),
279
269
  operatorUser: (0, _user.checkFcrUserRole)((0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache)),
@@ -296,6 +286,4 @@ class FcrPrivilegeControlImpl {
296
286
  this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onSecurityInfoUpdated', 'onLocalUserPermissionInfoAdded', 'onLocalUserPermissionInfoDeleted']));
297
287
  }
298
288
  }
299
- exports.FcrPrivilegeControlImpl = FcrPrivilegeControlImpl;
300
- _FcrPrivilegeControlImpl = FcrPrivilegeControlImpl;
301
- [_initProto] = _applyDecs(_FcrPrivilegeControlImpl, [[_imports.trace, 2, "allowWriteAnnotation"], [_getSecurityInfoDecs, 2, "getSecurityInfo"], [_getLocalUserPermissionInfoDecs, 2, "getLocalUserPermissionInfo"], [_enableLockedRoomDecs, 2, "enableLockedRoom"], [_allowShareAndWriteDecs, 2, "allowShareAndWrite"], [_allowWriteBoardDecs, 2, "allowWriteBoard"], [_allowSendChatDecs, 2, "allowSendChat"], [_allowStartAudioDecs, 2, "allowStartAudio"], [_allowStartVideoDecs, 2, "allowStartVideo"], [_allowJoinWithMutedAudioDecs, 2, "allowJoinWithMutedAudio"], [_allowJoinWithMutedVideoDecs, 2, "allowJoinWithMutedVideo"], [_allowWatermarkDecs, 2, "allowWatermark"], [_allowChangeUserNameDecs, 2, "allowChangeUserName"]], []).e;
289
+ exports.FcrPrivilegeControlImpl = FcrPrivilegeControlImpl;
@@ -12,6 +12,7 @@ let FcrPrivilegeUserRole = exports.FcrPrivilegeUserRole = /*#__PURE__*/function
12
12
  FcrPrivilegeUserRole[FcrPrivilegeUserRole["AUDIENCE"] = 4] = "AUDIENCE";
13
13
  FcrPrivilegeUserRole[FcrPrivilegeUserRole["OBSERVER"] = 5] = "OBSERVER";
14
14
  FcrPrivilegeUserRole[FcrPrivilegeUserRole["ROBOT"] = 6] = "ROBOT";
15
+ // All,
15
16
  FcrPrivilegeUserRole[FcrPrivilegeUserRole["SELF"] = 7] = "SELF";
16
17
  return FcrPrivilegeUserRole;
17
18
  }({});
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol.description.js");
4
- require("core-js/modules/es.error.cause.js");
5
3
  require("core-js/modules/esnext.function.metadata.js");
6
4
  require("core-js/modules/esnext.map.delete-all.js");
7
5
  require("core-js/modules/esnext.map.emplace.js");
@@ -24,21 +22,16 @@ Object.defineProperty(exports, "__esModule", {
24
22
  });
25
23
  exports.FcrRoomConnectorControlImpl = void 0;
26
24
  require("core-js/modules/es.array.push.js");
27
- require("core-js/modules/esnext.async-iterator.map.js");
28
- require("core-js/modules/esnext.async-iterator.reduce.js");
29
25
  require("core-js/modules/esnext.iterator.constructor.js");
30
26
  require("core-js/modules/esnext.iterator.map.js");
31
27
  require("core-js/modules/esnext.iterator.reduce.js");
32
- require("core-js/modules/web.dom-collections.iterator.js");
33
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
34
28
  var _type = require("./type");
35
29
  var _imports = require("../../imports");
36
30
  var _logger = require("../../utilities/logger");
37
31
  var _error = require("../../utilities/error");
38
32
  var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
39
33
  var _schema = require("../../schema");
40
- var _FcrRoomConnectorControlImpl;
41
- let _initProto, _startSessionByPhoneDecs, _startSessionByIPDecs, _stopSessionDecs, _ref;
34
+ let _initProto, _startSessionByPhoneDecs, _startSessionByIPDecs, _stopSessionDecs;
42
35
  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)]; } }; }
43
36
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
44
37
  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); }
@@ -47,14 +40,14 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
47
40
  /**
48
41
  * @internal
49
42
  */
50
- _ref = (_startSessionByPhoneDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrPhoneConnectorSessionParamsSchema)], _startSessionByIPDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrIPConnectorSessionParamsSchema)], _stopSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], "logger");
51
43
  class FcrRoomConnectorControlImpl {
44
+ static #_ = (() => [_initProto] = _applyDecs(this, [[_imports.trace, 2, "getRoomConnectorPhoneInfo"], [_imports.trace, 2, "getRoomConnectorIpInfo"], [_startSessionByPhoneDecs, 2, "startSessionByPhone"], [_startSessionByIPDecs, 2, "startSessionByIP"], [_stopSessionDecs, 2, "stopSession"]], []).e)();
45
+ //@internal
46
+ [(_startSessionByPhoneDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrPhoneConnectorSessionParamsSchema)], _startSessionByIPDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrIPConnectorSessionParamsSchema)], _stopSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], "logger")] = (() => (_initProto(this), (0, _logger.createLogger)({
47
+ prefix: 'FcrRoomConnectorControlImpl'
48
+ })))();
49
+ _observable = (() => new _imports.AgoraObservable())();
52
50
  constructor(_scene, _engine, _api) {
53
- //@internal
54
- (0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
55
- prefix: 'FcrRoomConnectorControlImpl'
56
- })));
57
- (0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
58
51
  this._scene = _scene;
59
52
  this._engine = _engine;
60
53
  this._api = _api;
@@ -64,18 +57,17 @@ class FcrRoomConnectorControlImpl {
64
57
  });
65
58
  }
66
59
  getRoomConnectorPhoneInfo() {
67
- var _ref2;
68
60
  const mid = this._scene.getScenePropertiesByKeyPath('call.mid');
69
- const callIn = (_ref2 = this._scene.getScenePropertiesByKeyPath('call.callIn')) !== null && _ref2 !== void 0 ? _ref2 : [];
61
+ const callIn = this._scene.getScenePropertiesByKeyPath('call.callIn') ?? [];
70
62
  const uid = this._scene.getUserPropertiesByKeyPath('call.uid', this._scene.getLocalUser().getLocalUserId());
71
63
  const regionMap = {
72
64
  cn: _type.FcrRoomConnectorPhoneRegion.CN
73
65
  };
74
- return Promise.resolve(callIn.map(_ref3 => {
66
+ return Promise.resolve(callIn.map(_ref => {
75
67
  let {
76
68
  callNumbers,
77
69
  region
78
- } = _ref3;
70
+ } = _ref;
79
71
  return {
80
72
  region: regionMap[region],
81
73
  phoneNumberList: callNumbers,
@@ -85,14 +77,13 @@ class FcrRoomConnectorControlImpl {
85
77
  }));
86
78
  }
87
79
  getRoomConnectorIpInfo() {
88
- var _ref4;
89
80
  const mid = this._scene.getScenePropertiesByKeyPath('call.mid');
90
- const callIn = (_ref4 = this._scene.getScenePropertiesByKeyPath('call.callIn')) !== null && _ref4 !== void 0 ? _ref4 : [];
81
+ const callIn = this._scene.getScenePropertiesByKeyPath('call.callIn') ?? [];
91
82
  return Promise.resolve({
92
- addressList: callIn.reduce((prev, _ref5) => {
83
+ addressList: callIn.reduce((prev, _ref2) => {
93
84
  let {
94
85
  ipAddresses
95
- } = _ref5;
86
+ } = _ref2;
96
87
  if (Array.isArray(ipAddresses)) {
97
88
  prev.push(...ipAddresses);
98
89
  }
@@ -192,6 +183,4 @@ class FcrRoomConnectorControlImpl {
192
183
  this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onIPConnectorSessionStateUpdated', 'onPhoneConnectorSessionStateUpdated']));
193
184
  }
194
185
  }
195
- exports.FcrRoomConnectorControlImpl = FcrRoomConnectorControlImpl;
196
- _FcrRoomConnectorControlImpl = FcrRoomConnectorControlImpl;
197
- [_initProto] = _applyDecs(_FcrRoomConnectorControlImpl, [[_imports.trace, 2, "getRoomConnectorPhoneInfo"], [_imports.trace, 2, "getRoomConnectorIpInfo"], [_startSessionByPhoneDecs, 2, "startSessionByPhone"], [_startSessionByIPDecs, 2, "startSessionByIP"], [_stopSessionDecs, 2, "stopSession"]], []).e;
186
+ exports.FcrRoomConnectorControlImpl = FcrRoomConnectorControlImpl;
@@ -1,21 +1,13 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol.description.js");
4
3
  require("core-js/modules/es.array.push.js");
5
- require("core-js/modules/esnext.async-iterator.filter.js");
6
- require("core-js/modules/esnext.async-iterator.for-each.js");
7
4
  require("core-js/modules/esnext.function.metadata.js");
8
- require("core-js/modules/esnext.iterator.constructor.js");
9
- require("core-js/modules/esnext.iterator.filter.js");
10
- require("core-js/modules/esnext.iterator.for-each.js");
11
5
  require("core-js/modules/esnext.symbol.metadata.js");
12
6
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
13
7
  Object.defineProperty(exports, "__esModule", {
14
8
  value: true
15
9
  });
16
10
  exports.FcrRoomSessionControlImpl = void 0;
17
- require("core-js/modules/es.error.cause.js");
18
- require("core-js/modules/es.json.stringify.js");
19
11
  require("core-js/modules/esnext.map.delete-all.js");
20
12
  require("core-js/modules/esnext.map.emplace.js");
21
13
  require("core-js/modules/esnext.map.every.js");
@@ -30,17 +22,12 @@ require("core-js/modules/esnext.map.merge.js");
30
22
  require("core-js/modules/esnext.map.reduce.js");
31
23
  require("core-js/modules/esnext.map.some.js");
32
24
  require("core-js/modules/esnext.map.update.js");
33
- require("core-js/modules/web.dom-collections.iterator.js");
34
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
35
25
  var _imports = require("../../imports");
36
26
  var _error = require("../../utilities/error");
37
27
  var _logger = require("../../utilities/logger");
38
28
  var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
39
29
  var _schema = require("../../schema");
40
- var _FcrRoomSessionControlImpl;
41
- let _initProto, _startRoomSessionDecs, _stopRoomSessionDecs, _acceptRoomSessionDecs, _rejectRoomSessionDecs, _ref;
42
- 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; }
43
- 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; }
30
+ let _initProto, _startRoomSessionDecs, _stopRoomSessionDecs, _acceptRoomSessionDecs, _rejectRoomSessionDecs;
44
31
  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)]; } }; }
45
32
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
46
33
  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); }
@@ -49,21 +36,23 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
49
36
  /**
50
37
  * @internal
51
38
  */
52
- _ref = (_startRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrRoomSessionParamsSchema)], _stopRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], _acceptRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSessionBaseSchema, _schema.stringKeyUnknownValueSchema.optional())], _rejectRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSessionBaseSchema, _schema.stringKeyUnknownValueSchema.optional())], "logger");
53
39
  class FcrRoomSessionControlImpl {
40
+ static #_ = (() => [_initProto] = _applyDecs(this, [[_startRoomSessionDecs, 2, "startRoomSession"], [_stopRoomSessionDecs, 2, "stopRoomSession"], [_acceptRoomSessionDecs, 2, "acceptRoomSession"], [_rejectRoomSessionDecs, 2, "rejectRoomSession"]], []).e)();
41
+ //@internal
42
+ [(_startRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrRoomSessionParamsSchema)], _stopRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], _acceptRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSessionBaseSchema, _schema.stringKeyUnknownValueSchema.optional())], _rejectRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSessionBaseSchema, _schema.stringKeyUnknownValueSchema.optional())], "logger")] = (() => (_initProto(this), (0, _logger.createLogger)({
43
+ prefix: 'FcrRoomSessionControlImpl'
44
+ })))();
45
+ //@internal
46
+ _observable = (() => new _imports.AgoraObservable())();
47
+ //@internal
48
+ _taskInterval = (() => _imports.Duration.second(1))();
49
+ //@internal
50
+
51
+ //@internal
52
+ _scheduleMap = (() => new Map())();
53
+ //@internal
54
+ _receivedMap = (() => new Map())();
54
55
  constructor(_roomControl, _api, _userId) {
55
- //@internal
56
- (0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
57
- prefix: 'FcrRoomSessionControlImpl'
58
- })));
59
- //@internal
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, "_scheduleMap", new Map());
65
- //@internal
66
- (0, _defineProperty2.default)(this, "_receivedMap", new Map());
67
56
  this._roomControl = _roomControl;
68
57
  this._api = _api;
69
58
  this._userId = _userId;
@@ -77,7 +66,7 @@ class FcrRoomSessionControlImpl {
77
66
  async startRoomSession(params) {
78
67
  try {
79
68
  const session = {
80
- sessionId: (0, _imports.md5)("".concat(Date.now())),
69
+ sessionId: (0, _imports.md5)(`${Date.now()}`),
81
70
  sessionKey: params.sessionKey,
82
71
  payload: params.payload,
83
72
  duration: params.duration,
@@ -96,11 +85,12 @@ class FcrRoomSessionControlImpl {
96
85
  targetId: this._roomControl.getRoomInfo().roomId
97
86
  });
98
87
  const nextTs = Date.now() + interval;
99
- this._scheduleMap.set(session.sessionId, _objectSpread(_objectSpread({}, params), {}, {
88
+ this._scheduleMap.set(session.sessionId, {
89
+ ...params,
100
90
  nextTs,
101
91
  startTs: Date.now()
102
- }));
103
- this.logger.info("[RoomSession] put into session schedule: ".concat(session.sessionId, ", next ts: ").concat(nextTs, ", remain: ").concat(nextTs - Date.now(), "ms"));
92
+ });
93
+ this.logger.info(`[RoomSession] put into session schedule: ${session.sessionId}, next ts: ${nextTs}, remain: ${nextTs - Date.now()}ms`);
104
94
  return session.sessionId;
105
95
  } catch (e) {
106
96
  throw (0, _error.generateFcrCoreServerError)(_error.FcrErrorCode.LOCAL_HTTP_REQUEST_FAILED, 'start room session failed', e);
@@ -169,13 +159,13 @@ class FcrRoomSessionControlImpl {
169
159
  interval: 0
170
160
  };
171
161
  if (this._isSessionExpired(session)) {
172
- this.logger.info("[RoomSession] room session expired, removed: ".concat(session.sessionId));
162
+ this.logger.info(`[RoomSession] room session expired, removed: ${session.sessionId}`);
173
163
  this._scheduleMap.delete(session.sessionId);
174
164
  continue;
175
165
  }
176
166
  // check timeout
177
167
  if (params.nextTs < Date.now()) {
178
- this.logger.info("[RoomSession] ping session: ".concat(session.sessionId));
168
+ this.logger.info(`[RoomSession] ping session: ${session.sessionId}`);
179
169
  try {
180
170
  const {
181
171
  data: {
@@ -191,13 +181,14 @@ class FcrRoomSessionControlImpl {
191
181
  });
192
182
  const nextTs = Date.now() + interval;
193
183
  if (this._scheduleMap.has(session.sessionId)) {
194
- this._scheduleMap.set(session.sessionId, _objectSpread(_objectSpread({}, params), {}, {
184
+ this._scheduleMap.set(session.sessionId, {
185
+ ...params,
195
186
  nextTs
196
- }));
197
- this.logger.info("[RoomSession] refresh session schedule: ".concat(session.sessionId, ", next ts: ").concat(nextTs));
187
+ });
188
+ this.logger.info(`[RoomSession] refresh session schedule: ${session.sessionId}, next ts: ${nextTs}`);
198
189
  }
199
190
  } catch (e) {
200
- this.logger.error("[RoomSession] ping session failed: ".concat(e));
191
+ this.logger.error(`[RoomSession] ping session failed: ${e}`);
201
192
  }
202
193
  }
203
194
  }
@@ -206,7 +197,7 @@ class FcrRoomSessionControlImpl {
206
197
  const session = this._receivedMap.get(key);
207
198
  if (this._isSessionExpired(session)) {
208
199
  this._receivedMap.delete(key);
209
- this.logger.info("[RoomSession] delete session callback: ".concat(key));
200
+ this.logger.info(`[RoomSession] delete session callback: ${key}`);
210
201
  }
211
202
  }
212
203
  }
@@ -237,7 +228,7 @@ class FcrRoomSessionControlImpl {
237
228
  }
238
229
  if (!this._isSessionExpired(session)) {
239
230
  if (!this._receivedMap.has(session.sessionId)) {
240
- this.logger.info("[RoomSession] received room session request ".concat(JSON.stringify(session)));
231
+ this.logger.info(`[RoomSession] received room session request ${JSON.stringify(session)}`);
241
232
  this._observable.notifyObservers('onRoomSessionReceived', roomId, session);
242
233
  }
243
234
  this._receivedMap.set(session.sessionId, session);
@@ -245,7 +236,6 @@ class FcrRoomSessionControlImpl {
245
236
  } else if (cmd === '1002') {
246
237
  if (data.action === 1) {
247
238
  if (this._scheduleMap.has(data.sessionUuid)) {
248
- var _session$payload, _ref2, _data$payload;
249
239
  const session = this._scheduleMap.get(data.sessionUuid);
250
240
  const sessionResponse = {
251
241
  sessionId: data.sessionUuid,
@@ -253,16 +243,15 @@ class FcrRoomSessionControlImpl {
253
243
  responderId: senderId,
254
244
  // FIXME: session may be lost when the client refreshes
255
245
  // get payload from original session
256
- payload: (_session$payload = session.payload) !== null && _session$payload !== void 0 ? _session$payload : {},
257
- cause: (_ref2 = (_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.cause) !== null && _ref2 !== void 0 ? _ref2 : {}
246
+ payload: session.payload ?? {},
247
+ cause: data.payload?.cause ?? {}
258
248
  };
259
- this.logger.info("[RoomSession] received room session accepted ".concat(JSON.stringify(sessionResponse)));
249
+ this.logger.info(`[RoomSession] received room session accepted ${JSON.stringify(sessionResponse)}`);
260
250
  this._scheduleMap.delete(data.sessionUuid);
261
251
  this._observable.notifyObservers('onRoomSessionAccepted', roomId, sessionResponse);
262
252
  }
263
253
  } else if (data.action === 2) {
264
254
  if (this._scheduleMap.has(data.sessionUuid)) {
265
- var _session$payload2, _ref3, _data$payload2;
266
255
  const session = this._scheduleMap.get(data.sessionUuid);
267
256
  const sessionResponse = {
268
257
  sessionId: data.sessionUuid,
@@ -270,10 +259,10 @@ class FcrRoomSessionControlImpl {
270
259
  responderId: senderId,
271
260
  // FIXME: session may be lost when the client refreshes
272
261
  // get payload from original session
273
- payload: (_session$payload2 = session.payload) !== null && _session$payload2 !== void 0 ? _session$payload2 : {},
274
- cause: (_ref3 = (_data$payload2 = data.payload) === null || _data$payload2 === void 0 ? void 0 : _data$payload2.cause) !== null && _ref3 !== void 0 ? _ref3 : {}
262
+ payload: session.payload ?? {},
263
+ cause: data.payload?.cause ?? {}
275
264
  };
276
- this.logger.info("[RoomSession] received room session rejected ".concat(JSON.stringify(sessionResponse)));
265
+ this.logger.info(`[RoomSession] received room session rejected ${JSON.stringify(sessionResponse)}`);
277
266
  if (this._scheduleMap.has(data.sessionUuid)) {
278
267
  this._scheduleMap.delete(data.sessionUuid);
279
268
  this._observable.notifyObservers('onRoomSessionRejected', roomId, sessionResponse);
@@ -291,6 +280,4 @@ class FcrRoomSessionControlImpl {
291
280
  this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onRoomSessionAccepted', 'onRoomSessionRejected', 'onRoomSessionReceived']));
292
281
  }
293
282
  }
294
- exports.FcrRoomSessionControlImpl = FcrRoomSessionControlImpl;
295
- _FcrRoomSessionControlImpl = FcrRoomSessionControlImpl;
296
- [_initProto] = _applyDecs(_FcrRoomSessionControlImpl, [[_startRoomSessionDecs, 2, "startRoomSession"], [_stopRoomSessionDecs, 2, "stopRoomSession"], [_acceptRoomSessionDecs, 2, "acceptRoomSession"], [_rejectRoomSessionDecs, 2, "rejectRoomSession"]], []).e;
283
+ exports.FcrRoomSessionControlImpl = FcrRoomSessionControlImpl;