@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
@@ -108,7 +108,7 @@ export default class Session {
108
108
  if (token) {
109
109
  const isValid = jws.JWS.verifyJWT(token, swarmKey, {
110
110
  alg: ['RS256'],
111
- // @ts-ignore
111
+ // @ts-ignore: date / number
112
112
  verifyAt: new Date(),
113
113
  });
114
114
 
@@ -247,8 +247,8 @@ export default class Session {
247
247
  return line && Array.isArray(line.extensions) && line.extensions.length > 0 ? line.extensions[0].context : 'default';
248
248
  }
249
249
 
250
- hasEngineVersionGte(version: string) {
251
- return this.engineVersion && compareVersions(String(this.engineVersion), String(version)) >= 0;
250
+ hasEngineVersionGte(version: string): boolean {
251
+ return !!this.engineVersion && compareVersions(String(this.engineVersion), String(version)) >= 0;
252
252
  }
253
253
 
254
254
  primaryNumber(): string | null | undefined {
@@ -3,7 +3,7 @@ import type { Endpoint } from './Line';
3
3
 
4
4
  const availableCodecs = ['vp8', 'vp9', 'h264'];
5
5
  type SipLineResponse = {
6
- id: number;
6
+ id: string;
7
7
  uuid: string;
8
8
  tenant_uuid: string;
9
9
  username: string;
@@ -18,7 +18,7 @@ type SipLineResponse = {
18
18
  line: Endpoint;
19
19
  };
20
20
  type SipLineArguments = {
21
- id: number;
21
+ id: string;
22
22
  uuid: string;
23
23
  tenantUuid: string;
24
24
  username: string;
@@ -32,7 +32,7 @@ type SipLineArguments = {
32
32
  line: Endpoint;
33
33
  };
34
34
  export default class SipLine {
35
- id: any;
35
+ id: string;
36
36
 
37
37
  uuid: string;
38
38
 
@@ -1,4 +1,4 @@
1
- import Agent, { AgentResponse } from '../Agent';
1
+ import Agent, { AgentArguments, AgentResponse } from '../Agent';
2
2
 
3
3
  const fieldMap: Record<string, any> = {
4
4
  context: 'context',
@@ -27,14 +27,12 @@ Object.keys(fieldMap).forEach((field: string) => {
27
27
  });
28
28
  describe('Call Center Agent domain', () => {
29
29
  it('should keep its values', () => {
30
- // @ts-expect-error
31
- const agent = new Agent(formatted) as any;
30
+ const agent = new Agent(formatted as AgentArguments) as any;
32
31
  expect(agent).toBeInstanceOf(Agent);
33
32
  Object.keys(fieldMap).map(key => expect(agent[key]).toBe(formatted[key]));
34
33
  });
35
34
  it('can parse a plain call center agent to domain', () => {
36
35
  const agent = Agent.parse(plain as AgentResponse);
37
- // @ts-expect-error
38
- expect(agent).toEqual(new Agent(formatted));
36
+ expect(agent).toEqual(new Agent(formatted as AgentArguments));
39
37
  });
40
38
  });
@@ -1,12 +1,11 @@
1
- // @ts-nocheck
2
1
  import Call from '../Call';
3
2
 
4
3
  describe('Call domain', () => {
5
4
  it('can return the elapsed time since its creation in seconds', () => {
6
- Date.now = jest.fn(() => new Date(2012, 7, 28, 13, 0, 0));
5
+ Date.now = jest.fn(() => new Date(2012, 7, 28, 13, 0, 0)) as any;
7
6
  const call = new Call({
8
7
  startingTime: new Date(2012, 7, 28, 12, 30, 0),
9
- });
8
+ } as any);
10
9
  const elapsedTimeInSeconds = call.getElapsedTimeInSeconds();
11
10
  expect(elapsedTimeInSeconds).toBe(30 * 60);
12
11
  });
@@ -14,14 +13,14 @@ describe('Call domain', () => {
14
13
  const call = new Call({
15
14
  calleeName: 'John Doe',
16
15
  calleeNumber: '911',
17
- });
16
+ } as any);
18
17
  expect(call.hasNumber('911')).toBeTruthy();
19
18
  });
20
19
  it('does not have the number provided it is a different number', () => {
21
20
  const call = new Call({
22
21
  calleeName: 'John Doe',
23
22
  calleeNumber: '911',
24
- });
23
+ } as any);
25
24
  expect(call.hasNumber('418-222-5555')).toBeFalsy();
26
25
  });
27
26
  });
@@ -1,5 +1,3 @@
1
- // @ts-nocheck
2
-
3
1
  import moment from 'moment';
4
2
  import CallLog from '../CallLog';
5
3
  import Recording from '../Recording';
@@ -34,7 +32,7 @@ describe('CallLog domain', () => {
34
32
  }],
35
33
  total: 233,
36
34
  };
37
- const logs = CallLog.parseMany(response);
35
+ const logs = CallLog.parseMany(response as any);
38
36
  expect(logs).toEqual([new CallLog({
39
37
  answer: moment('2017-08-07T13:51:18.892002+00:00').toDate(),
40
38
  answered: true,
@@ -1,7 +1,6 @@
1
- // @ts-nocheck
2
1
  import CallSession from '../CallSession';
3
2
 
4
- const stringify = cs => JSON.parse(JSON.stringify(cs));
3
+ const stringify = (cs: any) => JSON.parse(JSON.stringify(cs));
5
4
 
6
5
  describe('CallSession domain', () => {
7
6
  it('should update from another CallSession without data loss', () => {
@@ -12,14 +11,14 @@ describe('CallSession domain', () => {
12
11
  number: '8001',
13
12
  isCaller: true,
14
13
  dialedExtension: null,
15
- });
14
+ } as any);
16
15
  const anotherCallSession = new CallSession({
17
16
  callId: 345,
18
17
  callerNumber: '8008',
19
18
  number: '8008',
20
19
  isCaller: false,
21
20
  dialedExtension: undefined,
22
- });
21
+ } as any);
23
22
  callSession.updateFrom(anotherCallSession);
24
23
  expect(callSession.callId).toBe(345);
25
24
  expect(callSession.sipCallId).toBe(123);
@@ -34,22 +33,22 @@ describe('CallSession domain', () => {
34
33
  const cs1 = new CallSession({
35
34
  callId: 123,
36
35
  sipCallId: 456,
37
- });
36
+ } as any);
38
37
  const cs2 = new CallSession({
39
38
  callId: 123,
40
39
  sipCallId: null,
41
- });
40
+ } as any);
42
41
  expect(cs1.is(cs2)).toBeTruthy();
43
42
  expect(cs2.is(cs1)).toBeTruthy();
44
43
  });
45
44
  it('should set answerTime when setting answered to true', () => {
46
- const cs1 = new CallSession({});
45
+ const cs1 = new CallSession({} as any);
47
46
  cs1.answered = true;
48
- const cs2 = new CallSession({});
47
+ const cs2 = new CallSession({} as any);
49
48
  cs2.answer();
50
49
  const cs3 = new CallSession({
51
50
  answered: true,
52
- });
51
+ } as any);
53
52
  expect(cs1.answered).toEqual(true);
54
53
  expect(cs1.answerTime).not.toBeNull();
55
54
  expect(cs2.answered).toEqual(true);
@@ -64,11 +63,11 @@ describe('CallSession domain', () => {
64
63
  expect(cs6.answered).toEqual(true);
65
64
  });
66
65
  it('should reset answerTime when setting answered to false', () => {
67
- const cs1 = new CallSession({});
66
+ const cs1 = new CallSession({} as any);
68
67
  cs1.answered = false;
69
68
  const cs2 = new CallSession({
70
69
  answered: false,
71
- });
70
+ } as any);
72
71
  expect(cs1.answered).toEqual(false);
73
72
  expect(cs1.answerTime).toBeNull();
74
73
  expect(cs2.answered).toEqual(false);
@@ -309,13 +309,11 @@ describe('Contact domain', () => {
309
309
  const noBirthdayContact = new Contact({
310
310
  uuid: 'uuid-12345',
311
311
  lastActivity: 'yesterday',
312
- // @ts-expect-error
313
- birthday: null,
312
+ birthday: undefined,
314
313
  });
315
314
  const noLastActivityContact = new Contact({
316
315
  uuid: 'uuid-12345',
317
- // @ts-expect-error
318
- lastActivity: null,
316
+ lastActivity: undefined,
319
317
  birthday: 'tomorrow',
320
318
  });
321
319
  const result = noBirthdayContact.merge(noLastActivityContact);
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import CallSession from '../CallSession';
3
2
  import IndirectTransfer from '../IndirectTransfer';
4
3
 
@@ -9,9 +8,9 @@ describe('Indirect transfer', () => {
9
8
  const destinationId = 'destination-id';
10
9
  const indirectTransfer = IndirectTransfer.parseFromCallSession(new CallSession({
11
10
  callId: sourceId,
12
- }), new CallSession({
11
+ } as any), new CallSession({
13
12
  callId: destinationId,
14
- }));
13
+ } as any));
15
14
  expect(indirectTransfer).toEqual({
16
15
  sourceId,
17
16
  destinationId,
@@ -27,7 +26,7 @@ describe('Indirect transfer', () => {
27
26
  });
28
27
  const isDestination = indirectTransfer.destinationIs(new CallSession({
29
28
  callId: destinationId,
30
- }));
29
+ } as any));
31
30
  expect(isDestination).toBeTruthy();
32
31
  });
33
32
  it('should NOT match when destination is the different', async () => {
@@ -38,7 +37,7 @@ describe('Indirect transfer', () => {
38
37
  });
39
38
  const isDestination = indirectTransfer.destinationIs(new CallSession({
40
39
  callId: destinationId,
41
- }));
40
+ } as any));
42
41
  expect(isDestination).toBeFalsy();
43
42
  });
44
43
  });
@@ -51,7 +50,7 @@ describe('Indirect transfer', () => {
51
50
  });
52
51
  const isSource = indirectTransfer.sourceIs(new CallSession({
53
52
  callId: sourceId,
54
- }));
53
+ } as any));
55
54
  expect(isSource).toBeTruthy();
56
55
  });
57
56
  it('should NOT match when source is the different', async () => {
@@ -62,7 +61,7 @@ describe('Indirect transfer', () => {
62
61
  });
63
62
  const isSource = indirectTransfer.sourceIs(new CallSession({
64
63
  callId: sourceId,
65
- }));
64
+ } as any));
66
65
  expect(isSource).toBeFalsy();
67
66
  });
68
67
  });
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import Profile from '../Profile';
3
2
  import Line from '../Line';
4
3
  import ForwardOption, { FORWARD_KEYS } from '../ForwardOption';
@@ -18,12 +17,12 @@ describe('Profile domain', () => {
18
17
  context: 'default',
19
18
  }],
20
19
  endpoint_custom: null,
21
- })],
20
+ } as any)],
22
21
  username: 'john.doe',
23
22
  forwards: [],
24
23
  mobileNumber: '123',
25
24
  };
26
- const oldProfile = new Profile(attributes);
25
+ const oldProfile = new Profile(attributes as any);
27
26
  const newProfile = Profile.newFrom(oldProfile);
28
27
  expect(newProfile).toBeInstanceOf(Profile);
29
28
  expect(newProfile.firstName).toBe(attributes.firstName);
@@ -88,7 +87,7 @@ describe('Profile domain', () => {
88
87
  }],
89
88
  online_call_record_enabled: true,
90
89
  };
91
- const profile = Profile.parse(plain);
90
+ const profile = Profile.parse(plain as any);
92
91
  expect(profile).toEqual(new Profile({
93
92
  id: 'xxx-xxx-xxx-xx',
94
93
  firstName: 'John',
@@ -8,10 +8,9 @@ describe('Room', () => {
8
8
  const number = 'some-number';
9
9
  const room = new Room({
10
10
  id: 'some-id',
11
- // @ts-expect-error
12
11
  connectedCallSession: new CallSession({
13
12
  number,
14
- }),
13
+ } as any),
15
14
  participants: [],
16
15
  });
17
16
  const extension = room.getExtension();
@@ -32,14 +31,12 @@ describe('Room', () => {
32
31
  });
33
32
  describe('on connect call', () => {
34
33
  it('should add call to room', async () => {
35
- // @ts-expect-error
36
34
  const room = new Room({
37
35
  id: 'some-id',
38
- });
39
- // @ts-expect-error
36
+ } as any);
40
37
  const callSession = new CallSession({
41
38
  callId: 'some-call-id',
42
- });
39
+ } as any);
43
40
  const connectedRoom = room.connect(callSession);
44
41
  expect(connectedRoom.connectedCallSession).toBe(callSession);
45
42
  });
@@ -47,42 +44,35 @@ describe('Room', () => {
47
44
  describe('on room has call', () => {
48
45
  describe('given no connected call', () => {
49
46
  it('should be false', async () => {
50
- // @ts-expect-error
51
47
  const room = new Room({
52
48
  connectedCallSession: null,
53
- });
54
- // @ts-expect-error
55
- const callSession = new CallSession({});
49
+ } as any);
50
+ const callSession = new CallSession({} as any);
56
51
  const roomHasCall = room.has(callSession);
57
52
  expect(roomHasCall).toBeFalsy();
58
53
  });
59
54
  });
60
55
  describe('given a connected call', () => {
61
56
  it('should be true if same calls', async () => {
62
- // @ts-expect-error
63
57
  const callSession = new CallSession({
64
58
  callId: 'some-call-id',
65
- });
66
- // @ts-expect-error
59
+ } as any);
67
60
  const room = new Room({
68
61
  connectedCallSession: callSession,
69
- });
62
+ } as any);
70
63
  const roomHasCall = room.has(callSession);
71
64
  expect(roomHasCall).toBeTruthy();
72
65
  });
73
66
  it('should be false if different calls', async () => {
74
- // @ts-expect-error
75
67
  const call1 = new CallSession({
76
68
  callId: 'some-call-id',
77
- });
78
- // @ts-expect-error
69
+ } as any);
79
70
  const call2 = new CallSession({
80
71
  callId: 'some-other-call-id',
81
- });
82
- // @ts-expect-error
72
+ } as any);
83
73
  const room = new Room({
84
74
  connectedCallSession: call1,
85
- });
75
+ } as any);
86
76
  const roomHasCall = room.has(call2);
87
77
  expect(roomHasCall).toBeFalsy();
88
78
  });
@@ -93,9 +83,8 @@ describe('Room', () => {
93
83
  const participants = [{}];
94
84
  const room = new Room({
95
85
  connectedCallSession: null,
96
- // @ts-expect-error
97
86
  participants,
98
- });
87
+ } as any);
99
88
  const participantUuid = 'some-uuid';
100
89
  const participantExtension = 'some-extension';
101
90
  const updatedRoom = room.addParticipant(participantUuid, participantExtension);
@@ -106,10 +95,9 @@ describe('Room', () => {
106
95
  describe('on room has call with id', () => {
107
96
  describe('given no connected call', () => {
108
97
  it('should be false', async () => {
109
- // @ts-expect-error
110
98
  const room = new Room({
111
99
  connectedCallSession: null,
112
- });
100
+ } as any);
113
101
  const callId = 'some-call-id';
114
102
  const roomHasCall = room.hasCallWithId(callId);
115
103
  expect(roomHasCall).toBeFalsy();
@@ -118,25 +106,21 @@ describe('Room', () => {
118
106
  describe('given a connected call', () => {
119
107
  it('should be true if same calls', async () => {
120
108
  const callId = 'some-call-id';
121
- // @ts-expect-error
122
109
  const room = new Room({
123
- // @ts-expect-error
124
110
  connectedCallSession: new CallSession({
125
111
  callId,
126
- }),
127
- });
112
+ } as any),
113
+ } as any);
128
114
  const roomHasCall = room.hasCallWithId(callId);
129
115
  expect(roomHasCall).toBeTruthy();
130
116
  });
131
117
  it('should be false if different calls', async () => {
132
118
  const callId = 'some-call-id';
133
- // @ts-expect-error
134
119
  const room = new Room({
135
- // @ts-expect-error
136
120
  connectedCallSession: new CallSession({
137
121
  callId: 'some-other-call-id',
138
- }),
139
- });
122
+ } as any),
123
+ } as any);
140
124
  const roomHasCall = room.hasCallWithId(callId);
141
125
  expect(roomHasCall).toBeFalsy();
142
126
  });
@@ -146,55 +130,49 @@ describe('Room', () => {
146
130
  it('should updated participant with corresponding UUID', async () => {
147
131
  const uuid = 'some-uuid';
148
132
  const room = new Room({
149
- // @ts-expect-error
150
133
  participants: [{
151
134
  uuid,
152
135
  talking: true,
153
136
  }],
154
- });
137
+ } as any);
155
138
  expect(room.participants[0].talking).toBeTruthy();
156
139
  const updatedRoom = room.updateParticipant(uuid, {
157
140
  talking: false,
158
- });
141
+ } as any);
159
142
  expect(updatedRoom.participants[0].talking).toBeFalsy();
160
143
  });
161
144
  it('should add participant when not found', async () => {
162
145
  const uuid = 'some-uuid';
163
- // @ts-expect-error
164
146
  const room = new Room({
165
147
  participants: [],
166
- });
148
+ } as any);
167
149
  const updatedRoom = room.updateParticipant(uuid, {
168
150
  talking: false,
169
- }, true);
151
+ } as any, true);
170
152
  expect(updatedRoom.participants[0].talking).toBeFalsy();
171
153
  });
172
154
  });
173
155
  describe('on updated participant by extension', () => {
174
156
  it('should updated participant with corresponding extension', async () => {
175
- const extension = 1234;
157
+ const extension = '1234';
176
158
  const room = new Room({
177
159
  participants: [{
178
- // @ts-expect-error
179
160
  extension,
180
161
  talking: false,
181
162
  }],
182
- });
163
+ } as any);
183
164
  expect(room.participants[0].talking).toBeFalsy();
184
- // @ts-expect-error
185
165
  const updatedRoom = room.updateParticipantByExtension(extension, {
186
166
  talking: true,
187
- });
167
+ } as any);
188
168
  expect(updatedRoom.participants[0].talking).toBeTruthy();
189
169
  });
190
170
  });
191
171
  describe('on disconnect', () => {
192
172
  it('should destroy connected call', async () => {
193
- // @ts-expect-error
194
173
  const room = new Room({
195
- // @ts-expect-error
196
- connectedCallSession: new CallSession({}),
197
- });
174
+ connectedCallSession: new CallSession({} as any),
175
+ } as any);
198
176
  expect(room.connectedCallSession).not.toBeNull();
199
177
  const updatedRoom = room.disconnect();
200
178
  expect(updatedRoom.connectedCallSession).toBeNull();
@@ -204,11 +182,10 @@ describe('Room', () => {
204
182
  it('should remove participant with corresponding UUID', async () => {
205
183
  const uuid = 'some-uuid';
206
184
  const room = new Room({
207
- // @ts-expect-error
208
185
  participants: [{
209
186
  uuid,
210
187
  }],
211
- });
188
+ } as any);
212
189
  expect(room.participants.some(participant => participant.uuid === uuid)).toBeTruthy();
213
190
  const updatedRoom = room.removeParticipantWithUUID(uuid);
214
191
  expect(updatedRoom.participants.some(participant => participant.uuid === uuid)).toBeFalsy();
@@ -218,11 +195,10 @@ describe('Room', () => {
218
195
  it('should remove participant with corresponding UUID', async () => {
219
196
  const extension = 'some-extension';
220
197
  const room = new Room({
221
- // @ts-expect-error
222
198
  participants: [{
223
199
  extension,
224
200
  }],
225
- });
201
+ } as any);
226
202
  expect(room.participants.some(participant => participant.extension === extension)).toBeTruthy();
227
203
  const updatedRoom = room.removeParticipantWithExtension(extension);
228
204
  expect(updatedRoom.participants.some(participant => participant.extension === extension)).toBeFalsy();
@@ -27,8 +27,7 @@ describe('Session domain', () => {
27
27
  xivo_user_uuid: null,
28
28
  },
29
29
  };
30
- // @ts-ignore
31
- const session = Session.parse(plain);
30
+ const session = Session.parse(plain as any);
32
31
  expect(session).toEqual(new Session({
33
32
  token: 'b93ae6bd-08d7-4001-9e61-057e72bbc4b3',
34
33
  refreshToken: null,
@@ -47,13 +46,13 @@ describe('Session domain', () => {
47
46
  const session = new Session({
48
47
  token: 'ref-12345',
49
48
  uuid: '1234',
50
- // @ts-expect-error
49
+ //
51
50
  profile: new Profile({
52
51
  voicemail: {
53
52
  id: 1234,
54
53
  name: 'inbox',
55
54
  },
56
- }),
55
+ } as any),
57
56
  expiresAt: A_DATE,
58
57
  });
59
58
  expect(session.hasAccessToVoicemail()).toBeTruthy();
@@ -64,7 +63,7 @@ describe('Session domain', () => {
64
63
  const session = new Session({
65
64
  token: 'ref-12345',
66
65
  uuid: '1234',
67
- // @ts-expect-error
66
+ //
68
67
  profile: new Profile({
69
68
  lines: [new Line({
70
69
  id: 9012,
@@ -81,7 +80,7 @@ describe('Session domain', () => {
81
80
  context: 'internal',
82
81
  }],
83
82
  })],
84
- }),
83
+ } as any),
85
84
  expiresAt: A_DATE,
86
85
  });
87
86
  expect(session.allNumbers().length).toBeGreaterThan(1);
@@ -92,7 +91,7 @@ describe('Session domain', () => {
92
91
  const session = new Session({
93
92
  token: 'ref-12345',
94
93
  uuid: '1234',
95
- // @ts-expect-error
94
+ //
96
95
  profile: new Profile({
97
96
  lines: [new Line({
98
97
  id: 9012,
@@ -102,7 +101,7 @@ describe('Session domain', () => {
102
101
  context: 'default',
103
102
  }],
104
103
  })],
105
- }),
104
+ } as any),
106
105
  expiresAt: A_DATE,
107
106
  });
108
107
  expect(session.allNumbers().length).toEqual(1);
@@ -113,10 +112,10 @@ describe('Session domain', () => {
113
112
  const session = new Session({
114
113
  token: 'ref-12345',
115
114
  uuid: '1234',
116
- // @ts-expect-error
115
+ //
117
116
  profile: new Profile({
118
117
  voicemail: undefined,
119
- }),
118
+ } as any),
120
119
  expiresAt: A_DATE,
121
120
  });
122
121
  expect(session.hasAccessToVoicemail()).toBeFalsy();
@@ -164,7 +163,7 @@ describe('Session domain', () => {
164
163
  const session = new Session({
165
164
  token: 'ref-12345',
166
165
  uuid: '1234',
167
- // @ts-expect-error
166
+ //
168
167
  profile: new Profile({
169
168
  lines: [new Line({
170
169
  id: 9012,
@@ -181,7 +180,7 @@ describe('Session domain', () => {
181
180
  context: 'internal',
182
181
  }],
183
182
  })],
184
- }),
183
+ } as any),
185
184
  expiresAt: new Date(9999, 0, 1),
186
185
  });
187
186
  it('should return true given it owns the extension', () => {
@@ -226,10 +225,10 @@ describe('Session domain', () => {
226
225
  describe('and NO lines', () => {
227
226
  beforeEach(() => {
228
227
  A_SESSION = new Session({ ...A_SESSION,
229
- // @ts-expect-error
228
+ //
230
229
  profile: new Profile({
231
230
  lines: [],
232
- }),
231
+ } as any),
233
232
  });
234
233
  });
235
234
  it('should return default context', async () => {
@@ -246,13 +245,13 @@ describe('Session domain', () => {
246
245
  exten: '1',
247
246
  }],
248
247
  id: 1,
249
- // @ts-expect-error
248
+ //
250
249
  exten: 1,
251
- });
252
- // @ts-expect-error
250
+ } as any);
251
+ //
253
252
  const profile = new Profile({
254
253
  lines: [line],
255
- });
254
+ } as any);
256
255
  A_SESSION = new Session({ ...A_SESSION,
257
256
  profile,
258
257
  });
@@ -272,10 +271,10 @@ describe('Session domain', () => {
272
271
  });
273
272
  describe('and NO lines', () => {
274
273
  beforeEach(() => {
275
- // @ts-expect-error
274
+ //
276
275
  const profile = new Profile({
277
276
  lines: [],
278
- });
277
+ } as any);
279
278
  A_SESSION = new Session({ ...A_SESSION,
280
279
  profile,
281
280
  });
@@ -294,13 +293,13 @@ describe('Session domain', () => {
294
293
  exten: '1',
295
294
  }],
296
295
  id: 1,
297
- // @ts-expect-error
296
+ //
298
297
  exten: 1,
299
- });
300
- // @ts-expect-error
298
+ } as any);
299
+ //
301
300
  const profile = new Profile({
302
301
  lines: [line],
303
- });
302
+ } as any);
304
303
  A_SESSION = new Session({ ...A_SESSION,
305
304
  profile,
306
305
  engineVersion: '18.08',
@@ -329,13 +328,13 @@ describe('Session domain', () => {
329
328
  exten: '1',
330
329
  }],
331
330
  id: 1,
332
- // @ts-expect-error
331
+ //
333
332
  exten: 1,
334
- });
335
- // @ts-expect-error
333
+ } as any);
334
+ //
336
335
  const profile = new Profile({
337
336
  lines: [line],
338
- });
337
+ } as any);
339
338
  A_SESSION = new Session({ ...A_SESSION,
340
339
  profile,
341
340
  });