@incodetech/core 2.0.0-alpha.2 → 2.0.0-alpha.4
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/OpenViduLogger-BdPfiZO6.esm.js +3 -0
- package/dist/OpenViduLogger-CQyDxBvM.esm.js +803 -0
- package/dist/{addEvent-1Mi5CEiq.esm.js → addEvent-9v4w5iO-.esm.js} +1 -1
- package/dist/email.d.ts +1 -1
- package/dist/email.esm.js +2 -2
- package/dist/{endpoints-D_pUMaqA.esm.js → endpoints-Dn1t57hJ.esm.js} +8 -3
- package/dist/flow.d.ts +3 -3
- package/dist/flow.esm.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +2 -2
- package/dist/{lib-CyIAFRfr.esm.js → lib-Bu9XGMBW.esm.js} +1 -800
- package/dist/{permissionServices-CVR0Pq38.esm.js → permissionServices-CCpxd8le.esm.js} +1 -1
- package/dist/phone.d.ts +1 -1
- package/dist/phone.esm.js +2 -2
- package/dist/selfie.d.ts +5 -4
- package/dist/selfie.esm.js +27 -10
- package/package.json +4 -1
- package/.turbo/turbo-build.log +0 -33
- package/.turbo/turbo-coverage.log +0 -22
- package/.turbo/turbo-format.log +0 -6
- package/.turbo/turbo-lint$colon$fix.log +0 -77
- package/.turbo/turbo-lint.log +0 -95
- package/.turbo/turbo-test.log +0 -870
- package/.turbo/turbo-typecheck.log +0 -5
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -221
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/coverage/src/camera/cameraService.ts.html +0 -580
- package/coverage/src/camera/cameraServices.ts.html +0 -163
- package/coverage/src/camera/cameraStateMachine.ts.html +0 -877
- package/coverage/src/camera/index.html +0 -146
- package/coverage/src/email/emailActor.ts.html +0 -130
- package/coverage/src/email/emailManager.ts.html +0 -1366
- package/coverage/src/email/emailStateMachine.ts.html +0 -1186
- package/coverage/src/email/index.html +0 -146
- package/coverage/src/flow/flowActor.ts.html +0 -124
- package/coverage/src/flow/flowAnalyzer.ts.html +0 -196
- package/coverage/src/flow/flowManager.ts.html +0 -790
- package/coverage/src/flow/flowServices.ts.html +0 -124
- package/coverage/src/flow/flowStateMachine.ts.html +0 -631
- package/coverage/src/flow/index.html +0 -221
- package/coverage/src/flow/moduleLoader.ts.html +0 -304
- package/coverage/src/flow/orchestratedFlowManager.ts.html +0 -778
- package/coverage/src/flow/orchestratedFlowStateMachine.ts.html +0 -1060
- package/coverage/src/http/api.ts.html +0 -355
- package/coverage/src/http/endpoints.ts.html +0 -136
- package/coverage/src/http/index.html +0 -131
- package/coverage/src/index.html +0 -116
- package/coverage/src/phone/index.html +0 -146
- package/coverage/src/phone/phoneActor.ts.html +0 -130
- package/coverage/src/phone/phoneManager.ts.html +0 -1459
- package/coverage/src/phone/phoneStateMachine.ts.html +0 -1351
- package/coverage/src/recordings/index.html +0 -116
- package/coverage/src/recordings/recordingsRepository.ts.html +0 -229
- package/coverage/src/selfie/index.html +0 -191
- package/coverage/src/selfie/selfieActor.ts.html +0 -136
- package/coverage/src/selfie/selfieErrorUtils.ts.html +0 -283
- package/coverage/src/selfie/selfieManager.ts.html +0 -988
- package/coverage/src/selfie/selfieStateMachine.ts.html +0 -2497
- package/coverage/src/selfie/selfieUploadService.ts.html +0 -328
- package/coverage/src/selfie/types.ts.html +0 -394
- package/coverage/src/setup.ts.html +0 -598
- package/src/camera/cameraActor.ts +0 -21
- package/src/camera/cameraService.test.ts +0 -437
- package/src/camera/cameraService.ts +0 -165
- package/src/camera/cameraServices.test.ts +0 -66
- package/src/camera/cameraServices.ts +0 -26
- package/src/camera/cameraStateMachine.test.ts +0 -602
- package/src/camera/cameraStateMachine.ts +0 -264
- package/src/camera/index.ts +0 -5
- package/src/camera/types.ts +0 -17
- package/src/device/getBrowser.ts +0 -31
- package/src/device/getDeviceClass.ts +0 -29
- package/src/device/index.ts +0 -2
- package/src/email/__mocks__/emailMocks.ts +0 -59
- package/src/email/emailActor.ts +0 -15
- package/src/email/emailManager.test.ts +0 -573
- package/src/email/emailManager.ts +0 -427
- package/src/email/emailServices.ts +0 -66
- package/src/email/emailStateMachine.test.ts +0 -741
- package/src/email/emailStateMachine.ts +0 -367
- package/src/email/index.ts +0 -39
- package/src/email/types.ts +0 -60
- package/src/events/addEvent.ts +0 -20
- package/src/events/types.ts +0 -7
- package/src/flow/__mocks__/flowMocks.ts +0 -84
- package/src/flow/flowActor.ts +0 -13
- package/src/flow/flowAnalyzer.test.ts +0 -266
- package/src/flow/flowAnalyzer.ts +0 -37
- package/src/flow/flowCompletionService.ts +0 -21
- package/src/flow/flowManager.test.ts +0 -560
- package/src/flow/flowManager.ts +0 -235
- package/src/flow/flowServices.test.ts +0 -109
- package/src/flow/flowServices.ts +0 -13
- package/src/flow/flowStateMachine.test.ts +0 -334
- package/src/flow/flowStateMachine.ts +0 -182
- package/src/flow/index.ts +0 -21
- package/src/flow/moduleLoader.test.ts +0 -136
- package/src/flow/moduleLoader.ts +0 -73
- package/src/flow/orchestratedFlowManager.test.ts +0 -240
- package/src/flow/orchestratedFlowManager.ts +0 -231
- package/src/flow/orchestratedFlowStateMachine.test.ts +0 -199
- package/src/flow/orchestratedFlowStateMachine.ts +0 -325
- package/src/flow/types.ts +0 -434
- package/src/http/__mocks__/api.ts +0 -88
- package/src/http/api.test.ts +0 -231
- package/src/http/api.ts +0 -90
- package/src/http/endpoints.ts +0 -17
- package/src/index.ts +0 -33
- package/src/permissions/index.ts +0 -2
- package/src/permissions/permissionServices.ts +0 -31
- package/src/permissions/types.ts +0 -3
- package/src/phone/__mocks__/phoneMocks.ts +0 -71
- package/src/phone/index.ts +0 -39
- package/src/phone/phoneActor.ts +0 -15
- package/src/phone/phoneManager.test.ts +0 -393
- package/src/phone/phoneManager.ts +0 -458
- package/src/phone/phoneServices.ts +0 -98
- package/src/phone/phoneStateMachine.test.ts +0 -918
- package/src/phone/phoneStateMachine.ts +0 -422
- package/src/phone/types.ts +0 -83
- package/src/recordings/recordingsRepository.test.ts +0 -87
- package/src/recordings/recordingsRepository.ts +0 -48
- package/src/recordings/streamingEvents.ts +0 -10
- package/src/selfie/__mocks__/selfieMocks.ts +0 -26
- package/src/selfie/index.ts +0 -14
- package/src/selfie/selfieActor.ts +0 -17
- package/src/selfie/selfieErrorUtils.test.ts +0 -116
- package/src/selfie/selfieErrorUtils.ts +0 -66
- package/src/selfie/selfieManager.test.ts +0 -297
- package/src/selfie/selfieManager.ts +0 -301
- package/src/selfie/selfieServices.ts +0 -362
- package/src/selfie/selfieStateMachine.test.ts +0 -283
- package/src/selfie/selfieStateMachine.ts +0 -804
- package/src/selfie/selfieUploadService.test.ts +0 -90
- package/src/selfie/selfieUploadService.ts +0 -81
- package/src/selfie/types.ts +0 -103
- package/src/session/index.ts +0 -5
- package/src/session/sessionService.ts +0 -78
- package/src/setup.test.ts +0 -61
- package/src/setup.ts +0 -171
- package/tsconfig.json +0 -13
- package/tsdown.config.ts +0 -22
- package/vitest.config.ts +0 -37
- package/vitest.setup.ts +0 -135
- /package/dist/{Manager-6BwbaI_H.d.ts → Manager-BGfxEmyv.d.ts} +0 -0
- /package/dist/{StateMachine-7c1gcu94.d.ts → StateMachine-DRE1oH2B.d.ts} +0 -0
- /package/dist/{types-tq1ypYSL.d.ts → types-kWlqshfM.d.ts} +0 -0
- /package/dist/{warmup-Dr7OcFND.d.ts → warmup-CEJTfxQr.d.ts} +0 -0
|
@@ -0,0 +1,803 @@
|
|
|
1
|
+
import { t as __commonJS } from "./chunk-C_Yo44FK.esm.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/jsnlog@2.30.0/node_modules/jsnlog/jsnlog.js
|
|
4
|
+
var require_jsnlog = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/jsnlog@2.30.0/node_modules/jsnlog/jsnlog.js": ((exports) => {
|
|
5
|
+
var __extends = exports && exports.__extends || (function() {
|
|
6
|
+
var extendStatics = function(d, b) {
|
|
7
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d$1, b$1) {
|
|
8
|
+
d$1.__proto__ = b$1;
|
|
9
|
+
} || function(d$1, b$1) {
|
|
10
|
+
for (var p in b$1) if (Object.prototype.hasOwnProperty.call(b$1, p)) d$1[p] = b$1[p];
|
|
11
|
+
};
|
|
12
|
+
return extendStatics(d, b);
|
|
13
|
+
};
|
|
14
|
+
return function(d, b) {
|
|
15
|
+
extendStatics(d, b);
|
|
16
|
+
function __() {
|
|
17
|
+
this.constructor = d;
|
|
18
|
+
}
|
|
19
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
20
|
+
};
|
|
21
|
+
})();
|
|
22
|
+
function JL(loggerName) {
|
|
23
|
+
if (!loggerName) return JL.__;
|
|
24
|
+
if (!Array.prototype.reduce) Array.prototype.reduce = function(callback, initialValue) {
|
|
25
|
+
var previousValue = initialValue;
|
|
26
|
+
for (var i = 0; i < this.length; i++) previousValue = callback(previousValue, this[i], i, this);
|
|
27
|
+
return previousValue;
|
|
28
|
+
};
|
|
29
|
+
var accumulatedLoggerName = "";
|
|
30
|
+
return ("." + loggerName).split(".").reduce(function(prev, curr, idx, arr) {
|
|
31
|
+
if (accumulatedLoggerName) accumulatedLoggerName += "." + curr;
|
|
32
|
+
else accumulatedLoggerName = curr;
|
|
33
|
+
var currentLogger = prev["__" + accumulatedLoggerName];
|
|
34
|
+
if (currentLogger === void 0) {
|
|
35
|
+
JL.Logger.prototype = prev;
|
|
36
|
+
currentLogger = new JL.Logger(accumulatedLoggerName);
|
|
37
|
+
prev["__" + accumulatedLoggerName] = currentLogger;
|
|
38
|
+
}
|
|
39
|
+
return currentLogger;
|
|
40
|
+
}, JL.__);
|
|
41
|
+
}
|
|
42
|
+
(function(JL$1) {
|
|
43
|
+
JL$1.requestId = "";
|
|
44
|
+
JL$1.entryId = 0;
|
|
45
|
+
JL$1._createXMLHttpRequest = function() {
|
|
46
|
+
return new XMLHttpRequest();
|
|
47
|
+
};
|
|
48
|
+
JL$1._getTime = function() {
|
|
49
|
+
return (/* @__PURE__ */ new Date()).getTime();
|
|
50
|
+
};
|
|
51
|
+
JL$1._console = console;
|
|
52
|
+
JL$1._appenderNames = [];
|
|
53
|
+
/**
|
|
54
|
+
Copies the value of a property from one object to the other.
|
|
55
|
+
This is used to copy property values as part of setOption for loggers and appenders.
|
|
56
|
+
|
|
57
|
+
Because loggers inherit property values from their parents, it is important never to
|
|
58
|
+
create a property on a logger if the intent is to inherit from the parent.
|
|
59
|
+
|
|
60
|
+
Copying rules:
|
|
61
|
+
1) if the from property is undefined (for example, not mentioned in a JSON object), the
|
|
62
|
+
to property is not affected at all.
|
|
63
|
+
2) if the from property is null, the to property is deleted (so the logger will inherit from
|
|
64
|
+
its parent).
|
|
65
|
+
3) Otherwise, the from property is copied to the to property.
|
|
66
|
+
*/
|
|
67
|
+
function copyProperty(propertyName, from, to) {
|
|
68
|
+
if (from[propertyName] === void 0) return;
|
|
69
|
+
if (from[propertyName] === null) {
|
|
70
|
+
delete to[propertyName];
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
to[propertyName] = from[propertyName];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
Returns true if a log should go ahead.
|
|
77
|
+
Does not check level.
|
|
78
|
+
|
|
79
|
+
@param filters
|
|
80
|
+
Filters that determine whether a log can go ahead.
|
|
81
|
+
*/
|
|
82
|
+
function allow(filters) {
|
|
83
|
+
if (!(JL$1.enabled == null)) {
|
|
84
|
+
if (!JL$1.enabled) return false;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
if (filters.userAgentRegex) {
|
|
88
|
+
if (!new RegExp(filters.userAgentRegex).test(navigator.userAgent)) return false;
|
|
89
|
+
}
|
|
90
|
+
} catch (e) {}
|
|
91
|
+
try {
|
|
92
|
+
if (filters.ipRegex && JL$1.clientIP) {
|
|
93
|
+
if (!new RegExp(filters.ipRegex).test(JL$1.clientIP)) return false;
|
|
94
|
+
}
|
|
95
|
+
} catch (e) {}
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
Returns true if a log should go ahead, based on the message.
|
|
100
|
+
|
|
101
|
+
@param filters
|
|
102
|
+
Filters that determine whether a log can go ahead.
|
|
103
|
+
|
|
104
|
+
@param message
|
|
105
|
+
Message to be logged.
|
|
106
|
+
*/
|
|
107
|
+
function allowMessage(filters, message) {
|
|
108
|
+
try {
|
|
109
|
+
if (filters.disallow) {
|
|
110
|
+
if (new RegExp(filters.disallow).test(message)) return false;
|
|
111
|
+
}
|
|
112
|
+
} catch (e) {}
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
function stringifyLogObjectFunction(logObject) {
|
|
116
|
+
if (typeof logObject == "function") if (logObject instanceof RegExp) return logObject.toString();
|
|
117
|
+
else return logObject();
|
|
118
|
+
return logObject;
|
|
119
|
+
}
|
|
120
|
+
var StringifiedLogObject = function() {
|
|
121
|
+
function StringifiedLogObject$1(msg, meta, finalString) {
|
|
122
|
+
this.msg = msg;
|
|
123
|
+
this.meta = meta;
|
|
124
|
+
this.finalString = finalString;
|
|
125
|
+
}
|
|
126
|
+
return StringifiedLogObject$1;
|
|
127
|
+
}();
|
|
128
|
+
function stringifyLogObject(logObject) {
|
|
129
|
+
var actualLogObject = stringifyLogObjectFunction(logObject);
|
|
130
|
+
var finalString;
|
|
131
|
+
switch (typeof actualLogObject) {
|
|
132
|
+
case "string": return new StringifiedLogObject(actualLogObject, null, actualLogObject);
|
|
133
|
+
case "number":
|
|
134
|
+
finalString = actualLogObject.toString();
|
|
135
|
+
return new StringifiedLogObject(finalString, null, finalString);
|
|
136
|
+
case "boolean":
|
|
137
|
+
finalString = actualLogObject.toString();
|
|
138
|
+
return new StringifiedLogObject(finalString, null, finalString);
|
|
139
|
+
case "undefined": return new StringifiedLogObject("undefined", null, "undefined");
|
|
140
|
+
case "object": if (actualLogObject instanceof RegExp || actualLogObject instanceof String || actualLogObject instanceof Number || actualLogObject instanceof Boolean) {
|
|
141
|
+
finalString = actualLogObject.toString();
|
|
142
|
+
return new StringifiedLogObject(finalString, null, finalString);
|
|
143
|
+
} else {
|
|
144
|
+
if (typeof JL$1.serialize === "function") finalString = JL$1.serialize.call(this, actualLogObject);
|
|
145
|
+
else finalString = JSON.stringify(actualLogObject);
|
|
146
|
+
return new StringifiedLogObject("", actualLogObject, finalString);
|
|
147
|
+
}
|
|
148
|
+
default: return new StringifiedLogObject("unknown", null, "unknown");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function setOptions(options) {
|
|
152
|
+
copyProperty("enabled", options, this);
|
|
153
|
+
copyProperty("maxMessages", options, this);
|
|
154
|
+
copyProperty("defaultAjaxUrl", options, this);
|
|
155
|
+
copyProperty("clientIP", options, this);
|
|
156
|
+
copyProperty("requestId", options, this);
|
|
157
|
+
copyProperty("defaultBeforeSend", options, this);
|
|
158
|
+
copyProperty("serialize", options, this);
|
|
159
|
+
return this;
|
|
160
|
+
}
|
|
161
|
+
JL$1.setOptions = setOptions;
|
|
162
|
+
function getAllLevel() {
|
|
163
|
+
return -2147483648;
|
|
164
|
+
}
|
|
165
|
+
JL$1.getAllLevel = getAllLevel;
|
|
166
|
+
function getTraceLevel() {
|
|
167
|
+
return 1e3;
|
|
168
|
+
}
|
|
169
|
+
JL$1.getTraceLevel = getTraceLevel;
|
|
170
|
+
function getDebugLevel() {
|
|
171
|
+
return 2e3;
|
|
172
|
+
}
|
|
173
|
+
JL$1.getDebugLevel = getDebugLevel;
|
|
174
|
+
function getInfoLevel() {
|
|
175
|
+
return 3e3;
|
|
176
|
+
}
|
|
177
|
+
JL$1.getInfoLevel = getInfoLevel;
|
|
178
|
+
function getWarnLevel() {
|
|
179
|
+
return 4e3;
|
|
180
|
+
}
|
|
181
|
+
JL$1.getWarnLevel = getWarnLevel;
|
|
182
|
+
function getErrorLevel() {
|
|
183
|
+
return 5e3;
|
|
184
|
+
}
|
|
185
|
+
JL$1.getErrorLevel = getErrorLevel;
|
|
186
|
+
function getFatalLevel() {
|
|
187
|
+
return 6e3;
|
|
188
|
+
}
|
|
189
|
+
JL$1.getFatalLevel = getFatalLevel;
|
|
190
|
+
function getOffLevel() {
|
|
191
|
+
return 2147483647;
|
|
192
|
+
}
|
|
193
|
+
JL$1.getOffLevel = getOffLevel;
|
|
194
|
+
function levelToString(level) {
|
|
195
|
+
if (level <= 1e3) return "trace";
|
|
196
|
+
if (level <= 2e3) return "debug";
|
|
197
|
+
if (level <= 3e3) return "info";
|
|
198
|
+
if (level <= 4e3) return "warn";
|
|
199
|
+
if (level <= 5e3) return "error";
|
|
200
|
+
return "fatal";
|
|
201
|
+
}
|
|
202
|
+
var Exception = function() {
|
|
203
|
+
function Exception$1(data, inner) {
|
|
204
|
+
this.inner = inner;
|
|
205
|
+
this.name = "JL.Exception";
|
|
206
|
+
this.message = stringifyLogObject(data).finalString;
|
|
207
|
+
}
|
|
208
|
+
return Exception$1;
|
|
209
|
+
}();
|
|
210
|
+
JL$1.Exception = Exception;
|
|
211
|
+
Exception.prototype = /* @__PURE__ */ new Error();
|
|
212
|
+
var LogItem = function() {
|
|
213
|
+
function LogItem$1(l, m, n, t, u) {
|
|
214
|
+
this.l = l;
|
|
215
|
+
this.m = m;
|
|
216
|
+
this.n = n;
|
|
217
|
+
this.t = t;
|
|
218
|
+
this.u = u;
|
|
219
|
+
}
|
|
220
|
+
return LogItem$1;
|
|
221
|
+
}();
|
|
222
|
+
JL$1.LogItem = LogItem;
|
|
223
|
+
function newLogItem(levelNbr, message, loggerName) {
|
|
224
|
+
JL$1.entryId++;
|
|
225
|
+
return new LogItem(levelNbr, message, loggerName, JL$1._getTime(), JL$1.entryId);
|
|
226
|
+
}
|
|
227
|
+
function clearTimer(timer) {
|
|
228
|
+
if (timer.id) {
|
|
229
|
+
clearTimeout(timer.id);
|
|
230
|
+
timer.id = null;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function setTimer(timer, timeoutMs, callback) {
|
|
234
|
+
var that = this;
|
|
235
|
+
if (!timer.id) timer.id = setTimeout(function() {
|
|
236
|
+
callback.call(that);
|
|
237
|
+
}, timeoutMs);
|
|
238
|
+
}
|
|
239
|
+
var Appender = function() {
|
|
240
|
+
function Appender$1(appenderName, sendLogItems) {
|
|
241
|
+
this.appenderName = appenderName;
|
|
242
|
+
this.sendLogItems = sendLogItems;
|
|
243
|
+
this.level = JL$1.getTraceLevel();
|
|
244
|
+
this.sendWithBufferLevel = 2147483647;
|
|
245
|
+
this.storeInBufferLevel = -2147483648;
|
|
246
|
+
this.bufferSize = 0;
|
|
247
|
+
this.batchSize = 1;
|
|
248
|
+
this.maxBatchSize = 20;
|
|
249
|
+
this.batchTimeout = 2147483647;
|
|
250
|
+
this.sendTimeout = 5e3;
|
|
251
|
+
this.buffer = [];
|
|
252
|
+
this.batchBuffer = [];
|
|
253
|
+
this.batchTimeoutTimer = { id: null };
|
|
254
|
+
this.sendTimeoutTimer = { id: null };
|
|
255
|
+
this.nbrLogItemsSkipped = 0;
|
|
256
|
+
this.nbrLogItemsBeingSent = 0;
|
|
257
|
+
var emptyNameErrorMessage = "Trying to create an appender without a name or with an empty name";
|
|
258
|
+
if (appenderName == void 0) throw emptyNameErrorMessage;
|
|
259
|
+
if (JL$1._appenderNames.indexOf(appenderName) != -1) {
|
|
260
|
+
if (!appenderName) throw emptyNameErrorMessage;
|
|
261
|
+
throw "Multiple appenders use the same name " + appenderName;
|
|
262
|
+
}
|
|
263
|
+
JL$1._appenderNames.push(appenderName);
|
|
264
|
+
}
|
|
265
|
+
Appender$1.prototype.addLogItemsToBuffer = function(logItems) {
|
|
266
|
+
if (this.batchBuffer.length >= this.maxBatchSize) {
|
|
267
|
+
this.nbrLogItemsSkipped += logItems.length;
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (!(JL$1.maxMessages == null)) {
|
|
271
|
+
if (JL$1.maxMessages < 1) return;
|
|
272
|
+
JL$1.maxMessages -= logItems.length;
|
|
273
|
+
}
|
|
274
|
+
this.batchBuffer = this.batchBuffer.concat(logItems);
|
|
275
|
+
var that = this;
|
|
276
|
+
setTimer(this.batchTimeoutTimer, this.batchTimeout, function() {
|
|
277
|
+
that.sendBatch.call(that);
|
|
278
|
+
});
|
|
279
|
+
};
|
|
280
|
+
Appender$1.prototype.batchBufferHasOverdueMessages = function() {
|
|
281
|
+
for (var i = 0; i < this.batchBuffer.length; i++) if (JL$1._getTime() - this.batchBuffer[i].t > this.batchTimeout) return true;
|
|
282
|
+
return false;
|
|
283
|
+
};
|
|
284
|
+
Appender$1.prototype.batchBufferHasStrandedMessage = function() {
|
|
285
|
+
return !(JL$1.maxMessages == null) && JL$1.maxMessages < 1 && this.batchBuffer.length > 0;
|
|
286
|
+
};
|
|
287
|
+
Appender$1.prototype.sendBatchIfComplete = function() {
|
|
288
|
+
if (this.batchBuffer.length >= this.batchSize || this.batchBufferHasOverdueMessages() || this.batchBufferHasStrandedMessage()) this.sendBatch();
|
|
289
|
+
};
|
|
290
|
+
Appender$1.prototype.onSendingEnded = function() {
|
|
291
|
+
clearTimer(this.sendTimeoutTimer);
|
|
292
|
+
this.nbrLogItemsBeingSent = 0;
|
|
293
|
+
this.sendBatchIfComplete();
|
|
294
|
+
};
|
|
295
|
+
Appender$1.prototype.setOptions = function(options) {
|
|
296
|
+
copyProperty("level", options, this);
|
|
297
|
+
copyProperty("ipRegex", options, this);
|
|
298
|
+
copyProperty("userAgentRegex", options, this);
|
|
299
|
+
copyProperty("disallow", options, this);
|
|
300
|
+
copyProperty("sendWithBufferLevel", options, this);
|
|
301
|
+
copyProperty("storeInBufferLevel", options, this);
|
|
302
|
+
copyProperty("bufferSize", options, this);
|
|
303
|
+
copyProperty("batchSize", options, this);
|
|
304
|
+
copyProperty("maxBatchSize", options, this);
|
|
305
|
+
copyProperty("batchTimeout", options, this);
|
|
306
|
+
copyProperty("sendTimeout", options, this);
|
|
307
|
+
if (this.bufferSize < this.buffer.length) this.buffer.length = this.bufferSize;
|
|
308
|
+
if (this.maxBatchSize < this.batchSize) throw new JL$1.Exception({
|
|
309
|
+
"message": "maxBatchSize cannot be smaller than batchSize",
|
|
310
|
+
"maxBatchSize": this.maxBatchSize,
|
|
311
|
+
"batchSize": this.batchSize
|
|
312
|
+
});
|
|
313
|
+
return this;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
Called by a logger to log a log item.
|
|
317
|
+
If in response to this call one or more log items need to be processed
|
|
318
|
+
(eg., sent to the server), this method calls this.sendLogItems
|
|
319
|
+
with an array with all items to be processed.
|
|
320
|
+
|
|
321
|
+
Note that the name and parameters of this function must match those of the log function of
|
|
322
|
+
a Winston transport object, so that users can use these transports as appenders.
|
|
323
|
+
That is why there are many parameters that are not actually used by this function.
|
|
324
|
+
|
|
325
|
+
level - string with the level ("trace", "debug", etc.) Only used by Winston transports.
|
|
326
|
+
msg - human readable message. Undefined if the log item is an object. Only used by Winston transports.
|
|
327
|
+
meta - log object. Always defined, because at least it contains the logger name. Only used by Winston transports.
|
|
328
|
+
callback - function that is called when the log item has been logged. Only used by Winston transports.
|
|
329
|
+
levelNbr - level as a number. Not used by Winston transports.
|
|
330
|
+
message - log item. If the user logged an object, this is the JSON string. Not used by Winston transports.
|
|
331
|
+
loggerName: name of the logger. Not used by Winston transports.
|
|
332
|
+
*/
|
|
333
|
+
Appender$1.prototype.log = function(level, msg, meta, callback, levelNbr, message, loggerName) {
|
|
334
|
+
var logItem;
|
|
335
|
+
if (!allow(this)) return;
|
|
336
|
+
if (!allowMessage(this, message)) return;
|
|
337
|
+
if (levelNbr < this.storeInBufferLevel) return;
|
|
338
|
+
logItem = newLogItem(levelNbr, message, loggerName);
|
|
339
|
+
if (levelNbr < this.level) {
|
|
340
|
+
if (this.bufferSize > 0) {
|
|
341
|
+
this.buffer.push(logItem);
|
|
342
|
+
if (this.buffer.length > this.bufferSize) this.buffer.shift();
|
|
343
|
+
}
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
this.addLogItemsToBuffer([logItem]);
|
|
347
|
+
if (levelNbr >= this.sendWithBufferLevel) {
|
|
348
|
+
if (this.buffer.length) {
|
|
349
|
+
this.addLogItemsToBuffer(this.buffer);
|
|
350
|
+
this.buffer.length = 0;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
this.sendBatchIfComplete();
|
|
354
|
+
};
|
|
355
|
+
Appender$1.prototype.sendBatch = function() {
|
|
356
|
+
if (this.nbrLogItemsBeingSent > 0) return;
|
|
357
|
+
clearTimer(this.batchTimeoutTimer);
|
|
358
|
+
if (this.batchBuffer.length == 0) return;
|
|
359
|
+
this.nbrLogItemsBeingSent = this.batchBuffer.length;
|
|
360
|
+
var that = this;
|
|
361
|
+
setTimer(this.sendTimeoutTimer, this.sendTimeout, function() {
|
|
362
|
+
that.onSendingEnded.call(that);
|
|
363
|
+
});
|
|
364
|
+
this.sendLogItems(this.batchBuffer, function() {
|
|
365
|
+
that.batchBuffer.splice(0, that.nbrLogItemsBeingSent);
|
|
366
|
+
if (that.nbrLogItemsSkipped > 0) {
|
|
367
|
+
that.batchBuffer.push(newLogItem(getWarnLevel(), "Lost " + that.nbrLogItemsSkipped + " messages. Either connection with the server was down or logging was disabled via the enabled option. Reduce lost messages by increasing the ajaxAppender option maxBatchSize.", that.appenderName));
|
|
368
|
+
that.nbrLogItemsSkipped = 0;
|
|
369
|
+
}
|
|
370
|
+
that.onSendingEnded.call(that);
|
|
371
|
+
});
|
|
372
|
+
};
|
|
373
|
+
return Appender$1;
|
|
374
|
+
}();
|
|
375
|
+
JL$1.Appender = Appender;
|
|
376
|
+
var AjaxAppender = function(_super) {
|
|
377
|
+
__extends(AjaxAppender$1, _super);
|
|
378
|
+
function AjaxAppender$1(appenderName) {
|
|
379
|
+
return _super.call(this, appenderName, AjaxAppender$1.prototype.sendLogItemsAjax) || this;
|
|
380
|
+
}
|
|
381
|
+
AjaxAppender$1.prototype.setOptions = function(options) {
|
|
382
|
+
copyProperty("url", options, this);
|
|
383
|
+
copyProperty("beforeSend", options, this);
|
|
384
|
+
_super.prototype.setOptions.call(this, options);
|
|
385
|
+
return this;
|
|
386
|
+
};
|
|
387
|
+
AjaxAppender$1.prototype.sendLogItemsAjax = function(logItems, successCallback) {
|
|
388
|
+
try {
|
|
389
|
+
if (!allow(this)) return;
|
|
390
|
+
if (this.xhr && this.xhr.readyState != 0 && this.xhr.readyState != 4) this.xhr.abort();
|
|
391
|
+
this.xhr = JL$1._createXMLHttpRequest();
|
|
392
|
+
var ajaxUrl = "/jsnlog.logger";
|
|
393
|
+
if (!(JL$1.defaultAjaxUrl == null)) ajaxUrl = JL$1.defaultAjaxUrl;
|
|
394
|
+
if (this.url) ajaxUrl = this.url;
|
|
395
|
+
this.xhr.open("POST", ajaxUrl);
|
|
396
|
+
this.xhr.setRequestHeader("Content-Type", "application/json");
|
|
397
|
+
this.xhr.setRequestHeader("JSNLog-RequestId", JL$1.requestId);
|
|
398
|
+
var that = this;
|
|
399
|
+
this.xhr.onreadystatechange = function() {
|
|
400
|
+
if (that.xhr.readyState == 4 && that.xhr.status >= 200 && that.xhr.status < 300) successCallback();
|
|
401
|
+
};
|
|
402
|
+
var json = {
|
|
403
|
+
r: JL$1.requestId,
|
|
404
|
+
lg: logItems
|
|
405
|
+
};
|
|
406
|
+
if (typeof this.beforeSend === "function") this.beforeSend.call(this, this.xhr, json);
|
|
407
|
+
else if (typeof JL$1.defaultBeforeSend === "function") JL$1.defaultBeforeSend.call(this, this.xhr, json);
|
|
408
|
+
var finalmsg = JSON.stringify(json);
|
|
409
|
+
this.xhr.send(finalmsg);
|
|
410
|
+
} catch (e) {}
|
|
411
|
+
};
|
|
412
|
+
return AjaxAppender$1;
|
|
413
|
+
}(Appender);
|
|
414
|
+
JL$1.AjaxAppender = AjaxAppender;
|
|
415
|
+
var ConsoleAppender = function(_super) {
|
|
416
|
+
__extends(ConsoleAppender$1, _super);
|
|
417
|
+
function ConsoleAppender$1(appenderName) {
|
|
418
|
+
return _super.call(this, appenderName, ConsoleAppender$1.prototype.sendLogItemsConsole) || this;
|
|
419
|
+
}
|
|
420
|
+
ConsoleAppender$1.prototype.clog = function(logEntry) {
|
|
421
|
+
JL$1._console.log(logEntry);
|
|
422
|
+
};
|
|
423
|
+
ConsoleAppender$1.prototype.cerror = function(logEntry) {
|
|
424
|
+
if (JL$1._console.error) JL$1._console.error(logEntry);
|
|
425
|
+
else this.clog(logEntry);
|
|
426
|
+
};
|
|
427
|
+
ConsoleAppender$1.prototype.cwarn = function(logEntry) {
|
|
428
|
+
if (JL$1._console.warn) JL$1._console.warn(logEntry);
|
|
429
|
+
else this.clog(logEntry);
|
|
430
|
+
};
|
|
431
|
+
ConsoleAppender$1.prototype.cinfo = function(logEntry) {
|
|
432
|
+
if (JL$1._console.info) JL$1._console.info(logEntry);
|
|
433
|
+
else this.clog(logEntry);
|
|
434
|
+
};
|
|
435
|
+
ConsoleAppender$1.prototype.cdebug = function(logEntry) {
|
|
436
|
+
if (JL$1._console.debug) JL$1._console.debug(logEntry);
|
|
437
|
+
else this.cinfo(logEntry);
|
|
438
|
+
};
|
|
439
|
+
ConsoleAppender$1.prototype.sendLogItemsConsole = function(logItems, successCallback) {
|
|
440
|
+
try {
|
|
441
|
+
if (!allow(this)) return;
|
|
442
|
+
if (!JL$1._console) return;
|
|
443
|
+
var i;
|
|
444
|
+
for (i = 0; i < logItems.length; ++i) {
|
|
445
|
+
var li = logItems[i];
|
|
446
|
+
var msg = li.n + ": " + li.m;
|
|
447
|
+
if (typeof window === "undefined") msg = new Date(li.t) + " | " + msg;
|
|
448
|
+
if (li.l <= JL$1.getDebugLevel()) this.cdebug(msg);
|
|
449
|
+
else if (li.l <= JL$1.getInfoLevel()) this.cinfo(msg);
|
|
450
|
+
else if (li.l <= JL$1.getWarnLevel()) this.cwarn(msg);
|
|
451
|
+
else this.cerror(msg);
|
|
452
|
+
}
|
|
453
|
+
} catch (e) {}
|
|
454
|
+
successCallback();
|
|
455
|
+
};
|
|
456
|
+
return ConsoleAppender$1;
|
|
457
|
+
}(Appender);
|
|
458
|
+
JL$1.ConsoleAppender = ConsoleAppender;
|
|
459
|
+
JL$1.Logger = function() {
|
|
460
|
+
function Logger(loggerName) {
|
|
461
|
+
this.loggerName = loggerName;
|
|
462
|
+
this.seenRegexes = [];
|
|
463
|
+
}
|
|
464
|
+
Logger.prototype.setOptions = function(options) {
|
|
465
|
+
copyProperty("level", options, this);
|
|
466
|
+
copyProperty("userAgentRegex", options, this);
|
|
467
|
+
copyProperty("disallow", options, this);
|
|
468
|
+
copyProperty("ipRegex", options, this);
|
|
469
|
+
copyProperty("appenders", options, this);
|
|
470
|
+
copyProperty("onceOnly", options, this);
|
|
471
|
+
this.seenRegexes = [];
|
|
472
|
+
return this;
|
|
473
|
+
};
|
|
474
|
+
Logger.prototype.buildExceptionObject = function(e) {
|
|
475
|
+
var excObject = {};
|
|
476
|
+
if (e.stack) excObject.stack = e.stack;
|
|
477
|
+
else excObject.e = e;
|
|
478
|
+
if (e.message) excObject.message = e.message;
|
|
479
|
+
if (e.name) excObject.name = e.name;
|
|
480
|
+
if (e.data) excObject.data = e.data;
|
|
481
|
+
if (e.inner) excObject.inner = this.buildExceptionObject(e.inner);
|
|
482
|
+
return excObject;
|
|
483
|
+
};
|
|
484
|
+
Logger.prototype.log = function(level, logObject, e) {
|
|
485
|
+
var i = 0;
|
|
486
|
+
var compositeMessage;
|
|
487
|
+
var excObject;
|
|
488
|
+
if (!this.appenders) return this;
|
|
489
|
+
if (level >= this.level && allow(this)) {
|
|
490
|
+
if (e) {
|
|
491
|
+
excObject = this.buildExceptionObject(e);
|
|
492
|
+
excObject.logData = stringifyLogObjectFunction(logObject);
|
|
493
|
+
} else excObject = logObject;
|
|
494
|
+
compositeMessage = stringifyLogObject(excObject);
|
|
495
|
+
if (allowMessage(this, compositeMessage.finalString)) {
|
|
496
|
+
if (this.onceOnly) {
|
|
497
|
+
i = this.onceOnly.length - 1;
|
|
498
|
+
while (i >= 0) {
|
|
499
|
+
if (new RegExp(this.onceOnly[i]).test(compositeMessage.finalString)) {
|
|
500
|
+
if (this.seenRegexes[i]) return this;
|
|
501
|
+
this.seenRegexes[i] = true;
|
|
502
|
+
}
|
|
503
|
+
i--;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
compositeMessage.meta = compositeMessage.meta || {};
|
|
507
|
+
i = this.appenders.length - 1;
|
|
508
|
+
while (i >= 0) {
|
|
509
|
+
this.appenders[i].log(levelToString(level), compositeMessage.msg, compositeMessage.meta, function() {}, level, compositeMessage.finalString, this.loggerName);
|
|
510
|
+
i--;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return this;
|
|
515
|
+
};
|
|
516
|
+
Logger.prototype.trace = function(logObject) {
|
|
517
|
+
return this.log(getTraceLevel(), logObject);
|
|
518
|
+
};
|
|
519
|
+
Logger.prototype.debug = function(logObject) {
|
|
520
|
+
return this.log(getDebugLevel(), logObject);
|
|
521
|
+
};
|
|
522
|
+
Logger.prototype.info = function(logObject) {
|
|
523
|
+
return this.log(getInfoLevel(), logObject);
|
|
524
|
+
};
|
|
525
|
+
Logger.prototype.warn = function(logObject) {
|
|
526
|
+
return this.log(getWarnLevel(), logObject);
|
|
527
|
+
};
|
|
528
|
+
Logger.prototype.error = function(logObject) {
|
|
529
|
+
return this.log(getErrorLevel(), logObject);
|
|
530
|
+
};
|
|
531
|
+
Logger.prototype.fatal = function(logObject) {
|
|
532
|
+
return this.log(getFatalLevel(), logObject);
|
|
533
|
+
};
|
|
534
|
+
Logger.prototype.fatalException = function(logObject, e) {
|
|
535
|
+
return this.log(getFatalLevel(), logObject, e);
|
|
536
|
+
};
|
|
537
|
+
return Logger;
|
|
538
|
+
}();
|
|
539
|
+
function createAjaxAppender(appenderName) {
|
|
540
|
+
return new AjaxAppender(appenderName);
|
|
541
|
+
}
|
|
542
|
+
JL$1.createAjaxAppender = createAjaxAppender;
|
|
543
|
+
function createConsoleAppender(appenderName) {
|
|
544
|
+
return new ConsoleAppender(appenderName);
|
|
545
|
+
}
|
|
546
|
+
JL$1.createConsoleAppender = createConsoleAppender;
|
|
547
|
+
var defaultAppender;
|
|
548
|
+
if (typeof window !== "undefined") defaultAppender = new AjaxAppender("");
|
|
549
|
+
else defaultAppender = new ConsoleAppender("");
|
|
550
|
+
JL$1.__ = new JL$1.Logger("");
|
|
551
|
+
JL$1.__.setOptions({
|
|
552
|
+
level: JL$1.getDebugLevel(),
|
|
553
|
+
appenders: [defaultAppender]
|
|
554
|
+
});
|
|
555
|
+
})(JL || (JL = {}));
|
|
556
|
+
if (typeof exports !== "undefined") {
|
|
557
|
+
exports.__esModule = true;
|
|
558
|
+
exports.JL = JL;
|
|
559
|
+
}
|
|
560
|
+
var define;
|
|
561
|
+
if (typeof define == "function" && define.amd) define("jsnlog", [], function() {
|
|
562
|
+
return JL;
|
|
563
|
+
});
|
|
564
|
+
if (typeof __jsnlog_configure == "function") __jsnlog_configure(JL);
|
|
565
|
+
if (typeof window !== "undefined" && !window.onerror) window.onerror = function(errorMsg, url, lineNumber, column, errorObj) {
|
|
566
|
+
JL("onerrorLogger").fatalException({
|
|
567
|
+
"msg": "Uncaught Exception",
|
|
568
|
+
"errorMsg": errorMsg ? errorMsg.message || errorMsg : "",
|
|
569
|
+
"url": url,
|
|
570
|
+
"line number": lineNumber,
|
|
571
|
+
"column": column
|
|
572
|
+
}, errorObj);
|
|
573
|
+
return false;
|
|
574
|
+
};
|
|
575
|
+
if (typeof window !== "undefined" && !window.onunhandledrejection) window.onunhandledrejection = function(event) {
|
|
576
|
+
JL("onerrorLogger").fatalException({
|
|
577
|
+
"msg": "unhandledrejection",
|
|
578
|
+
"errorMsg": event.reason ? event.reason.message : event.message || null
|
|
579
|
+
}, event.reason);
|
|
580
|
+
};
|
|
581
|
+
}) });
|
|
582
|
+
|
|
583
|
+
//#endregion
|
|
584
|
+
//#region ../../node_modules/.pnpm/openvidu-browser@2.32.1/node_modules/openvidu-browser/lib/OpenViduInternal/Logger/ConsoleLogger.js
|
|
585
|
+
var require_ConsoleLogger = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/openvidu-browser@2.32.1/node_modules/openvidu-browser/lib/OpenViduInternal/Logger/ConsoleLogger.js": ((exports) => {
|
|
586
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
587
|
+
exports.ConsoleLogger = void 0;
|
|
588
|
+
var ConsoleLogger = class {
|
|
589
|
+
constructor(console$1) {
|
|
590
|
+
this.logger = console$1;
|
|
591
|
+
this.log = console$1.log, this.info = console$1.info, this.debug = console$1.debug, this.warn = console$1.warn, this.error = console$1.error;
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
exports.ConsoleLogger = ConsoleLogger;
|
|
595
|
+
}) });
|
|
596
|
+
|
|
597
|
+
//#endregion
|
|
598
|
+
//#region ../../node_modules/.pnpm/openvidu-browser@2.32.1/node_modules/openvidu-browser/lib/OpenViduInternal/Logger/OpenViduLoggerConfiguration.js
|
|
599
|
+
var require_OpenViduLoggerConfiguration = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/openvidu-browser@2.32.1/node_modules/openvidu-browser/lib/OpenViduInternal/Logger/OpenViduLoggerConfiguration.js": ((exports) => {
|
|
600
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
601
|
+
exports.OpenViduLoggerConfiguration = void 0;
|
|
602
|
+
var OpenViduLoggerConfiguration;
|
|
603
|
+
(function(OpenViduLoggerConfiguration$1) {
|
|
604
|
+
OpenViduLoggerConfiguration$1["disabled"] = "disabled";
|
|
605
|
+
OpenViduLoggerConfiguration$1["debug"] = "debug";
|
|
606
|
+
OpenViduLoggerConfiguration$1["debug_app"] = "debug_app";
|
|
607
|
+
})(OpenViduLoggerConfiguration || (exports.OpenViduLoggerConfiguration = OpenViduLoggerConfiguration = {}));
|
|
608
|
+
}) });
|
|
609
|
+
|
|
610
|
+
//#endregion
|
|
611
|
+
//#region ../../node_modules/.pnpm/openvidu-browser@2.32.1/node_modules/openvidu-browser/lib/OpenViduInternal/Logger/OpenViduLogger.js
|
|
612
|
+
var require_OpenViduLogger = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/openvidu-browser@2.32.1/node_modules/openvidu-browser/lib/OpenViduInternal/Logger/OpenViduLogger.js": ((exports) => {
|
|
613
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
614
|
+
exports.OpenViduLogger = void 0;
|
|
615
|
+
const jsnlog_1 = require_jsnlog();
|
|
616
|
+
const ConsoleLogger_1 = require_ConsoleLogger();
|
|
617
|
+
const OpenViduLoggerConfiguration_1 = require_OpenViduLoggerConfiguration();
|
|
618
|
+
var OpenViduLogger = class OpenViduLogger {
|
|
619
|
+
constructor() {
|
|
620
|
+
this.JSNLOG_URL = "/openvidu/elk/openvidu-browser-logs";
|
|
621
|
+
this.MAX_JSNLOG_BATCH_LOG_MESSAGES = 100;
|
|
622
|
+
this.MAX_MSECONDS_BATCH_MESSAGES = 5e3;
|
|
623
|
+
this.MAX_LENGTH_STRING_JSON = 1e3;
|
|
624
|
+
this.defaultConsoleLogger = new ConsoleLogger_1.ConsoleLogger(globalThis.console);
|
|
625
|
+
this.isProdMode = false;
|
|
626
|
+
this.isJSNLogSetup = false;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* @hidden
|
|
630
|
+
*/
|
|
631
|
+
static configureJSNLog(openVidu, token) {
|
|
632
|
+
try {
|
|
633
|
+
if (globalThis["LOG_JSNLOG_RESULTS"] || this.instance && openVidu.isAtLeastPro && this.instance.isOpenViduBrowserLogsDebugActive(openVidu) && this.instance.canConfigureJSNLog(openVidu, this.instance)) {
|
|
634
|
+
if (openVidu.sendBrowserLogs === OpenViduLoggerConfiguration_1.OpenViduLoggerConfiguration.debug_app) this.instance.replaceWindowConsole();
|
|
635
|
+
this.instance.isJSNLogSetup = false;
|
|
636
|
+
this.instance.info("Configuring JSNLogs.");
|
|
637
|
+
const finalUserId = openVidu.finalUserId;
|
|
638
|
+
const sessionId = openVidu.session.sessionId;
|
|
639
|
+
const beforeSendCallback = (xhr) => {
|
|
640
|
+
const parentReadyStateFunction = xhr.onreadystatechange;
|
|
641
|
+
xhr.onreadystatechange = () => {
|
|
642
|
+
if (this.isInvalidResponse(xhr)) {
|
|
643
|
+
Object.defineProperty(xhr, "readyState", { value: 4 });
|
|
644
|
+
Object.defineProperty(xhr, "status", { value: 200 });
|
|
645
|
+
this.instance.disableLogger();
|
|
646
|
+
}
|
|
647
|
+
parentReadyStateFunction();
|
|
648
|
+
};
|
|
649
|
+
xhr.setRequestHeader("Authorization", "Basic " + btoa(`${finalUserId}%/%${sessionId}:` + token));
|
|
650
|
+
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
|
651
|
+
xhr.setRequestHeader("OV-Final-User-Id", finalUserId);
|
|
652
|
+
xhr.setRequestHeader("OV-Session-Id", sessionId);
|
|
653
|
+
xhr.setRequestHeader("OV-Token", token);
|
|
654
|
+
};
|
|
655
|
+
this.instance.currentAppender = jsnlog_1.JL.createAjaxAppender(`appender-${finalUserId}-${sessionId}`);
|
|
656
|
+
this.instance.currentAppender.setOptions({
|
|
657
|
+
beforeSend: beforeSendCallback,
|
|
658
|
+
maxBatchSize: 1e3,
|
|
659
|
+
batchSize: this.instance.MAX_JSNLOG_BATCH_LOG_MESSAGES,
|
|
660
|
+
batchTimeout: this.instance.MAX_MSECONDS_BATCH_MESSAGES
|
|
661
|
+
});
|
|
662
|
+
const logSerializer = (obj) => {
|
|
663
|
+
const getCircularReplacer = () => {
|
|
664
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
665
|
+
return (key, value) => {
|
|
666
|
+
if (typeof value === "object" && value != null) {
|
|
667
|
+
if (seen.has(value) || globalThis.HTMLElement && value instanceof HTMLElement) return;
|
|
668
|
+
seen.add(value);
|
|
669
|
+
}
|
|
670
|
+
return value;
|
|
671
|
+
};
|
|
672
|
+
};
|
|
673
|
+
let stringifyJson = JSON.stringify(obj, getCircularReplacer());
|
|
674
|
+
if (stringifyJson.length > this.instance.MAX_LENGTH_STRING_JSON) stringifyJson = `${stringifyJson.substring(0, this.instance.MAX_LENGTH_STRING_JSON)}...`;
|
|
675
|
+
if (globalThis["LOG_JSNLOG_RESULTS"]) console.log(stringifyJson);
|
|
676
|
+
return stringifyJson;
|
|
677
|
+
};
|
|
678
|
+
jsnlog_1.JL.setOptions({
|
|
679
|
+
defaultAjaxUrl: openVidu.httpUri + this.instance.JSNLOG_URL,
|
|
680
|
+
serialize: logSerializer,
|
|
681
|
+
enabled: true
|
|
682
|
+
});
|
|
683
|
+
(0, jsnlog_1.JL)().setOptions({ appenders: [this.instance.currentAppender] });
|
|
684
|
+
this.instance.isJSNLogSetup = true;
|
|
685
|
+
this.instance.loggingSessionId = sessionId;
|
|
686
|
+
this.instance.info("JSNLog configured.");
|
|
687
|
+
}
|
|
688
|
+
} catch (e) {
|
|
689
|
+
console.error("Error configuring JSNLog: ");
|
|
690
|
+
console.error(e);
|
|
691
|
+
this.instance.disableLogger();
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* @hidden
|
|
696
|
+
*/
|
|
697
|
+
static getInstance() {
|
|
698
|
+
if (!OpenViduLogger.instance) OpenViduLogger.instance = new OpenViduLogger();
|
|
699
|
+
return OpenViduLogger.instance;
|
|
700
|
+
}
|
|
701
|
+
static isInvalidResponse(xhr) {
|
|
702
|
+
return xhr.status == 401 || xhr.status == 403 || xhr.status == 404 || xhr.status == 0;
|
|
703
|
+
}
|
|
704
|
+
canConfigureJSNLog(openVidu, logger) {
|
|
705
|
+
return openVidu.session.sessionId != logger.loggingSessionId;
|
|
706
|
+
}
|
|
707
|
+
isOpenViduBrowserLogsDebugActive(openVidu) {
|
|
708
|
+
return openVidu.sendBrowserLogs === OpenViduLoggerConfiguration_1.OpenViduLoggerConfiguration.debug || openVidu.sendBrowserLogs === OpenViduLoggerConfiguration_1.OpenViduLoggerConfiguration.debug_app;
|
|
709
|
+
}
|
|
710
|
+
getConsoleWithJSNLog() {
|
|
711
|
+
return (function(openViduLogger) {
|
|
712
|
+
return {
|
|
713
|
+
log: function(...args) {
|
|
714
|
+
openViduLogger.defaultConsoleLogger.log.apply(openViduLogger.defaultConsoleLogger.logger, arguments);
|
|
715
|
+
if (openViduLogger.isJSNLogSetup) (0, jsnlog_1.JL)().info(arguments);
|
|
716
|
+
},
|
|
717
|
+
info: function(...args) {
|
|
718
|
+
openViduLogger.defaultConsoleLogger.info.apply(openViduLogger.defaultConsoleLogger.logger, arguments);
|
|
719
|
+
if (openViduLogger.isJSNLogSetup) (0, jsnlog_1.JL)().info(arguments);
|
|
720
|
+
},
|
|
721
|
+
debug: function(...args) {
|
|
722
|
+
openViduLogger.defaultConsoleLogger.debug.apply(openViduLogger.defaultConsoleLogger.logger, arguments);
|
|
723
|
+
},
|
|
724
|
+
warn: function(...args) {
|
|
725
|
+
openViduLogger.defaultConsoleLogger.warn.apply(openViduLogger.defaultConsoleLogger.logger, arguments);
|
|
726
|
+
if (openViduLogger.isJSNLogSetup) (0, jsnlog_1.JL)().warn(arguments);
|
|
727
|
+
},
|
|
728
|
+
error: function(...args) {
|
|
729
|
+
openViduLogger.defaultConsoleLogger.error.apply(openViduLogger.defaultConsoleLogger.logger, arguments);
|
|
730
|
+
if (openViduLogger.isJSNLogSetup) (0, jsnlog_1.JL)().error(arguments);
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
})(this);
|
|
734
|
+
}
|
|
735
|
+
replaceWindowConsole() {
|
|
736
|
+
globalThis.console = this.defaultConsoleLogger.logger;
|
|
737
|
+
globalThis.console.log = this.getConsoleWithJSNLog().log;
|
|
738
|
+
globalThis.console.info = this.getConsoleWithJSNLog().info;
|
|
739
|
+
globalThis.console.debug = this.getConsoleWithJSNLog().debug;
|
|
740
|
+
globalThis.console.warn = this.getConsoleWithJSNLog().warn;
|
|
741
|
+
globalThis.console.error = this.getConsoleWithJSNLog().error;
|
|
742
|
+
}
|
|
743
|
+
disableLogger() {
|
|
744
|
+
jsnlog_1.JL.setOptions({ enabled: false });
|
|
745
|
+
this.isJSNLogSetup = false;
|
|
746
|
+
this.loggingSessionId = void 0;
|
|
747
|
+
this.currentAppender = void 0;
|
|
748
|
+
globalThis.console = this.defaultConsoleLogger.logger;
|
|
749
|
+
globalThis.console.log = this.defaultConsoleLogger.log;
|
|
750
|
+
globalThis.console.info = this.defaultConsoleLogger.info;
|
|
751
|
+
globalThis.console.debug = this.defaultConsoleLogger.debug;
|
|
752
|
+
globalThis.console.warn = this.defaultConsoleLogger.warn;
|
|
753
|
+
globalThis.console.error = this.defaultConsoleLogger.error;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* @hidden
|
|
757
|
+
*/
|
|
758
|
+
log(...args) {
|
|
759
|
+
if (!this.isProdMode) this.defaultConsoleLogger.log.apply(this.defaultConsoleLogger.logger, arguments);
|
|
760
|
+
if (this.isJSNLogSetup) (0, jsnlog_1.JL)().info(arguments);
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* @hidden
|
|
764
|
+
*/
|
|
765
|
+
debug(...args) {
|
|
766
|
+
if (!this.isProdMode) this.defaultConsoleLogger.debug.apply(this.defaultConsoleLogger.logger, arguments);
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* @hidden
|
|
770
|
+
*/
|
|
771
|
+
info(...args) {
|
|
772
|
+
if (!this.isProdMode) this.defaultConsoleLogger.info.apply(this.defaultConsoleLogger.logger, arguments);
|
|
773
|
+
if (this.isJSNLogSetup) (0, jsnlog_1.JL)().info(arguments);
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* @hidden
|
|
777
|
+
*/
|
|
778
|
+
warn(...args) {
|
|
779
|
+
this.defaultConsoleLogger.warn.apply(this.defaultConsoleLogger.logger, arguments);
|
|
780
|
+
if (this.isJSNLogSetup) (0, jsnlog_1.JL)().warn(arguments);
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* @hidden
|
|
784
|
+
*/
|
|
785
|
+
error(...args) {
|
|
786
|
+
this.defaultConsoleLogger.error.apply(this.defaultConsoleLogger.logger, arguments);
|
|
787
|
+
if (this.isJSNLogSetup) (0, jsnlog_1.JL)().error(arguments);
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* @hidden
|
|
791
|
+
*/
|
|
792
|
+
flush() {
|
|
793
|
+
if (this.isJSNLogSetup && this.currentAppender != null) this.currentAppender.sendBatch();
|
|
794
|
+
}
|
|
795
|
+
enableProdMode() {
|
|
796
|
+
this.isProdMode = true;
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
exports.OpenViduLogger = OpenViduLogger;
|
|
800
|
+
}) });
|
|
801
|
+
|
|
802
|
+
//#endregion
|
|
803
|
+
export { require_jsnlog as n, require_OpenViduLogger as t };
|