@wazo/sdk 0.39.14 → 0.40.0

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 (288) hide show
  1. package/README.md +2 -2
  2. package/dist/wazo-sdk.js +12 -12
  3. package/esm/__tests__/api-client.test.js +0 -10
  4. package/esm/__tests__/web-rtc-client.test.js +2 -15
  5. package/esm/api/amid.js +12 -4
  6. package/esm/api/chatd.js +0 -1
  7. package/esm/api/dird.js +7 -10
  8. package/esm/checker/checks/ice-ipv4.js +2 -3
  9. package/esm/checker/checks/symmetric-nat.js +7 -4
  10. package/esm/domain/AdHocAPIConference.js +1 -1
  11. package/esm/domain/CallLog.js +1 -1
  12. package/esm/domain/Contact.js +2 -1
  13. package/esm/domain/MeetingAuthorization.js +6 -0
  14. package/esm/domain/Phone/CTIPhone.js +2 -0
  15. package/esm/domain/Phone/WebRTCPhone.js +23 -18
  16. package/esm/domain/Session.js +2 -2
  17. package/esm/domain/__tests__/Agent.test.js +0 -2
  18. package/esm/domain/__tests__/Call.test.js +0 -1
  19. package/esm/domain/__tests__/CallLog.test.js +0 -1
  20. package/esm/domain/__tests__/CallSession.test.js +1 -2
  21. package/esm/domain/__tests__/Contact.test.js +2 -4
  22. package/esm/domain/__tests__/IndirectTransfer.test.js +0 -1
  23. package/esm/domain/__tests__/Profile.test.js +0 -1
  24. package/esm/domain/__tests__/Room.test.js +1 -25
  25. package/esm/domain/__tests__/Session.test.js +13 -14
  26. package/esm/domain/__tests__/SipLine.test.js +2 -3
  27. package/esm/index.js +42 -88
  28. package/esm/lib/WazoSessionDescriptionHandler.js +9 -15
  29. package/esm/service/IssueReporter.js +1 -3
  30. package/esm/service/__tests__/IssueReporter.test.js +0 -1
  31. package/esm/simple/Phone.js +1 -1
  32. package/esm/simple/Websocket.js +2 -2
  33. package/esm/simple/index.js +5 -4
  34. package/esm/simple/room/Room.js +15 -15
  35. package/esm/simple/room/SipRoom.js +1 -1
  36. package/esm/simple/room/Stream.js +1 -2
  37. package/esm/simple/room/__tests__/Participant.test.js +0 -2
  38. package/esm/simple/room/__tests__/RemoteParticipant.test.js +1 -2
  39. package/esm/types/api/amid.d.ts.map +1 -1
  40. package/esm/types/api/auth.d.ts +2 -2
  41. package/esm/types/api/auth.d.ts.map +1 -1
  42. package/esm/types/api/call-logd.d.ts +3 -3
  43. package/esm/types/api/call-logd.d.ts.map +1 -1
  44. package/esm/types/api/chatd.d.ts +9 -22
  45. package/esm/types/api/chatd.d.ts.map +1 -1
  46. package/esm/types/api/dird.d.ts +21 -14
  47. package/esm/types/api/dird.d.ts.map +1 -1
  48. package/esm/types/checker/checks/ice-ipv4.d.ts.map +1 -1
  49. package/esm/types/checker/checks/index.d.ts +1 -1
  50. package/esm/types/checker/checks/symmetric-nat.d.ts.map +1 -1
  51. package/esm/types/checker/checks/webrtc-transport.d.ts +2 -2
  52. package/esm/types/checker/checks/webrtc-transport.d.ts.map +1 -1
  53. package/esm/types/domain/Agent.d.ts +1 -1
  54. package/esm/types/domain/Agent.d.ts.map +1 -1
  55. package/esm/types/domain/CallLog.d.ts +14 -26
  56. package/esm/types/domain/CallLog.d.ts.map +1 -1
  57. package/esm/types/domain/CallSession.d.ts +3 -4
  58. package/esm/types/domain/CallSession.d.ts.map +1 -1
  59. package/esm/types/domain/Contact.d.ts +8 -0
  60. package/esm/types/domain/Contact.d.ts.map +1 -1
  61. package/esm/types/domain/MeetingAuthorization.d.ts +6 -0
  62. package/esm/types/domain/MeetingAuthorization.d.ts.map +1 -1
  63. package/esm/types/domain/Phone/CTIPhone.d.ts +2 -0
  64. package/esm/types/domain/Phone/CTIPhone.d.ts.map +1 -1
  65. package/esm/types/domain/Phone/Phone.d.ts +12 -2
  66. package/esm/types/domain/Phone/Phone.d.ts.map +1 -1
  67. package/esm/types/domain/Phone/WebRTCPhone.d.ts +24 -20
  68. package/esm/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
  69. package/esm/types/domain/Room.d.ts +10 -12
  70. package/esm/types/domain/Room.d.ts.map +1 -1
  71. package/esm/types/domain/Session.d.ts +1 -1
  72. package/esm/types/domain/Session.d.ts.map +1 -1
  73. package/esm/types/domain/SipLine.d.ts +3 -3
  74. package/esm/types/domain/SipLine.d.ts.map +1 -1
  75. package/esm/types/domain/types.d.ts +64 -10
  76. package/esm/types/domain/types.d.ts.map +1 -1
  77. package/esm/types/index.d.ts +51 -314
  78. package/esm/types/index.d.ts.map +1 -1
  79. package/esm/types/lib/WazoSessionDescriptionHandler.d.ts +5 -4
  80. package/esm/types/lib/WazoSessionDescriptionHandler.d.ts.map +1 -1
  81. package/esm/types/service/CallApi.d.ts +3 -3
  82. package/esm/types/service/CallApi.d.ts.map +1 -1
  83. package/esm/types/service/IssueReporter.d.ts.map +1 -1
  84. package/esm/types/simple/Auth.d.ts +0 -40
  85. package/esm/types/simple/Auth.d.ts.map +1 -1
  86. package/esm/types/simple/Phone.d.ts +0 -113
  87. package/esm/types/simple/Phone.d.ts.map +1 -1
  88. package/esm/types/simple/Websocket.d.ts +0 -16
  89. package/esm/types/simple/Websocket.d.ts.map +1 -1
  90. package/esm/types/simple/index.d.ts +8 -8
  91. package/esm/types/simple/index.d.ts.map +1 -1
  92. package/esm/types/simple/room/Participant.d.ts +4 -3
  93. package/esm/types/simple/room/Participant.d.ts.map +1 -1
  94. package/esm/types/simple/room/Room.d.ts +29 -18
  95. package/esm/types/simple/room/Room.d.ts.map +1 -1
  96. package/esm/types/simple/room/SipRoom.d.ts +1 -1
  97. package/esm/types/simple/room/SipRoom.d.ts.map +1 -1
  98. package/esm/types/simple/room/Stream.d.ts +1 -1
  99. package/esm/types/simple/room/Stream.d.ts.map +1 -1
  100. package/esm/types/utils/PhoneNumberUtil.d.ts +1 -1
  101. package/esm/types/utils/PhoneNumberUtil.d.ts.map +1 -1
  102. package/esm/types/utils/api-requester.d.ts +1 -1
  103. package/esm/types/utils/api-requester.d.ts.map +1 -1
  104. package/esm/types/utils/sdp.d.ts +20 -5
  105. package/esm/types/utils/sdp.d.ts.map +1 -1
  106. package/esm/types/web-rtc-client.d.ts +51 -49
  107. package/esm/types/web-rtc-client.d.ts.map +1 -1
  108. package/esm/types/websocket-client.d.ts.map +1 -1
  109. package/esm/utils/__tests__/PhoneNumberUtil.test.js +0 -6
  110. package/esm/utils/__tests__/api-requester.test.js +0 -2
  111. package/esm/utils/__tests__/sdp.test.js +4 -18
  112. package/esm/utils/api-requester.js +1 -2
  113. package/esm/utils/sdp.js +8 -3
  114. package/esm/web-rtc-client.js +99 -136
  115. package/esm/websocket-client.js +1 -2
  116. package/index.js +1 -0
  117. package/lib/__tests__/api-client.test.js +0 -10
  118. package/lib/__tests__/web-rtc-client.test.js +2 -15
  119. package/lib/api/amid.js +12 -4
  120. package/lib/api/chatd.js +0 -1
  121. package/lib/api/dird.js +19 -22
  122. package/lib/checker/checks/ice-ipv4.js +2 -3
  123. package/lib/checker/checks/symmetric-nat.js +7 -4
  124. package/lib/domain/AdHocAPIConference.js +1 -1
  125. package/lib/domain/CallLog.js +1 -1
  126. package/lib/domain/Contact.js +2 -1
  127. package/lib/domain/MeetingAuthorization.js +6 -0
  128. package/lib/domain/Phone/CTIPhone.js +2 -0
  129. package/lib/domain/Phone/WebRTCPhone.js +23 -18
  130. package/lib/domain/Session.js +2 -2
  131. package/lib/domain/__tests__/Agent.test.js +0 -2
  132. package/lib/domain/__tests__/Call.test.js +0 -1
  133. package/lib/domain/__tests__/CallLog.test.js +0 -1
  134. package/lib/domain/__tests__/CallSession.test.js +1 -2
  135. package/lib/domain/__tests__/Contact.test.js +2 -4
  136. package/lib/domain/__tests__/IndirectTransfer.test.js +0 -1
  137. package/lib/domain/__tests__/Profile.test.js +0 -1
  138. package/lib/domain/__tests__/Room.test.js +1 -25
  139. package/lib/domain/__tests__/Session.test.js +13 -14
  140. package/lib/domain/__tests__/SipLine.test.js +2 -3
  141. package/lib/index.js +93 -99
  142. package/lib/lib/WazoSessionDescriptionHandler.js +9 -15
  143. package/lib/service/IssueReporter.js +1 -3
  144. package/lib/service/__tests__/IssueReporter.test.js +0 -1
  145. package/lib/simple/Phone.js +1 -1
  146. package/lib/simple/Websocket.js +2 -2
  147. package/lib/simple/index.js +2 -1
  148. package/lib/simple/room/Room.js +17 -15
  149. package/lib/simple/room/SipRoom.js +1 -1
  150. package/lib/simple/room/Stream.js +1 -2
  151. package/lib/simple/room/__tests__/Participant.test.js +0 -2
  152. package/lib/simple/room/__tests__/RemoteParticipant.test.js +1 -2
  153. package/lib/types/api/amid.d.ts.map +1 -1
  154. package/lib/types/api/auth.d.ts +2 -2
  155. package/lib/types/api/auth.d.ts.map +1 -1
  156. package/lib/types/api/call-logd.d.ts +3 -3
  157. package/lib/types/api/call-logd.d.ts.map +1 -1
  158. package/lib/types/api/chatd.d.ts +9 -22
  159. package/lib/types/api/chatd.d.ts.map +1 -1
  160. package/lib/types/api/dird.d.ts +21 -14
  161. package/lib/types/api/dird.d.ts.map +1 -1
  162. package/lib/types/checker/checks/ice-ipv4.d.ts.map +1 -1
  163. package/lib/types/checker/checks/index.d.ts +1 -1
  164. package/lib/types/checker/checks/symmetric-nat.d.ts.map +1 -1
  165. package/lib/types/checker/checks/webrtc-transport.d.ts +2 -2
  166. package/lib/types/checker/checks/webrtc-transport.d.ts.map +1 -1
  167. package/lib/types/domain/Agent.d.ts +1 -1
  168. package/lib/types/domain/Agent.d.ts.map +1 -1
  169. package/lib/types/domain/CallLog.d.ts +14 -26
  170. package/lib/types/domain/CallLog.d.ts.map +1 -1
  171. package/lib/types/domain/CallSession.d.ts +3 -4
  172. package/lib/types/domain/CallSession.d.ts.map +1 -1
  173. package/lib/types/domain/Contact.d.ts +8 -0
  174. package/lib/types/domain/Contact.d.ts.map +1 -1
  175. package/lib/types/domain/MeetingAuthorization.d.ts +6 -0
  176. package/lib/types/domain/MeetingAuthorization.d.ts.map +1 -1
  177. package/lib/types/domain/Phone/CTIPhone.d.ts +2 -0
  178. package/lib/types/domain/Phone/CTIPhone.d.ts.map +1 -1
  179. package/lib/types/domain/Phone/Phone.d.ts +12 -2
  180. package/lib/types/domain/Phone/Phone.d.ts.map +1 -1
  181. package/lib/types/domain/Phone/WebRTCPhone.d.ts +24 -20
  182. package/lib/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
  183. package/lib/types/domain/Room.d.ts +10 -12
  184. package/lib/types/domain/Room.d.ts.map +1 -1
  185. package/lib/types/domain/Session.d.ts +1 -1
  186. package/lib/types/domain/Session.d.ts.map +1 -1
  187. package/lib/types/domain/SipLine.d.ts +3 -3
  188. package/lib/types/domain/SipLine.d.ts.map +1 -1
  189. package/lib/types/domain/types.d.ts +64 -10
  190. package/lib/types/domain/types.d.ts.map +1 -1
  191. package/lib/types/index.d.ts +51 -314
  192. package/lib/types/index.d.ts.map +1 -1
  193. package/lib/types/lib/WazoSessionDescriptionHandler.d.ts +5 -4
  194. package/lib/types/lib/WazoSessionDescriptionHandler.d.ts.map +1 -1
  195. package/lib/types/service/CallApi.d.ts +3 -3
  196. package/lib/types/service/CallApi.d.ts.map +1 -1
  197. package/lib/types/service/IssueReporter.d.ts.map +1 -1
  198. package/lib/types/simple/Auth.d.ts +0 -40
  199. package/lib/types/simple/Auth.d.ts.map +1 -1
  200. package/lib/types/simple/Phone.d.ts +0 -113
  201. package/lib/types/simple/Phone.d.ts.map +1 -1
  202. package/lib/types/simple/Websocket.d.ts +0 -16
  203. package/lib/types/simple/Websocket.d.ts.map +1 -1
  204. package/lib/types/simple/index.d.ts +8 -8
  205. package/lib/types/simple/index.d.ts.map +1 -1
  206. package/lib/types/simple/room/Participant.d.ts +4 -3
  207. package/lib/types/simple/room/Participant.d.ts.map +1 -1
  208. package/lib/types/simple/room/Room.d.ts +29 -18
  209. package/lib/types/simple/room/Room.d.ts.map +1 -1
  210. package/lib/types/simple/room/SipRoom.d.ts +1 -1
  211. package/lib/types/simple/room/SipRoom.d.ts.map +1 -1
  212. package/lib/types/simple/room/Stream.d.ts +1 -1
  213. package/lib/types/simple/room/Stream.d.ts.map +1 -1
  214. package/lib/types/utils/PhoneNumberUtil.d.ts +1 -1
  215. package/lib/types/utils/PhoneNumberUtil.d.ts.map +1 -1
  216. package/lib/types/utils/api-requester.d.ts +1 -1
  217. package/lib/types/utils/api-requester.d.ts.map +1 -1
  218. package/lib/types/utils/sdp.d.ts +20 -5
  219. package/lib/types/utils/sdp.d.ts.map +1 -1
  220. package/lib/types/web-rtc-client.d.ts +51 -49
  221. package/lib/types/web-rtc-client.d.ts.map +1 -1
  222. package/lib/types/websocket-client.d.ts.map +1 -1
  223. package/lib/utils/__tests__/PhoneNumberUtil.test.js +0 -6
  224. package/lib/utils/__tests__/api-requester.test.js +0 -2
  225. package/lib/utils/__tests__/sdp.test.js +6 -18
  226. package/lib/utils/api-requester.js +2 -3
  227. package/lib/utils/sdp.js +9 -3
  228. package/lib/web-rtc-client.js +105 -140
  229. package/lib/websocket-client.js +1 -2
  230. package/package.json +5 -18
  231. package/src/__tests__/api-client.test.ts +10 -19
  232. package/src/__tests__/web-rtc-client.test.ts +13 -25
  233. package/src/api/amid.ts +13 -4
  234. package/src/api/auth.ts +2 -5
  235. package/src/api/call-logd.ts +3 -3
  236. package/src/api/chatd.ts +10 -24
  237. package/src/api/dird.ts +33 -39
  238. package/src/checker/checks/ice-ipv4.ts +4 -5
  239. package/src/checker/checks/symmetric-nat.ts +11 -7
  240. package/src/checker/checks/webrtc-transport.ts +2 -2
  241. package/src/domain/AdHocAPIConference.ts +1 -1
  242. package/src/domain/Agent.ts +1 -1
  243. package/src/domain/CallLog.ts +19 -27
  244. package/src/domain/CallSession.ts +3 -4
  245. package/src/domain/Contact.ts +3 -1
  246. package/src/domain/MeetingAuthorization.ts +13 -0
  247. package/src/domain/Phone/CTIPhone.ts +4 -0
  248. package/src/domain/Phone/Phone.ts +11 -2
  249. package/src/domain/Phone/WebRTCPhone.ts +60 -52
  250. package/src/domain/Room.ts +12 -14
  251. package/src/domain/Session.ts +3 -3
  252. package/src/domain/SipLine.ts +3 -3
  253. package/src/domain/__tests__/Agent.test.ts +3 -5
  254. package/src/domain/__tests__/Call.test.ts +4 -5
  255. package/src/domain/__tests__/CallLog.test.ts +1 -3
  256. package/src/domain/__tests__/CallSession.test.ts +10 -11
  257. package/src/domain/__tests__/Contact.test.ts +2 -4
  258. package/src/domain/__tests__/IndirectTransfer.test.ts +6 -7
  259. package/src/domain/__tests__/Profile.test.ts +3 -4
  260. package/src/domain/__tests__/Room.test.ts +27 -51
  261. package/src/domain/__tests__/Session.test.ts +27 -28
  262. package/src/domain/__tests__/SipLine.test.ts +4 -5
  263. package/src/domain/types.ts +64 -11
  264. package/src/index.ts +51 -111
  265. package/src/lib/WazoSessionDescriptionHandler.ts +24 -30
  266. package/src/service/CallApi.ts +3 -3
  267. package/src/service/IssueReporter.ts +3 -5
  268. package/src/service/__tests__/IssueReporter.test.ts +1 -2
  269. package/src/simple/Auth.ts +1 -41
  270. package/src/simple/Phone.ts +9 -116
  271. package/src/simple/Websocket.ts +4 -20
  272. package/src/simple/index.ts +8 -7
  273. package/src/simple/room/Participant.ts +4 -3
  274. package/src/simple/room/Room.ts +44 -36
  275. package/src/simple/room/SipRoom.ts +4 -4
  276. package/src/simple/room/Stream.ts +2 -3
  277. package/src/simple/room/__tests__/Participant.test.ts +2 -4
  278. package/src/simple/room/__tests__/RemoteParticipant.test.ts +4 -3
  279. package/src/types/wazo.d.ts +1 -0
  280. package/src/utils/PhoneNumberUtil.ts +1 -1
  281. package/src/utils/__tests__/PhoneNumberUtil.test.ts +0 -6
  282. package/src/utils/__tests__/api-requester.test.ts +3 -4
  283. package/src/utils/__tests__/sdp.test.ts +16 -30
  284. package/src/utils/api-requester.ts +1 -4
  285. package/src/utils/sdp.ts +38 -17
  286. package/src/web-rtc-client.ts +196 -234
  287. package/src/websocket-client.ts +2 -3
  288. package/lib/.DS_Store +0 -0
@@ -7,7 +7,6 @@ describe('Room', () => {
7
7
  const number = 'some-number';
8
8
  const room = new Room({
9
9
  id: 'some-id',
10
- // @ts-expect-error
11
10
  connectedCallSession: new CallSession({
12
11
  number,
13
12
  }),
@@ -31,11 +30,9 @@ describe('Room', () => {
31
30
  });
32
31
  describe('on connect call', () => {
33
32
  it('should add call to room', async () => {
34
- // @ts-expect-error
35
33
  const room = new Room({
36
34
  id: 'some-id',
37
35
  });
38
- // @ts-expect-error
39
36
  const callSession = new CallSession({
40
37
  callId: 'some-call-id',
41
38
  });
@@ -46,11 +43,9 @@ describe('Room', () => {
46
43
  describe('on room has call', () => {
47
44
  describe('given no connected call', () => {
48
45
  it('should be false', async () => {
49
- // @ts-expect-error
50
46
  const room = new Room({
51
47
  connectedCallSession: null,
52
48
  });
53
- // @ts-expect-error
54
49
  const callSession = new CallSession({});
55
50
  const roomHasCall = room.has(callSession);
56
51
  expect(roomHasCall).toBeFalsy();
@@ -58,11 +53,9 @@ describe('Room', () => {
58
53
  });
59
54
  describe('given a connected call', () => {
60
55
  it('should be true if same calls', async () => {
61
- // @ts-expect-error
62
56
  const callSession = new CallSession({
63
57
  callId: 'some-call-id',
64
58
  });
65
- // @ts-expect-error
66
59
  const room = new Room({
67
60
  connectedCallSession: callSession,
68
61
  });
@@ -70,15 +63,12 @@ describe('Room', () => {
70
63
  expect(roomHasCall).toBeTruthy();
71
64
  });
72
65
  it('should be false if different calls', async () => {
73
- // @ts-expect-error
74
66
  const call1 = new CallSession({
75
67
  callId: 'some-call-id',
76
68
  });
77
- // @ts-expect-error
78
69
  const call2 = new CallSession({
79
70
  callId: 'some-other-call-id',
80
71
  });
81
- // @ts-expect-error
82
72
  const room = new Room({
83
73
  connectedCallSession: call1,
84
74
  });
@@ -92,7 +82,6 @@ describe('Room', () => {
92
82
  const participants = [{}];
93
83
  const room = new Room({
94
84
  connectedCallSession: null,
95
- // @ts-expect-error
96
85
  participants,
97
86
  });
98
87
  const participantUuid = 'some-uuid';
@@ -105,7 +94,6 @@ describe('Room', () => {
105
94
  describe('on room has call with id', () => {
106
95
  describe('given no connected call', () => {
107
96
  it('should be false', async () => {
108
- // @ts-expect-error
109
97
  const room = new Room({
110
98
  connectedCallSession: null,
111
99
  });
@@ -117,9 +105,7 @@ describe('Room', () => {
117
105
  describe('given a connected call', () => {
118
106
  it('should be true if same calls', async () => {
119
107
  const callId = 'some-call-id';
120
- // @ts-expect-error
121
108
  const room = new Room({
122
- // @ts-expect-error
123
109
  connectedCallSession: new CallSession({
124
110
  callId,
125
111
  }),
@@ -129,9 +115,7 @@ describe('Room', () => {
129
115
  });
130
116
  it('should be false if different calls', async () => {
131
117
  const callId = 'some-call-id';
132
- // @ts-expect-error
133
118
  const room = new Room({
134
- // @ts-expect-error
135
119
  connectedCallSession: new CallSession({
136
120
  callId: 'some-other-call-id',
137
121
  }),
@@ -145,7 +129,6 @@ describe('Room', () => {
145
129
  it('should updated participant with corresponding UUID', async () => {
146
130
  const uuid = 'some-uuid';
147
131
  const room = new Room({
148
- // @ts-expect-error
149
132
  participants: [{
150
133
  uuid,
151
134
  talking: true,
@@ -159,7 +142,6 @@ describe('Room', () => {
159
142
  });
160
143
  it('should add participant when not found', async () => {
161
144
  const uuid = 'some-uuid';
162
- // @ts-expect-error
163
145
  const room = new Room({
164
146
  participants: [],
165
147
  });
@@ -171,16 +153,14 @@ describe('Room', () => {
171
153
  });
172
154
  describe('on updated participant by extension', () => {
173
155
  it('should updated participant with corresponding extension', async () => {
174
- const extension = 1234;
156
+ const extension = '1234';
175
157
  const room = new Room({
176
158
  participants: [{
177
- // @ts-expect-error
178
159
  extension,
179
160
  talking: false,
180
161
  }],
181
162
  });
182
163
  expect(room.participants[0].talking).toBeFalsy();
183
- // @ts-expect-error
184
164
  const updatedRoom = room.updateParticipantByExtension(extension, {
185
165
  talking: true,
186
166
  });
@@ -189,9 +169,7 @@ describe('Room', () => {
189
169
  });
190
170
  describe('on disconnect', () => {
191
171
  it('should destroy connected call', async () => {
192
- // @ts-expect-error
193
172
  const room = new Room({
194
- // @ts-expect-error
195
173
  connectedCallSession: new CallSession({}),
196
174
  });
197
175
  expect(room.connectedCallSession).not.toBeNull();
@@ -203,7 +181,6 @@ describe('Room', () => {
203
181
  it('should remove participant with corresponding UUID', async () => {
204
182
  const uuid = 'some-uuid';
205
183
  const room = new Room({
206
- // @ts-expect-error
207
184
  participants: [{
208
185
  uuid,
209
186
  }],
@@ -217,7 +194,6 @@ describe('Room', () => {
217
194
  it('should remove participant with corresponding UUID', async () => {
218
195
  const extension = 'some-extension';
219
196
  const room = new Room({
220
- // @ts-expect-error
221
197
  participants: [{
222
198
  extension,
223
199
  }],
@@ -25,7 +25,6 @@ describe('Session domain', () => {
25
25
  xivo_user_uuid: null,
26
26
  },
27
27
  };
28
- // @ts-ignore
29
28
  const session = Session.parse(plain);
30
29
  expect(session).toEqual(new Session({
31
30
  token: 'b93ae6bd-08d7-4001-9e61-057e72bbc4b3',
@@ -45,7 +44,7 @@ describe('Session domain', () => {
45
44
  const session = new Session({
46
45
  token: 'ref-12345',
47
46
  uuid: '1234',
48
- // @ts-expect-error
47
+ //
49
48
  profile: new Profile({
50
49
  voicemail: {
51
50
  id: 1234,
@@ -62,7 +61,7 @@ describe('Session domain', () => {
62
61
  const session = new Session({
63
62
  token: 'ref-12345',
64
63
  uuid: '1234',
65
- // @ts-expect-error
64
+ //
66
65
  profile: new Profile({
67
66
  lines: [new Line({
68
67
  id: 9012,
@@ -90,7 +89,7 @@ describe('Session domain', () => {
90
89
  const session = new Session({
91
90
  token: 'ref-12345',
92
91
  uuid: '1234',
93
- // @ts-expect-error
92
+ //
94
93
  profile: new Profile({
95
94
  lines: [new Line({
96
95
  id: 9012,
@@ -111,7 +110,7 @@ describe('Session domain', () => {
111
110
  const session = new Session({
112
111
  token: 'ref-12345',
113
112
  uuid: '1234',
114
- // @ts-expect-error
113
+ //
115
114
  profile: new Profile({
116
115
  voicemail: undefined,
117
116
  }),
@@ -162,7 +161,7 @@ describe('Session domain', () => {
162
161
  const session = new Session({
163
162
  token: 'ref-12345',
164
163
  uuid: '1234',
165
- // @ts-expect-error
164
+ //
166
165
  profile: new Profile({
167
166
  lines: [new Line({
168
167
  id: 9012,
@@ -224,7 +223,7 @@ describe('Session domain', () => {
224
223
  describe('and NO lines', () => {
225
224
  beforeEach(() => {
226
225
  A_SESSION = new Session({ ...A_SESSION,
227
- // @ts-expect-error
226
+ //
228
227
  profile: new Profile({
229
228
  lines: [],
230
229
  }),
@@ -244,10 +243,10 @@ describe('Session domain', () => {
244
243
  exten: '1',
245
244
  }],
246
245
  id: 1,
247
- // @ts-expect-error
246
+ //
248
247
  exten: 1,
249
248
  });
250
- // @ts-expect-error
249
+ //
251
250
  const profile = new Profile({
252
251
  lines: [line],
253
252
  });
@@ -270,7 +269,7 @@ describe('Session domain', () => {
270
269
  });
271
270
  describe('and NO lines', () => {
272
271
  beforeEach(() => {
273
- // @ts-expect-error
272
+ //
274
273
  const profile = new Profile({
275
274
  lines: [],
276
275
  });
@@ -292,10 +291,10 @@ describe('Session domain', () => {
292
291
  exten: '1',
293
292
  }],
294
293
  id: 1,
295
- // @ts-expect-error
294
+ //
296
295
  exten: 1,
297
296
  });
298
- // @ts-expect-error
297
+ //
299
298
  const profile = new Profile({
300
299
  lines: [line],
301
300
  });
@@ -327,10 +326,10 @@ describe('Session domain', () => {
327
326
  exten: '1',
328
327
  }],
329
328
  id: 1,
330
- // @ts-expect-error
329
+ //
331
330
  exten: 1,
332
331
  });
333
- // @ts-expect-error
332
+ //
334
333
  const profile = new Profile({
335
334
  lines: [line],
336
335
  });
@@ -1,9 +1,8 @@
1
- // @ts-nocheck
2
1
  import SipLine from '../SipLine';
3
2
  describe('SipLine domain', () => {
4
3
  describe('Endpoint (20.13 and higher)', () => {
5
4
  it('can tell if we have videoConference capabilities', () => {
6
- const getSipLine = endpointSectionOptions => new SipLine({
5
+ const getSipLine = (endpointSectionOptions) => new SipLine({
7
6
  endpointSectionOptions,
8
7
  });
9
8
  expect(getSipLine([['max_audio_streams', '1'], ['max_video_streams', '2']]).hasVideoConference()).toBe(true);
@@ -15,7 +14,7 @@ describe('SipLine domain', () => {
15
14
  });
16
15
  describe('Old Endpoint', () => {
17
16
  it('can tell if we have videoConference capabilities', () => {
18
- const getSipLine = options => new SipLine({
17
+ const getSipLine = (options) => new SipLine({
19
18
  options,
20
19
  });
21
20
  expect(getSipLine([['max_audio_streams', '1'], ['max_video_streams', '2']]).hasVideoConference()).toBe(true);
package/esm/index.js CHANGED
@@ -1,89 +1,43 @@
1
- import ApiClient from './api-client';
2
- import WebRTCClient from './web-rtc-client';
3
- import WebSocketClient, { SOCKET_EVENTS } from './websocket-client';
4
- import Emitter from './utils/Emitter';
5
- import IssueReporter from './service/IssueReporter';
6
- // Domain
7
- import BadResponse from './domain/BadResponse';
8
- import ServerError from './domain/ServerError';
9
- import SFUNotAvailableError from './domain/SFUNotAvailableError';
10
- import Call from './domain/Call';
11
- import CallLog from './domain/CallLog';
12
- import Recording from './domain/Recording';
13
- import ChatMessage from './domain/ChatMessage';
14
- import ChatRoom from './domain/ChatRoom';
15
- import Contact from './domain/Contact';
16
- import COUNTRIES from './domain/Country';
17
- import Features from './domain/Features';
18
- import ForwardOption, { FORWARD_KEYS } from './domain/ForwardOption';
19
- import Line from './domain/Line';
20
- import NotificationOptions from './domain/NotificationOptions';
21
- import Profile, { STATE as PROFILE_STATE, LINE_STATE } from './domain/Profile';
22
- import Session from './domain/Session';
23
- import Voicemail from './domain/Voicemail';
24
- import Relocation from './domain/Relocation';
25
- import Room from './domain/Room';
26
- import CallSession from './domain/CallSession';
27
- import IndirectTransfer from './domain/IndirectTransfer';
28
- import SwitchboardCall from './domain/SwitchboardCall';
29
- import WebRTCPhone from './domain/Phone/WebRTCPhone';
30
- import CTIPhone from './domain/Phone/CTIPhone';
31
- import Meeting from './domain/Meeting';
32
- import DebugDevice from './domain/Device/DebugDevice';
33
- import Checker from './checker/Checker';
34
- import { PhoneNumberUtil, PhoneNumberFormat, AsYouTypeFormatter, getDisplayableNumber, getCallableNumber } from './utils/PhoneNumberUtil';
35
- import ApiRequester from './utils/api-requester';
36
1
  import Wazo from './simple/index';
37
- import MeetingStatus from './domain/MeetingStatus';
38
- import MeetingAuthorization from './domain/MeetingAuthorization';
39
- import SipLine from './domain/SipLine';
40
- import getApiClient from './service/getApiClient';
41
- export default {
42
- ApiRequester,
43
- Checker,
44
- Emitter,
45
- PhoneNumberUtil,
46
- PhoneNumberFormat,
47
- AsYouTypeFormatter,
48
- getDisplayableNumber,
49
- getCallableNumber,
50
- WazoApiClient: ApiClient,
51
- WazoWebRTCClient: WebRTCClient,
52
- WazoWebSocketClient: WebSocketClient,
53
- BadResponse,
54
- ServerError,
55
- SFUNotAvailableError,
56
- Call,
57
- CallSession,
58
- CTIPhone,
59
- Features,
60
- IndirectTransfer,
61
- SwitchboardCall,
62
- CallLog,
63
- Recording,
64
- ChatMessage,
65
- ChatRoom,
66
- Contact,
67
- COUNTRIES,
68
- ForwardOption,
69
- Line,
70
- NotificationOptions,
71
- Profile,
72
- Session,
73
- Voicemail,
74
- Relocation,
75
- Room,
76
- IssueReporter,
77
- DebugDevice,
78
- PROFILE_STATE,
79
- FORWARD_KEYS,
80
- LINE_STATE,
81
- SOCKET_EVENTS,
82
- Wazo,
83
- WebRTCPhone,
84
- Meeting,
85
- MeetingAuthorization,
86
- MeetingStatus,
87
- SipLine,
88
- getApiClient,
89
- };
2
+ export { default as Emitter } from './utils/Emitter';
3
+ export { default as IssueReporter } from './service/IssueReporter';
4
+ export { default as BadResponse } from './domain/BadResponse';
5
+ export { default as ServerError } from './domain/ServerError';
6
+ export { default as SFUNotAvailableError } from './domain/SFUNotAvailableError';
7
+ export { default as Call } from './domain/Call';
8
+ export { default as CallLog } from './domain/CallLog';
9
+ export { default as Recording } from './domain/Recording';
10
+ export { default as ChatMessage } from './domain/ChatMessage';
11
+ export { default as ChatRoom } from './domain/ChatRoom';
12
+ export { default as Contact } from './domain/Contact';
13
+ export { default as COUNTRIES } from './domain/Country';
14
+ export { default as Features } from './domain/Features';
15
+ export { default as ForwardOption, FORWARD_KEYS } from './domain/ForwardOption';
16
+ export { default as Line } from './domain/Line';
17
+ export { default as NotificationOptions } from './domain/NotificationOptions';
18
+ export { default as Profile, STATE as PROFILE_STATE, LINE_STATE } from './domain/Profile';
19
+ export { default as Session } from './domain/Session';
20
+ export { default as Voicemail } from './domain/Voicemail';
21
+ export { default as Relocation } from './domain/Relocation';
22
+ export { default as Room } from './domain/Room';
23
+ export { default as CallSession } from './domain/CallSession';
24
+ export { default as IndirectTransfer } from './domain/IndirectTransfer';
25
+ export { default as SwitchboardCall } from './domain/SwitchboardCall';
26
+ export { default as WebRTCPhone } from './domain/Phone/WebRTCPhone';
27
+ export { default as CTIPhone } from './domain/Phone/CTIPhone';
28
+ export { default as Meeting } from './domain/Meeting';
29
+ export { default as DebugDevice } from './domain/Device/DebugDevice';
30
+ export { default as Checker } from './checker/Checker';
31
+ export * from './utils/PhoneNumberUtil';
32
+ export { default as ApiRequester } from './utils/api-requester';
33
+ export { default as MeetingStatus } from './domain/MeetingStatus';
34
+ export { default as MeetingAuthorization } from './domain/MeetingAuthorization';
35
+ export { default as SipLine } from './domain/SipLine';
36
+ export { default as getApiClient, setApiToken, setCurrentServer, setOnRefreshToken, setOnRefreshTokenError, setIsMobile } from './service/getApiClient';
37
+ export { default as CallApi } from './service/CallApi';
38
+ export { default as AdHocAPIConference } from './domain/AdHocAPIConference';
39
+ export { default as WebSocketClient, SOCKET_EVENTS } from './websocket-client';
40
+ export { default as WebRTCClient } from './web-rtc-client';
41
+ export { default as WazoApiClient } from './api-client';
42
+ export * from './domain/types';
43
+ export default Wazo;
@@ -55,7 +55,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
55
55
  return Promise.reject(new Error('Peer connection closed.'));
56
56
  }
57
57
  // Callback on data channel creation
58
- // @ts-ignore
58
+ // @ts-ignore: private
59
59
  this.onDataChannel = options.onDataChannel;
60
60
  // ICE will restart upon applying an offer created with the iceRestart option
61
61
  const iceRestart = options.offerOptions ? options.offerOptions.iceRestart : false;
@@ -64,7 +64,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
64
64
  // We should wait for ice when iceRestart (reinvite) or for the first invite
65
65
  // We shouldn't wait for ice when holding or resuming the call
66
66
  // We shouldn't wait for ice when receiving a reinvite (eg: pendingReinviteAck = true)
67
- // @ts-ignore
67
+ // @ts-ignore: private
68
68
  const shouldWaitForIce = !this.session.pendingReinviteAck && (iceRestart || 'constraints' in options);
69
69
  // ICE gathering timeout may be set on a per call basis, otherwise the configured default is used
70
70
  const iceTimeout = options.iceGatheringTimeout === undefined ? this.sessionDescriptionHandlerConfiguration?.iceGatheringTimeout : options.iceGatheringTimeout;
@@ -83,7 +83,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
83
83
  done: true,
84
84
  });
85
85
  if (event.candidate) {
86
- // @ts-ignore @REEVALUATE
86
+ // @ts-ignore: we're possibly inject null candidates
87
87
  this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
88
88
  // When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
89
89
  if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
@@ -125,7 +125,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
125
125
  return {
126
126
  type: description.type,
127
127
  // Fix sdp only when no candidates
128
- // @ts-ignore
129
128
  sdp: fixSdp(sdp, this.gatheredCandidates, options && options.constraints ? options.constraints.video : false),
130
129
  };
131
130
  })
@@ -171,16 +170,13 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
171
170
  return;
172
171
  }
173
172
  // Closing senders via getLocalStreams, `getLocalStreams` is deprecated, we have to check if it exists.
174
- // @ts-ignore
175
173
  if (this.peerConnection?.getLocalStreams) {
176
- // @ts-ignore
177
174
  this.peerConnection?.getLocalStreams().forEach(stream => {
178
175
  stream.getTracks()
179
176
  .filter((track) => track.enabled)
180
177
  .forEach((track) => track.stop());
181
178
  });
182
179
  // Closing receivers via getRemoteStreams
183
- // @ts-ignore
184
180
  this.peerConnection?.getRemoteStreams().forEach(stream => {
185
181
  stream.getTracks()
186
182
  .filter((track) => track.enabled)
@@ -292,7 +288,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
292
288
  })();
293
289
  // set the transceiver direction to the answer direction
294
290
  this._peerConnection.getTransceivers().forEach(transceiver => {
295
- // @ts-ignore
296
291
  if (transceiver.stopped) {
297
292
  return;
298
293
  }
@@ -352,11 +347,11 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
352
347
  if (oldTrack) {
353
348
  oldTrack.stop();
354
349
  localStream.removeTrack(oldTrack);
355
- // @ts-ignore
350
+ // @ts-ignore: private
356
351
  SessionDescriptionHandler.dispatchRemoveTrackEvent(localStream, oldTrack);
357
352
  }
358
353
  localStream.addTrack(newTrack);
359
- // @ts-ignore
354
+ // @ts-ignore: private
360
355
  SessionDescriptionHandler.dispatchAddTrackEvent(localStream, newTrack);
361
356
  }).catch((error) => {
362
357
  this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${kind} track`);
@@ -383,7 +378,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
383
378
  throw error;
384
379
  }
385
380
  localStream.addTrack(newTrack);
386
- // @ts-ignore
381
+ // @ts-ignore: private
387
382
  SessionDescriptionHandler.dispatchAddTrackEvent(localStream, newTrack);
388
383
  }));
389
384
  }
@@ -409,10 +404,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
409
404
  let constraints = options.constraints ? { ...options.constraints,
410
405
  } : {};
411
406
  // if we already have a local media stream...
412
- // @ts-ignore
407
+ // @ts-ignore: private
413
408
  if (this.localMediaStreamConstraints) {
414
409
  // if constraints have not changed, do not get a new media stream
415
- // @ts-ignore
410
+ // @ts-ignore: private
416
411
  if (JSON.stringify(this.localMediaStreamConstraints.audio) === JSON.stringify(constraints.audio) && JSON.stringify(this.localMediaStreamConstraints.video) === JSON.stringify(constraints.video)) {
417
412
  return Promise.resolve();
418
413
  }
@@ -423,9 +418,8 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
423
418
  audio: true,
424
419
  };
425
420
  }
426
- // @ts-ignore
421
+ // @ts-ignore: private
427
422
  this.localMediaStreamConstraints = constraints;
428
- // @ts-ignore
429
423
  return this.mediaStreamFactory(constraints, this).then(mediaStream => {
430
424
  this.setLocalMediaStream(mediaStream);
431
425
  return mediaStream;
@@ -126,7 +126,6 @@ class IssueReporter {
126
126
  errorMessage: lastArg.message,
127
127
  errorStack: lastArg.stack,
128
128
  errorType: lastArg.constructor.name,
129
- // @ts-ignore
130
129
  skipSendToRemote: lastArg.skipSendToRemote,
131
130
  };
132
131
  }
@@ -204,7 +203,7 @@ class IssueReporter {
204
203
  this.oldConsoleMethods = {};
205
204
  CONSOLE_METHODS.forEach((methodName) => {
206
205
  if (this.oldConsoleMethods) {
207
- // @ts-ignore
206
+ // @ts-ignore: keys
208
207
  // eslint-disable-next-line
209
208
  this.oldConsoleMethods[methodName] = console[methodName];
210
209
  }
@@ -297,7 +296,6 @@ class IssueReporter {
297
296
  },
298
297
  body,
299
298
  }).catch((e) => {
300
- // @ts-ignore
301
299
  e.skipSendToRemote = true;
302
300
  this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
303
301
  // wait at least 1 second, at most 50 seconds
@@ -18,7 +18,6 @@ describe('IssueReporter', () => {
18
18
  });
19
19
  beforeEach(() => {
20
20
  jest.resetAllMocks();
21
- // @ts-expect-error
22
21
  realFetch.mockImplementation(() => () => ({
23
22
  catch: () => { },
24
23
  }));
@@ -65,7 +65,7 @@ class Phone extends Emitter {
65
65
  super();
66
66
  // Sugar syntax for `Wazo.Phone.EVENT_NAME`
67
67
  Object.keys(PHONE_EVENTS).forEach((key) => {
68
- // @ts-ignore
68
+ // @ts-ignore: keys
69
69
  this[key] = PHONE_EVENTS[key];
70
70
  });
71
71
  this.SessionState = SessionState;
@@ -17,11 +17,11 @@ class Websocket extends Emitter {
17
17
  super();
18
18
  // Sugar syntax for `Wazo.WebSocket.EVENT_NAME`
19
19
  Object.keys(OTHER_EVENTS).forEach(key => {
20
- // @ts-ignore
20
+ // @ts-ignore: keys
21
21
  this[key] = OTHER_EVENTS[key];
22
22
  });
23
23
  Object.keys(SOCKET_EVENTS).forEach(key => {
24
- // @ts-ignore
24
+ // @ts-ignore: keys
25
25
  this[key] = SOCKET_EVENTS[key];
26
26
  });
27
27
  this.eventLists = WazoWebSocketClient.eventLists;
@@ -6,6 +6,7 @@ import Room from './room/Room';
6
6
  import SipRoom from './room/SipRoom';
7
7
  import RemoteParticipant from './room/RemoteParticipant';
8
8
  import LocalParticipant from './room/LocalParticipant';
9
+ import Participant from './room/Participant';
9
10
  import Stream from './room/Stream';
10
11
  import Directory from './Directory';
11
12
  import Configuration from './Configuration';
@@ -39,13 +40,14 @@ import Features from '../domain/Features';
39
40
  import Meeting from '../domain/Meeting';
40
41
  import Checker from '../checker/Checker';
41
42
  const Wazo = {
42
- Auth: Auth,
43
- Phone: Phone,
44
- Websocket: Websocket,
43
+ Auth,
44
+ Phone,
45
+ Websocket,
45
46
  Room,
46
47
  SipRoom,
47
48
  RemoteParticipant,
48
49
  LocalParticipant,
50
+ Participant,
49
51
  Stream,
50
52
  createLocalVideoStream,
51
53
  createLocalAudioStream,
@@ -124,7 +126,6 @@ const Wazo = {
124
126
  NoDomainNameError,
125
127
  };
126
128
  if (window) {
127
- // @ts-ignore
128
129
  window.Wazo = Wazo;
129
130
  }
130
131
  if (global) {