@webex/calling 3.12.0-mobius-socket.18 → 3.12.0-mobius-socket.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/CallingClient/utils/request.js +6 -3
  2. package/dist/CallingClient/utils/request.js.map +1 -1
  3. package/dist/CallingClient/utils/request.test.js +2 -2
  4. package/dist/CallingClient/utils/request.test.js.map +1 -1
  5. package/dist/CallingClient/utils/types.js.map +1 -1
  6. package/dist/mobius-socket/config.js +7 -44
  7. package/dist/mobius-socket/config.js.map +1 -1
  8. package/dist/mobius-socket/errors.js +71 -26
  9. package/dist/mobius-socket/errors.js.map +1 -1
  10. package/dist/mobius-socket/index.js +4 -54
  11. package/dist/mobius-socket/index.js.map +1 -1
  12. package/dist/mobius-socket/mobius-socket-events.test.js +20 -48
  13. package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -1
  14. package/dist/mobius-socket/mobius-socket.js +359 -748
  15. package/dist/mobius-socket/mobius-socket.js.map +1 -1
  16. package/dist/mobius-socket/mobius-socket.test.js +452 -728
  17. package/dist/mobius-socket/mobius-socket.test.js.map +1 -1
  18. package/dist/mobius-socket/socket/constants.js +14 -0
  19. package/dist/mobius-socket/socket/constants.js.map +1 -1
  20. package/dist/mobius-socket/socket/socket-base.js +152 -205
  21. package/dist/mobius-socket/socket/socket-base.js.map +1 -1
  22. package/dist/mobius-socket/socket/types.js.map +1 -1
  23. package/dist/mobius-socket/socket.test.js +38 -63
  24. package/dist/mobius-socket/socket.test.js.map +1 -1
  25. package/dist/mobius-socket/types.js.map +1 -1
  26. package/dist/module/CallingClient/utils/request.js +3 -2
  27. package/dist/module/mobius-socket/config.js +7 -10
  28. package/dist/module/mobius-socket/errors.js +34 -0
  29. package/dist/module/mobius-socket/index.js +0 -3
  30. package/dist/module/mobius-socket/mobius-socket.js +237 -426
  31. package/dist/module/mobius-socket/socket/socket-base.js +79 -116
  32. package/dist/types/CallingClient/utils/request.d.ts.map +1 -1
  33. package/dist/types/CallingClient/utils/types.d.ts +1 -1
  34. package/dist/types/CallingClient/utils/types.d.ts.map +1 -1
  35. package/dist/types/mobius-socket/config.d.ts +7 -8
  36. package/dist/types/mobius-socket/config.d.ts.map +1 -1
  37. package/dist/types/mobius-socket/errors.d.ts +11 -1
  38. package/dist/types/mobius-socket/errors.d.ts.map +1 -1
  39. package/dist/types/mobius-socket/index.d.ts +1 -5
  40. package/dist/types/mobius-socket/index.d.ts.map +1 -1
  41. package/dist/types/mobius-socket/mobius-socket.d.ts +33 -35
  42. package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -1
  43. package/dist/types/mobius-socket/socket/constants.d.ts.map +1 -1
  44. package/dist/types/mobius-socket/socket/socket-base.d.ts +9 -10
  45. package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -1
  46. package/dist/types/mobius-socket/socket/types.d.ts +0 -8
  47. package/dist/types/mobius-socket/socket/types.d.ts.map +1 -1
  48. package/dist/types/mobius-socket/types.d.ts.map +1 -1
  49. package/package.json +1 -1
@@ -7,6 +7,8 @@ _Object$defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.UnknownResponse = exports.NotAuthorized = exports.Forbidden = exports.ConnectionError = exports.BadRequest = void 0;
10
+ exports.createTimeoutError = createTimeoutError;
11
+ exports.createWssResponseError = createWssResponseError;
10
12
  var _defineProperties = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-properties"));
11
13
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
12
14
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
@@ -20,21 +22,28 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
20
22
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
21
23
  */ // @ts-expect-error `@webex/common` is still JS-only and does not ship declarations.
22
24
  /**
23
- * Exception thrown when a websocket gets closed
25
+ * Exception thrown when a websocket gets closed.
24
26
  */
25
27
  var ConnectionError = exports.ConnectionError = /*#__PURE__*/function (_Exception) {
26
- function ConnectionError() {
28
+ // eslint-disable-next-line no-useless-constructor
29
+ function ConnectionError(event) {
30
+ var _this;
27
31
  (0, _classCallCheck2.default)(this, ConnectionError);
28
- return _callSuper(this, ConnectionError, arguments);
32
+ _this = _callSuper(this, ConnectionError, [event]);
33
+ (0, _defineProperty2.default)(_this, "code", void 0);
34
+ (0, _defineProperty2.default)(_this, "reason", void 0);
35
+ return _this;
29
36
  }
37
+
38
+ /**
39
+ * Parses a close event and sets the code and reason properties.
40
+ * @param event - Socket close event to parse
41
+ * @returns The reason string from the event
42
+ */
30
43
  (0, _inherits2.default)(ConnectionError, _Exception);
31
44
  return (0, _createClass2.default)(ConnectionError, [{
32
45
  key: "parse",
33
- value:
34
- /**
35
- * @param event
36
- */
37
- function parse() {
46
+ value: function parse() {
38
47
  var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
39
48
  (0, _defineProperties.default)(this, {
40
49
  code: {
@@ -49,57 +58,93 @@ var ConnectionError = exports.ConnectionError = /*#__PURE__*/function (_Exceptio
49
58
  }]);
50
59
  }(_common.Exception);
51
60
  /**
52
- * thrown for CloseCode 4400
61
+ * Thrown for CloseCode 1005.
62
+ * UnknownResponse is produced by IE when we receive a 4XXX close code.
63
+ * This should typically be treated like a NotFound error.
53
64
  */
54
65
  (0, _defineProperty2.default)(ConnectionError, "defaultMessage", 'Failed to connect to socket');
55
66
  var UnknownResponse = exports.UnknownResponse = /*#__PURE__*/function (_ConnectionError2) {
56
- function UnknownResponse() {
67
+ // eslint-disable-next-line no-useless-constructor
68
+ function UnknownResponse(event) {
57
69
  (0, _classCallCheck2.default)(this, UnknownResponse);
58
- return _callSuper(this, UnknownResponse, arguments);
70
+ return _callSuper(this, UnknownResponse, [event]);
59
71
  }
60
72
  (0, _inherits2.default)(UnknownResponse, _ConnectionError2);
61
73
  return (0, _createClass2.default)(UnknownResponse);
62
74
  }(ConnectionError);
63
75
  /**
64
- * thrown for CloseCode 4400
76
+ * Thrown for CloseCode 4400.
77
+ * BadRequest usually implies an attempt to use service account credentials.
65
78
  */
66
79
  (0, _defineProperty2.default)(UnknownResponse, "defaultMessage", 'UnknownResponse is produced by IE when we receive a 4XXX. You probably want to treat this like a NotFound');
67
80
  var BadRequest = exports.BadRequest = /*#__PURE__*/function (_ConnectionError3) {
68
- function BadRequest() {
81
+ // eslint-disable-next-line no-useless-constructor
82
+ function BadRequest(event) {
69
83
  (0, _classCallCheck2.default)(this, BadRequest);
70
- return _callSuper(this, BadRequest, arguments);
84
+ return _callSuper(this, BadRequest, [event]);
71
85
  }
72
86
  (0, _inherits2.default)(BadRequest, _ConnectionError3);
73
87
  return (0, _createClass2.default)(BadRequest);
74
88
  }(ConnectionError);
75
89
  /**
76
- * thrown for CloseCode 4401
90
+ * Thrown for CloseCode 4401.
91
+ * Indicates an authorization failure requiring a token refresh.
77
92
  */
78
93
  (0, _defineProperty2.default)(BadRequest, "defaultMessage", 'BadRequest usually implies an attempt to use service account credentials');
79
94
  var NotAuthorized = exports.NotAuthorized = /*#__PURE__*/function (_ConnectionError4) {
80
- function NotAuthorized() {
95
+ // eslint-disable-next-line no-useless-constructor
96
+ function NotAuthorized(event) {
81
97
  (0, _classCallCheck2.default)(this, NotAuthorized);
82
- return _callSuper(this, NotAuthorized, arguments);
98
+ return _callSuper(this, NotAuthorized, [event]);
83
99
  }
84
100
  (0, _inherits2.default)(NotAuthorized, _ConnectionError4);
85
101
  return (0, _createClass2.default)(NotAuthorized);
86
102
  }(ConnectionError);
87
103
  /**
88
- * thrown for CloseCode 4403
104
+ * Thrown for CloseCode 4403.
105
+ * Forbidden usually implies the credentials are not entitled for Webex.
89
106
  */
90
107
  (0, _defineProperty2.default)(NotAuthorized, "defaultMessage", 'Please refresh your access token');
91
108
  var Forbidden = exports.Forbidden = /*#__PURE__*/function (_ConnectionError5) {
92
- function Forbidden() {
109
+ // eslint-disable-next-line no-useless-constructor
110
+ function Forbidden(event) {
93
111
  (0, _classCallCheck2.default)(this, Forbidden);
94
- return _callSuper(this, Forbidden, arguments);
112
+ return _callSuper(this, Forbidden, [event]);
95
113
  }
96
114
  (0, _inherits2.default)(Forbidden, _ConnectionError5);
97
115
  return (0, _createClass2.default)(Forbidden);
98
- }(ConnectionError); // /**
99
- // * thrown for CloseCode 4404
100
- // */
101
- // export class NotFound extends ConnectionError {
102
- // static defaultMessage = `Please refresh your Mercury registration (typically via a WDM refresh)`;
103
- // }
116
+ }(ConnectionError);
117
+ /**
118
+ * Creates a MobiusSocketResponseError from a socket response.
119
+ *
120
+ * @param response - The socket response that triggered the error
121
+ * @param statusCode - HTTP-style status code for the error
122
+ * @param statusMessage - Human-readable status message
123
+ * @returns A formatted error object with response details
124
+ */
104
125
  (0, _defineProperty2.default)(Forbidden, "defaultMessage", 'Forbidden usually implies these credentials are not entitled for Webex');
126
+ function createWssResponseError(response, statusCode, statusMessage) {
127
+ var error = new Error(statusMessage || "Mobius websocket request failed with status ".concat(statusCode || 'unknown'));
128
+ error.name = 'MobiusSocketResponseError';
129
+ error.statusCode = statusCode;
130
+ error.statusMessage = statusMessage;
131
+ error.response = response;
132
+ error.trackingId = response === null || response === void 0 ? void 0 : response.trackingId;
133
+ return error;
134
+ }
135
+
136
+ /**
137
+ * Creates a timeout error for a socket request that didn't receive a response.
138
+ *
139
+ * @param request - The socket request that timed out
140
+ * @returns A timeout error with status code 408
141
+ */
142
+ function createTimeoutError(request) {
143
+ var errorPayload = {
144
+ type: 'response_event',
145
+ subtype: request.type,
146
+ trackingId: request.trackingId
147
+ };
148
+ return createWssResponseError(errorPayload, 408, 'Mobius websocket response timed out');
149
+ }
105
150
  //# sourceMappingURL=errors.js.map
@@ -1 +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.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n// @ts-expect-error `@webex/common` is still JS-only and does not ship declarations.\nimport {Exception} from '@webex/common';\nimport type {SocketCloseEvent} from './socket/types';\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 event\n */\n parse(event: SocketCloseEvent = {}) {\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":";;;;;;;;;;;;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AAAwC,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CA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iBAAA;EAAA,SAAAD,UAAA;IAAA,IAAArB,gBAAA,CAAAb,OAAA,QAAAkC,SAAA;IAAA,OAAAvC,UAAA,OAAAuC,SAAA,EAAApB,SAAA;EAAA;EAAA,IAAAC,UAAA,CAAAf,OAAA,EAAAkC,SAAA,EAAAC,iBAAA;EAAA,WAAAnB,aAAA,CAAAhB,OAAA,EAAAkC,SAAA;AAAA,EAASxB,eAAe,GAI9C;AACA;AACA;AACA;AACA;AACA;AAAA,IAAAiB,gBAAA,CAAA3B,OAAA,EATakC,SAAS,oBACI,wEAAwE","ignoreList":[]}
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","event","_this","_classCallCheck2","_defineProperty2","_inherits2","_createClass2","key","value","parse","arguments","length","undefined","_defineProperties","code","reason","Exception","UnknownResponse","_ConnectionError2","BadRequest","_ConnectionError3","NotAuthorized","_ConnectionError4","Forbidden","_ConnectionError5","createWssResponseError","response","statusCode","statusMessage","error","Error","concat","name","trackingId","createTimeoutError","request","errorPayload","type","subtype"],"sources":["errors.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n// @ts-expect-error `@webex/common` is still JS-only and does not ship declarations.\nimport {Exception} from '@webex/common';\nimport type {SocketCloseEvent, SocketResponse} from './socket/types';\nimport {MobiusSocketResponseError} from './types';\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 code?: number;\n\n reason?: string;\n\n // eslint-disable-next-line no-useless-constructor\n constructor(event?: SocketCloseEvent) {\n super(event);\n }\n\n /**\n * Parses a close event and sets the code and reason properties.\n * @param event - Socket close event to parse\n * @returns The reason string from the event\n */\n parse(event: SocketCloseEvent = {}) {\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 1005.\n * UnknownResponse is produced by IE when we receive a 4XXX close code.\n * This should typically be treated like a NotFound error.\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 // eslint-disable-next-line no-useless-constructor\n constructor(event?: SocketCloseEvent) {\n super(event);\n }\n}\n\n/**\n * Thrown for CloseCode 4400.\n * BadRequest usually implies an attempt to use service account credentials.\n */\nexport class BadRequest extends ConnectionError {\n static defaultMessage =\n 'BadRequest usually implies an attempt to use service account credentials';\n\n // eslint-disable-next-line no-useless-constructor\n constructor(event?: SocketCloseEvent) {\n super(event);\n }\n}\n\n/**\n * Thrown for CloseCode 4401.\n * Indicates an authorization failure requiring a token refresh.\n */\nexport class NotAuthorized extends ConnectionError {\n static defaultMessage = 'Please refresh your access token';\n\n // eslint-disable-next-line no-useless-constructor\n constructor(event?: SocketCloseEvent) {\n super(event);\n }\n}\n\n/**\n * Thrown for CloseCode 4403.\n * Forbidden usually implies the credentials are not entitled for Webex.\n */\nexport class Forbidden extends ConnectionError {\n static defaultMessage = 'Forbidden usually implies these credentials are not entitled for Webex';\n\n // eslint-disable-next-line no-useless-constructor\n constructor(event?: SocketCloseEvent) {\n super(event);\n }\n}\n\n/**\n * Creates a MobiusSocketResponseError from a socket response.\n *\n * @param response - The socket response that triggered the error\n * @param statusCode - HTTP-style status code for the error\n * @param statusMessage - Human-readable status message\n * @returns A formatted error object with response details\n */\nexport function createWssResponseError(\n response: SocketResponse,\n statusCode?: number,\n statusMessage?: string\n): MobiusSocketResponseError {\n const error = new Error(\n statusMessage || `Mobius websocket request failed with status ${statusCode || 'unknown'}`\n ) as MobiusSocketResponseError;\n\n error.name = 'MobiusSocketResponseError';\n error.statusCode = statusCode;\n error.statusMessage = statusMessage;\n error.response = response;\n error.trackingId = response?.trackingId;\n\n return error;\n}\n\n/**\n * Creates a timeout error for a socket request that didn't receive a response.\n *\n * @param request - The socket request that timed out\n * @returns A timeout error with status code 408\n */\nexport function createTimeoutError(request: SocketResponse): MobiusSocketResponseError {\n const errorPayload = {\n type: 'response_event',\n subtype: request.type,\n trackingId: request.trackingId,\n };\n\n return createWssResponseError(errorPayload, 408, 'Mobius websocket response timed out');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AAAwC,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,kBAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAU,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAN,kBAAA,CAAAG,OAAA,iCAAAV,CAAA,aAAAM,yBAAA,YAAAA,0BAAA,aAAAN,CAAA,UALxC;AACA;AACA,GAFA,CAIA;AAKA;AACA;AACA;AAFA,IAGac,eAAe,GAAAC,OAAA,CAAAD,eAAA,0BAAAE,UAAA;EAO1B;EACA,SAAAF,gBAAYG,KAAwB,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAf,OAAA,QAAAU,eAAA;IACpCI,KAAA,GAAAnB,UAAA,OAAAe,eAAA,GAAMG,KAAK;IAAE,IAAAG,gBAAA,CAAAhB,OAAA,EAAAc,KAAA;IAAA,IAAAE,gBAAA,CAAAhB,OAAA,EAAAc,KAAA;IAAA,OAAAA,KAAA;EACf;;EAEA;AACF;AACA;AACA;AACA;EAJE,IAAAG,UAAA,CAAAjB,OAAA,EAAAU,eAAA,EAA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AS,CACzF,CAA8B;EAE9BE,KAAK,CAACG,IAAI,GAAG,2BAA2B;EACxCH,KAAK,CAACF,UAAU,GAAGA,UAAU;EAC7BE,KAAK,CAACD,aAAa,GAAGA,aAAa;EACnCC,KAAK,CAACH,QAAQ,GAAGA,QAAQ;EACzBG,KAAK,CAACI,UAAU,GAAGP,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEO,UAAU;EAEvC,OAAOJ,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,kBAAkBA,CAACC,OAAuB,EAA6B;EACrF,IAAMC,YAAY,GAAG;IACnBC,IAAI,EAAE,gBAAgB;IACtBC,OAAO,EAAEH,OAAO,CAACE,IAAI;IACrBJ,UAAU,EAAEE,OAAO,CAACF;EACtB,CAAC;EAED,OAAOR,sBAAsB,CAACW,YAAY,EAAE,GAAG,EAAE,qCAAqC,CAAC;AACzF","ignoreList":[]}
@@ -10,54 +10,12 @@ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequ
10
10
  _Object$defineProperty(exports, "__esModule", {
11
11
  value: true
12
12
  });
13
- _Object$defineProperty(exports, "BadRequest", {
14
- enumerable: true,
15
- get: function get() {
16
- return _errors.BadRequest;
17
- }
18
- });
19
- _Object$defineProperty(exports, "ConnectionError", {
20
- enumerable: true,
21
- get: function get() {
22
- return _errors.ConnectionError;
23
- }
24
- });
25
- _Object$defineProperty(exports, "Forbidden", {
26
- enumerable: true,
27
- get: function get() {
28
- return _errors.Forbidden;
29
- }
30
- });
31
13
  _Object$defineProperty(exports, "MobiusSocket", {
32
14
  enumerable: true,
33
15
  get: function get() {
34
16
  return _mobiusSocket.default;
35
17
  }
36
18
  });
37
- _Object$defineProperty(exports, "NotAuthorized", {
38
- enumerable: true,
39
- get: function get() {
40
- return _errors.NotAuthorized;
41
- }
42
- });
43
- _Object$defineProperty(exports, "Socket", {
44
- enumerable: true,
45
- get: function get() {
46
- return _socket.default;
47
- }
48
- });
49
- _Object$defineProperty(exports, "UnknownResponse", {
50
- enumerable: true,
51
- get: function get() {
52
- return _errors.UnknownResponse;
53
- }
54
- });
55
- _Object$defineProperty(exports, "config", {
56
- enumerable: true,
57
- get: function get() {
58
- return _config.default;
59
- }
60
- });
61
19
  exports.default = void 0;
62
20
  exports.getMobiusSocketInstance = getMobiusSocketInstance;
63
21
  exports.resetMobiusSocketInstance = resetMobiusSocketInstance;
@@ -67,25 +25,18 @@ require("@webex/internal-plugin-feature");
67
25
  require("@webex/internal-plugin-metrics");
68
26
  var _mobiusSocket = _interopRequireDefault(require("./mobius-socket"));
69
27
  var _config = _interopRequireDefault(require("./config"));
70
- var _socket = _interopRequireDefault(require("./socket"));
71
- var _errors = require("./errors");
72
28
  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; }
73
29
  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; } /*!
74
30
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
75
31
  */
76
- /**
77
- * Creates a calling-owned Mobius socket client for the provided Webex instance.
78
- *
79
- * @param webex
80
- * @param [mobiusSocketConfig]
81
- * @returns
82
- */
83
- var mobiusSocketInstance; // Keeping just one instance of MobiusSocket since there won't be multiple connections
32
+ // Singleton instance - keeping just one instance of MobiusSocket since there won't be multiple connections
33
+ var mobiusSocketInstance;
84
34
 
85
35
  /**
86
36
  * Creates or returns the singleton Mobius socket client for the provided Webex instance.
37
+ *
87
38
  * @param webex - The Webex SDK instance
88
- * @param [mobiusSocketConfig] - Optional configuration overrides
39
+ * @param mobiusSocketConfig - Optional configuration overrides
89
40
  * @returns The singleton MobiusSocket instance
90
41
  */
91
42
  function getMobiusSocketInstance(webex, mobiusSocketConfig) {
@@ -98,7 +49,6 @@ function getMobiusSocketInstance(webex, mobiusSocketConfig) {
98
49
 
99
50
  /**
100
51
  * Resets the singleton MobiusSocket instance, allowing a new one to be created.
101
- * @returns
102
52
  */
103
53
  function resetMobiusSocketInstance() {
104
54
  mobiusSocketInstance = undefined;
@@ -1 +1 @@
1
- {"version":3,"names":["require","_mobiusSocket","_interopRequireDefault","_config","_socket","_errors","ownKeys","e","r","t","_Object$keys","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","mobiusSocketInstance","getMobiusSocketInstance","webex","mobiusSocketConfig","MobiusSocket","config","mobiusSocket","resetMobiusSocketInstance","undefined","_default","exports"],"sources":["index.ts"],"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 type {WebexSDK} from '../SDKConnector/types';\nimport MobiusSocket from './mobius-socket';\nimport config, {MobiusSocketConfig} from './config';\n\n/**\n * Creates a calling-owned Mobius socket client for the provided Webex instance.\n *\n * @param webex\n * @param [mobiusSocketConfig]\n * @returns\n */\nlet mobiusSocketInstance: MobiusSocket | undefined; // Keeping just one instance of MobiusSocket since there won't be multiple connections\n\n/**\n * Creates or returns the singleton Mobius socket client for the provided Webex instance.\n * @param webex - The Webex SDK instance\n * @param [mobiusSocketConfig] - Optional configuration overrides\n * @returns The singleton MobiusSocket instance\n */\nexport function getMobiusSocketInstance(\n webex: WebexSDK,\n mobiusSocketConfig?: Partial<MobiusSocketConfig>\n): MobiusSocket {\n if (mobiusSocketInstance) {\n return mobiusSocketInstance;\n }\n\n mobiusSocketInstance = new MobiusSocket(webex, {\n ...config.mobiusSocket,\n ...mobiusSocketConfig,\n });\n\n return mobiusSocketInstance;\n}\n\n/**\n * Resets the singleton MobiusSocket instance, allowing a new one to be created.\n * @returns\n */\nexport function resetMobiusSocketInstance() {\n mobiusSocketInstance = undefined;\n}\n\nexport default MobiusSocket;\nexport {MobiusSocket};\nexport {default as Socket} from './socket';\nexport {config};\nexport {BadRequest, ConnectionError, Forbidden, NotAuthorized, UnknownResponse} from './errors';\nexport type {\n MobiusSocketCloseOptions,\n MobiusSocketRequestOptions,\n MobiusSocketRequestPayload,\n MobiusSocketResponseError,\n} from './types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAGA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AA2CA,IAAAI,OAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AAAgG,SAAAM,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAH,CAAA,OAAAI,6BAAA,QAAAC,CAAA,GAAAD,6BAAA,CAAAJ,CAAA,GAAAC,CAAA,KAAAI,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAL,CAAA,WAAAM,gCAAA,CAAAP,CAAA,EAAAC,CAAA,EAAAO,UAAA,OAAAN,CAAA,CAAAO,IAAA,CAAAC,KAAA,CAAAR,CAAA,EAAAG,CAAA,YAAAH,CAAA;AAAA,SAAAS,cAAAX,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAW,SAAA,CAAAC,MAAA,EAAAZ,CAAA,UAAAC,CAAA,WAAAU,SAAA,CAAAX,CAAA,IAAAW,SAAA,CAAAX,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAe,MAAA,CAAAZ,CAAA,OAAAa,OAAA,WAAAd,CAAA,QAAAe,gBAAA,CAAAC,OAAA,EAAAjB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAiB,iCAAA,GAAAC,wBAAA,CAAAnB,CAAA,EAAAkB,iCAAA,CAAAhB,CAAA,KAAAH,OAAA,CAAAe,MAAA,CAAAZ,CAAA,GAAAa,OAAA,WAAAd,CAAA,IAAAmB,sBAAA,CAAApB,CAAA,EAAAC,CAAA,EAAAM,gCAAA,CAAAL,CAAA,EAAAD,CAAA,iBAAAD,CAAA,IAvDhG;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIqB,oBAA8C,CAAC,CAAC;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CACrCC,KAAe,EACfC,kBAAgD,EAClC;EACd,IAAIH,oBAAoB,EAAE;IACxB,OAAOA,oBAAoB;EAC7B;EAEAA,oBAAoB,GAAG,IAAII,qBAAY,CAACF,KAAK,EAAAZ,aAAA,CAAAA,aAAA,KACxCe,eAAM,CAACC,YAAY,GACnBH,kBAAkB,CACtB,CAAC;EAEF,OAAOH,oBAAoB;AAC7B;;AAEA;AACA;AACA;AACA;AACO,SAASO,yBAAyBA,CAAA,EAAG;EAC1CP,oBAAoB,GAAGQ,SAAS;AAClC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAd,OAAA,GAEcQ,qBAAY","ignoreList":[]}
1
+ {"version":3,"names":["require","_mobiusSocket","_interopRequireDefault","_config","ownKeys","e","r","t","_Object$keys","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","mobiusSocketInstance","getMobiusSocketInstance","webex","mobiusSocketConfig","MobiusSocket","config","mobiusSocket","resetMobiusSocketInstance","undefined","_default","exports"],"sources":["index.ts"],"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 type {WebexSDK} from '../SDKConnector/types';\nimport MobiusSocket from './mobius-socket';\nimport config, {MobiusSocketConfig} from './config';\n\n// Singleton instance - keeping just one instance of MobiusSocket since there won't be multiple connections\nlet mobiusSocketInstance: MobiusSocket | undefined;\n\n/**\n * Creates or returns the singleton Mobius socket client for the provided Webex instance.\n *\n * @param webex - The Webex SDK instance\n * @param mobiusSocketConfig - Optional configuration overrides\n * @returns The singleton MobiusSocket instance\n */\nexport function getMobiusSocketInstance(\n webex: WebexSDK,\n mobiusSocketConfig?: Partial<MobiusSocketConfig>\n): MobiusSocket {\n if (mobiusSocketInstance) {\n return mobiusSocketInstance;\n }\n\n mobiusSocketInstance = new MobiusSocket(webex, {\n ...config.mobiusSocket,\n ...mobiusSocketConfig,\n });\n\n return mobiusSocketInstance;\n}\n\n/**\n * Resets the singleton MobiusSocket instance, allowing a new one to be created.\n */\nexport function resetMobiusSocketInstance() {\n mobiusSocketInstance = undefined;\n}\n\nexport default MobiusSocket;\nexport {MobiusSocket};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAGA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAoD,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAH,CAAA,OAAAI,6BAAA,QAAAC,CAAA,GAAAD,6BAAA,CAAAJ,CAAA,GAAAC,CAAA,KAAAI,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAL,CAAA,WAAAM,gCAAA,CAAAP,CAAA,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runtime-corejs2/helpers/typeof");
4
3
  var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
5
4
  var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
6
5
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
7
6
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
8
7
  var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
9
8
  var _Object$defineProperty2 = require("@babel/runtime-corejs2/core-js/object/define-property");
10
- var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
11
9
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
12
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
13
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));
@@ -24,10 +22,11 @@ var _sinon = _interopRequireDefault(require("sinon"));
24
22
  var _testHelperChai = require("@webex/test-helper-chai");
25
23
  var _testHelperMockWebex = _interopRequireDefault(require("@webex/test-helper-mock-webex"));
26
24
  var _testHelperMockWebSocket = _interopRequireDefault(require("@webex/test-helper-mock-web-socket"));
27
- var _index = _interopRequireWildcard(require("./index"));
25
+ var _index = _interopRequireDefault(require("./index"));
26
+ var _config = _interopRequireDefault(require("./config"));
27
+ var _socket = _interopRequireDefault(require("./socket"));
28
28
  var _constants = require("./socket/constants");
29
29
  var _promiseTick = _interopRequireDefault(require("./test/promise-tick"));
30
- function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = _Object$defineProperty2) && _Object$getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
31
30
  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; }
32
31
  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, _defineProperty3.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty2(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /*!
33
32
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
@@ -68,8 +67,7 @@ describe('plugin-mobiusSocket', function () {
68
67
  conversationId: createUuid()
69
68
  },
70
69
  timestamp: (0, _now.default)(),
71
- trackingId: "suffix_".concat(createUuid(), "_").concat((0, _now.default)()),
72
- sessionId: 'mobius-websocket-session'
70
+ trackingId: "suffix_".concat(createUuid(), "_").concat((0, _now.default)())
73
71
  };
74
72
  var emitAuthResponse = function emitAuthResponse() {
75
73
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
@@ -105,17 +103,12 @@ describe('plugin-mobiusSocket', function () {
105
103
  usingFakeTimers = false;
106
104
  }
107
105
  if (!mobiusSocket) {
108
- _context.next = 5;
106
+ _context.next = 4;
109
107
  break;
110
108
  }
111
- if (mobiusSocket._connectPromises) {
112
- mobiusSocket._connectPromises.forEach(function (promise) {
113
- promise.catch(function () {});
114
- });
115
- }
116
109
  _context.prev = 1;
117
110
  _context.next = 2;
118
- return mobiusSocket.disconnectAll();
111
+ return mobiusSocket.disconnect();
119
112
  case 2:
120
113
  _context.next = 4;
121
114
  break;
@@ -123,10 +116,6 @@ describe('plugin-mobiusSocket', function () {
123
116
  _context.prev = 3;
124
117
  _t = _context["catch"](1);
125
118
  case 4:
126
- if (mobiusSocket._connectPromises) {
127
- mobiusSocket._connectPromises.clear();
128
- }
129
- case 5:
130
119
  if (mockWebSocket && typeof mockWebSocket.close === 'function') {
131
120
  try {
132
121
  mockWebSocket.close();
@@ -135,13 +124,13 @@ describe('plugin-mobiusSocket', function () {
135
124
  }
136
125
  }
137
126
  // Restore stubs
138
- if (_index.Socket.getWebSocketConstructor.restore) {
139
- _index.Socket.getWebSocketConstructor.restore();
127
+ if (_socket.default.getWebSocketConstructor.restore) {
128
+ _socket.default.getWebSocketConstructor.restore();
140
129
  }
141
130
  if (socketOpenStub && socketOpenStub.restore) {
142
131
  socketOpenStub.restore();
143
132
  }
144
- case 6:
133
+ case 5:
145
134
  case "end":
146
135
  return _context.stop();
147
136
  }
@@ -153,7 +142,7 @@ describe('plugin-mobiusSocket', function () {
153
142
  webex.internal.metrics.submitClientMetrics = _sinon.default.stub();
154
143
  webex.trackingId = 'fakeTrackingId';
155
144
  webex.logger = console;
156
- _sinon.default.stub(_index.Socket, 'getWebSocketConstructor').callsFake(function () {
145
+ _sinon.default.stub(_socket.default, 'getWebSocketConstructor').callsFake(function () {
157
146
  return function () {
158
147
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
159
148
  args[_key] = arguments[_key];
@@ -163,8 +152,8 @@ describe('plugin-mobiusSocket', function () {
163
152
  return mockWebSocket;
164
153
  };
165
154
  });
166
- var origOpen = _index.Socket.prototype.open;
167
- socketOpenStub = _sinon.default.stub(_index.Socket.prototype, 'open').callsFake(function () {
155
+ var origOpen = _socket.default.prototype.open;
156
+ socketOpenStub = _sinon.default.stub(_socket.default.prototype, 'open').callsFake(function () {
168
157
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
169
158
  args[_key2] = arguments[_key2];
170
159
  }
@@ -178,8 +167,7 @@ describe('plugin-mobiusSocket', function () {
178
167
  });
179
168
  return promise;
180
169
  });
181
- mobiusSocket = new _index.default(webex, _objectSpread({}, _index.config.mobiusSocket));
182
- mobiusSocket.defaultSessionId = 'mobius-websocket-session';
170
+ mobiusSocket = new _index.default(webex, _objectSpread({}, _config.default.mobiusSocket));
183
171
  });
184
172
  it('removes all listeners for an event when off() is called without a listener', function () {
185
173
  var firstListener = _sinon.default.stub();
@@ -195,8 +183,8 @@ describe('plugin-mobiusSocket', function () {
195
183
  if (socketOpenStub) {
196
184
  socketOpenStub.restore();
197
185
  }
198
- if (_index.Socket.getWebSocketConstructor.restore) {
199
- _index.Socket.getWebSocketConstructor.restore();
186
+ if (_socket.default.getWebSocketConstructor.restore) {
187
+ _socket.default.getWebSocketConstructor.restore();
200
188
  }
201
189
  });
202
190
  describe('when connected', function () {
@@ -258,7 +246,7 @@ describe('plugin-mobiusSocket', function () {
258
246
  var onlineSpy = _sinon.default.spy();
259
247
  mobiusSocket.on('event:mercury.buffer_state', bufferStateSpy);
260
248
  mobiusSocket.on('online', onlineSpy);
261
- _index.Socket.getWebSocketConstructor.callsFake(function () {
249
+ _socket.default.getWebSocketConstructor.callsFake(function () {
262
250
  return function () {
263
251
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
264
252
  args[_key3] = arguments[_key3];
@@ -294,7 +282,7 @@ describe('plugin-mobiusSocket', function () {
294
282
  // string assertion
295
283
  _testHelperChai.assert.lengthOf(sendSpy.args, 0, 'The client has not acked the buffer_state message');
296
284
  (0, _promiseTick.default)(1).then(function () {
297
- _testHelperChai.assert.calledOnce(bufferStateSpy);
285
+ _testHelperChai.assert.called(bufferStateSpy);
298
286
  resolveTest();
299
287
  }).catch(rejectTest);
300
288
  });
@@ -363,8 +351,8 @@ describe('plugin-mobiusSocket', function () {
363
351
  }
364
352
  describe("when an event ".concat(description, " is received"), function () {
365
353
  it("takes the ".concat(action, " action"), function () {
366
- if (mobiusSocket._reconnect.restore) {
367
- mobiusSocket._reconnect.restore();
354
+ if (mobiusSocket.reconnect.restore) {
355
+ mobiusSocket.reconnect.restore();
368
356
  }
369
357
  _sinon.default.spy(mobiusSocket, 'connect');
370
358
  var offlineSpy = _sinon.default.spy();
@@ -389,8 +377,7 @@ describe('plugin-mobiusSocket', function () {
389
377
  _testHelperChai.assert.called(offlineSpy);
390
378
  _testHelperChai.assert.calledWith(offlineSpy, {
391
379
  code: code,
392
- reason: reason,
393
- sessionId: 'mobius-websocket-session'
380
+ reason: reason
394
381
  });
395
382
  switch (action) {
396
383
  case 'close':
@@ -429,21 +416,6 @@ describe('plugin-mobiusSocket', function () {
429
416
  });
430
417
  });
431
418
  describe('when a MessageEvent is received', function () {
432
- it('processes the Event via any autowired event handlers', function () {
433
- webex.fake = {
434
- processTestEvent: _sinon.default.spy()
435
- };
436
- var promise = mobiusSocket.connect();
437
- mockWebSocket.open();
438
- return promise.then(function () {
439
- mockWebSocket.emit('message', {
440
- data: (0, _stringify.default)(fakeTestMessage)
441
- });
442
- return (0, _promiseTick.default)(1);
443
- }).then(function () {
444
- _testHelperChai.assert.called(webex.fake.processTestEvent);
445
- });
446
- });
447
419
  it('emits the MobiusSocket envelope', function () {
448
420
  var startSpy = _sinon.default.spy();
449
421
  var stopSpy = _sinon.default.spy();