@webex/internal-plugin-conversation 3.0.0-beta.9 → 3.0.0-bnr.2
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/activities.js +8 -69
- package/dist/activities.js.map +1 -1
- package/dist/activity-thread-ordering.js +19 -79
- package/dist/activity-thread-ordering.js.map +1 -1
- package/dist/config.js +1 -7
- package/dist/config.js.map +1 -1
- package/dist/constants.js +4 -5
- package/dist/constants.js.map +1 -1
- package/dist/conversation.js +790 -1199
- package/dist/conversation.js.map +1 -1
- package/dist/convo-error.js +0 -23
- package/dist/convo-error.js.map +1 -1
- package/dist/decryption-transforms.js +35 -98
- package/dist/decryption-transforms.js.map +1 -1
- package/dist/encryption-transforms.js +11 -48
- package/dist/encryption-transforms.js.map +1 -1
- package/dist/index.js +7 -50
- package/dist/index.js.map +1 -1
- package/dist/internal-plugin-conversation.d.ts +21 -0
- package/dist/share-activity.js +40 -106
- package/dist/share-activity.js.map +1 -1
- package/dist/to-array.js +9 -11
- package/dist/to-array.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/activities.d.ts +32 -0
- package/dist/types/activity-thread-ordering.d.ts +18 -0
- package/dist/types/config.d.ts +19 -0
- package/dist/types/constants.d.ts +5 -0
- package/dist/types/conversation.d.ts +2 -0
- package/dist/types/convo-error.d.ts +10 -0
- package/dist/types/decryption-transforms.d.ts +1 -0
- package/dist/types/encryption-transforms.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/share-activity.d.ts +7 -0
- package/dist/types/to-array.d.ts +9 -0
- package/package.json +15 -15
- package/src/activities.js +10 -7
- package/src/activity-thread-ordering.js +27 -30
- package/src/activity-threading.md +68 -49
- package/src/config.js +5 -5
- package/src/conversation.js +621 -589
- package/src/decryption-transforms.js +103 -62
- package/src/encryption-transforms.js +103 -83
- package/src/index.js +82 -66
- package/src/share-activity.js +64 -55
- package/src/to-array.js +2 -2
- package/test/integration/spec/create.js +184 -118
- package/test/integration/spec/encryption.js +250 -186
- package/test/integration/spec/get.js +761 -513
- package/test/integration/spec/mercury.js +37 -27
- package/test/integration/spec/share.js +292 -229
- package/test/integration/spec/verbs.js +628 -441
- package/test/unit/spec/conversation.js +265 -163
- package/test/unit/spec/decrypt-transforms.js +112 -131
- package/test/unit/spec/encryption-transforms.js +24 -18
- package/test/unit/spec/share-activity.js +37 -40
|
@@ -14,11 +14,11 @@ describe('plugin-conversation', () => {
|
|
|
14
14
|
const transformStub = sinon.stub();
|
|
15
15
|
|
|
16
16
|
const ctx = {
|
|
17
|
-
transform: transformStub
|
|
17
|
+
transform: transformStub,
|
|
18
18
|
};
|
|
19
19
|
const key = null;
|
|
20
20
|
const activity = {
|
|
21
|
-
objectType: 'microappInstance'
|
|
21
|
+
objectType: 'microappInstance',
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
transform.fn(ctx, key, activity);
|
|
@@ -33,12 +33,14 @@ describe('plugin-conversation', () => {
|
|
|
33
33
|
const transformStub = sinon.stub();
|
|
34
34
|
|
|
35
35
|
const ctx = {
|
|
36
|
-
transform: transformStub
|
|
36
|
+
transform: transformStub,
|
|
37
37
|
};
|
|
38
38
|
const key = null;
|
|
39
39
|
const activity = {
|
|
40
40
|
objectType: 'comment',
|
|
41
|
-
cards: [
|
|
41
|
+
cards: [
|
|
42
|
+
'eyJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIn0..QQeWYBBB8H7MCnWm.6C-feMX3zp70t4VZNNrsFQRMpWSpByJFYXPOfTUeTXi6SNXvw0s2jVfHbLSBCyiOJCQxMtzNAbnWsqL0LC3HdEWbLee2DYVMLHLpLTleUKErgoIy3xvO6vbDcv3USaF4qq64m5fn2P5vJxNy96mtfghW8cDsWs22kUsA7uHkICrUICdMC2F6isuHTy9e-HTOl6L2tI5DNZHs2niD_-eq_om30NRlBN05AU33Biu6iVmBhH-AVLJfzvl6S5V7o8e61ppniuHJzGA-PVACTK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ZAEIuCRdOjXLuVLB8dJ3E0dXFRk5we8nQJ_oQwgKpMKDfMj5-eWau8VzOZxZNzKf-QVqtXnBxt_2cMv1rzgwZ3c8zjbUrTbamkCOQvsxgogBe36ySbsY1R1wQUfXSeJOgkLqbteDlrMthf5QEstJGm3BYJHFBFEYW-nSzEbiea0CEMNwWzOjAUvetdg5lKBXwT_dIiVa_ZRxofe6-v7fbXiZ15TE73GYlldtyYcY9js32rKHCN47BoBKYATM-njnymmN8Vts0znsRM53WAHr-27tJYQC46YMyPCJoajIFYmlcX8og9hRhvgR_WUWt1QcTyG1DUCpUiferYYC5j5ifU9Gv35JIFpCfOFti-H4eSyPY8N_EIC3Yf-dbCPK9qSJUu0Sfo7PzCybcC3HgbucQI8k3rK_l_9758hYoZR2fZh3gMlOSmNqVhO0a7-YwSv_bxpKvHOIyiIlAVFIsrGLvdal4tJbLq8kGwyYS8X60qK_l-8G4uJ8F7LBkUO6zn-6kxTi10woXqwPGyo5MBYyMKH7HGG67jKRuADJRqSis8RHolHt7LEhlimh6fIqPxBKmorq__TF4IYTGKgnyl41NM_r_XjC6QSLMgTBszXYPDI6CnUZrAl5GI09WCEOC4bKp98I2Qa3ssS2AlBIwwP6Z7oRsUg0om2FUr9kW4HSsv0kNMTbGa7fqlgbCRn1bGttU7W8EVwmBlCJw9v5RklkHbj9qpaNA4iyTCRxfHWyjIQkOA6jUfOaNIRZLHywaUEG-1yZ4bNFdTLjEQ_gvzQgg.jM6UaCTq9P_i4tKbkxrLrg',
|
|
43
|
+
],
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
transform.fn(ctx, key, activity);
|
|
@@ -52,11 +54,11 @@ describe('plugin-conversation', () => {
|
|
|
52
54
|
const transformStub = sinon.stub();
|
|
53
55
|
|
|
54
56
|
const ctx = {
|
|
55
|
-
transform: transformStub
|
|
57
|
+
transform: transformStub,
|
|
56
58
|
};
|
|
57
59
|
const key = null;
|
|
58
60
|
const microappInstance = {
|
|
59
|
-
model: 'Longencryptedstring'
|
|
61
|
+
model: 'Longencryptedstring',
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
transform.fn(ctx, key, microappInstance);
|
|
@@ -71,12 +73,12 @@ describe('plugin-conversation', () => {
|
|
|
71
73
|
const transformStub = sinon.stub();
|
|
72
74
|
|
|
73
75
|
const ctx = {
|
|
74
|
-
transform: transformStub
|
|
76
|
+
transform: transformStub,
|
|
75
77
|
};
|
|
76
78
|
const key = null;
|
|
77
79
|
const activity = {
|
|
78
80
|
objectType: 'conversation',
|
|
79
|
-
previous: {}
|
|
81
|
+
previous: {},
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
transform.fn(ctx, key, activity);
|
|
@@ -89,7 +91,7 @@ describe('plugin-conversation', () => {
|
|
|
89
91
|
const transformStub = sinon.spy();
|
|
90
92
|
|
|
91
93
|
const ctx = {
|
|
92
|
-
transform: transformStub
|
|
94
|
+
transform: transformStub,
|
|
93
95
|
};
|
|
94
96
|
const key = null;
|
|
95
97
|
const activity = {
|
|
@@ -100,16 +102,15 @@ describe('plugin-conversation', () => {
|
|
|
100
102
|
objectType: 'conversation',
|
|
101
103
|
previous: {
|
|
102
104
|
displayName: 'test123',
|
|
103
|
-
encryptionKeyUrl: 'keyUrl1'
|
|
104
|
-
}
|
|
105
|
-
}
|
|
105
|
+
encryptionKeyUrl: 'keyUrl1',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
106
108
|
};
|
|
107
109
|
|
|
108
|
-
return transform.fn(ctx, key, activity)
|
|
109
|
-
.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
110
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
111
|
+
assert.equal(transformStub.callCount, 1);
|
|
112
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
113
|
+
});
|
|
113
114
|
});
|
|
114
115
|
|
|
115
116
|
it('decrypts the activity object with a previousValue in the conversation', () => {
|
|
@@ -117,7 +118,7 @@ describe('plugin-conversation', () => {
|
|
|
117
118
|
const transformStub = sinon.spy();
|
|
118
119
|
|
|
119
120
|
const ctx = {
|
|
120
|
-
transform: transformStub
|
|
121
|
+
transform: transformStub,
|
|
121
122
|
};
|
|
122
123
|
const key = null;
|
|
123
124
|
const activity = {
|
|
@@ -128,16 +129,15 @@ describe('plugin-conversation', () => {
|
|
|
128
129
|
objectType: 'conversation',
|
|
129
130
|
previousValue: {
|
|
130
131
|
displayName: 'test123',
|
|
131
|
-
encryptionKeyUrl: 'keyUrl1'
|
|
132
|
-
}
|
|
133
|
-
}
|
|
132
|
+
encryptionKeyUrl: 'keyUrl1',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
134
135
|
};
|
|
135
136
|
|
|
136
|
-
return transform.fn(ctx, key, activity)
|
|
137
|
-
.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
});
|
|
137
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
138
|
+
assert.equal(transformStub.callCount, 1);
|
|
139
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
140
|
+
});
|
|
141
141
|
});
|
|
142
142
|
});
|
|
143
143
|
|
|
@@ -147,15 +147,17 @@ describe('plugin-conversation', () => {
|
|
|
147
147
|
const transformStub = sinon.stub();
|
|
148
148
|
|
|
149
149
|
const ctx = {
|
|
150
|
-
transform: transformStub
|
|
150
|
+
transform: transformStub,
|
|
151
151
|
};
|
|
152
152
|
|
|
153
153
|
const threadObject = {
|
|
154
154
|
childType: 'reply',
|
|
155
155
|
actorId: '123',
|
|
156
|
-
childActivities: [
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
childActivities: [
|
|
157
|
+
{
|
|
158
|
+
objectType: 'activity',
|
|
159
|
+
},
|
|
160
|
+
],
|
|
159
161
|
};
|
|
160
162
|
|
|
161
163
|
transform.fn(ctx, threadObject);
|
|
@@ -170,11 +172,11 @@ describe('plugin-conversation', () => {
|
|
|
170
172
|
const transformStub = sinon.stub();
|
|
171
173
|
|
|
172
174
|
const ctx = {
|
|
173
|
-
transform: transformStub
|
|
175
|
+
transform: transformStub,
|
|
174
176
|
};
|
|
175
177
|
const key = null;
|
|
176
178
|
const activity = {
|
|
177
|
-
objectType: 'reaction2Summary'
|
|
179
|
+
objectType: 'reaction2Summary',
|
|
178
180
|
};
|
|
179
181
|
|
|
180
182
|
transform.fn(ctx, key, activity);
|
|
@@ -187,7 +189,7 @@ describe('plugin-conversation', () => {
|
|
|
187
189
|
const transformStub = sinon.spy();
|
|
188
190
|
|
|
189
191
|
const ctx = {
|
|
190
|
-
transform: transformStub
|
|
192
|
+
transform: transformStub,
|
|
191
193
|
};
|
|
192
194
|
const key = null;
|
|
193
195
|
const activity = {
|
|
@@ -195,7 +197,7 @@ describe('plugin-conversation', () => {
|
|
|
195
197
|
verb: 'post',
|
|
196
198
|
encryptionKeyUrl: 'keyUrl1',
|
|
197
199
|
object: {
|
|
198
|
-
objectType: 'comment'
|
|
200
|
+
objectType: 'comment',
|
|
199
201
|
},
|
|
200
202
|
children: [
|
|
201
203
|
{
|
|
@@ -204,11 +206,8 @@ describe('plugin-conversation', () => {
|
|
|
204
206
|
encryptionKeyUrl: 'keyUrl1',
|
|
205
207
|
object: {
|
|
206
208
|
objectType: 'reaction2Summary',
|
|
207
|
-
reactions: [
|
|
208
|
-
|
|
209
|
-
{displayName: 'reaction2'}
|
|
210
|
-
]
|
|
211
|
-
}
|
|
209
|
+
reactions: [{displayName: 'reaction1'}, {displayName: 'reaction2'}],
|
|
210
|
+
},
|
|
212
211
|
},
|
|
213
212
|
{
|
|
214
213
|
verb: 'add',
|
|
@@ -216,24 +215,18 @@ describe('plugin-conversation', () => {
|
|
|
216
215
|
encryptionKeyUrl: 'keyUrl1',
|
|
217
216
|
object: {
|
|
218
217
|
objectType: 'reaction2Summary',
|
|
219
|
-
reactions: [
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
]
|
|
227
|
-
|
|
218
|
+
reactions: [{displayName: 'reaction1'}, {displayName: 'reaction2'}],
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
],
|
|
228
222
|
};
|
|
229
223
|
|
|
230
|
-
return transform.fn(ctx, key, activity)
|
|
231
|
-
.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
});
|
|
224
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
225
|
+
assert.equal(transformStub.callCount, 3); // once for the parents object and then once for each child
|
|
226
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
227
|
+
assert.equal(transformStub.getCall(1).args[0], 'decryptObject');
|
|
228
|
+
assert.equal(transformStub.getCall(2).args[0], 'decryptObject');
|
|
229
|
+
});
|
|
237
230
|
});
|
|
238
231
|
|
|
239
232
|
it('decrypts the reaction2Summary object and the reactions', () => {
|
|
@@ -241,24 +234,19 @@ describe('plugin-conversation', () => {
|
|
|
241
234
|
const transformStub = sinon.spy();
|
|
242
235
|
|
|
243
236
|
const ctx = {
|
|
244
|
-
transform: transformStub
|
|
237
|
+
transform: transformStub,
|
|
245
238
|
};
|
|
246
239
|
const key = null;
|
|
247
240
|
const activity = {
|
|
248
241
|
objectType: 'reaction2Summary',
|
|
249
|
-
reactions: [
|
|
250
|
-
{displayName: 'reaction1'},
|
|
251
|
-
{displayName: 'reaction2'}
|
|
252
|
-
]
|
|
253
|
-
|
|
242
|
+
reactions: [{displayName: 'reaction1'}, {displayName: 'reaction2'}],
|
|
254
243
|
};
|
|
255
244
|
|
|
256
|
-
return transform.fn(ctx, key, activity)
|
|
257
|
-
.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
});
|
|
245
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
246
|
+
assert.equal(transformStub.callCount, 2);
|
|
247
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptPropDisplayName');
|
|
248
|
+
assert.equal(transformStub.getCall(1).args[0], 'decryptPropDisplayName');
|
|
249
|
+
});
|
|
262
250
|
});
|
|
263
251
|
|
|
264
252
|
it('calls the correct method if a reaction2SelfSummary object is passed in', () => {
|
|
@@ -266,11 +254,11 @@ describe('plugin-conversation', () => {
|
|
|
266
254
|
const transformStub = sinon.stub();
|
|
267
255
|
|
|
268
256
|
const ctx = {
|
|
269
|
-
transform: transformStub
|
|
257
|
+
transform: transformStub,
|
|
270
258
|
};
|
|
271
259
|
const key = null;
|
|
272
260
|
const activity = {
|
|
273
|
-
objectType: 'reaction2SelfSummary'
|
|
261
|
+
objectType: 'reaction2SelfSummary',
|
|
274
262
|
};
|
|
275
263
|
|
|
276
264
|
transform.fn(ctx, key, activity);
|
|
@@ -283,11 +271,11 @@ describe('plugin-conversation', () => {
|
|
|
283
271
|
const transformStub = sinon.stub();
|
|
284
272
|
|
|
285
273
|
const ctx = {
|
|
286
|
-
transform: transformStub
|
|
274
|
+
transform: transformStub,
|
|
287
275
|
};
|
|
288
276
|
const key = null;
|
|
289
277
|
const activity = {
|
|
290
|
-
objectType: 'reaction2'
|
|
278
|
+
objectType: 'reaction2',
|
|
291
279
|
};
|
|
292
280
|
|
|
293
281
|
transform.fn(ctx, key, activity);
|
|
@@ -302,11 +290,11 @@ describe('plugin-conversation', () => {
|
|
|
302
290
|
const transformStub = sinon.stub();
|
|
303
291
|
|
|
304
292
|
const ctx = {
|
|
305
|
-
transform: transformStub
|
|
293
|
+
transform: transformStub,
|
|
306
294
|
};
|
|
307
295
|
const key = null;
|
|
308
296
|
const activity = {
|
|
309
|
-
objectType: 'content'
|
|
297
|
+
objectType: 'content',
|
|
310
298
|
};
|
|
311
299
|
|
|
312
300
|
transform.fn(ctx, key, activity);
|
|
@@ -319,12 +307,12 @@ describe('plugin-conversation', () => {
|
|
|
319
307
|
const transformStub = sinon.stub();
|
|
320
308
|
|
|
321
309
|
const ctx = {
|
|
322
|
-
transform: transformStub
|
|
310
|
+
transform: transformStub,
|
|
323
311
|
};
|
|
324
312
|
const key = null;
|
|
325
313
|
const activity = {
|
|
326
314
|
objectType: 'content',
|
|
327
|
-
contentCategory: 'links'
|
|
315
|
+
contentCategory: 'links',
|
|
328
316
|
};
|
|
329
317
|
|
|
330
318
|
transform.fn(ctx, key, activity);
|
|
@@ -337,25 +325,22 @@ describe('plugin-conversation', () => {
|
|
|
337
325
|
const transformStub = sinon.spy();
|
|
338
326
|
|
|
339
327
|
const ctx = {
|
|
340
|
-
transform: transformStub
|
|
328
|
+
transform: transformStub,
|
|
341
329
|
};
|
|
342
330
|
const key = null;
|
|
343
331
|
const activity = {
|
|
344
332
|
objectType: 'content',
|
|
345
333
|
contentCategory: 'links',
|
|
346
334
|
links: {
|
|
347
|
-
items: [
|
|
348
|
-
|
|
349
|
-
]
|
|
350
|
-
}
|
|
335
|
+
items: [{item1: 'item1'}],
|
|
336
|
+
},
|
|
351
337
|
};
|
|
352
338
|
|
|
353
|
-
return transform.fn(ctx, key, activity)
|
|
354
|
-
.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
});
|
|
339
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
340
|
+
assert.equal(transformStub.callCount, 2);
|
|
341
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
342
|
+
assert.equal(transformStub.getCall(1).args[0], 'decryptComment');
|
|
343
|
+
});
|
|
359
344
|
});
|
|
360
345
|
|
|
361
346
|
it('decrypts a link object', () => {
|
|
@@ -363,25 +348,22 @@ describe('plugin-conversation', () => {
|
|
|
363
348
|
const transformStub = sinon.spy();
|
|
364
349
|
|
|
365
350
|
const ctx = {
|
|
366
|
-
transform: transformStub
|
|
351
|
+
transform: transformStub,
|
|
367
352
|
};
|
|
368
353
|
const key = null;
|
|
369
354
|
const activity = {
|
|
370
355
|
objectType: 'content',
|
|
371
356
|
contentCategory: 'links',
|
|
372
357
|
links: {
|
|
373
|
-
items: [
|
|
374
|
-
|
|
375
|
-
]
|
|
376
|
-
}
|
|
358
|
+
items: [{item1: 'item1'}],
|
|
359
|
+
},
|
|
377
360
|
};
|
|
378
361
|
|
|
379
|
-
return transform.fn(ctx, key, activity)
|
|
380
|
-
.
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
});
|
|
362
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
363
|
+
assert.equal(transformStub.callCount, 2);
|
|
364
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptPropSslr');
|
|
365
|
+
assert.equal(transformStub.getCall(1).args[0], 'decryptPropDisplayName');
|
|
366
|
+
});
|
|
385
367
|
});
|
|
386
368
|
|
|
387
369
|
it('decrypts an sslr', () => {
|
|
@@ -395,29 +377,26 @@ describe('plugin-conversation', () => {
|
|
|
395
377
|
webex: {
|
|
396
378
|
internal: {
|
|
397
379
|
encryption: {
|
|
398
|
-
decryptScr: transformStub
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
380
|
+
decryptScr: transformStub,
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
},
|
|
402
384
|
};
|
|
403
385
|
const key = null;
|
|
404
386
|
const activity = {
|
|
405
387
|
objectType: 'content',
|
|
406
388
|
contentCategory: 'links',
|
|
407
389
|
links: {
|
|
408
|
-
items: [
|
|
409
|
-
{item1: 'item1'}
|
|
410
|
-
]
|
|
390
|
+
items: [{item1: 'item1'}],
|
|
411
391
|
},
|
|
412
|
-
sslr: ORIG_SSLR
|
|
392
|
+
sslr: ORIG_SSLR,
|
|
413
393
|
};
|
|
414
394
|
|
|
415
|
-
return transform.fn(ctx, key, activity)
|
|
416
|
-
.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
});
|
|
395
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
396
|
+
assert.equal(transformStub.callCount, 1);
|
|
397
|
+
assert.equal(transformStub.getCall(0).args[1], ORIG_SSLR);
|
|
398
|
+
assert.equal(activity.sslr, DECRYPTED_SSLR);
|
|
399
|
+
});
|
|
421
400
|
});
|
|
422
401
|
|
|
423
402
|
describe('meeting containers', () => {
|
|
@@ -425,53 +404,55 @@ describe('plugin-conversation', () => {
|
|
|
425
404
|
const transform = transforms.find((t) => t.name === 'decryptMeetingcontainer');
|
|
426
405
|
const transformStub = sinon.spy();
|
|
427
406
|
const ctx = {
|
|
428
|
-
transform: transformStub
|
|
407
|
+
transform: transformStub,
|
|
429
408
|
};
|
|
430
409
|
const key = null;
|
|
431
410
|
const meetingContainer = {
|
|
432
411
|
id: 'd5416be0-aeb9-11ec-bac4-ad7fbcfb8ba2',
|
|
433
412
|
objectType: 'meetingContainer',
|
|
434
|
-
displayName:
|
|
413
|
+
displayName:
|
|
414
|
+
'eyJraWQiOiJrbXM6XC9cL2ttcy1jaXNjby53YngyLmNvbVwva2V5c1wvYjhjOTg1MTYtNmY0OS00Zjk2LThhMmEtZGIxOTc2ZTAwYTk5IiwiZW5jIjoiQTI1NkdDTSIsImFsZyI6ImRpciJ9..H-Ef6wjRGeolqSTJ.xZUwyy5VnKPGdsWDCg0T1A.3Vrx_z7Z0Z2NlnNr3vf43A',
|
|
435
415
|
};
|
|
436
416
|
|
|
437
|
-
return transform.fn(ctx, key, meetingContainer)
|
|
438
|
-
.
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
});
|
|
417
|
+
return transform.fn(ctx, key, meetingContainer).then(() => {
|
|
418
|
+
assert.equal(transformStub.callCount, 1); // once for the parents object and then once for each child
|
|
419
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptPropDisplayName');
|
|
420
|
+
});
|
|
442
421
|
});
|
|
443
422
|
|
|
444
423
|
it('decrypts a meeting container activity with display name and extension with recording', () => {
|
|
445
424
|
const transform = transforms.find((t) => t.name === 'decryptMeetingcontainer');
|
|
446
425
|
const transformStub = sinon.spy();
|
|
447
426
|
const ctx = {
|
|
448
|
-
transform: transformStub
|
|
427
|
+
transform: transformStub,
|
|
449
428
|
};
|
|
450
429
|
const key = null;
|
|
451
430
|
const meetingContainer = {
|
|
452
431
|
id: 'd5416be0-aeb9-11ec-bac4-ad7fbcfb8ba2',
|
|
453
432
|
objectType: 'meetingContainer',
|
|
454
|
-
displayName:
|
|
433
|
+
displayName:
|
|
434
|
+
'eyJraWQiOiJrbXM6XC9cL2ttcy1jaXNjby53YngyLmNvbVwva2V5c1wvYjhjOTg1MTYtNmY0OS00Zjk2LThhMmEtZGIxOTc2ZTAwYTk5IiwiZW5jIjoiQTI1NkdDTSIsImFsZyI6ImRpciJ9..H-Ef6wjRGeolqSTJ.xZUwyy5VnKPGdsWDCg0T1A.3Vrx_z7Z0Z2NlnNr3vf43A',
|
|
455
435
|
extensions: {
|
|
456
436
|
items: [
|
|
457
437
|
{
|
|
458
438
|
data: {
|
|
459
439
|
id: '6a055bbe96aa103a9afd005056818248',
|
|
460
440
|
objectType: 'recording',
|
|
461
|
-
topic:
|
|
441
|
+
topic:
|
|
442
|
+
'eyJraWQiOiJrbXM6XC9cL2ttcy1jaXNjby53YngyLmNvbVwva2V5c1wvOTAwYjUwZmMtYzg0Yi00YTM4LTk0MGQtYWJjM2IyNjJiMWUyIiwiZW5jIjoiQTI1NkdDTSIsImFsZyI6ImRpciJ9..5LXICENQ0AvplBc4.yUlXzF86eyP9sZR75l6spOtAaEwYWIzRx2N-kWZQLVB2JwudN2U.-DWv7fce_Ac2K_l5QryDCQ',
|
|
462
443
|
},
|
|
463
|
-
encryptionKeyUrl:
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
444
|
+
encryptionKeyUrl:
|
|
445
|
+
'kms://kms-cisco.wbx2.com/keys/900b50fc-c84b-4a38-940d-abc3b262b1e2',
|
|
446
|
+
},
|
|
447
|
+
],
|
|
448
|
+
},
|
|
467
449
|
};
|
|
468
450
|
|
|
469
|
-
return transform.fn(ctx, key, meetingContainer)
|
|
470
|
-
.
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
});
|
|
451
|
+
return transform.fn(ctx, key, meetingContainer).then(() => {
|
|
452
|
+
assert.equal(transformStub.callCount, 2); // once for the parents object and then once for each child
|
|
453
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptPropDisplayName');
|
|
454
|
+
assert.equal(transformStub.getCall(1).args[0], 'decryptPropTopic');
|
|
455
|
+
});
|
|
475
456
|
});
|
|
476
457
|
});
|
|
477
458
|
});
|
|
@@ -7,7 +7,6 @@ import {assert} from '@webex/test-helper-chai';
|
|
|
7
7
|
|
|
8
8
|
import {transforms} from '@webex/internal-plugin-conversation/src/encryption-transforms';
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
describe('plugin-conversation', () => {
|
|
12
11
|
describe('encryption transforms', () => {
|
|
13
12
|
describe('encryptActivity()', () => {
|
|
@@ -15,23 +14,26 @@ describe('plugin-conversation', () => {
|
|
|
15
14
|
const transform = transforms.find((t) => t.name === 'encryptActivity');
|
|
16
15
|
|
|
17
16
|
const ctx = {
|
|
18
|
-
transform
|
|
17
|
+
transform,
|
|
19
18
|
};
|
|
20
19
|
const key = null;
|
|
21
20
|
const activity = {
|
|
22
21
|
object: {
|
|
23
|
-
created: 'True'
|
|
22
|
+
created: 'True',
|
|
24
23
|
},
|
|
25
24
|
objectType: 'activity',
|
|
26
|
-
verb: 'update'
|
|
25
|
+
verb: 'update',
|
|
27
26
|
};
|
|
28
27
|
|
|
29
28
|
// should just resolve immediately and return nothing
|
|
30
|
-
transform
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
transform
|
|
30
|
+
.fn(ctx, key, activity)
|
|
31
|
+
.then((result) => {
|
|
32
|
+
assert.equal(undefined, result, 'should just return nothing');
|
|
33
|
+
})
|
|
34
|
+
.catch(() => {
|
|
35
|
+
assert.equal(false, true, 'something unexpected happened');
|
|
36
|
+
});
|
|
35
37
|
});
|
|
36
38
|
|
|
37
39
|
it('does transfom when created is not True', async () => {
|
|
@@ -39,15 +41,15 @@ describe('plugin-conversation', () => {
|
|
|
39
41
|
const transformStub = sinon.stub().resolves();
|
|
40
42
|
|
|
41
43
|
const ctx = {
|
|
42
|
-
transform: transformStub
|
|
44
|
+
transform: transformStub,
|
|
43
45
|
};
|
|
44
46
|
const key = null;
|
|
45
47
|
const activity = {
|
|
46
48
|
object: {
|
|
47
|
-
created: 'false'
|
|
49
|
+
created: 'false',
|
|
48
50
|
},
|
|
49
51
|
objectType: 'activity',
|
|
50
|
-
verb: 'update'
|
|
52
|
+
verb: 'update',
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
// should go through the promise chain and last thing called is prepareActivityKmsMessage
|
|
@@ -59,28 +61,32 @@ describe('plugin-conversation', () => {
|
|
|
59
61
|
const transform = transforms.find((t) => t.name === 'prepareActivityKmsMessage');
|
|
60
62
|
|
|
61
63
|
const ctx = {
|
|
62
|
-
transform
|
|
64
|
+
transform,
|
|
63
65
|
};
|
|
64
66
|
const key = null;
|
|
65
67
|
const activity = {
|
|
66
68
|
object: {
|
|
67
|
-
created: 'false'
|
|
69
|
+
created: 'false',
|
|
68
70
|
},
|
|
69
71
|
target: {
|
|
70
72
|
defaultActivityEncryptionKeyUrl: 'fakeEncryptionKey',
|
|
71
|
-
kmsResourceObjectUrl: 'meetingContainerKRO'
|
|
73
|
+
kmsResourceObjectUrl: 'meetingContainerKRO',
|
|
72
74
|
},
|
|
73
75
|
objectType: 'activity',
|
|
74
76
|
verb: 'delete',
|
|
75
77
|
kmsMessage: {
|
|
76
78
|
uri: '<KRO>/authorizations?authId=123',
|
|
77
|
-
method: 'delete'
|
|
78
|
-
}
|
|
79
|
+
method: 'delete',
|
|
80
|
+
},
|
|
79
81
|
};
|
|
80
82
|
|
|
81
83
|
transform.fn(ctx, key, activity);
|
|
82
84
|
|
|
83
|
-
assert.equal(
|
|
85
|
+
assert.equal(
|
|
86
|
+
activity.kmsMessage.uri,
|
|
87
|
+
'meetingContainerKRO/authorizations?authId=123',
|
|
88
|
+
'did not properly transform KRO for delete meeting container activity'
|
|
89
|
+
);
|
|
84
90
|
});
|
|
85
91
|
});
|
|
86
92
|
});
|