@webex/plugin-meetings 3.10.0-next.14 → 3.10.0-next.16
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/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/hashTree/constants.js +20 -0
- package/dist/hashTree/constants.js.map +1 -0
- package/dist/hashTree/hashTree.js +515 -0
- package/dist/hashTree/hashTree.js.map +1 -0
- package/dist/hashTree/hashTreeParser.js +1115 -14
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/types.js +10 -3
- package/dist/hashTree/types.js.map +1 -1
- package/dist/hashTree/utils.js +48 -0
- package/dist/hashTree/utils.js.map +1 -0
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/index.js +59 -49
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/types.js.map +1 -1
- package/dist/types/hashTree/constants.d.ts +8 -0
- package/dist/types/hashTree/hashTree.d.ts +129 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +151 -0
- package/dist/types/hashTree/types.d.ts +11 -0
- package/dist/types/hashTree/utils.d.ts +9 -0
- package/dist/types/locus-info/index.d.ts +5 -15
- package/dist/types/locus-info/types.d.ts +21 -12
- package/dist/webinar/index.js +1 -1
- package/package.json +22 -21
- package/src/hashTree/constants.ts +9 -0
- package/src/hashTree/hashTree.ts +463 -0
- package/src/hashTree/hashTreeParser.ts +1022 -7
- package/src/hashTree/types.ts +13 -1
- package/src/hashTree/utils.ts +42 -0
- package/src/locus-info/index.ts +64 -48
- package/src/locus-info/types.ts +19 -12
- package/test/unit/spec/hashTree/hashTree.ts +655 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +1532 -0
- package/test/unit/spec/hashTree/utils.ts +103 -0
- package/test/unit/spec/locus-info/index.js +150 -7
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {deleteNestedObjectsWithHtMeta} from '../../../../src/hashTree/utils';
|
|
2
|
+
|
|
3
|
+
import {assert} from '@webex/test-helper-chai';
|
|
4
|
+
|
|
5
|
+
describe('Hash Tree Utils', () => {
|
|
6
|
+
describe('#deleteNestedObjectsWithHtMeta', () => {
|
|
7
|
+
it('should delete nested objects with htMeta', () => {
|
|
8
|
+
const locusPart = {
|
|
9
|
+
a: {
|
|
10
|
+
htMeta: {
|
|
11
|
+
id: '1',
|
|
12
|
+
},
|
|
13
|
+
value: 'to be deleted',
|
|
14
|
+
},
|
|
15
|
+
b: {
|
|
16
|
+
c: {
|
|
17
|
+
htMeta: {
|
|
18
|
+
id: '2',
|
|
19
|
+
},
|
|
20
|
+
value: 'to be deleted',
|
|
21
|
+
},
|
|
22
|
+
d: 'to be kept',
|
|
23
|
+
},
|
|
24
|
+
e: [
|
|
25
|
+
{
|
|
26
|
+
htMeta: {
|
|
27
|
+
id: '3',
|
|
28
|
+
},
|
|
29
|
+
value: 'to be deleted',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
f: 'to be kept',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
htMeta: {
|
|
36
|
+
id: '4',
|
|
37
|
+
},
|
|
38
|
+
value: 'to be deleted',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
g: 'to be kept',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
deleteNestedObjectsWithHtMeta(locusPart);
|
|
47
|
+
|
|
48
|
+
assert.deepEqual(locusPart, {
|
|
49
|
+
b: {
|
|
50
|
+
d: 'to be kept',
|
|
51
|
+
},
|
|
52
|
+
e: [
|
|
53
|
+
{
|
|
54
|
+
f: 'to be kept',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
g: 'to be kept',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should handle arrays correctly', () => {
|
|
64
|
+
const locusPart = {
|
|
65
|
+
htMeta: {
|
|
66
|
+
id: '0', // this should not be deleted
|
|
67
|
+
},
|
|
68
|
+
participants: [
|
|
69
|
+
{
|
|
70
|
+
htMeta: {
|
|
71
|
+
id: '1',
|
|
72
|
+
},
|
|
73
|
+
id: 'participant1',
|
|
74
|
+
value: 'to be deleted',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
htMeta: {
|
|
78
|
+
id: '2',
|
|
79
|
+
},
|
|
80
|
+
id: 'participant2',
|
|
81
|
+
value: 'to be deleted',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
self: {
|
|
85
|
+
htMeta: {
|
|
86
|
+
id: '3',
|
|
87
|
+
},
|
|
88
|
+
id: 'self1',
|
|
89
|
+
value: 'to be deleted',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
deleteNestedObjectsWithHtMeta(locusPart);
|
|
94
|
+
|
|
95
|
+
assert.deepEqual(locusPart, {
|
|
96
|
+
htMeta: {
|
|
97
|
+
id: '0',
|
|
98
|
+
},
|
|
99
|
+
participants: [],
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -358,11 +358,65 @@ describe('plugin-meetings', () => {
|
|
|
358
358
|
});
|
|
359
359
|
});
|
|
360
360
|
|
|
361
|
+
it('should process locus update correctly when called with updated fullState', () => {
|
|
362
|
+
const newFullState = {
|
|
363
|
+
id: 'new-fullState',
|
|
364
|
+
visibleDataSets: ['dataset1', 'dataset2'],
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
368
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
369
|
+
updatedObjects: [{htMeta: {elementId: {type: 'fullState'}}, data: newFullState}],
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
373
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
374
|
+
...expectedLocusInfo,
|
|
375
|
+
fullState: newFullState,
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
it('should process locus update correctly when called with updated info', () => {
|
|
380
|
+
const newInfo = {
|
|
381
|
+
id: 'new-info',
|
|
382
|
+
visibleDataSets: ['dataset1', 'dataset2'],
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
386
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
387
|
+
updatedObjects: [{htMeta: {elementId: {type: 'info'}}, data: newInfo}],
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
391
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
392
|
+
...expectedLocusInfo,
|
|
393
|
+
info: newInfo,
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
it('should process locus update correctly when called with updated links', () => {
|
|
398
|
+
const newLinks = {
|
|
399
|
+
id: 'new-links',
|
|
400
|
+
visibleDataSets: ['dataset1', 'dataset2'],
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
404
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
405
|
+
updatedObjects: [{htMeta: {elementId: {type: 'links'}}, data: newLinks}],
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
409
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
410
|
+
...expectedLocusInfo,
|
|
411
|
+
links: newLinks,
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
|
|
361
415
|
it('should process locus update correctly when called with updated LOCUS object', () => {
|
|
362
416
|
// setup new updated locus that has many things missing
|
|
363
417
|
const newLocusHtMeta = {elementId: {type: 'locus', version: 42}};
|
|
364
418
|
const newLocus = {
|
|
365
|
-
|
|
419
|
+
controls: 'new-controls',
|
|
366
420
|
host: 'new-host',
|
|
367
421
|
htMeta: newLocusHtMeta,
|
|
368
422
|
};
|
|
@@ -374,6 +428,13 @@ describe('plugin-meetings', () => {
|
|
|
374
428
|
|
|
375
429
|
// check onDeltaLocus() was called with correctly updated locus info
|
|
376
430
|
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
431
|
+
// these fields are not part of Locus object, so should keep their old values:
|
|
432
|
+
info: {id: 'fake-info'},
|
|
433
|
+
fullState: {id: 'fake-full-state'},
|
|
434
|
+
self: {id: 'fake-self'},
|
|
435
|
+
links: { id: 'fake-links' },
|
|
436
|
+
mediaShares: expectedLocusInfo.mediaShares,
|
|
437
|
+
// and now the new fields
|
|
377
438
|
...newLocus,
|
|
378
439
|
htMeta: newLocusHtMeta,
|
|
379
440
|
participants: [], // empty means there were no participant updates
|
|
@@ -381,6 +442,51 @@ describe('plugin-meetings', () => {
|
|
|
381
442
|
});
|
|
382
443
|
});
|
|
383
444
|
|
|
445
|
+
// this test is checking that we cope with an edge case if Locus
|
|
446
|
+
// sends us something that they shouldn't
|
|
447
|
+
it('should process locus update correctly when called with updated LOCUS object that contains info/fullState/self/participants etc', () => {
|
|
448
|
+
// setup new updated locus that has many things missing
|
|
449
|
+
const newLocusHtMeta = {elementId: {type: 'locus', version: 42}};
|
|
450
|
+
const newLocus = {
|
|
451
|
+
controls: 'new-controls',
|
|
452
|
+
host: 'new-host',
|
|
453
|
+
htMeta: newLocusHtMeta,
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
457
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
458
|
+
updatedObjects: [
|
|
459
|
+
{
|
|
460
|
+
htMeta: newLocusHtMeta,
|
|
461
|
+
data: {
|
|
462
|
+
...newLocus,
|
|
463
|
+
// all these fields below should be ignored and not override the existing ones in our "old" Locus
|
|
464
|
+
info: 'new-info',
|
|
465
|
+
fullState: 'new-fullState',
|
|
466
|
+
self: 'new-self',
|
|
467
|
+
participants: 'new-participants',
|
|
468
|
+
mediaShares: 'new-mediaShares',
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
],
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
475
|
+
// with old values for the fields that should be ignored (like "info" or "fullState")
|
|
476
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
477
|
+
// these fields have the "old" values:
|
|
478
|
+
info: {id: 'fake-info'},
|
|
479
|
+
fullState: {id: 'fake-full-state'},
|
|
480
|
+
self: {id: 'fake-self'},
|
|
481
|
+
links: { id: 'fake-links' },
|
|
482
|
+
mediaShares: expectedLocusInfo.mediaShares,
|
|
483
|
+
participants: [], // empty means there were no participant updates
|
|
484
|
+
jsSdkMeta: {removedParticipantIds: []}, // no participants were removed
|
|
485
|
+
...newLocus,
|
|
486
|
+
htMeta: newLocusHtMeta,
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
|
|
384
490
|
it('should process locus update correctly when called with removed LOCUS object followed by updated LOCUS object', () => {
|
|
385
491
|
// setup new updated locus that has many things missing
|
|
386
492
|
const newLocusHtMeta = {elementId: {type: 'locus', version: 99}};
|
|
@@ -402,6 +508,13 @@ describe('plugin-meetings', () => {
|
|
|
402
508
|
|
|
403
509
|
// check onDeltaLocus() was called with correctly updated locus info
|
|
404
510
|
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
511
|
+
// these fields are not part of Locus object, so should keep their old values:
|
|
512
|
+
info: {id: 'fake-info'},
|
|
513
|
+
fullState: {id: 'fake-full-state'},
|
|
514
|
+
self: {id: 'fake-self'},
|
|
515
|
+
links: {id: 'fake-links'},
|
|
516
|
+
mediaShares: expectedLocusInfo.mediaShares,
|
|
517
|
+
// and now the new fields
|
|
405
518
|
...newLocus,
|
|
406
519
|
htMeta: newLocusHtMeta,
|
|
407
520
|
participants: [], // empty means there were no participant updates
|
|
@@ -2578,7 +2691,7 @@ describe('plugin-meetings', () => {
|
|
|
2578
2691
|
|
|
2579
2692
|
assert.calledWith(locusInfo.handleLocusDelta, fakeLocus, mockMeeting);
|
|
2580
2693
|
});
|
|
2581
|
-
it('
|
|
2694
|
+
it('calls hash tree parser when we are using hash trees', () => {
|
|
2582
2695
|
const fakeLocus = {eventType: LOCUSEVENT.DIFFERENCE};
|
|
2583
2696
|
const fakeDataSets = [{name: 'dataset1', url: 'http://test.com'}];
|
|
2584
2697
|
const responseBody = {locus: fakeLocus, dataSets: fakeDataSets};
|
|
@@ -2593,8 +2706,7 @@ describe('plugin-meetings', () => {
|
|
|
2593
2706
|
|
|
2594
2707
|
locusInfo.handleLocusAPIResponse(mockMeeting, responseBody);
|
|
2595
2708
|
|
|
2596
|
-
assert.
|
|
2597
|
-
assert.notCalled(locusInfo.onDeltaLocus);
|
|
2709
|
+
assert.calledOnceWithExactly(mockHashTreeParser.handleLocusUpdate, responseBody);
|
|
2598
2710
|
});
|
|
2599
2711
|
});
|
|
2600
2712
|
|
|
@@ -2680,7 +2792,7 @@ describe('plugin-meetings', () => {
|
|
|
2680
2792
|
sinon.stub(locusInfo, "updateMemberShip");
|
|
2681
2793
|
sinon.stub(locusInfo, "updateIdentifiers");
|
|
2682
2794
|
sinon.stub(locusInfo, "updateEmbeddedApps");
|
|
2683
|
-
sinon.stub(locusInfo, "
|
|
2795
|
+
sinon.stub(locusInfo, "updateLinks");
|
|
2684
2796
|
sinon.stub(locusInfo, "compareAndUpdate");
|
|
2685
2797
|
|
|
2686
2798
|
locusInfo.updateLocusInfo(locus);
|
|
@@ -2714,7 +2826,7 @@ describe('plugin-meetings', () => {
|
|
|
2714
2826
|
locusInfo.updateMemberShip = sinon.stub();
|
|
2715
2827
|
locusInfo.updateIdentifiers = sinon.stub();
|
|
2716
2828
|
locusInfo.updateEmbeddedApps = sinon.stub();
|
|
2717
|
-
locusInfo.
|
|
2829
|
+
locusInfo.updateLinks = sinon.stub();
|
|
2718
2830
|
locusInfo.compareAndUpdate = sinon.stub();
|
|
2719
2831
|
|
|
2720
2832
|
locusInfo.updateLocusInfo(newLocus);
|
|
@@ -2736,11 +2848,42 @@ describe('plugin-meetings', () => {
|
|
|
2736
2848
|
assert.notCalled(locusInfo.updateMemberShip);
|
|
2737
2849
|
assert.notCalled(locusInfo.updateIdentifiers);
|
|
2738
2850
|
assert.notCalled(locusInfo.updateEmbeddedApps);
|
|
2739
|
-
assert.notCalled(locusInfo.
|
|
2851
|
+
assert.notCalled(locusInfo.updateLinks);
|
|
2740
2852
|
assert.notCalled(locusInfo.compareAndUpdate);
|
|
2741
2853
|
});
|
|
2742
2854
|
|
|
2855
|
+
it('#updateLocusInfo puts the Locus DTO top level properties at the right place in LocusInfo class', () => {
|
|
2856
|
+
// this test verifies that the top-level properties of Locus DTO are copied
|
|
2857
|
+
// into LocusInfo class and set as top level properties too
|
|
2858
|
+
// this is important, because the code handling Locus hass trees relies on it, see updateFromHashTree()
|
|
2859
|
+
const info = {id: 'info id'};
|
|
2860
|
+
const fullState = {id: 'fullState id'};
|
|
2861
|
+
const links = {services: {id: 'service links'}, resources: {id: 'resource links'}};
|
|
2862
|
+
const self = {id: 'self id'};
|
|
2863
|
+
const mediaShares = [{id: 'fake media share'}];
|
|
2743
2864
|
|
|
2865
|
+
sinon.stub(SelfUtils, 'getSelves').returns({
|
|
2866
|
+
current: {},
|
|
2867
|
+
previous: {},
|
|
2868
|
+
updates: {},
|
|
2869
|
+
});
|
|
2870
|
+
|
|
2871
|
+
const newLocus = {
|
|
2872
|
+
info,
|
|
2873
|
+
fullState,
|
|
2874
|
+
links,
|
|
2875
|
+
self,
|
|
2876
|
+
mediaShares,
|
|
2877
|
+
};
|
|
2878
|
+
|
|
2879
|
+
locusInfo.updateLocusInfo(newLocus);
|
|
2880
|
+
|
|
2881
|
+
assert.deepEqual(locusInfo.info, newLocus.info);
|
|
2882
|
+
assert.deepEqual(locusInfo.fullState, newLocus.fullState);
|
|
2883
|
+
assert.deepEqual(locusInfo.links, newLocus.links);
|
|
2884
|
+
assert.deepEqual(locusInfo.self, newLocus.self);
|
|
2885
|
+
assert.deepEqual(locusInfo.mediaShares, newLocus.mediaShares);
|
|
2886
|
+
});
|
|
2744
2887
|
|
|
2745
2888
|
it('onFullLocus() updates the working-copy of locus parser', () => {
|
|
2746
2889
|
const eventType = 'fakeEvent';
|