@webex/plugin-meetings 3.10.0-next.13 → 3.10.0-next.15

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 (36) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/hashTree/constants.js +20 -0
  4. package/dist/hashTree/constants.js.map +1 -0
  5. package/dist/hashTree/hashTree.js +515 -0
  6. package/dist/hashTree/hashTree.js.map +1 -0
  7. package/dist/hashTree/hashTreeParser.js +1115 -14
  8. package/dist/hashTree/hashTreeParser.js.map +1 -1
  9. package/dist/hashTree/types.js +9 -3
  10. package/dist/hashTree/types.js.map +1 -1
  11. package/dist/hashTree/utils.js +48 -0
  12. package/dist/hashTree/utils.js.map +1 -0
  13. package/dist/interpretation/index.js +1 -1
  14. package/dist/interpretation/siLanguage.js +1 -1
  15. package/dist/locus-info/index.js +41 -22
  16. package/dist/locus-info/index.js.map +1 -1
  17. package/dist/locus-info/types.js.map +1 -1
  18. package/dist/types/hashTree/constants.d.ts +8 -0
  19. package/dist/types/hashTree/hashTree.d.ts +129 -0
  20. package/dist/types/hashTree/hashTreeParser.d.ts +151 -0
  21. package/dist/types/hashTree/types.d.ts +9 -0
  22. package/dist/types/hashTree/utils.d.ts +9 -0
  23. package/dist/types/locus-info/types.d.ts +12 -11
  24. package/dist/webinar/index.js +1 -1
  25. package/package.json +22 -21
  26. package/src/hashTree/constants.ts +9 -0
  27. package/src/hashTree/hashTree.ts +463 -0
  28. package/src/hashTree/hashTreeParser.ts +1022 -7
  29. package/src/hashTree/types.ts +11 -1
  30. package/src/hashTree/utils.ts +42 -0
  31. package/src/locus-info/index.ts +49 -27
  32. package/src/locus-info/types.ts +13 -11
  33. package/test/unit/spec/hashTree/hashTree.ts +655 -0
  34. package/test/unit/spec/hashTree/hashTreeParser.ts +1532 -0
  35. package/test/unit/spec/hashTree/utils.ts +103 -0
  36. package/test/unit/spec/locus-info/index.js +95 -4
@@ -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,47 @@ 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
+
361
397
  it('should process locus update correctly when called with updated LOCUS object', () => {
362
398
  // setup new updated locus that has many things missing
363
399
  const newLocusHtMeta = {elementId: {type: 'locus', version: 42}};
364
400
  const newLocus = {
365
- conntrols: 'new-controls',
401
+ controls: 'new-controls',
366
402
  host: 'new-host',
367
403
  htMeta: newLocusHtMeta,
368
404
  };
@@ -374,6 +410,12 @@ describe('plugin-meetings', () => {
374
410
 
375
411
  // check onDeltaLocus() was called with correctly updated locus info
376
412
  assert.calledOnceWithExactly(onDeltaLocusStub, {
413
+ // these fields are not part of Locus object, so should keep their old values:
414
+ info: {id: 'fake-info'},
415
+ fullState: {id: 'fake-full-state'},
416
+ self: {id: 'fake-self'},
417
+ mediaShares: expectedLocusInfo.mediaShares,
418
+ // and now the new fields
377
419
  ...newLocus,
378
420
  htMeta: newLocusHtMeta,
379
421
  participants: [], // empty means there were no participant updates
@@ -381,6 +423,50 @@ describe('plugin-meetings', () => {
381
423
  });
382
424
  });
383
425
 
426
+ // this test is checking that we cope with an edge case if Locus
427
+ // sends us something that they shouldn't
428
+ it('should process locus update correctly when called with updated LOCUS object that contains info/fullState/self/participants etc', () => {
429
+ // setup new updated locus that has many things missing
430
+ const newLocusHtMeta = {elementId: {type: 'locus', version: 42}};
431
+ const newLocus = {
432
+ controls: 'new-controls',
433
+ host: 'new-host',
434
+ htMeta: newLocusHtMeta,
435
+ };
436
+
437
+ // simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
438
+ locusInfoUpdateCallback(OBJECTS_UPDATED, {
439
+ updatedObjects: [
440
+ {
441
+ htMeta: newLocusHtMeta,
442
+ data: {
443
+ ...newLocus,
444
+ // all these fields below should be ignored and not override the existing ones in our "old" Locus
445
+ info: 'new-info',
446
+ fullState: 'new-fullState',
447
+ self: 'new-self',
448
+ participants: 'new-participants',
449
+ mediaShares: 'new-mediaShares',
450
+ },
451
+ },
452
+ ],
453
+ });
454
+
455
+ // check onDeltaLocus() was called with correctly updated locus info
456
+ // with old values for the fields that should be ignored (like "info" or "fullState")
457
+ assert.calledOnceWithExactly(onDeltaLocusStub, {
458
+ // these fields have the "old" values:
459
+ info: {id: 'fake-info'},
460
+ fullState: {id: 'fake-full-state'},
461
+ self: {id: 'fake-self'},
462
+ mediaShares: expectedLocusInfo.mediaShares,
463
+ participants: [], // empty means there were no participant updates
464
+ jsSdkMeta: {removedParticipantIds: []}, // no participants were removed
465
+ ...newLocus,
466
+ htMeta: newLocusHtMeta,
467
+ });
468
+ });
469
+
384
470
  it('should process locus update correctly when called with removed LOCUS object followed by updated LOCUS object', () => {
385
471
  // setup new updated locus that has many things missing
386
472
  const newLocusHtMeta = {elementId: {type: 'locus', version: 99}};
@@ -402,6 +488,12 @@ describe('plugin-meetings', () => {
402
488
 
403
489
  // check onDeltaLocus() was called with correctly updated locus info
404
490
  assert.calledOnceWithExactly(onDeltaLocusStub, {
491
+ // these fields are not part of Locus object, so should keep their old values:
492
+ info: {id: 'fake-info'},
493
+ fullState: {id: 'fake-full-state'},
494
+ self: {id: 'fake-self'},
495
+ mediaShares: expectedLocusInfo.mediaShares,
496
+ // and now the new fields
405
497
  ...newLocus,
406
498
  htMeta: newLocusHtMeta,
407
499
  participants: [], // empty means there were no participant updates
@@ -2578,7 +2670,7 @@ describe('plugin-meetings', () => {
2578
2670
 
2579
2671
  assert.calledWith(locusInfo.handleLocusDelta, fakeLocus, mockMeeting);
2580
2672
  });
2581
- it('does nothing when we are using hash trees', () => {
2673
+ it('calls hash tree parser when we are using hash trees', () => {
2582
2674
  const fakeLocus = {eventType: LOCUSEVENT.DIFFERENCE};
2583
2675
  const fakeDataSets = [{name: 'dataset1', url: 'http://test.com'}];
2584
2676
  const responseBody = {locus: fakeLocus, dataSets: fakeDataSets};
@@ -2593,8 +2685,7 @@ describe('plugin-meetings', () => {
2593
2685
 
2594
2686
  locusInfo.handleLocusAPIResponse(mockMeeting, responseBody);
2595
2687
 
2596
- assert.notCalled(mockHashTreeParser.handleLocusUpdate);
2597
- assert.notCalled(locusInfo.onDeltaLocus);
2688
+ assert.calledOnceWithExactly(mockHashTreeParser.handleLocusUpdate, responseBody);
2598
2689
  });
2599
2690
  });
2600
2691