@webex/internal-plugin-team 2.36.1 → 2.37.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/README.md +1 -3
- package/dist/config.js +0 -3
- package/dist/config.js.map +1 -1
- package/dist/index.js +4 -23
- package/dist/index.js.map +1 -1
- package/dist/team.js +68 -139
- package/dist/team.js.map +1 -1
- package/package.json +11 -11
- package/src/config.js +1 -1
- package/src/index.js +49 -33
- package/src/team.js +104 -83
- package/test/integration/spec/actions.js +326 -295
- package/test/integration/spec/create.js +81 -51
- package/test/integration/spec/get.js +47 -45
- package/test/integration/spec/mercury.js +53 -43
- package/test/unit/spec/team.js +38 -26
package/README.md
CHANGED
|
@@ -21,14 +21,12 @@ npm install --save @webex/internal-plugin-team
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
|
-
|
|
25
24
|
import '@webex/internal-plugin-team';
|
|
26
25
|
|
|
27
26
|
import WebexCore from '@webex/webex-core';
|
|
28
27
|
|
|
29
28
|
const webex = new WebexCore();
|
|
30
|
-
webex.internal.team.WHATEVER
|
|
31
|
-
|
|
29
|
+
webex.internal.team.WHATEVER;
|
|
32
30
|
```
|
|
33
31
|
|
|
34
32
|
## Maintainers
|
package/dist/config.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
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.default = void 0;
|
|
10
|
-
|
|
11
8
|
/*!
|
|
12
9
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
13
10
|
*/
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["team"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport default {\n team: {}
|
|
1
|
+
{"version":3,"names":["team"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport default {\n team: {},\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAFA,eAIe;EACbA,IAAI,EAAE,CAAC;AACT,CAAC;AAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,43 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
_Object$defineProperty(exports, "default", {
|
|
12
9
|
enumerable: true,
|
|
13
10
|
get: function get() {
|
|
14
11
|
return _team.default;
|
|
15
12
|
}
|
|
16
13
|
});
|
|
17
|
-
|
|
18
14
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
19
|
-
|
|
20
15
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
21
|
-
|
|
22
16
|
var _has2 = _interopRequireDefault(require("lodash/has"));
|
|
23
|
-
|
|
24
17
|
var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
|
|
25
|
-
|
|
26
18
|
require("@webex/internal-plugin-conversation");
|
|
27
|
-
|
|
28
19
|
require("@webex/internal-plugin-user");
|
|
29
|
-
|
|
30
20
|
require("@webex/internal-plugin-encryption");
|
|
31
|
-
|
|
32
21
|
var _webexCore = require("@webex/webex-core");
|
|
33
|
-
|
|
34
22
|
var _team = _interopRequireDefault(require("./team"));
|
|
35
|
-
|
|
36
23
|
var _config = _interopRequireDefault(require("./config"));
|
|
37
|
-
|
|
38
24
|
/*!
|
|
39
25
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
40
26
|
*/
|
|
27
|
+
|
|
41
28
|
(0, _webexCore.registerInternalPlugin)('team', _team.default, {
|
|
42
29
|
payloadTransformer: {
|
|
43
30
|
predicates: [{
|
|
@@ -55,20 +42,16 @@ var _config = _interopRequireDefault(require("./config"));
|
|
|
55
42
|
direction: 'inbound',
|
|
56
43
|
fn: function fn(ctx, key, team) {
|
|
57
44
|
var promises = [];
|
|
58
|
-
|
|
59
45
|
if (team.conversations.items) {
|
|
60
46
|
promises.push(_promise.default.all(team.conversations.items.map(function (item) {
|
|
61
47
|
return ctx.transform('decryptObject', null, item);
|
|
62
48
|
})));
|
|
63
49
|
}
|
|
64
|
-
|
|
65
50
|
var usableKey = team.encryptionKeyUrl || key;
|
|
66
|
-
|
|
67
51
|
if (usableKey) {
|
|
68
52
|
promises.push(ctx.transform('decryptPropDisplayName', usableKey, team));
|
|
69
53
|
promises.push(ctx.transform('decryptPropSummary', usableKey, team));
|
|
70
54
|
}
|
|
71
|
-
|
|
72
55
|
return _promise.default.all(promises);
|
|
73
56
|
}
|
|
74
57
|
}, {
|
|
@@ -91,20 +74,18 @@ var _config = _interopRequireDefault(require("./config"));
|
|
|
91
74
|
if (key === false) {
|
|
92
75
|
return _promise.default.resolve();
|
|
93
76
|
}
|
|
94
|
-
|
|
95
77
|
return _promise.default.resolve(key || ctx.webex.internal.encryption.kms.createUnboundKeys({
|
|
96
78
|
count: 1
|
|
97
79
|
})).then(function (keys) {
|
|
98
80
|
var k = (0, _isArray2.default)(keys) ? keys[0] : keys;
|
|
99
|
-
|
|
100
81
|
if (team.kmsMessage && team.kmsMessage.keyUris && !team.kmsMessage.keyUris.includes(k.uri)) {
|
|
101
82
|
team.kmsMessage.keyUris.push(k.uri);
|
|
102
83
|
}
|
|
103
|
-
|
|
104
84
|
return _promise.default.all([ctx.transform('encryptPropDisplayName', k, team), ctx.transform('encryptPropSummary', k, team)]).then(function () {
|
|
105
|
-
team.encryptionKeyUrl = k.uri || k;
|
|
106
|
-
// bound a new key
|
|
85
|
+
team.encryptionKeyUrl = k.uri || k;
|
|
107
86
|
|
|
87
|
+
// we only want to set the defaultActivityEncryptionKeyUrl if we've
|
|
88
|
+
// bound a new key
|
|
108
89
|
if (!key) {
|
|
109
90
|
team.defaultActivityEncryptionKeyUrl = team.defaultActivityEncryptionKeyUrl || k.uri || k;
|
|
110
91
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["registerInternalPlugin","Team","payloadTransformer","predicates","name","direction","test","ctx","optionsOrResponse","resolve","extract","activity","object","transforms","fn","key","team","promises","conversations","items","push","all","map","item","transform","usableKey","encryptionKeyUrl","teamRoomStatus","keyUrl","activityEvent","webex","internal","encryption","kms","createUnboundKeys","count","then","keys","k","kmsMessage","keyUris","includes","uri","defaultActivityEncryptionKeyUrl","teamMembers","config"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-conversation';\nimport '@webex/internal-plugin-user';\nimport '@webex/internal-plugin-encryption';\nimport {isArray, has, get} from 'lodash';\nimport {registerInternalPlugin} from '@webex/webex-core';\n\nimport Team from './team';\nimport config from './config';\n\nregisterInternalPlugin('team', Team, {\n payloadTransformer: {\n predicates: [\n {\n name: 'decryptTeamRoomStatus',\n direction: 'inbound',\n test(ctx, optionsOrResponse) {\n return Promise.resolve(has(optionsOrResponse, 'activity.object.activityEvent')
|
|
1
|
+
{"version":3,"names":["registerInternalPlugin","Team","payloadTransformer","predicates","name","direction","test","ctx","optionsOrResponse","resolve","extract","activity","object","transforms","fn","key","team","promises","conversations","items","push","all","map","item","transform","usableKey","encryptionKeyUrl","teamRoomStatus","keyUrl","activityEvent","webex","internal","encryption","kms","createUnboundKeys","count","then","keys","k","kmsMessage","keyUris","includes","uri","defaultActivityEncryptionKeyUrl","teamMembers","config"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-conversation';\nimport '@webex/internal-plugin-user';\nimport '@webex/internal-plugin-encryption';\nimport {isArray, has, get} from 'lodash';\nimport {registerInternalPlugin} from '@webex/webex-core';\n\nimport Team from './team';\nimport config from './config';\n\nregisterInternalPlugin('team', Team, {\n payloadTransformer: {\n predicates: [\n {\n name: 'decryptTeamRoomStatus',\n direction: 'inbound',\n test(ctx, optionsOrResponse) {\n return Promise.resolve(\n has(optionsOrResponse, 'activity.object.activityEvent') &&\n get(optionsOrResponse, 'activity.object.objectType') === 'teamRoomStatus'\n );\n },\n extract(optionsOrResponse) {\n return Promise.resolve(optionsOrResponse.activity.object);\n },\n },\n ],\n transforms: [\n {\n name: 'decryptTeam',\n direction: 'inbound',\n fn(ctx, key, team) {\n const promises = [];\n\n if (team.conversations.items) {\n promises.push(\n Promise.all(\n team.conversations.items.map((item) => ctx.transform('decryptObject', null, item))\n )\n );\n }\n\n const usableKey = team.encryptionKeyUrl || key;\n\n if (usableKey) {\n promises.push(ctx.transform('decryptPropDisplayName', usableKey, team));\n promises.push(ctx.transform('decryptPropSummary', usableKey, team));\n }\n\n return Promise.all(promises);\n },\n },\n {\n name: 'decryptTeamRoomStatus',\n direction: 'inbound',\n fn(ctx, teamRoomStatus) {\n const keyUrl = get(teamRoomStatus, 'activityEvent.encryptionKeyUrl');\n\n return ctx.transform('decryptObject', keyUrl, teamRoomStatus.activityEvent);\n },\n },\n {\n name: 'decryptPropSummary',\n direction: 'inbound',\n fn(ctx, key, team) {\n return ctx.transform('decryptTextProp', 'summary', key, team);\n },\n },\n {\n name: 'encryptTeam',\n direction: 'outbound',\n fn(ctx, key, team) {\n if (key === false) {\n return Promise.resolve();\n }\n\n return Promise.resolve(\n key || ctx.webex.internal.encryption.kms.createUnboundKeys({count: 1})\n ).then((keys) => {\n const k = isArray(keys) ? keys[0] : keys;\n\n if (\n team.kmsMessage &&\n team.kmsMessage.keyUris &&\n !team.kmsMessage.keyUris.includes(k.uri)\n ) {\n team.kmsMessage.keyUris.push(k.uri);\n }\n\n return Promise.all([\n ctx.transform('encryptPropDisplayName', k, team),\n ctx.transform('encryptPropSummary', k, team),\n ]).then(() => {\n team.encryptionKeyUrl = k.uri || k;\n\n // we only want to set the defaultActivityEncryptionKeyUrl if we've\n // bound a new key\n if (!key) {\n team.defaultActivityEncryptionKeyUrl =\n team.defaultActivityEncryptionKeyUrl || k.uri || k;\n }\n });\n });\n },\n },\n {\n name: 'encryptPropSummary',\n direction: 'outbound',\n fn(ctx, key, team) {\n return ctx.transform('encryptTextProp', 'summary', key, team);\n },\n },\n {\n name: 'normalizeTeam',\n fn(ctx, team) {\n team.conversations = team.conversations || {};\n team.conversations.items = team.conversations.items || [];\n team.teamMembers = team.teamMembers || {};\n team.teamMembers.items = team.teamMembers.items || [];\n\n return Promise.all([\n Promise.all(\n team.conversations.items.map((item) => ctx.transform('normalizeObject', item))\n ),\n Promise.all(\n team.teamMembers.items.map((item) => ctx.transform('normalizeObject', item))\n ),\n ]);\n },\n },\n ],\n },\n config,\n});\n\nexport {default} from './team';\n"],"mappings":";;;;;;;;;;;;;;;;;AAIA;AACA;AACA;AAEA;AAEA;AACA;AAXA;AACA;AACA;;AAWA,IAAAA,iCAAsB,EAAC,MAAM,EAAEC,aAAI,EAAE;EACnCC,kBAAkB,EAAE;IAClBC,UAAU,EAAE,CACV;MACEC,IAAI,EAAE,uBAAuB;MAC7BC,SAAS,EAAE,SAAS;MACpBC,IAAI,gBAACC,GAAG,EAAEC,iBAAiB,EAAE;QAC3B,OAAO,iBAAQC,OAAO,CACpB,mBAAID,iBAAiB,EAAE,+BAA+B,CAAC,IACrD,mBAAIA,iBAAiB,EAAE,4BAA4B,CAAC,KAAK,gBAAgB,CAC5E;MACH,CAAC;MACDE,OAAO,mBAACF,iBAAiB,EAAE;QACzB,OAAO,iBAAQC,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 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
4
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
5
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
6
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
7
|
+
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
8
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
3
9
|
var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
|
|
4
|
-
|
|
5
10
|
var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
|
|
6
|
-
|
|
7
11
|
var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
|
|
8
|
-
|
|
9
12
|
var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
|
|
10
|
-
|
|
11
|
-
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
12
|
-
|
|
13
13
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
14
|
-
|
|
15
14
|
_Object$defineProperty(exports, "__esModule", {
|
|
16
15
|
value: true
|
|
17
16
|
});
|
|
18
|
-
|
|
19
17
|
exports.default = void 0;
|
|
20
|
-
|
|
21
18
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
22
|
-
|
|
23
19
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
24
|
-
|
|
25
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
|
|
26
|
-
|
|
27
20
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
28
|
-
|
|
21
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
29
22
|
var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
|
|
30
|
-
|
|
31
23
|
var _pick2 = _interopRequireDefault(require("lodash/pick"));
|
|
32
|
-
|
|
33
24
|
var _find2 = _interopRequireDefault(require("lodash/find"));
|
|
34
|
-
|
|
35
25
|
var _querystring = _interopRequireDefault(require("querystring"));
|
|
36
|
-
|
|
37
26
|
var _webexCore = require("@webex/webex-core");
|
|
38
|
-
|
|
39
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; } } }; }
|
|
40
|
-
|
|
41
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); }
|
|
42
|
-
|
|
43
|
-
function
|
|
44
|
-
|
|
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; }
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
45
32
|
var Team = _webexCore.WebexPlugin.extend({
|
|
46
33
|
namespace: 'Team',
|
|
47
|
-
|
|
48
34
|
/**
|
|
49
35
|
* Move an existing group conversation into a team.
|
|
50
36
|
* @param {TeamObject} team
|
|
@@ -56,7 +42,6 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
56
42
|
*/
|
|
57
43
|
addConversation: function addConversation(team, conversation, activity) {
|
|
58
44
|
var _this = this;
|
|
59
|
-
|
|
60
45
|
return this._ensureGeneralConversation(team).then(function (generalConversation) {
|
|
61
46
|
return _this.webex.internal.conversation.prepare(activity, {
|
|
62
47
|
verb: 'add',
|
|
@@ -76,7 +61,6 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
76
61
|
return _this.webex.internal.conversation.submit(a);
|
|
77
62
|
});
|
|
78
63
|
},
|
|
79
|
-
|
|
80
64
|
/**
|
|
81
65
|
* Add a member to a team
|
|
82
66
|
* @param {TeamObject} team
|
|
@@ -88,12 +72,10 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
88
72
|
*/
|
|
89
73
|
addMember: function addMember(team, participant, activity) {
|
|
90
74
|
var _this2 = this;
|
|
91
|
-
|
|
92
75
|
return this._ensureGeneralConversation(team).then(function (generalConversation) {
|
|
93
76
|
return _this2.webex.internal.conversation.add(generalConversation, participant, activity);
|
|
94
77
|
});
|
|
95
78
|
},
|
|
96
|
-
|
|
97
79
|
/**
|
|
98
80
|
* Create a team
|
|
99
81
|
* @param {NewTeamObject} params
|
|
@@ -104,15 +86,12 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
104
86
|
*/
|
|
105
87
|
create: function create(params) {
|
|
106
88
|
var _this3 = this;
|
|
107
|
-
|
|
108
89
|
if (!params.displayName) {
|
|
109
90
|
return _promise.default.reject(new Error('`params.displayName` is required'));
|
|
110
91
|
}
|
|
111
|
-
|
|
112
92
|
if (!params.participants || params.participants.length === 0) {
|
|
113
93
|
return _promise.default.reject(new Error('`params.participants` is required'));
|
|
114
94
|
}
|
|
115
|
-
|
|
116
95
|
return _promise.default.all(params.participants.map(function (participant) {
|
|
117
96
|
return _this3.webex.internal.user.asUUID(participant, {
|
|
118
97
|
create: true
|
|
@@ -133,7 +112,6 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
133
112
|
return res.body;
|
|
134
113
|
});
|
|
135
114
|
},
|
|
136
|
-
|
|
137
115
|
/**
|
|
138
116
|
* Create a conversation within a team. Currently does not support
|
|
139
117
|
* activities besides add (ie no post or share activities).
|
|
@@ -148,17 +126,13 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
148
126
|
*/
|
|
149
127
|
createConversation: function createConversation(team, params) {
|
|
150
128
|
var _this4 = this;
|
|
151
|
-
|
|
152
129
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
153
|
-
|
|
154
130
|
if (!team.url) {
|
|
155
131
|
return _promise.default.reject(new Error('`team.url` is required'));
|
|
156
132
|
}
|
|
157
|
-
|
|
158
133
|
if (!params.displayName) {
|
|
159
134
|
return _promise.default.reject(new Error('`params.displayName` is required'));
|
|
160
135
|
}
|
|
161
|
-
|
|
162
136
|
return this._ensureGeneralConversation(team).then(function (generalConversation) {
|
|
163
137
|
return _promise.default.all(params.participants.map(function (participant) {
|
|
164
138
|
return _this4.webex.internal.user.asUUID(participant, {
|
|
@@ -181,7 +155,6 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
181
155
|
return res.body;
|
|
182
156
|
});
|
|
183
157
|
},
|
|
184
|
-
|
|
185
158
|
/**
|
|
186
159
|
* Retrieve a single team
|
|
187
160
|
* @param {Object|Team~TeamObject} team
|
|
@@ -193,15 +166,12 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
193
166
|
*/
|
|
194
167
|
get: function get(_ref) {
|
|
195
168
|
var _this5 = this;
|
|
196
|
-
|
|
197
169
|
var url = _ref.url;
|
|
198
170
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
199
|
-
|
|
200
171
|
if (!url) {
|
|
201
172
|
return _promise.default.reject(new Error('`team.url` is required'));
|
|
202
173
|
}
|
|
203
|
-
|
|
204
|
-
var params = (0, _assign.default)({
|
|
174
|
+
var params = _objectSpread({
|
|
205
175
|
includeTeamConversations: false,
|
|
206
176
|
includeTeamMembers: false
|
|
207
177
|
}, options);
|
|
@@ -214,7 +184,6 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
214
184
|
});
|
|
215
185
|
});
|
|
216
186
|
},
|
|
217
|
-
|
|
218
187
|
/**
|
|
219
188
|
* Get the list of conversations for a particular team
|
|
220
189
|
* @param {TeamObject} team
|
|
@@ -223,18 +192,15 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
223
192
|
*/
|
|
224
193
|
listConversations: function listConversations(_ref2) {
|
|
225
194
|
var url = _ref2.url;
|
|
226
|
-
|
|
227
195
|
if (!url) {
|
|
228
196
|
return _promise.default.reject(new Error('`team.url` is required'));
|
|
229
197
|
}
|
|
230
|
-
|
|
231
198
|
return this.webex.request({
|
|
232
199
|
uri: "".concat(url, "/conversations")
|
|
233
200
|
}).then(function (res) {
|
|
234
201
|
return res.body.items;
|
|
235
202
|
});
|
|
236
203
|
},
|
|
237
|
-
|
|
238
204
|
/**
|
|
239
205
|
* Join a team conversation
|
|
240
206
|
* @param {TeamObject} team
|
|
@@ -249,7 +215,6 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
249
215
|
return res.body;
|
|
250
216
|
});
|
|
251
217
|
},
|
|
252
|
-
|
|
253
218
|
/**
|
|
254
219
|
* Retrieve all teams
|
|
255
220
|
* @param {Object} options
|
|
@@ -259,82 +224,68 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
259
224
|
*/
|
|
260
225
|
list: function list() {
|
|
261
226
|
var _arguments = arguments,
|
|
262
|
-
|
|
263
|
-
|
|
227
|
+
_this6 = this;
|
|
264
228
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
265
229
|
var options, params, resource, res, list, results, _iterator, _step, result;
|
|
266
|
-
|
|
267
230
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
268
|
-
while (1) {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
231
|
+
while (1) switch (_context.prev = _context.next) {
|
|
232
|
+
case 0:
|
|
233
|
+
options = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {};
|
|
234
|
+
params = _objectSpread({
|
|
235
|
+
includeTeamConversations: false,
|
|
236
|
+
includeTeamMembers: false
|
|
237
|
+
}, options);
|
|
238
|
+
resource = 'teams';
|
|
239
|
+
_context.next = 5;
|
|
240
|
+
return _this6.webex.request({
|
|
241
|
+
api: 'conversation',
|
|
242
|
+
resource: resource,
|
|
243
|
+
qs: params
|
|
244
|
+
});
|
|
245
|
+
case 5:
|
|
246
|
+
res = _context.sent;
|
|
247
|
+
list = res.body.items.slice(0);
|
|
248
|
+
if (!res.body.additionalUrls) {
|
|
249
|
+
_context.next = 13;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
_context.next = 10;
|
|
253
|
+
return _promise.default.all(res.body.additionalUrls.map(function (host) {
|
|
254
|
+
var uri = "".concat(host, "/").concat(resource);
|
|
278
255
|
return _this6.webex.request({
|
|
279
|
-
|
|
280
|
-
resource: resource,
|
|
256
|
+
uri: uri,
|
|
281
257
|
qs: params
|
|
282
258
|
});
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
_context.next = 10;
|
|
294
|
-
return _promise.default.all(res.body.additionalUrls.map(function (host) {
|
|
295
|
-
var uri = "".concat(host, "/").concat(resource);
|
|
296
|
-
return _this6.webex.request({
|
|
297
|
-
uri: uri,
|
|
298
|
-
qs: params
|
|
299
|
-
});
|
|
300
|
-
}));
|
|
301
|
-
|
|
302
|
-
case 10:
|
|
303
|
-
results = _context.sent;
|
|
304
|
-
_iterator = _createForOfIteratorHelper(results);
|
|
305
|
-
|
|
306
|
-
try {
|
|
307
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
308
|
-
result = _step.value;
|
|
309
|
-
|
|
310
|
-
if (result.body && result.body.items && result.body.items.length) {
|
|
311
|
-
list = list.concat(result.body.items);
|
|
312
|
-
}
|
|
259
|
+
}));
|
|
260
|
+
case 10:
|
|
261
|
+
results = _context.sent;
|
|
262
|
+
_iterator = _createForOfIteratorHelper(results);
|
|
263
|
+
try {
|
|
264
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
265
|
+
result = _step.value;
|
|
266
|
+
if (result.body && result.body.items && result.body.items.length) {
|
|
267
|
+
list = list.concat(result.body.items);
|
|
313
268
|
}
|
|
314
|
-
} catch (err) {
|
|
315
|
-
_iterator.e(err);
|
|
316
|
-
} finally {
|
|
317
|
-
_iterator.f();
|
|
318
269
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
return
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
270
|
+
} catch (err) {
|
|
271
|
+
_iterator.e(err);
|
|
272
|
+
} finally {
|
|
273
|
+
_iterator.f();
|
|
274
|
+
}
|
|
275
|
+
case 13:
|
|
276
|
+
_context.next = 15;
|
|
277
|
+
return _promise.default.all(res.body.items.map(function (team) {
|
|
278
|
+
return _this6._recordUUIDs(team);
|
|
279
|
+
}));
|
|
280
|
+
case 15:
|
|
281
|
+
return _context.abrupt("return", list);
|
|
282
|
+
case 16:
|
|
283
|
+
case "end":
|
|
284
|
+
return _context.stop();
|
|
333
285
|
}
|
|
334
286
|
}, _callee);
|
|
335
287
|
}))();
|
|
336
288
|
},
|
|
337
|
-
|
|
338
289
|
/**
|
|
339
290
|
* Remove a member from a team
|
|
340
291
|
* @param {TeamObject} team
|
|
@@ -346,12 +297,10 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
346
297
|
*/
|
|
347
298
|
removeMember: function removeMember(team, participant, activity) {
|
|
348
299
|
var _this7 = this;
|
|
349
|
-
|
|
350
300
|
return this._ensureGeneralConversation(team).then(function (generalConversation) {
|
|
351
301
|
return _this7.webex.internal.conversation.leave(generalConversation, participant, activity);
|
|
352
302
|
});
|
|
353
303
|
},
|
|
354
|
-
|
|
355
304
|
/**
|
|
356
305
|
* Remove a team conversation from a team.
|
|
357
306
|
* @param {TeamObject} team
|
|
@@ -363,7 +312,6 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
363
312
|
*/
|
|
364
313
|
removeConversation: function removeConversation(team, conversation, activity) {
|
|
365
314
|
var _this8 = this;
|
|
366
|
-
|
|
367
315
|
return this._ensureGeneralConversation(team).then(function (generalConversation) {
|
|
368
316
|
var properties = {
|
|
369
317
|
verb: 'remove',
|
|
@@ -381,7 +329,6 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
381
329
|
return _this8.webex.internal.conversation.submit(a);
|
|
382
330
|
});
|
|
383
331
|
},
|
|
384
|
-
|
|
385
332
|
/**
|
|
386
333
|
* Update the displayName, summary, or teamColor field for a team.
|
|
387
334
|
* @param {TeamObject} team to be updated
|
|
@@ -394,73 +341,60 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
394
341
|
update: function update(team, object, activity) {
|
|
395
342
|
return this.webex.internal.conversation.update(team, object, activity);
|
|
396
343
|
},
|
|
397
|
-
|
|
398
|
-
/* eslint-disable require-jsdoc */
|
|
399
|
-
_ensureGeneralConversation: function _ensureGeneralConversation(team) {
|
|
344
|
+
/* eslint-disable require-jsdoc */_ensureGeneralConversation: function _ensureGeneralConversation(team) {
|
|
400
345
|
if (!team.generalConversationUuid) {
|
|
401
346
|
return _promise.default.reject(new Error('`team.generalConversationUuid` must be present'));
|
|
402
347
|
}
|
|
403
|
-
|
|
404
348
|
if (team.conversations.items.length) {
|
|
405
349
|
var generalConversation = (0, _find2.default)(team.conversations.items, {
|
|
406
350
|
id: team.generalConversationUuid
|
|
407
351
|
});
|
|
408
|
-
|
|
409
352
|
if (generalConversation) {
|
|
410
353
|
return _promise.default.resolve(generalConversation);
|
|
411
354
|
}
|
|
412
355
|
}
|
|
413
|
-
|
|
414
356
|
return this.webex.internal.conversation.get({
|
|
415
357
|
id: team.generalConversationUuid
|
|
416
358
|
});
|
|
417
359
|
},
|
|
418
360
|
_prepareTeam: function _prepareTeam(params) {
|
|
419
361
|
var payload = this.webex.internal.conversation._prepareConversationForCreation(params);
|
|
420
|
-
|
|
421
362
|
payload.objectType = 'team';
|
|
422
|
-
|
|
423
363
|
if (params.summary) {
|
|
424
364
|
payload.summary = params.summary;
|
|
425
365
|
}
|
|
426
|
-
|
|
427
366
|
return _promise.default.resolve(payload);
|
|
428
367
|
},
|
|
429
368
|
_prepareTeamConversation: function _prepareTeamConversation(teamConversation, params) {
|
|
430
369
|
if (!teamConversation.kmsResourceObjectUrl) {
|
|
431
370
|
return _promise.default.reject(new Error('Team general conversation must have a KRO'));
|
|
432
371
|
}
|
|
372
|
+
var payload = this.webex.internal.conversation._prepareConversationForCreation(params);
|
|
433
373
|
|
|
434
|
-
|
|
374
|
+
// Push the general conversation KRO on so that team members can
|
|
435
375
|
// decrypt the title of this open room without joining it.
|
|
436
|
-
|
|
437
|
-
|
|
438
376
|
payload.kmsMessage.userIds.push(teamConversation.kmsResourceObjectUrl);
|
|
439
377
|
return _promise.default.resolve(payload);
|
|
440
378
|
},
|
|
441
379
|
_recordUUIDs: function _recordUUIDs(team) {
|
|
442
380
|
var _this9 = this;
|
|
443
|
-
|
|
444
381
|
if (!team.teamMembers || !team.teamMembers.items) {
|
|
445
382
|
return _promise.default.resolve(team);
|
|
446
383
|
}
|
|
447
|
-
|
|
448
384
|
return _promise.default.all(team.teamMembers.items.map(function (participant) {
|
|
449
385
|
// ROOMs or LYRA_SPACEs do not have email addresses, so there's no point attempting to
|
|
450
386
|
// record their UUIDs.
|
|
451
387
|
if (participant.type === 'ROOM' || participant.type === 'LYRA_SPACE') {
|
|
452
388
|
return _promise.default.resolve();
|
|
453
389
|
}
|
|
454
|
-
|
|
455
390
|
return _this9.webex.internal.user.recordUUID(participant).catch(function (err) {
|
|
456
391
|
return _this9.logger.warn('Could not record uuid', err);
|
|
457
392
|
});
|
|
458
393
|
}));
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
,
|
|
462
|
-
version: "2.36.1"
|
|
394
|
+
} /* eslint-enable require-jsdoc */,
|
|
395
|
+
version: "2.37.1"
|
|
463
396
|
});
|
|
397
|
+
|
|
464
398
|
/**
|
|
465
399
|
* Assign or unassign a team member to be a moderator of a team
|
|
466
400
|
* @param {TeamObject} team
|
|
@@ -468,17 +402,15 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
468
402
|
* @param {Object} activity
|
|
469
403
|
* @returns {Promise} Resolves with activity that was posted
|
|
470
404
|
*/
|
|
471
|
-
|
|
472
|
-
|
|
473
405
|
['assignModerator', 'unassignModerator'].forEach(function (verb) {
|
|
474
406
|
Team.prototype[verb] = function submitModerationChangeActivity(team, member, activity) {
|
|
475
407
|
var _this10 = this;
|
|
476
|
-
|
|
477
408
|
return this._ensureGeneralConversation(team).then(function (teamConversation) {
|
|
478
409
|
return _this10.webex.internal.conversation[verb](teamConversation, member, activity);
|
|
479
410
|
});
|
|
480
411
|
};
|
|
481
412
|
});
|
|
413
|
+
|
|
482
414
|
/**
|
|
483
415
|
* Archive or unarchive a team or team conversation.
|
|
484
416
|
* @param {TeamObject|ConversationObject} target team or team conversation that should be archived
|
|
@@ -487,15 +419,12 @@ var Team = _webexCore.WebexPlugin.extend({
|
|
|
487
419
|
* provisional activity
|
|
488
420
|
* @returns {Promise} Resolves with the posted activity
|
|
489
421
|
*/
|
|
490
|
-
|
|
491
422
|
['archive', 'unarchive'].forEach(function (verb) {
|
|
492
423
|
Team.prototype[verb] = function submitArchiveStateChangeActivity(target, activity) {
|
|
493
424
|
var _this11 = this;
|
|
494
|
-
|
|
495
425
|
if (!target.objectType) {
|
|
496
426
|
return _promise.default.reject(new Error('`target.objectType` is required'));
|
|
497
427
|
}
|
|
498
|
-
|
|
499
428
|
var properties = {
|
|
500
429
|
verb: verb,
|
|
501
430
|
object: (0, _pick2.default)(target, 'id', 'url', 'objectType'),
|