@webex/internal-plugin-locus 3.0.0-beta.9 → 3.0.0-beta.90
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/README.md +1 -3
- package/dist/event-keys.js +1 -3
- package/dist/event-keys.js.map +1 -1
- package/dist/index.js +1 -20
- package/dist/index.js.map +1 -1
- package/dist/locus.js +28 -115
- package/dist/locus.js.map +1 -1
- package/package.json +6 -6
- package/src/event-keys.js +1 -1
- package/src/index.js +1 -9
- package/src/locus.js +144 -129
- package/test/unit/lib/BasicSeqCmp.json +88 -430
- package/test/unit/lib/SeqCmp.json +513 -685
- package/test/unit/spec/locus.js +4 -4
package/README.md
CHANGED
|
@@ -21,14 +21,12 @@ npm install --save @webex/internal-plugin-locus
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
|
-
|
|
25
24
|
import '@webex/internal-plugin-locus';
|
|
26
25
|
|
|
27
26
|
import WebexCore from '@webex/webex-core';
|
|
28
27
|
|
|
29
28
|
const webex = new WebexCore();
|
|
30
|
-
webex.internal.locus.WHATEVER
|
|
31
|
-
|
|
29
|
+
webex.internal.locus.WHATEVER;
|
|
32
30
|
```
|
|
33
31
|
|
|
34
32
|
## Maintainers
|
package/dist/event-keys.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
|
|
9
7
|
exports.locusEventKeys = exports.default = void 0;
|
|
10
|
-
|
|
11
8
|
/*!
|
|
12
9
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
13
10
|
*/
|
|
11
|
+
|
|
14
12
|
var locusEventKeys = ['locus.summary', 'locus.self_changed', 'locus.participant_joined', 'locus.participant_left', 'locus.participant_declined', 'locus.participant_alerted', 'locus.participant_updated', 'locus.participant_roles_updated', 'locus.participant_audio_muted', 'locus.participant_audio_unmuted', 'locus.participant_video_muted', 'locus.participant_video_unmuted', 'locus.floor_granted', 'locus.floor_released', 'locus.space_users_modified', 'locus.controls_updated', 'locus.participant_controls_updated'];
|
|
15
13
|
exports.locusEventKeys = locusEventKeys;
|
|
16
14
|
var _default = locusEventKeys;
|
package/dist/event-keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["locusEventKeys"],"sources":["event-keys.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport const locusEventKeys = [\n 'locus.summary',\n 'locus.self_changed',\n 'locus.participant_joined',\n 'locus.participant_left',\n 'locus.participant_declined',\n 'locus.participant_alerted',\n 'locus.participant_updated',\n 'locus.participant_roles_updated',\n 'locus.participant_audio_muted',\n 'locus.participant_audio_unmuted',\n 'locus.participant_video_muted',\n 'locus.participant_video_unmuted',\n 'locus.floor_granted',\n 'locus.floor_released',\n 'locus.space_users_modified',\n 'locus.controls_updated',\n 'locus.participant_controls_updated'
|
|
1
|
+
{"version":3,"names":["locusEventKeys"],"sources":["event-keys.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport const locusEventKeys = [\n 'locus.summary',\n 'locus.self_changed',\n 'locus.participant_joined',\n 'locus.participant_left',\n 'locus.participant_declined',\n 'locus.participant_alerted',\n 'locus.participant_updated',\n 'locus.participant_roles_updated',\n 'locus.participant_audio_muted',\n 'locus.participant_audio_unmuted',\n 'locus.participant_video_muted',\n 'locus.participant_video_unmuted',\n 'locus.floor_granted',\n 'locus.floor_released',\n 'locus.space_users_modified',\n 'locus.controls_updated',\n 'locus.participant_controls_updated',\n];\n\nexport default locusEventKeys;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;;AAEO,IAAMA,cAAc,GAAG,CAC5B,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2B,EAC3B,iCAAiC,EACjC,+BAA+B,EAC/B,iCAAiC,EACjC,+BAA+B,EAC/B,iCAAiC,EACjC,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,wBAAwB,EACxB,oCAAoC,CACrC;AAAC;AAAA,eAEaA,cAAc;AAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,90 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
|
|
4
|
-
|
|
5
4
|
var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
|
|
6
|
-
|
|
7
5
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
8
|
-
|
|
9
6
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
10
|
-
|
|
11
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
12
8
|
value: true
|
|
13
9
|
});
|
|
14
|
-
|
|
15
10
|
_Object$defineProperty(exports, "DESYNC", {
|
|
16
11
|
enumerable: true,
|
|
17
12
|
get: function get() {
|
|
18
13
|
return _locus.DESYNC;
|
|
19
14
|
}
|
|
20
15
|
});
|
|
21
|
-
|
|
22
16
|
_Object$defineProperty(exports, "EQUAL", {
|
|
23
17
|
enumerable: true,
|
|
24
18
|
get: function get() {
|
|
25
19
|
return _locus.EQUAL;
|
|
26
20
|
}
|
|
27
21
|
});
|
|
28
|
-
|
|
29
22
|
_Object$defineProperty(exports, "FETCH", {
|
|
30
23
|
enumerable: true,
|
|
31
24
|
get: function get() {
|
|
32
25
|
return _locus.FETCH;
|
|
33
26
|
}
|
|
34
27
|
});
|
|
35
|
-
|
|
36
28
|
_Object$defineProperty(exports, "GREATER_THAN", {
|
|
37
29
|
enumerable: true,
|
|
38
30
|
get: function get() {
|
|
39
31
|
return _locus.GREATER_THAN;
|
|
40
32
|
}
|
|
41
33
|
});
|
|
42
|
-
|
|
43
34
|
_Object$defineProperty(exports, "LESS_THAN", {
|
|
44
35
|
enumerable: true,
|
|
45
36
|
get: function get() {
|
|
46
37
|
return _locus.LESS_THAN;
|
|
47
38
|
}
|
|
48
39
|
});
|
|
49
|
-
|
|
50
40
|
_Object$defineProperty(exports, "USE_CURRENT", {
|
|
51
41
|
enumerable: true,
|
|
52
42
|
get: function get() {
|
|
53
43
|
return _locus.USE_CURRENT;
|
|
54
44
|
}
|
|
55
45
|
});
|
|
56
|
-
|
|
57
46
|
_Object$defineProperty(exports, "USE_INCOMING", {
|
|
58
47
|
enumerable: true,
|
|
59
48
|
get: function get() {
|
|
60
49
|
return _locus.USE_INCOMING;
|
|
61
50
|
}
|
|
62
51
|
});
|
|
63
|
-
|
|
64
52
|
exports.default = void 0;
|
|
65
|
-
|
|
66
53
|
_Object$defineProperty(exports, "eventKeys", {
|
|
67
54
|
enumerable: true,
|
|
68
55
|
get: function get() {
|
|
69
56
|
return _eventKeys.locusEventKeys;
|
|
70
57
|
}
|
|
71
58
|
});
|
|
72
|
-
|
|
73
59
|
require("@webex/internal-plugin-mercury");
|
|
74
|
-
|
|
75
60
|
var _webexCore = require("@webex/webex-core");
|
|
76
|
-
|
|
77
61
|
var _locus = _interopRequireWildcard(require("./locus"));
|
|
78
|
-
|
|
79
62
|
var _eventKeys = require("./event-keys");
|
|
80
|
-
|
|
81
63
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
82
|
-
|
|
83
64
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
84
|
-
|
|
85
65
|
/*!
|
|
86
66
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
87
67
|
*/
|
|
68
|
+
|
|
88
69
|
(0, _webexCore.registerInternalPlugin)('locus', _locus.default);
|
|
89
70
|
var _default = _locus.default;
|
|
90
71
|
exports.default = _default;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["registerInternalPlugin","Locus"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-mercury';\nimport {registerInternalPlugin} from '@webex/webex-core';\n\nimport Locus from './locus';\n\nregisterInternalPlugin('locus', Locus);\n\nexport default Locus;\nexport {locusEventKeys as eventKeys} from './event-keys';\nexport {
|
|
1
|
+
{"version":3,"names":["registerInternalPlugin","Locus"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-mercury';\nimport {registerInternalPlugin} from '@webex/webex-core';\n\nimport Locus from './locus';\n\nregisterInternalPlugin('locus', Locus);\n\nexport default Locus;\nexport {locusEventKeys as eventKeys} from './event-keys';\nexport {USE_INCOMING, USE_CURRENT, EQUAL, FETCH, GREATER_THAN, LESS_THAN, DESYNC} from './locus';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;AACA;AAEA;AAKA;AAAyD;AAAA;AAZzD;AACA;AACA;;AAOA,IAAAA,iCAAsB,EAAC,OAAO,EAAEC,cAAK,CAAC;AAAC,eAExBA,cAAK;AAAA"}
|
package/dist/locus.js
CHANGED
|
@@ -1,57 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
|
|
4
|
-
|
|
5
4
|
var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
|
|
6
|
-
|
|
7
5
|
var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
|
|
8
|
-
|
|
9
6
|
var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
|
|
10
|
-
|
|
11
7
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
12
|
-
|
|
13
8
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
14
|
-
|
|
15
9
|
_Object$defineProperty(exports, "__esModule", {
|
|
16
10
|
value: true
|
|
17
11
|
});
|
|
18
|
-
|
|
19
12
|
exports.default = exports.USE_INCOMING = exports.USE_CURRENT = exports.LESS_THAN = exports.GREATER_THAN = exports.FETCH = exports.EQUAL = exports.DESYNC = void 0;
|
|
20
|
-
|
|
21
13
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
22
|
-
|
|
23
14
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
24
|
-
|
|
25
15
|
var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
|
|
26
|
-
|
|
27
16
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
28
|
-
|
|
29
17
|
var _set = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/set"));
|
|
30
|
-
|
|
31
18
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
|
|
32
|
-
|
|
33
19
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
34
|
-
|
|
35
20
|
var _memoize2 = _interopRequireDefault(require("lodash/memoize"));
|
|
36
|
-
|
|
37
21
|
var _last2 = _interopRequireDefault(require("lodash/last"));
|
|
38
|
-
|
|
39
22
|
var _first2 = _interopRequireDefault(require("lodash/first"));
|
|
40
|
-
|
|
41
23
|
var _difference2 = _interopRequireDefault(require("lodash/difference"));
|
|
42
|
-
|
|
43
24
|
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
44
|
-
|
|
45
25
|
var _webexCore = require("@webex/webex-core");
|
|
46
|
-
|
|
47
26
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
48
|
-
|
|
49
27
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
50
|
-
|
|
51
28
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
52
|
-
|
|
53
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
54
|
-
|
|
29
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
55
30
|
var USE_INCOMING = 'USE_INCOMING';
|
|
56
31
|
exports.USE_INCOMING = USE_INCOMING;
|
|
57
32
|
var USE_CURRENT = 'USE_CURRENT';
|
|
@@ -65,39 +40,33 @@ exports.GREATER_THAN = GREATER_THAN;
|
|
|
65
40
|
var LESS_THAN = 'LESS_THAN';
|
|
66
41
|
exports.LESS_THAN = LESS_THAN;
|
|
67
42
|
var DESYNC = 'DESYNC';
|
|
43
|
+
|
|
68
44
|
/**
|
|
69
45
|
* Transates the result of a sequence comparison into an intended behavior
|
|
70
46
|
* @param {string} result
|
|
71
47
|
* @private
|
|
72
48
|
* @returns {string}
|
|
73
49
|
*/
|
|
74
|
-
|
|
75
50
|
exports.DESYNC = DESYNC;
|
|
76
|
-
|
|
77
51
|
function compareToAction(result) {
|
|
78
52
|
switch (result) {
|
|
79
53
|
case EQUAL:
|
|
80
54
|
case GREATER_THAN:
|
|
81
55
|
return USE_CURRENT;
|
|
82
|
-
|
|
83
56
|
case LESS_THAN:
|
|
84
57
|
return USE_INCOMING;
|
|
85
|
-
|
|
86
58
|
case DESYNC:
|
|
87
59
|
return FETCH;
|
|
88
|
-
|
|
89
60
|
default:
|
|
90
61
|
throw new Error("".concat(result, " is not a recognized sequence comparison result"));
|
|
91
62
|
}
|
|
92
63
|
}
|
|
64
|
+
|
|
93
65
|
/**
|
|
94
66
|
* @class
|
|
95
67
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
68
|
var Locus = _webexCore.WebexPlugin.extend({
|
|
99
69
|
namespace: 'Locus',
|
|
100
|
-
|
|
101
70
|
/**
|
|
102
71
|
* Alert the specified locus that the local user has been notified of the
|
|
103
72
|
* locus's active state
|
|
@@ -118,7 +87,6 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
118
87
|
return res.body;
|
|
119
88
|
});
|
|
120
89
|
},
|
|
121
|
-
|
|
122
90
|
/**
|
|
123
91
|
* Compares two loci to determine which one contains the most recent state
|
|
124
92
|
* @instance
|
|
@@ -138,18 +106,14 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
138
106
|
var sequence = locus.sequence;
|
|
139
107
|
return (!sequence.entries || !sequence.entries.length) && sequence.rangeStart === 0 && sequence.rangeEnd === 0;
|
|
140
108
|
}
|
|
141
|
-
|
|
142
109
|
if (isEmpty(current) || isEmpty(incoming)) {
|
|
143
110
|
return USE_INCOMING;
|
|
144
111
|
}
|
|
145
|
-
|
|
146
112
|
if (incoming.baseSequence) {
|
|
147
113
|
return this.compareDelta(current, incoming);
|
|
148
114
|
}
|
|
149
|
-
|
|
150
115
|
return compareToAction(this.compareSequence(current.sequence, incoming.sequence));
|
|
151
116
|
},
|
|
152
|
-
|
|
153
117
|
/**
|
|
154
118
|
* Compares two loci sequences (with delta params) and indicates what action
|
|
155
119
|
* to take.
|
|
@@ -162,23 +126,18 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
162
126
|
*/
|
|
163
127
|
compareDelta: function compareDelta(current, incoming) {
|
|
164
128
|
var ret = this.compareSequence(current.sequence, incoming.sequence);
|
|
165
|
-
|
|
166
129
|
if (ret !== LESS_THAN) {
|
|
167
130
|
return compareToAction(ret);
|
|
168
131
|
}
|
|
169
|
-
|
|
170
132
|
ret = this.compareSequence(current.sequence, incoming.baseSequence);
|
|
171
|
-
|
|
172
133
|
switch (ret) {
|
|
173
134
|
case GREATER_THAN:
|
|
174
135
|
case EQUAL:
|
|
175
136
|
return USE_INCOMING;
|
|
176
|
-
|
|
177
137
|
default:
|
|
178
138
|
return FETCH;
|
|
179
139
|
}
|
|
180
140
|
},
|
|
181
|
-
|
|
182
141
|
/**
|
|
183
142
|
* Compares two Locus sequences
|
|
184
143
|
* @instance
|
|
@@ -191,24 +150,22 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
191
150
|
if (!current) {
|
|
192
151
|
throw new Error('`current` is required');
|
|
193
152
|
}
|
|
194
|
-
|
|
195
153
|
if (!incoming) {
|
|
196
154
|
throw new Error('`incoming` is required');
|
|
197
|
-
}
|
|
198
|
-
|
|
155
|
+
}
|
|
156
|
+
// complexity here is unavoidable
|
|
199
157
|
/* eslint complexity: [0] */
|
|
200
|
-
|
|
201
158
|
/* eslint max-statements: [0] */
|
|
202
|
-
// must pick one of arrow-body-style or no-confusing-arrow to disable
|
|
203
159
|
|
|
160
|
+
// must pick one of arrow-body-style or no-confusing-arrow to disable
|
|
204
161
|
/* eslint arrow-body-style: [0] */
|
|
162
|
+
|
|
205
163
|
// after running the #compare() test suite in a loop, there doesn't seem to
|
|
206
164
|
// be any appreciable difference when used with or without memoize; since
|
|
207
165
|
// real locus sequences are likely to contain more sequence numbers than
|
|
208
166
|
// those in the test suite, I have to assume memoize can only help and the
|
|
209
167
|
// overhead of memoizing these methods is not a problem.
|
|
210
168
|
|
|
211
|
-
|
|
212
169
|
var getEntriesFirstValue = (0, _memoize2.default)(function (sequence) {
|
|
213
170
|
return sequence.entries.length === 0 ? 0 : (0, _first2.default)(sequence.entries);
|
|
214
171
|
});
|
|
@@ -221,37 +178,31 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
221
178
|
var getCompareLastValue = (0, _memoize2.default)(function (sequence) {
|
|
222
179
|
return getEntriesLastValue(sequence) || sequence.rangeEnd;
|
|
223
180
|
});
|
|
181
|
+
|
|
224
182
|
/**
|
|
225
183
|
* @param {number} entry
|
|
226
184
|
* @param {LocusSequence} sequence
|
|
227
185
|
* @private
|
|
228
186
|
* @returns {Boolean}
|
|
229
187
|
*/
|
|
230
|
-
|
|
231
188
|
function inRange(entry, sequence) {
|
|
232
189
|
return entry >= sequence.rangeStart && entry <= sequence.rangeEnd;
|
|
233
190
|
}
|
|
234
|
-
|
|
235
191
|
if (getCompareFirstValue(current) > getCompareLastValue(incoming)) {
|
|
236
192
|
return GREATER_THAN;
|
|
237
193
|
}
|
|
238
|
-
|
|
239
194
|
if (getCompareLastValue(current) < getCompareFirstValue(incoming)) {
|
|
240
195
|
return LESS_THAN;
|
|
241
196
|
}
|
|
242
|
-
|
|
243
197
|
var currentOnlyEntries = (0, _difference2.default)(current.entries, incoming.entries);
|
|
244
198
|
var incomingOnlyEntries = (0, _difference2.default)(incoming.entries, current.entries);
|
|
245
199
|
var currentOnly = [];
|
|
246
200
|
var incomingOnly = [];
|
|
247
|
-
|
|
248
201
|
var _iterator = _createForOfIteratorHelper(currentOnlyEntries),
|
|
249
|
-
|
|
250
|
-
|
|
202
|
+
_step;
|
|
251
203
|
try {
|
|
252
204
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
253
205
|
var _i4 = _step.value;
|
|
254
|
-
|
|
255
206
|
if (!inRange(_i4, incoming)) {
|
|
256
207
|
currentOnly.push(_i4);
|
|
257
208
|
}
|
|
@@ -261,14 +212,11 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
261
212
|
} finally {
|
|
262
213
|
_iterator.f();
|
|
263
214
|
}
|
|
264
|
-
|
|
265
215
|
var _iterator2 = _createForOfIteratorHelper(incomingOnlyEntries),
|
|
266
|
-
|
|
267
|
-
|
|
216
|
+
_step2;
|
|
268
217
|
try {
|
|
269
218
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
270
219
|
var _i5 = _step2.value;
|
|
271
|
-
|
|
272
220
|
if (!inRange(_i5, current)) {
|
|
273
221
|
incomingOnly.push(_i5);
|
|
274
222
|
}
|
|
@@ -278,54 +226,41 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
278
226
|
} finally {
|
|
279
227
|
_iterator2.f();
|
|
280
228
|
}
|
|
281
|
-
|
|
282
229
|
if (!currentOnly.length && !incomingOnly.length) {
|
|
283
230
|
if (current.rangeEnd - getCompareFirstValue(current) > incoming.rangeEnd - getCompareFirstValue(incoming)) {
|
|
284
231
|
return GREATER_THAN;
|
|
285
232
|
}
|
|
286
|
-
|
|
287
233
|
if (current.rangeEnd - getCompareFirstValue(current) < incoming.rangeEnd - getCompareFirstValue(incoming)) {
|
|
288
234
|
return LESS_THAN;
|
|
289
235
|
}
|
|
290
|
-
|
|
291
236
|
return EQUAL;
|
|
292
237
|
}
|
|
293
|
-
|
|
294
238
|
if (currentOnly.length && !incomingOnly.length) {
|
|
295
239
|
return GREATER_THAN;
|
|
296
240
|
}
|
|
297
|
-
|
|
298
241
|
if (!currentOnly.length && incomingOnly.length) {
|
|
299
242
|
return LESS_THAN;
|
|
300
243
|
}
|
|
301
|
-
|
|
302
244
|
if (!current.rangeStart && !current.rangeEnd && !incoming.rangeStart && !incoming.rangeEnd) {
|
|
303
245
|
return DESYNC;
|
|
304
246
|
}
|
|
305
|
-
|
|
306
247
|
for (var _i = 0, _currentOnly = currentOnly; _i < _currentOnly.length; _i++) {
|
|
307
248
|
var i = _currentOnly[_i];
|
|
308
|
-
|
|
309
249
|
if (getCompareFirstValue(incoming) < i && i < getCompareLastValue(incoming)) {
|
|
310
250
|
return DESYNC;
|
|
311
251
|
}
|
|
312
252
|
}
|
|
313
|
-
|
|
314
253
|
for (var _i2 = 0, _incomingOnly = incomingOnly; _i2 < _incomingOnly.length; _i2++) {
|
|
315
254
|
var _i3 = _incomingOnly[_i2];
|
|
316
|
-
|
|
317
255
|
if (getCompareFirstValue(current) < _i3 && _i3 < getCompareLastValue(current)) {
|
|
318
256
|
return DESYNC;
|
|
319
257
|
}
|
|
320
258
|
}
|
|
321
|
-
|
|
322
259
|
if (currentOnly[0] > incomingOnly[0]) {
|
|
323
260
|
return GREATER_THAN;
|
|
324
261
|
}
|
|
325
|
-
|
|
326
262
|
return LESS_THAN;
|
|
327
263
|
},
|
|
328
|
-
|
|
329
264
|
/**
|
|
330
265
|
* Calls the specified invitee and offers the specified media via
|
|
331
266
|
* options.localSdp
|
|
@@ -339,11 +274,9 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
339
274
|
create: function create(invitee) {
|
|
340
275
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
341
276
|
var correlationId = options.correlationId;
|
|
342
|
-
|
|
343
277
|
if (!correlationId) {
|
|
344
278
|
throw new Error('options.correlationId is required');
|
|
345
279
|
}
|
|
346
|
-
|
|
347
280
|
return this.request({
|
|
348
281
|
method: 'POST',
|
|
349
282
|
service: 'locus',
|
|
@@ -366,7 +299,8 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
366
299
|
rangeEnd: 0
|
|
367
300
|
}
|
|
368
301
|
}
|
|
369
|
-
})
|
|
302
|
+
})
|
|
303
|
+
// res.body.mediaConnections is deprecated so just return the locus
|
|
370
304
|
.then(function (res) {
|
|
371
305
|
res.body.locus.self.devices.map(function (item, index) {
|
|
372
306
|
item.mediaConnections = [res.body.mediaConnections[index]];
|
|
@@ -375,7 +309,6 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
375
309
|
return res.body.locus;
|
|
376
310
|
});
|
|
377
311
|
},
|
|
378
|
-
|
|
379
312
|
/**
|
|
380
313
|
* This is mostly an internal function to simplify the phone plugin. Decides
|
|
381
314
|
* which path to call based on the type of the thing being joined.
|
|
@@ -390,10 +323,8 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
390
323
|
if (target.url) {
|
|
391
324
|
return this.join(target, options);
|
|
392
325
|
}
|
|
393
|
-
|
|
394
326
|
return this.create(target, options);
|
|
395
327
|
},
|
|
396
|
-
|
|
397
328
|
/**
|
|
398
329
|
* Decline to join the specified Locus
|
|
399
330
|
* @instance
|
|
@@ -403,7 +334,6 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
403
334
|
*/
|
|
404
335
|
decline: function decline(locus) {
|
|
405
336
|
var _this = this;
|
|
406
|
-
|
|
407
337
|
return this.request({
|
|
408
338
|
method: 'PUT',
|
|
409
339
|
uri: "".concat(locus.url, "/participant/decline"),
|
|
@@ -417,11 +347,9 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
417
347
|
if (reason instanceof _webexCore.WebexHttpError.Conflict) {
|
|
418
348
|
return _this.get(locus);
|
|
419
349
|
}
|
|
420
|
-
|
|
421
350
|
return _promise.default.reject(reason);
|
|
422
351
|
});
|
|
423
352
|
},
|
|
424
|
-
|
|
425
353
|
/**
|
|
426
354
|
* Retrieves a single Locus
|
|
427
355
|
* @instance
|
|
@@ -437,7 +365,6 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
437
365
|
return res.body;
|
|
438
366
|
});
|
|
439
367
|
},
|
|
440
|
-
|
|
441
368
|
/**
|
|
442
369
|
* Retrieves the call history for the current user
|
|
443
370
|
* @instance
|
|
@@ -460,7 +387,6 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
460
387
|
return res.body;
|
|
461
388
|
});
|
|
462
389
|
},
|
|
463
|
-
|
|
464
390
|
/**
|
|
465
391
|
* Join the specified Locus and offer to send it media
|
|
466
392
|
* @instance
|
|
@@ -473,11 +399,9 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
473
399
|
join: function join(locus) {
|
|
474
400
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
475
401
|
var correlationId = locus.correlationId || options.correlationId;
|
|
476
|
-
|
|
477
402
|
if (!correlationId) {
|
|
478
403
|
throw new Error('locus.correlationId or options.correlationId is required');
|
|
479
404
|
}
|
|
480
|
-
|
|
481
405
|
return this.request({
|
|
482
406
|
method: 'POST',
|
|
483
407
|
uri: "".concat(locus.url, "/participant"),
|
|
@@ -496,7 +420,8 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
496
420
|
rangeEnd: 0
|
|
497
421
|
}
|
|
498
422
|
}
|
|
499
|
-
})
|
|
423
|
+
})
|
|
424
|
+
// The mediaConnections object is deprecated, so just return the locus
|
|
500
425
|
.then(function (res) {
|
|
501
426
|
res.body.locus.self.devices.map(function (item, index) {
|
|
502
427
|
item.mediaConnections = [res.body.mediaConnections[index]];
|
|
@@ -505,7 +430,6 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
505
430
|
return res.body.locus;
|
|
506
431
|
});
|
|
507
432
|
},
|
|
508
|
-
|
|
509
433
|
/**
|
|
510
434
|
* Leave the specified Locus
|
|
511
435
|
* @instance
|
|
@@ -515,7 +439,6 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
515
439
|
*/
|
|
516
440
|
leave: function leave(locus) {
|
|
517
441
|
var _this2 = this;
|
|
518
|
-
|
|
519
442
|
return this.request({
|
|
520
443
|
method: 'PUT',
|
|
521
444
|
uri: "".concat(locus.self.url, "/leave"),
|
|
@@ -529,11 +452,9 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
529
452
|
if (reason instanceof _webexCore.WebexHttpError.Conflict) {
|
|
530
453
|
return _this2.get(locus);
|
|
531
454
|
}
|
|
532
|
-
|
|
533
455
|
return _promise.default.reject(reason);
|
|
534
456
|
});
|
|
535
457
|
},
|
|
536
|
-
|
|
537
458
|
/**
|
|
538
459
|
* Lists active loci
|
|
539
460
|
* @instance
|
|
@@ -549,7 +470,6 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
549
470
|
return res.body.loci;
|
|
550
471
|
});
|
|
551
472
|
},
|
|
552
|
-
|
|
553
473
|
/**
|
|
554
474
|
* Merges two locus DTOs (for the same locus)
|
|
555
475
|
* @instance
|
|
@@ -563,18 +483,19 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
563
483
|
if (!incoming.baseSequence) {
|
|
564
484
|
return incoming;
|
|
565
485
|
}
|
|
486
|
+
var next = (0, _cloneDeep2.default)(current);
|
|
566
487
|
|
|
567
|
-
|
|
488
|
+
// 1. All non-null elements in the delta event except the "baseSequence" and
|
|
568
489
|
// the "participants" collection should be used to replace their existing
|
|
569
490
|
// values.
|
|
570
|
-
|
|
571
491
|
(0, _keys.default)(incoming).forEach(function (key) {
|
|
572
492
|
if (key === 'baseSequence' || key === 'participants') {
|
|
573
493
|
return;
|
|
574
494
|
}
|
|
575
|
-
|
|
576
495
|
next[key] = incoming[key] || next[key];
|
|
577
|
-
});
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
// 2. The "baseSequence" in the delta event can be discarded (it doesn't
|
|
578
499
|
// need to be maintained in the local working copy).
|
|
579
500
|
|
|
580
501
|
if (incoming.participants || incoming.participants.length) {
|
|
@@ -591,16 +512,16 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
591
512
|
// from the local working copy should be added to that collection.
|
|
592
513
|
toUpsert.set(p.url, p);
|
|
593
514
|
}
|
|
594
|
-
});
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
// The "participants" collection in the delta event should be merged with
|
|
595
518
|
// that of the local working copy of the Locus such that elements in the
|
|
596
519
|
// delta event's "participants" replace those with the same url value in
|
|
597
520
|
// the working copy "participants" collection.
|
|
598
|
-
|
|
599
521
|
var participants = next.participants.reduce(function (acc, p) {
|
|
600
522
|
if (!toRemove.has(p.url)) {
|
|
601
523
|
acc[p.url] = p;
|
|
602
524
|
}
|
|
603
|
-
|
|
604
525
|
return acc;
|
|
605
526
|
}, {});
|
|
606
527
|
toUpsert.forEach(function (value, key) {
|
|
@@ -608,10 +529,8 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
608
529
|
});
|
|
609
530
|
next.participants = (0, _values.default)(participants);
|
|
610
531
|
}
|
|
611
|
-
|
|
612
532
|
return next;
|
|
613
533
|
},
|
|
614
|
-
|
|
615
534
|
/**
|
|
616
535
|
* Signals to locus that the current user is done sharing their additional
|
|
617
536
|
* media stream
|
|
@@ -633,7 +552,6 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
633
552
|
return body;
|
|
634
553
|
});
|
|
635
554
|
},
|
|
636
|
-
|
|
637
555
|
/**
|
|
638
556
|
* Signals to locus that the current user would like to share an additional
|
|
639
557
|
* media stream
|
|
@@ -661,7 +579,6 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
661
579
|
return body;
|
|
662
580
|
});
|
|
663
581
|
},
|
|
664
|
-
|
|
665
582
|
/**
|
|
666
583
|
* Sends a string of DTMF tones to the locus
|
|
667
584
|
* @instance
|
|
@@ -683,7 +600,6 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
683
600
|
}
|
|
684
601
|
});
|
|
685
602
|
},
|
|
686
|
-
|
|
687
603
|
/**
|
|
688
604
|
* Fetches the delta for the locus from its syncUrl. *Does not merge*
|
|
689
605
|
* @instance
|
|
@@ -695,13 +611,13 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
695
611
|
return this.request({
|
|
696
612
|
method: 'GET',
|
|
697
613
|
uri: locus.syncUrl
|
|
698
|
-
})
|
|
614
|
+
})
|
|
615
|
+
// the api may return a 204 no content, so we'll give back an empty
|
|
699
616
|
// object in that case.
|
|
700
617
|
.then(function (res) {
|
|
701
618
|
return res.body || {};
|
|
702
619
|
});
|
|
703
620
|
},
|
|
704
|
-
|
|
705
621
|
/**
|
|
706
622
|
* Send a new sdp to Linus via the Locus API to update media state (e.g. to
|
|
707
623
|
* start or stop sending audio or video)
|
|
@@ -717,19 +633,17 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
717
633
|
*/
|
|
718
634
|
updateMedia: function updateMedia(locus, _ref3) {
|
|
719
635
|
var sdp = _ref3.sdp,
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
636
|
+
audioMuted = _ref3.audioMuted,
|
|
637
|
+
videoMuted = _ref3.videoMuted,
|
|
638
|
+
mediaId = _ref3.mediaId;
|
|
723
639
|
var localSdp = {
|
|
724
640
|
audioMuted: audioMuted,
|
|
725
641
|
videoMuted: videoMuted
|
|
726
642
|
};
|
|
727
|
-
|
|
728
643
|
if (sdp) {
|
|
729
644
|
localSdp.type = 'SDP';
|
|
730
645
|
localSdp.sdp = sdp;
|
|
731
646
|
}
|
|
732
|
-
|
|
733
647
|
return this.request({
|
|
734
648
|
method: 'PUT',
|
|
735
649
|
uri: "".concat(locus.self.url, "/media"),
|
|
@@ -745,9 +659,8 @@ var Locus = _webexCore.WebexPlugin.extend({
|
|
|
745
659
|
return res.body.locus;
|
|
746
660
|
});
|
|
747
661
|
},
|
|
748
|
-
version: "3.0.0-beta.
|
|
662
|
+
version: "3.0.0-beta.90"
|
|
749
663
|
});
|
|
750
|
-
|
|
751
664
|
var _default = Locus;
|
|
752
665
|
exports.default = _default;
|
|
753
666
|
//# sourceMappingURL=locus.js.map
|