@wazo/sdk 0.43.15 → 0.44.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.
- package/dist/index.js +10630 -0
- package/dist/index.mjs +10541 -0
- package/{lib → dist}/types/domain/Contact.d.ts +3 -1
- package/dist/types/domain/Contact.d.ts.map +1 -0
- package/{lib → dist}/types/index.d.ts +13 -13
- package/dist/types/index.d.ts.map +1 -0
- package/dist/wazo-sdk.js +69378 -43
- package/dist/wazo-sdk.js.LICENSE.txt +684 -0
- package/package.json +10 -21
- package/esm/__tests__/api-client.test.js +0 -281
- package/esm/__tests__/web-rtc-client.test.js +0 -192
- package/esm/api/agentd.js +0 -23
- package/esm/api/amid.js +0 -17
- package/esm/api/application.js +0 -63
- package/esm/api/auth.js +0 -198
- package/esm/api/call-logd.js +0 -24
- package/esm/api/calld.js +0 -120
- package/esm/api/chatd.js +0 -50
- package/esm/api/confd.js +0 -77
- package/esm/api/ctid-ng.js +0 -96
- package/esm/api/dird.js +0 -110
- package/esm/api/webhookd.js +0 -7
- package/esm/api-client.js +0 -41
- package/esm/base-api-client.js +0 -125
- package/esm/checker/Checker.js +0 -54
- package/esm/checker/checks/aor.js +0 -28
- package/esm/checker/checks/api.js +0 -76
- package/esm/checker/checks/ice-ipv4.js +0 -69
- package/esm/checker/checks/index.js +0 -8
- package/esm/checker/checks/symmetric-nat.js +0 -59
- package/esm/checker/checks/wazo-websocket.js +0 -38
- package/esm/checker/checks/webrtc-transport.js +0 -35
- package/esm/checker/checks/webrtc.js +0 -40
- package/esm/constants.js +0 -11
- package/esm/domain/AdHocAPIConference.js +0 -102
- package/esm/domain/Agent.js +0 -30
- package/esm/domain/BadResponse.js +0 -21
- package/esm/domain/Call.js +0 -123
- package/esm/domain/CallLog.js +0 -157
- package/esm/domain/CallSession.js +0 -253
- package/esm/domain/CallerID.js +0 -24
- package/esm/domain/ChatMessage.js +0 -55
- package/esm/domain/ChatRoom.js +0 -30
- package/esm/domain/Contact.js +0 -464
- package/esm/domain/Country.js +0 -19
- package/esm/domain/Device/DebugDevice.js +0 -32
- package/esm/domain/Device/Device.js +0 -1
- package/esm/domain/DirectorySource.js +0 -1
- package/esm/domain/ExternalApp.js +0 -24
- package/esm/domain/Features.js +0 -77
- package/esm/domain/ForwardOption.js +0 -37
- package/esm/domain/Incall.js +0 -28
- package/esm/domain/IndirectTransfer.js +0 -40
- package/esm/domain/Line.js +0 -39
- package/esm/domain/Meeting.js +0 -61
- package/esm/domain/MeetingAuthorization.js +0 -46
- package/esm/domain/MeetingStatus.js +0 -14
- package/esm/domain/NotificationOptions.js +0 -45
- package/esm/domain/Phone/CTIPhone.js +0 -288
- package/esm/domain/Phone/Phone.js +0 -1
- package/esm/domain/Phone/WebRTCPhone.js +0 -1482
- package/esm/domain/Profile.js +0 -128
- package/esm/domain/Recording.js +0 -30
- package/esm/domain/Relocation.js +0 -20
- package/esm/domain/Room.js +0 -97
- package/esm/domain/SFUNotAvailableError.js +0 -6
- package/esm/domain/ServerError.js +0 -9
- package/esm/domain/Session.js +0 -174
- package/esm/domain/SipLine.js +0 -82
- package/esm/domain/Subscription.js +0 -42
- package/esm/domain/SwitchboardCall.js +0 -56
- package/esm/domain/Voicemail.js +0 -76
- package/esm/domain/__tests__/Agent.test.js +0 -37
- package/esm/domain/__tests__/Call.test.js +0 -25
- package/esm/domain/__tests__/CallLog.test.js +0 -181
- package/esm/domain/__tests__/CallSession.test.js +0 -78
- package/esm/domain/__tests__/Contact.test.js +0 -393
- package/esm/domain/__tests__/IndirectTransfer.test.js +0 -67
- package/esm/domain/__tests__/Line.test.js +0 -52
- package/esm/domain/__tests__/Meeting.test.js +0 -77
- package/esm/domain/__tests__/MeetingAuthorization.test.js +0 -49
- package/esm/domain/__tests__/Profile.test.js +0 -169
- package/esm/domain/__tests__/Room.test.js +0 -206
- package/esm/domain/__tests__/Session.test.js +0 -382
- package/esm/domain/__tests__/SipLine.test.js +0 -27
- package/esm/domain/__tests__/Voicemail.test.js +0 -90
- package/esm/domain/types.js +0 -2
- package/esm/index.js +0 -51
- package/esm/lib/WazoSessionDescriptionHandler.js +0 -429
- package/esm/pubkey.js +0 -10
- package/esm/service/CallApi.js +0 -61
- package/esm/service/IssueReporter.js +0 -331
- package/esm/service/__tests__/IssueReporter.test.js +0 -112
- package/esm/service/__tests__/getApiclient.test.js +0 -37
- package/esm/service/getApiClient.js +0 -94
- package/esm/simple/Auth.js +0 -384
- package/esm/simple/Configuration.js +0 -13
- package/esm/simple/Directory.js +0 -11
- package/esm/simple/Phone.js +0 -389
- package/esm/simple/Websocket.js +0 -81
- package/esm/simple/__tests__/Auth.test.js +0 -144
- package/esm/simple/index.js +0 -137
- package/esm/simple/room/LocalParticipant.js +0 -4
- package/esm/simple/room/Participant.js +0 -315
- package/esm/simple/room/RemoteParticipant.js +0 -10
- package/esm/simple/room/Room.js +0 -714
- package/esm/simple/room/SipRoom.js +0 -121
- package/esm/simple/room/Stream.js +0 -47
- package/esm/simple/room/__tests__/Participant.test.js +0 -71
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +0 -12
- package/esm/simple/utils.js +0 -10
- package/esm/types/WebSocketMessage.js +0 -1
- package/esm/types/domain/Contact.d.ts +0 -332
- package/esm/types/domain/Contact.d.ts.map +0 -1
- package/esm/types/index.d.ts +0 -59
- package/esm/types/index.d.ts.map +0 -1
- package/esm/utils/Emitter.js +0 -19
- package/esm/utils/Heartbeat.js +0 -73
- package/esm/utils/PhoneNumberUtil.js +0 -67
- package/esm/utils/__tests__/Heartbeat.test.js +0 -65
- package/esm/utils/__tests__/PhoneNumberUtil.test.js +0 -70
- package/esm/utils/__tests__/api-requester.test.js +0 -166
- package/esm/utils/__tests__/array.test.js +0 -18
- package/esm/utils/__tests__/compare-version.test.js +0 -10
- package/esm/utils/__tests__/object.test.js +0 -76
- package/esm/utils/__tests__/sdp.test.js +0 -172
- package/esm/utils/__tests__/string.test.js +0 -49
- package/esm/utils/api-requester.js +0 -213
- package/esm/utils/array.js +0 -9
- package/esm/utils/compare-version.js +0 -17
- package/esm/utils/isMobile.js +0 -3
- package/esm/utils/new-from.js +0 -7
- package/esm/utils/object.js +0 -10
- package/esm/utils/once.js +0 -15
- package/esm/utils/sdp.js +0 -104
- package/esm/utils/string.js +0 -12
- package/esm/utils/update-from.js +0 -10
- package/esm/utils/webrtc.js +0 -37
- package/esm/web-rtc-client.js +0 -2200
- package/esm/websocket-client.js +0 -385
- package/index.js +0 -1
- package/lib/__tests__/api-client.test.js +0 -295
- package/lib/__tests__/web-rtc-client.test.js +0 -210
- package/lib/api/agentd.js +0 -28
- package/lib/api/amid.js +0 -28
- package/lib/api/application.js +0 -68
- package/lib/api/auth.js +0 -210
- package/lib/api/call-logd.js +0 -29
- package/lib/api/calld.js +0 -134
- package/lib/api/chatd.js +0 -68
- package/lib/api/confd.js +0 -91
- package/lib/api/ctid-ng.js +0 -101
- package/lib/api/dird.js +0 -124
- package/lib/api/webhookd.js +0 -12
- package/lib/api-client.js +0 -37
- package/lib/base-api-client.js +0 -133
- package/lib/checker/Checker.js +0 -68
- package/lib/checker/checks/aor.js +0 -42
- package/lib/checker/checks/api.js +0 -90
- package/lib/checker/checks/ice-ipv4.js +0 -73
- package/lib/checker/checks/index.js +0 -13
- package/lib/checker/checks/symmetric-nat.js +0 -61
- package/lib/checker/checks/wazo-websocket.js +0 -63
- package/lib/checker/checks/webrtc-transport.js +0 -49
- package/lib/checker/checks/webrtc.js +0 -54
- package/lib/constants.js +0 -14
- package/lib/domain/AdHocAPIConference.js +0 -101
- package/lib/domain/Agent.js +0 -25
- package/lib/domain/BadResponse.js +0 -19
- package/lib/domain/Call.js +0 -112
- package/lib/domain/CallLog.js +0 -151
- package/lib/domain/CallSession.js +0 -224
- package/lib/domain/CallerID.js +0 -27
- package/lib/domain/ChatMessage.js +0 -53
- package/lib/domain/ChatRoom.js +0 -32
- package/lib/domain/Contact.js +0 -439
- package/lib/domain/Country.js +0 -21
- package/lib/domain/Device/DebugDevice.js +0 -35
- package/lib/domain/Device/Device.js +0 -2
- package/lib/domain/DirectorySource.js +0 -2
- package/lib/domain/ExternalApp.js +0 -27
- package/lib/domain/Features.js +0 -87
- package/lib/domain/ForwardOption.js +0 -41
- package/lib/domain/Incall.js +0 -32
- package/lib/domain/IndirectTransfer.js +0 -42
- package/lib/domain/Line.js +0 -39
- package/lib/domain/Meeting.js +0 -55
- package/lib/domain/MeetingAuthorization.js +0 -45
- package/lib/domain/MeetingStatus.js +0 -15
- package/lib/domain/NotificationOptions.js +0 -49
- package/lib/domain/Phone/CTIPhone.js +0 -324
- package/lib/domain/Phone/Phone.js +0 -2
- package/lib/domain/Phone/WebRTCPhone.js +0 -1492
- package/lib/domain/Profile.js +0 -138
- package/lib/domain/Recording.js +0 -31
- package/lib/domain/Relocation.js +0 -18
- package/lib/domain/Room.js +0 -81
- package/lib/domain/SFUNotAvailableError.js +0 -9
- package/lib/domain/ServerError.js +0 -15
- package/lib/domain/Session.js +0 -166
- package/lib/domain/SipLine.js +0 -76
- package/lib/domain/Subscription.js +0 -34
- package/lib/domain/SwitchboardCall.js +0 -50
- package/lib/domain/Voicemail.js +0 -77
- package/lib/domain/__tests__/Agent.test.js +0 -42
- package/lib/domain/__tests__/Call.test.js +0 -30
- package/lib/domain/__tests__/CallLog.test.js +0 -166
- package/lib/domain/__tests__/CallSession.test.js +0 -83
- package/lib/domain/__tests__/Contact.test.js +0 -371
- package/lib/domain/__tests__/IndirectTransfer.test.js +0 -81
- package/lib/domain/__tests__/Line.test.js +0 -57
- package/lib/domain/__tests__/Meeting.test.js +0 -82
- package/lib/domain/__tests__/MeetingAuthorization.test.js +0 -54
- package/lib/domain/__tests__/Profile.test.js +0 -197
- package/lib/domain/__tests__/Room.test.js +0 -220
- package/lib/domain/__tests__/Session.test.js +0 -378
- package/lib/domain/__tests__/SipLine.test.js +0 -32
- package/lib/domain/__tests__/Voicemail.test.js +0 -95
- package/lib/domain/types.js +0 -38
- package/lib/index.js +0 -127
- package/lib/lib/WazoSessionDescriptionHandler.js +0 -434
- package/lib/pubkey.js +0 -12
- package/lib/service/CallApi.js +0 -112
- package/lib/service/IssueReporter.js +0 -317
- package/lib/service/__tests__/IssueReporter.test.js +0 -117
- package/lib/service/__tests__/getApiclient.test.js +0 -42
- package/lib/service/getApiClient.js +0 -114
- package/lib/simple/Auth.js +0 -433
- package/lib/simple/Configuration.js +0 -31
- package/lib/simple/Directory.js +0 -29
- package/lib/simple/Phone.js +0 -418
- package/lib/simple/Websocket.js +0 -116
- package/lib/simple/__tests__/Auth.test.js +0 -181
- package/lib/simple/index.js +0 -165
- package/lib/simple/room/LocalParticipant.js +0 -9
- package/lib/simple/room/Participant.js +0 -302
- package/lib/simple/room/RemoteParticipant.js +0 -15
- package/lib/simple/room/Room.js +0 -711
- package/lib/simple/room/SipRoom.js +0 -141
- package/lib/simple/room/Stream.js +0 -50
- package/lib/simple/room/__tests__/Participant.test.js +0 -85
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +0 -17
- package/lib/simple/utils.js +0 -27
- package/lib/types/WebSocketMessage.js +0 -2
- package/lib/types/__tests__/api-client.test.d.ts +0 -2
- package/lib/types/__tests__/api-client.test.d.ts.map +0 -1
- package/lib/types/__tests__/web-rtc-client.test.d.ts +0 -2
- package/lib/types/__tests__/web-rtc-client.test.d.ts.map +0 -1
- package/lib/types/api/agentd.d.ts +0 -17
- package/lib/types/api/agentd.d.ts.map +0 -1
- package/lib/types/api/amid.d.ts +0 -8
- package/lib/types/api/amid.d.ts.map +0 -1
- package/lib/types/api/application.d.ts +0 -34
- package/lib/types/api/application.d.ts.map +0 -1
- package/lib/types/api/auth.d.ts +0 -69
- package/lib/types/api/auth.d.ts.map +0 -1
- package/lib/types/api/call-logd.d.ts +0 -12
- package/lib/types/api/call-logd.d.ts.map +0 -1
- package/lib/types/api/calld.d.ts +0 -52
- package/lib/types/api/calld.d.ts.map +0 -1
- package/lib/types/api/chatd.d.ts +0 -29
- package/lib/types/api/chatd.d.ts.map +0 -1
- package/lib/types/api/confd.d.ts +0 -46
- package/lib/types/api/confd.d.ts.map +0 -1
- package/lib/types/api/ctid-ng.d.ts +0 -36
- package/lib/types/api/ctid-ng.d.ts.map +0 -1
- package/lib/types/api/dird.d.ts +0 -33
- package/lib/types/api/dird.d.ts.map +0 -1
- package/lib/types/api/webhookd.d.ts +0 -24
- package/lib/types/api/webhookd.d.ts.map +0 -1
- package/lib/types/api-client.d.ts +0 -26
- package/lib/types/api-client.d.ts.map +0 -1
- package/lib/types/base-api-client.d.ts +0 -43
- package/lib/types/base-api-client.d.ts.map +0 -1
- package/lib/types/checker/Checker.d.ts +0 -13
- package/lib/types/checker/Checker.d.ts.map +0 -1
- package/lib/types/checker/checks/aor.d.ts +0 -6
- package/lib/types/checker/checks/aor.d.ts.map +0 -1
- package/lib/types/checker/checks/api.d.ts +0 -6
- package/lib/types/checker/checks/api.d.ts.map +0 -1
- package/lib/types/checker/checks/ice-ipv4.d.ts +0 -6
- package/lib/types/checker/checks/ice-ipv4.d.ts.map +0 -1
- package/lib/types/checker/checks/index.d.ts +0 -9
- package/lib/types/checker/checks/index.d.ts.map +0 -1
- package/lib/types/checker/checks/symmetric-nat.d.ts +0 -6
- package/lib/types/checker/checks/symmetric-nat.d.ts.map +0 -1
- package/lib/types/checker/checks/wazo-websocket.d.ts +0 -6
- package/lib/types/checker/checks/wazo-websocket.d.ts.map +0 -1
- package/lib/types/checker/checks/webrtc-transport.d.ts +0 -7
- package/lib/types/checker/checks/webrtc-transport.d.ts.map +0 -1
- package/lib/types/checker/checks/webrtc.d.ts +0 -6
- package/lib/types/checker/checks/webrtc.d.ts.map +0 -1
- package/lib/types/constants.d.ts +0 -12
- package/lib/types/constants.d.ts.map +0 -1
- package/lib/types/domain/AdHocAPIConference.d.ts +0 -54
- package/lib/types/domain/AdHocAPIConference.d.ts.map +0 -1
- package/lib/types/domain/Agent.d.ts +0 -31
- package/lib/types/domain/Agent.d.ts.map +0 -1
- package/lib/types/domain/BadResponse.d.ts +0 -11
- package/lib/types/domain/BadResponse.d.ts.map +0 -1
- package/lib/types/domain/Call.d.ts +0 -79
- package/lib/types/domain/Call.d.ts.map +0 -1
- package/lib/types/domain/CallLog.d.ts +0 -88
- package/lib/types/domain/CallLog.d.ts.map +0 -1
- package/lib/types/domain/CallSession.d.ts +0 -119
- package/lib/types/domain/CallSession.d.ts.map +0 -1
- package/lib/types/domain/CallerID.d.ts +0 -22
- package/lib/types/domain/CallerID.d.ts.map +0 -1
- package/lib/types/domain/ChatMessage.d.ts +0 -41
- package/lib/types/domain/ChatMessage.d.ts.map +0 -1
- package/lib/types/domain/ChatRoom.d.ts +0 -22
- package/lib/types/domain/ChatRoom.d.ts.map +0 -1
- package/lib/types/domain/Contact.d.ts.map +0 -1
- package/lib/types/domain/Country.d.ts +0 -21
- package/lib/types/domain/Country.d.ts.map +0 -1
- package/lib/types/domain/Device/DebugDevice.d.ts +0 -14
- package/lib/types/domain/Device/DebugDevice.d.ts.map +0 -1
- package/lib/types/domain/Device/Device.d.ts +0 -13
- package/lib/types/domain/Device/Device.d.ts.map +0 -1
- package/lib/types/domain/DirectorySource.d.ts +0 -13
- package/lib/types/domain/DirectorySource.d.ts.map +0 -1
- package/lib/types/domain/ExternalApp.d.ts +0 -22
- package/lib/types/domain/ExternalApp.d.ts.map +0 -1
- package/lib/types/domain/Features.d.ts +0 -26
- package/lib/types/domain/Features.d.ts.map +0 -1
- package/lib/types/domain/ForwardOption.d.ts +0 -28
- package/lib/types/domain/ForwardOption.d.ts.map +0 -1
- package/lib/types/domain/Incall.d.ts +0 -21
- package/lib/types/domain/Incall.d.ts.map +0 -1
- package/lib/types/domain/IndirectTransfer.d.ts +0 -31
- package/lib/types/domain/IndirectTransfer.d.ts.map +0 -1
- package/lib/types/domain/Line.d.ts +0 -35
- package/lib/types/domain/Line.d.ts.map +0 -1
- package/lib/types/domain/Meeting.d.ts +0 -45
- package/lib/types/domain/Meeting.d.ts.map +0 -1
- package/lib/types/domain/MeetingAuthorization.d.ts +0 -32
- package/lib/types/domain/MeetingAuthorization.d.ts.map +0 -1
- package/lib/types/domain/MeetingStatus.d.ts +0 -10
- package/lib/types/domain/MeetingStatus.d.ts.map +0 -1
- package/lib/types/domain/NotificationOptions.d.ts +0 -22
- package/lib/types/domain/NotificationOptions.d.ts.map +0 -1
- package/lib/types/domain/Phone/CTIPhone.d.ts +0 -79
- package/lib/types/domain/Phone/CTIPhone.d.ts.map +0 -1
- package/lib/types/domain/Phone/Phone.d.ts +0 -83
- package/lib/types/domain/Phone/Phone.d.ts.map +0 -1
- package/lib/types/domain/Phone/WebRTCPhone.d.ts +0 -183
- package/lib/types/domain/Phone/WebRTCPhone.d.ts.map +0 -1
- package/lib/types/domain/Profile.d.ts +0 -155
- package/lib/types/domain/Profile.d.ts.map +0 -1
- package/lib/types/domain/Recording.d.ts +0 -26
- package/lib/types/domain/Recording.d.ts.map +0 -1
- package/lib/types/domain/Relocation.d.ts +0 -23
- package/lib/types/domain/Relocation.d.ts.map +0 -1
- package/lib/types/domain/Room.d.ts +0 -33
- package/lib/types/domain/Room.d.ts.map +0 -1
- package/lib/types/domain/SFUNotAvailableError.d.ts +0 -4
- package/lib/types/domain/SFUNotAvailableError.d.ts.map +0 -1
- package/lib/types/domain/ServerError.d.ts +0 -6
- package/lib/types/domain/ServerError.d.ts.map +0 -1
- package/lib/types/domain/Session.d.ts +0 -100
- package/lib/types/domain/Session.d.ts.map +0 -1
- package/lib/types/domain/SipLine.d.ts +0 -54
- package/lib/types/domain/SipLine.d.ts.map +0 -1
- package/lib/types/domain/Subscription.d.ts +0 -43
- package/lib/types/domain/Subscription.d.ts.map +0 -1
- package/lib/types/domain/SwitchboardCall.d.ts +0 -62
- package/lib/types/domain/SwitchboardCall.d.ts.map +0 -1
- package/lib/types/domain/Voicemail.d.ts +0 -58
- package/lib/types/domain/Voicemail.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Agent.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Agent.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Call.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Call.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/CallLog.test.d.ts +0 -2
- package/lib/types/domain/__tests__/CallLog.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/CallSession.test.d.ts +0 -2
- package/lib/types/domain/__tests__/CallSession.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Contact.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Contact.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/IndirectTransfer.test.d.ts +0 -2
- package/lib/types/domain/__tests__/IndirectTransfer.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Line.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Line.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Meeting.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Meeting.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/MeetingAuthorization.test.d.ts +0 -2
- package/lib/types/domain/__tests__/MeetingAuthorization.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Profile.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Profile.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Room.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Room.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Session.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Session.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/SipLine.test.d.ts +0 -2
- package/lib/types/domain/__tests__/SipLine.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Voicemail.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Voicemail.test.d.ts.map +0 -1
- package/lib/types/domain/types.d.ts +0 -378
- package/lib/types/domain/types.d.ts.map +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts +0 -31
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts.map +0 -1
- package/lib/types/pubkey.d.ts +0 -3
- package/lib/types/pubkey.d.ts.map +0 -1
- package/lib/types/service/CallApi.d.ts +0 -28
- package/lib/types/service/CallApi.d.ts.map +0 -1
- package/lib/types/service/IssueReporter.d.ts +0 -42
- package/lib/types/service/IssueReporter.d.ts.map +0 -1
- package/lib/types/service/__tests__/IssueReporter.test.d.ts +0 -2
- package/lib/types/service/__tests__/IssueReporter.test.d.ts.map +0 -1
- package/lib/types/service/__tests__/getApiclient.test.d.ts +0 -2
- package/lib/types/service/__tests__/getApiclient.test.d.ts.map +0 -1
- package/lib/types/service/getApiClient.d.ts +0 -21
- package/lib/types/service/getApiClient.d.ts.map +0 -1
- package/lib/types/simple/Auth.d.ts +0 -75
- package/lib/types/simple/Auth.d.ts.map +0 -1
- package/lib/types/simple/Configuration.d.ts +0 -7
- package/lib/types/simple/Configuration.d.ts.map +0 -1
- package/lib/types/simple/Directory.d.ts +0 -7
- package/lib/types/simple/Directory.d.ts.map +0 -1
- package/lib/types/simple/Phone.d.ts +0 -119
- package/lib/types/simple/Phone.d.ts.map +0 -1
- package/lib/types/simple/Websocket.d.ts +0 -21
- package/lib/types/simple/Websocket.d.ts.map +0 -1
- package/lib/types/simple/__tests__/Auth.test.d.ts +0 -2
- package/lib/types/simple/__tests__/Auth.test.d.ts.map +0 -1
- package/lib/types/simple/index.d.ts +0 -153
- package/lib/types/simple/index.d.ts.map +0 -1
- package/lib/types/simple/room/LocalParticipant.d.ts +0 -5
- package/lib/types/simple/room/LocalParticipant.d.ts.map +0 -1
- package/lib/types/simple/room/Participant.d.ts +0 -77
- package/lib/types/simple/room/Participant.d.ts.map +0 -1
- package/lib/types/simple/room/RemoteParticipant.d.ts +0 -7
- package/lib/types/simple/room/RemoteParticipant.d.ts.map +0 -1
- package/lib/types/simple/room/Room.d.ts +0 -127
- package/lib/types/simple/room/Room.d.ts.map +0 -1
- package/lib/types/simple/room/SipRoom.d.ts +0 -14
- package/lib/types/simple/room/SipRoom.d.ts.map +0 -1
- package/lib/types/simple/room/Stream.d.ts +0 -13
- package/lib/types/simple/room/Stream.d.ts.map +0 -1
- package/lib/types/simple/room/__tests__/Participant.test.d.ts +0 -2
- package/lib/types/simple/room/__tests__/Participant.test.d.ts.map +0 -1
- package/lib/types/simple/room/__tests__/RemoteParticipant.test.d.ts +0 -2
- package/lib/types/simple/room/__tests__/RemoteParticipant.test.d.ts.map +0 -1
- package/lib/types/simple/utils.d.ts +0 -3
- package/lib/types/simple/utils.d.ts.map +0 -1
- package/lib/types/types/WebSocketMessage.d.ts +0 -285
- package/lib/types/types/WebSocketMessage.d.ts.map +0 -1
- package/lib/types/utils/Emitter.d.ts +0 -18
- package/lib/types/utils/Emitter.d.ts.map +0 -1
- package/lib/types/utils/Heartbeat.d.ts +0 -22
- package/lib/types/utils/Heartbeat.d.ts.map +0 -1
- package/lib/types/utils/PhoneNumberUtil.d.ts +0 -7
- package/lib/types/utils/PhoneNumberUtil.d.ts.map +0 -1
- package/lib/types/utils/__tests__/Heartbeat.test.d.ts +0 -2
- package/lib/types/utils/__tests__/Heartbeat.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/PhoneNumberUtil.test.d.ts +0 -2
- package/lib/types/utils/__tests__/PhoneNumberUtil.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/api-requester.test.d.ts +0 -2
- package/lib/types/utils/__tests__/api-requester.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/array.test.d.ts +0 -2
- package/lib/types/utils/__tests__/array.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/compare-version.test.d.ts +0 -2
- package/lib/types/utils/__tests__/compare-version.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/object.test.d.ts +0 -2
- package/lib/types/utils/__tests__/object.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/sdp.test.d.ts +0 -2
- package/lib/types/utils/__tests__/sdp.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/string.test.d.ts +0 -2
- package/lib/types/utils/__tests__/string.test.d.ts.map +0 -1
- package/lib/types/utils/api-requester.d.ts +0 -48
- package/lib/types/utils/api-requester.d.ts.map +0 -1
- package/lib/types/utils/array.d.ts +0 -2
- package/lib/types/utils/array.d.ts.map +0 -1
- package/lib/types/utils/compare-version.d.ts +0 -3
- package/lib/types/utils/compare-version.d.ts.map +0 -1
- package/lib/types/utils/isMobile.d.ts +0 -3
- package/lib/types/utils/isMobile.d.ts.map +0 -1
- package/lib/types/utils/new-from.d.ts +0 -3
- package/lib/types/utils/new-from.d.ts.map +0 -1
- package/lib/types/utils/object.d.ts +0 -2
- package/lib/types/utils/object.d.ts.map +0 -1
- package/lib/types/utils/once.d.ts +0 -2
- package/lib/types/utils/once.d.ts.map +0 -1
- package/lib/types/utils/sdp.d.ts +0 -28
- package/lib/types/utils/sdp.d.ts.map +0 -1
- package/lib/types/utils/string.d.ts +0 -3
- package/lib/types/utils/string.d.ts.map +0 -1
- package/lib/types/utils/update-from.d.ts +0 -3
- package/lib/types/utils/update-from.d.ts.map +0 -1
- package/lib/types/utils/webrtc.d.ts +0 -15
- package/lib/types/utils/webrtc.d.ts.map +0 -1
- package/lib/types/web-rtc-client.d.ts +0 -198
- package/lib/types/web-rtc-client.d.ts.map +0 -1
- package/lib/types/websocket-client.d.ts +0 -138
- package/lib/types/websocket-client.d.ts.map +0 -1
- package/lib/utils/Emitter.js +0 -24
- package/lib/utils/Heartbeat.js +0 -66
- package/lib/utils/PhoneNumberUtil.js +0 -73
- package/lib/utils/__tests__/Heartbeat.test.js +0 -79
- package/lib/utils/__tests__/PhoneNumberUtil.test.js +0 -72
- package/lib/utils/__tests__/api-requester.test.js +0 -180
- package/lib/utils/__tests__/array.test.js +0 -20
- package/lib/utils/__tests__/compare-version.test.js +0 -15
- package/lib/utils/__tests__/object.test.js +0 -78
- package/lib/utils/__tests__/sdp.test.js +0 -188
- package/lib/utils/__tests__/string.test.js +0 -51
- package/lib/utils/api-requester.js +0 -200
- package/lib/utils/array.js +0 -13
- package/lib/utils/compare-version.js +0 -19
- package/lib/utils/isMobile.js +0 -5
- package/lib/utils/new-from.js +0 -9
- package/lib/utils/object.js +0 -14
- package/lib/utils/once.js +0 -18
- package/lib/utils/sdp.js +0 -115
- package/lib/utils/string.js +0 -17
- package/lib/utils/update-from.js +0 -12
- package/lib/utils/webrtc.js +0 -41
- package/lib/web-rtc-client.js +0 -2239
- package/lib/websocket-client.js +0 -390
- package/src/__tests__/api-client.test.ts +0 -315
- package/src/__tests__/web-rtc-client.test.ts +0 -198
- package/src/api/agentd.ts +0 -37
- package/src/api/amid.ts +0 -25
- package/src/api/application.ts +0 -96
- package/src/api/auth.ts +0 -305
- package/src/api/call-logd.ts +0 -38
- package/src/api/calld.ts +0 -185
- package/src/api/chatd.ts +0 -87
- package/src/api/confd.ts +0 -119
- package/src/api/ctid-ng.ts +0 -152
- package/src/api/dird.ts +0 -143
- package/src/api/webhookd.ts +0 -30
- package/src/api-client.ts +0 -65
- package/src/base-api-client.ts +0 -184
- package/src/checker/Checker.ts +0 -73
- package/src/checker/checks/aor.ts +0 -34
- package/src/checker/checks/api.ts +0 -78
- package/src/checker/checks/ice-ipv4.ts +0 -80
- package/src/checker/checks/index.ts +0 -9
- package/src/checker/checks/symmetric-nat.ts +0 -69
- package/src/checker/checks/wazo-websocket.ts +0 -41
- package/src/checker/checks/webrtc-transport.ts +0 -42
- package/src/checker/checks/webrtc.ts +0 -48
- package/src/constants.ts +0 -11
- package/src/domain/AdHocAPIConference.ts +0 -166
- package/src/domain/Agent.ts +0 -68
- package/src/domain/BadResponse.ts +0 -29
- package/src/domain/Call.ts +0 -217
- package/src/domain/CallLog.ts +0 -265
- package/src/domain/CallSession.ts +0 -401
- package/src/domain/CallerID.ts +0 -49
- package/src/domain/ChatMessage.ts +0 -107
- package/src/domain/ChatRoom.ts +0 -55
- package/src/domain/Contact.ts +0 -851
- package/src/domain/Country.ts +0 -19
- package/src/domain/Device/DebugDevice.ts +0 -44
- package/src/domain/Device/Device.ts +0 -12
- package/src/domain/DirectorySource.ts +0 -13
- package/src/domain/ExternalApp.ts +0 -46
- package/src/domain/Features.ts +0 -105
- package/src/domain/ForwardOption.ts +0 -65
- package/src/domain/Incall.ts +0 -50
- package/src/domain/IndirectTransfer.ts +0 -73
- package/src/domain/Line.ts +0 -79
- package/src/domain/Meeting.ts +0 -113
- package/src/domain/MeetingAuthorization.ts +0 -81
- package/src/domain/MeetingStatus.ts +0 -23
- package/src/domain/NotificationOptions.ts +0 -68
- package/src/domain/Phone/CTIPhone.ts +0 -381
- package/src/domain/Phone/Phone.ts +0 -81
- package/src/domain/Phone/WebRTCPhone.ts +0 -1830
- package/src/domain/Profile.ts +0 -289
- package/src/domain/Recording.ts +0 -60
- package/src/domain/Relocation.ts +0 -45
- package/src/domain/Room.ts +0 -141
- package/src/domain/SFUNotAvailableError.ts +0 -7
- package/src/domain/ServerError.ts +0 -12
- package/src/domain/Session.ts +0 -297
- package/src/domain/SipLine.ts +0 -154
- package/src/domain/Subscription.ts +0 -95
- package/src/domain/SwitchboardCall.ts +0 -127
- package/src/domain/Voicemail.ts +0 -138
- package/src/domain/__tests__/Agent.test.ts +0 -38
- package/src/domain/__tests__/Call.test.ts +0 -26
- package/src/domain/__tests__/CallLog.test.ts +0 -203
- package/src/domain/__tests__/CallSession.test.ts +0 -80
- package/src/domain/__tests__/Contact.test.ts +0 -407
- package/src/domain/__tests__/IndirectTransfer.test.ts +0 -68
- package/src/domain/__tests__/Line.test.ts +0 -53
- package/src/domain/__tests__/Meeting.test.ts +0 -93
- package/src/domain/__tests__/MeetingAuthorization.test.ts +0 -50
- package/src/domain/__tests__/Profile.test.ts +0 -170
- package/src/domain/__tests__/Room.test.ts +0 -207
- package/src/domain/__tests__/Session.test.ts +0 -385
- package/src/domain/__tests__/SipLine.test.ts +0 -30
- package/src/domain/__tests__/Voicemail.test.ts +0 -91
- package/src/domain/types.ts +0 -331
- package/src/index.ts +0 -60
- package/src/lib/WazoSessionDescriptionHandler.ts +0 -532
- package/src/pubkey.ts +0 -11
- package/src/service/CallApi.ts +0 -86
- package/src/service/IssueReporter.ts +0 -434
- package/src/service/__tests__/IssueReporter.test.ts +0 -127
- package/src/service/__tests__/getApiclient.test.ts +0 -46
- package/src/service/getApiClient.ts +0 -113
- package/src/simple/Auth.ts +0 -496
- package/src/simple/Configuration.ts +0 -18
- package/src/simple/Directory.ts +0 -16
- package/src/simple/Phone.ts +0 -531
- package/src/simple/Websocket.ts +0 -107
- package/src/simple/__tests__/Auth.test.ts +0 -168
- package/src/simple/index.ts +0 -153
- package/src/simple/room/LocalParticipant.ts +0 -5
- package/src/simple/room/Participant.ts +0 -409
- package/src/simple/room/RemoteParticipant.ts +0 -15
- package/src/simple/room/Room.ts +0 -942
- package/src/simple/room/SipRoom.ts +0 -164
- package/src/simple/room/Stream.ts +0 -64
- package/src/simple/room/__tests__/Participant.test.ts +0 -73
- package/src/simple/room/__tests__/RemoteParticipant.test.ts +0 -15
- package/src/simple/utils.ts +0 -12
- package/src/types/WebSocketMessage.ts +0 -335
- package/src/types/global.d.ts +0 -33
- package/src/types/wazo.d.ts +0 -1
- package/src/utils/Emitter.ts +0 -34
- package/src/utils/Heartbeat.ts +0 -102
- package/src/utils/PhoneNumberUtil.ts +0 -81
- package/src/utils/__tests__/Heartbeat.test.ts +0 -66
- package/src/utils/__tests__/PhoneNumberUtil.test.ts +0 -79
- package/src/utils/__tests__/api-requester.test.ts +0 -180
- package/src/utils/__tests__/array.test.ts +0 -19
- package/src/utils/__tests__/compare-version.test.ts +0 -11
- package/src/utils/__tests__/object.test.ts +0 -77
- package/src/utils/__tests__/sdp.test.ts +0 -173
- package/src/utils/__tests__/string.test.ts +0 -55
- package/src/utils/api-requester.ts +0 -294
- package/src/utils/array.ts +0 -11
- package/src/utils/compare-version.ts +0 -21
- package/src/utils/isMobile.ts +0 -4
- package/src/utils/new-from.ts +0 -7
- package/src/utils/object.ts +0 -12
- package/src/utils/once.ts +0 -14
- package/src/utils/sdp.ts +0 -140
- package/src/utils/string.ts +0 -15
- package/src/utils/update-from.ts +0 -11
- package/src/utils/webrtc.ts +0 -56
- package/src/web-rtc-client.ts +0 -2687
- package/src/websocket-client.ts +0 -475
- /package/{esm → dist}/types/__tests__/api-client.test.d.ts +0 -0
- /package/{esm → dist}/types/__tests__/api-client.test.d.ts.map +0 -0
- /package/{esm → dist}/types/__tests__/web-rtc-client.test.d.ts +0 -0
- /package/{esm → dist}/types/__tests__/web-rtc-client.test.d.ts.map +0 -0
- /package/{esm → dist}/types/api/agentd.d.ts +0 -0
- /package/{esm → dist}/types/api/agentd.d.ts.map +0 -0
- /package/{esm → dist}/types/api/amid.d.ts +0 -0
- /package/{esm → dist}/types/api/amid.d.ts.map +0 -0
- /package/{esm → dist}/types/api/application.d.ts +0 -0
- /package/{esm → dist}/types/api/application.d.ts.map +0 -0
- /package/{esm → dist}/types/api/auth.d.ts +0 -0
- /package/{esm → dist}/types/api/auth.d.ts.map +0 -0
- /package/{esm → dist}/types/api/call-logd.d.ts +0 -0
- /package/{esm → dist}/types/api/call-logd.d.ts.map +0 -0
- /package/{esm → dist}/types/api/calld.d.ts +0 -0
- /package/{esm → dist}/types/api/calld.d.ts.map +0 -0
- /package/{esm → dist}/types/api/chatd.d.ts +0 -0
- /package/{esm → dist}/types/api/chatd.d.ts.map +0 -0
- /package/{esm → dist}/types/api/confd.d.ts +0 -0
- /package/{esm → dist}/types/api/confd.d.ts.map +0 -0
- /package/{esm → dist}/types/api/ctid-ng.d.ts +0 -0
- /package/{esm → dist}/types/api/ctid-ng.d.ts.map +0 -0
- /package/{esm → dist}/types/api/dird.d.ts +0 -0
- /package/{esm → dist}/types/api/dird.d.ts.map +0 -0
- /package/{esm → dist}/types/api/webhookd.d.ts +0 -0
- /package/{esm → dist}/types/api/webhookd.d.ts.map +0 -0
- /package/{esm → dist}/types/api-client.d.ts +0 -0
- /package/{esm → dist}/types/api-client.d.ts.map +0 -0
- /package/{esm → dist}/types/base-api-client.d.ts +0 -0
- /package/{esm → dist}/types/base-api-client.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/Checker.d.ts +0 -0
- /package/{esm → dist}/types/checker/Checker.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/aor.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/aor.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/api.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/api.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/ice-ipv4.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/ice-ipv4.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/index.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/index.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/symmetric-nat.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/symmetric-nat.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/wazo-websocket.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/wazo-websocket.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/webrtc-transport.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/webrtc-transport.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/webrtc.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/webrtc.d.ts.map +0 -0
- /package/{esm → dist}/types/constants.d.ts +0 -0
- /package/{esm → dist}/types/constants.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/AdHocAPIConference.d.ts +0 -0
- /package/{esm → dist}/types/domain/AdHocAPIConference.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Agent.d.ts +0 -0
- /package/{esm → dist}/types/domain/Agent.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/BadResponse.d.ts +0 -0
- /package/{esm → dist}/types/domain/BadResponse.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Call.d.ts +0 -0
- /package/{esm → dist}/types/domain/Call.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/CallLog.d.ts +0 -0
- /package/{esm → dist}/types/domain/CallLog.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/CallSession.d.ts +0 -0
- /package/{esm → dist}/types/domain/CallSession.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/CallerID.d.ts +0 -0
- /package/{esm → dist}/types/domain/CallerID.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/ChatMessage.d.ts +0 -0
- /package/{esm → dist}/types/domain/ChatMessage.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/ChatRoom.d.ts +0 -0
- /package/{esm → dist}/types/domain/ChatRoom.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Country.d.ts +0 -0
- /package/{esm → dist}/types/domain/Country.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Device/DebugDevice.d.ts +0 -0
- /package/{esm → dist}/types/domain/Device/DebugDevice.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Device/Device.d.ts +0 -0
- /package/{esm → dist}/types/domain/Device/Device.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/DirectorySource.d.ts +0 -0
- /package/{esm → dist}/types/domain/DirectorySource.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/ExternalApp.d.ts +0 -0
- /package/{esm → dist}/types/domain/ExternalApp.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Features.d.ts +0 -0
- /package/{esm → dist}/types/domain/Features.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/ForwardOption.d.ts +0 -0
- /package/{esm → dist}/types/domain/ForwardOption.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Incall.d.ts +0 -0
- /package/{esm → dist}/types/domain/Incall.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/IndirectTransfer.d.ts +0 -0
- /package/{esm → dist}/types/domain/IndirectTransfer.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Line.d.ts +0 -0
- /package/{esm → dist}/types/domain/Line.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Meeting.d.ts +0 -0
- /package/{esm → dist}/types/domain/Meeting.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/MeetingAuthorization.d.ts +0 -0
- /package/{esm → dist}/types/domain/MeetingAuthorization.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/MeetingStatus.d.ts +0 -0
- /package/{esm → dist}/types/domain/MeetingStatus.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/NotificationOptions.d.ts +0 -0
- /package/{esm → dist}/types/domain/NotificationOptions.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Phone/CTIPhone.d.ts +0 -0
- /package/{esm → dist}/types/domain/Phone/CTIPhone.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Phone/Phone.d.ts +0 -0
- /package/{esm → dist}/types/domain/Phone/Phone.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Phone/WebRTCPhone.d.ts +0 -0
- /package/{esm → dist}/types/domain/Phone/WebRTCPhone.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Profile.d.ts +0 -0
- /package/{esm → dist}/types/domain/Profile.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Recording.d.ts +0 -0
- /package/{esm → dist}/types/domain/Recording.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Relocation.d.ts +0 -0
- /package/{esm → dist}/types/domain/Relocation.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Room.d.ts +0 -0
- /package/{esm → dist}/types/domain/Room.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/SFUNotAvailableError.d.ts +0 -0
- /package/{esm → dist}/types/domain/SFUNotAvailableError.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/ServerError.d.ts +0 -0
- /package/{esm → dist}/types/domain/ServerError.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Session.d.ts +0 -0
- /package/{esm → dist}/types/domain/Session.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/SipLine.d.ts +0 -0
- /package/{esm → dist}/types/domain/SipLine.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Subscription.d.ts +0 -0
- /package/{esm → dist}/types/domain/Subscription.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/SwitchboardCall.d.ts +0 -0
- /package/{esm → dist}/types/domain/SwitchboardCall.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Voicemail.d.ts +0 -0
- /package/{esm → dist}/types/domain/Voicemail.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Agent.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Agent.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Call.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Call.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/CallLog.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/CallLog.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/CallSession.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/CallSession.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Contact.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Contact.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/IndirectTransfer.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/IndirectTransfer.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Line.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Line.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Meeting.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Meeting.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/MeetingAuthorization.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/MeetingAuthorization.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Profile.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Profile.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Room.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Room.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Session.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Session.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/SipLine.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/SipLine.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Voicemail.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Voicemail.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/types.d.ts +0 -0
- /package/{esm → dist}/types/domain/types.d.ts.map +0 -0
- /package/{esm → dist}/types/lib/WazoSessionDescriptionHandler.d.ts +0 -0
- /package/{esm → dist}/types/lib/WazoSessionDescriptionHandler.d.ts.map +0 -0
- /package/{esm → dist}/types/pubkey.d.ts +0 -0
- /package/{esm → dist}/types/pubkey.d.ts.map +0 -0
- /package/{esm → dist}/types/service/CallApi.d.ts +0 -0
- /package/{esm → dist}/types/service/CallApi.d.ts.map +0 -0
- /package/{esm → dist}/types/service/IssueReporter.d.ts +0 -0
- /package/{esm → dist}/types/service/IssueReporter.d.ts.map +0 -0
- /package/{esm → dist}/types/service/__tests__/IssueReporter.test.d.ts +0 -0
- /package/{esm → dist}/types/service/__tests__/IssueReporter.test.d.ts.map +0 -0
- /package/{esm → dist}/types/service/__tests__/getApiclient.test.d.ts +0 -0
- /package/{esm → dist}/types/service/__tests__/getApiclient.test.d.ts.map +0 -0
- /package/{esm → dist}/types/service/getApiClient.d.ts +0 -0
- /package/{esm → dist}/types/service/getApiClient.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/Auth.d.ts +0 -0
- /package/{esm → dist}/types/simple/Auth.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/Configuration.d.ts +0 -0
- /package/{esm → dist}/types/simple/Configuration.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/Directory.d.ts +0 -0
- /package/{esm → dist}/types/simple/Directory.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/Phone.d.ts +0 -0
- /package/{esm → dist}/types/simple/Phone.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/Websocket.d.ts +0 -0
- /package/{esm → dist}/types/simple/Websocket.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/__tests__/Auth.test.d.ts +0 -0
- /package/{esm → dist}/types/simple/__tests__/Auth.test.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/index.d.ts +0 -0
- /package/{esm → dist}/types/simple/index.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/LocalParticipant.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/LocalParticipant.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/Participant.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/Participant.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/RemoteParticipant.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/RemoteParticipant.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/Room.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/Room.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/SipRoom.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/SipRoom.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/Stream.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/Stream.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/__tests__/Participant.test.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/__tests__/Participant.test.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/__tests__/RemoteParticipant.test.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/__tests__/RemoteParticipant.test.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/utils.d.ts +0 -0
- /package/{esm → dist}/types/simple/utils.d.ts.map +0 -0
- /package/{esm → dist}/types/types/WebSocketMessage.d.ts +0 -0
- /package/{esm → dist}/types/types/WebSocketMessage.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/Emitter.d.ts +0 -0
- /package/{esm → dist}/types/utils/Emitter.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/Heartbeat.d.ts +0 -0
- /package/{esm → dist}/types/utils/Heartbeat.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/PhoneNumberUtil.d.ts +0 -0
- /package/{esm → dist}/types/utils/PhoneNumberUtil.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/Heartbeat.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/Heartbeat.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/PhoneNumberUtil.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/PhoneNumberUtil.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/api-requester.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/api-requester.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/array.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/array.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/compare-version.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/compare-version.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/object.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/object.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/sdp.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/sdp.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/string.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/string.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/api-requester.d.ts +0 -0
- /package/{esm → dist}/types/utils/api-requester.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/array.d.ts +0 -0
- /package/{esm → dist}/types/utils/array.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/compare-version.d.ts +0 -0
- /package/{esm → dist}/types/utils/compare-version.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/isMobile.d.ts +0 -0
- /package/{esm → dist}/types/utils/isMobile.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/new-from.d.ts +0 -0
- /package/{esm → dist}/types/utils/new-from.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/object.d.ts +0 -0
- /package/{esm → dist}/types/utils/object.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/once.d.ts +0 -0
- /package/{esm → dist}/types/utils/once.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/sdp.d.ts +0 -0
- /package/{esm → dist}/types/utils/sdp.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/string.d.ts +0 -0
- /package/{esm → dist}/types/utils/string.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/update-from.d.ts +0 -0
- /package/{esm → dist}/types/utils/update-from.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/webrtc.d.ts +0 -0
- /package/{esm → dist}/types/utils/webrtc.d.ts.map +0 -0
- /package/{esm → dist}/types/web-rtc-client.d.ts +0 -0
- /package/{esm → dist}/types/web-rtc-client.d.ts.map +0 -0
- /package/{esm → dist}/types/websocket-client.d.ts +0 -0
- /package/{esm → dist}/types/websocket-client.d.ts.map +0 -0
|
@@ -1,434 +0,0 @@
|
|
|
1
|
-
/* global window */
|
|
2
|
-
|
|
3
|
-
/* eslint-disable prefer-destructuring, no-param-reassign, no-underscore-dangle */
|
|
4
|
-
import moment from 'moment';
|
|
5
|
-
import isMobile from '../utils/isMobile';
|
|
6
|
-
import { obfuscateToken } from '../utils/string';
|
|
7
|
-
|
|
8
|
-
const TRACE = 'trace';
|
|
9
|
-
const DEBUG = 'debug';
|
|
10
|
-
const INFO = 'info';
|
|
11
|
-
const LOG = 'log';
|
|
12
|
-
const WARN = 'warn';
|
|
13
|
-
const ERROR = 'error';
|
|
14
|
-
const CONSOLE_METHODS = [INFO, LOG, WARN, ERROR];
|
|
15
|
-
const LOG_LEVELS = [TRACE, DEBUG, INFO, LOG, WARN, ERROR];
|
|
16
|
-
const CATEGORY_PREFIX = 'logger-category=';
|
|
17
|
-
const MAX_REMOTE_RETRY = 10;
|
|
18
|
-
|
|
19
|
-
const addLevelsTo = (instance: Record<string, any>, withMethods = false) => {
|
|
20
|
-
instance.TRACE = TRACE;
|
|
21
|
-
instance.DEBUG = DEBUG;
|
|
22
|
-
instance.INFO = INFO;
|
|
23
|
-
instance.LOG = LOG;
|
|
24
|
-
instance.WARN = WARN;
|
|
25
|
-
instance.ERROR = ERROR;
|
|
26
|
-
|
|
27
|
-
if (withMethods) {
|
|
28
|
-
instance.trace = (...args: any) => instance.apply(null, [TRACE, ...args]);
|
|
29
|
-
|
|
30
|
-
instance.debug = (...args: any) => instance.apply(null, [DEBUG, ...args]);
|
|
31
|
-
|
|
32
|
-
instance.info = (...args: any) => instance.apply(null, [INFO, ...args]);
|
|
33
|
-
|
|
34
|
-
instance.log = (...args: any) => instance.apply(null, [LOG, ...args]);
|
|
35
|
-
|
|
36
|
-
instance.warn = (...args: any) => instance.apply(null, [WARN, ...args]);
|
|
37
|
-
|
|
38
|
-
instance.error = (...args: any) => instance.apply(null, [ERROR, ...args]);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return instance;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const safeStringify = (object: Record<string, any>) => {
|
|
45
|
-
const result = '{"message": "Not parsable JSON"}';
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
return JSON.stringify(object);
|
|
49
|
-
} catch (e: any) { // Nothing to do
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return result;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
class IssueReporter {
|
|
56
|
-
TRACE: string;
|
|
57
|
-
|
|
58
|
-
INFO: string;
|
|
59
|
-
|
|
60
|
-
LOG: string;
|
|
61
|
-
|
|
62
|
-
WARN: string;
|
|
63
|
-
|
|
64
|
-
ERROR: string;
|
|
65
|
-
|
|
66
|
-
oldConsoleMethods: Record<string, any> | null;
|
|
67
|
-
|
|
68
|
-
enabled: boolean;
|
|
69
|
-
|
|
70
|
-
remoteClientConfiguration: Record<string, any> | null | undefined;
|
|
71
|
-
|
|
72
|
-
buffer: Record<string, any>[];
|
|
73
|
-
|
|
74
|
-
bufferTimeout: any | null | undefined;
|
|
75
|
-
|
|
76
|
-
_boundProcessBuffer: (...args: Array<any>) => any;
|
|
77
|
-
|
|
78
|
-
_boundParseLoggerBody: (...args: Array<any>) => any;
|
|
79
|
-
|
|
80
|
-
_callback: ((...args: Array<any>) => any) | null | undefined;
|
|
81
|
-
|
|
82
|
-
constructor() {
|
|
83
|
-
addLevelsTo(this);
|
|
84
|
-
this.oldConsoleMethods = null;
|
|
85
|
-
this.enabled = false;
|
|
86
|
-
this.remoteClientConfiguration = null;
|
|
87
|
-
this.buffer = [];
|
|
88
|
-
this.bufferTimeout = null;
|
|
89
|
-
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
90
|
-
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
91
|
-
this._callback = null;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
init() {
|
|
95
|
-
this._catchConsole();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
setCallback(cb: (...args: Array<any>) => any) {
|
|
99
|
-
this._callback = cb;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
configureRemoteClient(configuration: Record<string, any> = {
|
|
103
|
-
tag: 'wazo-sdk',
|
|
104
|
-
host: null,
|
|
105
|
-
port: null,
|
|
106
|
-
level: null,
|
|
107
|
-
extra: {},
|
|
108
|
-
}) {
|
|
109
|
-
this.remoteClientConfiguration = configuration;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
enable() {
|
|
113
|
-
if (!this.oldConsoleMethods) {
|
|
114
|
-
this.init();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
this.enabled = true;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
disable() {
|
|
121
|
-
this.enabled = false;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
loggerFor(category: string): any {
|
|
125
|
-
const logger = (level: string, ...args: any) => {
|
|
126
|
-
this.log.apply(this, [level, this._makeCategory(category), ...args]);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
return addLevelsTo(logger, true);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
removeSlashes(str: string) {
|
|
133
|
-
return str.replace(/"/g, "'").replace(/\\/g, '');
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
obfuscateHeaderToken(headers: object): object {
|
|
137
|
-
const newHeaders: object = { ...headers };
|
|
138
|
-
if ('X-Auth-Token' in newHeaders) {
|
|
139
|
-
newHeaders['X-Auth-Token'] = obfuscateToken(newHeaders['X-Auth-Token'] as string);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return newHeaders;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
log(level: string, ...args: any) {
|
|
146
|
-
if (!this.enabled) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Handle category label
|
|
151
|
-
let category = null;
|
|
152
|
-
let skipSendToRemote = false;
|
|
153
|
-
let extra: any = {};
|
|
154
|
-
|
|
155
|
-
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
156
|
-
category = args[0].split('=')[1];
|
|
157
|
-
// eslint-disable-next-line no-param-reassign
|
|
158
|
-
args.splice(0, 1);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Handle extra data as object for the last argument
|
|
162
|
-
const lastArg = args[args.length - 1];
|
|
163
|
-
|
|
164
|
-
if (lastArg && ((typeof lastArg === 'object' && Object.keys(lastArg).length) || lastArg instanceof Error)) {
|
|
165
|
-
if (lastArg instanceof Error) {
|
|
166
|
-
extra = {
|
|
167
|
-
errorMessage: lastArg.message,
|
|
168
|
-
errorStack: lastArg.stack,
|
|
169
|
-
errorType: lastArg.constructor.name,
|
|
170
|
-
skipSendToRemote: (lastArg as Error & { skipSendToRemote: boolean }).skipSendToRemote,
|
|
171
|
-
};
|
|
172
|
-
} else {
|
|
173
|
-
extra = lastArg;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// eslint-disable-next-line no-param-reassign
|
|
177
|
-
args.splice(1, 1);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (extra.skipSendToRemote) {
|
|
181
|
-
skipSendToRemote = true;
|
|
182
|
-
delete extra.skipSendToRemote;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
186
|
-
const message = args.join(', ');
|
|
187
|
-
let consoleMessage = message;
|
|
188
|
-
|
|
189
|
-
if (Object.keys(extra).length) {
|
|
190
|
-
const parsedExtra = safeStringify(extra);
|
|
191
|
-
consoleMessage = `${consoleMessage} (${parsedExtra})`;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (category) {
|
|
195
|
-
consoleMessage = `[${category}] ${consoleMessage}`;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Log the message in the console anyway (but don't console.error on mobile)
|
|
199
|
-
const consoleLevel = isMobile() && level === 'error' ? WARN : level;
|
|
200
|
-
// eslint-disable-next-line
|
|
201
|
-
const oldMethod = this.oldConsoleMethods?.[consoleLevel] || this.oldConsoleMethods?.log;
|
|
202
|
-
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
203
|
-
|
|
204
|
-
if (this._callback) {
|
|
205
|
-
this._callback(level, consoleMessage);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (!skipSendToRemote) {
|
|
209
|
-
this._sendToRemoteLogger(level, {
|
|
210
|
-
date,
|
|
211
|
-
message,
|
|
212
|
-
category,
|
|
213
|
-
...extra,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
logRequest(url: string, options: Record<string, any>, response: Record<string, any>, start: Date) {
|
|
219
|
-
if (!this.enabled) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const {
|
|
224
|
-
status,
|
|
225
|
-
} = response;
|
|
226
|
-
|
|
227
|
-
const duration = +(new Date()) - +start;
|
|
228
|
-
let level = TRACE;
|
|
229
|
-
|
|
230
|
-
if (status >= 400 && status < 500) {
|
|
231
|
-
level = WARN;
|
|
232
|
-
} else if (status >= 500) {
|
|
233
|
-
level = ERROR;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
this.log(level, this._makeCategory('http'), url, {
|
|
237
|
-
status,
|
|
238
|
-
body: this.removeSlashes(JSON.stringify(options.body)),
|
|
239
|
-
method: options.method,
|
|
240
|
-
headers: this.obfuscateHeaderToken(options.headers),
|
|
241
|
-
duration,
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// Logs aren't stored anymore
|
|
246
|
-
getLogs() {
|
|
247
|
-
console.warn('IssueReporter\'s logs aren\'t stored anymore. Please use fluentd to store them');
|
|
248
|
-
return [];
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
getParsedLogs() {
|
|
252
|
-
console.warn('IssueReporter\'s logs aren\'t stored anymore. Please use fluentd to store them');
|
|
253
|
-
return [];
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
getReport() {
|
|
257
|
-
return this.getParsedLogs().join('\r\n');
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
_catchConsole() {
|
|
261
|
-
this.oldConsoleMethods = {};
|
|
262
|
-
CONSOLE_METHODS.forEach((methodName: string) => {
|
|
263
|
-
if (this.oldConsoleMethods) {
|
|
264
|
-
// @ts-ignore: keys
|
|
265
|
-
// eslint-disable-next-line
|
|
266
|
-
this.oldConsoleMethods[methodName] = console[methodName];
|
|
267
|
-
}
|
|
268
|
-
const parent:any = typeof window !== 'undefined' ? window : global;
|
|
269
|
-
parent.console[methodName] = (...args: any) => {
|
|
270
|
-
// Store message
|
|
271
|
-
try {
|
|
272
|
-
this.log(methodName, args.join(' '));
|
|
273
|
-
if (this.oldConsoleMethods) {
|
|
274
|
-
// Use old console method to log it normally
|
|
275
|
-
this.oldConsoleMethods[methodName].apply(null, args);
|
|
276
|
-
}
|
|
277
|
-
} catch (e: any) { // Avoid circular structure issues
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
_sendToRemoteLogger(level: string, payload: Record<string, any> = {}) {
|
|
284
|
-
if (!this.remoteClientConfiguration) {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
const {
|
|
289
|
-
level: minLevel,
|
|
290
|
-
bufferSize,
|
|
291
|
-
} = this.remoteClientConfiguration;
|
|
292
|
-
|
|
293
|
-
if (!minLevel || this._isLevelAbove(minLevel, level)) {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
payload.level = level;
|
|
298
|
-
|
|
299
|
-
if (bufferSize > 0) {
|
|
300
|
-
return this._addToBuffer(payload);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
this._sendDebugToGrafana(payload);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
_parseLoggerBody(payload: Record<string, any>) {
|
|
307
|
-
const {
|
|
308
|
-
level,
|
|
309
|
-
} = payload;
|
|
310
|
-
const {
|
|
311
|
-
maxMessageSize,
|
|
312
|
-
extra,
|
|
313
|
-
} = this.remoteClientConfiguration || {};
|
|
314
|
-
delete payload.level;
|
|
315
|
-
|
|
316
|
-
if (maxMessageSize && typeof payload.message === 'string' && payload.message.length > maxMessageSize) {
|
|
317
|
-
payload.message = `${payload.message.substr(0, maxMessageSize)}...`;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
return safeStringify({
|
|
321
|
-
level,
|
|
322
|
-
...payload,
|
|
323
|
-
...extra,
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
_addToBuffer(payload: Record<string, any>) {
|
|
328
|
-
// Reset buffer timer
|
|
329
|
-
if (this.bufferTimeout) {
|
|
330
|
-
clearTimeout(this.bufferTimeout);
|
|
331
|
-
this.bufferTimeout = null;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
this.buffer.push(payload);
|
|
335
|
-
|
|
336
|
-
const {
|
|
337
|
-
bufferSize,
|
|
338
|
-
bufferTimeout,
|
|
339
|
-
}: any = this.remoteClientConfiguration;
|
|
340
|
-
|
|
341
|
-
if (this.buffer.length > bufferSize) {
|
|
342
|
-
return this._processBuffer();
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
if (bufferTimeout > 0) {
|
|
346
|
-
this.bufferTimeout = setTimeout(this._boundProcessBuffer, bufferTimeout);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
_processBuffer() {
|
|
351
|
-
this._sendDebugToGrafana(this.buffer);
|
|
352
|
-
|
|
353
|
-
this.buffer = [];
|
|
354
|
-
|
|
355
|
-
if (this.bufferTimeout) {
|
|
356
|
-
clearTimeout(this.bufferTimeout);
|
|
357
|
-
this.bufferTimeout = null;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
_computeRetryDelay(attempt: number, initial = 1000, maxWait = 50000) {
|
|
362
|
-
// min wait is initial(attempt = 0)
|
|
363
|
-
// later retries are randomly distributed between initial wait and exponential
|
|
364
|
-
const base = 1.5;
|
|
365
|
-
const wait = Math.min(initial * base ** attempt, maxWait);
|
|
366
|
-
const jitterWait = Math.max(initial, Math.random() * wait);
|
|
367
|
-
return jitterWait;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
_sendDebugToGrafana(payload: string | Record<string, any> | Record<string, any>[], retry = 0) {
|
|
371
|
-
if (!this.remoteClientConfiguration || retry >= MAX_REMOTE_RETRY) {
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
const {
|
|
376
|
-
tag,
|
|
377
|
-
host,
|
|
378
|
-
port,
|
|
379
|
-
} = this.remoteClientConfiguration;
|
|
380
|
-
|
|
381
|
-
const isSecure = +port === 443;
|
|
382
|
-
const url = `http${isSecure ? 's' : ''}://${host}${isSecure ? '' : `:${port}`}/${tag}`;
|
|
383
|
-
const body = Array.isArray(payload) ? `[${payload.map(this._boundParseLoggerBody).join(',')}]` : this._parseLoggerBody(payload as Record<string, any>);
|
|
384
|
-
|
|
385
|
-
fetch(url, {
|
|
386
|
-
method: 'POST',
|
|
387
|
-
headers: {
|
|
388
|
-
Accept: 'application/json',
|
|
389
|
-
'Content-Type': 'application/json',
|
|
390
|
-
},
|
|
391
|
-
body,
|
|
392
|
-
}).catch((e: Error & { skipSendToRemote?: boolean }) => {
|
|
393
|
-
e.skipSendToRemote = true;
|
|
394
|
-
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
395
|
-
// wait at least 1 second, at most 50 seconds
|
|
396
|
-
const wait = this._computeRetryDelay(retry, 1000, 50000);
|
|
397
|
-
setTimeout(() => {
|
|
398
|
-
if (Array.isArray(payload)) {
|
|
399
|
-
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
400
|
-
} else if (payload && typeof payload === 'object') {
|
|
401
|
-
payload = this._writeRetryCount(payload, retry + 1);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
this._sendDebugToGrafana(payload, retry + 1);
|
|
405
|
-
}, wait);
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
_writeRetryCount(message: string | Record<string, any>, count: number): string | Record<string, any> {
|
|
410
|
-
if (message && typeof message === 'object') {
|
|
411
|
-
message._retry = count;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
return message;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
_isLevelAbove(level1: string, level2: string) {
|
|
418
|
-
const index1 = LOG_LEVELS.indexOf(level1);
|
|
419
|
-
const index2 = LOG_LEVELS.indexOf(level2);
|
|
420
|
-
|
|
421
|
-
if (index1 === -1 || index2 === -1) {
|
|
422
|
-
return false;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
return index1 > index2;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
_makeCategory(category: string) {
|
|
429
|
-
return `${CATEGORY_PREFIX}${category}`;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
export default new IssueReporter();
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-underscore-dangle */
|
|
2
|
-
|
|
3
|
-
/* eslint-disable no-useless-escape */
|
|
4
|
-
|
|
5
|
-
/* eslint-disable no-console */
|
|
6
|
-
import IssueReporter from '../IssueReporter';
|
|
7
|
-
|
|
8
|
-
jest.mock('../../utils/api-requester');
|
|
9
|
-
let oldLog: any;
|
|
10
|
-
let oldError: any;
|
|
11
|
-
|
|
12
|
-
class MyError extends Error {}
|
|
13
|
-
|
|
14
|
-
describe('IssueReporter', () => {
|
|
15
|
-
beforeAll(() => {
|
|
16
|
-
oldLog = console.log;
|
|
17
|
-
oldError = console.error;
|
|
18
|
-
|
|
19
|
-
console.log = () => {};
|
|
20
|
-
|
|
21
|
-
console.error = () => {};
|
|
22
|
-
|
|
23
|
-
IssueReporter.enable();
|
|
24
|
-
});
|
|
25
|
-
beforeEach(() => {
|
|
26
|
-
jest.resetAllMocks();
|
|
27
|
-
Object.defineProperty(global, 'fetch', {
|
|
28
|
-
value: jest.fn(() => ({
|
|
29
|
-
catch: () => {},
|
|
30
|
-
})),
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
afterAll(() => {
|
|
34
|
-
console.log = oldLog;
|
|
35
|
-
console.error = oldError;
|
|
36
|
-
});
|
|
37
|
-
it('should compute level order', () => {
|
|
38
|
-
expect(IssueReporter._isLevelAbove('info', 'trace')).toBeTruthy();
|
|
39
|
-
expect(IssueReporter._isLevelAbove('trace', 'warn')).toBeFalsy();
|
|
40
|
-
expect(IssueReporter._isLevelAbove('error', 'warn')).toBeTruthy();
|
|
41
|
-
expect(IssueReporter._isLevelAbove('info', 'warn')).toBeFalsy();
|
|
42
|
-
expect(IssueReporter._isLevelAbove('trace', 'trace')).toBeFalsy();
|
|
43
|
-
expect(IssueReporter._isLevelAbove('trace', 'something')).toBeFalsy();
|
|
44
|
-
expect(IssueReporter._isLevelAbove('something', 'trace')).toBeFalsy();
|
|
45
|
-
});
|
|
46
|
-
it('should send if verbosity is higher than required', () => {
|
|
47
|
-
// Same level
|
|
48
|
-
IssueReporter.configureRemoteClient({
|
|
49
|
-
level: 'trace',
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
IssueReporter._sendToRemoteLogger('info');
|
|
53
|
-
|
|
54
|
-
expect(fetch).toHaveBeenCalled();
|
|
55
|
-
});
|
|
56
|
-
it('should send if verbosity is equal than required', () => {
|
|
57
|
-
// Same level
|
|
58
|
-
IssueReporter.configureRemoteClient({
|
|
59
|
-
level: 'trace',
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
IssueReporter._sendToRemoteLogger('trace');
|
|
63
|
-
|
|
64
|
-
expect(fetch).toHaveBeenCalled();
|
|
65
|
-
});
|
|
66
|
-
it('should not send if verbosity is lower than required', () => {
|
|
67
|
-
// Lower level
|
|
68
|
-
IssueReporter.configureRemoteClient({
|
|
69
|
-
level: 'info',
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
IssueReporter._sendToRemoteLogger('trace');
|
|
73
|
-
|
|
74
|
-
expect(fetch).not.toHaveBeenCalled();
|
|
75
|
-
});
|
|
76
|
-
it('should log extra data', () => {
|
|
77
|
-
jest.spyOn(IssueReporter, '_sendToRemoteLogger').mockImplementation(() => {});
|
|
78
|
-
IssueReporter.log('log', 'logger-category=http', 'my message', {
|
|
79
|
-
status: 200,
|
|
80
|
-
});
|
|
81
|
-
expect(IssueReporter._sendToRemoteLogger).toHaveBeenCalledWith('log', {
|
|
82
|
-
date: expect.anything(),
|
|
83
|
-
message: 'my message',
|
|
84
|
-
category: 'http',
|
|
85
|
-
status: 200,
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
it('should log an error', () => {
|
|
89
|
-
jest.spyOn(IssueReporter, '_sendToRemoteLogger').mockImplementation(() => {});
|
|
90
|
-
IssueReporter.log('error', 'logger-category=http', 'my message', new MyError('nope'));
|
|
91
|
-
expect(IssueReporter._sendToRemoteLogger).toHaveBeenCalledWith('error', {
|
|
92
|
-
date: expect.anything(),
|
|
93
|
-
message: 'my message',
|
|
94
|
-
category: 'http',
|
|
95
|
-
errorMessage: 'nope',
|
|
96
|
-
errorStack: expect.anything(),
|
|
97
|
-
errorType: 'MyError',
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
it('remove slashes', () => {
|
|
101
|
-
expect(IssueReporter.removeSlashes('\\')).toBe('');
|
|
102
|
-
expect(IssueReporter.removeSlashes('\\"')).toBe("'");
|
|
103
|
-
expect(IssueReporter.removeSlashes('\"')).toBe("'");
|
|
104
|
-
expect(IssueReporter.removeSlashes('\\\"')).toBe("'");
|
|
105
|
-
});
|
|
106
|
-
it('Add retry count', () => {
|
|
107
|
-
expect(IssueReporter._writeRetryCount('', 1)).toBe('');
|
|
108
|
-
expect(IssueReporter._writeRetryCount('{}', 1)).toBe('{}');
|
|
109
|
-
expect(IssueReporter._writeRetryCount({}, 1)).toEqual({
|
|
110
|
-
_retry: 1,
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('retry delay', () => {
|
|
115
|
-
expect(IssueReporter._computeRetryDelay(0, 1000, 50000)).toBe(1000);
|
|
116
|
-
expect(IssueReporter._computeRetryDelay(1, 1000, 50000)).toBeGreaterThanOrEqual(1000);
|
|
117
|
-
const samples = [];
|
|
118
|
-
for (let i = 0; i <= 10; i++) {
|
|
119
|
-
samples.push(IssueReporter._computeRetryDelay(i, 1000, 50000));
|
|
120
|
-
}
|
|
121
|
-
const min = Math.min(...samples);
|
|
122
|
-
expect(min).toBe(1000);
|
|
123
|
-
const max = Math.max(...samples);
|
|
124
|
-
expect(max).toBeLessThanOrEqual(50000);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { ApiRequester, BaseApiClient, WazoApiClient } from '../..';
|
|
2
|
-
import { ConstructorParams } from '../../base-api-client';
|
|
3
|
-
import getApiClient from '../getApiClient';
|
|
4
|
-
|
|
5
|
-
describe('getApiClient', () => {
|
|
6
|
-
it('should return WazoApiClient by default', () => {
|
|
7
|
-
const globalClient = getApiClient();
|
|
8
|
-
expect(globalClient).toBeInstanceOf(WazoApiClient);
|
|
9
|
-
expect(globalClient.amid).toBeDefined();
|
|
10
|
-
|
|
11
|
-
const serverClient = getApiClient('wazo-platorm.org');
|
|
12
|
-
expect(serverClient).toBeInstanceOf(WazoApiClient);
|
|
13
|
-
expect(globalClient.amid).toBeDefined();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it.only('should return custom ApiClient', () => {
|
|
17
|
-
const fooMethods = (client: ApiRequester, baseUrl: string) => ({
|
|
18
|
-
test: (myString: string) => ({ client, myString, baseUrl }),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
class FooApiClient extends BaseApiClient {
|
|
22
|
-
public foo: ReturnType<typeof fooMethods>;
|
|
23
|
-
|
|
24
|
-
constructor(args: ConstructorParams) {
|
|
25
|
-
super(args);
|
|
26
|
-
this.initializeEndpoints();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
initializeEndpoints() {
|
|
30
|
-
super.initializeEndpoints();
|
|
31
|
-
this.foo = fooMethods(this.client, 'foo/0.1');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const extendedClient = getApiClient<FooApiClient>('foo.wazo-platform.org', FooApiClient);
|
|
36
|
-
expect(extendedClient).toBeInstanceOf(FooApiClient);
|
|
37
|
-
expect(extendedClient.auth).toBeDefined();
|
|
38
|
-
// @ts-ignore: we know amid is undefined, it's important to test it
|
|
39
|
-
expect(extendedClient.amid).not.toBeDefined();
|
|
40
|
-
|
|
41
|
-
const fooTest = extendedClient.foo?.test('foo');
|
|
42
|
-
expect(fooTest.myString).toBe('foo');
|
|
43
|
-
expect(fooTest.client).toBeInstanceOf(ApiRequester);
|
|
44
|
-
expect(fooTest.baseUrl).toBe('foo/0.1');
|
|
45
|
-
});
|
|
46
|
-
});
|