@webex/internal-plugin-mobius-socket 0.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +6 -0
- package/README.md +131 -0
- package/babel.config.js +3 -0
- package/dist/config.js +47 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.js +106 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/mercury.js +916 -0
- package/dist/mercury.js.map +1 -0
- package/dist/socket/constants.js +16 -0
- package/dist/socket/constants.js.map +1 -0
- package/dist/socket/index.js +15 -0
- package/dist/socket/index.js.map +1 -0
- package/dist/socket/socket-base.js +537 -0
- package/dist/socket/socket-base.js.map +1 -0
- package/dist/socket/socket.js +19 -0
- package/dist/socket/socket.js.map +1 -0
- package/dist/socket/socket.shim.js +36 -0
- package/dist/socket/socket.shim.js.map +1 -0
- package/jest.config.js +3 -0
- package/package.json +68 -0
- package/process +1 -0
- package/src/config.js +40 -0
- package/src/errors.js +66 -0
- package/src/index.js +32 -0
- package/src/mercury.js +1059 -0
- package/src/socket/constants.js +6 -0
- package/src/socket/index.js +5 -0
- package/src/socket/socket-base.js +558 -0
- package/src/socket/socket.js +13 -0
- package/src/socket/socket.shim.js +31 -0
- package/test/integration/spec/mercury.js +117 -0
- package/test/integration/spec/sharable-mercury.js +59 -0
- package/test/integration/spec/webex.js +44 -0
- package/test/unit/lib/promise-tick.js +19 -0
- package/test/unit/spec/mercury-events.js +492 -0
- package/test/unit/spec/mercury.js +1787 -0
- package/test/unit/spec/socket.js +1037 -0
package/.eslintrc.js
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# @webex/internal-plugin-mercury
|
|
2
|
+
|
|
3
|
+
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
+
|
|
5
|
+
> Plugin for the Mercury service
|
|
6
|
+
|
|
7
|
+
This is an internal Cisco Webex plugin. As such, it does not strictly adhere to semantic versioning. Use at your own risk. If you're not working on one of our first party clients, please look at our [developer api](https://developer.webex.com/) and stick to our public plugins.
|
|
8
|
+
|
|
9
|
+
- [Install](#install)
|
|
10
|
+
- [Usage](#usage)
|
|
11
|
+
- [Contribute](#contribute)
|
|
12
|
+
- [Maintainers](#maintainers)
|
|
13
|
+
- [License](#license)
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install --save @webex/internal-plugin-mercury
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import '@webex/internal-plugin-mercury';
|
|
25
|
+
|
|
26
|
+
import WebexCore from '@webex/webex-core';
|
|
27
|
+
|
|
28
|
+
const webex = new WebexCore();
|
|
29
|
+
webex.internal.mercury.WHATEVER;
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Multiple Connections
|
|
33
|
+
|
|
34
|
+
Mercury now supports multiple simultaneous websocket connections scoped by `sessionId`.
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
const mercury = webex.internal.mercury;
|
|
38
|
+
|
|
39
|
+
// Default session
|
|
40
|
+
await mercury.connect();
|
|
41
|
+
|
|
42
|
+
// Additional session
|
|
43
|
+
await mercury.connect(undefined, 'secondary-session');
|
|
44
|
+
|
|
45
|
+
// Disconnect only one session
|
|
46
|
+
await mercury.disconnect(undefined, 'secondary-session');
|
|
47
|
+
|
|
48
|
+
// Disconnect everything
|
|
49
|
+
await mercury.disconnectAll();
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### Listening to multiple connections
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
const mercury = webex.internal.mercury;
|
|
56
|
+
const secondarySessionId = 'secondary-session';
|
|
57
|
+
|
|
58
|
+
// Connect both sessions first.
|
|
59
|
+
await mercury.connect();
|
|
60
|
+
await mercury.connect(undefined, secondarySessionId);
|
|
61
|
+
|
|
62
|
+
// Default session listeners use the base event name.
|
|
63
|
+
mercury.on('online', () => {
|
|
64
|
+
console.log('[default] online');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
mercury.on('event:conversation.activity', (envelope) => {
|
|
68
|
+
console.log('[default] activity', envelope.data?.eventType);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Non-default sessions use :<sessionId> suffix.
|
|
72
|
+
mercury.on(`online:${secondarySessionId}`, () => {
|
|
73
|
+
console.log(`[${secondarySessionId}] online`);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
mercury.on(`event:conversation.activity:${secondarySessionId}`, (envelope) => {
|
|
77
|
+
console.log(`[${secondarySessionId}] activity`, envelope.data?.eventType);
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Notes:
|
|
82
|
+
- `connect(webSocketUrl, sessionId)` and `disconnect(options, sessionId)` are session-aware.
|
|
83
|
+
- Non-default sessions emit events with a `:<sessionId>` suffix (for example, `online:secondary-session`).
|
|
84
|
+
- `getSocket(sessionId)` returns the socket for a specific session.
|
|
85
|
+
|
|
86
|
+
## Config Options
|
|
87
|
+
|
|
88
|
+
### Using A Proxy Agent To Open A Websocket Connection
|
|
89
|
+
|
|
90
|
+
For consumers who are not using the SDK via the browser it may be necessary to configure a proxy agent in order to connect with Mercury and open a Websocket in a proxy environment.
|
|
91
|
+
|
|
92
|
+
This can be done by configuring an agent as part of a DefaultMercuryOptions config object as shown below. The agent object will then be injected into the SDK and used in the Mercury plugin during WebSocket construction as an option property, allowing a connection to be established via the specified proxy url.
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
const webex = require(`webex`);
|
|
96
|
+
const HttpsProxyAgent = require('https-proxy-agent');
|
|
97
|
+
|
|
98
|
+
let httpsProxyAgent = new HttpsProxyAgent(url.parse(proxyUrl));
|
|
99
|
+
|
|
100
|
+
webex.init({
|
|
101
|
+
config: {
|
|
102
|
+
defaultMercuryOptions: {
|
|
103
|
+
agent: httpsProxyAgent
|
|
104
|
+
},
|
|
105
|
+
...
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Retries
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
The default behaviour is for Mercury to continue to try to connect with an exponential back-off. This behavior can be adjusted with the following config params:
|
|
114
|
+
|
|
115
|
+
- `maxRetries` - the number of times it will retry before error. Default: 0
|
|
116
|
+
- `initialConnectionMaxRetries` - the number of times it will retry before error on the first connection. Once a connection has been established, any further connection attempts will use `maxRetries`. Default: 0
|
|
117
|
+
- `backoffTimeMax` - The maximum time between connection attempts in ms. Default: 32000
|
|
118
|
+
- `backoffTimeReset` - The time before the first retry in ms. Default: 1000
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
## Maintainers
|
|
122
|
+
|
|
123
|
+
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
124
|
+
|
|
125
|
+
## Contribute
|
|
126
|
+
|
|
127
|
+
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
package/babel.config.js
ADDED
package/dist/config.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
10
|
+
*/
|
|
11
|
+
var _default = exports.default = {
|
|
12
|
+
mercury: {
|
|
13
|
+
/**
|
|
14
|
+
* Milliseconds between pings sent up the socket
|
|
15
|
+
* @type {number}
|
|
16
|
+
*/
|
|
17
|
+
pingInterval: process.env.MERCURY_PING_INTERVAL || 15000,
|
|
18
|
+
/**
|
|
19
|
+
* Milliseconds to wait for a pong before declaring the connection dead
|
|
20
|
+
* @type {number}
|
|
21
|
+
*/
|
|
22
|
+
pongTimeout: process.env.MERCURY_PONG_TIMEOUT || 14000,
|
|
23
|
+
/**
|
|
24
|
+
* Maximum milliseconds between connection attempts
|
|
25
|
+
* @type {Number}
|
|
26
|
+
*/
|
|
27
|
+
backoffTimeMax: process.env.MERCURY_BACKOFF_TIME_MAX || 32000,
|
|
28
|
+
/**
|
|
29
|
+
* Initial milliseconds between connection attempts
|
|
30
|
+
* @type {Number}
|
|
31
|
+
*/
|
|
32
|
+
backoffTimeReset: process.env.MERCURY_BACKOFF_TIME_RESET || 1000,
|
|
33
|
+
/**
|
|
34
|
+
* Milliseconds to wait for a close frame before declaring the socket dead and
|
|
35
|
+
* discarding it
|
|
36
|
+
* @type {[type]}
|
|
37
|
+
*/
|
|
38
|
+
forceCloseDelay: process.env.MERCURY_FORCE_CLOSE_DELAY || 2000,
|
|
39
|
+
/**
|
|
40
|
+
* When logging out, use default reason which can trigger a reconnect,
|
|
41
|
+
* or set to something else, like `done (permanent)` to prevent reconnect
|
|
42
|
+
* @type {String}
|
|
43
|
+
*/
|
|
44
|
+
beforeLogoutOptionsCloseReason: process.env.MERCURY_LOGOUT_REASON || 'done (forced)'
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_default","exports","default","mercury","pingInterval","process","env","MERCURY_PING_INTERVAL","pongTimeout","MERCURY_PONG_TIMEOUT","backoffTimeMax","MERCURY_BACKOFF_TIME_MAX","backoffTimeReset","MERCURY_BACKOFF_TIME_RESET","forceCloseDelay","MERCURY_FORCE_CLOSE_DELAY","beforeLogoutOptionsCloseReason","MERCURY_LOGOUT_REASON"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport default {\n mercury: {\n /**\n * Milliseconds between pings sent up the socket\n * @type {number}\n */\n pingInterval: process.env.MERCURY_PING_INTERVAL || 15000,\n /**\n * Milliseconds to wait for a pong before declaring the connection dead\n * @type {number}\n */\n pongTimeout: process.env.MERCURY_PONG_TIMEOUT || 14000,\n /**\n * Maximum milliseconds between connection attempts\n * @type {Number}\n */\n backoffTimeMax: process.env.MERCURY_BACKOFF_TIME_MAX || 32000,\n /**\n * Initial milliseconds between connection attempts\n * @type {Number}\n */\n backoffTimeReset: process.env.MERCURY_BACKOFF_TIME_RESET || 1000,\n /**\n * Milliseconds to wait for a close frame before declaring the socket dead and\n * discarding it\n * @type {[type]}\n */\n forceCloseDelay: process.env.MERCURY_FORCE_CLOSE_DELAY || 2000,\n /**\n * When logging out, use default reason which can trigger a reconnect,\n * or set to something else, like `done (permanent)` to prevent reconnect\n * @type {String}\n */\n beforeLogoutOptionsCloseReason: process.env.MERCURY_LOGOUT_REASON || 'done (forced)',\n },\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAFA,IAAAA,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAIe;EACbC,OAAO,EAAE;IACP;AACJ;AACA;AACA;IACIC,YAAY,EAAEC,OAAO,CAACC,GAAG,CAACC,qBAAqB,IAAI,KAAK;IACxD;AACJ;AACA;AACA;IACIC,WAAW,EAAEH,OAAO,CAACC,GAAG,CAACG,oBAAoB,IAAI,KAAK;IACtD;AACJ;AACA;AACA;IACIC,cAAc,EAAEL,OAAO,CAACC,GAAG,CAACK,wBAAwB,IAAI,KAAK;IAC7D;AACJ;AACA;AACA;IACIC,gBAAgB,EAAEP,OAAO,CAACC,GAAG,CAACO,0BAA0B,IAAI,IAAI;IAChE;AACJ;AACA;AACA;AACA;IACIC,eAAe,EAAET,OAAO,CAACC,GAAG,CAACS,yBAAyB,IAAI,IAAI;IAC9D;AACJ;AACA;AACA;AACA;IACIC,8BAA8B,EAAEX,OAAO,CAACC,GAAG,CAACW,qBAAqB,IAAI;EACvE;AACF,CAAC","ignoreList":[]}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
|
|
4
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.UnknownResponse = exports.NotAuthorized = exports.Forbidden = exports.ConnectionError = exports.BadRequest = void 0;
|
|
10
|
+
var _defineProperties = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-properties"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
13
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
|
|
14
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
17
|
+
var _common = require("@webex/common");
|
|
18
|
+
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)); }
|
|
19
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*!
|
|
20
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Exception thrown when a websocket gets closed
|
|
24
|
+
*/
|
|
25
|
+
var ConnectionError = exports.ConnectionError = /*#__PURE__*/function (_Exception) {
|
|
26
|
+
function ConnectionError() {
|
|
27
|
+
(0, _classCallCheck2.default)(this, ConnectionError);
|
|
28
|
+
return _callSuper(this, ConnectionError, arguments);
|
|
29
|
+
}
|
|
30
|
+
(0, _inherits2.default)(ConnectionError, _Exception);
|
|
31
|
+
return (0, _createClass2.default)(ConnectionError, [{
|
|
32
|
+
key: "parse",
|
|
33
|
+
value:
|
|
34
|
+
/**
|
|
35
|
+
* @param {CloseEvent} event
|
|
36
|
+
* @returns {string}
|
|
37
|
+
*/
|
|
38
|
+
function parse() {
|
|
39
|
+
var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
40
|
+
(0, _defineProperties.default)(this, {
|
|
41
|
+
code: {
|
|
42
|
+
value: event.code
|
|
43
|
+
},
|
|
44
|
+
reason: {
|
|
45
|
+
value: event.reason
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return event.reason;
|
|
49
|
+
}
|
|
50
|
+
}]);
|
|
51
|
+
}(_common.Exception);
|
|
52
|
+
/**
|
|
53
|
+
* thrown for CloseCode 4400
|
|
54
|
+
*/
|
|
55
|
+
(0, _defineProperty2.default)(ConnectionError, "defaultMessage", 'Failed to connect to socket');
|
|
56
|
+
var UnknownResponse = exports.UnknownResponse = /*#__PURE__*/function (_ConnectionError2) {
|
|
57
|
+
function UnknownResponse() {
|
|
58
|
+
(0, _classCallCheck2.default)(this, UnknownResponse);
|
|
59
|
+
return _callSuper(this, UnknownResponse, arguments);
|
|
60
|
+
}
|
|
61
|
+
(0, _inherits2.default)(UnknownResponse, _ConnectionError2);
|
|
62
|
+
return (0, _createClass2.default)(UnknownResponse);
|
|
63
|
+
}(ConnectionError);
|
|
64
|
+
/**
|
|
65
|
+
* thrown for CloseCode 4400
|
|
66
|
+
*/
|
|
67
|
+
(0, _defineProperty2.default)(UnknownResponse, "defaultMessage", 'UnknownResponse is produced by IE when we receive a 4XXX. You probably want to treat this like a NotFound');
|
|
68
|
+
var BadRequest = exports.BadRequest = /*#__PURE__*/function (_ConnectionError3) {
|
|
69
|
+
function BadRequest() {
|
|
70
|
+
(0, _classCallCheck2.default)(this, BadRequest);
|
|
71
|
+
return _callSuper(this, BadRequest, arguments);
|
|
72
|
+
}
|
|
73
|
+
(0, _inherits2.default)(BadRequest, _ConnectionError3);
|
|
74
|
+
return (0, _createClass2.default)(BadRequest);
|
|
75
|
+
}(ConnectionError);
|
|
76
|
+
/**
|
|
77
|
+
* thrown for CloseCode 4401
|
|
78
|
+
*/
|
|
79
|
+
(0, _defineProperty2.default)(BadRequest, "defaultMessage", 'BadRequest usually implies an attempt to use service account credentials');
|
|
80
|
+
var NotAuthorized = exports.NotAuthorized = /*#__PURE__*/function (_ConnectionError4) {
|
|
81
|
+
function NotAuthorized() {
|
|
82
|
+
(0, _classCallCheck2.default)(this, NotAuthorized);
|
|
83
|
+
return _callSuper(this, NotAuthorized, arguments);
|
|
84
|
+
}
|
|
85
|
+
(0, _inherits2.default)(NotAuthorized, _ConnectionError4);
|
|
86
|
+
return (0, _createClass2.default)(NotAuthorized);
|
|
87
|
+
}(ConnectionError);
|
|
88
|
+
/**
|
|
89
|
+
* thrown for CloseCode 4403
|
|
90
|
+
*/
|
|
91
|
+
(0, _defineProperty2.default)(NotAuthorized, "defaultMessage", 'Please refresh your access token');
|
|
92
|
+
var Forbidden = exports.Forbidden = /*#__PURE__*/function (_ConnectionError5) {
|
|
93
|
+
function Forbidden() {
|
|
94
|
+
(0, _classCallCheck2.default)(this, Forbidden);
|
|
95
|
+
return _callSuper(this, Forbidden, arguments);
|
|
96
|
+
}
|
|
97
|
+
(0, _inherits2.default)(Forbidden, _ConnectionError5);
|
|
98
|
+
return (0, _createClass2.default)(Forbidden);
|
|
99
|
+
}(ConnectionError); // /**
|
|
100
|
+
// * thrown for CloseCode 4404
|
|
101
|
+
// */
|
|
102
|
+
// export class NotFound extends ConnectionError {
|
|
103
|
+
// static defaultMessage = `Please refresh your Mercury registration (typically via a WDM refresh)`;
|
|
104
|
+
// }
|
|
105
|
+
(0, _defineProperty2.default)(Forbidden, "defaultMessage", 'Forbidden usually implies these credentials are not entitled for Webex');
|
|
106
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_common","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","ConnectionError","exports","_Exception","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","parse","event","length","undefined","_defineProperties","code","reason","Exception","_defineProperty2","UnknownResponse","_ConnectionError2","BadRequest","_ConnectionError3","NotAuthorized","_ConnectionError4","Forbidden","_ConnectionError5"],"sources":["errors.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Exception} from '@webex/common';\n\n/**\n * Exception thrown when a websocket gets closed\n */\nexport class ConnectionError extends Exception {\n static defaultMessage = 'Failed to connect to socket';\n\n /**\n * @param {CloseEvent} event\n * @returns {string}\n */\n parse(event = {}) {\n Object.defineProperties(this, {\n code: {\n value: event.code,\n },\n reason: {\n value: event.reason,\n },\n });\n\n return event.reason;\n }\n}\n\n/**\n * thrown for CloseCode 4400\n */\nexport class UnknownResponse extends ConnectionError {\n static defaultMessage =\n 'UnknownResponse is produced by IE when we receive a 4XXX. You probably want to treat this like a NotFound';\n}\n\n/**\n * thrown for CloseCode 4400\n */\nexport class BadRequest extends ConnectionError {\n static defaultMessage =\n 'BadRequest usually implies an attempt to use service account credentials';\n}\n\n/**\n * thrown for CloseCode 4401\n */\nexport class NotAuthorized extends ConnectionError {\n static defaultMessage = 'Please refresh your access token';\n}\n\n/**\n * thrown for CloseCode 4403\n */\nexport class Forbidden extends ConnectionError {\n static defaultMessage = 'Forbidden usually implies these credentials are not entitled for Webex';\n}\n\n// /**\n// * thrown for CloseCode 4404\n// */\n// export class NotFound extends ConnectionError {\n// static defaultMessage = `Please refresh your Mercury registration (typically via a WDM refresh)`;\n// }\n"],"mappings":"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","ignoreList":[]}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
_Object$defineProperty(exports, "BadRequest", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _errors.BadRequest;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
_Object$defineProperty(exports, "ConnectionError", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _errors.ConnectionError;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
_Object$defineProperty(exports, "Forbidden", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _errors.Forbidden;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
_Object$defineProperty(exports, "Mercury", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function get() {
|
|
29
|
+
return _mercury.default;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
_Object$defineProperty(exports, "NotAuthorized", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _errors.NotAuthorized;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
_Object$defineProperty(exports, "Socket", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _socket.default;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
_Object$defineProperty(exports, "UnknownResponse", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function get() {
|
|
47
|
+
return _errors.UnknownResponse;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
_Object$defineProperty(exports, "config", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function get() {
|
|
53
|
+
return _config.default;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
_Object$defineProperty(exports, "default", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function get() {
|
|
59
|
+
return _mercury.default;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
require("@webex/internal-plugin-device");
|
|
63
|
+
require("@webex/internal-plugin-feature");
|
|
64
|
+
require("@webex/internal-plugin-metrics");
|
|
65
|
+
var _webexCore = require("@webex/webex-core");
|
|
66
|
+
var _mercury = _interopRequireDefault(require("./mercury"));
|
|
67
|
+
var _config = _interopRequireDefault(require("./config"));
|
|
68
|
+
var _socket = _interopRequireDefault(require("./socket"));
|
|
69
|
+
var _errors = require("./errors");
|
|
70
|
+
/*!
|
|
71
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
(0, _webexCore.registerInternalPlugin)('mercury', _mercury.default, {
|
|
75
|
+
config: _config.default,
|
|
76
|
+
onBeforeLogout: function onBeforeLogout() {
|
|
77
|
+
return this.logout();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["require","_webexCore","_mercury","_interopRequireDefault","_config","_socket","_errors","registerInternalPlugin","Mercury","config","onBeforeLogout","logout"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-device';\nimport '@webex/internal-plugin-feature';\nimport '@webex/internal-plugin-metrics';\n\nimport {registerInternalPlugin} from '@webex/webex-core';\n\nimport Mercury from './mercury';\nimport config from './config';\n\nregisterInternalPlugin('mercury', Mercury, {\n config,\n onBeforeLogout() {\n return this.logout();\n },\n});\n\nexport {default} from './mercury';\nexport {default as Mercury} from './mercury';\nexport {default as Socket} from './socket';\nexport {default as config} from './config';\nexport {\n BadRequest,\n ConnectionError,\n Forbidden,\n NotAuthorized,\n UnknownResponse,\n // NotFound\n} from './errors';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAD,sBAAA,CAAAH,OAAA;AAWA,IAAAK,OAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,OAAA,GAAAN,OAAA;AAxBA;AACA;AACA;;AAWA,IAAAO,iCAAsB,EAAC,SAAS,EAAEC,gBAAO,EAAE;EACzCC,MAAM,EAANA,eAAM;EACNC,cAAc,WAAdA,cAAcA,CAAA,EAAG;IACf,OAAO,IAAI,CAACC,MAAM,CAAC,CAAC;EACtB;AACF,CAAC,CAAC","ignoreList":[]}
|