@wazo/sdk 0.37.20 → 0.37.21
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 +44 -5
- package/esm/__tests__/web-rtc-client.test.js +70 -15
- 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 +25 -2
- package/esm/api/calld.js +25 -2
- package/esm/api/chatd.js +25 -2
- package/esm/api/confd.js +44 -5
- package/esm/api/ctid-ng.js +25 -2
- package/esm/api/dird.js +25 -2
- package/esm/api/webhookd.js +25 -2
- package/esm/api-client.js +44 -5
- package/esm/checker/Checker.js +72 -15
- package/esm/checker/checks/aor.js +44 -5
- package/esm/checker/checks/api.js +44 -5
- package/esm/checker/checks/index.js +72 -15
- package/esm/checker/checks/wazo-websocket.js +27 -2
- package/esm/checker/checks/webrtc-transport.js +70 -15
- package/esm/checker/checks/webrtc.js +70 -15
- package/esm/domain/AdHocAPIConference.js +44 -5
- package/esm/domain/Features.js +44 -5
- package/esm/domain/Meeting.js +14 -1
- package/esm/domain/Phone/CTIPhone.js +44 -5
- package/esm/domain/Phone/WebRTCPhone.js +32 -3
- package/esm/index.js +85 -16
- package/esm/lib/WazoSessionDescriptionHandler.js +25 -2
- package/esm/service/CallApi.js +44 -5
- package/esm/service/IssueReporter.js +25 -2
- package/esm/service/__tests__/IssueReporter.test.js +25 -2
- package/esm/service/getApiClient.js +44 -5
- package/esm/simple/Auth.js +85 -16
- package/esm/simple/Configuration.js +85 -16
- package/esm/simple/Directory.js +44 -5
- package/esm/simple/Phone.js +85 -16
- package/esm/simple/Websocket.js +28 -2
- package/esm/simple/index.js +85 -16
- package/esm/simple/room/LocalParticipant.js +85 -16
- package/esm/simple/room/Participant.js +85 -16
- package/esm/simple/room/RemoteParticipant.js +85 -16
- package/esm/simple/room/Room.js +85 -16
- package/esm/simple/room/SipRoom.js +85 -16
- package/esm/simple/room/Stream.js +85 -16
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +85 -16
- package/esm/simple/utils.js +85 -16
- package/esm/utils/__tests__/api-requester.test.js +25 -2
- package/esm/utils/api-requester.js +25 -2
- package/esm/web-rtc-client.js +70 -15
- package/esm/websocket-client.js +28 -3
- package/lib/__tests__/api-client.test.js +44 -5
- package/lib/__tests__/web-rtc-client.test.js +70 -15
- 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 +25 -2
- package/lib/api/calld.js +25 -2
- package/lib/api/chatd.js +25 -2
- package/lib/api/confd.js +44 -5
- package/lib/api/ctid-ng.js +25 -2
- package/lib/api/dird.js +25 -2
- package/lib/api/webhookd.js +25 -2
- package/lib/api-client.js +44 -5
- package/lib/checker/Checker.js +72 -15
- package/lib/checker/checks/aor.js +44 -5
- package/lib/checker/checks/api.js +44 -5
- package/lib/checker/checks/index.js +72 -15
- package/lib/checker/checks/wazo-websocket.js +27 -2
- package/lib/checker/checks/webrtc-transport.js +70 -15
- package/lib/checker/checks/webrtc.js +70 -15
- package/lib/domain/AdHocAPIConference.js +44 -5
- package/lib/domain/Features.js +44 -5
- package/lib/domain/Meeting.js +14 -1
- package/lib/domain/Phone/CTIPhone.js +44 -5
- package/lib/domain/Phone/WebRTCPhone.js +32 -3
- package/lib/index.js +85 -16
- package/lib/lib/WazoSessionDescriptionHandler.js +25 -2
- package/lib/service/CallApi.js +44 -5
- package/lib/service/IssueReporter.js +25 -2
- package/lib/service/__tests__/IssueReporter.test.js +25 -2
- package/lib/service/getApiClient.js +44 -5
- package/lib/simple/Auth.js +85 -16
- package/lib/simple/Configuration.js +85 -16
- package/lib/simple/Directory.js +44 -5
- package/lib/simple/Phone.js +85 -16
- package/lib/simple/Websocket.js +28 -2
- package/lib/simple/index.js +85 -16
- package/lib/simple/room/LocalParticipant.js +85 -16
- package/lib/simple/room/Participant.js +85 -16
- package/lib/simple/room/RemoteParticipant.js +85 -16
- package/lib/simple/room/Room.js +85 -16
- package/lib/simple/room/SipRoom.js +85 -16
- package/lib/simple/room/Stream.js +85 -16
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +85 -16
- package/lib/simple/utils.js +85 -16
- package/lib/utils/__tests__/api-requester.test.js +25 -2
- package/lib/utils/api-requester.js +25 -2
- package/lib/web-rtc-client.js +70 -15
- package/lib/websocket-client.js +28 -2
- package/package.json +1 -1
- package/src/api/confd.js +5 -2
- package/src/domain/Meeting.js +14 -1
- package/src/domain/Phone/WebRTCPhone.js +7 -1
- 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 +26 -10
- package/src/websocket-client.js +2 -0
package/lib/api/calld.js
CHANGED
|
@@ -133,6 +133,7 @@ class IssueReporter {
|
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
|
|
136
|
+
|
|
136
137
|
|
|
137
138
|
constructor() {
|
|
138
139
|
addLevelsTo(this);
|
|
@@ -144,12 +145,17 @@ class IssueReporter {
|
|
|
144
145
|
this.bufferTimeout = null;
|
|
145
146
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
146
147
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
148
|
+
this._callback = null;
|
|
147
149
|
}
|
|
148
150
|
|
|
149
151
|
init() {
|
|
150
152
|
this._catchConsole();
|
|
151
153
|
}
|
|
152
154
|
|
|
155
|
+
setCallback(cb ) {
|
|
156
|
+
this._callback = cb;
|
|
157
|
+
}
|
|
158
|
+
|
|
153
159
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
154
160
|
this.remoteClientConfiguration = configuration;
|
|
155
161
|
}
|
|
@@ -185,6 +191,7 @@ class IssueReporter {
|
|
|
185
191
|
|
|
186
192
|
// Handle category label
|
|
187
193
|
let category = null;
|
|
194
|
+
let skipSendToRemote = false;
|
|
188
195
|
let extra = {};
|
|
189
196
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
190
197
|
category = args[0].split('=')[1];
|
|
@@ -200,6 +207,7 @@ class IssueReporter {
|
|
|
200
207
|
errorMessage: lastArg.message,
|
|
201
208
|
errorStack: lastArg.stack,
|
|
202
209
|
errorType: lastArg.constructor.name,
|
|
210
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
203
211
|
};
|
|
204
212
|
} else {
|
|
205
213
|
extra = lastArg;
|
|
@@ -208,6 +216,11 @@ class IssueReporter {
|
|
|
208
216
|
args.splice(1, 1);
|
|
209
217
|
}
|
|
210
218
|
|
|
219
|
+
if (extra.skipSendToRemote) {
|
|
220
|
+
skipSendToRemote = true;
|
|
221
|
+
delete extra.skipSendToRemote;
|
|
222
|
+
}
|
|
223
|
+
|
|
211
224
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
212
225
|
const message = args.join(', ');
|
|
213
226
|
let consoleMessage = message;
|
|
@@ -228,7 +241,13 @@ class IssueReporter {
|
|
|
228
241
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
229
242
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
230
243
|
|
|
231
|
-
this.
|
|
244
|
+
if (this._callback) {
|
|
245
|
+
this._callback(level, consoleMessage);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (!skipSendToRemote) {
|
|
249
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
250
|
+
}
|
|
232
251
|
}
|
|
233
252
|
|
|
234
253
|
logRequest(url , options , response , start ) {
|
|
@@ -373,7 +392,11 @@ class IssueReporter {
|
|
|
373
392
|
},
|
|
374
393
|
// $FlowFixMe
|
|
375
394
|
body,
|
|
376
|
-
}).catch(() => {
|
|
395
|
+
}).catch((e ) => {
|
|
396
|
+
// $FlowFixMe
|
|
397
|
+
e.skipSendToRemote = true;
|
|
398
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
399
|
+
|
|
377
400
|
setTimeout(() => {
|
|
378
401
|
if (isArray) {
|
|
379
402
|
payload = payload.map(message => {
|
package/lib/api/chatd.js
CHANGED
|
@@ -132,6 +132,7 @@ class IssueReporter {
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
|
|
135
|
+
|
|
135
136
|
|
|
136
137
|
constructor() {
|
|
137
138
|
addLevelsTo(this);
|
|
@@ -143,12 +144,17 @@ class IssueReporter {
|
|
|
143
144
|
this.bufferTimeout = null;
|
|
144
145
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
145
146
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
147
|
+
this._callback = null;
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
init() {
|
|
149
151
|
this._catchConsole();
|
|
150
152
|
}
|
|
151
153
|
|
|
154
|
+
setCallback(cb ) {
|
|
155
|
+
this._callback = cb;
|
|
156
|
+
}
|
|
157
|
+
|
|
152
158
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
153
159
|
this.remoteClientConfiguration = configuration;
|
|
154
160
|
}
|
|
@@ -184,6 +190,7 @@ class IssueReporter {
|
|
|
184
190
|
|
|
185
191
|
// Handle category label
|
|
186
192
|
let category = null;
|
|
193
|
+
let skipSendToRemote = false;
|
|
187
194
|
let extra = {};
|
|
188
195
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
189
196
|
category = args[0].split('=')[1];
|
|
@@ -199,6 +206,7 @@ class IssueReporter {
|
|
|
199
206
|
errorMessage: lastArg.message,
|
|
200
207
|
errorStack: lastArg.stack,
|
|
201
208
|
errorType: lastArg.constructor.name,
|
|
209
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
202
210
|
};
|
|
203
211
|
} else {
|
|
204
212
|
extra = lastArg;
|
|
@@ -207,6 +215,11 @@ class IssueReporter {
|
|
|
207
215
|
args.splice(1, 1);
|
|
208
216
|
}
|
|
209
217
|
|
|
218
|
+
if (extra.skipSendToRemote) {
|
|
219
|
+
skipSendToRemote = true;
|
|
220
|
+
delete extra.skipSendToRemote;
|
|
221
|
+
}
|
|
222
|
+
|
|
210
223
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
211
224
|
const message = args.join(', ');
|
|
212
225
|
let consoleMessage = message;
|
|
@@ -227,7 +240,13 @@ class IssueReporter {
|
|
|
227
240
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
228
241
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
229
242
|
|
|
230
|
-
this.
|
|
243
|
+
if (this._callback) {
|
|
244
|
+
this._callback(level, consoleMessage);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (!skipSendToRemote) {
|
|
248
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
249
|
+
}
|
|
231
250
|
}
|
|
232
251
|
|
|
233
252
|
logRequest(url , options , response , start ) {
|
|
@@ -372,7 +391,11 @@ class IssueReporter {
|
|
|
372
391
|
},
|
|
373
392
|
// $FlowFixMe
|
|
374
393
|
body,
|
|
375
|
-
}).catch(() => {
|
|
394
|
+
}).catch((e ) => {
|
|
395
|
+
// $FlowFixMe
|
|
396
|
+
e.skipSendToRemote = true;
|
|
397
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
398
|
+
|
|
376
399
|
setTimeout(() => {
|
|
377
400
|
if (isArray) {
|
|
378
401
|
payload = payload.map(message => {
|
package/lib/api/confd.js
CHANGED
|
@@ -132,6 +132,7 @@ class IssueReporter {
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
|
|
135
|
+
|
|
135
136
|
|
|
136
137
|
constructor() {
|
|
137
138
|
addLevelsTo(this);
|
|
@@ -143,12 +144,17 @@ class IssueReporter {
|
|
|
143
144
|
this.bufferTimeout = null;
|
|
144
145
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
145
146
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
147
|
+
this._callback = null;
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
init() {
|
|
149
151
|
this._catchConsole();
|
|
150
152
|
}
|
|
151
153
|
|
|
154
|
+
setCallback(cb ) {
|
|
155
|
+
this._callback = cb;
|
|
156
|
+
}
|
|
157
|
+
|
|
152
158
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
153
159
|
this.remoteClientConfiguration = configuration;
|
|
154
160
|
}
|
|
@@ -184,6 +190,7 @@ class IssueReporter {
|
|
|
184
190
|
|
|
185
191
|
// Handle category label
|
|
186
192
|
let category = null;
|
|
193
|
+
let skipSendToRemote = false;
|
|
187
194
|
let extra = {};
|
|
188
195
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
189
196
|
category = args[0].split('=')[1];
|
|
@@ -199,6 +206,7 @@ class IssueReporter {
|
|
|
199
206
|
errorMessage: lastArg.message,
|
|
200
207
|
errorStack: lastArg.stack,
|
|
201
208
|
errorType: lastArg.constructor.name,
|
|
209
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
202
210
|
};
|
|
203
211
|
} else {
|
|
204
212
|
extra = lastArg;
|
|
@@ -207,6 +215,11 @@ class IssueReporter {
|
|
|
207
215
|
args.splice(1, 1);
|
|
208
216
|
}
|
|
209
217
|
|
|
218
|
+
if (extra.skipSendToRemote) {
|
|
219
|
+
skipSendToRemote = true;
|
|
220
|
+
delete extra.skipSendToRemote;
|
|
221
|
+
}
|
|
222
|
+
|
|
210
223
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
211
224
|
const message = args.join(', ');
|
|
212
225
|
let consoleMessage = message;
|
|
@@ -227,7 +240,13 @@ class IssueReporter {
|
|
|
227
240
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
228
241
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
229
242
|
|
|
230
|
-
this.
|
|
243
|
+
if (this._callback) {
|
|
244
|
+
this._callback(level, consoleMessage);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (!skipSendToRemote) {
|
|
248
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
249
|
+
}
|
|
231
250
|
}
|
|
232
251
|
|
|
233
252
|
logRequest(url , options , response , start ) {
|
|
@@ -372,7 +391,11 @@ class IssueReporter {
|
|
|
372
391
|
},
|
|
373
392
|
// $FlowFixMe
|
|
374
393
|
body,
|
|
375
|
-
}).catch(() => {
|
|
394
|
+
}).catch((e ) => {
|
|
395
|
+
// $FlowFixMe
|
|
396
|
+
e.skipSendToRemote = true;
|
|
397
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
398
|
+
|
|
376
399
|
setTimeout(() => {
|
|
377
400
|
if (isArray) {
|
|
378
401
|
payload = payload.map(message => {
|
|
@@ -1294,11 +1317,24 @@ class Meeting {
|
|
|
1294
1317
|
});
|
|
1295
1318
|
}
|
|
1296
1319
|
|
|
1320
|
+
static parseMany(items ) {
|
|
1321
|
+
return items.map(plain => Meeting.parse(plain));
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1297
1324
|
static newFrom(meeting ) {
|
|
1298
1325
|
return newFrom(meeting, Meeting);
|
|
1299
1326
|
}
|
|
1300
1327
|
|
|
1301
|
-
constructor({
|
|
1328
|
+
constructor({
|
|
1329
|
+
uuid,
|
|
1330
|
+
name,
|
|
1331
|
+
guestSipAuthorization,
|
|
1332
|
+
ownerUuids,
|
|
1333
|
+
port,
|
|
1334
|
+
uri,
|
|
1335
|
+
number,
|
|
1336
|
+
persistent,
|
|
1337
|
+
} = {}) {
|
|
1302
1338
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
1303
1339
|
this.uri = uri;
|
|
1304
1340
|
this.name = name;
|
|
@@ -1384,8 +1420,11 @@ var confd = (client , baseUrl ) => ({
|
|
|
1384
1420
|
}
|
|
1385
1421
|
},
|
|
1386
1422
|
|
|
1387
|
-
|
|
1388
|
-
client.
|
|
1423
|
+
getMyMeetings: () =>
|
|
1424
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
1425
|
+
|
|
1426
|
+
createMyMeeting: (name , persistent ) =>
|
|
1427
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
1389
1428
|
|
|
1390
1429
|
deleteMyMeeting: (meetingUuid ) =>
|
|
1391
1430
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
package/lib/api/ctid-ng.js
CHANGED
|
@@ -136,6 +136,7 @@ class IssueReporter {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
|
|
139
|
+
|
|
139
140
|
|
|
140
141
|
constructor() {
|
|
141
142
|
addLevelsTo(this);
|
|
@@ -147,12 +148,17 @@ class IssueReporter {
|
|
|
147
148
|
this.bufferTimeout = null;
|
|
148
149
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
149
150
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
151
|
+
this._callback = null;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
init() {
|
|
153
155
|
this._catchConsole();
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
setCallback(cb ) {
|
|
159
|
+
this._callback = cb;
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
157
163
|
this.remoteClientConfiguration = configuration;
|
|
158
164
|
}
|
|
@@ -188,6 +194,7 @@ class IssueReporter {
|
|
|
188
194
|
|
|
189
195
|
// Handle category label
|
|
190
196
|
let category = null;
|
|
197
|
+
let skipSendToRemote = false;
|
|
191
198
|
let extra = {};
|
|
192
199
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
193
200
|
category = args[0].split('=')[1];
|
|
@@ -203,6 +210,7 @@ class IssueReporter {
|
|
|
203
210
|
errorMessage: lastArg.message,
|
|
204
211
|
errorStack: lastArg.stack,
|
|
205
212
|
errorType: lastArg.constructor.name,
|
|
213
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
206
214
|
};
|
|
207
215
|
} else {
|
|
208
216
|
extra = lastArg;
|
|
@@ -211,6 +219,11 @@ class IssueReporter {
|
|
|
211
219
|
args.splice(1, 1);
|
|
212
220
|
}
|
|
213
221
|
|
|
222
|
+
if (extra.skipSendToRemote) {
|
|
223
|
+
skipSendToRemote = true;
|
|
224
|
+
delete extra.skipSendToRemote;
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
215
228
|
const message = args.join(', ');
|
|
216
229
|
let consoleMessage = message;
|
|
@@ -231,7 +244,13 @@ class IssueReporter {
|
|
|
231
244
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
232
245
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
233
246
|
|
|
234
|
-
this.
|
|
247
|
+
if (this._callback) {
|
|
248
|
+
this._callback(level, consoleMessage);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!skipSendToRemote) {
|
|
252
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
253
|
+
}
|
|
235
254
|
}
|
|
236
255
|
|
|
237
256
|
logRequest(url , options , response , start ) {
|
|
@@ -376,7 +395,11 @@ class IssueReporter {
|
|
|
376
395
|
},
|
|
377
396
|
// $FlowFixMe
|
|
378
397
|
body,
|
|
379
|
-
}).catch(() => {
|
|
398
|
+
}).catch((e ) => {
|
|
399
|
+
// $FlowFixMe
|
|
400
|
+
e.skipSendToRemote = true;
|
|
401
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
402
|
+
|
|
380
403
|
setTimeout(() => {
|
|
381
404
|
if (isArray) {
|
|
382
405
|
payload = payload.map(message => {
|
package/lib/api/dird.js
CHANGED
|
@@ -134,6 +134,7 @@ class IssueReporter {
|
|
|
134
134
|
|
|
135
135
|
|
|
136
136
|
|
|
137
|
+
|
|
137
138
|
|
|
138
139
|
constructor() {
|
|
139
140
|
addLevelsTo(this);
|
|
@@ -145,12 +146,17 @@ class IssueReporter {
|
|
|
145
146
|
this.bufferTimeout = null;
|
|
146
147
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
147
148
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
149
|
+
this._callback = null;
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
init() {
|
|
151
153
|
this._catchConsole();
|
|
152
154
|
}
|
|
153
155
|
|
|
156
|
+
setCallback(cb ) {
|
|
157
|
+
this._callback = cb;
|
|
158
|
+
}
|
|
159
|
+
|
|
154
160
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
155
161
|
this.remoteClientConfiguration = configuration;
|
|
156
162
|
}
|
|
@@ -186,6 +192,7 @@ class IssueReporter {
|
|
|
186
192
|
|
|
187
193
|
// Handle category label
|
|
188
194
|
let category = null;
|
|
195
|
+
let skipSendToRemote = false;
|
|
189
196
|
let extra = {};
|
|
190
197
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
191
198
|
category = args[0].split('=')[1];
|
|
@@ -201,6 +208,7 @@ class IssueReporter {
|
|
|
201
208
|
errorMessage: lastArg.message,
|
|
202
209
|
errorStack: lastArg.stack,
|
|
203
210
|
errorType: lastArg.constructor.name,
|
|
211
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
204
212
|
};
|
|
205
213
|
} else {
|
|
206
214
|
extra = lastArg;
|
|
@@ -209,6 +217,11 @@ class IssueReporter {
|
|
|
209
217
|
args.splice(1, 1);
|
|
210
218
|
}
|
|
211
219
|
|
|
220
|
+
if (extra.skipSendToRemote) {
|
|
221
|
+
skipSendToRemote = true;
|
|
222
|
+
delete extra.skipSendToRemote;
|
|
223
|
+
}
|
|
224
|
+
|
|
212
225
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
213
226
|
const message = args.join(', ');
|
|
214
227
|
let consoleMessage = message;
|
|
@@ -229,7 +242,13 @@ class IssueReporter {
|
|
|
229
242
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
230
243
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
231
244
|
|
|
232
|
-
this.
|
|
245
|
+
if (this._callback) {
|
|
246
|
+
this._callback(level, consoleMessage);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (!skipSendToRemote) {
|
|
250
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
251
|
+
}
|
|
233
252
|
}
|
|
234
253
|
|
|
235
254
|
logRequest(url , options , response , start ) {
|
|
@@ -374,7 +393,11 @@ class IssueReporter {
|
|
|
374
393
|
},
|
|
375
394
|
// $FlowFixMe
|
|
376
395
|
body,
|
|
377
|
-
}).catch(() => {
|
|
396
|
+
}).catch((e ) => {
|
|
397
|
+
// $FlowFixMe
|
|
398
|
+
e.skipSendToRemote = true;
|
|
399
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
400
|
+
|
|
378
401
|
setTimeout(() => {
|
|
379
402
|
if (isArray) {
|
|
380
403
|
payload = payload.map(message => {
|
package/lib/api/webhookd.js
CHANGED
|
@@ -71,6 +71,7 @@ class IssueReporter {
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
|
|
74
75
|
|
|
75
76
|
constructor() {
|
|
76
77
|
addLevelsTo(this);
|
|
@@ -82,12 +83,17 @@ class IssueReporter {
|
|
|
82
83
|
this.bufferTimeout = null;
|
|
83
84
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
84
85
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
86
|
+
this._callback = null;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
init() {
|
|
88
90
|
this._catchConsole();
|
|
89
91
|
}
|
|
90
92
|
|
|
93
|
+
setCallback(cb ) {
|
|
94
|
+
this._callback = cb;
|
|
95
|
+
}
|
|
96
|
+
|
|
91
97
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
92
98
|
this.remoteClientConfiguration = configuration;
|
|
93
99
|
}
|
|
@@ -123,6 +129,7 @@ class IssueReporter {
|
|
|
123
129
|
|
|
124
130
|
// Handle category label
|
|
125
131
|
let category = null;
|
|
132
|
+
let skipSendToRemote = false;
|
|
126
133
|
let extra = {};
|
|
127
134
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
128
135
|
category = args[0].split('=')[1];
|
|
@@ -138,6 +145,7 @@ class IssueReporter {
|
|
|
138
145
|
errorMessage: lastArg.message,
|
|
139
146
|
errorStack: lastArg.stack,
|
|
140
147
|
errorType: lastArg.constructor.name,
|
|
148
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
141
149
|
};
|
|
142
150
|
} else {
|
|
143
151
|
extra = lastArg;
|
|
@@ -146,6 +154,11 @@ class IssueReporter {
|
|
|
146
154
|
args.splice(1, 1);
|
|
147
155
|
}
|
|
148
156
|
|
|
157
|
+
if (extra.skipSendToRemote) {
|
|
158
|
+
skipSendToRemote = true;
|
|
159
|
+
delete extra.skipSendToRemote;
|
|
160
|
+
}
|
|
161
|
+
|
|
149
162
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
150
163
|
const message = args.join(', ');
|
|
151
164
|
let consoleMessage = message;
|
|
@@ -166,7 +179,13 @@ class IssueReporter {
|
|
|
166
179
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
167
180
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
168
181
|
|
|
169
|
-
this.
|
|
182
|
+
if (this._callback) {
|
|
183
|
+
this._callback(level, consoleMessage);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!skipSendToRemote) {
|
|
187
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
188
|
+
}
|
|
170
189
|
}
|
|
171
190
|
|
|
172
191
|
logRequest(url , options , response , start ) {
|
|
@@ -311,7 +330,11 @@ class IssueReporter {
|
|
|
311
330
|
},
|
|
312
331
|
// $FlowFixMe
|
|
313
332
|
body,
|
|
314
|
-
}).catch(() => {
|
|
333
|
+
}).catch((e ) => {
|
|
334
|
+
// $FlowFixMe
|
|
335
|
+
e.skipSendToRemote = true;
|
|
336
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
337
|
+
|
|
315
338
|
setTimeout(() => {
|
|
316
339
|
if (isArray) {
|
|
317
340
|
payload = payload.map(message => {
|
package/lib/api-client.js
CHANGED
|
@@ -136,6 +136,7 @@ class IssueReporter {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
|
|
139
|
+
|
|
139
140
|
|
|
140
141
|
constructor() {
|
|
141
142
|
addLevelsTo(this);
|
|
@@ -147,12 +148,17 @@ class IssueReporter {
|
|
|
147
148
|
this.bufferTimeout = null;
|
|
148
149
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
149
150
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
151
|
+
this._callback = null;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
init() {
|
|
153
155
|
this._catchConsole();
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
setCallback(cb ) {
|
|
159
|
+
this._callback = cb;
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
157
163
|
this.remoteClientConfiguration = configuration;
|
|
158
164
|
}
|
|
@@ -188,6 +194,7 @@ class IssueReporter {
|
|
|
188
194
|
|
|
189
195
|
// Handle category label
|
|
190
196
|
let category = null;
|
|
197
|
+
let skipSendToRemote = false;
|
|
191
198
|
let extra = {};
|
|
192
199
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
193
200
|
category = args[0].split('=')[1];
|
|
@@ -203,6 +210,7 @@ class IssueReporter {
|
|
|
203
210
|
errorMessage: lastArg.message,
|
|
204
211
|
errorStack: lastArg.stack,
|
|
205
212
|
errorType: lastArg.constructor.name,
|
|
213
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
206
214
|
};
|
|
207
215
|
} else {
|
|
208
216
|
extra = lastArg;
|
|
@@ -211,6 +219,11 @@ class IssueReporter {
|
|
|
211
219
|
args.splice(1, 1);
|
|
212
220
|
}
|
|
213
221
|
|
|
222
|
+
if (extra.skipSendToRemote) {
|
|
223
|
+
skipSendToRemote = true;
|
|
224
|
+
delete extra.skipSendToRemote;
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
215
228
|
const message = args.join(', ');
|
|
216
229
|
let consoleMessage = message;
|
|
@@ -231,7 +244,13 @@ class IssueReporter {
|
|
|
231
244
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
232
245
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
233
246
|
|
|
234
|
-
this.
|
|
247
|
+
if (this._callback) {
|
|
248
|
+
this._callback(level, consoleMessage);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!skipSendToRemote) {
|
|
252
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
253
|
+
}
|
|
235
254
|
}
|
|
236
255
|
|
|
237
256
|
logRequest(url , options , response , start ) {
|
|
@@ -376,7 +395,11 @@ class IssueReporter {
|
|
|
376
395
|
},
|
|
377
396
|
// $FlowFixMe
|
|
378
397
|
body,
|
|
379
|
-
}).catch(() => {
|
|
398
|
+
}).catch((e ) => {
|
|
399
|
+
// $FlowFixMe
|
|
400
|
+
e.skipSendToRemote = true;
|
|
401
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
402
|
+
|
|
380
403
|
setTimeout(() => {
|
|
381
404
|
if (isArray) {
|
|
382
405
|
payload = payload.map(message => {
|
|
@@ -2620,11 +2643,24 @@ class Meeting {
|
|
|
2620
2643
|
});
|
|
2621
2644
|
}
|
|
2622
2645
|
|
|
2646
|
+
static parseMany(items ) {
|
|
2647
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2623
2650
|
static newFrom(meeting ) {
|
|
2624
2651
|
return newFrom(meeting, Meeting);
|
|
2625
2652
|
}
|
|
2626
2653
|
|
|
2627
|
-
constructor({
|
|
2654
|
+
constructor({
|
|
2655
|
+
uuid,
|
|
2656
|
+
name,
|
|
2657
|
+
guestSipAuthorization,
|
|
2658
|
+
ownerUuids,
|
|
2659
|
+
port,
|
|
2660
|
+
uri,
|
|
2661
|
+
number,
|
|
2662
|
+
persistent,
|
|
2663
|
+
} = {}) {
|
|
2628
2664
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2629
2665
|
this.uri = uri;
|
|
2630
2666
|
this.name = name;
|
|
@@ -2710,8 +2746,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2710
2746
|
}
|
|
2711
2747
|
},
|
|
2712
2748
|
|
|
2713
|
-
|
|
2714
|
-
client.
|
|
2749
|
+
getMyMeetings: () =>
|
|
2750
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2751
|
+
|
|
2752
|
+
createMyMeeting: (name , persistent ) =>
|
|
2753
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2715
2754
|
|
|
2716
2755
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2717
2756
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|