@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
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.js","names":["getCurrentSite","catchUserErrors","display","assign","isPercentage","ONE_SECOND","isNullUndefinedDefaultValue","ONE_KIBI_BYTE","computeTransportConfiguration","DefaultPrivacyLevel","ALLOW","MASK","MASK_USER_INPUT","validateAndBuildConfiguration","initConfiguration","sampleRate","undefined","error","sessionSampleRate","telemetrySampleRate","beforeSend","cookieOptions","buildCookieOptions","service","version","env","telemetryEnabled","silentMultipleInit","batchBytesLimit","eventRateLimiterThreshold","maxTelemetryEventsPerPage","flushTimeout","batchMessagesLimit","messageBytesLimit","resourceUrlLimit","storeContextsToLocal","storeContextsKey","sendContentTypeByJson","validatePostRequestRequireParamsConfiguration","site","datakitOrigin","datakitUrl","clientToken","secure","useSecureSessionCookie","usePartitionedCrossSiteSessionCookie","useCrossSiteSessionCookie","crossSite","partitioned","trackSessionAcrossSubdomains","domain"],"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,SAASA,cAAc,QAAQ,mBAAmB;AAClD,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,OAAO,QAAQ,mBAAmB;AAC3C,SACEC,MAAM,EACNC,YAAY,EACZC,UAAU,EACVC,2BAA2B,QACtB,iBAAiB;AACxB,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,6BAA6B,QAAQ,0BAA0B;AAExE,OAAO,IAAIC,mBAAmB,GAAG;EAC/BC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,eAAe,EAAE;AACnB,CAAC;AACD,OAAO,SAASC,6BAA6BA,CAACC,iBAAiB,EAAE;EAC/D,IACEA,iBAAiB,CAACC,UAAU,KAAKC,SAAS,IAC1C,CAACZ,YAAY,CAACU,iBAAiB,CAACC,UAAU,CAAC,EAC3C;IACAb,OAAO,CAACe,KAAK,CAAC,kDAAkD,CAAC;IACjE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a,CAAC6B,MAAM,GAAGlD,cAAc,CAAC,CAAC;EACzC;EAEA,OAAOqB,aAAa;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"configuration.js","names":["catchUserErrors","display","assign","isPercentage","ONE_SECOND","isNullUndefinedDefaultValue","ONE_KIBI_BYTE","computeTransportConfiguration","selectSessionStoreStrategyType","DefaultPrivacyLevel","ALLOW","MASK","MASK_USER_INPUT","validateAndBuildConfiguration","initConfiguration","sampleRate","undefined","error","sessionSampleRate","telemetrySampleRate","beforeSend","sessionStoreStrategyType","service","version","env","telemetryEnabled","silentMultipleInit","batchBytesLimit","eventRateLimiterThreshold","maxTelemetryEventsPerPage","flushTimeout","batchMessagesLimit","messageBytesLimit","resourceUrlLimit","storeContextsToLocal","storeContextsKey","sendContentTypeByJson","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,SAASA,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,OAAO,QAAQ,mBAAmB;AAC3C,SACEC,MAAM,EACNC,YAAY,EACZC,UAAU,EACVC,2BAA2B,QACtB,iBAAiB;AACxB,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,6BAA6B,QAAQ,0BAA0B;AACxE,SAASC,8BAA8B,QAAQ,yBAAyB;AACxE,OAAO,IAAIC,mBAAmB,GAAG;EAC/BC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,eAAe,EAAE;AACnB,CAAC;AACD,OAAO,SAASC,6BAA6BA,CAACC,iBAAiB,EAAE;EAC/D,IACEA,iBAAiB,CAACC,UAAU,KAAKC,SAAS,IAC1C,CAACb,YAAY,CAACW,iBAAiB,CAACC,UAAU,CAAC,EAC3C;IACAd,OAAO,CAACgB,KAAK,CAAC,kDAAkD,CAAC;IACjE;EACF;EACA,IACEH,iBAAiB,CAACI,iBAAiB,KAAKF,SAAS,IACjD,CAACb,YAAY,CAACW,iBAAiB,CAACI,iBAAiB,CAAC,EAClD;IACAjB,OAAO,CAACgB,KAAK,CAAC,kDAAkD,CAAC;IACjE;EACF;EACA,IACEH,iBAAiB,CAACK,mBAAmB,KAAKH,SAAS,IACnD,CAACb,YAAY,CAACW,iBAAiB,CAACK,mBAAmB,CAAC,EACpD;IACAlB,OAAO,CAACgB,KAAK,CAAC,4DAA4D,CAAC;IAC3E;EACF;EACA,IAAIC,iBAAiB,GACnBJ,iBAAiB,CAACI,iBAAiB,IAAIJ,iBAAiB,CAACC,UAAU;EACrE,OAAOb,MAAM,CACX;IACEkB,UAAU,EACRN,iBAAiB,CAACM,UAAU,IAC5BpB,eAAe,CACbc,iBAAiB,CAACM,UAAU,EAC5B,4BACF,CAAC;IACHC,wBAAw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A;EACA,IAAIH,iBAAiB,CAACwB,IAAI,IAAI,CAACxB,iBAAiB,CAAC2B,WAAW,EAAE;IAC5DxC,OAAO,CAACgB,KAAK,CACX,+DACF,CAAC;IACD,OAAO,KAAK;EACd;EACA,OAAO,IAAI;AACb","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ import { setTimeout, clearTimeout } from './timer';
2
+ import { monitor } from './monitor';
3
+ import { dateNow } from './tools';
4
+
5
+ /**
6
+ * 'requestIdleCallback' with a shim.
7
+ */
8
+ export function requestIdleCallback(callback, opts) {
9
+ // Note: check both 'requestIdleCallback' and 'cancelIdleCallback' existence because some polyfills only implement 'requestIdleCallback'.
10
+ if (window.requestIdleCallback && window.cancelIdleCallback) {
11
+ var id = window.requestIdleCallback(monitor(callback), opts);
12
+ return function () {
13
+ return window.cancelIdleCallback(id);
14
+ };
15
+ }
16
+ return requestIdleCallbackShim(callback);
17
+ }
18
+ export var MAX_TASK_TIME = 50;
19
+
20
+ /*
21
+ * Shim from https://developer.chrome.com/blog/using-requestidlecallback#checking_for_requestidlecallback
22
+ * Note: there is no simple way to support the "timeout" option, so we ignore it.
23
+ */
24
+ export function requestIdleCallbackShim(callback) {
25
+ var start = dateNow();
26
+ var timeoutId = setTimeout(function () {
27
+ callback({
28
+ didTimeout: false,
29
+ timeRemaining: function timeRemaining() {
30
+ return Math.max(0, MAX_TASK_TIME - (dateNow() - start));
31
+ }
32
+ });
33
+ }, 0);
34
+ return function () {
35
+ return clearTimeout(timeoutId);
36
+ };
37
+ }
38
+ //# sourceMappingURL=requestIdleCallback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestIdleCallback.js","names":["setTimeout","clearTimeout","monitor","dateNow","requestIdleCallback","callback","opts","window","cancelIdleCallback","id","requestIdleCallbackShim","MAX_TASK_TIME","start","timeoutId","didTimeout","timeRemaining","Math","max"],"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,SAASA,UAAU,EAAEC,YAAY,QAAQ,SAAS;AAClD,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,OAAO,QAAQ,SAAS;;AAEjC;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAACC,QAAQ,EAAEC,IAAI,EAAE;EAClD;EACA,IAAIC,MAAM,CAACH,mBAAmB,IAAIG,MAAM,CAACC,kBAAkB,EAAE;IAC3D,IAAMC,EAAE,GAAGF,MAAM,CAACH,mBAAmB,CAACF,OAAO,CAACG,QAAQ,CAAC,EAAEC,IAAI,CAAC;IAC9D,OAAO,YAAY;MACjB,OAAOC,MAAM,CAACC,kBAAkB,CAACC,EAAE,CAAC;IACtC,CAAC;EACH;EACA,OAAOC,uBAAuB,CAACL,QAAQ,CAAC;AAC1C;AAEA,OAAO,IAAMM,aAAa,GAAG,EAAE;;AAE/B;AACA;AACA;AACA;AACA,OAAO,SAASD,uBAAuBA,CAACL,QAAQ,EAAE;EAChD,IAAMO,KAAK,GAAGT,OAAO,CAAC,CAAC;EACvB,IAAMU,SAAS,GAAGb,UAAU,CAAC,YAAY;IACvCK,QAAQ,CAAC;MACPS,UAAU,EAAE,KAAK;MACjBC,aAAa,EAAE,SAAAA,cAAA,EAAY;QACzB,OAAOC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEN,aAAa,IAAIR,OAAO,CAAC,CAAC,GAAGS,KAAK,CAAC,CAAC;MACzD;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAAC,CAAC;EACL,OAAO,YAAY;IACjB,OAAOX,YAAY,CAACY,SAAS,CAAC;EAChC,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ import { ONE_SECOND } from './tools';
2
+ import { requestIdleCallback } from './requestIdleCallback';
3
+
4
+ /**
5
+ * Maximum delay before starting to execute tasks in the queue. We don't want to wait too long
6
+ * before running tasks, as it might hurt reliability (ex: if the user navigates away, we might lose
7
+ * the opportunity to send some data). We also don't want to run tasks too often, as it might hurt
8
+ * performance.
9
+ */
10
+ var IDLE_CALLBACK_TIMEOUT = ONE_SECOND;
11
+
12
+ /**
13
+ * Maximum amount of time allocated to running tasks when a timeout (`IDLE_CALLBACK_TIMEOUT`) is
14
+ * reached. We should not run tasks for too long as it will hurt performance, but we should still
15
+ * run some tasks to avoid postponing them forever.
16
+ *
17
+ * Rational: Running tasks for 30ms every second (IDLE_CALLBACK_TIMEOUT) should be acceptable.
18
+ */
19
+ export var MAX_EXECUTION_TIME_ON_TIMEOUT = 30;
20
+ export function createTaskQueue() {
21
+ var pendingTasks = [];
22
+ function run(deadline) {
23
+ var executionTimeRemaining;
24
+ if (deadline.didTimeout) {
25
+ var start = performance.now();
26
+ executionTimeRemaining = function executionTimeRemaining() {
27
+ return MAX_EXECUTION_TIME_ON_TIMEOUT - (performance.now() - start);
28
+ };
29
+ } else {
30
+ executionTimeRemaining = deadline.timeRemaining.bind(deadline);
31
+ }
32
+ while (executionTimeRemaining() > 0 && pendingTasks.length) {
33
+ pendingTasks.shift()();
34
+ }
35
+ if (pendingTasks.length) {
36
+ scheduleNextRun();
37
+ }
38
+ }
39
+ function scheduleNextRun() {
40
+ requestIdleCallback(run, {
41
+ timeout: IDLE_CALLBACK_TIMEOUT
42
+ });
43
+ }
44
+ return {
45
+ push: function push(task) {
46
+ if (pendingTasks.push(task) === 1) {
47
+ scheduleNextRun();
48
+ }
49
+ }
50
+ };
51
+ }
52
+ //# sourceMappingURL=taskQueue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taskQueue.js","names":["ONE_SECOND","requestIdleCallback","IDLE_CALLBACK_TIMEOUT","MAX_EXECUTION_TIME_ON_TIMEOUT","createTaskQueue","pendingTasks","run","deadline","executionTimeRemaining","didTimeout","start","performance","now","timeRemaining","bind","length","shift","scheduleNextRun","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,SAASA,UAAU,QAAQ,SAAS;AACpC,SAASC,mBAAmB,QAAQ,uBAAuB;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,qBAAqB,GAAGF,UAAU;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMG,6BAA6B,GAAG,EAAE;AAE/C,OAAO,SAASC,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,OAAOL,6BAA6B,IAAIQ,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;IACzBhB,mBAAmB,CAACK,GAAG,EAAE;MAAEY,OAAO,EAAEhB;IAAsB,CAAC,CAAC;EAC9D;EAEA,OAAO;IACLiB,IAAI,WAAAA,KAACC,IAAI,EAAE;MACT,IAAIf,YAAY,CAACc,IAAI,CAACC,IAAI,CAAC,KAAK,CAAC,EAAE;QACjCH,eAAe,CAAC,CAAC;MACnB;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -1379,7 +1379,7 @@ export function findByPath(source, path) {
1379
1379
  var pathArr = path.split('.');
1380
1380
  while (pathArr.length) {
1381
1381
  var key = pathArr.shift();
1382
- if (source && key in source && hasOwnProperty.call(source, key)) {
1382
+ if (source && isObject(source) && key in source && hasOwnProperty.call(source, key)) {
1383
1383
  source = source[key];
1384
1384
  } else {
1385
1385
  return undefined;