@cloudcare/browser-core 3.2.3 → 3.2.6

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 (82) hide show
  1. package/cjs/browser/cookie.js +14 -9
  2. package/cjs/browser/cookie.js.map +1 -1
  3. package/cjs/configuration/configuration.js +2 -23
  4. package/cjs/configuration/configuration.js.map +1 -1
  5. package/cjs/helper/requestIdleCallback.js +46 -0
  6. package/cjs/helper/requestIdleCallback.js.map +1 -0
  7. package/cjs/helper/taskQueue.js +59 -0
  8. package/cjs/helper/taskQueue.js.map +1 -0
  9. package/cjs/helper/tools.js +1 -1
  10. package/cjs/helper/tools.js.map +1 -1
  11. package/cjs/index.js +112 -41
  12. package/cjs/index.js.map +1 -1
  13. package/cjs/init.js +0 -19
  14. package/cjs/init.js.map +1 -1
  15. package/cjs/session/sessionConstants.js +3 -1
  16. package/cjs/session/sessionConstants.js.map +1 -1
  17. package/cjs/session/sessionInCookie.js +59 -0
  18. package/cjs/session/sessionInCookie.js.map +1 -0
  19. package/cjs/session/sessionInLocalStorage.js +44 -0
  20. package/cjs/session/sessionInLocalStorage.js.map +1 -0
  21. package/cjs/session/sessionManagement.js +38 -31
  22. package/cjs/session/sessionManagement.js.map +1 -1
  23. package/cjs/session/sessionState.js +73 -0
  24. package/cjs/session/sessionState.js.map +1 -0
  25. package/cjs/session/sessionStore.js +113 -90
  26. package/cjs/session/sessionStore.js.map +1 -1
  27. package/cjs/session/sessionStoreOperations.js +117 -0
  28. package/cjs/session/sessionStoreOperations.js.map +1 -0
  29. package/esm/browser/cookie.js +15 -8
  30. package/esm/browser/cookie.js.map +1 -1
  31. package/esm/configuration/configuration.js +2 -22
  32. package/esm/configuration/configuration.js.map +1 -1
  33. package/esm/helper/requestIdleCallback.js +38 -0
  34. package/esm/helper/requestIdleCallback.js.map +1 -0
  35. package/esm/helper/taskQueue.js +52 -0
  36. package/esm/helper/taskQueue.js.map +1 -0
  37. package/esm/helper/tools.js +1 -1
  38. package/esm/helper/tools.js.map +1 -1
  39. package/esm/index.js +5 -4
  40. package/esm/index.js.map +1 -1
  41. package/esm/init.js +0 -19
  42. package/esm/init.js.map +1 -1
  43. package/esm/session/sessionConstants.js +1 -0
  44. package/esm/session/sessionConstants.js.map +1 -1
  45. package/esm/session/sessionInCookie.js +51 -0
  46. package/esm/session/sessionInCookie.js.map +1 -0
  47. package/esm/session/sessionInLocalStorage.js +37 -0
  48. package/esm/session/sessionInLocalStorage.js.map +1 -0
  49. package/esm/session/sessionManagement.js +35 -28
  50. package/esm/session/sessionManagement.js.map +1 -1
  51. package/esm/session/sessionState.js +59 -0
  52. package/esm/session/sessionState.js.map +1 -0
  53. package/esm/session/sessionStore.js +113 -90
  54. package/esm/session/sessionStore.js.map +1 -1
  55. package/esm/session/sessionStoreOperations.js +108 -0
  56. package/esm/session/sessionStoreOperations.js.map +1 -0
  57. package/package.json +2 -2
  58. package/src/browser/cookie.js +23 -11
  59. package/src/configuration/configuration.js +3 -30
  60. package/src/helper/requestIdleCallback.js +38 -0
  61. package/src/helper/taskQueue.js +55 -0
  62. package/src/helper/tools.js +6 -1
  63. package/src/index.js +11 -4
  64. package/src/init.js +0 -19
  65. package/src/session/sessionConstants.js +1 -0
  66. package/src/session/sessionInCookie.js +87 -0
  67. package/src/session/sessionInLocalStorage.js +45 -0
  68. package/src/session/sessionManagement.js +48 -36
  69. package/src/session/sessionState.js +72 -0
  70. package/src/session/sessionStore.js +163 -108
  71. package/src/session/sessionStoreOperations.js +134 -0
  72. package/types/index.d.ts +4 -0
  73. package/cjs/session/sessionCookieStore.js +0 -156
  74. package/cjs/session/sessionCookieStore.js.map +0 -1
  75. package/cjs/synthetics/usr.js +0 -26
  76. package/cjs/synthetics/usr.js.map +0 -1
  77. package/esm/session/sessionCookieStore.js +0 -142
  78. package/esm/session/sessionCookieStore.js.map +0 -1
  79. package/esm/synthetics/usr.js +0 -17
  80. package/esm/synthetics/usr.js.map +0 -1
  81. package/src/session/sessionCookieStore.js +0 -169
  82. package/src/synthetics/usr.js +0 -18
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.COOKIE_ACCESS_DELAY = void 0;
7
6
  exports.areCookiesAuthorized = areCookiesAuthorized;
8
7
  exports.deleteCookie = deleteCookie;
9
8
  exports.getCookie = getCookie;
@@ -12,8 +11,9 @@ exports.getInitCookie = getInitCookie;
12
11
  exports.resetInitCookies = resetInitCookies;
13
12
  exports.setCookie = setCookie;
14
13
  var _tools = require("../helper/tools");
15
- var COOKIE_ACCESS_DELAY = _tools.ONE_SECOND;
16
- exports.COOKIE_ACCESS_DELAY = COOKIE_ACCESS_DELAY;
14
+ function getCookieName(name, options) {
15
+ return "".concat(name, "_").concat(options && options.crossSite ? 'cs1' : 'cs0', "_").concat(options && options.domain ? 'd1' : 'd0', "_").concat(options && options.secure ? 'sec1' : 'sec0', "_").concat(options && options.partitioned ? 'part1' : 'part0');
16
+ }
17
17
  function setCookie(name, value, expireDelay, options) {
18
18
  var date = new Date();
19
19
  date.setTime(date.getTime() + expireDelay);
@@ -22,10 +22,10 @@ function setCookie(name, value, expireDelay, options) {
22
22
  var domain = options && options.domain ? ';domain=' + options.domain : '';
23
23
  var secure = options && options.secure ? ';secure' : '';
24
24
  var partitioned = options && options.partitioned ? ';partitioned' : '';
25
- document.cookie = name + '=' + value + ';' + expires + ';path=/;samesite=' + sameSite + domain + secure + partitioned;
25
+ document.cookie = getCookieName(name, options) + '=' + value + ';' + expires + ';path=/;samesite=' + sameSite + domain + secure + partitioned;
26
26
  }
27
- function getCookie(name) {
28
- return (0, _tools.findCommaSeparatedValue)(document.cookie, name);
27
+ function getCookie(name, options) {
28
+ return (0, _tools.findCommaSeparatedValue)(document.cookie, getCookieName(name, options));
29
29
  }
30
30
  var initCookieParsed;
31
31
  /**
@@ -53,8 +53,10 @@ function areCookiesAuthorized(options) {
53
53
  // the test cookie lifetime
54
54
  var testCookieName = "gc_cookie_test_".concat((0, _tools.UUID)());
55
55
  var testCookieValue = 'test';
56
- setCookie(testCookieName, testCookieValue, _tools.ONE_SECOND, options);
57
- return getCookie(testCookieName) === testCookieValue;
56
+ setCookie(testCookieName, testCookieValue, _tools.ONE_MINUTE, options);
57
+ var isCookieCorrectlySet = getCookie(testCookieName, options) === testCookieValue;
58
+ deleteCookie(testCookieName, options);
59
+ return isCookieCorrectlySet;
58
60
  } catch (error) {
59
61
  return false;
60
62
  }
@@ -75,11 +77,14 @@ function getCurrentSite() {
75
77
  var domainLevels = window.location.hostname.split('.');
76
78
  var candidateDomain = domainLevels.pop();
77
79
  while (domainLevels.length && !getCookie(testCookieName)) {
78
- candidateDomain = domainLevels.pop() + '.' + candidateDomain;
80
+ candidateDomain = "".concat(domainLevels.pop(), ".").concat(candidateDomain);
79
81
  setCookie(testCookieName, testCookieValue, _tools.ONE_SECOND, {
80
82
  domain: candidateDomain
81
83
  });
82
84
  }
85
+ deleteCookie(testCookieName, {
86
+ domain: candidateDomain
87
+ });
83
88
  getCurrentSiteCache = candidateDomain;
84
89
  }
85
90
  return getCurrentSiteCache;
@@ -1 +1 @@
1
- {"version":3,"file":"cookie.js","names":["_tools","require","COOKIE_ACCESS_DELAY","ONE_SECOND","exports","setCookie","name","value","expireDelay","options","date","Date","setTime","getTime","expires","toUTCString","sameSite","crossSite","domain","secure","partitioned","document","cookie","getCookie","findCommaSeparatedValue","initCookieParsed","getInitCookie","findCommaSeparatedValues","get","resetInitCookies","undefined","deleteCookie","areCookiesAuthorized","testCookieName","concat","UUID","testCookieValue","error","getCurrentSiteCache","getCurrentSite","domainLevels","window","location","hostname","split","candidateDomain","pop","length"],"sources":["../../src/browser/cookie.js"],"sourcesContent":["import {\n findCommaSeparatedValue,\n UUID,\n ONE_SECOND,\n findCommaSeparatedValues\n} from '../helper/tools'\nexport var COOKIE_ACCESS_DELAY = ONE_SECOND\n\nexport function setCookie(name, value, expireDelay, options) {\n var date = new Date()\n date.setTime(date.getTime() + expireDelay)\n var expires = 'expires=' + date.toUTCString()\n var sameSite = options && options.crossSite ? 'none' : 'strict'\n var domain = options && options.domain ? ';domain=' + options.domain : ''\n var secure = options && options.secure ? ';secure' : ''\n var partitioned = options && options.partitioned ? ';partitioned' : ''\n document.cookie =\n name +\n '=' +\n value +\n ';' +\n expires +\n ';path=/;samesite=' +\n sameSite +\n domain +\n secure +\n partitioned\n}\n\nexport function getCookie(name) {\n return findCommaSeparatedValue(document.cookie, name)\n}\nvar initCookieParsed\n/**\n * Returns a cached value of the cookie. Use this during SDK initialization (and whenever possible)\n * to avoid accessing document.cookie multiple times.\n */\nexport function getInitCookie(name) {\n if (!initCookieParsed) {\n initCookieParsed = findCommaSeparatedValues(document.cookie)\n }\n return initCookieParsed.get(name)\n}\n\nexport function resetInitCookies() {\n initCookieParsed = undefined\n}\nexport function deleteCookie(name, options) {\n setCookie(name, '', 0, options)\n}\n\nexport function areCookiesAuthorized(options) {\n if (document.cookie === undefined || document.cookie === null) {\n return false\n }\n try {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n var testCookieName = `gc_cookie_test_${UUID()}`\n var testCookieValue = 'test'\n setCookie(testCookieName, testCookieValue, ONE_SECOND, options)\n return getCookie(testCookieName) === testCookieValue\n } catch (error) {\n return false\n }\n}\n\n/**\n * No API to retrieve it, number of levels for subdomain and suffix are unknown\n * strategy: find the minimal domain on which cookies are allowed to be set\n * https://web.dev/same-site-same-origin/#site\n */\nvar getCurrentSiteCache\nexport function getCurrentSite() {\n if (getCurrentSiteCache === undefined) {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n var testCookieName = `gc_site_test_${UUID()}`\n var testCookieValue = 'test'\n\n var domainLevels = window.location.hostname.split('.')\n var candidateDomain = domainLevels.pop()\n while (domainLevels.length && !getCookie(testCookieName)) {\n candidateDomain = domainLevels.pop() + '.' + candidateDomain\n setCookie(testCookieName, testCookieValue, ONE_SECOND, {\n domain: candidateD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Ac,CAAC,EAAE;MACxDY,eAAe,GAAGL,YAAY,CAACM,GAAG,CAAC,CAAC,GAAG,GAAG,GAAGD,eAAe;MAC5DxC,SAAS,CAAC4B,cAAc,EAAEG,eAAe,EAAEjC,iBAAU,EAAE;QACrDe,MAAM,EAAE2B;MACV,CAAC,CAAC;IACJ;IACAP,mBAAmB,GAAGO,eAAe;EACvC;EACA,OAAOP,mBAAmB;AAC5B","ignoreList":[]}
1
+ {"version":3,"file":"cookie.js","names":["_tools","require","getCookieName","name","options","concat","crossSite","domain","secure","partitioned","setCookie","value","expireDelay","date","Date","setTime","getTime","expires","toUTCString","sameSite","document","cookie","getCookie","findCommaSeparatedValue","initCookieParsed","getInitCookie","findCommaSeparatedValues","get","resetInitCookies","undefined","deleteCookie","areCookiesAuthorized","testCookieName","UUID","testCookieValue","ONE_MINUTE","isCookieCorrectlySet","error","getCurrentSiteCache","getCurrentSite","domainLevels","window","location","hostname","split","candidateDomain","pop","length","ONE_SECOND"],"sources":["../../src/browser/cookie.js"],"sourcesContent":["import {\n findCommaSeparatedValue,\n UUID,\n ONE_SECOND,\n ONE_MINUTE,\n findCommaSeparatedValues\n} from '../helper/tools'\n\nfunction getCookieName(name, options) {\n return `${name}_${options && options.crossSite ? 'cs1' : 'cs0'}_${\n options && options.domain ? 'd1' : 'd0'\n }_${options && options.secure ? 'sec1' : 'sec0'}_${\n options && options.partitioned ? 'part1' : 'part0'\n }`\n}\nexport function setCookie(name, value, expireDelay, options) {\n var date = new Date()\n date.setTime(date.getTime() + expireDelay)\n var expires = 'expires=' + date.toUTCString()\n var sameSite = options && options.crossSite ? 'none' : 'strict'\n var domain = options && options.domain ? ';domain=' + options.domain : ''\n var secure = options && options.secure ? ';secure' : ''\n var partitioned = options && options.partitioned ? ';partitioned' : ''\n\n document.cookie =\n getCookieName(name, options) +\n '=' +\n value +\n ';' +\n expires +\n ';path=/;samesite=' +\n sameSite +\n domain +\n secure +\n partitioned\n}\n\nexport function getCookie(name, options) {\n return findCommaSeparatedValue(document.cookie, getCookieName(name, options))\n}\nvar initCookieParsed\n/**\n * Returns a cached value of the cookie. Use this during SDK initialization (and whenever possible)\n * to avoid accessing document.cookie multiple times.\n */\nexport function getInitCookie(name) {\n if (!initCookieParsed) {\n initCookieParsed = findCommaSeparatedValues(document.cookie)\n }\n return initCookieParsed.get(name)\n}\n\nexport function resetInitCookies() {\n initCookieParsed = undefined\n}\nexport function deleteCookie(name, options) {\n setCookie(name, '', 0, options)\n}\n\nexport function areCookiesAuthorized(options) {\n if (document.cookie === undefined || document.cookie === null) {\n return false\n }\n try {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n var testCookieName = `gc_cookie_test_${UUID()}`\n var testCookieValue = 'test'\n setCookie(testCookieName, testCookieValue, ONE_MINUTE, options)\n const isCookieCorrectlySet =\n getCookie(testCookieName, options) === testCookieValue\n deleteCookie(testCookieName, options)\n return isCookieCorrectlySet\n } catch (error) {\n return false\n }\n}\n\n/**\n * No API to retrieve it, number of levels for subdomain and suffix are unknown\n * strategy: find the minimal domain on which cookies are allowed to be set\n * https://web.dev/same-site-same-origin/#site\n */\nvar getCurrentSiteCache\nexport function getCurrentSite() {\n if (getCurrentSiteCache === undefined) {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n const testCookieName = `gc_site_test_${UUID()}`\n const testCookieValue = 'test'\n\n const domainLevels = window.location.hostname.split('.')\n let candidateDomain = domainLevels.pop()\n while (domainLevels.length && !getCookie(testCookieName)) {\n candidateDomain = `${domainLevels.pop()}.${candidateDomain}`\n setCookie(testCookieName, testCookieValue, ONE_SECOND, {\n domain: candidateDomain\n })\n }\n deleteCookie(testCookieName, { domain: candidateDomain })\n getCurrentSiteCache = candidateDomain\n }\n return getCurrentSiteCache\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQA,SAASC,aAAaA,CAACC,IAAI,EAAEC,OAAO,EAAE;EACpC,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KT,SAAS,EAAE;IACrC;IACA;IACA,IAAMG,cAAc,mBAAA3B,MAAA,CAAmB,IAAA4B,WAAI,EAAC,CAAC,CAAE;IAC/C,IAAMC,eAAe,GAAG,MAAM;IAE9B,IAAMM,YAAY,GAAGC,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAACC,KAAK,CAAC,GAAG,CAAC;IACxD,IAAIC,eAAe,GAAGL,YAAY,CAACM,GAAG,CAAC,CAAC;IACxC,OAAON,YAAY,CAACO,MAAM,IAAI,CAACzB,SAAS,CAACU,cAAc,CAAC,EAAE;MACxDa,eAAe,MAAAxC,MAAA,CAAMmC,YAAY,CAACM,GAAG,CAAC,CAAC,OAAAzC,MAAA,CAAIwC,eAAe,CAAE;MAC5DnC,SAAS,CAACsB,cAAc,EAAEE,eAAe,EAAEc,iBAAU,EAAE;QACrDzC,MAAM,EAAEsC;MACV,CAAC,CAAC;IACJ;IACAf,YAAY,CAACE,cAAc,EAAE;MAAEzB,MAAM,EAAEsC;IAAgB,CAAC,CAAC;IACzDP,mBAAmB,GAAGO,eAAe;EACvC;EACA,OAAOP,mBAAmB;AAC5B","ignoreList":[]}
@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DefaultPrivacyLevel = void 0;
7
- exports.buildCookieOptions = buildCookieOptions;
8
7
  exports.validateAndBuildConfiguration = validateAndBuildConfiguration;
9
8
  exports.validatePostRequestRequireParamsConfiguration = validatePostRequestRequireParamsConfiguration;
10
- var _cookie = require("../browser/cookie");
11
9
  var _catchUserErrors = require("../helper/catchUserErrors");
12
10
  var _display = require("../helper/display");
13
11
  var _tools = require("../helper/tools");
14
12
  var _byteUtils = require("../helper/byteUtils");
15
13
  var _transportConfiguration = require("./transportConfiguration");
14
+ var _sessionStore = require("../session/sessionStore");
16
15
  var DefaultPrivacyLevel = {
17
16
  ALLOW: 'allow',
18
17
  MASK: 'mask',
@@ -35,7 +34,7 @@ function validateAndBuildConfiguration(initConfiguration) {
35
34
  var sessionSampleRate = initConfiguration.sessionSampleRate || initConfiguration.sampleRate;
36
35
  return (0, _tools.assign)({
37
36
  beforeSend: initConfiguration.beforeSend && (0, _catchUserErrors.catchUserErrors)(initConfiguration.beforeSend, 'beforeSend threw an error:'),
38
- cookieOptions: buildCookieOptions(initConfiguration),
37
+ sessionStoreStrategyType: (0, _sessionStore.selectSessionStoreStrategyType)(initConfiguration),
39
38
  sessionSampleRate: (0, _tools.isNullUndefinedDefaultValue)(sessionSampleRate, 100),
40
39
  service: initConfiguration.service,
41
40
  version: initConfiguration.version,
@@ -84,24 +83,4 @@ function validatePostRequestRequireParamsConfiguration(initConfiguration) {
84
83
  }
85
84
  return true;
86
85
  }
87
- function buildCookieOptions(initConfiguration) {
88
- var cookieOptions = {};
89
-
90
- // cookieOptions.secure = mustUseSecureCookie(initConfiguration)
91
- // cookieOptions.crossSite = !!initConfiguration.useCrossSiteSessionCookie
92
- cookieOptions.secure = !!initConfiguration.useSecureSessionCookie || !!initConfiguration.usePartitionedCrossSiteSessionCookie || !!initConfiguration.useCrossSiteSessionCookie;
93
- cookieOptions.crossSite = !!initConfiguration.usePartitionedCrossSiteSessionCookie || !!initConfiguration.useCrossSiteSessionCookie;
94
- cookieOptions.partitioned = !!initConfiguration.usePartitionedCrossSiteSessionCookie;
95
- if (initConfiguration.trackSessionAcrossSubdomains) {
96
- cookieOptions.domain = (0, _cookie.getCurrentSite)();
97
- }
98
- return cookieOptions;
99
- }
100
-
101
- // function mustUseSecureCookie(initConfiguration) {
102
- // return (
103
- // !!initConfiguration.useSecureSessionCookie ||
104
- // !!initConfiguration.useCrossSiteSessionCookie
105
- // )
106
- // }
107
86
  //# sourceMappingURL=configuration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.js","names":["_cookie","require","_catchUserErrors","_display","_tools","_byteUtils","_transportConfiguration","DefaultPrivacyLevel","ALLOW","MASK","MASK_USER_INPUT","exports","validateAndBuildConfiguration","initConfiguration","sampleRate","undefined","isPercentage","display","error","sessionSampleRate","telemetrySampleRate","assign","beforeSend","catchUserErrors","cookieOptions","buildCookieOptions","isNullUndefinedDefaultValue","service","version","env","telemetryEnabled","silentMultipleInit","batchBytesLimit","ONE_KIBI_BYTE","eventRateLimiterThreshold","maxTelemetryEventsPerPage","flushTimeout","ONE_SECOND","batchMessagesLimit","messageBytesLimit","resourceUrlLimit","storeContextsToLocal","storeContextsKey","sendContentTypeByJson","computeTransportConfiguration","validatePostRequestRequireParamsConfiguration","site","datakitOrigin","datakitUrl","clientToken","secure","useSecureSessionCookie","usePartitionedCrossSiteSessionCookie","useCrossSiteSessionCookie","crossSite","partitioned","trackSessionAcrossSubdomains","domain","getCurrentSite"],"sources":["../../src/configuration/configuration.js"],"sourcesContent":["import { getCurrentSite } from '../browser/cookie'\nimport { catchUserErrors } from '../helper/catchUserErrors'\nimport { display } from '../helper/display'\nimport {\n assign,\n isPercentage,\n ONE_SECOND,\n isNullUndefinedDefaultValue\n} from '../helper/tools'\nimport { ONE_KIBI_BYTE } from '../helper/byteUtils'\nimport { computeTransportConfiguration } from './transportConfiguration'\n\nexport var DefaultPrivacyLevel = {\n ALLOW: 'allow',\n MASK: 'mask',\n MASK_USER_INPUT: 'mask-user-input'\n}\nexport function validateAndBuildConfiguration(initConfiguration) {\n if (\n initConfiguration.sampleRate !== undefined &&\n !isPercentage(initConfiguration.sampleRate)\n ) {\n display.error('Sample Rate should be a number between 0 and 100')\n return\n }\n if (\n initConfiguration.sessionSampleRate !== undefined &&\n !isPercentage(initConfiguration.sessionSampleRate)\n ) {\n display.error('Sample Rate should be a number between 0 and 100')\n return\n }\n if (\n initConfiguration.telemetrySampleRate !== undefined &&\n !isPercentage(initConfiguration.telemetrySampleRate)\n ) {\n display.error('Telemetry Sample Rate should be a number between 0 and 100')\n return\n }\n var sessionSampleRate =\n initConfiguration.sessionSampleRate || initConfiguration.sampleRate\n return assign(\n {\n beforeSend:\n initConfiguration.beforeSend &&\n catchUserErrors(\n initConfiguration.beforeSend,\n 'beforeSend threw an error:'\n ),\n cookieOptions: buildCookieOptions(initConfiguration),\n sessionSampleRate: isNullUndefinedDefaultValue(sessionSampleRate, 100),\n service: initConfiguration.service,\n version: initConfiguration.version,\n env: initConfiguration.env,\n telemetrySampleRate: isNullUndefinedDefaultValue(\n initConfiguration.telemetrySampleRate,\n 100\n ),\n telemetryEnabled: isNullUndefinedDefaultValue(\n initConfiguration.telemetryEnabled,\n false\n ),\n silentMultipleInit: !!initConfiguration.silentMultipleInit,\n\n /**\n * beacon payload max queue size implementation is 64kb\n * ensure that we leave room for logs, rum and potential other users\n */\n batchBytesLimit: 16 * ONE_KIBI_BYTE,\n\n eventRateLimiterThreshold: 3000,\n maxTelemetryEventsPerPage: 15,\n\n /**\n * flush automatically, aim to be lower than ALB connection timeout\n * to maximize connection reuse.\n */\n flushTimeout: 30 * ONE_SECOND,\n\n /**\n * Logs intake limit\n */\n batchMessagesLimit: 50,\n messageBytesLimit: 256 * ONE_KIBI_BYTE,\n resourceUrlLimit: 5 * ONE_KIBI_BYTE,\n storeContextsToLocal: !!initConfiguration.storeContextsToLocal,\n // 存储到localstorage key ,默认不填,自动生成\n storeContextsKey: initConfiguration.storeContextsKey,\n sendContentTypeByJson: !!initConfiguration.sendContentTypeByJson\n },\n computeTransportConfiguration(initConfiguration)\n )\n}\nexport function validatePostRequestRequireParamsConfiguration(\n initConfiguration\n) {\n if (\n !initConfiguration.site &&\n !initConfiguration.datakitOrigin &&\n !initConfiguration.datakitUrl\n ) {\n display.error(\n 'datakitOrigin or site is not configured, no RUM data will be collected.'\n )\n return false\n }\n // if (!initConfiguration.datakitUrl && !initConfiguration.datakitOrigin) {\n // display.error(\n // 'datakitOrigin is not configured, no RUM data will be collected.'\n // )\n // return false\n // }\n if (initConfiguration.site && !initConfiguration.clientToken) {\n display.error(\n 'clientToken is not configured, no RUM data will be collected.'\n )\n return false\n }\n return true\n}\nexport function buildCookieOptions(initConfiguration) {\n var cookieOptions = {}\n\n // cookieOptions.secure = mustUseSecureCookie(initConfiguration)\n // cookieOptions.crossSite = !!initConfiguration.useCrossSiteSessionCookie\n cookieOptions.secure =\n !!initConfiguration.useSecureSessionCookie ||\n !!initConfiguration.usePartitionedCrossSiteSessionCookie ||\n !!initConfiguration.useCrossSiteSessionCookie\n cookieOptions.crossSite =\n !!initConfiguration.usePartitionedCrossSiteSessionCookie ||\n !!initConfiguration.useCrossSiteSessionCookie\n cookieOptions.partitioned =\n !!initConfiguration.usePartitionedCrossSiteSessionCookie\n if (initConfiguration.trackSessionAcrossSubdomains) {\n cookieOptions.domain = getCurrentSite()\n }\n\n return cookieOptions\n}\n\n// function mustUseSecureCookie(initConfiguration) {\n// return (\n// !!initConfiguration.useSecureSessionCookie ||\n// !!initConfiguration.useCrossSiteSessionCookie\n// )\n// }\n"],"mappings":";;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAMA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,uBAAA,GAAAL,OAAA;AAEO,IAAIM,mBAAmB,GAAG;EAC/BC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,eAAe,EAAE;AACnB,CAAC;AAAAC,OAAA,CAAAJ,mBAAA,GAAAA,mBAAA;AACM,SAASK,6BAA6BA,CAACC,iBAAiB,EAAE;EAC/D,IACEA,iBAAiB,CAACC,UAAU,KAAKC,SAAS,IAC1C,CAAC,IAAAC,mBAAY,EAACH,iBAAiB,CAACC,UAAU,CAAC,EAC3C;IACAG,gBAAO,CAACC,KAAK,CAAC,kDAAkD,CAAC;IACjE;EACF;EACA,IACEL,iBAAiB,CAACM,iBAAiB,KAAKJ,SAAS,IACjD,CAAC,IAAAC,mBAAY,EAACH,iBAAiB,CAACM,iBAAiB,CAAC,EAClD;IACAF,gBAAO,CAACC,KAAK,CAAC,kDAAkD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[]}
1
+ {"version":3,"file":"configuration.js","names":["_catchUserErrors","require","_display","_tools","_byteUtils","_transportConfiguration","_sessionStore","DefaultPrivacyLevel","ALLOW","MASK","MASK_USER_INPUT","exports","validateAndBuildConfiguration","initConfiguration","sampleRate","undefined","isPercentage","display","error","sessionSampleRate","telemetrySampleRate","assign","beforeSend","catchUserErrors","sessionStoreStrategyType","selectSessionStoreStrategyType","isNullUndefinedDefaultValue","service","version","env","telemetryEnabled","silentMultipleInit","batchBytesLimit","ONE_KIBI_BYTE","eventRateLimiterThreshold","maxTelemetryEventsPerPage","flushTimeout","ONE_SECOND","batchMessagesLimit","messageBytesLimit","resourceUrlLimit","storeContextsToLocal","storeContextsKey","sendContentTypeByJson","computeTransportConfiguration","validatePostRequestRequireParamsConfiguration","site","datakitOrigin","datakitUrl","clientToken"],"sources":["../../src/configuration/configuration.js"],"sourcesContent":["import { catchUserErrors } from '../helper/catchUserErrors'\nimport { display } from '../helper/display'\nimport {\n assign,\n isPercentage,\n ONE_SECOND,\n isNullUndefinedDefaultValue\n} from '../helper/tools'\nimport { ONE_KIBI_BYTE } from '../helper/byteUtils'\nimport { computeTransportConfiguration } from './transportConfiguration'\nimport { selectSessionStoreStrategyType } from '../session/sessionStore'\nexport var DefaultPrivacyLevel = {\n ALLOW: 'allow',\n MASK: 'mask',\n MASK_USER_INPUT: 'mask-user-input'\n}\nexport function validateAndBuildConfiguration(initConfiguration) {\n if (\n initConfiguration.sampleRate !== undefined &&\n !isPercentage(initConfiguration.sampleRate)\n ) {\n display.error('Sample Rate should be a number between 0 and 100')\n return\n }\n if (\n initConfiguration.sessionSampleRate !== undefined &&\n !isPercentage(initConfiguration.sessionSampleRate)\n ) {\n display.error('Sample Rate should be a number between 0 and 100')\n return\n }\n if (\n initConfiguration.telemetrySampleRate !== undefined &&\n !isPercentage(initConfiguration.telemetrySampleRate)\n ) {\n display.error('Telemetry Sample Rate should be a number between 0 and 100')\n return\n }\n var sessionSampleRate =\n initConfiguration.sessionSampleRate || initConfiguration.sampleRate\n return assign(\n {\n beforeSend:\n initConfiguration.beforeSend &&\n catchUserErrors(\n initConfiguration.beforeSend,\n 'beforeSend threw an error:'\n ),\n sessionStoreStrategyType:\n selectSessionStoreStrategyType(initConfiguration),\n sessionSampleRate: isNullUndefinedDefaultValue(sessionSampleRate, 100),\n service: initConfiguration.service,\n version: initConfiguration.version,\n env: initConfiguration.env,\n telemetrySampleRate: isNullUndefinedDefaultValue(\n initConfiguration.telemetrySampleRate,\n 100\n ),\n telemetryEnabled: isNullUndefinedDefaultValue(\n initConfiguration.telemetryEnabled,\n false\n ),\n silentMultipleInit: !!initConfiguration.silentMultipleInit,\n\n /**\n * beacon payload max queue size implementation is 64kb\n * ensure that we leave room for logs, rum and potential other users\n */\n batchBytesLimit: 16 * ONE_KIBI_BYTE,\n\n eventRateLimiterThreshold: 3000,\n maxTelemetryEventsPerPage: 15,\n\n /**\n * flush automatically, aim to be lower than ALB connection timeout\n * to maximize connection reuse.\n */\n flushTimeout: 30 * ONE_SECOND,\n\n /**\n * Logs intake limit\n */\n batchMessagesLimit: 50,\n messageBytesLimit: 256 * ONE_KIBI_BYTE,\n resourceUrlLimit: 5 * ONE_KIBI_BYTE,\n storeContextsToLocal: !!initConfiguration.storeContextsToLocal,\n // 存储到localstorage key ,默认不填,自动生成\n storeContextsKey: initConfiguration.storeContextsKey,\n sendContentTypeByJson: !!initConfiguration.sendContentTypeByJson\n },\n computeTransportConfiguration(initConfiguration)\n )\n}\nexport function validatePostRequestRequireParamsConfiguration(\n initConfiguration\n) {\n if (\n !initConfiguration.site &&\n !initConfiguration.datakitOrigin &&\n !initConfiguration.datakitUrl\n ) {\n display.error(\n 'datakitOrigin or site is not configured, no RUM data will be collected.'\n )\n return false\n }\n // if (!initConfiguration.datakitUrl && !initConfiguration.datakitOrigin) {\n // display.error(\n // 'datakitOrigin is not configured, no RUM data will be collected.'\n // )\n // return false\n // }\n if (initConfiguration.site && !initConfiguration.clientToken) {\n display.error(\n 'clientToken is not configured, no RUM data will be collected.'\n )\n return false\n }\n return true\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAMA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACO,IAAIM,mBAAmB,GAAG;EAC/BC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,eAAe,EAAE;AACnB,CAAC;AAAAC,OAAA,CAAAJ,mBAAA,GAAAA,mBAAA;AACM,SAASK,6BAA6BA,CAACC,iBAAiB,EAAE;EAC/D,IACEA,iBAAiB,CAACC,UAAU,KAAKC,SAAS,IAC1C,CAAC,IAAAC,mBAAY,EAACH,iBAAiB,CAACC,UAAU,CAAC,EAC3C;IACAG,gBAAO,CAACC,KAAK,CAAC,kDAAkD,CAAC;IACjE;EACF;EACA,IACEL,iBAAiB,CAACM,iBAAiB,KAAKJ,SAAS,IACjD,CAAC,IAAAC,mBAAY,EAACH,iBAAiB,CAACM,iBAAiB,CAAC,EAClD;IACAF,gBAAO,CAACC,KAAK,CAAC,kDAAkD,CAAC;IACjE;EACF;EACA,IACEL,iBAAiB,CAACO,mBAAmB,KAAKL,SAAS,IACnD,CAAC,IAAAC,mBAAY,EAACH,iBAAiB,CAACO,mBAAmB,CAAC,EACpD;IACAH,gBAAO,CAACC,KAAK,CAAC,4DAA4D,CAAC;IAC3E;EACF;EACA,IAAIC,iBAAiB,GACnBN,iBAAiB,CAACM,iBAAiB,IAAIN,iBAAiB,CAACC,UAAU;EACrE,OAAO,IAAAO,aAAM,EACX;IACEC,UAAU,EACRT,iBAAiB,CAACS,UAAU,IAC5B,IAAAC,gCAAe,EACbV,iBAAiB,CAACS,UAAU,EAC5B,4BACF,CAAC;IACHE,wBAAwB,EACtB,IAAAC,4CAA8B,EAACZ,iBAAiB,CAA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A,IAAIL,iBAAiB,CAACiC,IAAI,IAAI,CAACjC,iBAAiB,CAACoC,WAAW,EAAE;IAC5DhC,gBAAO,CAACC,KAAK,CACX,+DACF,CAAC;IACD,OAAO,KAAK;EACd;EACA,OAAO,IAAI;AACb","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MAX_TASK_TIME = void 0;
7
+ exports.requestIdleCallback = requestIdleCallback;
8
+ exports.requestIdleCallbackShim = requestIdleCallbackShim;
9
+ var _timer = require("./timer");
10
+ var _monitor = require("./monitor");
11
+ var _tools = require("./tools");
12
+ /**
13
+ * 'requestIdleCallback' with a shim.
14
+ */
15
+ function requestIdleCallback(callback, opts) {
16
+ // Note: check both 'requestIdleCallback' and 'cancelIdleCallback' existence because some polyfills only implement 'requestIdleCallback'.
17
+ if (window.requestIdleCallback && window.cancelIdleCallback) {
18
+ var id = window.requestIdleCallback((0, _monitor.monitor)(callback), opts);
19
+ return function () {
20
+ return window.cancelIdleCallback(id);
21
+ };
22
+ }
23
+ return requestIdleCallbackShim(callback);
24
+ }
25
+ var MAX_TASK_TIME = 50;
26
+
27
+ /*
28
+ * Shim from https://developer.chrome.com/blog/using-requestidlecallback#checking_for_requestidlecallback
29
+ * Note: there is no simple way to support the "timeout" option, so we ignore it.
30
+ */
31
+ exports.MAX_TASK_TIME = MAX_TASK_TIME;
32
+ function requestIdleCallbackShim(callback) {
33
+ var start = (0, _tools.dateNow)();
34
+ var timeoutId = (0, _timer.setTimeout)(function () {
35
+ callback({
36
+ didTimeout: false,
37
+ timeRemaining: function timeRemaining() {
38
+ return Math.max(0, MAX_TASK_TIME - ((0, _tools.dateNow)() - start));
39
+ }
40
+ });
41
+ }, 0);
42
+ return function () {
43
+ return (0, _timer.clearTimeout)(timeoutId);
44
+ };
45
+ }
46
+ //# sourceMappingURL=requestIdleCallback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestIdleCallback.js","names":["_timer","require","_monitor","_tools","requestIdleCallback","callback","opts","window","cancelIdleCallback","id","monitor","requestIdleCallbackShim","MAX_TASK_TIME","exports","start","dateNow","timeoutId","setTimeout","didTimeout","timeRemaining","Math","max","clearTimeout"],"sources":["../../src/helper/requestIdleCallback.js"],"sourcesContent":["import { setTimeout, clearTimeout } from './timer'\nimport { monitor } from './monitor'\nimport { dateNow } from './tools'\n\n/**\n * 'requestIdleCallback' with a shim.\n */\nexport function requestIdleCallback(callback, opts) {\n // Note: check both 'requestIdleCallback' and 'cancelIdleCallback' existence because some polyfills only implement 'requestIdleCallback'.\n if (window.requestIdleCallback && window.cancelIdleCallback) {\n const id = window.requestIdleCallback(monitor(callback), opts)\n return function () {\n return window.cancelIdleCallback(id)\n }\n }\n return requestIdleCallbackShim(callback)\n}\n\nexport const MAX_TASK_TIME = 50\n\n/*\n * Shim from https://developer.chrome.com/blog/using-requestidlecallback#checking_for_requestidlecallback\n * Note: there is no simple way to support the \"timeout\" option, so we ignore it.\n */\nexport function requestIdleCallbackShim(callback) {\n const start = dateNow()\n const timeoutId = setTimeout(function () {\n callback({\n didTimeout: false,\n timeRemaining: function () {\n return Math.max(0, MAX_TASK_TIME - (dateNow() - start))\n }\n })\n }, 0)\n return function () {\n return clearTimeout(timeoutId)\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACO,SAASG,mBAAmBA,CAACC,QAAQ,EAAEC,IAAI,EAAE;EAClD;EACA,IAAIC,MAAM,CAACH,mBAAmB,IAAIG,MAAM,CAACC,kBAAkB,EAAE;IAC3D,IAAMC,EAAE,GAAGF,MAAM,CAACH,mBAAmB,CAAC,IAAAM,gBAAO,EAACL,QAAQ,CAAC,EAAEC,IAAI,CAAC;IAC9D,OAAO,YAAY;MACjB,OAAOC,MAAM,CAACC,kBAAkB,CAACC,EAAE,CAAC;IACtC,CAAC;EACH;EACA,OAAOE,uBAAuB,CAACN,QAAQ,CAAC;AAC1C;AAEO,IAAMO,aAAa,GAAG,EAAE;;AAE/B;AACA;AACA;AACA;AAHAC,OAAA,CAAAD,aAAA,GAAAA,aAAA;AAIO,SAASD,uBAAuBA,CAACN,QAAQ,EAAE;EAChD,IAAMS,KAAK,GAAG,IAAAC,cAAO,EAAC,CAAC;EACvB,IAAMC,SAAS,GAAG,IAAAC,iBAAU,EAAC,YAAY;IACvCZ,QAAQ,CAAC;MACPa,UAAU,EAAE,KAAK;MACjBC,aAAa,EAAE,SAAAA,cAAA,EAAY;QACzB,OAAOC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAET,aAAa,IAAI,IAAAG,cAAO,EAAC,CAAC,GAAGD,KAAK,CAAC,CAAC;MACzD;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAAC,CAAC;EACL,OAAO,YAAY;IACjB,OAAO,IAAAQ,mBAAY,EAACN,SAAS,CAAC;EAChC,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MAX_EXECUTION_TIME_ON_TIMEOUT = void 0;
7
+ exports.createTaskQueue = createTaskQueue;
8
+ var _tools = require("./tools");
9
+ var _requestIdleCallback = require("./requestIdleCallback");
10
+ /**
11
+ * Maximum delay before starting to execute tasks in the queue. We don't want to wait too long
12
+ * before running tasks, as it might hurt reliability (ex: if the user navigates away, we might lose
13
+ * the opportunity to send some data). We also don't want to run tasks too often, as it might hurt
14
+ * performance.
15
+ */
16
+ var IDLE_CALLBACK_TIMEOUT = _tools.ONE_SECOND;
17
+
18
+ /**
19
+ * Maximum amount of time allocated to running tasks when a timeout (`IDLE_CALLBACK_TIMEOUT`) is
20
+ * reached. We should not run tasks for too long as it will hurt performance, but we should still
21
+ * run some tasks to avoid postponing them forever.
22
+ *
23
+ * Rational: Running tasks for 30ms every second (IDLE_CALLBACK_TIMEOUT) should be acceptable.
24
+ */
25
+ var MAX_EXECUTION_TIME_ON_TIMEOUT = 30;
26
+ exports.MAX_EXECUTION_TIME_ON_TIMEOUT = MAX_EXECUTION_TIME_ON_TIMEOUT;
27
+ function createTaskQueue() {
28
+ var pendingTasks = [];
29
+ function run(deadline) {
30
+ var executionTimeRemaining;
31
+ if (deadline.didTimeout) {
32
+ var start = performance.now();
33
+ executionTimeRemaining = function executionTimeRemaining() {
34
+ return MAX_EXECUTION_TIME_ON_TIMEOUT - (performance.now() - start);
35
+ };
36
+ } else {
37
+ executionTimeRemaining = deadline.timeRemaining.bind(deadline);
38
+ }
39
+ while (executionTimeRemaining() > 0 && pendingTasks.length) {
40
+ pendingTasks.shift()();
41
+ }
42
+ if (pendingTasks.length) {
43
+ scheduleNextRun();
44
+ }
45
+ }
46
+ function scheduleNextRun() {
47
+ (0, _requestIdleCallback.requestIdleCallback)(run, {
48
+ timeout: IDLE_CALLBACK_TIMEOUT
49
+ });
50
+ }
51
+ return {
52
+ push: function push(task) {
53
+ if (pendingTasks.push(task) === 1) {
54
+ scheduleNextRun();
55
+ }
56
+ }
57
+ };
58
+ }
59
+ //# sourceMappingURL=taskQueue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taskQueue.js","names":["_tools","require","_requestIdleCallback","IDLE_CALLBACK_TIMEOUT","ONE_SECOND","MAX_EXECUTION_TIME_ON_TIMEOUT","exports","createTaskQueue","pendingTasks","run","deadline","executionTimeRemaining","didTimeout","start","performance","now","timeRemaining","bind","length","shift","scheduleNextRun","requestIdleCallback","timeout","push","task"],"sources":["../../src/helper/taskQueue.js"],"sourcesContent":["import { ONE_SECOND } from './tools'\nimport { requestIdleCallback } from './requestIdleCallback'\n\n/**\n * Maximum delay before starting to execute tasks in the queue. We don't want to wait too long\n * before running tasks, as it might hurt reliability (ex: if the user navigates away, we might lose\n * the opportunity to send some data). We also don't want to run tasks too often, as it might hurt\n * performance.\n */\nconst IDLE_CALLBACK_TIMEOUT = ONE_SECOND\n\n/**\n * Maximum amount of time allocated to running tasks when a timeout (`IDLE_CALLBACK_TIMEOUT`) is\n * reached. We should not run tasks for too long as it will hurt performance, but we should still\n * run some tasks to avoid postponing them forever.\n *\n * Rational: Running tasks for 30ms every second (IDLE_CALLBACK_TIMEOUT) should be acceptable.\n */\nexport const MAX_EXECUTION_TIME_ON_TIMEOUT = 30\n\nexport function createTaskQueue() {\n const pendingTasks = []\n\n function run(deadline) {\n let executionTimeRemaining\n if (deadline.didTimeout) {\n const start = performance.now()\n executionTimeRemaining = function () {\n return MAX_EXECUTION_TIME_ON_TIMEOUT - (performance.now() - start)\n }\n } else {\n executionTimeRemaining = deadline.timeRemaining.bind(deadline)\n }\n\n while (executionTimeRemaining() > 0 && pendingTasks.length) {\n pendingTasks.shift()()\n }\n\n if (pendingTasks.length) {\n scheduleNextRun()\n }\n }\n\n function scheduleNextRun() {\n requestIdleCallback(run, { timeout: IDLE_CALLBACK_TIMEOUT })\n }\n\n return {\n push(task) {\n if (pendingTasks.push(task) === 1) {\n scheduleNextRun()\n }\n }\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAME,qBAAqB,GAAGC,iBAAU;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMC,6BAA6B,GAAG,EAAE;AAAAC,OAAA,CAAAD,6BAAA,GAAAA,6BAAA;AAExC,SAASE,eAAeA,CAAA,EAAG;EAChC,IAAMC,YAAY,GAAG,EAAE;EAEvB,SAASC,GAAGA,CAACC,QAAQ,EAAE;IACrB,IAAIC,sBAAsB;IAC1B,IAAID,QAAQ,CAACE,UAAU,EAAE;MACvB,IAAMC,KAAK,GAAGC,WAAW,CAACC,GAAG,CAAC,CAAC;MAC/BJ,sBAAsB,GAAG,SAAAA,uBAAA,EAAY;QACnC,OAAON,6BAA6B,IAAIS,WAAW,CAACC,GAAG,CAAC,CAAC,GAAGF,KAAK,CAAC;MACpE,CAAC;IACH,CAAC,MAAM;MACLF,sBAAsB,GAAGD,QAAQ,CAACM,aAAa,CAACC,IAAI,CAACP,QAAQ,CAAC;IAChE;IAEA,OAAOC,sBAAsB,CAAC,CAAC,GAAG,CAAC,IAAIH,YAAY,CAACU,MAAM,EAAE;MAC1DV,YAAY,CAACW,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB;IAEA,IAAIX,YAAY,CAACU,MAAM,EAAE;MACvBE,eAAe,CAAC,CAAC;IACnB;EACF;EAEA,SAASA,eAAeA,CAAA,EAAG;IACzB,IAAAC,wCAAmB,EAACZ,GAAG,EAAE;MAAEa,OAAO,EAAEnB;IAAsB,CAAC,CAAC;EAC9D;EAEA,OAAO;IACLoB,IAAI,WAAAA,KAACC,IAAI,EAAE;MACT,IAAIhB,YAAY,CAACe,IAAI,CAACC,IAAI,CAAC,KAAK,CAAC,EAAE;QACjCJ,eAAe,CAAC,CAAC;MACnB;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -1545,7 +1545,7 @@ function findByPath(source, path) {
1545
1545
  var pathArr = path.split('.');
1546
1546
  while (pathArr.length) {
1547
1547
  var key = pathArr.shift();
1548
- if (source && key in source && hasOwnProperty.call(source, key)) {
1548
+ if (source && isObject(source) && key in source && hasOwnProperty.call(source, key)) {
1549
1549
  source = source[key];
1550
1550
  } else {
1551
1551
  return undefined;