@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.
Files changed (48) hide show
  1. package/.eslintrc.js +6 -6
  2. package/README.md +47 -47
  3. package/babel.config.js +3 -3
  4. package/dist/activities.js +4 -4
  5. package/dist/activities.js.map +1 -1
  6. package/dist/activity-thread-ordering.js +34 -34
  7. package/dist/activity-thread-ordering.js.map +1 -1
  8. package/dist/config.js +12 -12
  9. package/dist/config.js.map +1 -1
  10. package/dist/constants.js.map +1 -1
  11. package/dist/conversation.js +474 -474
  12. package/dist/conversation.js.map +1 -1
  13. package/dist/convo-error.js +4 -4
  14. package/dist/convo-error.js.map +1 -1
  15. package/dist/decryption-transforms.js +155 -155
  16. package/dist/decryption-transforms.js.map +1 -1
  17. package/dist/encryption-transforms.js.map +1 -1
  18. package/dist/index.js +2 -2
  19. package/dist/index.js.map +1 -1
  20. package/dist/share-activity.js +57 -57
  21. package/dist/share-activity.js.map +1 -1
  22. package/dist/to-array.js +7 -7
  23. package/dist/to-array.js.map +1 -1
  24. package/jest.config.js +3 -3
  25. package/package.json +21 -20
  26. package/process +1 -1
  27. package/src/activities.js +157 -157
  28. package/src/activity-thread-ordering.js +283 -283
  29. package/src/activity-threading.md +282 -282
  30. package/src/config.js +37 -37
  31. package/src/constants.js +3 -3
  32. package/src/conversation.js +2535 -2535
  33. package/src/convo-error.js +15 -15
  34. package/src/decryption-transforms.js +541 -541
  35. package/src/encryption-transforms.js +345 -345
  36. package/src/index.js +327 -327
  37. package/src/share-activity.js +436 -436
  38. package/src/to-array.js +29 -29
  39. package/test/integration/spec/create.js +290 -290
  40. package/test/integration/spec/encryption.js +333 -333
  41. package/test/integration/spec/get.js +1255 -1255
  42. package/test/integration/spec/mercury.js +94 -94
  43. package/test/integration/spec/share.js +537 -537
  44. package/test/integration/spec/verbs.js +1041 -1041
  45. package/test/unit/spec/conversation.js +823 -823
  46. package/test/unit/spec/decrypt-transforms.js +460 -460
  47. package/test/unit/spec/encryption-transforms.js +93 -93
  48. 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
+ });