@wazo/sdk 0.37.32 → 0.37.33

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 (42) hide show
  1. package/dist/wazo-sdk.js +1 -1
  2. package/esm/domain/CallSession.js +8 -0
  3. package/esm/domain/Phone/CTIPhone.js +8 -0
  4. package/esm/domain/Phone/WebRTCPhone.js +8 -0
  5. package/esm/domain/__tests__/CallSession.test.js +40 -4
  6. package/esm/domain/__tests__/IndirectTransfer.test.js +8 -0
  7. package/esm/domain/__tests__/Room.test.js +8 -0
  8. package/esm/index.js +8 -0
  9. package/esm/simple/Auth.js +8 -0
  10. package/esm/simple/Configuration.js +8 -0
  11. package/esm/simple/Phone.js +8 -0
  12. package/esm/simple/index.js +8 -0
  13. package/esm/simple/room/LocalParticipant.js +8 -0
  14. package/esm/simple/room/Participant.js +8 -0
  15. package/esm/simple/room/RemoteParticipant.js +8 -0
  16. package/esm/simple/room/Room.js +8 -0
  17. package/esm/simple/room/SipRoom.js +8 -0
  18. package/esm/simple/room/Stream.js +8 -0
  19. package/esm/simple/room/__tests__/RemoteParticipant.test.js +8 -0
  20. package/esm/simple/utils.js +8 -0
  21. package/lib/domain/CallSession.js +8 -0
  22. package/lib/domain/Phone/CTIPhone.js +8 -0
  23. package/lib/domain/Phone/WebRTCPhone.js +8 -0
  24. package/lib/domain/__tests__/CallSession.test.js +40 -4
  25. package/lib/domain/__tests__/IndirectTransfer.test.js +8 -0
  26. package/lib/domain/__tests__/Room.test.js +8 -0
  27. package/lib/index.js +8 -0
  28. package/lib/simple/Auth.js +8 -0
  29. package/lib/simple/Configuration.js +8 -0
  30. package/lib/simple/Phone.js +8 -0
  31. package/lib/simple/index.js +8 -0
  32. package/lib/simple/room/LocalParticipant.js +8 -0
  33. package/lib/simple/room/Participant.js +8 -0
  34. package/lib/simple/room/RemoteParticipant.js +8 -0
  35. package/lib/simple/room/Room.js +8 -0
  36. package/lib/simple/room/SipRoom.js +8 -0
  37. package/lib/simple/room/Stream.js +8 -0
  38. package/lib/simple/room/__tests__/RemoteParticipant.test.js +8 -0
  39. package/lib/simple/utils.js +8 -0
  40. package/package.json +1 -1
  41. package/src/domain/CallSession.js +8 -0
  42. package/src/domain/__tests__/CallSession.test.js +32 -4
@@ -375,6 +375,14 @@ class CallSession {
375
375
  return !!this.answerTime;
376
376
  }
377
377
 
378
+ toJSON() {
379
+ const jsonObj = { ...this };
380
+ // $FlowFixMe
381
+ jsonObj.answered = this.answered;
382
+
383
+ return jsonObj;
384
+ }
385
+
378
386
  static parseCall(call ) {
379
387
  return new CallSession({
380
388
  callId: call.id,
@@ -2049,6 +2049,14 @@ class CallSession {
2049
2049
  return !!this.answerTime;
2050
2050
  }
2051
2051
 
2052
+ toJSON() {
2053
+ const jsonObj = { ...this };
2054
+ // $FlowFixMe
2055
+ jsonObj.answered = this.answered;
2056
+
2057
+ return jsonObj;
2058
+ }
2059
+
2052
2060
  static parseCall(call ) {
2053
2061
  return new CallSession({
2054
2062
  callId: call.id,
@@ -397,6 +397,14 @@ class CallSession {
397
397
  return !!this.answerTime;
398
398
  }
399
399
 
400
+ toJSON() {
401
+ const jsonObj = { ...this };
402
+ // $FlowFixMe
403
+ jsonObj.answered = this.answered;
404
+
405
+ return jsonObj;
406
+ }
407
+
400
408
  static parseCall(call ) {
401
409
  return new CallSession({
402
410
  callId: call.id,
@@ -375,6 +375,14 @@ class CallSession {
375
375
  return !!this.answerTime;
376
376
  }
377
377
 
378
+ toJSON() {
379
+ const jsonObj = { ...this };
380
+ // $FlowFixMe
381
+ jsonObj.answered = this.answered;
382
+
383
+ return jsonObj;
384
+ }
385
+
378
386
  static parseCall(call ) {
379
387
  return new CallSession({
380
388
  callId: call.id,
@@ -400,6 +408,8 @@ class CallSession {
400
408
  }
401
409
  }
402
410
 
411
+ const stringify = cs => JSON.parse(JSON.stringify(cs));
412
+
403
413
  describe('CallSession domain', () => {
404
414
  it('should update from another CallSession without data loss', () => {
405
415
  const callSession = new CallSession({
@@ -438,7 +448,7 @@ describe('CallSession domain', () => {
438
448
  expect(cs2.is(cs1)).toBeTruthy();
439
449
  });
440
450
 
441
- it('should set answerTime when setting answered', () => {
451
+ it('should set answerTime when setting answered to true', () => {
442
452
  const cs1 = new CallSession({});
443
453
  cs1.answered = true;
444
454
 
@@ -447,11 +457,37 @@ describe('CallSession domain', () => {
447
457
 
448
458
  const cs3 = new CallSession({ answered: true });
449
459
 
450
- expect(cs1.answered).toBeTruthy();
460
+ expect(cs1.answered).toEqual(true);
451
461
  expect(cs1.answerTime).not.toBeNull();
452
- expect(cs2.answered).toBeTruthy();
462
+ expect(cs2.answered).toEqual(true);
453
463
  expect(cs2.answerTime).not.toBeNull();
454
- expect(cs3.answered).toBeTruthy();
464
+ expect(cs3.answered).toEqual(true);
455
465
  expect(cs3.answerTime).not.toBeNull();
466
+
467
+ const cs4 = stringify(cs1);
468
+ const cs5 = stringify(cs2);
469
+ const cs6 = stringify(cs3);
470
+
471
+ expect(cs4.answered).toEqual(true);
472
+ expect(cs5.answered).toEqual(true);
473
+ expect(cs6.answered).toEqual(true);
474
+ });
475
+
476
+ it('should reset answerTime when setting answered to false', () => {
477
+ const cs1 = new CallSession({});
478
+ cs1.answered = false;
479
+
480
+ const cs2 = new CallSession({ answered: false });
481
+
482
+ expect(cs1.answered).toEqual(false);
483
+ expect(cs1.answerTime).toBeNull();
484
+ expect(cs2.answered).toEqual(false);
485
+ expect(cs2.answerTime).toBeNull();
486
+
487
+ const cs4 = stringify(cs1);
488
+ const cs5 = stringify(cs2);
489
+
490
+ expect(cs4.answered).toEqual(false);
491
+ expect(cs5.answered).toEqual(false);
456
492
  });
457
493
  });
@@ -375,6 +375,14 @@ class CallSession {
375
375
  return !!this.answerTime;
376
376
  }
377
377
 
378
+ toJSON() {
379
+ const jsonObj = { ...this };
380
+ // $FlowFixMe
381
+ jsonObj.answered = this.answered;
382
+
383
+ return jsonObj;
384
+ }
385
+
378
386
  static parseCall(call ) {
379
387
  return new CallSession({
380
388
  callId: call.id,
@@ -375,6 +375,14 @@ class CallSession {
375
375
  return !!this.answerTime;
376
376
  }
377
377
 
378
+ toJSON() {
379
+ const jsonObj = { ...this };
380
+ // $FlowFixMe
381
+ jsonObj.answered = this.answered;
382
+
383
+ return jsonObj;
384
+ }
385
+
378
386
  static parseCall(call ) {
379
387
  return new CallSession({
380
388
  callId: call.id,
package/esm/index.js CHANGED
@@ -3592,6 +3592,14 @@ class CallSession {
3592
3592
  return !!this.answerTime;
3593
3593
  }
3594
3594
 
3595
+ toJSON() {
3596
+ const jsonObj = { ...this };
3597
+ // $FlowFixMe
3598
+ jsonObj.answered = this.answered;
3599
+
3600
+ return jsonObj;
3601
+ }
3602
+
3595
3603
  static parseCall(call ) {
3596
3604
  return new CallSession({
3597
3605
  callId: call.id,
@@ -3591,6 +3591,14 @@ class CallSession {
3591
3591
  return !!this.answerTime;
3592
3592
  }
3593
3593
 
3594
+ toJSON() {
3595
+ const jsonObj = { ...this };
3596
+ // $FlowFixMe
3597
+ jsonObj.answered = this.answered;
3598
+
3599
+ return jsonObj;
3600
+ }
3601
+
3594
3602
  static parseCall(call ) {
3595
3603
  return new CallSession({
3596
3604
  callId: call.id,
@@ -3591,6 +3591,14 @@ class CallSession {
3591
3591
  return !!this.answerTime;
3592
3592
  }
3593
3593
 
3594
+ toJSON() {
3595
+ const jsonObj = { ...this };
3596
+ // $FlowFixMe
3597
+ jsonObj.answered = this.answered;
3598
+
3599
+ return jsonObj;
3600
+ }
3601
+
3594
3602
  static parseCall(call ) {
3595
3603
  return new CallSession({
3596
3604
  callId: call.id,
@@ -591,6 +591,14 @@ class CallSession {
591
591
  return !!this.answerTime;
592
592
  }
593
593
 
594
+ toJSON() {
595
+ const jsonObj = { ...this };
596
+ // $FlowFixMe
597
+ jsonObj.answered = this.answered;
598
+
599
+ return jsonObj;
600
+ }
601
+
594
602
  static parseCall(call ) {
595
603
  return new CallSession({
596
604
  callId: call.id,
@@ -3591,6 +3591,14 @@ class CallSession {
3591
3591
  return !!this.answerTime;
3592
3592
  }
3593
3593
 
3594
+ toJSON() {
3595
+ const jsonObj = { ...this };
3596
+ // $FlowFixMe
3597
+ jsonObj.answered = this.answered;
3598
+
3599
+ return jsonObj;
3600
+ }
3601
+
3594
3602
  static parseCall(call ) {
3595
3603
  return new CallSession({
3596
3604
  callId: call.id,
@@ -3617,6 +3617,14 @@ class CallSession {
3617
3617
  return !!this.answerTime;
3618
3618
  }
3619
3619
 
3620
+ toJSON() {
3621
+ const jsonObj = { ...this };
3622
+ // $FlowFixMe
3623
+ jsonObj.answered = this.answered;
3624
+
3625
+ return jsonObj;
3626
+ }
3627
+
3620
3628
  static parseCall(call ) {
3621
3629
  return new CallSession({
3622
3630
  callId: call.id,
@@ -3617,6 +3617,14 @@ class CallSession {
3617
3617
  return !!this.answerTime;
3618
3618
  }
3619
3619
 
3620
+ toJSON() {
3621
+ const jsonObj = { ...this };
3622
+ // $FlowFixMe
3623
+ jsonObj.answered = this.answered;
3624
+
3625
+ return jsonObj;
3626
+ }
3627
+
3620
3628
  static parseCall(call ) {
3621
3629
  return new CallSession({
3622
3630
  callId: call.id,
@@ -3591,6 +3591,14 @@ class CallSession {
3591
3591
  return !!this.answerTime;
3592
3592
  }
3593
3593
 
3594
+ toJSON() {
3595
+ const jsonObj = { ...this };
3596
+ // $FlowFixMe
3597
+ jsonObj.answered = this.answered;
3598
+
3599
+ return jsonObj;
3600
+ }
3601
+
3594
3602
  static parseCall(call ) {
3595
3603
  return new CallSession({
3596
3604
  callId: call.id,
@@ -3591,6 +3591,14 @@ class CallSession {
3591
3591
  return !!this.answerTime;
3592
3592
  }
3593
3593
 
3594
+ toJSON() {
3595
+ const jsonObj = { ...this };
3596
+ // $FlowFixMe
3597
+ jsonObj.answered = this.answered;
3598
+
3599
+ return jsonObj;
3600
+ }
3601
+
3594
3602
  static parseCall(call ) {
3595
3603
  return new CallSession({
3596
3604
  callId: call.id,
@@ -3591,6 +3591,14 @@ class CallSession {
3591
3591
  return !!this.answerTime;
3592
3592
  }
3593
3593
 
3594
+ toJSON() {
3595
+ const jsonObj = { ...this };
3596
+ // $FlowFixMe
3597
+ jsonObj.answered = this.answered;
3598
+
3599
+ return jsonObj;
3600
+ }
3601
+
3594
3602
  static parseCall(call ) {
3595
3603
  return new CallSession({
3596
3604
  callId: call.id,
@@ -3591,6 +3591,14 @@ class CallSession {
3591
3591
  return !!this.answerTime;
3592
3592
  }
3593
3593
 
3594
+ toJSON() {
3595
+ const jsonObj = { ...this };
3596
+ // $FlowFixMe
3597
+ jsonObj.answered = this.answered;
3598
+
3599
+ return jsonObj;
3600
+ }
3601
+
3594
3602
  static parseCall(call ) {
3595
3603
  return new CallSession({
3596
3604
  callId: call.id,
@@ -3591,6 +3591,14 @@ class CallSession {
3591
3591
  return !!this.answerTime;
3592
3592
  }
3593
3593
 
3594
+ toJSON() {
3595
+ const jsonObj = { ...this };
3596
+ // $FlowFixMe
3597
+ jsonObj.answered = this.answered;
3598
+
3599
+ return jsonObj;
3600
+ }
3601
+
3594
3602
  static parseCall(call ) {
3595
3603
  return new CallSession({
3596
3604
  callId: call.id,
@@ -3591,6 +3591,14 @@ class CallSession {
3591
3591
  return !!this.answerTime;
3592
3592
  }
3593
3593
 
3594
+ toJSON() {
3595
+ const jsonObj = { ...this };
3596
+ // $FlowFixMe
3597
+ jsonObj.answered = this.answered;
3598
+
3599
+ return jsonObj;
3600
+ }
3601
+
3594
3602
  static parseCall(call ) {
3595
3603
  return new CallSession({
3596
3604
  callId: call.id,
@@ -377,6 +377,14 @@ class CallSession {
377
377
  return !!this.answerTime;
378
378
  }
379
379
 
380
+ toJSON() {
381
+ const jsonObj = { ...this };
382
+ // $FlowFixMe
383
+ jsonObj.answered = this.answered;
384
+
385
+ return jsonObj;
386
+ }
387
+
380
388
  static parseCall(call ) {
381
389
  return new CallSession({
382
390
  callId: call.id,
@@ -2058,6 +2058,14 @@ class CallSession {
2058
2058
  return !!this.answerTime;
2059
2059
  }
2060
2060
 
2061
+ toJSON() {
2062
+ const jsonObj = { ...this };
2063
+ // $FlowFixMe
2064
+ jsonObj.answered = this.answered;
2065
+
2066
+ return jsonObj;
2067
+ }
2068
+
2061
2069
  static parseCall(call ) {
2062
2070
  return new CallSession({
2063
2071
  callId: call.id,
@@ -406,6 +406,14 @@ class CallSession {
406
406
  return !!this.answerTime;
407
407
  }
408
408
 
409
+ toJSON() {
410
+ const jsonObj = { ...this };
411
+ // $FlowFixMe
412
+ jsonObj.answered = this.answered;
413
+
414
+ return jsonObj;
415
+ }
416
+
409
417
  static parseCall(call ) {
410
418
  return new CallSession({
411
419
  callId: call.id,
@@ -377,6 +377,14 @@ class CallSession {
377
377
  return !!this.answerTime;
378
378
  }
379
379
 
380
+ toJSON() {
381
+ const jsonObj = { ...this };
382
+ // $FlowFixMe
383
+ jsonObj.answered = this.answered;
384
+
385
+ return jsonObj;
386
+ }
387
+
380
388
  static parseCall(call ) {
381
389
  return new CallSession({
382
390
  callId: call.id,
@@ -402,6 +410,8 @@ class CallSession {
402
410
  }
403
411
  }
404
412
 
413
+ const stringify = cs => JSON.parse(JSON.stringify(cs));
414
+
405
415
  describe('CallSession domain', () => {
406
416
  it('should update from another CallSession without data loss', () => {
407
417
  const callSession = new CallSession({
@@ -440,7 +450,7 @@ describe('CallSession domain', () => {
440
450
  expect(cs2.is(cs1)).toBeTruthy();
441
451
  });
442
452
 
443
- it('should set answerTime when setting answered', () => {
453
+ it('should set answerTime when setting answered to true', () => {
444
454
  const cs1 = new CallSession({});
445
455
  cs1.answered = true;
446
456
 
@@ -449,11 +459,37 @@ describe('CallSession domain', () => {
449
459
 
450
460
  const cs3 = new CallSession({ answered: true });
451
461
 
452
- expect(cs1.answered).toBeTruthy();
462
+ expect(cs1.answered).toEqual(true);
453
463
  expect(cs1.answerTime).not.toBeNull();
454
- expect(cs2.answered).toBeTruthy();
464
+ expect(cs2.answered).toEqual(true);
455
465
  expect(cs2.answerTime).not.toBeNull();
456
- expect(cs3.answered).toBeTruthy();
466
+ expect(cs3.answered).toEqual(true);
457
467
  expect(cs3.answerTime).not.toBeNull();
468
+
469
+ const cs4 = stringify(cs1);
470
+ const cs5 = stringify(cs2);
471
+ const cs6 = stringify(cs3);
472
+
473
+ expect(cs4.answered).toEqual(true);
474
+ expect(cs5.answered).toEqual(true);
475
+ expect(cs6.answered).toEqual(true);
476
+ });
477
+
478
+ it('should reset answerTime when setting answered to false', () => {
479
+ const cs1 = new CallSession({});
480
+ cs1.answered = false;
481
+
482
+ const cs2 = new CallSession({ answered: false });
483
+
484
+ expect(cs1.answered).toEqual(false);
485
+ expect(cs1.answerTime).toBeNull();
486
+ expect(cs2.answered).toEqual(false);
487
+ expect(cs2.answerTime).toBeNull();
488
+
489
+ const cs4 = stringify(cs1);
490
+ const cs5 = stringify(cs2);
491
+
492
+ expect(cs4.answered).toEqual(false);
493
+ expect(cs5.answered).toEqual(false);
458
494
  });
459
495
  });
@@ -377,6 +377,14 @@ class CallSession {
377
377
  return !!this.answerTime;
378
378
  }
379
379
 
380
+ toJSON() {
381
+ const jsonObj = { ...this };
382
+ // $FlowFixMe
383
+ jsonObj.answered = this.answered;
384
+
385
+ return jsonObj;
386
+ }
387
+
380
388
  static parseCall(call ) {
381
389
  return new CallSession({
382
390
  callId: call.id,
@@ -377,6 +377,14 @@ class CallSession {
377
377
  return !!this.answerTime;
378
378
  }
379
379
 
380
+ toJSON() {
381
+ const jsonObj = { ...this };
382
+ // $FlowFixMe
383
+ jsonObj.answered = this.answered;
384
+
385
+ return jsonObj;
386
+ }
387
+
380
388
  static parseCall(call ) {
381
389
  return new CallSession({
382
390
  callId: call.id,
package/lib/index.js CHANGED
@@ -3603,6 +3603,14 @@ class CallSession {
3603
3603
  return !!this.answerTime;
3604
3604
  }
3605
3605
 
3606
+ toJSON() {
3607
+ const jsonObj = { ...this };
3608
+ // $FlowFixMe
3609
+ jsonObj.answered = this.answered;
3610
+
3611
+ return jsonObj;
3612
+ }
3613
+
3606
3614
  static parseCall(call ) {
3607
3615
  return new CallSession({
3608
3616
  callId: call.id,
@@ -3603,6 +3603,14 @@ class CallSession {
3603
3603
  return !!this.answerTime;
3604
3604
  }
3605
3605
 
3606
+ toJSON() {
3607
+ const jsonObj = { ...this };
3608
+ // $FlowFixMe
3609
+ jsonObj.answered = this.answered;
3610
+
3611
+ return jsonObj;
3612
+ }
3613
+
3606
3614
  static parseCall(call ) {
3607
3615
  return new CallSession({
3608
3616
  callId: call.id,
@@ -3601,6 +3601,14 @@ class CallSession {
3601
3601
  return !!this.answerTime;
3602
3602
  }
3603
3603
 
3604
+ toJSON() {
3605
+ const jsonObj = { ...this };
3606
+ // $FlowFixMe
3607
+ jsonObj.answered = this.answered;
3608
+
3609
+ return jsonObj;
3610
+ }
3611
+
3604
3612
  static parseCall(call ) {
3605
3613
  return new CallSession({
3606
3614
  callId: call.id,
@@ -601,6 +601,14 @@ class CallSession {
601
601
  return !!this.answerTime;
602
602
  }
603
603
 
604
+ toJSON() {
605
+ const jsonObj = { ...this };
606
+ // $FlowFixMe
607
+ jsonObj.answered = this.answered;
608
+
609
+ return jsonObj;
610
+ }
611
+
604
612
  static parseCall(call ) {
605
613
  return new CallSession({
606
614
  callId: call.id,
@@ -3601,6 +3601,14 @@ class CallSession {
3601
3601
  return !!this.answerTime;
3602
3602
  }
3603
3603
 
3604
+ toJSON() {
3605
+ const jsonObj = { ...this };
3606
+ // $FlowFixMe
3607
+ jsonObj.answered = this.answered;
3608
+
3609
+ return jsonObj;
3610
+ }
3611
+
3604
3612
  static parseCall(call ) {
3605
3613
  return new CallSession({
3606
3614
  callId: call.id,
@@ -3627,6 +3627,14 @@ class CallSession {
3627
3627
  return !!this.answerTime;
3628
3628
  }
3629
3629
 
3630
+ toJSON() {
3631
+ const jsonObj = { ...this };
3632
+ // $FlowFixMe
3633
+ jsonObj.answered = this.answered;
3634
+
3635
+ return jsonObj;
3636
+ }
3637
+
3630
3638
  static parseCall(call ) {
3631
3639
  return new CallSession({
3632
3640
  callId: call.id,
@@ -3627,6 +3627,14 @@ class CallSession {
3627
3627
  return !!this.answerTime;
3628
3628
  }
3629
3629
 
3630
+ toJSON() {
3631
+ const jsonObj = { ...this };
3632
+ // $FlowFixMe
3633
+ jsonObj.answered = this.answered;
3634
+
3635
+ return jsonObj;
3636
+ }
3637
+
3630
3638
  static parseCall(call ) {
3631
3639
  return new CallSession({
3632
3640
  callId: call.id,
@@ -3601,6 +3601,14 @@ class CallSession {
3601
3601
  return !!this.answerTime;
3602
3602
  }
3603
3603
 
3604
+ toJSON() {
3605
+ const jsonObj = { ...this };
3606
+ // $FlowFixMe
3607
+ jsonObj.answered = this.answered;
3608
+
3609
+ return jsonObj;
3610
+ }
3611
+
3604
3612
  static parseCall(call ) {
3605
3613
  return new CallSession({
3606
3614
  callId: call.id,
@@ -3603,6 +3603,14 @@ class CallSession {
3603
3603
  return !!this.answerTime;
3604
3604
  }
3605
3605
 
3606
+ toJSON() {
3607
+ const jsonObj = { ...this };
3608
+ // $FlowFixMe
3609
+ jsonObj.answered = this.answered;
3610
+
3611
+ return jsonObj;
3612
+ }
3613
+
3606
3614
  static parseCall(call ) {
3607
3615
  return new CallSession({
3608
3616
  callId: call.id,
@@ -3601,6 +3601,14 @@ class CallSession {
3601
3601
  return !!this.answerTime;
3602
3602
  }
3603
3603
 
3604
+ toJSON() {
3605
+ const jsonObj = { ...this };
3606
+ // $FlowFixMe
3607
+ jsonObj.answered = this.answered;
3608
+
3609
+ return jsonObj;
3610
+ }
3611
+
3604
3612
  static parseCall(call ) {
3605
3613
  return new CallSession({
3606
3614
  callId: call.id,