agora-foundation 3.8.2 → 3.9.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/decorator/log/handler.d.ts +1 -1
- package/lib/decorator/log/handler.js +57 -64
- package/lib/decorator/log/index.d.ts +26 -1
- package/lib/decorator/log/index.js +50 -5
- package/lib/decorator/log/log-serializer.d.ts +1 -1
- package/lib/decorator/log/log-serializer.js +15 -2
- package/lib/decorator/proxy.d.ts +1 -1
- package/lib/decorator/proxy.js +16 -16
- package/lib/decorator/type.d.ts +3 -2
- package/lib/decorator/type.js +2 -2
- package/lib/utilities/desc-type.d.ts +1 -0
- package/lib/utilities/desc-type.js +1 -1
- package/lib/utilities/env.d.ts +2 -1
- package/lib/utilities/env.js +1 -0
- package/lib/utilities/{agora-error.d.ts → error/agora-error.d.ts} +5 -11
- package/lib/utilities/error/agora-error.js +148 -0
- package/lib/utilities/error/error-code.d.ts +69 -0
- package/lib/utilities/error/error-code.js +81 -0
- package/lib/utilities/logger.d.ts +13 -1
- package/lib/utilities/logger.js +103 -13
- package/lib/utilities/observable.js +1 -0
- package/lib/utilities/package-info.d.ts +8 -0
- package/lib/utilities/package-info.js +85 -0
- package/lib/utilities/regex.d.ts +1 -0
- package/lib/utilities/regex.js +14 -0
- package/lib/utilities/tools.d.ts +28 -0
- package/lib/utilities/tools.js +154 -0
- package/lib-es/decorator/log/handler.js +56 -64
- package/lib-es/decorator/log/index.js +49 -4
- package/lib-es/decorator/log/log-serializer.js +15 -2
- package/lib-es/decorator/proxy.js +16 -16
- package/lib-es/decorator/type.js +2 -2
- package/lib-es/utilities/desc-type.js +1 -1
- package/lib-es/utilities/env.js +1 -0
- package/lib-es/utilities/error/agora-error.js +140 -0
- package/lib-es/utilities/error/error-code.js +74 -0
- package/lib-es/utilities/logger.js +102 -12
- package/lib-es/utilities/observable.js +1 -0
- package/lib-es/utilities/package-info.js +78 -0
- package/lib-es/utilities/regex.js +7 -0
- package/lib-es/utilities/tools.js +144 -0
- package/package.json +2 -2
- package/lib/utilities/agora-error.js +0 -128
- package/lib-es/utilities/agora-error.js +0 -120
|
@@ -1,19 +1,109 @@
|
|
|
1
|
+
import "core-js/modules/es.symbol.js";
|
|
2
|
+
import "core-js/modules/es.symbol.description.js";
|
|
3
|
+
import "core-js/modules/es.symbol.to-primitive.js";
|
|
4
|
+
import "core-js/modules/es.error.cause.js";
|
|
5
|
+
import "core-js/modules/es.error.to-string.js";
|
|
6
|
+
import "core-js/modules/es.array.iterator.js";
|
|
7
|
+
import "core-js/modules/es.array.push.js";
|
|
8
|
+
import "core-js/modules/es.date.to-primitive.js";
|
|
9
|
+
import "core-js/modules/es.function.bind.js";
|
|
10
|
+
import "core-js/modules/es.function.name.js";
|
|
11
|
+
import "core-js/modules/es.map.js";
|
|
12
|
+
import "core-js/modules/es.number.constructor.js";
|
|
13
|
+
import "core-js/modules/es.object.create.js";
|
|
14
|
+
import "core-js/modules/es.object.define-property.js";
|
|
15
|
+
import "core-js/modules/es.object.get-own-property-descriptor.js";
|
|
16
|
+
import "core-js/modules/es.string.iterator.js";
|
|
17
|
+
import "core-js/modules/esnext.function.metadata.js";
|
|
18
|
+
import "core-js/modules/esnext.map.delete-all.js";
|
|
19
|
+
import "core-js/modules/esnext.map.emplace.js";
|
|
20
|
+
import "core-js/modules/esnext.map.every.js";
|
|
21
|
+
import "core-js/modules/esnext.map.filter.js";
|
|
22
|
+
import "core-js/modules/esnext.map.find.js";
|
|
23
|
+
import "core-js/modules/esnext.map.find-key.js";
|
|
24
|
+
import "core-js/modules/esnext.map.includes.js";
|
|
25
|
+
import "core-js/modules/esnext.map.key-of.js";
|
|
26
|
+
import "core-js/modules/esnext.map.map-keys.js";
|
|
27
|
+
import "core-js/modules/esnext.map.map-values.js";
|
|
28
|
+
import "core-js/modules/esnext.map.merge.js";
|
|
29
|
+
import "core-js/modules/esnext.map.reduce.js";
|
|
30
|
+
import "core-js/modules/esnext.map.some.js";
|
|
31
|
+
import "core-js/modules/esnext.map.update.js";
|
|
32
|
+
import "core-js/modules/esnext.symbol.metadata.js";
|
|
33
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
34
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
35
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
36
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
37
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
38
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
39
|
+
var _LoggerManager;
|
|
40
|
+
var _initProto;
|
|
1
41
|
import "core-js/modules/es.array.concat.js";
|
|
2
42
|
import "core-js/modules/es.array.for-each.js";
|
|
43
|
+
import "core-js/modules/es.array.is-array.js";
|
|
3
44
|
import "core-js/modules/es.object.to-string.js";
|
|
4
45
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
5
46
|
import "core-js/modules/esnext.iterator.for-each.js";
|
|
6
47
|
import "core-js/modules/web.dom-collections.for-each.js";
|
|
48
|
+
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 set(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 k(e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { return e[n]; }, (o < 2 || 4 === o) && (F = function F(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 s(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)]; } }; }
|
|
49
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
50
|
+
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); }
|
|
51
|
+
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; }
|
|
52
|
+
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; }
|
|
53
|
+
import { bound } from '../decorator/bound';
|
|
7
54
|
import { serializeArgs } from '../decorator/log/log-serializer';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
55
|
+
import { getLogger as _getLogger, createLogger as _createLogger } from '../logger';
|
|
56
|
+
import { randomString } from './misc';
|
|
57
|
+
export var LoggerManager = /*#__PURE__*/function () {
|
|
58
|
+
function LoggerManager(_ref) {
|
|
59
|
+
var label = _ref.label;
|
|
60
|
+
_classCallCheck(this, LoggerManager);
|
|
61
|
+
_defineProperty(this, "_logger", void _initProto(this));
|
|
62
|
+
this.label = label;
|
|
63
|
+
this._logger = _getLogger({
|
|
64
|
+
label: this.label
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return _createClass(LoggerManager, [{
|
|
68
|
+
key: "getLogger",
|
|
69
|
+
value: function getLogger() {
|
|
70
|
+
return this._logger;
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "createLogger",
|
|
74
|
+
value: function createLogger(opts) {
|
|
75
|
+
return _createLogger({
|
|
76
|
+
label: this.label,
|
|
77
|
+
prefix: "".concat(opts.prefix, "@").concat(randomString(5)),
|
|
78
|
+
database: opts.database
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "generateLogObserver",
|
|
83
|
+
value: function generateLogObserver(logger, callbackMethods) {
|
|
84
|
+
var observer = {};
|
|
85
|
+
callbackMethods.forEach(function (method) {
|
|
86
|
+
var methodName;
|
|
87
|
+
var methodParamNames;
|
|
88
|
+
if (Array.isArray(method)) {
|
|
89
|
+
methodName = method[0];
|
|
90
|
+
methodParamNames = method[1];
|
|
91
|
+
} else {
|
|
92
|
+
methodName = method;
|
|
93
|
+
}
|
|
94
|
+
observer[methodName] = function () {
|
|
95
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
96
|
+
args[_key] = arguments[_key];
|
|
97
|
+
}
|
|
98
|
+
logger.info("".concat(methodName, ": [API Callback] [parameters: [").concat(serializeArgs(args, methodParamNames), "]]"));
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
return observer;
|
|
102
|
+
}
|
|
103
|
+
}]);
|
|
104
|
+
}();
|
|
105
|
+
_LoggerManager = LoggerManager;
|
|
106
|
+
var _applyDecs$e = _applyDecs(_LoggerManager, [[bound, 2, "getLogger"], [bound, 2, "createLogger"], [bound, 2, "generateLogObserver"]], []).e;
|
|
107
|
+
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
108
|
+
_initProto = _applyDecs$e2[0];
|
|
109
|
+
_applyDecs$e;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import "core-js/modules/es.symbol.js";
|
|
2
|
+
import "core-js/modules/es.symbol.description.js";
|
|
3
|
+
import "core-js/modules/es.symbol.to-primitive.js";
|
|
4
|
+
import "core-js/modules/es.error.cause.js";
|
|
5
|
+
import "core-js/modules/es.error.to-string.js";
|
|
6
|
+
import "core-js/modules/es.array.is-array.js";
|
|
7
|
+
import "core-js/modules/es.array.iterator.js";
|
|
8
|
+
import "core-js/modules/es.array.push.js";
|
|
9
|
+
import "core-js/modules/es.date.to-primitive.js";
|
|
10
|
+
import "core-js/modules/es.function.bind.js";
|
|
11
|
+
import "core-js/modules/es.function.name.js";
|
|
12
|
+
import "core-js/modules/es.map.js";
|
|
13
|
+
import "core-js/modules/es.number.constructor.js";
|
|
14
|
+
import "core-js/modules/es.object.create.js";
|
|
15
|
+
import "core-js/modules/es.object.define-property.js";
|
|
16
|
+
import "core-js/modules/es.object.get-own-property-descriptor.js";
|
|
17
|
+
import "core-js/modules/es.object.to-string.js";
|
|
18
|
+
import "core-js/modules/es.string.iterator.js";
|
|
19
|
+
import "core-js/modules/esnext.function.metadata.js";
|
|
20
|
+
import "core-js/modules/esnext.map.delete-all.js";
|
|
21
|
+
import "core-js/modules/esnext.map.emplace.js";
|
|
22
|
+
import "core-js/modules/esnext.map.every.js";
|
|
23
|
+
import "core-js/modules/esnext.map.filter.js";
|
|
24
|
+
import "core-js/modules/esnext.map.find.js";
|
|
25
|
+
import "core-js/modules/esnext.map.find-key.js";
|
|
26
|
+
import "core-js/modules/esnext.map.includes.js";
|
|
27
|
+
import "core-js/modules/esnext.map.key-of.js";
|
|
28
|
+
import "core-js/modules/esnext.map.map-keys.js";
|
|
29
|
+
import "core-js/modules/esnext.map.map-values.js";
|
|
30
|
+
import "core-js/modules/esnext.map.merge.js";
|
|
31
|
+
import "core-js/modules/esnext.map.reduce.js";
|
|
32
|
+
import "core-js/modules/esnext.map.some.js";
|
|
33
|
+
import "core-js/modules/esnext.map.update.js";
|
|
34
|
+
import "core-js/modules/esnext.symbol.metadata.js";
|
|
35
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
36
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
37
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
38
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
39
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
40
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
41
|
+
var _PackageInfo;
|
|
42
|
+
var _initProto;
|
|
43
|
+
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 set(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 k(e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { return e[n]; }, (o < 2 || 4 === o) && (F = function F(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 s(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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
45
|
+
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); }
|
|
46
|
+
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; }
|
|
47
|
+
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; }
|
|
48
|
+
import { bound } from '../decorator/bound';
|
|
49
|
+
export var PackageInfo = /*#__PURE__*/function () {
|
|
50
|
+
function PackageInfo(packageInfo) {
|
|
51
|
+
_classCallCheck(this, PackageInfo);
|
|
52
|
+
_defineProperty(this, "_packageInfo", void _initProto(this));
|
|
53
|
+
this._packageInfo = packageInfo;
|
|
54
|
+
}
|
|
55
|
+
return _createClass(PackageInfo, [{
|
|
56
|
+
key: "getVersion",
|
|
57
|
+
value: function getVersion() {
|
|
58
|
+
return this._packageInfo.version || '';
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "getDependenciesInfo",
|
|
62
|
+
value: function getDependenciesInfo(packageName) {
|
|
63
|
+
var _this$_packageInfo$de;
|
|
64
|
+
return ((_this$_packageInfo$de = this._packageInfo.dependencies) === null || _this$_packageInfo$de === void 0 ? void 0 : _this$_packageInfo$de[packageName]) || '';
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
key: "getDevDependenciesInfo",
|
|
68
|
+
value: function getDevDependenciesInfo(packageName) {
|
|
69
|
+
var _this$_packageInfo$de2;
|
|
70
|
+
return ((_this$_packageInfo$de2 = this._packageInfo.devDependencies) === null || _this$_packageInfo$de2 === void 0 ? void 0 : _this$_packageInfo$de2[packageName]) || '';
|
|
71
|
+
}
|
|
72
|
+
}]);
|
|
73
|
+
}();
|
|
74
|
+
_PackageInfo = PackageInfo;
|
|
75
|
+
var _applyDecs$e = _applyDecs(_PackageInfo, [[bound, 2, "getVersion"], [bound, 2, "getDependenciesInfo"], [bound, 2, "getDevDependenciesInfo"]], []).e;
|
|
76
|
+
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
77
|
+
_initProto = _applyDecs$e2[0];
|
|
78
|
+
_applyDecs$e;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
2
|
+
import "core-js/modules/es.regexp.test.js";
|
|
3
|
+
export var isPhoneNumber = function isPhoneNumber(invitePhoneNumber) {
|
|
4
|
+
if (typeof invitePhoneNumber !== 'string') return false;
|
|
5
|
+
var reg = /^1[3-9]\d{9}$/;
|
|
6
|
+
return reg.test(invitePhoneNumber);
|
|
7
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import "core-js/modules/es.array.reduce.js";
|
|
4
|
+
import "core-js/modules/es.array.slice.js";
|
|
5
|
+
import "core-js/modules/es.number.constructor.js";
|
|
6
|
+
import "core-js/modules/es.number.to-fixed.js";
|
|
7
|
+
import "core-js/modules/es.object.to-string.js";
|
|
8
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
9
|
+
import "core-js/modules/es.regexp.test.js";
|
|
10
|
+
import "core-js/modules/es.string.ends-with.js";
|
|
11
|
+
import "core-js/modules/es.string.match.js";
|
|
12
|
+
import "core-js/modules/es.string.replace.js";
|
|
13
|
+
import "core-js/modules/es.string.starts-with.js";
|
|
14
|
+
var LocalStorage = /*#__PURE__*/function () {
|
|
15
|
+
function LocalStorage() {
|
|
16
|
+
_classCallCheck(this, LocalStorage);
|
|
17
|
+
}
|
|
18
|
+
return _createClass(LocalStorage, [{
|
|
19
|
+
key: "set",
|
|
20
|
+
value: function set(key, value) {
|
|
21
|
+
localStorage.setItem(key, value);
|
|
22
|
+
}
|
|
23
|
+
}, {
|
|
24
|
+
key: "get",
|
|
25
|
+
value: function get(key) {
|
|
26
|
+
return localStorage.getItem(key);
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
key: "remove",
|
|
30
|
+
value: function remove(key) {
|
|
31
|
+
localStorage.removeItem(key);
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
key: "clear",
|
|
35
|
+
value: function clear() {
|
|
36
|
+
localStorage.clear();
|
|
37
|
+
}
|
|
38
|
+
}]);
|
|
39
|
+
}();
|
|
40
|
+
export var storage = new LocalStorage();
|
|
41
|
+
export var ASIDE_WIDTH = 'aside_width';
|
|
42
|
+
export var PARTICIPANT_POSITION = 'participant_position';
|
|
43
|
+
export var convertToFixedNumber = function convertToFixedNumber(value) {
|
|
44
|
+
var divisor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
|
|
45
|
+
var fractionDigits = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
|
|
46
|
+
return Number((value / divisor).toFixed(fractionDigits));
|
|
47
|
+
};
|
|
48
|
+
var virtualSoundCardPatternList = [/BlackHole/i, /SoundFlower/i, /AgoraALD/i];
|
|
49
|
+
export var matchVirtualSoundCardPattern = function matchVirtualSoundCardPattern(deviceName) {
|
|
50
|
+
return virtualSoundCardPatternList.reduce(function (prev, pattern) {
|
|
51
|
+
pattern.test(deviceName) && (prev = true);
|
|
52
|
+
return prev;
|
|
53
|
+
}, false);
|
|
54
|
+
};
|
|
55
|
+
export var isZipUrl = function isZipUrl(url) {
|
|
56
|
+
if (!url || typeof url !== 'string') return false;
|
|
57
|
+
var regex = /^https?:\/\/.+\.(zip)(\?.*)?$/i;
|
|
58
|
+
return regex.test(url);
|
|
59
|
+
};
|
|
60
|
+
export var isPngOrJpg = function isPngOrJpg(path) {
|
|
61
|
+
if (!path || typeof path !== 'string') return false;
|
|
62
|
+
return path.endsWith('.png') || path.endsWith('.jpg');
|
|
63
|
+
};
|
|
64
|
+
export var isMp4 = function isMp4(path) {
|
|
65
|
+
if (!path || typeof path !== 'string') return false;
|
|
66
|
+
return path.endsWith('.mp4');
|
|
67
|
+
};
|
|
68
|
+
export var isMp3OrWavUrl = function isMp3OrWavUrl(url) {
|
|
69
|
+
if (!url || typeof url !== 'string') return false;
|
|
70
|
+
var regex = /^https?:\/\/.+\.(mp3|wav)(\?.*)?$/i;
|
|
71
|
+
return regex.test(url);
|
|
72
|
+
};
|
|
73
|
+
export var isMp3OrWav = function isMp3OrWav(path) {
|
|
74
|
+
if (!path || typeof path !== 'string') return false;
|
|
75
|
+
return path.endsWith('.mp3') || path.endsWith('.wav');
|
|
76
|
+
};
|
|
77
|
+
export function getFileNameWithoutExtension(filePath) {
|
|
78
|
+
var match = filePath.match(/([^\\/]+)(?=\.\w+$)/);
|
|
79
|
+
var result = match ? match[1] : '';
|
|
80
|
+
return result !== null && result !== void 0 ? result : '';
|
|
81
|
+
}
|
|
82
|
+
export var setLanguage = function setLanguage(language) {
|
|
83
|
+
storage.set('$$fcr_language', language);
|
|
84
|
+
};
|
|
85
|
+
export var getLanguage = function getLanguage() {
|
|
86
|
+
return storage.get('$$fcr_language');
|
|
87
|
+
};
|
|
88
|
+
export var getBrowserLanguage = function getBrowserLanguage() {
|
|
89
|
+
var usrlang = navigator.language;
|
|
90
|
+
if (usrlang.startsWith('zh')) {
|
|
91
|
+
return 'zh';
|
|
92
|
+
}
|
|
93
|
+
return 'en';
|
|
94
|
+
};
|
|
95
|
+
export var uint8ArrayToImageData = function uint8ArrayToImageData(target) {
|
|
96
|
+
var _target$buffer;
|
|
97
|
+
if (!target || !(target !== null && target !== void 0 && (_target$buffer = target.buffer) !== null && _target$buffer !== void 0 && _target$buffer.length)) {
|
|
98
|
+
return '';
|
|
99
|
+
}
|
|
100
|
+
var canvas = document.createElement('canvas');
|
|
101
|
+
var ctx = canvas.getContext('2d');
|
|
102
|
+
if (!ctx) return '';
|
|
103
|
+
var width = canvas.width = target.width;
|
|
104
|
+
var height = canvas.height = target.height;
|
|
105
|
+
var rowBytes = width * 4;
|
|
106
|
+
for (var row = 0; row < height; row++) {
|
|
107
|
+
var srow = row;
|
|
108
|
+
var imageData = ctx.createImageData(width, 1);
|
|
109
|
+
var start = srow * width * 4;
|
|
110
|
+
if (target.isWindows) {
|
|
111
|
+
for (var i = 0; i < rowBytes; i += 4) {
|
|
112
|
+
imageData.data[i] = target.buffer[start + i + 2];
|
|
113
|
+
imageData.data[i + 1] = target.buffer[start + i + 1];
|
|
114
|
+
imageData.data[i + 2] = target.buffer[start + i];
|
|
115
|
+
imageData.data[i + 3] = target.buffer[start + i + 3];
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
for (var _i = 0; _i < rowBytes; ++_i) {
|
|
119
|
+
imageData.data[_i] = target.buffer[start + _i];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
ctx.putImageData(imageData, 0, row);
|
|
123
|
+
}
|
|
124
|
+
return canvas.toDataURL('image/png');
|
|
125
|
+
};
|
|
126
|
+
export var renderMeetingId = function renderMeetingId(meetingId, roomId) {
|
|
127
|
+
var renderMeetingId = '';
|
|
128
|
+
if (meetingId) {
|
|
129
|
+
// 检查meetingId是否为纯数字
|
|
130
|
+
var isNumeric = /^\d+$/.test(meetingId);
|
|
131
|
+
if (!isNumeric) {
|
|
132
|
+
renderMeetingId = meetingId;
|
|
133
|
+
} else {
|
|
134
|
+
renderMeetingId = meetingId.replace(/(.{3})/g, '$1 ');
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
if (roomId.endsWith('-waiting')) {
|
|
138
|
+
renderMeetingId = roomId.slice(0, -8).replace(/(.{3})/g, '$1 ');
|
|
139
|
+
} else {
|
|
140
|
+
renderMeetingId = roomId.replace(/(.{3})/g, '$1 ');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return renderMeetingId;
|
|
144
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-foundation",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0-alpha",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@types/jasmine": "^5.1.4",
|
|
25
25
|
"@types/lodash": "^4.14.168",
|
|
26
26
|
"@types/node": "^20.11.30",
|
|
27
|
-
"agora-toolchain": "3.
|
|
27
|
+
"agora-toolchain": "3.9.0-alpha",
|
|
28
28
|
"core-js": "^3.33.3",
|
|
29
29
|
"tslib": "^2.6.2",
|
|
30
30
|
"winston": "^3.16.0",
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
require("core-js/modules/es.reflect.construct.js");
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7
|
-
value: true
|
|
8
|
-
});
|
|
9
|
-
exports.AgoraError = void 0;
|
|
10
|
-
require("core-js/modules/es.error.cause.js");
|
|
11
|
-
require("core-js/modules/es.error.to-string.js");
|
|
12
|
-
require("core-js/modules/es.array.concat.js");
|
|
13
|
-
require("core-js/modules/es.math.log10.js");
|
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
16
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
18
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
20
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
21
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
-
var ERROR_CODE = {
|
|
23
|
-
UNDEFINED: 1,
|
|
24
|
-
JOIN_TIMEOUT: 10
|
|
25
|
-
};
|
|
26
|
-
var AgoraError = exports.AgoraError = /*#__PURE__*/function (_Error) {
|
|
27
|
-
function AgoraError(params) {
|
|
28
|
-
var _this;
|
|
29
|
-
(0, _classCallCheck2["default"])(this, AgoraError);
|
|
30
|
-
_this = _callSuper(this, AgoraError);
|
|
31
|
-
_this._code = params.code;
|
|
32
|
-
_this._message = params.message;
|
|
33
|
-
_this._cause = params.cause;
|
|
34
|
-
return _this;
|
|
35
|
-
}
|
|
36
|
-
(0, _inherits2["default"])(AgoraError, _Error);
|
|
37
|
-
return (0, _createClass2["default"])(AgoraError, [{
|
|
38
|
-
key: "code",
|
|
39
|
-
get: function get() {
|
|
40
|
-
return this._code;
|
|
41
|
-
}
|
|
42
|
-
}, {
|
|
43
|
-
key: "message",
|
|
44
|
-
get: function get() {
|
|
45
|
-
return this._message;
|
|
46
|
-
}
|
|
47
|
-
}, {
|
|
48
|
-
key: "toString",
|
|
49
|
-
value: function toString() {
|
|
50
|
-
var text = "message: ".concat(this._message, ", code: ").concat(this._code);
|
|
51
|
-
if (this._cause) {
|
|
52
|
-
text += ", cause: ".concat(this._cause);
|
|
53
|
-
}
|
|
54
|
-
return text;
|
|
55
|
-
}
|
|
56
|
-
}], [{
|
|
57
|
-
key: "createCode",
|
|
58
|
-
value: function createCode(_ref) {
|
|
59
|
-
var serviceCode = _ref.serviceCode,
|
|
60
|
-
moduleCode = _ref.moduleCode,
|
|
61
|
-
detailCode = _ref.detailCode;
|
|
62
|
-
return AgoraError.createServiceCode(serviceCode) + AgoraError.createModuleCode(moduleCode) + detailCode;
|
|
63
|
-
}
|
|
64
|
-
}, {
|
|
65
|
-
key: "createServiceCode",
|
|
66
|
-
value: function createServiceCode(serviceCode) {
|
|
67
|
-
var digitCount = Math.floor(Math.log10(serviceCode)) + 1;
|
|
68
|
-
var formatServiceCode = serviceCode;
|
|
69
|
-
switch (digitCount) {
|
|
70
|
-
case 1:
|
|
71
|
-
formatServiceCode = formatServiceCode * 100;
|
|
72
|
-
case 2:
|
|
73
|
-
formatServiceCode = formatServiceCode * 10;
|
|
74
|
-
case 3:
|
|
75
|
-
formatServiceCode = formatServiceCode;
|
|
76
|
-
default:
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
return formatServiceCode * 1000 * 1000;
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
key: "createModuleCode",
|
|
83
|
-
value: function createModuleCode(moduleCode) {
|
|
84
|
-
return moduleCode * 1000;
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
key: "createWithOptions",
|
|
88
|
-
value: function createWithOptions(options) {
|
|
89
|
-
var code = AgoraError.createCode(options);
|
|
90
|
-
return new AgoraError({
|
|
91
|
-
code: code,
|
|
92
|
-
message: options.message,
|
|
93
|
-
cause: options.cause
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}, {
|
|
97
|
-
key: "createWithError",
|
|
98
|
-
value: function createWithError(error) {
|
|
99
|
-
if (error instanceof AgoraError) {
|
|
100
|
-
return error;
|
|
101
|
-
}
|
|
102
|
-
return new AgoraError({
|
|
103
|
-
code: 1,
|
|
104
|
-
message: 'undefine',
|
|
105
|
-
cause: String(error.cause)
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}, {
|
|
109
|
-
key: "createWithAny",
|
|
110
|
-
value: function createWithAny(error, message) {
|
|
111
|
-
if (error instanceof AgoraError) {
|
|
112
|
-
return error;
|
|
113
|
-
} else {
|
|
114
|
-
var code = ERROR_CODE.UNDEFINED;
|
|
115
|
-
if (error instanceof Error) {
|
|
116
|
-
if (error.cause) {
|
|
117
|
-
message = message + ", error cause: ".concat(error.cause);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
var rtcError = new AgoraError({
|
|
121
|
-
code: code,
|
|
122
|
-
message: message
|
|
123
|
-
});
|
|
124
|
-
return rtcError;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}]);
|
|
128
|
-
}(/*#__PURE__*/(0, _wrapNativeSuper2["default"])(Error));
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import "core-js/modules/es.reflect.construct.js";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
8
|
-
import "core-js/modules/es.error.cause.js";
|
|
9
|
-
import "core-js/modules/es.error.to-string.js";
|
|
10
|
-
import "core-js/modules/es.array.concat.js";
|
|
11
|
-
import "core-js/modules/es.math.log10.js";
|
|
12
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
13
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
|
-
var ERROR_CODE = {
|
|
15
|
-
UNDEFINED: 1,
|
|
16
|
-
JOIN_TIMEOUT: 10
|
|
17
|
-
};
|
|
18
|
-
export var AgoraError = /*#__PURE__*/function (_Error) {
|
|
19
|
-
function AgoraError(params) {
|
|
20
|
-
var _this;
|
|
21
|
-
_classCallCheck(this, AgoraError);
|
|
22
|
-
_this = _callSuper(this, AgoraError);
|
|
23
|
-
_this._code = params.code;
|
|
24
|
-
_this._message = params.message;
|
|
25
|
-
_this._cause = params.cause;
|
|
26
|
-
return _this;
|
|
27
|
-
}
|
|
28
|
-
_inherits(AgoraError, _Error);
|
|
29
|
-
return _createClass(AgoraError, [{
|
|
30
|
-
key: "code",
|
|
31
|
-
get: function get() {
|
|
32
|
-
return this._code;
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
key: "message",
|
|
36
|
-
get: function get() {
|
|
37
|
-
return this._message;
|
|
38
|
-
}
|
|
39
|
-
}, {
|
|
40
|
-
key: "toString",
|
|
41
|
-
value: function toString() {
|
|
42
|
-
var text = "message: ".concat(this._message, ", code: ").concat(this._code);
|
|
43
|
-
if (this._cause) {
|
|
44
|
-
text += ", cause: ".concat(this._cause);
|
|
45
|
-
}
|
|
46
|
-
return text;
|
|
47
|
-
}
|
|
48
|
-
}], [{
|
|
49
|
-
key: "createCode",
|
|
50
|
-
value: function createCode(_ref) {
|
|
51
|
-
var serviceCode = _ref.serviceCode,
|
|
52
|
-
moduleCode = _ref.moduleCode,
|
|
53
|
-
detailCode = _ref.detailCode;
|
|
54
|
-
return AgoraError.createServiceCode(serviceCode) + AgoraError.createModuleCode(moduleCode) + detailCode;
|
|
55
|
-
}
|
|
56
|
-
}, {
|
|
57
|
-
key: "createServiceCode",
|
|
58
|
-
value: function createServiceCode(serviceCode) {
|
|
59
|
-
var digitCount = Math.floor(Math.log10(serviceCode)) + 1;
|
|
60
|
-
var formatServiceCode = serviceCode;
|
|
61
|
-
switch (digitCount) {
|
|
62
|
-
case 1:
|
|
63
|
-
formatServiceCode = formatServiceCode * 100;
|
|
64
|
-
case 2:
|
|
65
|
-
formatServiceCode = formatServiceCode * 10;
|
|
66
|
-
case 3:
|
|
67
|
-
formatServiceCode = formatServiceCode;
|
|
68
|
-
default:
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
return formatServiceCode * 1000 * 1000;
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "createModuleCode",
|
|
75
|
-
value: function createModuleCode(moduleCode) {
|
|
76
|
-
return moduleCode * 1000;
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
key: "createWithOptions",
|
|
80
|
-
value: function createWithOptions(options) {
|
|
81
|
-
var code = AgoraError.createCode(options);
|
|
82
|
-
return new AgoraError({
|
|
83
|
-
code: code,
|
|
84
|
-
message: options.message,
|
|
85
|
-
cause: options.cause
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
key: "createWithError",
|
|
90
|
-
value: function createWithError(error) {
|
|
91
|
-
if (error instanceof AgoraError) {
|
|
92
|
-
return error;
|
|
93
|
-
}
|
|
94
|
-
return new AgoraError({
|
|
95
|
-
code: 1,
|
|
96
|
-
message: 'undefine',
|
|
97
|
-
cause: String(error.cause)
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}, {
|
|
101
|
-
key: "createWithAny",
|
|
102
|
-
value: function createWithAny(error, message) {
|
|
103
|
-
if (error instanceof AgoraError) {
|
|
104
|
-
return error;
|
|
105
|
-
} else {
|
|
106
|
-
var code = ERROR_CODE.UNDEFINED;
|
|
107
|
-
if (error instanceof Error) {
|
|
108
|
-
if (error.cause) {
|
|
109
|
-
message = message + ", error cause: ".concat(error.cause);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
var rtcError = new AgoraError({
|
|
113
|
-
code: code,
|
|
114
|
-
message: message
|
|
115
|
-
});
|
|
116
|
-
return rtcError;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}]);
|
|
120
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|