@webex/internal-plugin-conversation 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 +47 -47
- package/babel.config.js +3 -3
- package/dist/activities.js +4 -4
- package/dist/activities.js.map +1 -1
- package/dist/activity-thread-ordering.js +34 -34
- package/dist/activity-thread-ordering.js.map +1 -1
- package/dist/config.js +12 -12
- package/dist/config.js.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/conversation.js +474 -474
- package/dist/conversation.js.map +1 -1
- package/dist/convo-error.js +4 -4
- package/dist/convo-error.js.map +1 -1
- package/dist/decryption-transforms.js +155 -155
- package/dist/decryption-transforms.js.map +1 -1
- package/dist/encryption-transforms.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/share-activity.js +57 -57
- package/dist/share-activity.js.map +1 -1
- package/dist/to-array.js +7 -7
- package/dist/to-array.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +21 -20
- package/process +1 -1
- package/src/activities.js +157 -157
- package/src/activity-thread-ordering.js +283 -283
- package/src/activity-threading.md +282 -282
- package/src/config.js +37 -37
- package/src/constants.js +3 -3
- package/src/conversation.js +2535 -2535
- package/src/convo-error.js +15 -15
- package/src/decryption-transforms.js +541 -541
- package/src/encryption-transforms.js +345 -345
- package/src/index.js +327 -327
- package/src/share-activity.js +436 -436
- package/src/to-array.js +29 -29
- package/test/integration/spec/create.js +290 -290
- package/test/integration/spec/encryption.js +333 -333
- package/test/integration/spec/get.js +1255 -1255
- package/test/integration/spec/mercury.js +94 -94
- package/test/integration/spec/share.js +537 -537
- package/test/integration/spec/verbs.js +1041 -1041
- package/test/unit/spec/conversation.js +823 -823
- package/test/unit/spec/decrypt-transforms.js +460 -460
- package/test/unit/spec/encryption-transforms.js +93 -93
- package/test/unit/spec/share-activity.js +178 -178
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import '@webex/internal-plugin-conversation';
|
|
6
|
-
|
|
7
|
-
import WebexCore from '@webex/webex-core';
|
|
8
|
-
import {assert} from '@webex/test-helper-chai';
|
|
9
|
-
import testUsers from '@webex/test-helper-test-users';
|
|
10
|
-
import uuid from 'uuid';
|
|
11
|
-
|
|
12
|
-
describe('plugin-conversation', function () {
|
|
13
|
-
this.timeout(30000);
|
|
14
|
-
describe('mercury processing', () => {
|
|
15
|
-
let kirk, mccoy, participants, webex;
|
|
16
|
-
|
|
17
|
-
before(() =>
|
|
18
|
-
testUsers.create({count: 3}).then((users) => {
|
|
19
|
-
[kirk, mccoy] = participants = users;
|
|
20
|
-
|
|
21
|
-
webex = new WebexCore({
|
|
22
|
-
credentials: {
|
|
23
|
-
authorization: mccoy.token,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
kirk.webex = new WebexCore({
|
|
28
|
-
credentials: {
|
|
29
|
-
authorization: kirk.token,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return Promise.all([
|
|
34
|
-
webex.internal.mercury.connect(),
|
|
35
|
-
kirk.webex.internal.mercury.connect(),
|
|
36
|
-
]);
|
|
37
|
-
})
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
after(() =>
|
|
41
|
-
Promise.all([
|
|
42
|
-
webex && webex.internal.mercury.disconnect(),
|
|
43
|
-
kirk && kirk.webex.internal.mercury.disconnect(),
|
|
44
|
-
])
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
let conversation;
|
|
48
|
-
|
|
49
|
-
beforeEach(() => {
|
|
50
|
-
if (conversation) {
|
|
51
|
-
return Promise.resolve();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return webex.internal.conversation.create({participants}).then((c) => {
|
|
55
|
-
conversation = c;
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
describe('when an activity is received', () => {
|
|
60
|
-
it('is decrypted and normalized', () => {
|
|
61
|
-
const clientTempId = uuid.v4();
|
|
62
|
-
const promise = new Promise((resolve) => {
|
|
63
|
-
kirk.webex.internal.mercury.on('event:conversation.activity', (event) => {
|
|
64
|
-
if (event.data.activity.clientTempId === clientTempId) {
|
|
65
|
-
resolve(event);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const message = "Dammit Jim, I'm a Doctor not a brick-layer!";
|
|
71
|
-
|
|
72
|
-
webex.internal.conversation.post(
|
|
73
|
-
conversation,
|
|
74
|
-
{
|
|
75
|
-
displayName: message,
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
clientTempId,
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
return promise.then((event) => {
|
|
83
|
-
assert.isActivity(event.data.activity);
|
|
84
|
-
assert.isEncryptedActivity(event.data.activity);
|
|
85
|
-
assert.equal(
|
|
86
|
-
event.data.activity.encryptionKeyUrl,
|
|
87
|
-
conversation.defaultActivityEncryptionKeyUrl
|
|
88
|
-
);
|
|
89
|
-
assert.equal(event.data.activity.object.displayName, message);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@webex/internal-plugin-conversation';
|
|
6
|
+
|
|
7
|
+
import WebexCore from '@webex/webex-core';
|
|
8
|
+
import {assert} from '@webex/test-helper-chai';
|
|
9
|
+
import testUsers from '@webex/test-helper-test-users';
|
|
10
|
+
import uuid from 'uuid';
|
|
11
|
+
|
|
12
|
+
describe('plugin-conversation', function () {
|
|
13
|
+
this.timeout(30000);
|
|
14
|
+
describe('mercury processing', () => {
|
|
15
|
+
let kirk, mccoy, participants, webex;
|
|
16
|
+
|
|
17
|
+
before(() =>
|
|
18
|
+
testUsers.create({count: 3}).then((users) => {
|
|
19
|
+
[kirk, mccoy] = participants = users;
|
|
20
|
+
|
|
21
|
+
webex = new WebexCore({
|
|
22
|
+
credentials: {
|
|
23
|
+
authorization: mccoy.token,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
kirk.webex = new WebexCore({
|
|
28
|
+
credentials: {
|
|
29
|
+
authorization: kirk.token,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return Promise.all([
|
|
34
|
+
webex.internal.mercury.connect(),
|
|
35
|
+
kirk.webex.internal.mercury.connect(),
|
|
36
|
+
]);
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
after(() =>
|
|
41
|
+
Promise.all([
|
|
42
|
+
webex && webex.internal.mercury.disconnect(),
|
|
43
|
+
kirk && kirk.webex.internal.mercury.disconnect(),
|
|
44
|
+
])
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
let conversation;
|
|
48
|
+
|
|
49
|
+
beforeEach(() => {
|
|
50
|
+
if (conversation) {
|
|
51
|
+
return Promise.resolve();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return webex.internal.conversation.create({participants}).then((c) => {
|
|
55
|
+
conversation = c;
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('when an activity is received', () => {
|
|
60
|
+
it('is decrypted and normalized', () => {
|
|
61
|
+
const clientTempId = uuid.v4();
|
|
62
|
+
const promise = new Promise((resolve) => {
|
|
63
|
+
kirk.webex.internal.mercury.on('event:conversation.activity', (event) => {
|
|
64
|
+
if (event.data.activity.clientTempId === clientTempId) {
|
|
65
|
+
resolve(event);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const message = "Dammit Jim, I'm a Doctor not a brick-layer!";
|
|
71
|
+
|
|
72
|
+
webex.internal.conversation.post(
|
|
73
|
+
conversation,
|
|
74
|
+
{
|
|
75
|
+
displayName: message,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
clientTempId,
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
return promise.then((event) => {
|
|
83
|
+
assert.isActivity(event.data.activity);
|
|
84
|
+
assert.isEncryptedActivity(event.data.activity);
|
|
85
|
+
assert.equal(
|
|
86
|
+
event.data.activity.encryptionKeyUrl,
|
|
87
|
+
conversation.defaultActivityEncryptionKeyUrl
|
|
88
|
+
);
|
|
89
|
+
assert.equal(event.data.activity.object.displayName, message);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|