@wazo/sdk 0.37.19 → 0.37.23
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/wazo-sdk.js +5 -5
- package/esm/__tests__/api-client.test.js +70 -5
- package/esm/__tests__/web-rtc-client.test.js +111 -67
- package/esm/api/agentd.js +25 -2
- package/esm/api/amid.js +25 -2
- package/esm/api/application.js +25 -2
- package/esm/api/auth.js +25 -2
- package/esm/api/call-logd.js +32 -2
- package/esm/api/calld.js +35 -2
- package/esm/api/chatd.js +32 -2
- package/esm/api/confd.js +47 -5
- package/esm/api/ctid-ng.js +35 -2
- package/esm/api/dird.js +28 -2
- package/esm/api/webhookd.js +25 -2
- package/esm/api-client.js +70 -5
- package/esm/checker/Checker.js +113 -67
- package/esm/checker/checks/aor.js +70 -5
- package/esm/checker/checks/api.js +70 -5
- package/esm/checker/checks/index.js +113 -67
- package/esm/checker/checks/wazo-websocket.js +27 -2
- package/esm/checker/checks/webrtc-transport.js +111 -67
- package/esm/checker/checks/webrtc.js +111 -67
- package/esm/domain/AdHocAPIConference.js +70 -5
- package/esm/domain/Call.js +3 -0
- package/esm/domain/CallLog.js +7 -0
- package/esm/domain/ChatMessage.js +4 -0
- package/esm/domain/ChatRoom.js +3 -0
- package/esm/domain/Contact.js +3 -0
- package/esm/domain/Features.js +70 -5
- package/esm/domain/Meeting.js +17 -1
- package/esm/domain/Phone/CTIPhone.js +74 -5
- package/esm/domain/Phone/WebRTCPhone.js +50 -16
- package/esm/domain/Recording.js +3 -0
- package/esm/domain/Voicemail.js +3 -0
- package/esm/domain/__tests__/Call.test.js +3 -0
- package/esm/domain/__tests__/CallLog.test.js +7 -0
- package/esm/domain/__tests__/Contact.test.js +3 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +147 -80
- package/esm/lib/WazoSessionDescriptionHandler.js +25 -40
- package/esm/service/CallApi.js +70 -5
- package/esm/service/IssueReporter.js +25 -2
- package/esm/service/__tests__/IssueReporter.test.js +25 -2
- package/esm/service/getApiClient.js +70 -5
- package/esm/simple/Auth.js +147 -80
- package/esm/simple/Configuration.js +147 -80
- package/esm/simple/Directory.js +70 -5
- package/esm/simple/Phone.js +147 -80
- package/esm/simple/Websocket.js +28 -2
- package/esm/simple/index.js +147 -80
- package/esm/simple/room/LocalParticipant.js +147 -80
- package/esm/simple/room/Participant.js +147 -80
- package/esm/simple/room/RemoteParticipant.js +147 -80
- package/esm/simple/room/Room.js +147 -80
- package/esm/simple/room/SipRoom.js +147 -80
- package/esm/simple/room/Stream.js +147 -80
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +147 -80
- package/esm/simple/utils.js +147 -80
- package/esm/utils/__tests__/api-requester.test.js +25 -2
- package/esm/utils/api-requester.js +25 -2
- package/esm/web-rtc-client.js +111 -67
- package/esm/websocket-client.js +28 -3
- package/lib/__tests__/api-client.test.js +70 -5
- package/lib/__tests__/web-rtc-client.test.js +111 -67
- package/lib/api/agentd.js +25 -2
- package/lib/api/amid.js +25 -2
- package/lib/api/application.js +25 -2
- package/lib/api/auth.js +25 -2
- package/lib/api/call-logd.js +32 -2
- package/lib/api/calld.js +35 -2
- package/lib/api/chatd.js +32 -2
- package/lib/api/confd.js +47 -5
- package/lib/api/ctid-ng.js +35 -2
- package/lib/api/dird.js +28 -2
- package/lib/api/webhookd.js +25 -2
- package/lib/api-client.js +70 -5
- package/lib/checker/Checker.js +113 -67
- package/lib/checker/checks/aor.js +70 -5
- package/lib/checker/checks/api.js +70 -5
- package/lib/checker/checks/index.js +113 -67
- package/lib/checker/checks/wazo-websocket.js +27 -2
- package/lib/checker/checks/webrtc-transport.js +111 -67
- package/lib/checker/checks/webrtc.js +111 -67
- package/lib/domain/AdHocAPIConference.js +70 -5
- package/lib/domain/Call.js +3 -0
- package/lib/domain/CallLog.js +7 -0
- package/lib/domain/ChatMessage.js +4 -0
- package/lib/domain/ChatRoom.js +3 -0
- package/lib/domain/Contact.js +3 -0
- package/lib/domain/Features.js +70 -5
- package/lib/domain/Meeting.js +17 -1
- package/lib/domain/Phone/CTIPhone.js +74 -5
- package/lib/domain/Phone/WebRTCPhone.js +50 -16
- package/lib/domain/Recording.js +3 -0
- package/lib/domain/Voicemail.js +3 -0
- package/lib/domain/__tests__/Call.test.js +3 -0
- package/lib/domain/__tests__/CallLog.test.js +7 -0
- package/lib/domain/__tests__/Contact.test.js +3 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +147 -80
- package/lib/lib/WazoSessionDescriptionHandler.js +25 -40
- package/lib/service/CallApi.js +70 -5
- package/lib/service/IssueReporter.js +25 -2
- package/lib/service/__tests__/IssueReporter.test.js +25 -2
- package/lib/service/getApiClient.js +70 -5
- package/lib/simple/Auth.js +147 -80
- package/lib/simple/Configuration.js +147 -80
- package/lib/simple/Directory.js +70 -5
- package/lib/simple/Phone.js +147 -80
- package/lib/simple/Websocket.js +28 -2
- package/lib/simple/index.js +147 -80
- package/lib/simple/room/LocalParticipant.js +147 -80
- package/lib/simple/room/Participant.js +147 -80
- package/lib/simple/room/RemoteParticipant.js +147 -80
- package/lib/simple/room/Room.js +147 -80
- package/lib/simple/room/SipRoom.js +147 -80
- package/lib/simple/room/Stream.js +147 -80
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +147 -80
- package/lib/simple/utils.js +147 -80
- package/lib/utils/__tests__/api-requester.test.js +25 -2
- package/lib/utils/api-requester.js +25 -2
- package/lib/web-rtc-client.js +111 -67
- package/lib/websocket-client.js +28 -2
- package/package.json +2 -2
- package/src/api/confd.js +5 -2
- package/src/domain/Call.js +3 -0
- package/src/domain/CallLog.js +4 -0
- package/src/domain/ChatMessage.js +4 -0
- package/src/domain/ChatRoom.js +3 -0
- package/src/domain/Contact.js +3 -0
- package/src/domain/Meeting.js +17 -1
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +25 -14
- package/src/domain/Recording.js +3 -0
- package/src/domain/Voicemail.js +3 -0
- package/src/lib/WazoSessionDescriptionHandler.js +1 -35
- package/src/service/IssueReporter.js +25 -2
- package/src/simple/Phone.js +5 -0
- package/src/types/WebSocketMessage.js +5 -1
- package/src/web-rtc-client.js +41 -24
- package/src/websocket-client.js +2 -0
package/esm/api/amid.js
CHANGED
|
@@ -65,6 +65,7 @@ class IssueReporter {
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
|
|
68
69
|
|
|
69
70
|
constructor() {
|
|
70
71
|
addLevelsTo(this);
|
|
@@ -76,12 +77,17 @@ class IssueReporter {
|
|
|
76
77
|
this.bufferTimeout = null;
|
|
77
78
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
78
79
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
80
|
+
this._callback = null;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
init() {
|
|
82
84
|
this._catchConsole();
|
|
83
85
|
}
|
|
84
86
|
|
|
87
|
+
setCallback(cb ) {
|
|
88
|
+
this._callback = cb;
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
86
92
|
this.remoteClientConfiguration = configuration;
|
|
87
93
|
}
|
|
@@ -117,6 +123,7 @@ class IssueReporter {
|
|
|
117
123
|
|
|
118
124
|
// Handle category label
|
|
119
125
|
let category = null;
|
|
126
|
+
let skipSendToRemote = false;
|
|
120
127
|
let extra = {};
|
|
121
128
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
122
129
|
category = args[0].split('=')[1];
|
|
@@ -132,6 +139,7 @@ class IssueReporter {
|
|
|
132
139
|
errorMessage: lastArg.message,
|
|
133
140
|
errorStack: lastArg.stack,
|
|
134
141
|
errorType: lastArg.constructor.name,
|
|
142
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
135
143
|
};
|
|
136
144
|
} else {
|
|
137
145
|
extra = lastArg;
|
|
@@ -140,6 +148,11 @@ class IssueReporter {
|
|
|
140
148
|
args.splice(1, 1);
|
|
141
149
|
}
|
|
142
150
|
|
|
151
|
+
if (extra.skipSendToRemote) {
|
|
152
|
+
skipSendToRemote = true;
|
|
153
|
+
delete extra.skipSendToRemote;
|
|
154
|
+
}
|
|
155
|
+
|
|
143
156
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
144
157
|
const message = args.join(', ');
|
|
145
158
|
let consoleMessage = message;
|
|
@@ -160,7 +173,13 @@ class IssueReporter {
|
|
|
160
173
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
161
174
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
162
175
|
|
|
163
|
-
this.
|
|
176
|
+
if (this._callback) {
|
|
177
|
+
this._callback(level, consoleMessage);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (!skipSendToRemote) {
|
|
181
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
182
|
+
}
|
|
164
183
|
}
|
|
165
184
|
|
|
166
185
|
logRequest(url , options , response , start ) {
|
|
@@ -305,7 +324,11 @@ class IssueReporter {
|
|
|
305
324
|
},
|
|
306
325
|
// $FlowFixMe
|
|
307
326
|
body,
|
|
308
|
-
}).catch(() => {
|
|
327
|
+
}).catch((e ) => {
|
|
328
|
+
// $FlowFixMe
|
|
329
|
+
e.skipSendToRemote = true;
|
|
330
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
331
|
+
|
|
309
332
|
setTimeout(() => {
|
|
310
333
|
if (isArray) {
|
|
311
334
|
payload = payload.map(message => {
|
package/esm/api/application.js
CHANGED
|
@@ -126,6 +126,7 @@ class IssueReporter {
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
|
|
129
130
|
|
|
130
131
|
constructor() {
|
|
131
132
|
addLevelsTo(this);
|
|
@@ -137,12 +138,17 @@ class IssueReporter {
|
|
|
137
138
|
this.bufferTimeout = null;
|
|
138
139
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
139
140
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
141
|
+
this._callback = null;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
init() {
|
|
143
145
|
this._catchConsole();
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
setCallback(cb ) {
|
|
149
|
+
this._callback = cb;
|
|
150
|
+
}
|
|
151
|
+
|
|
146
152
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
147
153
|
this.remoteClientConfiguration = configuration;
|
|
148
154
|
}
|
|
@@ -178,6 +184,7 @@ class IssueReporter {
|
|
|
178
184
|
|
|
179
185
|
// Handle category label
|
|
180
186
|
let category = null;
|
|
187
|
+
let skipSendToRemote = false;
|
|
181
188
|
let extra = {};
|
|
182
189
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
183
190
|
category = args[0].split('=')[1];
|
|
@@ -193,6 +200,7 @@ class IssueReporter {
|
|
|
193
200
|
errorMessage: lastArg.message,
|
|
194
201
|
errorStack: lastArg.stack,
|
|
195
202
|
errorType: lastArg.constructor.name,
|
|
203
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
196
204
|
};
|
|
197
205
|
} else {
|
|
198
206
|
extra = lastArg;
|
|
@@ -201,6 +209,11 @@ class IssueReporter {
|
|
|
201
209
|
args.splice(1, 1);
|
|
202
210
|
}
|
|
203
211
|
|
|
212
|
+
if (extra.skipSendToRemote) {
|
|
213
|
+
skipSendToRemote = true;
|
|
214
|
+
delete extra.skipSendToRemote;
|
|
215
|
+
}
|
|
216
|
+
|
|
204
217
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
205
218
|
const message = args.join(', ');
|
|
206
219
|
let consoleMessage = message;
|
|
@@ -221,7 +234,13 @@ class IssueReporter {
|
|
|
221
234
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
222
235
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
223
236
|
|
|
224
|
-
this.
|
|
237
|
+
if (this._callback) {
|
|
238
|
+
this._callback(level, consoleMessage);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!skipSendToRemote) {
|
|
242
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
243
|
+
}
|
|
225
244
|
}
|
|
226
245
|
|
|
227
246
|
logRequest(url , options , response , start ) {
|
|
@@ -366,7 +385,11 @@ class IssueReporter {
|
|
|
366
385
|
},
|
|
367
386
|
// $FlowFixMe
|
|
368
387
|
body,
|
|
369
|
-
}).catch(() => {
|
|
388
|
+
}).catch((e ) => {
|
|
389
|
+
// $FlowFixMe
|
|
390
|
+
e.skipSendToRemote = true;
|
|
391
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
392
|
+
|
|
370
393
|
setTimeout(() => {
|
|
371
394
|
if (isArray) {
|
|
372
395
|
payload = payload.map(message => {
|
package/esm/api/auth.js
CHANGED
|
@@ -127,6 +127,7 @@ class IssueReporter {
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
130
|
+
|
|
130
131
|
|
|
131
132
|
constructor() {
|
|
132
133
|
addLevelsTo(this);
|
|
@@ -138,12 +139,17 @@ class IssueReporter {
|
|
|
138
139
|
this.bufferTimeout = null;
|
|
139
140
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
140
141
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
142
|
+
this._callback = null;
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
init() {
|
|
144
146
|
this._catchConsole();
|
|
145
147
|
}
|
|
146
148
|
|
|
149
|
+
setCallback(cb ) {
|
|
150
|
+
this._callback = cb;
|
|
151
|
+
}
|
|
152
|
+
|
|
147
153
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
148
154
|
this.remoteClientConfiguration = configuration;
|
|
149
155
|
}
|
|
@@ -179,6 +185,7 @@ class IssueReporter {
|
|
|
179
185
|
|
|
180
186
|
// Handle category label
|
|
181
187
|
let category = null;
|
|
188
|
+
let skipSendToRemote = false;
|
|
182
189
|
let extra = {};
|
|
183
190
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
184
191
|
category = args[0].split('=')[1];
|
|
@@ -194,6 +201,7 @@ class IssueReporter {
|
|
|
194
201
|
errorMessage: lastArg.message,
|
|
195
202
|
errorStack: lastArg.stack,
|
|
196
203
|
errorType: lastArg.constructor.name,
|
|
204
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
197
205
|
};
|
|
198
206
|
} else {
|
|
199
207
|
extra = lastArg;
|
|
@@ -202,6 +210,11 @@ class IssueReporter {
|
|
|
202
210
|
args.splice(1, 1);
|
|
203
211
|
}
|
|
204
212
|
|
|
213
|
+
if (extra.skipSendToRemote) {
|
|
214
|
+
skipSendToRemote = true;
|
|
215
|
+
delete extra.skipSendToRemote;
|
|
216
|
+
}
|
|
217
|
+
|
|
205
218
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
206
219
|
const message = args.join(', ');
|
|
207
220
|
let consoleMessage = message;
|
|
@@ -222,7 +235,13 @@ class IssueReporter {
|
|
|
222
235
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
223
236
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
224
237
|
|
|
225
|
-
this.
|
|
238
|
+
if (this._callback) {
|
|
239
|
+
this._callback(level, consoleMessage);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (!skipSendToRemote) {
|
|
243
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
244
|
+
}
|
|
226
245
|
}
|
|
227
246
|
|
|
228
247
|
logRequest(url , options , response , start ) {
|
|
@@ -367,7 +386,11 @@ class IssueReporter {
|
|
|
367
386
|
},
|
|
368
387
|
// $FlowFixMe
|
|
369
388
|
body,
|
|
370
|
-
}).catch(() => {
|
|
389
|
+
}).catch((e ) => {
|
|
390
|
+
// $FlowFixMe
|
|
391
|
+
e.skipSendToRemote = true;
|
|
392
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
393
|
+
|
|
371
394
|
setTimeout(() => {
|
|
372
395
|
if (isArray) {
|
|
373
396
|
payload = payload.map(message => {
|
package/esm/api/call-logd.js
CHANGED
|
@@ -66,6 +66,7 @@ class IssueReporter {
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
|
|
69
70
|
|
|
70
71
|
constructor() {
|
|
71
72
|
addLevelsTo(this);
|
|
@@ -77,12 +78,17 @@ class IssueReporter {
|
|
|
77
78
|
this.bufferTimeout = null;
|
|
78
79
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
79
80
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
81
|
+
this._callback = null;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
init() {
|
|
83
85
|
this._catchConsole();
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
setCallback(cb ) {
|
|
89
|
+
this._callback = cb;
|
|
90
|
+
}
|
|
91
|
+
|
|
86
92
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
87
93
|
this.remoteClientConfiguration = configuration;
|
|
88
94
|
}
|
|
@@ -118,6 +124,7 @@ class IssueReporter {
|
|
|
118
124
|
|
|
119
125
|
// Handle category label
|
|
120
126
|
let category = null;
|
|
127
|
+
let skipSendToRemote = false;
|
|
121
128
|
let extra = {};
|
|
122
129
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
123
130
|
category = args[0].split('=')[1];
|
|
@@ -133,6 +140,7 @@ class IssueReporter {
|
|
|
133
140
|
errorMessage: lastArg.message,
|
|
134
141
|
errorStack: lastArg.stack,
|
|
135
142
|
errorType: lastArg.constructor.name,
|
|
143
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
136
144
|
};
|
|
137
145
|
} else {
|
|
138
146
|
extra = lastArg;
|
|
@@ -141,6 +149,11 @@ class IssueReporter {
|
|
|
141
149
|
args.splice(1, 1);
|
|
142
150
|
}
|
|
143
151
|
|
|
152
|
+
if (extra.skipSendToRemote) {
|
|
153
|
+
skipSendToRemote = true;
|
|
154
|
+
delete extra.skipSendToRemote;
|
|
155
|
+
}
|
|
156
|
+
|
|
144
157
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
145
158
|
const message = args.join(', ');
|
|
146
159
|
let consoleMessage = message;
|
|
@@ -161,7 +174,13 @@ class IssueReporter {
|
|
|
161
174
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
162
175
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
163
176
|
|
|
164
|
-
this.
|
|
177
|
+
if (this._callback) {
|
|
178
|
+
this._callback(level, consoleMessage);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (!skipSendToRemote) {
|
|
182
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
183
|
+
}
|
|
165
184
|
}
|
|
166
185
|
|
|
167
186
|
logRequest(url , options , response , start ) {
|
|
@@ -306,7 +325,11 @@ class IssueReporter {
|
|
|
306
325
|
},
|
|
307
326
|
// $FlowFixMe
|
|
308
327
|
body,
|
|
309
|
-
}).catch(() => {
|
|
328
|
+
}).catch((e ) => {
|
|
329
|
+
// $FlowFixMe
|
|
330
|
+
e.skipSendToRemote = true;
|
|
331
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
332
|
+
|
|
310
333
|
setTimeout(() => {
|
|
311
334
|
if (isArray) {
|
|
312
335
|
payload = payload.map(message => {
|
|
@@ -421,6 +444,9 @@ class Recording {
|
|
|
421
444
|
|
|
422
445
|
|
|
423
446
|
static parseMany(recordings = []) {
|
|
447
|
+
if (!recordings) {
|
|
448
|
+
return [];
|
|
449
|
+
}
|
|
424
450
|
return recordings.map(item => Recording.parse(item));
|
|
425
451
|
}
|
|
426
452
|
|
|
@@ -522,6 +548,10 @@ class CallLog {
|
|
|
522
548
|
}
|
|
523
549
|
|
|
524
550
|
static parseMany(plain ) {
|
|
551
|
+
if (!plain || !plain.items) {
|
|
552
|
+
return [];
|
|
553
|
+
}
|
|
554
|
+
|
|
525
555
|
return plain.items.map(item => CallLog.parse(item));
|
|
526
556
|
}
|
|
527
557
|
|
package/esm/api/calld.js
CHANGED
|
@@ -127,6 +127,7 @@ class IssueReporter {
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
130
|
+
|
|
130
131
|
|
|
131
132
|
constructor() {
|
|
132
133
|
addLevelsTo(this);
|
|
@@ -138,12 +139,17 @@ class IssueReporter {
|
|
|
138
139
|
this.bufferTimeout = null;
|
|
139
140
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
140
141
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
142
|
+
this._callback = null;
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
init() {
|
|
144
146
|
this._catchConsole();
|
|
145
147
|
}
|
|
146
148
|
|
|
149
|
+
setCallback(cb ) {
|
|
150
|
+
this._callback = cb;
|
|
151
|
+
}
|
|
152
|
+
|
|
147
153
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
148
154
|
this.remoteClientConfiguration = configuration;
|
|
149
155
|
}
|
|
@@ -179,6 +185,7 @@ class IssueReporter {
|
|
|
179
185
|
|
|
180
186
|
// Handle category label
|
|
181
187
|
let category = null;
|
|
188
|
+
let skipSendToRemote = false;
|
|
182
189
|
let extra = {};
|
|
183
190
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
184
191
|
category = args[0].split('=')[1];
|
|
@@ -194,6 +201,7 @@ class IssueReporter {
|
|
|
194
201
|
errorMessage: lastArg.message,
|
|
195
202
|
errorStack: lastArg.stack,
|
|
196
203
|
errorType: lastArg.constructor.name,
|
|
204
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
197
205
|
};
|
|
198
206
|
} else {
|
|
199
207
|
extra = lastArg;
|
|
@@ -202,6 +210,11 @@ class IssueReporter {
|
|
|
202
210
|
args.splice(1, 1);
|
|
203
211
|
}
|
|
204
212
|
|
|
213
|
+
if (extra.skipSendToRemote) {
|
|
214
|
+
skipSendToRemote = true;
|
|
215
|
+
delete extra.skipSendToRemote;
|
|
216
|
+
}
|
|
217
|
+
|
|
205
218
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
206
219
|
const message = args.join(', ');
|
|
207
220
|
let consoleMessage = message;
|
|
@@ -222,7 +235,13 @@ class IssueReporter {
|
|
|
222
235
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
223
236
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
224
237
|
|
|
225
|
-
this.
|
|
238
|
+
if (this._callback) {
|
|
239
|
+
this._callback(level, consoleMessage);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (!skipSendToRemote) {
|
|
243
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
244
|
+
}
|
|
226
245
|
}
|
|
227
246
|
|
|
228
247
|
logRequest(url , options , response , start ) {
|
|
@@ -367,7 +386,11 @@ class IssueReporter {
|
|
|
367
386
|
},
|
|
368
387
|
// $FlowFixMe
|
|
369
388
|
body,
|
|
370
|
-
}).catch(() => {
|
|
389
|
+
}).catch((e ) => {
|
|
390
|
+
// $FlowFixMe
|
|
391
|
+
e.skipSendToRemote = true;
|
|
392
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
393
|
+
|
|
371
394
|
setTimeout(() => {
|
|
372
395
|
if (isArray) {
|
|
373
396
|
payload = payload.map(message => {
|
|
@@ -761,6 +784,10 @@ class ChatMessage {
|
|
|
761
784
|
|
|
762
785
|
|
|
763
786
|
static parseMany(plain ) {
|
|
787
|
+
if (!plain || !plain.items) {
|
|
788
|
+
return [];
|
|
789
|
+
}
|
|
790
|
+
|
|
764
791
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
765
792
|
}
|
|
766
793
|
|
|
@@ -870,6 +897,9 @@ class Voicemail {
|
|
|
870
897
|
}
|
|
871
898
|
|
|
872
899
|
static parseMany(plain ) {
|
|
900
|
+
if (!plain) {
|
|
901
|
+
return [];
|
|
902
|
+
}
|
|
873
903
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
874
904
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
875
905
|
|
|
@@ -979,6 +1009,9 @@ class Call {
|
|
|
979
1009
|
|
|
980
1010
|
|
|
981
1011
|
static parseMany(plain ) {
|
|
1012
|
+
if (!plain) {
|
|
1013
|
+
return [];
|
|
1014
|
+
}
|
|
982
1015
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
983
1016
|
}
|
|
984
1017
|
|
package/esm/api/chatd.js
CHANGED
|
@@ -126,6 +126,7 @@ class IssueReporter {
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
|
|
129
130
|
|
|
130
131
|
constructor() {
|
|
131
132
|
addLevelsTo(this);
|
|
@@ -137,12 +138,17 @@ class IssueReporter {
|
|
|
137
138
|
this.bufferTimeout = null;
|
|
138
139
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
139
140
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
141
|
+
this._callback = null;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
init() {
|
|
143
145
|
this._catchConsole();
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
setCallback(cb ) {
|
|
149
|
+
this._callback = cb;
|
|
150
|
+
}
|
|
151
|
+
|
|
146
152
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
147
153
|
this.remoteClientConfiguration = configuration;
|
|
148
154
|
}
|
|
@@ -178,6 +184,7 @@ class IssueReporter {
|
|
|
178
184
|
|
|
179
185
|
// Handle category label
|
|
180
186
|
let category = null;
|
|
187
|
+
let skipSendToRemote = false;
|
|
181
188
|
let extra = {};
|
|
182
189
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
183
190
|
category = args[0].split('=')[1];
|
|
@@ -193,6 +200,7 @@ class IssueReporter {
|
|
|
193
200
|
errorMessage: lastArg.message,
|
|
194
201
|
errorStack: lastArg.stack,
|
|
195
202
|
errorType: lastArg.constructor.name,
|
|
203
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
196
204
|
};
|
|
197
205
|
} else {
|
|
198
206
|
extra = lastArg;
|
|
@@ -201,6 +209,11 @@ class IssueReporter {
|
|
|
201
209
|
args.splice(1, 1);
|
|
202
210
|
}
|
|
203
211
|
|
|
212
|
+
if (extra.skipSendToRemote) {
|
|
213
|
+
skipSendToRemote = true;
|
|
214
|
+
delete extra.skipSendToRemote;
|
|
215
|
+
}
|
|
216
|
+
|
|
204
217
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
205
218
|
const message = args.join(', ');
|
|
206
219
|
let consoleMessage = message;
|
|
@@ -221,7 +234,13 @@ class IssueReporter {
|
|
|
221
234
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
222
235
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
223
236
|
|
|
224
|
-
this.
|
|
237
|
+
if (this._callback) {
|
|
238
|
+
this._callback(level, consoleMessage);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!skipSendToRemote) {
|
|
242
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
243
|
+
}
|
|
225
244
|
}
|
|
226
245
|
|
|
227
246
|
logRequest(url , options , response , start ) {
|
|
@@ -366,7 +385,11 @@ class IssueReporter {
|
|
|
366
385
|
},
|
|
367
386
|
// $FlowFixMe
|
|
368
387
|
body,
|
|
369
|
-
}).catch(() => {
|
|
388
|
+
}).catch((e ) => {
|
|
389
|
+
// $FlowFixMe
|
|
390
|
+
e.skipSendToRemote = true;
|
|
391
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
392
|
+
|
|
370
393
|
setTimeout(() => {
|
|
371
394
|
if (isArray) {
|
|
372
395
|
payload = payload.map(message => {
|
|
@@ -1080,6 +1103,9 @@ class ChatRoom {
|
|
|
1080
1103
|
|
|
1081
1104
|
|
|
1082
1105
|
static parseMany(plain ) {
|
|
1106
|
+
if (!plain || !plain.items) {
|
|
1107
|
+
return [];
|
|
1108
|
+
}
|
|
1083
1109
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
1084
1110
|
}
|
|
1085
1111
|
|
|
@@ -1146,6 +1172,10 @@ class ChatMessage {
|
|
|
1146
1172
|
|
|
1147
1173
|
|
|
1148
1174
|
static parseMany(plain ) {
|
|
1175
|
+
if (!plain || !plain.items) {
|
|
1176
|
+
return [];
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1149
1179
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
1150
1180
|
}
|
|
1151
1181
|
|
package/esm/api/confd.js
CHANGED
|
@@ -126,6 +126,7 @@ class IssueReporter {
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
|
|
129
130
|
|
|
130
131
|
constructor() {
|
|
131
132
|
addLevelsTo(this);
|
|
@@ -137,12 +138,17 @@ class IssueReporter {
|
|
|
137
138
|
this.bufferTimeout = null;
|
|
138
139
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
139
140
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
141
|
+
this._callback = null;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
init() {
|
|
143
145
|
this._catchConsole();
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
setCallback(cb ) {
|
|
149
|
+
this._callback = cb;
|
|
150
|
+
}
|
|
151
|
+
|
|
146
152
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
147
153
|
this.remoteClientConfiguration = configuration;
|
|
148
154
|
}
|
|
@@ -178,6 +184,7 @@ class IssueReporter {
|
|
|
178
184
|
|
|
179
185
|
// Handle category label
|
|
180
186
|
let category = null;
|
|
187
|
+
let skipSendToRemote = false;
|
|
181
188
|
let extra = {};
|
|
182
189
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
183
190
|
category = args[0].split('=')[1];
|
|
@@ -193,6 +200,7 @@ class IssueReporter {
|
|
|
193
200
|
errorMessage: lastArg.message,
|
|
194
201
|
errorStack: lastArg.stack,
|
|
195
202
|
errorType: lastArg.constructor.name,
|
|
203
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
196
204
|
};
|
|
197
205
|
} else {
|
|
198
206
|
extra = lastArg;
|
|
@@ -201,6 +209,11 @@ class IssueReporter {
|
|
|
201
209
|
args.splice(1, 1);
|
|
202
210
|
}
|
|
203
211
|
|
|
212
|
+
if (extra.skipSendToRemote) {
|
|
213
|
+
skipSendToRemote = true;
|
|
214
|
+
delete extra.skipSendToRemote;
|
|
215
|
+
}
|
|
216
|
+
|
|
204
217
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
205
218
|
const message = args.join(', ');
|
|
206
219
|
let consoleMessage = message;
|
|
@@ -221,7 +234,13 @@ class IssueReporter {
|
|
|
221
234
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
222
235
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
223
236
|
|
|
224
|
-
this.
|
|
237
|
+
if (this._callback) {
|
|
238
|
+
this._callback(level, consoleMessage);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!skipSendToRemote) {
|
|
242
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
243
|
+
}
|
|
225
244
|
}
|
|
226
245
|
|
|
227
246
|
logRequest(url , options , response , start ) {
|
|
@@ -366,7 +385,11 @@ class IssueReporter {
|
|
|
366
385
|
},
|
|
367
386
|
// $FlowFixMe
|
|
368
387
|
body,
|
|
369
|
-
}).catch(() => {
|
|
388
|
+
}).catch((e ) => {
|
|
389
|
+
// $FlowFixMe
|
|
390
|
+
e.skipSendToRemote = true;
|
|
391
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
392
|
+
|
|
370
393
|
setTimeout(() => {
|
|
371
394
|
if (isArray) {
|
|
372
395
|
payload = payload.map(message => {
|
|
@@ -1288,11 +1311,27 @@ class Meeting {
|
|
|
1288
1311
|
});
|
|
1289
1312
|
}
|
|
1290
1313
|
|
|
1314
|
+
static parseMany(items ) {
|
|
1315
|
+
if (!items) {
|
|
1316
|
+
return [];
|
|
1317
|
+
}
|
|
1318
|
+
return items.map(plain => Meeting.parse(plain));
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1291
1321
|
static newFrom(meeting ) {
|
|
1292
1322
|
return newFrom(meeting, Meeting);
|
|
1293
1323
|
}
|
|
1294
1324
|
|
|
1295
|
-
constructor({
|
|
1325
|
+
constructor({
|
|
1326
|
+
uuid,
|
|
1327
|
+
name,
|
|
1328
|
+
guestSipAuthorization,
|
|
1329
|
+
ownerUuids,
|
|
1330
|
+
port,
|
|
1331
|
+
uri,
|
|
1332
|
+
number,
|
|
1333
|
+
persistent,
|
|
1334
|
+
} = {}) {
|
|
1296
1335
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
1297
1336
|
this.uri = uri;
|
|
1298
1337
|
this.name = name;
|
|
@@ -1378,8 +1417,11 @@ var confd = (client , baseUrl ) => ({
|
|
|
1378
1417
|
}
|
|
1379
1418
|
},
|
|
1380
1419
|
|
|
1381
|
-
|
|
1382
|
-
client.
|
|
1420
|
+
getMyMeetings: () =>
|
|
1421
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
1422
|
+
|
|
1423
|
+
createMyMeeting: (name , persistent ) =>
|
|
1424
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
1383
1425
|
|
|
1384
1426
|
deleteMyMeeting: (meetingUuid ) =>
|
|
1385
1427
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|