@webex/internal-plugin-team 2.59.1 → 2.59.3-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +6 -6
- package/README.md +42 -42
- package/babel.config.js +3 -3
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/team.js +97 -97
- package/dist/team.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +17 -16
- package/process +1 -1
- package/src/config.js +7 -7
- package/src/index.js +139 -139
- package/src/team.js +437 -437
- package/test/integration/spec/actions.js +560 -560
- package/test/integration/spec/create.js +158 -158
- package/test/integration/spec/get.js +198 -198
- package/test/integration/spec/mercury.js +108 -108
- package/test/unit/spec/team.js +153 -153
package/jest.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const config = require('@webex/jest-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = config;
|
|
1
|
+
const config = require('@webex/jest-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/internal-plugin-team",
|
|
3
|
-
"version": "2.59.1",
|
|
4
3
|
"description": "",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"author": "Josh Dykstra <jodykstr@cisco.com>",
|
|
@@ -22,34 +21,36 @@
|
|
|
22
21
|
},
|
|
23
22
|
"devDependencies": {
|
|
24
23
|
"@babel/core": "^7.17.10",
|
|
25
|
-
"@webex/babel-config-legacy": "
|
|
26
|
-
"@webex/eslint-config-legacy": "
|
|
27
|
-
"@webex/jest-config-legacy": "
|
|
28
|
-
"@webex/legacy-tools": "
|
|
29
|
-
"@webex/test-helper-chai": "2.59.1",
|
|
30
|
-
"@webex/test-helper-mocha": "2.59.1",
|
|
31
|
-
"@webex/test-helper-mock-webex": "2.59.1",
|
|
32
|
-
"@webex/test-helper-test-users": "2.59.1",
|
|
24
|
+
"@webex/babel-config-legacy": "^0.0.0",
|
|
25
|
+
"@webex/eslint-config-legacy": "^0.0.0",
|
|
26
|
+
"@webex/jest-config-legacy": "^0.0.0",
|
|
27
|
+
"@webex/legacy-tools": "^0.0.0",
|
|
28
|
+
"@webex/test-helper-chai": "^2.59.3-next.1",
|
|
29
|
+
"@webex/test-helper-mocha": "^2.59.3-next.1",
|
|
30
|
+
"@webex/test-helper-mock-webex": "^2.59.3-next.1",
|
|
31
|
+
"@webex/test-helper-test-users": "^2.59.3-next.1",
|
|
33
32
|
"eslint": "^8.24.0",
|
|
34
33
|
"prettier": "^2.7.1",
|
|
35
34
|
"sinon": "^9.2.4"
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
|
-
"@webex/internal-plugin-conversation": "2.59.1",
|
|
39
|
-
"@webex/internal-plugin-device": "2.59.1",
|
|
40
|
-
"@webex/internal-plugin-encryption": "2.59.1",
|
|
41
|
-
"@webex/internal-plugin-user": "2.59.1",
|
|
42
|
-
"@webex/webex-core": "2.59.1",
|
|
37
|
+
"@webex/internal-plugin-conversation": "^2.59.3-next.1",
|
|
38
|
+
"@webex/internal-plugin-device": "^2.59.3-next.1",
|
|
39
|
+
"@webex/internal-plugin-encryption": "^2.59.3-next.1",
|
|
40
|
+
"@webex/internal-plugin-user": "^2.59.3-next.1",
|
|
41
|
+
"@webex/webex-core": "^2.59.3-next.1",
|
|
43
42
|
"lodash": "^4.17.21",
|
|
44
43
|
"uuid": "^3.3.2"
|
|
45
44
|
},
|
|
46
45
|
"scripts": {
|
|
47
46
|
"build": "yarn build:src",
|
|
48
47
|
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
|
|
48
|
+
"deploy:npm": "yarn npm publish",
|
|
49
49
|
"test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
|
|
50
50
|
"test:browser": "webex-legacy-tools test --integration --unit --runner karma",
|
|
51
51
|
"test:integration": "webex-legacy-tools test --integration --runner mocha",
|
|
52
52
|
"test:style": "eslint ./src/**/*.*",
|
|
53
53
|
"test:unit": "webex-legacy-tools test --unit --runner jest"
|
|
54
|
-
}
|
|
55
|
-
|
|
54
|
+
},
|
|
55
|
+
"version": "2.59.3-next.1"
|
|
56
|
+
}
|
package/process
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {browser: true};
|
|
1
|
+
module.exports = {browser: true};
|
package/src/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
team: {},
|
|
7
|
-
};
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
team: {},
|
|
7
|
+
};
|
package/src/index.js
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import '@webex/internal-plugin-conversation';
|
|
6
|
-
import '@webex/internal-plugin-user';
|
|
7
|
-
import '@webex/internal-plugin-encryption';
|
|
8
|
-
import {isArray, has, get} from 'lodash';
|
|
9
|
-
import {registerInternalPlugin} from '@webex/webex-core';
|
|
10
|
-
|
|
11
|
-
import Team from './team';
|
|
12
|
-
import config from './config';
|
|
13
|
-
|
|
14
|
-
registerInternalPlugin('team', Team, {
|
|
15
|
-
payloadTransformer: {
|
|
16
|
-
predicates: [
|
|
17
|
-
{
|
|
18
|
-
name: 'decryptTeamRoomStatus',
|
|
19
|
-
direction: 'inbound',
|
|
20
|
-
test(ctx, optionsOrResponse) {
|
|
21
|
-
return Promise.resolve(
|
|
22
|
-
has(optionsOrResponse, 'activity.object.activityEvent') &&
|
|
23
|
-
get(optionsOrResponse, 'activity.object.objectType') === 'teamRoomStatus'
|
|
24
|
-
);
|
|
25
|
-
},
|
|
26
|
-
extract(optionsOrResponse) {
|
|
27
|
-
return Promise.resolve(optionsOrResponse.activity.object);
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
transforms: [
|
|
32
|
-
{
|
|
33
|
-
name: 'decryptTeam',
|
|
34
|
-
direction: 'inbound',
|
|
35
|
-
fn(ctx, key, team) {
|
|
36
|
-
const promises = [];
|
|
37
|
-
|
|
38
|
-
if (team.conversations.items) {
|
|
39
|
-
promises.push(
|
|
40
|
-
Promise.all(
|
|
41
|
-
team.conversations.items.map((item) => ctx.transform('decryptObject', null, item))
|
|
42
|
-
)
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const usableKey = team.encryptionKeyUrl || key;
|
|
47
|
-
|
|
48
|
-
if (usableKey) {
|
|
49
|
-
promises.push(ctx.transform('decryptPropDisplayName', usableKey, team));
|
|
50
|
-
promises.push(ctx.transform('decryptPropSummary', usableKey, team));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return Promise.all(promises);
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: 'decryptTeamRoomStatus',
|
|
58
|
-
direction: 'inbound',
|
|
59
|
-
fn(ctx, teamRoomStatus) {
|
|
60
|
-
const keyUrl = get(teamRoomStatus, 'activityEvent.encryptionKeyUrl');
|
|
61
|
-
|
|
62
|
-
return ctx.transform('decryptObject', keyUrl, teamRoomStatus.activityEvent);
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'decryptPropSummary',
|
|
67
|
-
direction: 'inbound',
|
|
68
|
-
fn(ctx, key, team) {
|
|
69
|
-
return ctx.transform('decryptTextProp', 'summary', key, team);
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'encryptTeam',
|
|
74
|
-
direction: 'outbound',
|
|
75
|
-
fn(ctx, key, team) {
|
|
76
|
-
if (key === false) {
|
|
77
|
-
return Promise.resolve();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return Promise.resolve(
|
|
81
|
-
key || ctx.webex.internal.encryption.kms.createUnboundKeys({count: 1})
|
|
82
|
-
).then((keys) => {
|
|
83
|
-
const k = isArray(keys) ? keys[0] : keys;
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
team.kmsMessage &&
|
|
87
|
-
team.kmsMessage.keyUris &&
|
|
88
|
-
!team.kmsMessage.keyUris.includes(k.uri)
|
|
89
|
-
) {
|
|
90
|
-
team.kmsMessage.keyUris.push(k.uri);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return Promise.all([
|
|
94
|
-
ctx.transform('encryptPropDisplayName', k, team),
|
|
95
|
-
ctx.transform('encryptPropSummary', k, team),
|
|
96
|
-
]).then(() => {
|
|
97
|
-
team.encryptionKeyUrl = k.uri || k;
|
|
98
|
-
|
|
99
|
-
// we only want to set the defaultActivityEncryptionKeyUrl if we've
|
|
100
|
-
// bound a new key
|
|
101
|
-
if (!key) {
|
|
102
|
-
team.defaultActivityEncryptionKeyUrl =
|
|
103
|
-
team.defaultActivityEncryptionKeyUrl || k.uri || k;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: 'encryptPropSummary',
|
|
111
|
-
direction: 'outbound',
|
|
112
|
-
fn(ctx, key, team) {
|
|
113
|
-
return ctx.transform('encryptTextProp', 'summary', key, team);
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: 'normalizeTeam',
|
|
118
|
-
fn(ctx, team) {
|
|
119
|
-
team.conversations = team.conversations || {};
|
|
120
|
-
team.conversations.items = team.conversations.items || [];
|
|
121
|
-
team.teamMembers = team.teamMembers || {};
|
|
122
|
-
team.teamMembers.items = team.teamMembers.items || [];
|
|
123
|
-
|
|
124
|
-
return Promise.all([
|
|
125
|
-
Promise.all(
|
|
126
|
-
team.conversations.items.map((item) => ctx.transform('normalizeObject', item))
|
|
127
|
-
),
|
|
128
|
-
Promise.all(
|
|
129
|
-
team.teamMembers.items.map((item) => ctx.transform('normalizeObject', item))
|
|
130
|
-
),
|
|
131
|
-
]);
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
},
|
|
136
|
-
config,
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
export {default} from './team';
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@webex/internal-plugin-conversation';
|
|
6
|
+
import '@webex/internal-plugin-user';
|
|
7
|
+
import '@webex/internal-plugin-encryption';
|
|
8
|
+
import {isArray, has, get} from 'lodash';
|
|
9
|
+
import {registerInternalPlugin} from '@webex/webex-core';
|
|
10
|
+
|
|
11
|
+
import Team from './team';
|
|
12
|
+
import config from './config';
|
|
13
|
+
|
|
14
|
+
registerInternalPlugin('team', Team, {
|
|
15
|
+
payloadTransformer: {
|
|
16
|
+
predicates: [
|
|
17
|
+
{
|
|
18
|
+
name: 'decryptTeamRoomStatus',
|
|
19
|
+
direction: 'inbound',
|
|
20
|
+
test(ctx, optionsOrResponse) {
|
|
21
|
+
return Promise.resolve(
|
|
22
|
+
has(optionsOrResponse, 'activity.object.activityEvent') &&
|
|
23
|
+
get(optionsOrResponse, 'activity.object.objectType') === 'teamRoomStatus'
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
extract(optionsOrResponse) {
|
|
27
|
+
return Promise.resolve(optionsOrResponse.activity.object);
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
transforms: [
|
|
32
|
+
{
|
|
33
|
+
name: 'decryptTeam',
|
|
34
|
+
direction: 'inbound',
|
|
35
|
+
fn(ctx, key, team) {
|
|
36
|
+
const promises = [];
|
|
37
|
+
|
|
38
|
+
if (team.conversations.items) {
|
|
39
|
+
promises.push(
|
|
40
|
+
Promise.all(
|
|
41
|
+
team.conversations.items.map((item) => ctx.transform('decryptObject', null, item))
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const usableKey = team.encryptionKeyUrl || key;
|
|
47
|
+
|
|
48
|
+
if (usableKey) {
|
|
49
|
+
promises.push(ctx.transform('decryptPropDisplayName', usableKey, team));
|
|
50
|
+
promises.push(ctx.transform('decryptPropSummary', usableKey, team));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return Promise.all(promises);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'decryptTeamRoomStatus',
|
|
58
|
+
direction: 'inbound',
|
|
59
|
+
fn(ctx, teamRoomStatus) {
|
|
60
|
+
const keyUrl = get(teamRoomStatus, 'activityEvent.encryptionKeyUrl');
|
|
61
|
+
|
|
62
|
+
return ctx.transform('decryptObject', keyUrl, teamRoomStatus.activityEvent);
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'decryptPropSummary',
|
|
67
|
+
direction: 'inbound',
|
|
68
|
+
fn(ctx, key, team) {
|
|
69
|
+
return ctx.transform('decryptTextProp', 'summary', key, team);
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'encryptTeam',
|
|
74
|
+
direction: 'outbound',
|
|
75
|
+
fn(ctx, key, team) {
|
|
76
|
+
if (key === false) {
|
|
77
|
+
return Promise.resolve();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return Promise.resolve(
|
|
81
|
+
key || ctx.webex.internal.encryption.kms.createUnboundKeys({count: 1})
|
|
82
|
+
).then((keys) => {
|
|
83
|
+
const k = isArray(keys) ? keys[0] : keys;
|
|
84
|
+
|
|
85
|
+
if (
|
|
86
|
+
team.kmsMessage &&
|
|
87
|
+
team.kmsMessage.keyUris &&
|
|
88
|
+
!team.kmsMessage.keyUris.includes(k.uri)
|
|
89
|
+
) {
|
|
90
|
+
team.kmsMessage.keyUris.push(k.uri);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return Promise.all([
|
|
94
|
+
ctx.transform('encryptPropDisplayName', k, team),
|
|
95
|
+
ctx.transform('encryptPropSummary', k, team),
|
|
96
|
+
]).then(() => {
|
|
97
|
+
team.encryptionKeyUrl = k.uri || k;
|
|
98
|
+
|
|
99
|
+
// we only want to set the defaultActivityEncryptionKeyUrl if we've
|
|
100
|
+
// bound a new key
|
|
101
|
+
if (!key) {
|
|
102
|
+
team.defaultActivityEncryptionKeyUrl =
|
|
103
|
+
team.defaultActivityEncryptionKeyUrl || k.uri || k;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'encryptPropSummary',
|
|
111
|
+
direction: 'outbound',
|
|
112
|
+
fn(ctx, key, team) {
|
|
113
|
+
return ctx.transform('encryptTextProp', 'summary', key, team);
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'normalizeTeam',
|
|
118
|
+
fn(ctx, team) {
|
|
119
|
+
team.conversations = team.conversations || {};
|
|
120
|
+
team.conversations.items = team.conversations.items || [];
|
|
121
|
+
team.teamMembers = team.teamMembers || {};
|
|
122
|
+
team.teamMembers.items = team.teamMembers.items || [];
|
|
123
|
+
|
|
124
|
+
return Promise.all([
|
|
125
|
+
Promise.all(
|
|
126
|
+
team.conversations.items.map((item) => ctx.transform('normalizeObject', item))
|
|
127
|
+
),
|
|
128
|
+
Promise.all(
|
|
129
|
+
team.teamMembers.items.map((item) => ctx.transform('normalizeObject', item))
|
|
130
|
+
),
|
|
131
|
+
]);
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
config,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export {default} from './team';
|