@cloudcare/browser-logs 3.1.8 → 3.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/bundle/dataflux-logs.js +1 -1
  2. package/cjs/boot/buildEnv.js +1 -1
  3. package/cjs/boot/startLogs.js +1 -2
  4. package/cjs/boot/startLogs.js.map +1 -1
  5. package/cjs/domain/assembly.js +1 -3
  6. package/cjs/domain/assembly.js.map +1 -1
  7. package/cjs/domain/logger.js +3 -0
  8. package/cjs/domain/logger.js.map +1 -1
  9. package/cjs/domain/logsCollection/console/consoleCollection.js +0 -1
  10. package/cjs/domain/logsCollection/console/consoleCollection.js.map +1 -1
  11. package/cjs/domain/logsCollection/networkError/networkErrorCollection.js +0 -8
  12. package/cjs/domain/logsCollection/networkError/networkErrorCollection.js.map +1 -1
  13. package/cjs/domain/logsCollection/report/reportCollection.js +0 -1
  14. package/cjs/domain/logsCollection/report/reportCollection.js.map +1 -1
  15. package/cjs/domain/logsCollection/rumtimeError/runtimeErrorCollection.js +0 -1
  16. package/cjs/domain/logsCollection/rumtimeError/runtimeErrorCollection.js.map +1 -1
  17. package/esm/boot/buildEnv.js +1 -1
  18. package/esm/boot/startLogs.js +1 -2
  19. package/esm/boot/startLogs.js.map +1 -1
  20. package/esm/domain/assembly.js +1 -3
  21. package/esm/domain/assembly.js.map +1 -1
  22. package/esm/domain/logger.js +3 -0
  23. package/esm/domain/logger.js.map +1 -1
  24. package/esm/domain/logsCollection/console/consoleCollection.js +0 -1
  25. package/esm/domain/logsCollection/console/consoleCollection.js.map +1 -1
  26. package/esm/domain/logsCollection/networkError/networkErrorCollection.js +0 -8
  27. package/esm/domain/logsCollection/networkError/networkErrorCollection.js.map +1 -1
  28. package/esm/domain/logsCollection/report/reportCollection.js +0 -1
  29. package/esm/domain/logsCollection/report/reportCollection.js.map +1 -1
  30. package/esm/domain/logsCollection/rumtimeError/runtimeErrorCollection.js +0 -1
  31. package/esm/domain/logsCollection/rumtimeError/runtimeErrorCollection.js.map +1 -1
  32. package/package.json +5 -4
  33. package/src/boot/startLogs.js +1 -1
  34. package/src/domain/assembly.js +0 -1
  35. package/src/domain/logger.js +3 -1
  36. package/src/domain/logsCollection/console/consoleCollection.js +17 -10
  37. package/src/domain/logsCollection/networkError/networkErrorCollection.js +2 -7
  38. package/src/domain/logsCollection/report/reportCollection.js +1 -1
  39. package/src/domain/logsCollection/rumtimeError/runtimeErrorCollection.js +14 -8
  40. package/types/configuration.d.ts +12 -0
  41. package/types/index.d.ts +30 -0
  42. package/types/logger.d.ts +71 -0
@@ -43,12 +43,10 @@ function startNetworkErrorCollection(configuration, lifeCycle) {
43
43
  date: request.startClocks.timeStamp,
44
44
  error: {
45
45
  origin: _browserCore.ErrorSource.NETWORK,
46
- // Todo: Remove in the next major release
47
46
  stack: responseData || 'Failed to load'
48
47
  },
49
48
  http: {
50
49
  method: request.method,
51
- // Cast resource method because of case mismatch cf issue RUMF-1152
52
50
  status_code: request.status,
53
51
  url: request.url,
54
52
  statusGroup: (0, _browserCore.getStatusGroup)(request.status),
@@ -69,12 +67,6 @@ function startNetworkErrorCollection(configuration, lifeCycle) {
69
67
  }
70
68
  };
71
69
  }
72
-
73
- // TODO: ideally, computeXhrResponseData should always call the callback with a string instead of
74
- // `unknown`. But to keep backward compatibility, in the case of XHR with a `responseType` different
75
- // than "text", the response data should be whatever `xhr.response` is. This is a bit confusing as
76
- // Logs event 'stack' is expected to be a string. This should be changed in a future major version
77
- // as it could be a breaking change.
78
70
  function computeXhrResponseData(xhr, configuration, callback) {
79
71
  if (typeof xhr.response === 'string') {
80
72
  callback(truncateResponseText(xhr.response, configuration));
@@ -1 +1 @@
1
- {"version":3,"file":"networkErrorCollection.js","names":["_browserCore","require","_logger","startNetworkErrorCollection","configuration","lifeCycle","forwardErrorsToLogs","stop","noop","xhrSubscription","initXhrObservable","subscribe","context","state","handleCompleteRequest","RequestType","XHR","fetchSubscription","initFetchObservable","FETCH","type","request","isIntakeUrl","url","isRejected","isServerError","computeXhrResponseData","xhr","onResponseDataAvailable","response","computeFetchResponseText","error","computeFetchErrorText","responseData","urlObj","urlParse","getParse","notify","LifeCycleEventType","RAW_LOG_COLLECTED","rawLogsEvent","message","format","method","date","startClocks","timeStamp","origin","ErrorSource","NETWORK","stack","http","status_code","status","statusGroup","getStatusGroup","urlHost","Host","urlPath","Path","urlPathGroup","replaceNumberCharByPath","StatusType","unsubscribe","callback","truncateResponseText","toStackTraceString","computeStackTrace","clonedResponse","tryToClone","body","window","TextDecoder","text","then","monitor","truncateResponseStream","requestErrorResponseLengthLimit","responseText","responseType","length","substring","stream","bytesLimit","readBytesFromStream","bytes","limitExceeded","decode","undefined","collectStreamBody"],"sources":["../../../../src/domain/logsCollection/networkError/networkErrorCollection.js"],"sourcesContent":["import {\n ErrorSource,\n initXhrObservable,\n RequestType,\n initFetchObservable,\n computeStackTrace,\n toStackTraceString,\n noop,\n each,\n LifeCycleEventType,\n getStatusGroup,\n urlParse,\n replaceNumberCharByPath,\n tryToClone,\n readBytesFromStream,\n monitor\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nexport function startNetworkErrorCollection(configuration, lifeCycle) {\n if (!configuration.forwardErrorsToLogs) {\n return { stop: noop }\n }\n\n var xhrSubscription = initXhrObservable().subscribe(function (context) {\n if (context.state === 'complete') {\n handleCompleteRequest(RequestType.XHR, context)\n }\n })\n var fetchSubscription = initFetchObservable().subscribe(function (context) {\n if (context.state === 'resolve') {\n handleCompleteRequest(RequestType.FETCH, context)\n }\n })\n\n function handleCompleteRequest(type, request) {\n if (\n !configuration.isIntakeUrl(request.url) &&\n (isRejected(request) ||\n isServerError(request) ||\n configuration.isServerError(request))\n ) {\n if ('xhr' in request) {\n computeXhrResponseData(\n request.xhr,\n configuration,\n onResponseDataAvailable\n )\n } else if (request.response) {\n computeFetchResponseText(\n request.response,\n configuration,\n onResponseDataAvailable\n )\n } else if (request.error) {\n computeFetchErrorText(\n request.error,\n configuration,\n onResponseDataAvailable\n )\n }\n }\n\n function onResponseDataAvailable(responseData) {\n var urlObj = urlParse(request.url).getParse()\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message:\n format(type) + ' error ' + request.method + ' ' + request.url,\n date: request.startClocks.timeStamp,\n error: {\n origin: ErrorSource.NETWORK, // Todo: Remove in the next major release\n stack: responseData || 'Failed to load'\n },\n http: {\n method: request.method, // Cast resource method because of case mismatch cf issue RUMF-1152\n status_code: request.status,\n url: request.url,\n statusGroup: getStatusGroup(request.status),\n urlHost: urlObj.Host,\n urlPath: urlObj.Path,\n urlPathGroup: replaceNumberCharByPath(urlObj.Path)\n },\n status: StatusType.error,\n origin: ErrorSource.NETWORK\n }\n })\n }\n }\n\n return {\n stop: function () {\n xhrSubscription.unsubscribe()\n fetchSubscription.unsubscribe()\n }\n }\n}\n\n// TODO: ideally, computeXhrResponseData should always call the callback with a string instead of\n// `unknown`. But to keep backward compatibility, in the case of XHR with a `responseType` different\n// than \"text\", the response data should be whatever `xhr.response` is. This is a bit confusing as\n// Logs event 'stack' is expected to be a string. This should be changed in a future major version\n// as it could be a breaking change.\nexport function computeXhrResponseData(xhr, configuration, callback) {\n if (typeof xhr.response === 'string') {\n callback(truncateResponseText(xhr.response, configuration))\n } else {\n callback(xhr.response)\n }\n}\n\nexport function computeFetchErrorText(error, configuration, callback) {\n callback(\n truncateResponseText(\n toStackTraceString(computeStackTrace(error)),\n configuration\n )\n )\n}\n\nexport function computeFetchResponseText(response, configuration, callback) {\n var clonedResponse = tryToClone(response)\n if (!clonedResponse || !clonedResponse.body) {\n // if the clone failed or if the body is null, let's not try to read it.\n callback()\n } else if (!window.TextDecoder) {\n // If the browser doesn't support TextDecoder, let's read the whole response then truncate it.\n //\n // This should only be the case on early versions of Edge (before they migrated to Chromium).\n // Even if it could be possible to implement a workaround for the missing TextDecoder API (using\n // a Blob and FileReader), we found another issue preventing us from reading only the first\n // bytes from the response: contrary to other browsers, when reading from the cloned response,\n // if the original response gets canceled, the cloned response is also canceled and we can't\n // know about it. In the following illustration, the promise returned by `reader.read()` may\n // never be fulfilled:\n //\n // fetch('/').then((response) => {\n // const reader = response.clone().body.getReader()\n // readMore()\n // function readMore() {\n // reader.read().then(\n // (result) => {\n // if (result.done) {\n // console.log('done')\n // } else {\n // readMore()\n // }\n // },\n // () => console.log('error')\n // )\n // }\n // response.body.getReader().cancel()\n // })\n clonedResponse.text().then(\n monitor(function (text) {\n return callback(truncateResponseText(text, configuration))\n }),\n monitor(function (error) {\n return callback('Unable to retrieve response: ' + error)\n })\n )\n } else {\n truncateResponseStream(\n clonedResponse.body,\n configuration.requestErrorResponseLengthLimit,\n function (error, responseText) {\n if (error) {\n callback('Unable to retrieve response: ' + error)\n } else {\n callback(responseText)\n }\n }\n )\n }\n}\n\nfunction isRejected(request) {\n return request.status === 0 && request.responseType !== 'opaque'\n}\n\nfunction isServerError(request) {\n return request.status >= 500\n}\n\nfunction truncateResponseText(responseText, configuration) {\n if (responseText.length > configuration.requestErrorResponseLengthLimit) {\n return (\n responseText.substring(0, configuration.requestErrorResponseLengthLimit) +\n '...'\n )\n }\n return responseText\n}\n\nfunction format(type) {\n if (RequestType.XHR === type) {\n return 'XHR'\n }\n return 'Fetch'\n}\n\nfunction truncateResponseStream(stream, bytesLimit, callback) {\n readBytesFromStream(\n stream,\n function (error, bytes, limitExceeded) {\n if (error) {\n callback(error)\n } else {\n var responseText = new TextDecoder().decode(bytes)\n if (limitExceeded) {\n responseText += '...'\n }\n callback(undefined, responseText)\n }\n },\n {\n bytesLimit: bytesLimit,\n collectStreamBody: true\n }\n )\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAiBA,IAAAC,OAAA,GAAAD,OAAA;AAEO,SAASE,2BAA2BA,CAACC,aAAa,EAAEC,SAAS,EAAE;EACpE,IAAI,CAACD,aAAa,CAACE,mBAAmB,EAAE;IACtC,OAAO;MAAEC,IAA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M;QACLiC,QAAQ,CAACc,YAAY,CAAC;MACxB;IACF,CACF,CAAC;EACH;AACF;AAEA,SAAStD,UAAUA,CAACH,OAAO,EAAE;EAC3B,OAAOA,OAAO,CAACgC,MAAM,KAAK,CAAC,IAAIhC,OAAO,CAAC0D,YAAY,KAAK,QAAQ;AAClE;AAEA,SAAStD,aAAaA,CAACJ,OAAO,EAAE;EAC9B,OAAOA,OAAO,CAACgC,MAAM,IAAI,GAAG;AAC9B;AAEA,SAASY,oBAAoBA,CAACa,YAAY,EAAE1E,aAAa,EAAE;EACzD,IAAI0E,YAAY,CAACE,MAAM,GAAG5E,aAAa,CAACyE,+BAA+B,EAAE;IACvE,OACEC,YAAY,CAACG,SAAS,CAAC,CAAC,EAAE7E,aAAa,CAACyE,+BAA+B,CAAC,GACxE,KAAK;EAET;EACA,OAAOC,YAAY;AACrB;AAEA,SAASpC,MAAMA,CAACtB,IAAI,EAAE;EACpB,IAAIL,wBAAW,CAACC,GAAG,KAAKI,IAAI,EAAE;IAC5B,OAAO,KAAK;EACd;EACA,OAAO,OAAO;AAChB;AAEA,SAASwD,sBAAsBA,CAACM,MAAM,EAAEC,UAAU,EAAEnB,QAAQ,EAAE;EAC5D,IAAAoB,gCAAmB,EACjBF,MAAM,EACN,UAAUnD,KAAK,EAAEsD,KAAK,EAAEC,aAAa,EAAE;IACrC,IAAIvD,KAAK,EAAE;MACTiC,QAAQ,CAACjC,KAAK,CAAC;IACjB,CAAC,MAAM;MACL,IAAI+C,YAAY,GAAG,IAAIN,WAAW,CAAC,CAAC,CAACe,MAAM,CAACF,KAAK,CAAC;MAClD,IAAIC,aAAa,EAAE;QACjBR,YAAY,IAAI,KAAK;MACvB;MACAd,QAAQ,CAACwB,SAAS,EAAEV,YAAY,CAAC;IACnC;EACF,CAAC,EACD;IACEK,UAAU,EAAEA,UAAU;IACtBM,iBAAiB,EAAE;EACrB,CACF,CAAC;AACH"}
1
+ {"version":3,"file":"networkErrorCollection.js","names":["_browserCore","require","_logger","startNetworkErrorCollection","configuration","lifeCycle","forwardErrorsToLogs","stop","noop","xhrSubscription","initXhrObservable","subscribe","context","state","handleCompleteRequest","RequestType","XHR","fetchSubscription","initFetchObservable","FETCH","type","request","isIntakeUrl","url","isRejected","isServerError","computeXhrResponseData","xhr","onResponseDataAvailable","response","computeFetchResponseText","error","computeFetchErrorText","responseData","urlObj","urlParse","getParse","notify","LifeCycleEventType","RAW_LOG_COLLECTED","rawLogsEvent","message","format","method","date","startClocks","timeStamp","origin","ErrorSource","NETWORK","stack","http","status_code","status","statusGroup","getStatusGroup","urlHost","Host","urlPath","Path","urlPathGroup","replaceNumberCharByPath","StatusType","unsubscribe","callback","truncateResponseText","toStackTraceString","computeStackTrace","clonedResponse","tryToClone","body","window","TextDecoder","text","then","monitor","truncateResponseStream","requestErrorResponseLengthLimit","responseText","responseType","length","substring","stream","bytesLimit","readBytesFromStream","bytes","limitExceeded","decode","undefined","collectStreamBody"],"sources":["../../../../src/domain/logsCollection/networkError/networkErrorCollection.js"],"sourcesContent":["import {\n ErrorSource,\n initXhrObservable,\n RequestType,\n initFetchObservable,\n computeStackTrace,\n toStackTraceString,\n noop,\n each,\n LifeCycleEventType,\n getStatusGroup,\n urlParse,\n replaceNumberCharByPath,\n tryToClone,\n readBytesFromStream,\n monitor\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nexport function startNetworkErrorCollection(configuration, lifeCycle) {\n if (!configuration.forwardErrorsToLogs) {\n return { stop: noop }\n }\n\n var xhrSubscription = initXhrObservable().subscribe(function (context) {\n if (context.state === 'complete') {\n handleCompleteRequest(RequestType.XHR, context)\n }\n })\n var fetchSubscription = initFetchObservable().subscribe(function (context) {\n if (context.state === 'resolve') {\n handleCompleteRequest(RequestType.FETCH, context)\n }\n })\n\n function handleCompleteRequest(type, request) {\n if (\n !configuration.isIntakeUrl(request.url) &&\n (isRejected(request) ||\n isServerError(request) ||\n configuration.isServerError(request))\n ) {\n if ('xhr' in request) {\n computeXhrResponseData(\n request.xhr,\n configuration,\n onResponseDataAvailable\n )\n } else if (request.response) {\n computeFetchResponseText(\n request.response,\n configuration,\n onResponseDataAvailable\n )\n } else if (request.error) {\n computeFetchErrorText(\n request.error,\n configuration,\n onResponseDataAvailable\n )\n }\n }\n\n function onResponseDataAvailable(responseData) {\n var urlObj = urlParse(request.url).getParse()\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message:\n format(type) + ' error ' + request.method + ' ' + request.url,\n date: request.startClocks.timeStamp,\n error: {\n origin: ErrorSource.NETWORK,\n stack: responseData || 'Failed to load'\n },\n http: {\n method: request.method,\n status_code: request.status,\n url: request.url,\n statusGroup: getStatusGroup(request.status),\n urlHost: urlObj.Host,\n urlPath: urlObj.Path,\n urlPathGroup: replaceNumberCharByPath(urlObj.Path)\n },\n status: StatusType.error,\n origin: ErrorSource.NETWORK\n }\n })\n }\n }\n\n return {\n stop: function () {\n xhrSubscription.unsubscribe()\n fetchSubscription.unsubscribe()\n }\n }\n}\n\nexport function computeXhrResponseData(xhr, configuration, callback) {\n if (typeof xhr.response === 'string') {\n callback(truncateResponseText(xhr.response, configuration))\n } else {\n callback(xhr.response)\n }\n}\n\nexport function computeFetchErrorText(error, configuration, callback) {\n callback(\n truncateResponseText(\n toStackTraceString(computeStackTrace(error)),\n configuration\n )\n )\n}\n\nexport function computeFetchResponseText(response, configuration, callback) {\n var clonedResponse = tryToClone(response)\n if (!clonedResponse || !clonedResponse.body) {\n // if the clone failed or if the body is null, let's not try to read it.\n callback()\n } else if (!window.TextDecoder) {\n // If the browser doesn't support TextDecoder, let's read the whole response then truncate it.\n //\n // This should only be the case on early versions of Edge (before they migrated to Chromium).\n // Even if it could be possible to implement a workaround for the missing TextDecoder API (using\n // a Blob and FileReader), we found another issue preventing us from reading only the first\n // bytes from the response: contrary to other browsers, when reading from the cloned response,\n // if the original response gets canceled, the cloned response is also canceled and we can't\n // know about it. In the following illustration, the promise returned by `reader.read()` may\n // never be fulfilled:\n //\n // fetch('/').then((response) => {\n // const reader = response.clone().body.getReader()\n // readMore()\n // function readMore() {\n // reader.read().then(\n // (result) => {\n // if (result.done) {\n // console.log('done')\n // } else {\n // readMore()\n // }\n // },\n // () => console.log('error')\n // )\n // }\n // response.body.getReader().cancel()\n // })\n clonedResponse.text().then(\n monitor(function (text) {\n return callback(truncateResponseText(text, configuration))\n }),\n monitor(function (error) {\n return callback('Unable to retrieve response: ' + error)\n })\n )\n } else {\n truncateResponseStream(\n clonedResponse.body,\n configuration.requestErrorResponseLengthLimit,\n function (error, responseText) {\n if (error) {\n callback('Unable to retrieve response: ' + error)\n } else {\n callback(responseText)\n }\n }\n )\n }\n}\n\nfunction isRejected(request) {\n return request.status === 0 && request.responseType !== 'opaque'\n}\n\nfunction isServerError(request) {\n return request.status >= 500\n}\n\nfunction truncateResponseText(responseText, configuration) {\n if (responseText.length > configuration.requestErrorResponseLengthLimit) {\n return (\n responseText.substring(0, configuration.requestErrorResponseLengthLimit) +\n '...'\n )\n }\n return responseText\n}\n\nfunction format(type) {\n if (RequestType.XHR === type) {\n return 'XHR'\n }\n return 'Fetch'\n}\n\nfunction truncateResponseStream(stream, bytesLimit, callback) {\n readBytesFromStream(\n stream,\n function (error, bytes, limitExceeded) {\n if (error) {\n callback(error)\n } else {\n var responseText = new TextDecoder().decode(bytes)\n if (limitExceeded) {\n responseText += '...'\n }\n callback(undefined, responseText)\n }\n },\n {\n bytesLimit: bytesLimit,\n collectStreamBody: true\n }\n )\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAiBA,IAAAC,OAAA,GAAAD,OAAA;AAEO,SAASE,2BAA2BA,CAACC,aAAa,EAAEC,SAAS,EAAE;EACpE,IAAI,CAACD,aAAa,CAACE,mBAAmB,EAAE;IACtC,OAAO;MAAEC,IAAI,EAAEC;IAAK,CAAC;EACvB;EAEA,IAAIC,eAAe,GAAG,IAAAC,8BAAiB,EAAC,CAAC,CAACC,SAAS,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C,MAAM,KAAK,CAAC,IAAIhC,OAAO,CAAC0D,YAAY,KAAK,QAAQ;AAClE;AAEA,SAAStD,aAAaA,CAACJ,OAAO,EAAE;EAC9B,OAAOA,OAAO,CAACgC,MAAM,IAAI,GAAG;AAC9B;AAEA,SAASY,oBAAoBA,CAACa,YAAY,EAAE1E,aAAa,EAAE;EACzD,IAAI0E,YAAY,CAACE,MAAM,GAAG5E,aAAa,CAACyE,+BAA+B,EAAE;IACvE,OACEC,YAAY,CAACG,SAAS,CAAC,CAAC,EAAE7E,aAAa,CAACyE,+BAA+B,CAAC,GACxE,KAAK;EAET;EACA,OAAOC,YAAY;AACrB;AAEA,SAASpC,MAAMA,CAACtB,IAAI,EAAE;EACpB,IAAIL,wBAAW,CAACC,GAAG,KAAKI,IAAI,EAAE;IAC5B,OAAO,KAAK;EACd;EACA,OAAO,OAAO;AAChB;AAEA,SAASwD,sBAAsBA,CAACM,MAAM,EAAEC,UAAU,EAAEnB,QAAQ,EAAE;EAC5D,IAAAoB,gCAAmB,EACjBF,MAAM,EACN,UAAUnD,KAAK,EAAEsD,KAAK,EAAEC,aAAa,EAAE;IACrC,IAAIvD,KAAK,EAAE;MACTiC,QAAQ,CAACjC,KAAK,CAAC;IACjB,CAAC,MAAM;MACL,IAAI+C,YAAY,GAAG,IAAIN,WAAW,CAAC,CAAC,CAACe,MAAM,CAACF,KAAK,CAAC;MAClD,IAAIC,aAAa,EAAE;QACjBR,YAAY,IAAI,KAAK;MACvB;MACAd,QAAQ,CAACwB,SAAS,EAAEV,YAAY,CAAC;IACnC;EACF,CAAC,EACD;IACEK,UAAU,EAAEA,UAAU;IACtBM,iBAAiB,EAAE;EACrB,CACF,CAAC;AACH"}
@@ -21,7 +21,6 @@ function startReportCollection(configuration, lifeCycle) {
21
21
  error = {
22
22
  kind: report.subtype,
23
23
  origin: _browserCore.ErrorSource.REPORT,
24
- // Todo: Remove in the next major release
25
24
  stack: report.stack
26
25
  };
27
26
  } else if (report.stack) {
@@ -1 +1 @@
1
- {"version":3,"file":"reportCollection.js","names":["_browserCore","require","_logger","_LogStatusForReport","_typeof","obj","Symbol","iterator","constructor","prototype","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","call","TypeError","Number","LogStatusForReport","RawReportType","cspViolation","StatusType","error","intervention","deprecation","warn","startReportCollection","configuration","lifeCycle","reportSubscription","initReportObservable","forwardReports","subscribe","report","message","status","type","kind","subtype","origin","ErrorSource","REPORT","stack","getFileFromStackTraceString","notify","LifeCycleEventType","RAW_LOG_COLLECTED","rawLogsEvent","date","timeStampNow","stop","unsubscribe"],"sources":["../../../../src/domain/logsCollection/report/reportCollection.js"],"sourcesContent":["import {\n timeStampNow,\n ErrorSource,\n RawReportType,\n getFileFromStackTraceString,\n initReportObservable,\n LifeCycleEventType\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nvar LogStatusForReport = {\n [RawReportType.cspViolation]: StatusType.error,\n [RawReportType.intervention]: StatusType.error,\n [RawReportType.deprecation]: StatusType.warn\n}\n\nexport function startReportCollection(configuration, lifeCycle) {\n var reportSubscription = initReportObservable(\n configuration,\n configuration.forwardReports\n ).subscribe(function (report) {\n var message = report.message\n var status = LogStatusForReport[report.type]\n var error\n if (status === StatusType.error) {\n error = {\n kind: report.subtype,\n origin: ErrorSource.REPORT, // Todo: Remove in the next major release\n stack: report.stack\n }\n } else if (report.stack) {\n message += ' Found in ' + getFileFromStackTraceString(report.stack)\n }\n\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n date: timeStampNow(),\n message: message,\n origin: ErrorSource.REPORT,\n error: error,\n status: status\n }\n })\n })\n\n return {\n stop: function () {\n reportSubscription.unsubscribe()\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAD,OAAA;AAAyC,IAAAE,mBAAA;AAA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AAY,EAAGF,kBAAU,CAACC,KAAK,GAAAzB,eAAA,CAAAP,mBAAA,EAC7C6B,0BAAa,CAACK,WAAW,EAAGH,kBAAU,CAACI,IAAI,GAAAnC,mBAAA,CAC7C;AAEM,SAASoC,qBAAqBA,CAACC,aAAa,EAAEC,SAAS,EAAE;EAC9D,IAAIC,kBAAkB,GAAG,IAAAC,iCAAoB,EAC3CH,aAAa,EACbA,aAAa,CAACI,cAChB,CAAC,CAACC,SAAS,CAAC,UAAUC,MAAM,EAAE;IAC5B,IAAIC,OAAO,GAAGD,MAAM,CAACC,OAAO;IAC5B,IAAIC,MAAM,GAAGjB,kBAAkB,CAACe,MAAM,CAACG,IAAI,CAAC;IAC5C,IAAId,KAAK;IACT,IAAIa,MAAM,KAAKd,kBAAU,CAACC,KAAK,EAAE;MAC/BA,KAAK,GAAG;QACNe,IAAI,EAAEJ,MAAM,CAACK,OAAO;QACpBC,MAAM,EAAEC,wBAAW,CAACC,MAAM;QAAE;QAC5BC,KAAK,EAAET,MAAM,CAACS;MAChB,CAAC;IACH,CAAC,MAAM,IAAIT,MAAM,CAACS,KAAK,EAAE;MACvBR,OAAO,IAAI,YAAY,GAAG,IAAAS,wCAA2B,EAACV,MAAM,CAACS,KAAK,CAAC;IACrE;IAEAd,SAAS,CAACgB,MAAM,CAACC,+BAAkB,CAACC,iBAAiB,EAAE;MACrDC,YAAY,EAAE;QACZC,IAAI,EAAE,IAAAC,yBAAY,EAAC,CAAC;QACpBf,OAAO,EAAEA,OAAO;QAChBK,MAAM,EAAEC,wBAAW,CAACC,MAAM;QAC1BnB,KAAK,EAAEA,KAAK;QACZa,MAAM,EAAEA;MACV;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLe,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChBrB,kBAAkB,CAACsB,WAAW,CAAC,CAAC;IAClC;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"reportCollection.js","names":["_browserCore","require","_logger","_LogStatusForReport","_typeof","obj","Symbol","iterator","constructor","prototype","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","call","TypeError","Number","LogStatusForReport","RawReportType","cspViolation","StatusType","error","intervention","deprecation","warn","startReportCollection","configuration","lifeCycle","reportSubscription","initReportObservable","forwardReports","subscribe","report","message","status","type","kind","subtype","origin","ErrorSource","REPORT","stack","getFileFromStackTraceString","notify","LifeCycleEventType","RAW_LOG_COLLECTED","rawLogsEvent","date","timeStampNow","stop","unsubscribe"],"sources":["../../../../src/domain/logsCollection/report/reportCollection.js"],"sourcesContent":["import {\n timeStampNow,\n ErrorSource,\n RawReportType,\n getFileFromStackTraceString,\n initReportObservable,\n LifeCycleEventType\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nvar LogStatusForReport = {\n [RawReportType.cspViolation]: StatusType.error,\n [RawReportType.intervention]: StatusType.error,\n [RawReportType.deprecation]: StatusType.warn\n}\n\nexport function startReportCollection(configuration, lifeCycle) {\n var reportSubscription = initReportObservable(\n configuration,\n configuration.forwardReports\n ).subscribe(function (report) {\n var message = report.message\n var status = LogStatusForReport[report.type]\n var error\n if (status === StatusType.error) {\n error = {\n kind: report.subtype,\n origin: ErrorSource.REPORT,\n stack: report.stack\n }\n } else if (report.stack) {\n message += ' Found in ' + getFileFromStackTraceString(report.stack)\n }\n\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n date: timeStampNow(),\n message: message,\n origin: ErrorSource.REPORT,\n error: error,\n status: status\n }\n })\n })\n\n return {\n stop: function () {\n reportSubscription.unsubscribe()\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAD,OAAA;AAAyC,IAAAE,mBAAA;AAAA,SAAAC,QAAAC,GAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAA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CAACK,WAAW,EAAGH,kBAAU,CAACI,IAAI,GAAAnC,mBAAA,CAC7C;AAEM,SAASoC,qBAAqBA,CAACC,aAAa,EAAEC,SAAS,EAAE;EAC9D,IAAIC,kBAAkB,GAAG,IAAAC,iCAAoB,EAC3CH,aAAa,EACbA,aAAa,CAACI,cAChB,CAAC,CAACC,SAAS,CAAC,UAAUC,MAAM,EAAE;IAC5B,IAAIC,OAAO,GAAGD,MAAM,CAACC,OAAO;IAC5B,IAAIC,MAAM,GAAGjB,kBAAkB,CAACe,MAAM,CAACG,IAAI,CAAC;IAC5C,IAAId,KAAK;IACT,IAAIa,MAAM,KAAKd,kBAAU,CAACC,KAAK,EAAE;MAC/BA,KAAK,GAAG;QACNe,IAAI,EAAEJ,MAAM,CAACK,OAAO;QACpBC,MAAM,EAAEC,wBAAW,CAACC,MAAM;QAC1BC,KAAK,EAAET,MAAM,CAACS;MAChB,CAAC;IACH,CAAC,MAAM,IAAIT,MAAM,CAACS,KAAK,EAAE;MACvBR,OAAO,IAAI,YAAY,GAAG,IAAAS,wCAA2B,EAACV,MAAM,CAACS,KAAK,CAAC;IACrE;IAEAd,SAAS,CAACgB,MAAM,CAACC,+BAAkB,CAACC,iBAAiB,EAAE;MACrDC,YAAY,EAAE;QACZC,IAAI,EAAE,IAAAC,yBAAY,EAAC,CAAC;QACpBf,OAAO,EAAEA,OAAO;QAChBK,MAAM,EAAEC,wBAAW,CAACC,MAAM;QAC1BnB,KAAK,EAAEA,KAAK;QACZa,MAAM,EAAEA;MACV;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLe,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChBrB,kBAAkB,CAACsB,WAAW,CAAC,CAAC;IAClC;EACF,CAAC;AACH"}
@@ -22,7 +22,6 @@ function startRuntimeErrorCollection(configuration, lifeCycle) {
22
22
  error: {
23
23
  kind: rawError.type,
24
24
  origin: _browserCore.ErrorSource.SOURCE,
25
- // Todo: Remove in the next major release
26
25
  stack: rawError.stack
27
26
  },
28
27
  origin: _browserCore.ErrorSource.SOURCE,
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeErrorCollection.js","names":["_browserCore","require","_logger","startRuntimeErrorCollection","configuration","lifeCycle","forwardErrorsToLogs","stop","noop","rawErrorObservable","Observable","_trackRuntimeError","trackRuntimeError","rawErrorSubscription","subscribe","rawError","notify","LifeCycleEventType","RAW_LOG_COLLECTED","rawLogsEvent","message","date","startClocks","timeStamp","error","kind","type","origin","ErrorSource","SOURCE","stack","status","StatusType","unsubscribe"],"sources":["../../../../src/domain/logsCollection/rumtimeError/runtimeErrorCollection.js"],"sourcesContent":["import { noop, ErrorSource, trackRuntimeError, Observable, LifeCycleEventType } from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nexport function startRuntimeErrorCollection(configuration, lifeCycle) {\n if (!configuration.forwardErrorsToLogs) {\n return { stop: noop }\n }\n\n var rawErrorObservable = new Observable()\n\n var _trackRuntimeError = trackRuntimeError(rawErrorObservable)\n\n var rawErrorSubscription = rawErrorObservable.subscribe(function(rawError) {\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message: rawError.message,\n date: rawError.startClocks.timeStamp,\n error: {\n kind: rawError.type,\n origin: ErrorSource.SOURCE, // Todo: Remove in the next major release\n stack: rawError.stack,\n },\n origin: ErrorSource.SOURCE,\n status: StatusType.error,\n },\n })\n })\n\n return {\n stop: function() {\n _trackRuntimeError.stop()\n rawErrorSubscription.unsubscribe()\n },\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEO,SAASE,2BAA2BA,CAACC,aAAa,EAAEC,SAAS,EAAE;EACpE,IAAI,CAACD,aAAa,CAACE,mBAAmB,EAAE;IACtC,OAAO;MAAEC,IAAI,EAAEC;IAAK,CAAC;EACvB;EAEA,IAAIC,kBAAkB,GAAG,IAAIC,uBAAU,CAAC,CAAC;EAEzC,IAAIC,kBAAkB,GAAG,IAAAC,8BAAiB,EAACH,kBAAkB,CAAC;EAE9D,IAAII,oBAAoB,GAAGJ,kBAAkB,CAACK,SAAS,CAAC,UAASC,QAAQ,EAAE;IACzEV,SAAS,CAACW,MAAM,CAACC,+BAAkB,CAACC,iBAAiB,EAAE;MACrDC,YAAY,EAAE;QACZC,OAAO,EAAEL,QAAQ,CAACK,OAAO;QACzBC,IAAI,EAAEN,QAAQ,CAACO,WAAW,CAACC,SAAS;QACpCC,KAAK,EAAE;UACLC,IAAI,EAAEV,QAAQ,CAACW,IAAI;UACnBC,MAAM,EAAEC,wBAAW,CAACC,MAAM;UAAE;UAC5BC,KAAK,EAAEf,QAAQ,CAACe;QAClB,CAAC;QACDH,MAAM,EAAEC,wBAAW,CAACC,MAAM;QAC1BE,MAAM,EAAEC,kBAAU,CAACR;MACrB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLjB,IAAI,EAAE,SAAAA,KAAA,EAAW;MACfI,kBAAkB,CAACJ,IAAI,CAAC,CAAC;MACzBM,oBAAoB,CAACoB,WAAW,CAAC,CAAC;IACpC;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"runtimeErrorCollection.js","names":["_browserCore","require","_logger","startRuntimeErrorCollection","configuration","lifeCycle","forwardErrorsToLogs","stop","noop","rawErrorObservable","Observable","_trackRuntimeError","trackRuntimeError","rawErrorSubscription","subscribe","rawError","notify","LifeCycleEventType","RAW_LOG_COLLECTED","rawLogsEvent","message","date","startClocks","timeStamp","error","kind","type","origin","ErrorSource","SOURCE","stack","status","StatusType","unsubscribe"],"sources":["../../../../src/domain/logsCollection/rumtimeError/runtimeErrorCollection.js"],"sourcesContent":["import {\n noop,\n ErrorSource,\n trackRuntimeError,\n Observable,\n LifeCycleEventType\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nexport function startRuntimeErrorCollection(configuration, lifeCycle) {\n if (!configuration.forwardErrorsToLogs) {\n return { stop: noop }\n }\n\n var rawErrorObservable = new Observable()\n\n var _trackRuntimeError = trackRuntimeError(rawErrorObservable)\n\n var rawErrorSubscription = rawErrorObservable.subscribe(function (rawError) {\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message: rawError.message,\n date: rawError.startClocks.timeStamp,\n error: {\n kind: rawError.type,\n origin: ErrorSource.SOURCE,\n stack: rawError.stack\n },\n origin: ErrorSource.SOURCE,\n status: StatusType.error\n }\n })\n })\n\n return {\n stop: function () {\n _trackRuntimeError.stop()\n rawErrorSubscription.unsubscribe()\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AAEO,SAASE,2BAA2BA,CAACC,aAAa,EAAEC,SAAS,EAAE;EACpE,IAAI,CAACD,aAAa,CAACE,mBAAmB,EAAE;IACtC,OAAO;MAAEC,IAAI,EAAEC;IAAK,CAAC;EACvB;EAEA,IAAIC,kBAAkB,GAAG,IAAIC,uBAAU,CAAC,CAAC;EAEzC,IAAIC,kBAAkB,GAAG,IAAAC,8BAAiB,EAACH,kBAAkB,CAAC;EAE9D,IAAII,oBAAoB,GAAGJ,kBAAkB,CAACK,SAAS,CAAC,UAAUC,QAAQ,EAAE;IAC1EV,SAAS,CAACW,MAAM,CAACC,+BAAkB,CAACC,iBAAiB,EAAE;MACrDC,YAAY,EAAE;QACZC,OAAO,EAAEL,QAAQ,CAACK,OAAO;QACzBC,IAAI,EAAEN,QAAQ,CAACO,WAAW,CAACC,SAAS;QACpCC,KAAK,EAAE;UACLC,IAAI,EAAEV,QAAQ,CAACW,IAAI;UACnBC,MAAM,EAAEC,wBAAW,CAACC,MAAM;UAC1BC,KAAK,EAAEf,QAAQ,CAACe;QAClB,CAAC;QACDH,MAAM,EAAEC,wBAAW,CAACC,MAAM;QAC1BE,MAAM,EAAEC,kBAAU,CAACR;MACrB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLjB,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChBI,kBAAkB,CAACJ,IAAI,CAAC,CAAC;MACzBM,oBAAoB,CAACoB,WAAW,CAAC,CAAC;IACpC;EACF,CAAC;AACH"}
@@ -1,5 +1,5 @@
1
1
  export var buildEnv = {
2
- sdkVersion: "3.1.8",
2
+ sdkVersion: "3.1.10",
3
3
  sdkName: 'df_web_logs_sdk'
4
4
  };
5
5
  //# sourceMappingURL=buildEnv.js.map
@@ -17,9 +17,8 @@ export function startLogs(configuration, buildCommonContext, mainLogger) {
17
17
  message: error.message,
18
18
  date: error.startClocks.timeStamp,
19
19
  error: {
20
- origin: ErrorSource.AGENT // Todo: Remove in the next major release
20
+ origin: ErrorSource.AGENT
21
21
  },
22
-
23
22
  origin: ErrorSource.AGENT,
24
23
  status: StatusType.error
25
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"startLogs.js","names":["ErrorSource","LifeCycle","LifeCycleEventType","createPageExitObservable","areCookiesAuthorized","startTelemetry","startBatchWithReplica","canUseEventBridge","TelemetryService","startLogsSessionManager","startLogsSessionManagerStub","startLogsAssembly","getRUMInternalContext","startConsoleCollection","startReportCollection","startNetworkErrorCollection","startRuntimeErrorCollection","startLoggerCollection","startLogsBatch","StatusType","startInternalContext","startLogs","configuration","buildCommonContext","mainLogger","lifeCycle","reportError","error","notify","RAW_LOG_COLLECTED","rawLogsEvent","message","date","startClocks","timeStamp","origin","AGENT","status","pageExitObservable","session","cookieOptions","telemetry","startLogsTelemetry","expireObservable","setContextProvider","RUMInternalContext","application","id","findTrackedSession","view","action","userAction","_startLoggerCollection","internalContext","handleLog","getInternalContext","get","sessionExpireObservable","LOGS","telemetryBatch","rumEndpoint","observable","subscribe","event","add"],"sources":["../../src/boot/startLogs.js"],"sourcesContent":["import {\n ErrorSource,\n LifeCycle,\n LifeCycleEventType,\n createPageExitObservable,\n areCookiesAuthorized,\n startTelemetry,\n startBatchWithReplica,\n canUseEventBridge,\n TelemetryService\n} from '@cloudcare/browser-core'\nimport {\n startLogsSessionManager,\n startLogsSessionManagerStub\n} from '../domain/logsSessionManager'\nimport { startLogsAssembly, getRUMInternalContext } from '../domain/assembly'\nimport { startConsoleCollection } from '../domain/logsCollection/console/consoleCollection'\nimport { startReportCollection } from '../domain/logsCollection/report/reportCollection'\nimport { startNetworkErrorCollection } from '../domain/logsCollection/networkError/networkErrorCollection'\nimport { startRuntimeErrorCollection } from '../domain/logsCollection/rumtimeError/runtimeErrorCollection'\nimport { startLoggerCollection } from '../domain/logsCollection/logger/loggerCollection'\nimport { startLogsBatch } from '../transport/startLogsBatch'\nimport { StatusType } from '../domain/logger'\nimport { startInternalContext } from '../domain/internalContext'\n\nexport function startLogs(configuration, buildCommonContext, mainLogger) {\n var lifeCycle = new LifeCycle()\n\n var reportError = function (error) {\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message: error.message,\n date: error.startClocks.timeStamp,\n error: {\n origin: ErrorSource.AGENT // Todo: Remove in the next major release\n },\n origin: ErrorSource.AGENT,\n status: StatusType.error\n }\n })\n }\n var pageExitObservable = createPageExitObservable()\n var session = areCookiesAuthorized(configuration.cookieOptions)\n ? startLogsSessionManager(configuration)\n : startLogsSessionManagerStub(configuration)\n const telemetry = startLogsTelemetry(\n configuration,\n reportError,\n pageExitObservable,\n session.expireObservable\n )\n telemetry.setContextProvider(function () {\n var RUMInternalContext = getRUMInternalContext()\n return {\n application: {\n id:\n RUMInternalContext &&\n RUMInternalContext.application &&\n RUMInternalContext.application.id\n },\n session: {\n id: session.findTrackedSession() && session.findTrackedSession().id\n },\n view: {\n id:\n RUMInternalContext &&\n RUMInternalContext.view &&\n RUMInternalContext.view.id\n },\n action: {\n id:\n RUMInternalContext &&\n RUMInternalContext.userAction &&\n RUMInternalContext.userAction.id\n }\n }\n })\n startNetworkErrorCollection(configuration, lifeCycle)\n startRuntimeErrorCollection(configuration, lifeCycle)\n startConsoleCollection(configuration, lifeCycle)\n startReportCollection(configuration, lifeCycle)\n var _startLoggerCollection = startLoggerCollection(lifeCycle)\n\n startLogsAssembly(\n session,\n configuration,\n lifeCycle,\n buildCommonContext,\n mainLogger,\n reportError\n )\n if (!canUseEventBridge()) {\n startLogsBatch(\n configuration,\n lifeCycle,\n reportError,\n pageExitObservable,\n session.expireObservable\n )\n }\n\n var internalContext = startInternalContext(session)\n\n return {\n handleLog: _startLoggerCollection.handleLog,\n getInternalContext: internalContext.get\n }\n}\nfunction startLogsTelemetry(\n configuration,\n reportError,\n pageExitObservable,\n sessionExpireObservable\n) {\n const telemetry = startTelemetry(TelemetryService.LOGS, configuration)\n if (!canUseEventBridge()) {\n var telemetryBatch = startBatchWithReplica(\n configuration,\n configuration.rumEndpoint,\n reportError,\n pageExitObservable,\n sessionExpireObservable\n )\n telemetry.observable.subscribe(function (event) {\n telemetryBatch.add(event)\n })\n }\n return telemetry\n}\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,SAAS,EACTC,kBAAkB,EAClBC,wBAAwB,EACxBC,oBAAoB,EACpBC,cAAc,EACdC,qBAAqB,EACrBC,iBAAiB,EACjBC,gBAAgB,QACX,yBAAyB;AAChC,SACEC,uBAAuB,EACvBC,2BAA2B,QACtB,8BAA8B;AACrC,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ,oBAAoB;AAC7E,SAASC,sBAAsB,QAAQ,oDAAoD;AAC3F,SAASC,qBAAqB,QAAQ,kDAAkD;AACxF,SAASC,2BAA2B,QAAQ,8DAA8D;AAC1G,SAASC,2BAA2B,QAAQ,8DAA8D;AAC1G,SAASC,qBAAqB,QAAQ,kDAAkD;AACxF,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,OAAO,SAASC,SAASA,CAACC,aAAa,EAAEC,kBAAkB,EAAEC,UAAU,EAAE;EACvE,IAAIC,SAAS,GAAG,IAAI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B,CAAC,CAAC;EACJ;EACA,OAAOtB,SAAS;AAClB"}
1
+ {"version":3,"file":"startLogs.js","names":["ErrorSource","LifeCycle","LifeCycleEventType","createPageExitObservable","areCookiesAuthorized","startTelemetry","startBatchWithReplica","canUseEventBridge","TelemetryService","startLogsSessionManager","startLogsSessionManagerStub","startLogsAssembly","getRUMInternalContext","startConsoleCollection","startReportCollection","startNetworkErrorCollection","startRuntimeErrorCollection","startLoggerCollection","startLogsBatch","StatusType","startInternalContext","startLogs","configuration","buildCommonContext","mainLogger","lifeCycle","reportError","error","notify","RAW_LOG_COLLECTED","rawLogsEvent","message","date","startClocks","timeStamp","origin","AGENT","status","pageExitObservable","session","cookieOptions","telemetry","startLogsTelemetry","expireObservable","setContextProvider","RUMInternalContext","application","id","findTrackedSession","view","action","userAction","_startLoggerCollection","internalContext","handleLog","getInternalContext","get","sessionExpireObservable","LOGS","telemetryBatch","rumEndpoint","observable","subscribe","event","add"],"sources":["../../src/boot/startLogs.js"],"sourcesContent":["import {\n ErrorSource,\n LifeCycle,\n LifeCycleEventType,\n createPageExitObservable,\n areCookiesAuthorized,\n startTelemetry,\n startBatchWithReplica,\n canUseEventBridge,\n TelemetryService\n} from '@cloudcare/browser-core'\nimport {\n startLogsSessionManager,\n startLogsSessionManagerStub\n} from '../domain/logsSessionManager'\nimport { startLogsAssembly, getRUMInternalContext } from '../domain/assembly'\nimport { startConsoleCollection } from '../domain/logsCollection/console/consoleCollection'\nimport { startReportCollection } from '../domain/logsCollection/report/reportCollection'\nimport { startNetworkErrorCollection } from '../domain/logsCollection/networkError/networkErrorCollection'\nimport { startRuntimeErrorCollection } from '../domain/logsCollection/rumtimeError/runtimeErrorCollection'\nimport { startLoggerCollection } from '../domain/logsCollection/logger/loggerCollection'\nimport { startLogsBatch } from '../transport/startLogsBatch'\nimport { StatusType } from '../domain/logger'\nimport { startInternalContext } from '../domain/internalContext'\n\nexport function startLogs(configuration, buildCommonContext, mainLogger) {\n var lifeCycle = new LifeCycle()\n\n var reportError = function (error) {\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message: error.message,\n date: error.startClocks.timeStamp,\n error: {\n origin: ErrorSource.AGENT\n },\n origin: ErrorSource.AGENT,\n status: StatusType.error\n }\n })\n }\n var pageExitObservable = createPageExitObservable()\n var session = areCookiesAuthorized(configuration.cookieOptions)\n ? startLogsSessionManager(configuration)\n : startLogsSessionManagerStub(configuration)\n const telemetry = startLogsTelemetry(\n configuration,\n reportError,\n pageExitObservable,\n session.expireObservable\n )\n telemetry.setContextProvider(function () {\n var RUMInternalContext = getRUMInternalContext()\n return {\n application: {\n id:\n RUMInternalContext &&\n RUMInternalContext.application &&\n RUMInternalContext.application.id\n },\n session: {\n id: session.findTrackedSession() && session.findTrackedSession().id\n },\n view: {\n id:\n RUMInternalContext &&\n RUMInternalContext.view &&\n RUMInternalContext.view.id\n },\n action: {\n id:\n RUMInternalContext &&\n RUMInternalContext.userAction &&\n RUMInternalContext.userAction.id\n }\n }\n })\n startNetworkErrorCollection(configuration, lifeCycle)\n startRuntimeErrorCollection(configuration, lifeCycle)\n startConsoleCollection(configuration, lifeCycle)\n startReportCollection(configuration, lifeCycle)\n var _startLoggerCollection = startLoggerCollection(lifeCycle)\n\n startLogsAssembly(\n session,\n configuration,\n lifeCycle,\n buildCommonContext,\n mainLogger,\n reportError\n )\n if (!canUseEventBridge()) {\n startLogsBatch(\n configuration,\n lifeCycle,\n reportError,\n pageExitObservable,\n session.expireObservable\n )\n }\n\n var internalContext = startInternalContext(session)\n\n return {\n handleLog: _startLoggerCollection.handleLog,\n getInternalContext: internalContext.get\n }\n}\nfunction startLogsTelemetry(\n configuration,\n reportError,\n pageExitObservable,\n sessionExpireObservable\n) {\n const telemetry = startTelemetry(TelemetryService.LOGS, configuration)\n if (!canUseEventBridge()) {\n var telemetryBatch = startBatchWithReplica(\n configuration,\n configuration.rumEndpoint,\n reportError,\n pageExitObservable,\n sessionExpireObservable\n )\n telemetry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,aAAa,EACbG,SAAS,EACTC,WAAW,EACXY,kBAAkB,EAClBC,OAAO,CAACI,gBACV,CAAC;EACH;EAEA,IAAIU,eAAe,GAAGjC,oBAAoB,CAACmB,OAAO,CAAC;EAEnD,OAAO;IACLe,SAAS,EAAEF,sBAAsB,CAACE,SAAS;IAC3CC,kBAAkB,EAAEF,eAAe,CAACG;EACtC,CAAC;AACH;AACA,SAASd,kBAAkBA,CACzBpB,aAAa,EACbI,WAAW,EACXY,kBAAkB,EAClBmB,uBAAuB,EACvB;EACA,IAAMhB,SAAS,GAAGpC,cAAc,CAACG,gBAAgB,CAACkD,IAAI,EAAEpC,aAAa,CAAC;EACtE,IAAI,CAACf,iBAAiB,CAAC,CAAC,EAAE;IACxB,IAAIoD,cAAc,GAAGrD,qBAAqB,CACxCgB,aAAa,EACbA,aAAa,CAACsC,WAAW,EACzBlC,WAAW,EACXY,kBAAkB,EAClBmB,uBACF,CAAC;IACDhB,SAAS,CAACoB,UAAU,CAACC,SAAS,CAAC,UAAUC,KAAK,EAAE;MAC9CJ,cAAc,CAACK,GAAG,CAACD,KAAK,CAAC;IAC3B,CAAC,CAAC;EACJ;EACA,OAAOtB,SAAS;AAClB"}
@@ -35,9 +35,7 @@ export function startLogsAssembly(sessionManager, configuration, lifeCycle, buil
35
35
  device: deviceInfo,
36
36
  type: RumEventType.LOGGER
37
37
  }, commonContext.context, getRUMInternalContext(startTime), rawLogsEvent, logger.getContext(), messageContext);
38
- if (
39
- // Todo: [RUMF-1230] Move this check to the logger collection in the next major release
40
- !isAuthorized(rawLogsEvent.status, HandlerType.http, logger) || configuration.beforeSend && configuration.beforeSend(log) === false || log.error && log.error.origin !== ErrorSource.AGENT && isNullUndefinedDefaultValue(logRateLimiters[log.status], logRateLimiters['custom']).isLimitReached()) {
38
+ if (!isAuthorized(rawLogsEvent.status, HandlerType.http, logger) || configuration.beforeSend && configuration.beforeSend(log) === false || log.error && log.error.origin !== ErrorSource.AGENT && isNullUndefinedDefaultValue(logRateLimiters[log.status], logRateLimiters['custom']).isLimitReached()) {
41
39
  return;
42
40
  }
43
41
  lifeCycle.notify(LifeCycleEventType.LOG_COLLECTED, withSnakeCaseKeys(log));
@@ -1 +1 @@
1
- {"version":3,"file":"assembly.js","names":["ErrorSource","extend2Lev","createEventRateLimiter","getRelativeTime","withSnakeCaseKeys","LifeCycleEventType","deviceInfo","each","RumEventType","isEmptyObject","isNullUndefinedDefaultValue","STATUSES","HandlerType","isAuthorized","startLogsAssembly","sessionManager","configuration","lifeCycle","buildCommonContext","mainLogger","reportError","statusWithCustom","concat","logRateLimiters","status","eventRateLimiterThreshold","subscribe","RAW_LOG_COLLECTED","data","rawLogsEvent","messageContext","undefined","savedCommonContext","logger","startTime","date","session","findTrackedSession","commonContext","log","service","env","version","_gc","sdkName","sdkVersion","id","view","user","device","type","LOGGER","context","getRUMInternalContext","getContext","http","beforeSend","error","origin","AGENT","isLimitReached","notify","LOG_COLLECTED","getInternalContextFromRumGlobal","window","DATAFLUX_RUM","rumGlobal","getInternalContext"],"sources":["../../src/domain/assembly.js"],"sourcesContent":["import {\n ErrorSource,\n extend2Lev,\n createEventRateLimiter,\n getRelativeTime,\n withSnakeCaseKeys,\n LifeCycleEventType,\n deviceInfo,\n each,\n RumEventType,\n isEmptyObject,\n isNullUndefinedDefaultValue\n} from '@cloudcare/browser-core'\n\nimport { STATUSES, HandlerType } from './logger'\nimport { isAuthorized } from './logsCollection/logger/loggerCollection'\n\nexport function startLogsAssembly(\n sessionManager,\n configuration,\n lifeCycle,\n buildCommonContext,\n mainLogger,\n reportError\n) {\n var statusWithCustom = STATUSES.concat(['custom'])\n var logRateLimiters = {}\n each(statusWithCustom, function (status) {\n logRateLimiters[status] = createEventRateLimiter(\n status,\n configuration.eventRateLimiterThreshold,\n reportError\n )\n })\n lifeCycle.subscribe(LifeCycleEventType.RAW_LOG_COLLECTED, function (data) {\n // { rawLogsEvent, messageContext = undefined, savedCommonContext = undefined, logger = mainLogger }\n var rawLogsEvent = data.rawLogsEvent\n var messageContext = data.messageContext || undefined\n var savedCommonContext = data.savedCommonContext || undefined\n var logger = data.logger || mainLogger\n var startTime = getRelativeTime(rawLogsEvent.date)\n var session = sessionManager.findTrackedSession(startTime)\n\n if (!session) {\n return\n }\n var commonContext = savedCommonContext || buildCommonContext()\n var log = extend2Lev(\n {\n service: configuration.service || 'browser',\n env: configuration.env || '',\n version: configuration.version || '',\n _gc: {\n sdkName: configuration.sdkName,\n sdkVersion: configuration.sdkVersion\n },\n session: {\n id: session.id\n },\n view: commonContext.view,\n user: !isEmptyObject(commonContext.user)\n ? commonContext.user\n : undefined,\n device: deviceInfo,\n type: RumEventType.LOGGER\n },\n commonContext.context,\n getRUMInternalContext(startTime),\n rawLogsEvent,\n logger.getContext(),\n messageContext\n )\n\n if (\n // Todo: [RUMF-1230] Move this check to the logger collection in the next major release\n !isAuthorized(rawLogsEvent.status, HandlerType.http, logger) ||\n (configuration.beforeSend && configuration.beforeSend(log) === false) ||\n (log.error &&\n log.error.origin !== ErrorSource.AGENT &&\n isNullUndefinedDefaultValue(\n logRateLimiters[log.status],\n logRateLimiters['custom']\n ).isLimitReached())\n ) {\n return\n }\n\n lifeCycle.notify(LifeCycleEventType.LOG_COLLECTED, withSnakeCaseKeys(log))\n })\n}\n\nexport function getRUMInternalContext(startTime) {\n return getInternalContextFromRumGlobal(window.DATAFLUX_RUM)\n\n function getInternalContextFromRumGlobal(rumGlobal) {\n if (rumGlobal && rumGlobal.getInternalContext) {\n return rumGlobal.getInternalContext(startTime)\n }\n }\n}\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,UAAU,EACVC,sBAAsB,EACtBC,eAAe,EACfC,iBAAiB,EACjBC,kBAAkB,EAClBC,UAAU,EACVC,IAAI,EACJC,YAAY,EACZC,aAAa,EACbC,2BAA2B,QACtB,yBAAyB;AAEhC,SAASC,QAAQ,EAAEC,WAAW,QAAQ,UAAU;AAChD,SAASC,YAAY,QAAQ,0CAA0C;AAEvE,OAAO,SAASC,i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ACF"}
1
+ {"version":3,"file":"assembly.js","names":["ErrorSource","extend2Lev","createEventRateLimiter","getRelativeTime","withSnakeCaseKeys","LifeCycleEventType","deviceInfo","each","RumEventType","isEmptyObject","isNullUndefinedDefaultValue","STATUSES","HandlerType","isAuthorized","startLogsAssembly","sessionManager","configuration","lifeCycle","buildCommonContext","mainLogger","reportError","statusWithCustom","concat","logRateLimiters","status","eventRateLimiterThreshold","subscribe","RAW_LOG_COLLECTED","data","rawLogsEvent","messageContext","undefined","savedCommonContext","logger","startTime","date","session","findTrackedSession","commonContext","log","service","env","version","_gc","sdkName","sdkVersion","id","view","user","device","type","LOGGER","context","getRUMInternalContext","getContext","http","beforeSend","error","origin","AGENT","isLimitReached","notify","LOG_COLLECTED","getInternalContextFromRumGlobal","window","DATAFLUX_RUM","rumGlobal","getInternalContext"],"sources":["../../src/domain/assembly.js"],"sourcesContent":["import {\n ErrorSource,\n extend2Lev,\n createEventRateLimiter,\n getRelativeTime,\n withSnakeCaseKeys,\n LifeCycleEventType,\n deviceInfo,\n each,\n RumEventType,\n isEmptyObject,\n isNullUndefinedDefaultValue\n} from '@cloudcare/browser-core'\n\nimport { STATUSES, HandlerType } from './logger'\nimport { isAuthorized } from './logsCollection/logger/loggerCollection'\n\nexport function startLogsAssembly(\n sessionManager,\n configuration,\n lifeCycle,\n buildCommonContext,\n mainLogger,\n reportError\n) {\n var statusWithCustom = STATUSES.concat(['custom'])\n var logRateLimiters = {}\n each(statusWithCustom, function (status) {\n logRateLimiters[status] = createEventRateLimiter(\n status,\n configuration.eventRateLimiterThreshold,\n reportError\n )\n })\n lifeCycle.subscribe(LifeCycleEventType.RAW_LOG_COLLECTED, function (data) {\n // { rawLogsEvent, messageContext = undefined, savedCommonContext = undefined, logger = mainLogger }\n var rawLogsEvent = data.rawLogsEvent\n var messageContext = data.messageContext || undefined\n var savedCommonContext = data.savedCommonContext || undefined\n var logger = data.logger || mainLogger\n var startTime = getRelativeTime(rawLogsEvent.date)\n var session = sessionManager.findTrackedSession(startTime)\n\n if (!session) {\n return\n }\n var commonContext = savedCommonContext || buildCommonContext()\n var log = extend2Lev(\n {\n service: configuration.service || 'browser',\n env: configuration.env || '',\n version: configuration.version || '',\n _gc: {\n sdkName: configuration.sdkName,\n sdkVersion: configuration.sdkVersion\n },\n session: {\n id: session.id\n },\n view: commonContext.view,\n user: !isEmptyObject(commonContext.user)\n ? commonContext.user\n : undefined,\n device: deviceInfo,\n type: RumEventType.LOGGER\n },\n commonContext.context,\n getRUMInternalContext(startTime),\n rawLogsEvent,\n logger.getContext(),\n messageContext\n )\n\n if (\n !isAuthorized(rawLogsEvent.status, HandlerType.http, logger) ||\n (configuration.beforeSend && configuration.beforeSend(log) === false) ||\n (log.error &&\n log.error.origin !== ErrorSource.AGENT &&\n isNullUndefinedDefaultValue(\n logRateLimiters[log.status],\n logRateLimiters['custom']\n ).isLimitReached())\n ) {\n return\n }\n\n lifeCycle.notify(LifeCycleEventType.LOG_COLLECTED, withSnakeCaseKeys(log))\n })\n}\n\nexport function getRUMInternalContext(startTime) {\n return getInternalContextFromRumGlobal(window.DATAFLUX_RUM)\n\n function getInternalContextFromRumGlobal(rumGlobal) {\n if (rumGlobal && rumGlobal.getInternalContext) {\n return rumGlobal.getInternalContext(startTime)\n }\n }\n}\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,UAAU,EACVC,sBAAsB,EACtBC,eAAe,EACfC,iBAAiB,EACjBC,kBAAkB,EAClBC,UAAU,EACVC,IAAI,EACJC,YAAY,EACZC,aAAa,EACbC,2BAA2B,QACtB,yBAAyB;AAEhC,SAASC,QAAQ,EAAEC,WAAW,QAAQ,UAAU;AAChD,SAASC,YAAY,QAAQ,0CAA0C;AAEvE,OAAO,SAASC,iBAAiBA,CAC/BC,cAAc,EACdC,aAAa,EACbC,SAAS,EACTC,kBAAkB,EAClBC,UAAU,EACVC,WAAW,EACX;EACA,IAAIC,gBAAgB,GAAGV,QAAQ,CAACW,MAAM,CAAC,CAAC,QAAQ,CAA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IAAI,CAAC,GACpCV,aAAa,CAACU,IAAI,GAClBjB,SAAS;MACbkB,MAAM,EAAE3C,UAAU;MAClB4C,IAAI,EAAE1C,YAAY,CAAC2C;IACrB,CAAC,EACDb,aAAa,CAACc,OAAO,EACrBC,qBAAqB,CAACnB,SAAS,CAAC,EAChCL,YAAY,EACZI,MAAM,CAACqB,UAAU,CAAC,CAAC,EACnBxB,cACF,CAAC;IAED,IACE,CAACjB,YAAY,CAACgB,YAAY,CAACL,MAAM,EAAEZ,WAAW,CAAC2C,IAAI,EAAEtB,MAAM,CAAC,IAC3DjB,aAAa,CAACwC,UAAU,IAAIxC,aAAa,CAACwC,UAAU,CAACjB,GAAG,CAAC,KAAK,KAAM,IACpEA,GAAG,CAACkB,KAAK,IACRlB,GAAG,CAACkB,KAAK,CAACC,MAAM,KAAK1D,WAAW,CAAC2D,KAAK,IACtCjD,2BAA2B,CACzBa,eAAe,CAACgB,GAAG,CAACf,MAAM,CAAC,EAC3BD,eAAe,CAAC,QAAQ,CAC1B,CAAC,CAACqC,cAAc,CAAC,CAAE,EACrB;MACA;IACF;IAEA3C,SAAS,CAAC4C,MAAM,CAACxD,kBAAkB,CAACyD,aAAa,EAAE1D,iBAAiB,CAACmC,GAAG,CAAC,CAAC;EAC5E,CAAC,CAAC;AACJ;AAEA,OAAO,SAASc,qBAAqBA,CAACnB,SAAS,EAAE;EAC/C,OAAO6B,+BAA+B,CAACC,MAAM,CAACC,YAAY,CAAC;EAE3D,SAASF,+BAA+BA,CAACG,SAAS,EAAE;IAClD,IAAIA,SAAS,IAAIA,SAAS,CAACC,kBAAkB,EAAE;MAC7C,OAAOD,SAAS,CAACC,kBAAkB,CAACjC,SAAS,CAAC;IAChD;EACF;AACF"}
@@ -105,6 +105,9 @@ Logger.prototype = {
105
105
  removeContext: function removeContext(key) {
106
106
  this.contextManager.remove(key);
107
107
  },
108
+ clearContext: function clearContext() {
109
+ this.contextManager.clearContext();
110
+ },
108
111
  setHandler: function setHandler(handler) {
109
112
  this.handlerType = handler;
110
113
  },
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","names":["assign","extend2Lev","createContextManager","ErrorSource","keys","CustomerDataType","sanitize","computeStackTrace","computeRawError","clocksNow","ErrorHandling","monitor","NonErrorPrefix","StatusType","debug","error","info","warn","critical","HandlerType","console","http","silent","STATUSES","Logger","handleLogStrategy","name","handlerType","level","loggerContext","contextManager","LoggerContext","set","logger","undefined","prototype","log","message","messageContext","status","errorContext","origin","LOGGER","stackTrace","Error","rawError","originalError","nonErrorPrefix","PROVIDED","source","handling","HANDLED","startClocks","stack","kind","type","sanitizedMessageContext","context","errorOrigin","setContext","getContext","get","addContext","key","value","add","removeContext","remove","setHandler","handler","getHandler","setLevel","getLevel"],"sources":["../../src/domain/logger.js"],"sourcesContent":["import {\n assign,\n extend2Lev,\n createContextManager,\n ErrorSource,\n keys,\n CustomerDataType,\n sanitize,\n computeStackTrace,\n computeRawError,\n clocksNow,\n ErrorHandling,\n monitor,\n NonErrorPrefix\n} from '@cloudcare/browser-core'\n\nexport var StatusType = {\n debug: 'debug',\n error: 'error',\n info: 'info',\n warn: 'warn',\n critical: 'critical'\n}\n\nexport var HandlerType = {\n console: 'console',\n http: 'http',\n silent: 'silent'\n}\n\nexport var STATUSES = keys(StatusType)\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport function Logger(\n handleLogStrategy,\n name,\n handlerType,\n level,\n loggerContext\n) {\n this.contextManager = createContextManager(CustomerDataType.LoggerContext)\n if (typeof handlerType === 'undefined') {\n handlerType = HandlerType.http\n }\n if (typeof level === 'undefined') {\n level = StatusType.debug\n }\n if (typeof loggerContext === 'undefined') {\n loggerContext = {}\n }\n this.handleLogStrategy = handleLogStrategy\n this.handlerType = handlerType\n this.level = level\n this.contextManager.set(\n assign({}, loggerContext, name ? { logger: { name: name } } : undefined)\n )\n}\nLogger.prototype = {\n log: monitor(function (message, messageContext, status, error) {\n if (typeof status === 'undefined') {\n status = StatusType.info\n }\n var errorContext\n if (status === StatusType.error) {\n // Always add origin if status is error (backward compatibility - Remove in next major)\n errorContext = { origin: ErrorSource.LOGGER }\n }\n if (error !== undefined && error !== null) {\n var stackTrace =\n error instanceof Error ? computeStackTrace(error) : undefined\n var rawError = computeRawError({\n stackTrace: stackTrace,\n originalError: error,\n nonErrorPrefix: NonErrorPrefix.PROVIDED,\n source: ErrorSource.LOGGER,\n handling: ErrorHandling.HANDLED,\n startClocks: clocksNow()\n })\n\n errorContext = {\n origin: ErrorSource.LOGGER, // Remove in next major\n stack: rawError.stack,\n kind: rawError.type,\n message: rawError.message\n }\n }\n\n var sanitizedMessageContext = sanitize(messageContext)\n\n var context = errorContext\n ? extend2Lev({ error: errorContext }, sanitizedMessageContext)\n : sanitizedMessageContext\n\n this.handleLogStrategy(\n { message: message, context: context, status: status },\n this\n )\n }),\n\n debug: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.debug, error)\n },\n\n info: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.info, error)\n },\n\n warn: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.warn, error)\n },\n critical: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.critical, error)\n },\n error: function (message, messageContext, error) {\n var errorOrigin = {\n error: {\n origin: ErrorSource.LOGGER\n }\n }\n this.log(\n message,\n extend2Lev(errorOrigin, messageContext),\n StatusType.error,\n error\n )\n },\n\n setContext: function (context) {\n this.contextManager.set(context)\n },\n\n getContext: function () {\n return this.contextManager.get()\n },\n\n addContext: function (key, value) {\n this.contextManager.add(key, value)\n },\n\n removeContext: function (key) {\n this.contextManager.remove(key)\n },\n\n setHandler: function (handler) {\n this.handlerType = handler\n },\n\n getHandler: function () {\n return this.handlerType\n },\n setLevel: function (level) {\n this.level = level\n },\n getLevel: function () {\n return this.level\n }\n}\n"],"mappings":"AAAA,SACEA,MAAM,EACNC,UAAU,EACVC,oBAAoB,EACpBC,WAAW,EACXC,IAAI,EACJC,gBAAgB,EAChBC,QAAQ,EACRC,iBAAiB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A,EAAY;IACtB,OAAO,IAAI,CAAC9B,cAAc,CAAC+B,GAAG,CAAC,CAAC;EAClC,CAAC;EAEDC,UAAU,EAAE,SAAAA,WAAUC,GAAG,EAAEC,KAAK,EAAE;IAChC,IAAI,CAAClC,cAAc,CAACmC,GAAG,CAACF,GAAG,EAAEC,KAAK,CAAC;EACrC,CAAC;EAEDE,aAAa,EAAE,SAAAA,cAAUH,GAAG,EAAE;IAC5B,IAAI,CAACjC,cAAc,CAACqC,MAAM,CAACJ,GAAG,CAAC;EACjC,CAAC;EAEDK,UAAU,EAAE,SAAAA,WAAUC,OAAO,EAAE;IAC7B,IAAI,CAAC1C,WAAW,GAAG0C,OAAO;EAC5B,CAAC;EAEDC,UAAU,EAAE,SAAAA,WAAA,EAAY;IACtB,OAAO,IAAI,CAAC3C,WAAW;EACzB,CAAC;EACD4C,QAAQ,EAAE,SAAAA,SAAU3C,KAAK,EAAE;IACzB,IAAI,CAACA,KAAK,GAAGA,KAAK;EACpB,CAAC;EACD4C,QAAQ,EAAE,SAAAA,SAAA,EAAY;IACpB,OAAO,IAAI,CAAC5C,KAAK;EACnB;AACF,CAAC"}
1
+ {"version":3,"file":"logger.js","names":["assign","extend2Lev","createContextManager","ErrorSource","keys","CustomerDataType","sanitize","computeStackTrace","computeRawError","clocksNow","ErrorHandling","monitor","NonErrorPrefix","StatusType","debug","error","info","warn","critical","HandlerType","console","http","silent","STATUSES","Logger","handleLogStrategy","name","handlerType","level","loggerContext","contextManager","LoggerContext","set","logger","undefined","prototype","log","message","messageContext","status","errorContext","origin","LOGGER","stackTrace","Error","rawError","originalError","nonErrorPrefix","PROVIDED","source","handling","HANDLED","startClocks","stack","kind","type","sanitizedMessageContext","context","errorOrigin","setContext","getContext","get","addContext","key","value","add","removeContext","remove","clearContext","setHandler","handler","getHandler","setLevel","getLevel"],"sources":["../../src/domain/logger.js"],"sourcesContent":["import {\n assign,\n extend2Lev,\n createContextManager,\n ErrorSource,\n keys,\n CustomerDataType,\n sanitize,\n computeStackTrace,\n computeRawError,\n clocksNow,\n ErrorHandling,\n monitor,\n NonErrorPrefix\n} from '@cloudcare/browser-core'\n\nexport var StatusType = {\n debug: 'debug',\n error: 'error',\n info: 'info',\n warn: 'warn',\n critical: 'critical'\n}\n\nexport var HandlerType = {\n console: 'console',\n http: 'http',\n silent: 'silent'\n}\n\nexport var STATUSES = keys(StatusType)\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport function Logger(\n handleLogStrategy,\n name,\n handlerType,\n level,\n loggerContext\n) {\n this.contextManager = createContextManager(CustomerDataType.LoggerContext)\n if (typeof handlerType === 'undefined') {\n handlerType = HandlerType.http\n }\n if (typeof level === 'undefined') {\n level = StatusType.debug\n }\n if (typeof loggerContext === 'undefined') {\n loggerContext = {}\n }\n this.handleLogStrategy = handleLogStrategy\n this.handlerType = handlerType\n this.level = level\n this.contextManager.set(\n assign({}, loggerContext, name ? { logger: { name: name } } : undefined)\n )\n}\nLogger.prototype = {\n log: monitor(function (message, messageContext, status, error) {\n if (typeof status === 'undefined') {\n status = StatusType.info\n }\n var errorContext\n if (status === StatusType.error) {\n // Always add origin if status is error (backward compatibility - Remove in next major)\n errorContext = { origin: ErrorSource.LOGGER }\n }\n if (error !== undefined && error !== null) {\n var stackTrace =\n error instanceof Error ? computeStackTrace(error) : undefined\n var rawError = computeRawError({\n stackTrace: stackTrace,\n originalError: error,\n nonErrorPrefix: NonErrorPrefix.PROVIDED,\n source: ErrorSource.LOGGER,\n handling: ErrorHandling.HANDLED,\n startClocks: clocksNow()\n })\n\n errorContext = {\n origin: ErrorSource.LOGGER, // Remove in next major\n stack: rawError.stack,\n kind: rawError.type,\n message: rawError.message\n }\n }\n\n var sanitizedMessageContext = sanitize(messageContext)\n\n var context = errorContext\n ? extend2Lev({ error: errorContext }, sanitizedMessageContext)\n : sanitizedMessageContext\n\n this.handleLogStrategy(\n { message: message, context: context, status: status },\n this\n )\n }),\n\n debug: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.debug, error)\n },\n\n info: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.info, error)\n },\n\n warn: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.warn, error)\n },\n critical: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.critical, error)\n },\n error: function (message, messageContext, error) {\n var errorOrigin = {\n error: {\n origin: ErrorSource.LOGGER\n }\n }\n this.log(\n message,\n extend2Lev(errorOrigin, messageContext),\n StatusType.error,\n error\n )\n },\n\n setContext: function (context) {\n this.contextManager.set(context)\n },\n\n getContext: function () {\n return this.contextManager.get()\n },\n\n addContext: function (key, value) {\n this.contextManager.add(key, value)\n },\n\n removeContext: function (key) {\n this.contextManager.remove(key)\n },\n clearContext() {\n this.contextManager.clearContext()\n },\n setHandler: function (handler) {\n this.handlerType = handler\n },\n\n getHandler: function () {\n return this.handlerType\n },\n setLevel: function (level) {\n this.level = level\n },\n getLevel: function () {\n return this.level\n }\n}\n"],"mappings":"AAAA,SACEA,MAAM,EACNC,UAAU,EACVC,oBAAoB,EACpBC,WAAW,EACXC,IAAI,EACJC,gBAAgB,EAChBC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfC,SAAS,EACTC,aAAa,EACbC,OAAO,EACPC,cAAc,QACT,yBAAyB;AAEhC,OAAO,IAAIC,UAAU,GAAG;EACtBC,KAAK,EAAE,OAAO;EACdC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,IAAIC,WAAW,GAAG;EACvBC,OAAO,EAAE,SAAS;EAClBC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACV,CAAC;AAED,OAAO,IAAIC,QAAQ,GAAGnB,IAAI,CAACS,UAAU,CAAC;AACtC;AACA,OAAO,SAASW,MAAMA,CACpBC,iBAAiB,EACjBC,IAAI,EACJC,WAAW,EACXC,KAAK,EACLC,aAAa,EACb;EACA,IAAI,CAACC,cAAc,G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;EAEDC,UAAU,EAAE,SAAAA,WAAA,EAAY;IACtB,OAAO,IAAI,CAAC5C,WAAW;EACzB,CAAC;EACD6C,QAAQ,EAAE,SAAAA,SAAU5C,KAAK,EAAE;IACzB,IAAI,CAACA,KAAK,GAAGA,KAAK;EACpB,CAAC;EACD6C,QAAQ,EAAE,SAAAA,SAAA,EAAY;IACpB,OAAO,IAAI,CAAC7C,KAAK;EACnB;AACF,CAAC"}
@@ -15,7 +15,6 @@ export function startConsoleCollection(configuration, lifeCycle) {
15
15
  origin: ErrorSource.CONSOLE,
16
16
  error: log.api === ConsoleApiName.error ? {
17
17
  origin: ErrorSource.CONSOLE,
18
- // Todo: Remove in the next major release
19
18
  stack: log.stack
20
19
  } : undefined,
21
20
  status: LogStatusForApi[log.api]
@@ -1 +1 @@
1
- {"version":3,"file":"consoleCollection.js","names":["timeStampNow","ConsoleApiName","ErrorSource","initConsoleObservable","LifeCycleEventType","StatusType","LogStatusForApi","_LogStatusForApi","_defineProperty","log","info","debug","warn","error","startConsoleCollection","configuration","lifeCycle","consoleSubscription","forwardConsoleLogs","subscribe","notify","RAW_LOG_COLLECTED","rawLogsEvent","date","message","origin","CONSOLE","api","stack","undefined","status","stop","unsubscribe"],"sources":["../../../../src/domain/logsCollection/console/consoleCollection.js"],"sourcesContent":["import { timeStampNow, ConsoleApiName, ErrorSource, initConsoleObservable, LifeCycleEventType } from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\n\nvar LogStatusForApi = {\n [ConsoleApiName.log]: StatusType.info,\n [ConsoleApiName.debug]: StatusType.debug,\n [ConsoleApiName.info]: StatusType.info,\n [ConsoleApiName.warn]: StatusType.warn,\n [ConsoleApiName.error]: StatusType.error,\n}\nexport function startConsoleCollection(configuration, lifeCycle) {\n var consoleSubscription = initConsoleObservable(configuration.forwardConsoleLogs).subscribe(function(log) {\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n date: timeStampNow(),\n message: log.message,\n origin: ErrorSource.CONSOLE,\n error:\n log.api === ConsoleApiName.error\n ? {\n origin: ErrorSource.CONSOLE, // Todo: Remove in the next major release\n stack: log.stack,\n }\n : undefined,\n status: LogStatusForApi[log.api],\n },\n })\n })\n\n return {\n stop: function(){\n consoleSubscription.unsubscribe()\n },\n }\n}\n"],"mappings":";;;;;AAAA,SAASA,YAAY,EAAEC,cAAc,EAAEC,WAAW,EAAEC,qBAAqB,EAAEC,kBAAkB,QAAQ,yBAAyB;AAC9H,SAASC,UAAU,QAAQ,cAAc;AAGzC,IAAIC,eAAe,IAAAC,gBAAA,OAAAC,eAAA,CAAAD,gBAAA,EAChBN,cAAc,CAACQ,GAAG,EAAGJ,UAAU,CAACK,IAAI,GAAAF,eAAA,CAAAD,gBAAA,EACpCN,cAAc,CAACU,KAAK,EAAGN,UAAU,CAACM,KAAK,GAAAH,eAAA,CAAAD,gBAAA,EACvCN,cAAc,CAACS,IAAI,EAAGL,UAAU,CAACK,IAAI,GAAAF,eAAA,CAAAD,gBAAA,EACrCN,cAAc,CAACW,IAAI,EAAGP,UAAU,CAACO,IAAI,GAAAJ,eAAA,CAAAD,gBAAA,EACrCN,cAAc,CAACY,KAAK,EAAGR,UAAU,CAACQ,KAAK,GAAAN,gBAAA,CACzC;AACD,OAAO,SAASO,sBAAsBA,CAACC,aAAa,EAAEC,SAAS,EAAE;EAC/D,IAAIC,mBAAmB,GAAGd,qBAAqB,CAACY,aAAa,CAACG,kBAAkB,CAAC,CAACC,SAAS,CAAC,UAASV,GAAG,EAAE;IACxGO,SAAS,CAACI,MAAM,CAAChB,kBAAkB,CAACiB,iBAAiB,EAAE;MACrDC,YAAY,EAAE;QACZC,IAAI,EAAEvB,YAAY,CAAC,CAAC;QACpBwB,OAAO,EAAEf,GAAG,CAACe,OAAO;QACpBC,MAAM,EAAEvB,WAAW,CAACwB,OAAO;QAC3Bb,KAAK,EACHJ,GAAG,CAACkB,GAAG,KAAK1B,cAAc,CAACY,KAAK,GAC5B;UACEY,MAAM,EAAEvB,WAAW,CAACwB,OAAO;UAAE;UAC7BE,KAAK,EAAEnB,GAAG,CAACmB;QACb,CAAC,GACDC,SAAS;QACfC,MAAM,EAAExB,eAAe,CAACG,GAAG,CAACkB,GAAG;MACjC;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLI,IAAI,EAAE,SAAAA,KAAA,EAAU;MACdd,mBAAmB,CAACe,WAAW,CAAC,CAAC;IACnC;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"consoleCollection.js","names":["timeStampNow","ConsoleApiName","ErrorSource","initConsoleObservable","LifeCycleEventType","StatusType","LogStatusForApi","_LogStatusForApi","_defineProperty","log","info","debug","warn","error","startConsoleCollection","configuration","lifeCycle","consoleSubscription","forwardConsoleLogs","subscribe","notify","RAW_LOG_COLLECTED","rawLogsEvent","date","message","origin","CONSOLE","api","stack","undefined","status","stop","unsubscribe"],"sources":["../../../../src/domain/logsCollection/console/consoleCollection.js"],"sourcesContent":["import {\n timeStampNow,\n ConsoleApiName,\n ErrorSource,\n initConsoleObservable,\n LifeCycleEventType\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nvar LogStatusForApi = {\n [ConsoleApiName.log]: StatusType.info,\n [ConsoleApiName.debug]: StatusType.debug,\n [ConsoleApiName.info]: StatusType.info,\n [ConsoleApiName.warn]: StatusType.warn,\n [ConsoleApiName.error]: StatusType.error\n}\nexport function startConsoleCollection(configuration, lifeCycle) {\n var consoleSubscription = initConsoleObservable(\n configuration.forwardConsoleLogs\n ).subscribe(function (log) {\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n date: timeStampNow(),\n message: log.message,\n origin: ErrorSource.CONSOLE,\n error:\n log.api === ConsoleApiName.error\n ? {\n origin: ErrorSource.CONSOLE,\n stack: log.stack\n }\n : undefined,\n status: LogStatusForApi[log.api]\n }\n })\n })\n\n return {\n stop: function () {\n consoleSubscription.unsubscribe()\n }\n }\n}\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LI,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChBd,mBAAmB,CAACe,WAAW,CAAC,CAAC;IACnC;EACF,CAAC;AACH"}
@@ -34,12 +34,10 @@ export function startNetworkErrorCollection(configuration, lifeCycle) {
34
34
  date: request.startClocks.timeStamp,
35
35
  error: {
36
36
  origin: ErrorSource.NETWORK,
37
- // Todo: Remove in the next major release
38
37
  stack: responseData || 'Failed to load'
39
38
  },
40
39
  http: {
41
40
  method: request.method,
42
- // Cast resource method because of case mismatch cf issue RUMF-1152
43
41
  status_code: request.status,
44
42
  url: request.url,
45
43
  statusGroup: getStatusGroup(request.status),
@@ -60,12 +58,6 @@ export function startNetworkErrorCollection(configuration, lifeCycle) {
60
58
  }
61
59
  };
62
60
  }
63
-
64
- // TODO: ideally, computeXhrResponseData should always call the callback with a string instead of
65
- // `unknown`. But to keep backward compatibility, in the case of XHR with a `responseType` different
66
- // than "text", the response data should be whatever `xhr.response` is. This is a bit confusing as
67
- // Logs event 'stack' is expected to be a string. This should be changed in a future major version
68
- // as it could be a breaking change.
69
61
  export function computeXhrResponseData(xhr, configuration, callback) {
70
62
  if (typeof xhr.response === 'string') {
71
63
  callback(truncateResponseText(xhr.response, configuration));
@@ -1 +1 @@
1
- {"version":3,"file":"networkErrorCollection.js","names":["ErrorSource","initXhrObservable","RequestType","initFetchObservable","computeStackTrace","toStackTraceString","noop","each","LifeCycleEventType","getStatusGroup","urlParse","replaceNumberCharByPath","tryToClone","readBytesFromStream","monitor","StatusType","startNetworkErrorCollection","configuration","lifeCycle","forwardErrorsToLogs","stop","xhrSubscription","subscribe","context","state","handleCompleteRequest","XHR","fetchSubscription","FETCH","type","request","isIntakeUrl","url","isRejected","isServerError","computeXhrResponseData","xhr","onResponseDataAvailable","response","computeFetchResponseText","error","computeFetchErrorText","responseData","urlObj","getParse","notify","RAW_LOG_COLLECTED","rawLogsEvent","message","format","method","date","startClocks","timeStamp","origin","NETWORK","stack","http","status_code","status","statusGroup","urlHost","Host","urlPath","Path","urlPathGroup","unsubscribe","callback","truncateResponseText","clonedResponse","body","window","TextDecoder","text","then","truncateResponseStream","requestErrorResponseLengthLimit","responseText","responseType","length","substring","stream","bytesLimit","bytes","limitExceeded","decode","undefined","collectStreamBody"],"sources":["../../../../src/domain/logsCollection/networkError/networkErrorCollection.js"],"sourcesContent":["import {\n ErrorSource,\n initXhrObservable,\n RequestType,\n initFetchObservable,\n computeStackTrace,\n toStackTraceString,\n noop,\n each,\n LifeCycleEventType,\n getStatusGroup,\n urlParse,\n replaceNumberCharByPath,\n tryToClone,\n readBytesFromStream,\n monitor\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nexport function startNetworkErrorCollection(configuration, lifeCycle) {\n if (!configuration.forwardErrorsToLogs) {\n return { stop: noop }\n }\n\n var xhrSubscription = initXhrObservable().subscribe(function (context) {\n if (context.state === 'complete') {\n handleCompleteRequest(RequestType.XHR, context)\n }\n })\n var fetchSubscription = initFetchObservable().subscribe(function (context) {\n if (context.state === 'resolve') {\n handleCompleteRequest(RequestType.FETCH, context)\n }\n })\n\n function handleCompleteRequest(type, request) {\n if (\n !configuration.isIntakeUrl(request.url) &&\n (isRejected(request) ||\n isServerError(request) ||\n configuration.isServerError(request))\n ) {\n if ('xhr' in request) {\n computeXhrResponseData(\n request.xhr,\n configuration,\n onResponseDataAvailable\n )\n } else if (request.response) {\n computeFetchResponseText(\n request.response,\n configuration,\n onResponseDataAvailable\n )\n } else if (request.error) {\n computeFetchErrorText(\n request.error,\n configuration,\n onResponseDataAvailable\n )\n }\n }\n\n function onResponseDataAvailable(responseData) {\n var urlObj = urlParse(request.url).getParse()\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message:\n format(type) + ' error ' + request.method + ' ' + request.url,\n date: request.startClocks.timeStamp,\n error: {\n origin: ErrorSource.NETWORK, // Todo: Remove in the next major release\n stack: responseData || 'Failed to load'\n },\n http: {\n method: request.method, // Cast resource method because of case mismatch cf issue RUMF-1152\n status_code: request.status,\n url: request.url,\n statusGroup: getStatusGroup(request.status),\n urlHost: urlObj.Host,\n urlPath: urlObj.Path,\n urlPathGroup: replaceNumberCharByPath(urlObj.Path)\n },\n status: StatusType.error,\n origin: ErrorSource.NETWORK\n }\n })\n }\n }\n\n return {\n stop: function () {\n xhrSubscription.unsubscribe()\n fetchSubscription.unsubscribe()\n }\n }\n}\n\n// TODO: ideally, computeXhrResponseData should always call the callback with a string instead of\n// `unknown`. But to keep backward compatibility, in the case of XHR with a `responseType` different\n// than \"text\", the response data should be whatever `xhr.response` is. This is a bit confusing as\n// Logs event 'stack' is expected to be a string. This should be changed in a future major version\n// as it could be a breaking change.\nexport function computeXhrResponseData(xhr, configuration, callback) {\n if (typeof xhr.response === 'string') {\n callback(truncateResponseText(xhr.response, configuration))\n } else {\n callback(xhr.response)\n }\n}\n\nexport function computeFetchErrorText(error, configuration, callback) {\n callback(\n truncateResponseText(\n toStackTraceString(computeStackTrace(error)),\n configuration\n )\n )\n}\n\nexport function computeFetchResponseText(response, configuration, callback) {\n var clonedResponse = tryToClone(response)\n if (!clonedResponse || !clonedResponse.body) {\n // if the clone failed or if the body is null, let's not try to read it.\n callback()\n } else if (!window.TextDecoder) {\n // If the browser doesn't support TextDecoder, let's read the whole response then truncate it.\n //\n // This should only be the case on early versions of Edge (before they migrated to Chromium).\n // Even if it could be possible to implement a workaround for the missing TextDecoder API (using\n // a Blob and FileReader), we found another issue preventing us from reading only the first\n // bytes from the response: contrary to other browsers, when reading from the cloned response,\n // if the original response gets canceled, the cloned response is also canceled and we can't\n // know about it. In the following illustration, the promise returned by `reader.read()` may\n // never be fulfilled:\n //\n // fetch('/').then((response) => {\n // const reader = response.clone().body.getReader()\n // readMore()\n // function readMore() {\n // reader.read().then(\n // (result) => {\n // if (result.done) {\n // console.log('done')\n // } else {\n // readMore()\n // }\n // },\n // () => console.log('error')\n // )\n // }\n // response.body.getReader().cancel()\n // })\n clonedResponse.text().then(\n monitor(function (text) {\n return callback(truncateResponseText(text, configuration))\n }),\n monitor(function (error) {\n return callback('Unable to retrieve response: ' + error)\n })\n )\n } else {\n truncateResponseStream(\n clonedResponse.body,\n configuration.requestErrorResponseLengthLimit,\n function (error, responseText) {\n if (error) {\n callback('Unable to retrieve response: ' + error)\n } else {\n callback(responseText)\n }\n }\n )\n }\n}\n\nfunction isRejected(request) {\n return request.status === 0 && request.responseType !== 'opaque'\n}\n\nfunction isServerError(request) {\n return request.status >= 500\n}\n\nfunction truncateResponseText(responseText, configuration) {\n if (responseText.length > configuration.requestErrorResponseLengthLimit) {\n return (\n responseText.substring(0, configuration.requestErrorResponseLengthLimit) +\n '...'\n )\n }\n return responseText\n}\n\nfunction format(type) {\n if (RequestType.XHR === type) {\n return 'XHR'\n }\n return 'Fetch'\n}\n\nfunction truncateResponseStream(stream, bytesLimit, callback) {\n readBytesFromStream(\n stream,\n function (error, bytes, limitExceeded) {\n if (error) {\n callback(error)\n } else {\n var responseText = new TextDecoder().decode(bytes)\n if (limitExceeded) {\n responseText += '...'\n }\n callback(undefined, responseText)\n }\n },\n {\n bytesLimit: bytesLimit,\n collectStreamBody: true\n }\n )\n}\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAClBC,IAAI,EACJC,IAAI,EACJC,kBAAkB,EAClBC,cAAc,EACdC,QAAQ,EACRC,uBAAuB,EACvBC,UAAU,EACVC,mBAAmB,EACnBC,OAAO,QACF,yBAAyB;AAChC,SAASC,UAAU,QAAQ,cAAc;AAEzC,OAAO,SAASC,2BAA2BA,CAACC,aAAa,EAAEC,SAAS,EAAE;EACpE,IAAI,CAACD,aAAa,CAACE,mBAAmB,EAAE;IACtC,OAAO;MAAEC,IAAI,EAAEd;IAAK,CAAC;EACvB;EAEA,IAAIe,eAAe,GAAGpB,iBAAiB,CAAC,CAAC,CAACqB,SAAS,CAAC,UAAUC,OAAO,EAAE;IACrE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B,OAAO,CAACgD,YAAY,KAAK,QAAQ;AAClE;AAEA,SAAS5C,aAAaA,CAACJ,OAAO,EAAE;EAC9B,OAAOA,OAAO,CAAC6B,MAAM,IAAI,GAAG;AAC9B;AAEA,SAASS,oBAAoBA,CAACS,YAAY,EAAE5D,aAAa,EAAE;EACzD,IAAI4D,YAAY,CAACE,MAAM,GAAG9D,aAAa,CAAC2D,+BAA+B,EAAE;IACvE,OACEC,YAAY,CAACG,SAAS,CAAC,CAAC,EAAE/D,aAAa,CAAC2D,+BAA+B,CAAC,GACxE,KAAK;EAET;EACA,OAAOC,YAAY;AACrB;AAEA,SAAS5B,MAAMA,CAACpB,IAAI,EAAE;EACpB,IAAI3B,WAAW,CAACwB,GAAG,KAAKG,IAAI,EAAE;IAC5B,OAAO,KAAK;EACd;EACA,OAAO,OAAO;AAChB;AAEA,SAAS8C,sBAAsBA,CAACM,MAAM,EAAEC,UAAU,EAAEf,QAAQ,EAAE;EAC5DtD,mBAAmB,CACjBoE,MAAM,EACN,UAAUzC,KAAK,EAAE2C,KAAK,EAAEC,aAAa,EAAE;IACrC,IAAI5C,KAAK,EAAE;MACT2B,QAAQ,CAAC3B,KAAK,CAAC;IACjB,CAAC,MAAM;MACL,IAAIqC,YAAY,GAAG,IAAIL,WAAW,CAAC,CAAC,CAACa,MAAM,CAACF,KAAK,CAAC;MAClD,IAAIC,aAAa,EAAE;QACjBP,YAAY,IAAI,KAAK;MACvB;MACAV,QAAQ,CAACmB,SAAS,EAAET,YAAY,CAAC;IACnC;EACF,CAAC,EACD;IACEK,UAAU,EAAEA,UAAU;IACtBK,iBAAiB,EAAE;EACrB,CACF,CAAC;AACH"}
1
+ {"version":3,"file":"networkErrorCollection.js","names":["ErrorSource","initXhrObservable","RequestType","initFetchObservable","computeStackTrace","toStackTraceString","noop","each","LifeCycleEventType","getStatusGroup","urlParse","replaceNumberCharByPath","tryToClone","readBytesFromStream","monitor","StatusType","startNetworkErrorCollection","configuration","lifeCycle","forwardErrorsToLogs","stop","xhrSubscription","subscribe","context","state","handleCompleteRequest","XHR","fetchSubscription","FETCH","type","request","isIntakeUrl","url","isRejected","isServerError","computeXhrResponseData","xhr","onResponseDataAvailable","response","computeFetchResponseText","error","computeFetchErrorText","responseData","urlObj","getParse","notify","RAW_LOG_COLLECTED","rawLogsEvent","message","format","method","date","startClocks","timeStamp","origin","NETWORK","stack","http","status_code","status","statusGroup","urlHost","Host","urlPath","Path","urlPathGroup","unsubscribe","callback","truncateResponseText","clonedResponse","body","window","TextDecoder","text","then","truncateResponseStream","requestErrorResponseLengthLimit","responseText","responseType","length","substring","stream","bytesLimit","bytes","limitExceeded","decode","undefined","collectStreamBody"],"sources":["../../../../src/domain/logsCollection/networkError/networkErrorCollection.js"],"sourcesContent":["import {\n ErrorSource,\n initXhrObservable,\n RequestType,\n initFetchObservable,\n computeStackTrace,\n toStackTraceString,\n noop,\n each,\n LifeCycleEventType,\n getStatusGroup,\n urlParse,\n replaceNumberCharByPath,\n tryToClone,\n readBytesFromStream,\n monitor\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nexport function startNetworkErrorCollection(configuration, lifeCycle) {\n if (!configuration.forwardErrorsToLogs) {\n return { stop: noop }\n }\n\n var xhrSubscription = initXhrObservable().subscribe(function (context) {\n if (context.state === 'complete') {\n handleCompleteRequest(RequestType.XHR, context)\n }\n })\n var fetchSubscription = initFetchObservable().subscribe(function (context) {\n if (context.state === 'resolve') {\n handleCompleteRequest(RequestType.FETCH, context)\n }\n })\n\n function handleCompleteRequest(type, request) {\n if (\n !configuration.isIntakeUrl(request.url) &&\n (isRejected(request) ||\n isServerError(request) ||\n configuration.isServerError(request))\n ) {\n if ('xhr' in request) {\n computeXhrResponseData(\n request.xhr,\n configuration,\n onResponseDataAvailable\n )\n } else if (request.response) {\n computeFetchResponseText(\n request.response,\n configuration,\n onResponseDataAvailable\n )\n } else if (request.error) {\n computeFetchErrorText(\n request.error,\n configuration,\n onResponseDataAvailable\n )\n }\n }\n\n function onResponseDataAvailable(responseData) {\n var urlObj = urlParse(request.url).getParse()\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message:\n format(type) + ' error ' + request.method + ' ' + request.url,\n date: request.startClocks.timeStamp,\n error: {\n origin: ErrorSource.NETWORK,\n stack: responseData || 'Failed to load'\n },\n http: {\n method: request.method,\n status_code: request.status,\n url: request.url,\n statusGroup: getStatusGroup(request.status),\n urlHost: urlObj.Host,\n urlPath: urlObj.Path,\n urlPathGroup: replaceNumberCharByPath(urlObj.Path)\n },\n status: StatusType.error,\n origin: ErrorSource.NETWORK\n }\n })\n }\n }\n\n return {\n stop: function () {\n xhrSubscription.unsubscribe()\n fetchSubscription.unsubscribe()\n }\n }\n}\n\nexport function computeXhrResponseData(xhr, configuration, callback) {\n if (typeof xhr.response === 'string') {\n callback(truncateResponseText(xhr.response, configuration))\n } else {\n callback(xhr.response)\n }\n}\n\nexport function computeFetchErrorText(error, configuration, callback) {\n callback(\n truncateResponseText(\n toStackTraceString(computeStackTrace(error)),\n configuration\n )\n )\n}\n\nexport function computeFetchResponseText(response, configuration, callback) {\n var clonedResponse = tryToClone(response)\n if (!clonedResponse || !clonedResponse.body) {\n // if the clone failed or if the body is null, let's not try to read it.\n callback()\n } else if (!window.TextDecoder) {\n // If the browser doesn't support TextDecoder, let's read the whole response then truncate it.\n //\n // This should only be the case on early versions of Edge (before they migrated to Chromium).\n // Even if it could be possible to implement a workaround for the missing TextDecoder API (using\n // a Blob and FileReader), we found another issue preventing us from reading only the first\n // bytes from the response: contrary to other browsers, when reading from the cloned response,\n // if the original response gets canceled, the cloned response is also canceled and we can't\n // know about it. In the following illustration, the promise returned by `reader.read()` may\n // never be fulfilled:\n //\n // fetch('/').then((response) => {\n // const reader = response.clone().body.getReader()\n // readMore()\n // function readMore() {\n // reader.read().then(\n // (result) => {\n // if (result.done) {\n // console.log('done')\n // } else {\n // readMore()\n // }\n // },\n // () => console.log('error')\n // )\n // }\n // response.body.getReader().cancel()\n // })\n clonedResponse.text().then(\n monitor(function (text) {\n return callback(truncateResponseText(text, configuration))\n }),\n monitor(function (error) {\n return callback('Unable to retrieve response: ' + error)\n })\n )\n } else {\n truncateResponseStream(\n clonedResponse.body,\n configuration.requestErrorResponseLengthLimit,\n function (error, responseText) {\n if (error) {\n callback('Unable to retrieve response: ' + error)\n } else {\n callback(responseText)\n }\n }\n )\n }\n}\n\nfunction isRejected(request) {\n return request.status === 0 && request.responseType !== 'opaque'\n}\n\nfunction isServerError(request) {\n return request.status >= 500\n}\n\nfunction truncateResponseText(responseText, configuration) {\n if (responseText.length > configuration.requestErrorResponseLengthLimit) {\n return (\n responseText.substring(0, configuration.requestErrorResponseLengthLimit) +\n '...'\n )\n }\n return responseText\n}\n\nfunction format(type) {\n if (RequestType.XHR === type) {\n return 'XHR'\n }\n return 'Fetch'\n}\n\nfunction truncateResponseStream(stream, bytesLimit, callback) {\n readBytesFromStream(\n stream,\n function (error, bytes, limitExceeded) {\n if (error) {\n callback(error)\n } else {\n var responseText = new TextDecoder().decode(bytes)\n if (limitExceeded) {\n responseText += '...'\n }\n callback(undefined, responseText)\n }\n },\n {\n bytesLimit: bytesLimit,\n collectStreamBody: true\n }\n )\n}\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAClBC,IAAI,EACJC,IAAI,EACJC,kBAAkB,EAClBC,cAAc,EACdC,QAAQ,EACRC,uBAAuB,EACvBC,UAAU,EACVC,mBAAmB,EACnBC,OAAO,QACF,yBAAyB;AAChC,SAASC,UAAU,QAAQ,cAAc;AAEzC,OAAO,SAASC,2BAA2BA,CAACC,aAAa,EAAEC,SAAS,EAAE;EACpE,IAAI,CAACD,aAAa,CAACE,mBAAmB,EAAE;IACtC,OAAO;MAAEC,IAAI,EAAEd;IAAK,CAAC;EACvB;EAEA,IAAIe,eAAe,GAAGpB,iBAAiB,CAAC,C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AAC,IAAI7B,OAAO,CAACgD,YAAY,KAAK,QAAQ;AAClE;AAEA,SAAS5C,aAAaA,CAACJ,OAAO,EAAE;EAC9B,OAAOA,OAAO,CAAC6B,MAAM,IAAI,GAAG;AAC9B;AAEA,SAASS,oBAAoBA,CAACS,YAAY,EAAE5D,aAAa,EAAE;EACzD,IAAI4D,YAAY,CAACE,MAAM,GAAG9D,aAAa,CAAC2D,+BAA+B,EAAE;IACvE,OACEC,YAAY,CAACG,SAAS,CAAC,CAAC,EAAE/D,aAAa,CAAC2D,+BAA+B,CAAC,GACxE,KAAK;EAET;EACA,OAAOC,YAAY;AACrB;AAEA,SAAS5B,MAAMA,CAACpB,IAAI,EAAE;EACpB,IAAI3B,WAAW,CAACwB,GAAG,KAAKG,IAAI,EAAE;IAC5B,OAAO,KAAK;EACd;EACA,OAAO,OAAO;AAChB;AAEA,SAAS8C,sBAAsBA,CAACM,MAAM,EAAEC,UAAU,EAAEf,QAAQ,EAAE;EAC5DtD,mBAAmB,CACjBoE,MAAM,EACN,UAAUzC,KAAK,EAAE2C,KAAK,EAAEC,aAAa,EAAE;IACrC,IAAI5C,KAAK,EAAE;MACT2B,QAAQ,CAAC3B,KAAK,CAAC;IACjB,CAAC,MAAM;MACL,IAAIqC,YAAY,GAAG,IAAIL,WAAW,CAAC,CAAC,CAACa,MAAM,CAACF,KAAK,CAAC;MAClD,IAAIC,aAAa,EAAE;QACjBP,YAAY,IAAI,KAAK;MACvB;MACAV,QAAQ,CAACmB,SAAS,EAAET,YAAY,CAAC;IACnC;EACF,CAAC,EACD;IACEK,UAAU,EAAEA,UAAU;IACtBK,iBAAiB,EAAE;EACrB,CACF,CAAC;AACH"}
@@ -15,7 +15,6 @@ export function startReportCollection(configuration, lifeCycle) {
15
15
  error = {
16
16
  kind: report.subtype,
17
17
  origin: ErrorSource.REPORT,
18
- // Todo: Remove in the next major release
19
18
  stack: report.stack
20
19
  };
21
20
  } else if (report.stack) {
@@ -1 +1 @@
1
- {"version":3,"file":"reportCollection.js","names":["timeStampNow","ErrorSource","RawReportType","getFileFromStackTraceString","initReportObservable","LifeCycleEventType","StatusType","LogStatusForReport","_LogStatusForReport","_defineProperty","cspViolation","error","intervention","deprecation","warn","startReportCollection","configuration","lifeCycle","reportSubscription","forwardReports","subscribe","report","message","status","type","kind","subtype","origin","REPORT","stack","notify","RAW_LOG_COLLECTED","rawLogsEvent","date","stop","unsubscribe"],"sources":["../../../../src/domain/logsCollection/report/reportCollection.js"],"sourcesContent":["import {\n timeStampNow,\n ErrorSource,\n RawReportType,\n getFileFromStackTraceString,\n initReportObservable,\n LifeCycleEventType\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nvar LogStatusForReport = {\n [RawReportType.cspViolation]: StatusType.error,\n [RawReportType.intervention]: StatusType.error,\n [RawReportType.deprecation]: StatusType.warn\n}\n\nexport function startReportCollection(configuration, lifeCycle) {\n var reportSubscription = initReportObservable(\n configuration,\n configuration.forwardReports\n ).subscribe(function (report) {\n var message = report.message\n var status = LogStatusForReport[report.type]\n var error\n if (status === StatusType.error) {\n error = {\n kind: report.subtype,\n origin: ErrorSource.REPORT, // Todo: Remove in the next major release\n stack: report.stack\n }\n } else if (report.stack) {\n message += ' Found in ' + getFileFromStackTraceString(report.stack)\n }\n\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n date: timeStampNow(),\n message: message,\n origin: ErrorSource.REPORT,\n error: error,\n status: status\n }\n })\n })\n\n return {\n stop: function () {\n reportSubscription.unsubscribe()\n }\n }\n}\n"],"mappings":";;;;;AAAA,SACEA,YAAY,EACZC,WAAW,EACXC,aAAa,EACbC,2BAA2B,EAC3BC,oBAAoB,EACpBC,kBAAkB,QACb,yBAAyB;AAChC,SAASC,UAAU,QAAQ,cAAc;AAEzC,IAAIC,kBAAkB,IAAAC,mBAAA,OAAAC,eAAA,CAAAD,mBAAA,EACnBN,aAAa,CAACQ,YAAY,EAAGJ,UAAU,CAACK,KAAK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":3,"file":"reportCollection.js","names":["timeStampNow","ErrorSource","RawReportType","getFileFromStackTraceString","initReportObservable","LifeCycleEventType","StatusType","LogStatusForReport","_LogStatusForReport","_defineProperty","cspViolation","error","intervention","deprecation","warn","startReportCollection","configuration","lifeCycle","reportSubscription","forwardReports","subscribe","report","message","status","type","kind","subtype","origin","REPORT","stack","notify","RAW_LOG_COLLECTED","rawLogsEvent","date","stop","unsubscribe"],"sources":["../../../../src/domain/logsCollection/report/reportCollection.js"],"sourcesContent":["import {\n timeStampNow,\n ErrorSource,\n RawReportType,\n getFileFromStackTraceString,\n initReportObservable,\n LifeCycleEventType\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nvar LogStatusForReport = {\n [RawReportType.cspViolation]: StatusType.error,\n [RawReportType.intervention]: StatusType.error,\n [RawReportType.deprecation]: StatusType.warn\n}\n\nexport function startReportCollection(configuration, lifeCycle) {\n var reportSubscription = initReportObservable(\n configuration,\n configuration.forwardReports\n ).subscribe(function (report) {\n var message = report.message\n var status = LogStatusForReport[report.type]\n var error\n if (status === StatusType.error) {\n error = {\n kind: report.subtype,\n origin: ErrorSource.REPORT,\n stack: report.stack\n }\n } else if (report.stack) {\n message += ' Found in ' + getFileFromStackTraceString(report.stack)\n }\n\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n date: timeStampNow(),\n message: message,\n origin: ErrorSource.REPORT,\n error: error,\n status: status\n }\n })\n })\n\n return {\n stop: function () {\n reportSubscription.unsubscribe()\n }\n }\n}\n"],"mappings":";;;;;AAAA,SACEA,YAAY,EACZC,WAAW,EACXC,aAAa,EACbC,2BAA2B,EAC3BC,oBAAoB,EACpBC,kBAAkB,QACb,yBAAyB;AAChC,SAASC,UAAU,QAAQ,cAAc;AAEzC,IAAIC,kBAAkB,IAAAC,mBAAA,OAAAC,eAAA,CAAAD,mBAAA,EACnBN,aAAa,CAACQ,YAAY,EAAGJ,UAAU,CAACK,KAAK,GAAAF,e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untimeErrorCollection(configuration, lifeCycle) {
16
16
  error: {
17
17
  kind: rawError.type,
18
18
  origin: ErrorSource.SOURCE,
19
- // Todo: Remove in the next major release
20
19
  stack: rawError.stack
21
20
  },
22
21
  origin: ErrorSource.SOURCE,
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeErrorCollection.js","names":["noop","ErrorSource","trackRuntimeError","Observable","LifeCycleEventType","StatusType","startRuntimeErrorCollection","configuration","lifeCycle","forwardErrorsToLogs","stop","rawErrorObservable","_trackRuntimeError","rawErrorSubscription","subscribe","rawError","notify","RAW_LOG_COLLECTED","rawLogsEvent","message","date","startClocks","timeStamp","error","kind","type","origin","SOURCE","stack","status","unsubscribe"],"sources":["../../../../src/domain/logsCollection/rumtimeError/runtimeErrorCollection.js"],"sourcesContent":["import { noop, ErrorSource, trackRuntimeError, Observable, LifeCycleEventType } from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nexport function startRuntimeErrorCollection(configuration, lifeCycle) {\n if (!configuration.forwardErrorsToLogs) {\n return { stop: noop }\n }\n\n var rawErrorObservable = new Observable()\n\n var _trackRuntimeError = trackRuntimeError(rawErrorObservable)\n\n var rawErrorSubscription = rawErrorObservable.subscribe(function(rawError) {\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message: rawError.message,\n date: rawError.startClocks.timeStamp,\n error: {\n kind: rawError.type,\n origin: ErrorSource.SOURCE, // Todo: Remove in the next major release\n stack: rawError.stack,\n },\n origin: ErrorSource.SOURCE,\n status: StatusType.error,\n },\n })\n })\n\n return {\n stop: function() {\n _trackRuntimeError.stop()\n rawErrorSubscription.unsubscribe()\n },\n }\n}\n"],"mappings":"AAAA,SAASA,IAAI,EAAEC,WAAW,EAAEC,iBAAiB,EAAEC,UAAU,EAAEC,kBAAkB,QAAQ,yBAAyB;AAC9G,SAASC,UAAU,QAAQ,cAAc;AAEzC,OAAO,SAASC,2BAA2BA,CAACC,aAAa,EAAEC,SAAS,EAAE;EACpE,IAAI,CAACD,aAAa,CAACE,mBAAmB,EAAE;IACtC,OAAO;MAAEC,IAAI,EAAEV;IAAK,CAAC;EACvB;EAEA,IAAIW,kBAAkB,GAAG,IAAIR,UAAU,CAAC,CAAC;EAEzC,IAAIS,kBAAkB,GAAGV,iBAAiB,CAACS,kBAAkB,CAAC;EAE9D,IAAIE,oBAAoB,GAAGF,kBAAkB,CAACG,SAAS,CAAC,UAASC,QAAQ,EAAE;IACzEP,SAAS,CAACQ,MAAM,CAACZ,kBAAkB,CAACa,iBAAiB,EAAE;MACrDC,YAAY,EAAE;QACZC,OAAO,EAAEJ,QAAQ,CAACI,OAAO;QACzBC,IAAI,EAAEL,QAAQ,CAACM,WAAW,CAACC,SAAS;QACpCC,KAAK,EAAE;UACLC,IAAI,EAAET,QAAQ,CAACU,IAAI;UACnBC,MAAM,EAAEzB,WAAW,CAAC0B,MAAM;UAAE;UAC5BC,KAAK,EAAEb,QAAQ,CAACa;QAClB,CAAC;QACDF,MAAM,EAAEzB,WAAW,CAAC0B,MAAM;QAC1BE,MAAM,EAAExB,UAAU,CAACkB;MACrB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLb,IAAI,EAAE,SAAAA,KAAA,EAAW;MACfE,kBAAkB,CAACF,IAAI,CAAC,CAAC;MACzBG,oBAAoB,CAACiB,WAAW,CAAC,CAAC;IACpC;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"runtimeErrorCollection.js","names":["noop","ErrorSource","trackRuntimeError","Observable","LifeCycleEventType","StatusType","startRuntimeErrorCollection","configuration","lifeCycle","forwardErrorsToLogs","stop","rawErrorObservable","_trackRuntimeError","rawErrorSubscription","subscribe","rawError","notify","RAW_LOG_COLLECTED","rawLogsEvent","message","date","startClocks","timeStamp","error","kind","type","origin","SOURCE","stack","status","unsubscribe"],"sources":["../../../../src/domain/logsCollection/rumtimeError/runtimeErrorCollection.js"],"sourcesContent":["import {\n noop,\n ErrorSource,\n trackRuntimeError,\n Observable,\n LifeCycleEventType\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nexport function startRuntimeErrorCollection(configuration, lifeCycle) {\n if (!configuration.forwardErrorsToLogs) {\n return { stop: noop }\n }\n\n var rawErrorObservable = new Observable()\n\n var _trackRuntimeError = trackRuntimeError(rawErrorObservable)\n\n var rawErrorSubscription = rawErrorObservable.subscribe(function (rawError) {\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message: rawError.message,\n date: rawError.startClocks.timeStamp,\n error: {\n kind: rawError.type,\n origin: ErrorSource.SOURCE,\n stack: rawError.stack\n },\n origin: ErrorSource.SOURCE,\n status: StatusType.error\n }\n })\n })\n\n return {\n stop: function () {\n _trackRuntimeError.stop()\n rawErrorSubscription.unsubscribe()\n }\n }\n}\n"],"mappings":"AAAA,SACEA,IAAI,EACJC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,EACVC,kBAAkB,QACb,yBAAyB;AAChC,SAASC,UAAU,QAAQ,cAAc;AAEzC,OAAO,SAASC,2BAA2BA,CAACC,aAAa,EAAEC,SAAS,EAAE;EACpE,IAAI,CAACD,aAAa,CAACE,mBAAmB,EAAE;IACtC,OAAO;MAAEC,IAAI,EAAEV;IAAK,CAAC;EACvB;EAEA,IAAIW,kBAAkB,GAAG,IAAIR,UAAU,CAAC,CAAC;EAEzC,IAAIS,kBAAkB,GAAGV,iBAAiB,CAACS,kBAAkB,CAAC;EAE9D,IAAIE,oBAAoB,GAAGF,kBAAkB,CAACG,SAAS,CAAC,UAAUC,QAAQ,EAAE;IAC1EP,SAAS,CAACQ,MAAM,CAACZ,kBAAkB,CAACa,iBAAiB,EAAE;MACrDC,YAAY,EAAE;QACZC,OAAO,EAAEJ,QAAQ,CAACI,OAAO;QACzBC,IAAI,EAAEL,QAAQ,CAACM,WAAW,CAACC,SAAS;QACpCC,KAAK,EAAE;UACLC,IAAI,EAAET,QAAQ,CAACU,IAAI;UACnBC,MAAM,EAAEzB,WAAW,CAAC0B,MAAM;UAC1BC,KAAK,EAAEb,QAAQ,CAACa;QAClB,CAAC;QACDF,MAAM,EAAEzB,WAAW,CAAC0B,MAAM;QAC1BE,MAAM,EAAExB,UAAU,CAACkB;MACrB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLb,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChBE,kBAAkB,CAACF,IAAI,CAAC,CAAC;MACzBG,oBAAoB,CAACiB,WAAW,CAAC,CAAC;IACpC;EACF,CAAC;AACH"}
package/package.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@cloudcare/browser-logs",
3
3
  "main": "cjs/index.js",
4
4
  "module": "esm/index.js",
5
- "version": "3.1.8",
5
+ "version": "3.1.10",
6
6
  "dependencies": {
7
- "@cloudcare/browser-core": "3.1.8"
7
+ "@cloudcare/browser-core": "3.1.10"
8
8
  },
9
9
  "scripts": {
10
10
  "dev": "webpack serve --open --mode=development",
@@ -24,10 +24,11 @@
24
24
  ],
25
25
  "repository": {
26
26
  "url": "https://github.com/DataFlux-cn/datakit-js",
27
- "type": "git"
27
+ "type": "git",
28
+ "directory": "packages/logs"
28
29
  },
29
30
  "author": "dataflux",
30
31
  "license": "MIT",
31
32
  "description": "DataFlux RUM Web 端数据指标监控",
32
- "gitHead": "f4f753b59bd0d1c51501b6c4e6333a3e3d5d6f16"
33
+ "gitHead": "2361945f9933caee1559f4e3fd2c954488188844"
33
34
  }
@@ -32,7 +32,7 @@ export function startLogs(configuration, buildCommonContext, mainLogger) {
32
32
  message: error.message,
33
33
  date: error.startClocks.timeStamp,
34
34
  error: {
35
- origin: ErrorSource.AGENT // Todo: Remove in the next major release
35
+ origin: ErrorSource.AGENT
36
36
  },
37
37
  origin: ErrorSource.AGENT,
38
38
  status: StatusType.error
@@ -72,7 +72,6 @@ export function startLogsAssembly(
72
72
  )
73
73
 
74
74
  if (
75
- // Todo: [RUMF-1230] Move this check to the logger collection in the next major release
76
75
  !isAuthorized(rawLogsEvent.status, HandlerType.http, logger) ||
77
76
  (configuration.beforeSend && configuration.beforeSend(log) === false) ||
78
77
  (log.error &&
@@ -139,7 +139,9 @@ Logger.prototype = {
139
139
  removeContext: function (key) {
140
140
  this.contextManager.remove(key)
141
141
  },
142
-
142
+ clearContext() {
143
+ this.contextManager.clearContext()
144
+ },
143
145
  setHandler: function (handler) {
144
146
  this.handlerType = handler
145
147
  },