@cloudcare/browser-core 3.2.28 → 3.2.30

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 (52) hide show
  1. package/cjs/dataMap.js +1 -0
  2. package/cjs/dataMap.js.map +1 -1
  3. package/cjs/helper/encoder.js +1 -1
  4. package/cjs/helper/encoder.js.map +1 -1
  5. package/cjs/index.js +7 -0
  6. package/cjs/index.js.map +1 -1
  7. package/cjs/session/sessionConstants.js +5 -1
  8. package/cjs/session/sessionConstants.js.map +1 -1
  9. package/cjs/session/sessionInCookie.js +1 -1
  10. package/cjs/session/sessionInCookie.js.map +1 -1
  11. package/cjs/session/sessionInLocalStorage.js +1 -1
  12. package/cjs/session/sessionInLocalStorage.js.map +1 -1
  13. package/cjs/session/sessionStore.js +18 -5
  14. package/cjs/session/sessionStore.js.map +1 -1
  15. package/cjs/session/sessionStoreOperations.js +34 -8
  16. package/cjs/session/sessionStoreOperations.js.map +1 -1
  17. package/cjs/transport/batch.js +7 -2
  18. package/cjs/transport/batch.js.map +1 -1
  19. package/cjs/transport/httpRequest.js +37 -6
  20. package/cjs/transport/httpRequest.js.map +1 -1
  21. package/esm/dataMap.js +1 -0
  22. package/esm/dataMap.js.map +1 -1
  23. package/esm/helper/encoder.js +1 -1
  24. package/esm/helper/encoder.js.map +1 -1
  25. package/esm/index.js +1 -1
  26. package/esm/index.js.map +1 -1
  27. package/esm/session/sessionConstants.js +4 -0
  28. package/esm/session/sessionConstants.js.map +1 -1
  29. package/esm/session/sessionInCookie.js +2 -2
  30. package/esm/session/sessionInCookie.js.map +1 -1
  31. package/esm/session/sessionInLocalStorage.js +2 -2
  32. package/esm/session/sessionInLocalStorage.js.map +1 -1
  33. package/esm/session/sessionStore.js +18 -5
  34. package/esm/session/sessionStore.js.map +1 -1
  35. package/esm/session/sessionStoreOperations.js +34 -9
  36. package/esm/session/sessionStoreOperations.js.map +1 -1
  37. package/esm/transport/batch.js +7 -2
  38. package/esm/transport/batch.js.map +1 -1
  39. package/esm/transport/httpRequest.js +37 -6
  40. package/esm/transport/httpRequest.js.map +1 -1
  41. package/package.json +2 -2
  42. package/src/dataMap.js +1 -0
  43. package/src/helper/encoder.js +1 -1
  44. package/src/index.js +2 -1
  45. package/src/session/sessionConstants.js +4 -0
  46. package/src/session/sessionInCookie.js +3 -2
  47. package/src/session/sessionInLocalStorage.js +4 -2
  48. package/src/session/sessionStore.js +27 -8
  49. package/src/session/sessionStoreOperations.js +31 -13
  50. package/src/transport/batch.js +1 -2
  51. package/src/transport/httpRequest.js +52 -15
  52. package/types/index.d.ts +16 -2
@@ -1 +1 @@
1
- {"version":3,"file":"sessionStoreOperations.js","names":["_timer","require","_tools","_sessionState","LOCK_RETRY_DELAY","exports","LOCK_MAX_TRIES","bufferedOperations","ongoingOperations","processSessionStoreOperations","operations","sessionStoreStrategy","numberOfRetries","arguments","length","undefined","isLockEnabled","persistSession","expireSession","persistWithLock","session","assign","lock","currentLock","retrieveStore","retrieveSession","push","next","currentStore","retryLater","UUID","processedSession","process","isSessionInExpiredState","expandSessionState","after","sessionStore","currentNumberOfRetries","setTimeout","nextOperations","shift"],"sources":["../../src/session/sessionStoreOperations.js"],"sourcesContent":["import { setTimeout } from '../helper/timer'\nimport { UUID, assign } from '../helper/tools'\nimport {\n expandSessionState,\n isSessionInExpiredState,\n isSessionInNotStartedState\n} from './sessionState'\n\nexport const LOCK_RETRY_DELAY = 10\nexport const LOCK_MAX_TRIES = 100\nconst bufferedOperations = []\nlet ongoingOperations\n\nexport function processSessionStoreOperations(\n operations,\n sessionStoreStrategy,\n numberOfRetries = 0\n) {\n const { isLockEnabled, persistSession, expireSession } = sessionStoreStrategy\n const persistWithLock = function (session) {\n return persistSession(assign({}, session, { lock: currentLock }))\n }\n const retrieveStore = function () {\n const session = sessionStoreStrategy.retrieveSession()\n const lock = session.lock\n if (session.lock) {\n delete session.lock\n }\n\n return {\n session,\n lock\n }\n }\n\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (isLockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {\n next(sessionStoreStrategy)\n return\n }\n let currentLock\n let currentStore = retrieveStore()\n if (isLockEnabled) {\n // if someone has lock, retry later\n if (currentStore.lock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = UUID()\n persistWithLock(currentStore.session)\n // if lock is not acquired, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n let processedSession = operations.process(currentStore.session)\n if (isLockEnabled) {\n // if lock corrupted after process, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n if (isSessionInExpiredState(processedSession)) {\n expireSession()\n } else {\n expandSessionState(processedSession)\n isLockEnabled\n ? persistWithLock(processedSession)\n : persistSession(processedSession)\n }\n }\n if (isLockEnabled) {\n // correctly handle lock around expiration would require to handle this case properly at several levels\n // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it\n if (!(processedSession && isSessionInExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n persistSession(currentStore.session)\n processedSession = currentStore.session\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date session state value => the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentStore.session)\n }\n next(sessionStoreStrategy)\n}\n\nfunction retryLater(operations, sessionStore, currentNumberOfRetries) {\n setTimeout(function () {\n processSessionStoreOperations(\n operations,\n sessionStore,\n currentNumberOfRetries + 1\n )\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next(sessionStore) {\n ongoingOperations = undefined\n const nextOperations = bufferedOperations.shift()\n if (nextOper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IAAAE,qCAAuB,EAACF,gBAAgB,CAAC,CAAC,EAAE;MACpE;MACAH,YAAY,GAAGJ,aAAa,CAAC,CAAC;MAC9B,IAAII,YAAY,CAACN,IAAI,KAAKC,WAAW,EAAE;QACrCM,UAAU,CAACnB,UAAU,EAAEC,oBAAoB,EAAEC,eAAe,CAAC;QAC7D;MACF;MACAK,cAAc,CAACW,YAAY,CAACR,OAAO,CAAC;MACpCW,gBAAgB,GAAGH,YAAY,CAACR,OAAO;IACzC;EACF;EACA;EACA;EACA,IAAIV,UAAU,CAACyB,KAAK,EAAE;IACpBzB,UAAU,CAACyB,KAAK,CAACJ,gBAAgB,IAAIH,YAAY,CAACR,OAAO,CAAC;EAC5D;EACAO,IAAI,CAAChB,oBAAoB,CAAC;AAC5B;AAEA,SAASkB,UAAUA,CAACnB,UAAU,EAAE0B,YAAY,EAAEC,sBAAsB,EAAE;EACpE,IAAAC,iBAAU,EAAC,YAAY;IACrB7B,6BAA6B,CAC3BC,UAAU,EACV0B,YAAY,EACZC,sBAAsB,GAAG,CAC3B,CAAC;EACH,CAAC,EAAEjC,gBAAgB,CAAC;AACtB;AAEA,SAASuB,IAAIA,CAACS,YAAY,EAAE;EAC1B5B,iBAAiB,GAAGO,SAAS;EAC7B,IAAMwB,cAAc,GAAGhC,kBAAkB,CAACiC,KAAK,CAAC,CAAC;EACjD,IAAID,cAAc,EAAE;IAClB9B,6BAA6B,CAAC8B,cAAc,EAAEH,YAAY,CAAC;EAC7D;AACF","ignoreList":[]}
1
+ {"version":3,"file":"sessionStoreOperations.js","names":["_timer","require","_tools","_sessionState","_telemetry","_excluded","_slicedToArray","r","e","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","t","toString","call","slice","constructor","name","Array","from","test","length","n","l","Symbol","iterator","i","u","f","o","next","Object","done","push","value","isArray","_objectWithoutProperties","_objectWithoutPropertiesLoose","getOwnPropertySymbols","indexOf","propertyIsEnumerable","hasOwnProperty","LOCK_RETRY_DELAY","exports","LOCK_MAX_TRIES","LOCK_EXPIRATION_DELAY","ONE_SECOND","LOCK_SEPARATOR","bufferedOperations","ongoingOperations","processSessionStoreOperations","operations","sessionStoreStrategy","numberOfRetries","arguments","undefined","isLockEnabled","persistSession","expireSession","persistWithLock","session","assign","lock","currentLock","retrieveStore","_sessionStoreStrategy","retrieveSession","isLockExpired","addTelemetryDebug","currentStore","retryLater","createLock","processedSession","process","isSessionInExpiredState","expandSessionState","after","sessionStore","currentNumberOfRetries","setTimeout","nextOperations","shift","UUID","timeStampNow","_lock$split","split","_lock$split2","timeStamp","elapsed","Number"],"sources":["../../src/session/sessionStoreOperations.js"],"sourcesContent":["import { setTimeout } from '../helper/timer'\nimport {\n UUID,\n assign,\n ONE_SECOND,\n timeStampNow,\n elapsed\n} from '../helper/tools'\nimport { expandSessionState, isSessionInExpiredState } from './sessionState'\nimport { addTelemetryDebug } from '../telemetry/telemetry'\nexport const LOCK_RETRY_DELAY = 10\nexport const LOCK_MAX_TRIES = 100\n\n// Locks should be hold for a few milliseconds top, just the time it takes to read and write a\n// cookie. Using one second should be enough in most situations.\nexport const LOCK_EXPIRATION_DELAY = ONE_SECOND\nconst LOCK_SEPARATOR = '--'\nconst bufferedOperations = []\nlet ongoingOperations\n\nexport function processSessionStoreOperations(\n operations,\n sessionStoreStrategy,\n numberOfRetries = 0\n) {\n const { isLockEnabled, persistSession, expireSession } = sessionStoreStrategy\n const persistWithLock = function (session) {\n return persistSession(assign({}, session, { lock: currentLock }))\n }\n const retrieveStore = function () {\n const { lock, ...session } = sessionStoreStrategy.retrieveSession()\n\n return {\n session,\n lock: lock && !isLockExpired(lock) ? lock : undefined\n }\n }\n\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (isLockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {\n addTelemetryDebug('Aborted session operation after max lock retries', {\n currentStore: retrieveStore()\n })\n next(sessionStoreStrategy)\n return\n }\n let currentLock\n let currentStore = retrieveStore()\n if (isLockEnabled) {\n // if someone has lock, retry later\n if (currentStore.lock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = createLock()\n persistWithLock(currentStore.session)\n // if lock is not acquired, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n let processedSession = operations.process(currentStore.session)\n if (isLockEnabled) {\n // if lock corrupted after process, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n if (isSessionInExpiredState(processedSession)) {\n expireSession()\n } else {\n expandSessionState(processedSession)\n isLockEnabled\n ? persistWithLock(processedSession)\n : persistSession(processedSession)\n }\n }\n if (isLockEnabled) {\n // correctly handle lock around expiration would require to handle this case properly at several levels\n // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it\n if (!(processedSession && isSessionInExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n persistSession(currentStore.session)\n processedSession = currentStore.session\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date session state value => the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentStore.session)\n }\n next(sessionStoreStrategy)\n}\n\nfunction retryLater(operations, sessionStore, currentNumberOfRetries) {\n setTimeout(function () {\n processSessionStoreOperations(\n operations,\n sessionStore,\n currentNumberOfRetries + 1\n )\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next(sessionStore) {\n ongoingOperations = undefined\n const nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n processSessionStoreOperations(nextOperations, sessionStore)\n }\n}\n\nexport function createLock() {\n return UUID() + LOCK_SEPARATOR + timeStampNow()\n}\n\n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IAAIA,CAAC+C,YAAY,EAAE;EAC1B5B,iBAAiB,GAAGM,SAAS;EAC7B,IAAMyB,cAAc,GAAGhC,kBAAkB,CAACiC,KAAK,CAAC,CAAC;EACjD,IAAID,cAAc,EAAE;IAClB9B,6BAA6B,CAAC8B,cAAc,EAAEH,YAAY,CAAC;EAC7D;AACF;AAEO,SAASN,UAAUA,CAAA,EAAG;EAC3B,OAAO,IAAAW,WAAI,EAAC,CAAC,GAAGnC,cAAc,GAAG,IAAAoC,mBAAY,EAAC,CAAC;AACjD;AAEA,SAAShB,aAAaA,CAACL,IAAI,EAAE;EAC3B,IAAAsB,WAAA,GAAsBtB,IAAI,CAACuB,KAAK,CAACtC,cAAc,CAAC;IAAAuC,YAAA,GAAApF,cAAA,CAAAkF,WAAA;IAAvCG,SAAS,GAAAD,YAAA;EAClB,OACE,CAACC,SAAS,IACV,IAAAC,cAAO,EAACC,MAAM,CAACF,SAAS,CAAC,EAAE,IAAAJ,mBAAY,EAAC,CAAC,CAAC,GAAGtC,qBAAqB;AAEtE","ignoreList":[]}
@@ -13,6 +13,12 @@ var _enums = require("../helper/enums");
13
13
  var _byteUtils = require("../helper/byteUtils");
14
14
  var _pageExitObservable = require("../browser/pageExitObservable");
15
15
  var _jsonStringify = require("../helper/serialisation/jsonStringify");
16
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
17
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
18
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
19
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
20
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
21
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
22
  // https://en.wikipedia.org/wiki/UTF-8
17
23
  // eslint-disable-next-line no-control-regex
18
24
  var CUSTOM_KEYS = 'custom_keys';
@@ -187,9 +193,8 @@ function createBatch(options) {
187
193
  if (encoderResult.outputBytesCount) {
188
194
  send(formatPayloadFromEncoder(encoderResult, sendContentTypeByJson));
189
195
  }
190
-
191
196
  // Send messages that are not yet encoded at this point
192
- var pendingMessages = [encoderResult.pendingData, upsertMessages].filter(Boolean).join('\n');
197
+ var pendingMessages = [].concat(_toConsumableArray(encoderResult.pendingData), [upsertMessages]).filter(Boolean).join('\n');
193
198
  if (pendingMessages) {
194
199
  send({
195
200
  data: pendingMessages,
@@ -1 +1 @@
1
- {"version":3,"file":"batch.js","names":["_display","require","_tools","_rowData","_dataMap","_enums","_byteUtils","_pageExitObservable","_jsonStringify","CUSTOM_KEYS","processedMessageByDataMap","exports","message","type","rowStr","rowData","undefined","tags","fields","hasFileds","each","dataMap","value","key","measurement","tagsStr","extend","commonTags","filterFileds","value_path","_key","_value","findByPath","push","isNumber","escapeJsonValue","escapeRowData","fieldsStr","commonFields","isArray","length","_valueData","escapeRowField","isString","context","isObject","isEmptyObject","_tagKeys","indexOf","RumEventType","LOGGER","join","date","time","createBatch","options","encoder","request","messageBytesLimit","sendContentTypeByJson","flushController","upsertBuffer","flushSubscription","flushObservable","subscribe","event","flush","getMessageText","messages","isEmpty","arguments","serializedMessage","estimatedMessageBytesCount","notifyBeforeAddMessage","notifyAfterAddMessage","write","realMessageBytesCount","hasMessageFor","remove","removedMessage","messageBytesCount","estimateEncodedBytesCount","notifyAfterRemoveMessage","process","processedMessage","jsonStringify","addOrUpdate","display","warn","concat","upsertMessages","values","isPageExit","isPageExitReason","reason","send","sendOnExit","isAsync","encoderResult","finishSync","outputBytesCount","formatPayloadFromEncoder","pendingMessages","pendingData","filter","Boolean","data","bytesCount","computeBytesCount","text","finish","add","upsert","stop","unsubscribe","output","Blob","encoding"],"sources":["../../src/transport/batch.js"],"sourcesContent":["import { display } from '../helper/display'\nimport {\n values,\n findByPath,\n each,\n isNumber,\n isArray,\n extend,\n isString,\n isEmptyObject,\n isObject\n} from '../helper/tools'\nimport {\n escapeJsonValue,\n escapeRowField,\n escapeRowData\n} from '../helper/serialisation/rowData'\nimport { commonTags, dataMap, commonFields } from '../dataMap'\nimport { RumEventType } from '../helper/enums'\nimport { computeBytesCount } from '../helper/byteUtils'\nimport { isPageExitReason } from '../browser/pageExitObservable'\nimport { jsonStringify } from '../helper/serialisation/jsonStringify'\n// https://en.wikipedia.org/wiki/UTF-8\n// eslint-disable-next-line no-control-regex\nvar CUSTOM_KEYS = 'custom_keys'\nexport var processedMessageByDataMap = function (message) {\n if (!message || !message.type)\n return {\n rowStr: '',\n rowData: undefined\n }\n\n var rowData = { tags: {}, fields: {} }\n var hasFileds = false\n var rowStr = ''\n each(dataMap, function (value, key) {\n if (value.type === message.type) {\n rowStr += key + ','\n rowData.measurement = key\n var tagsStr = []\n var tags = extend({}, commonTags, value.tags)\n var filterFileds = ['date', 'type', CUSTOM_KEYS]\n each(tags, function (value_path, _key) {\n var _value = findByPath(message, value_path)\n filterFileds.push(_key)\n if (_value || isNumber(_value)) {\n rowData.tags[_key] = escapeJsonValue(_value, true)\n tagsStr.push(escapeRowData(_key) + '=' + escapeRowData(_value))\n }\n })\n\n var fieldsStr = []\n var fields = extend({}, commonFields, value.fields)\n each(fields, function (_value, _key) {\n if (isArray(_value) && _value.length === 2) {\n var value_path = _value[1]\n var _valueData = findByPath(message, value_path)\n filterFileds.push(_key)\n if (_valueData !== undefined && _valueData !== null) {\n rowData.fields[_key] = escapeJsonValue(_valueData)\n fieldsStr.push(\n escapeRowData(_key) + '=' + escapeRowField(_valueData)\n )\n }\n } else if (isString(_value)) {\n var _valueData = findByPath(message, _value)\n filterFileds.push(_key)\n if (_valueData !== undefined && _valueData !== null) {\n rowData.fields[_key] = escapeJsonValue(_valueData)\n fieldsStr.push(\n escapeRowData(_key) + '=' + escapeRowField(_valueData)\n )\n }\n }\n })\n if (\n message.context &&\n isObject(message.context) &&\n !isEmptyObject(message.context)\n ) {\n var _tagKeys = []\n each(message.context, function (_value, _key) {\n if (filterFileds.indexOf(_key) > -1) return\n filterFileds.push(_key)\n if (_value !== undefined && _value !== null) {\n _tagKeys.push(_key)\n rowData.fields[_key] = escapeJsonValue(_value)\n fieldsStr.push(escapeRowData(_key) + '=' + escapeRowField(_value))\n }\n })\n if (_tagKeys.length) {\n rowData.fields[CUSTOM_KEYS] = escapeJsonValue(_tagKeys)\n fieldsStr.push(\n escapeRowData(CUSTOM_KEYS) + '=' + escapeRowField(_tagKeys)\n )\n }\n }\n if (message.type === RumEventType.LOGGER) {\n each(message, function (value, key) {\n if (\n filterFileds.indexOf(key) === -1 &&\n value !== undefined &&\n value !== null\n ) {\n rowData.fields[key] = escapeJsonValue(value)\n fieldsStr.push(escapeRowData(key) + '=' + escapeRowField(value))\n }\n })\n }\n if (tagsStr.length) {\n rowStr += tagsStr.join(',')\n }\n if (fieldsStr.length) {\n rowStr += ' '\n rowStr += fieldsStr.join(',')\n hasFileds = true\n }\n rowStr = rowStr + ' ' + message.date\n rowData.time = message.date\n }\n })\n return {\n rowStr: hasFileds ? rowStr : '',\n rowData: hasFileds ? rowData : undefined\n }\n}\n\nexport function createBatch(options) {\n var encoder = options.encoder\n var request = options.request\n var messageBytesLimit = options.messageBytesLimit\n var sendContentTypeByJson = options.sendContentTypeByJson\n var flushController = options.flushController\n var upsertBuffer = {}\n var flushSubscription = flushController.flushObservable.subscribe(function (\n event\n ) {\n flush(event)\n })\n function getMessageText(messages, isEmpty = false) {\n if (sendContentTypeByJson) {\n if (isEmpty) {\n return '[' + messages.join(',')\n } else {\n return ',' + messages.join(',')\n }\n } else {\n if (isEmpty) {\n return messages.join('\\n')\n } else {\n return '\\n' + messages.join('\\n')\n }\n }\n }\n function push(serializedMessage, estimatedMessageBytesCount, key) {\n flushController.notifyBeforeAddMessage(estimatedMessageBytesCount)\n\n if (key !== undefined) {\n upsertBuffer[key] = serializedMessage\n flushController.notifyAfterAddMessage()\n } else {\n encoder.write(\n getMessageText([serializedMessage], encoder.isEmpty()),\n function (realMessageBytesCount) {\n flushController.notifyAfterAddMessage(\n realMessageBytesCount - estimatedMessageBytesCount\n )\n }\n )\n }\n }\n\n function hasMessageFor(key) {\n return key !== undefined && upsertBuffer[key] !== undefined\n }\n\n function remove(key) {\n var removedMessage = upsertBuffer[key]\n delete upsertBuffer[key]\n var messageBytesCount = encoder.estimateEncodedBytesCount(removedMessage)\n flushController.notifyAfterRemoveMessage(messageBytesCount)\n }\n function process(message) {\n var processedMessage = ''\n if (sendContentTypeByJson) {\n processedMessage = jsonStringify(\n processedMessageByDataMap(message).rowData\n )\n } else {\n processedMessage = processedMessageByDataMap(message).rowStr\n }\n return processedMessage\n }\n function addOrUpdate(message, key) {\n const serializedMessage = process(message)\n\n const estimatedMessageBytesCount =\n encoder.estimateEncodedBytesCount(serializedMessage)\n\n if (estimatedMessageBytesCount >= messageBytesLimit) {\n display.warn(\n `Discarded a message whose size was bigger than the maximum allowed size ${messageBytesLimit}KB.`\n )\n return\n }\n\n if (hasMessageFor(key)) {\n remove(key)\n }\n\n push(serializedMessage, estimatedMessageBytesCount, key)\n }\n\n function flush(event) {\n var upsertMessages = values(upsertBuffer).join(\n sendContentTypeByJson ? ',' : '\\n'\n )\n upsertBuffer = {}\n\n var isPageExit = isPageExitReason(event.reason)\n var send = isPageExit ? request.sendOnExit : request.send\n\n if (\n isPageExit &&\n // Note: checking that the encoder is async is not strictly needed, but it's an optimization:\n // if the encoder is async we need to send two requests in some cases (one for encoded data\n // and the other for non-encoded data). But if it's not async, we don't have to worry about\n // it and always send a single request.\n encoder.isAsync\n ) {\n var encoderResult = encoder.finishSync()\n\n // Send encoded messages\n if (encoderResult.outputBytesCount) {\n send(formatPayloadFromEncoder(encoderResult, sendContentTypeByJson))\n }\n\n // Send messages that are not yet encoded at this point\n var pendingMessages = [encoderResult.pendingData, upsertMessages]\n .filter(Boolean)\n .join('\\n')\n\n if (pendingMessages) {\n send({\n data: pendingMessages,\n bytesCount: computeBytesCount(pendingMessages)\n })\n }\n } else {\n if (upsertMessages) {\n var text = getMessageText([upsertMessages], encoder.isEmpty())\n if (sendContentTypeByJson) {\n text += ']'\n }\n encoder.write(text)\n } else {\n if (sendContentTypeByJson) {\n encoder.write(']')\n }\n }\n encoder.finish(function (encoderResult) {\n send(formatPayloadFromEncoder(encoderResult))\n })\n }\n }\n\n return {\n flushController: flushController,\n add: addOrUpdate,\n upsert: addOrUpdate,\n stop: flushSubscription.unsubscribe\n }\n}\n\nfunction formatPayloadFromEncoder(encoderResult, sendContentTypeByJson) {\n var data\n if (typeof encoderResult.output === 'string') {\n data = encoderResult.output\n } else {\n data = new Blob([encoderResult.output], {\n // This will set the 'Content-Type: text/plain' header. Reasoning:\n // * The intake rejects the request if there is no content type.\n // * The browser will issue CORS preflight requests if we set it to 'application/json', which\n // could induce higher intake load (and maybe has other impacts).\n // * Also it's not quite JSON, since we are concatenating multiple JSON objects separated by\n // new lines.\n type: 'text/plain'\n })\n }\n\n return {\n data: data,\n type: sendContentTypeByJson ? 'application/json;UTF-8' : undefined,\n bytesCount: encoderResult.outputBytesCount,\n encoding: encoderResult.encoding\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAWA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;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AAe;IAChCmD,GAAG,EAAEzB,WAAW;IAChB0B,MAAM,EAAE1B,WAAW;IACnB2B,IAAI,EAAEnD,iBAAiB,CAACoD;EAC1B,CAAC;AACH;AAEA,SAASb,wBAAwBA,CAACH,aAAa,EAAEvC,qBAAqB,EAAE;EACtE,IAAI+C,IAAI;EACR,IAAI,OAAOR,aAAa,CAACiB,MAAM,KAAK,QAAQ,EAAE;IAC5CT,IAAI,GAAGR,aAAa,CAACiB,MAAM;EAC7B,CAAC,MAAM;IACLT,IAAI,GAAG,IAAIU,IAAI,CAAC,CAAClB,aAAa,CAACiB,MAAM,CAAC,EAAE;MACtC;MACA;MACA;MACA;MACA;MACA;MACAtG,IAAI,EAAE;IACR,CAAC,CAAC;EACJ;EAEA,OAAO;IACL6F,IAAI,EAAEA,IAAI;IACV7F,IAAI,EAAE8C,qBAAqB,GAAG,wBAAwB,GAAG3C,SAAS;IAClE2F,UAAU,EAAET,aAAa,CAACE,gBAAgB;IAC1CiB,QAAQ,EAAEnB,aAAa,CAACmB;EAC1B,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"batch.js","names":["_display","require","_tools","_rowData","_dataMap","_enums","_byteUtils","_pageExitObservable","_jsonStringify","_toConsumableArray","r","_arrayWithoutHoles","_iterableToArray","_unsupportedIterableToArray","_nonIterableSpread","TypeError","a","_arrayLikeToArray","t","toString","call","slice","constructor","name","Array","from","test","Symbol","iterator","isArray","length","e","n","CUSTOM_KEYS","processedMessageByDataMap","exports","message","type","rowStr","rowData","undefined","tags","fields","hasFileds","each","dataMap","value","key","measurement","tagsStr","extend","commonTags","filterFileds","value_path","_key","_value","findByPath","push","isNumber","escapeJsonValue","escapeRowData","fieldsStr","commonFields","_valueData","escapeRowField","isString","context","isObject","isEmptyObject","_tagKeys","indexOf","RumEventType","LOGGER","join","date","time","createBatch","options","encoder","request","messageBytesLimit","sendContentTypeByJson","flushController","upsertBuffer","flushSubscription","flushObservable","subscribe","event","flush","getMessageText","messages","isEmpty","arguments","serializedMessage","estimatedMessageBytesCount","notifyBeforeAddMessage","notifyAfterAddMessage","write","realMessageBytesCount","hasMessageFor","remove","removedMessage","messageBytesCount","estimateEncodedBytesCount","notifyAfterRemoveMessage","process","processedMessage","jsonStringify","addOrUpdate","display","warn","concat","upsertMessages","values","isPageExit","isPageExitReason","reason","send","sendOnExit","isAsync","encoderResult","finishSync","outputBytesCount","formatPayloadFromEncoder","pendingMessages","pendingData","filter","Boolean","data","bytesCount","computeBytesCount","text","finish","add","upsert","stop","unsubscribe","output","Blob","encoding"],"sources":["../../src/transport/batch.js"],"sourcesContent":["import { display } from '../helper/display'\nimport {\n values,\n findByPath,\n each,\n isNumber,\n isArray,\n extend,\n isString,\n isEmptyObject,\n isObject\n} from '../helper/tools'\nimport {\n escapeJsonValue,\n escapeRowField,\n escapeRowData\n} from '../helper/serialisation/rowData'\nimport { commonTags, dataMap, commonFields } from '../dataMap'\nimport { RumEventType } from '../helper/enums'\nimport { computeBytesCount } from '../helper/byteUtils'\nimport { isPageExitReason } from '../browser/pageExitObservable'\nimport { jsonStringify } from '../helper/serialisation/jsonStringify'\n// https://en.wikipedia.org/wiki/UTF-8\n// eslint-disable-next-line no-control-regex\nvar CUSTOM_KEYS = 'custom_keys'\nexport var processedMessageByDataMap = function (message) {\n if (!message || !message.type)\n return {\n rowStr: '',\n rowData: undefined\n }\n\n var rowData = { tags: {}, fields: {} }\n var hasFileds = false\n var rowStr = ''\n each(dataMap, function (value, key) {\n if (value.type === message.type) {\n rowStr += key + ','\n rowData.measurement = key\n var tagsStr = []\n var tags = extend({}, commonTags, value.tags)\n var filterFileds = ['date', 'type', CUSTOM_KEYS]\n each(tags, function (value_path, _key) {\n var _value = findByPath(message, value_path)\n filterFileds.push(_key)\n if (_value || isNumber(_value)) {\n rowData.tags[_key] = escapeJsonValue(_value, true)\n tagsStr.push(escapeRowData(_key) + '=' + escapeRowData(_value))\n }\n })\n\n var fieldsStr = []\n var fields = extend({}, commonFields, value.fields)\n each(fields, function (_value, _key) {\n if (isArray(_value) && _value.length === 2) {\n var value_path = _value[1]\n var _valueData = findByPath(message, value_path)\n filterFileds.push(_key)\n if (_valueData !== undefined && _valueData !== null) {\n rowData.fields[_key] = escapeJsonValue(_valueData)\n fieldsStr.push(\n escapeRowData(_key) + '=' + escapeRowField(_valueData)\n )\n }\n } else if (isString(_value)) {\n var _valueData = findByPath(message, _value)\n filterFileds.push(_key)\n if (_valueData !== undefined && _valueData !== null) {\n rowData.fields[_key] = escapeJsonValue(_valueData)\n fieldsStr.push(\n escapeRowData(_key) + '=' + escapeRowField(_valueData)\n )\n }\n }\n })\n if (\n message.context &&\n isObject(message.context) &&\n !isEmptyObject(message.context)\n ) {\n var _tagKeys = []\n each(message.context, function (_value, _key) {\n if (filterFileds.indexOf(_key) > -1) return\n filterFileds.push(_key)\n if (_value !== undefined && _value !== null) {\n _tagKeys.push(_key)\n rowData.fields[_key] = escapeJsonValue(_value)\n fieldsStr.push(escapeRowData(_key) + '=' + escapeRowField(_value))\n }\n })\n if (_tagKeys.length) {\n rowData.fields[CUSTOM_KEYS] = escapeJsonValue(_tagKeys)\n fieldsStr.push(\n escapeRowData(CUSTOM_KEYS) + '=' + escapeRowField(_tagKeys)\n )\n }\n }\n if (message.type === RumEventType.LOGGER) {\n each(message, function (value, key) {\n if (\n filterFileds.indexOf(key) === -1 &&\n value !== undefined &&\n value !== null\n ) {\n rowData.fields[key] = escapeJsonValue(value)\n fieldsStr.push(escapeRowData(key) + '=' + escapeRowField(value))\n }\n })\n }\n if (tagsStr.length) {\n rowStr += tagsStr.join(',')\n }\n if (fieldsStr.length) {\n rowStr += ' '\n rowStr += fieldsStr.join(',')\n hasFileds = true\n }\n rowStr = rowStr + ' ' + message.date\n rowData.time = message.date\n }\n })\n return {\n rowStr: hasFileds ? rowStr : '',\n rowData: hasFileds ? rowData : undefined\n }\n}\n\nexport function createBatch(options) {\n var encoder = options.encoder\n var request = options.request\n var messageBytesLimit = options.messageBytesLimit\n var sendContentTypeByJson = options.sendContentTypeByJson\n var flushController = options.flushController\n var upsertBuffer = {}\n var flushSubscription = flushController.flushObservable.subscribe(function (\n event\n ) {\n flush(event)\n })\n function getMessageText(messages, isEmpty = false) {\n if (sendContentTypeByJson) {\n if (isEmpty) {\n return '[' + messages.join(',')\n } else {\n return ',' + messages.join(',')\n }\n } else {\n if (isEmpty) {\n return messages.join('\\n')\n } else {\n return '\\n' + messages.join('\\n')\n }\n }\n }\n function push(serializedMessage, estimatedMessageBytesCount, key) {\n flushController.notifyBeforeAddMessage(estimatedMessageBytesCount)\n\n if (key !== undefined) {\n upsertBuffer[key] = serializedMessage\n flushController.notifyAfterAddMessage()\n } else {\n encoder.write(\n getMessageText([serializedMessage], encoder.isEmpty()),\n function (realMessageBytesCount) {\n flushController.notifyAfterAddMessage(\n realMessageBytesCount - estimatedMessageBytesCount\n )\n }\n )\n }\n }\n\n function hasMessageFor(key) {\n return key !== undefined && upsertBuffer[key] !== undefined\n }\n\n function remove(key) {\n var removedMessage = upsertBuffer[key]\n delete upsertBuffer[key]\n var messageBytesCount = encoder.estimateEncodedBytesCount(removedMessage)\n flushController.notifyAfterRemoveMessage(messageBytesCount)\n }\n function process(message) {\n var processedMessage = ''\n if (sendContentTypeByJson) {\n processedMessage = jsonStringify(\n processedMessageByDataMap(message).rowData\n )\n } else {\n processedMessage = processedMessageByDataMap(message).rowStr\n }\n return processedMessage\n }\n function addOrUpdate(message, key) {\n const serializedMessage = process(message)\n\n const estimatedMessageBytesCount =\n encoder.estimateEncodedBytesCount(serializedMessage)\n\n if (estimatedMessageBytesCount >= messageBytesLimit) {\n display.warn(\n `Discarded a message whose size was bigger than the maximum allowed size ${messageBytesLimit}KB.`\n )\n return\n }\n\n if (hasMessageFor(key)) {\n remove(key)\n }\n\n push(serializedMessage, estimatedMessageBytesCount, key)\n }\n\n function flush(event) {\n var upsertMessages = values(upsertBuffer).join(\n sendContentTypeByJson ? ',' : '\\n'\n )\n upsertBuffer = {}\n\n var isPageExit = isPageExitReason(event.reason)\n var send = isPageExit ? request.sendOnExit : request.send\n\n if (\n isPageExit &&\n // Note: checking that the encoder is async is not strictly needed, but it's an optimization:\n // if the encoder is async we need to send two requests in some cases (one for encoded data\n // and the other for non-encoded data). But if it's not async, we don't have to worry about\n // it and always send a single request.\n encoder.isAsync\n ) {\n var encoderResult = encoder.finishSync()\n\n // Send encoded messages\n if (encoderResult.outputBytesCount) {\n send(formatPayloadFromEncoder(encoderResult, sendContentTypeByJson))\n }\n // Send messages that are not yet encoded at this point\n var pendingMessages = [...encoderResult.pendingData, upsertMessages]\n .filter(Boolean)\n .join('\\n')\n\n if (pendingMessages) {\n send({\n data: pendingMessages,\n bytesCount: computeBytesCount(pendingMessages)\n })\n }\n } else {\n if (upsertMessages) {\n var text = getMessageText([upsertMessages], encoder.isEmpty())\n if (sendContentTypeByJson) {\n text += ']'\n }\n encoder.write(text)\n } else {\n if (sendContentTypeByJson) {\n encoder.write(']')\n }\n }\n encoder.finish(function (encoderResult) {\n send(formatPayloadFromEncoder(encoderResult))\n })\n }\n }\n\n return {\n flushController: flushController,\n add: addOrUpdate,\n upsert: addOrUpdate,\n stop: flushSubscription.unsubscribe\n }\n}\n\nfunction formatPayloadFromEncoder(encoderResult, sendContentTypeByJson) {\n var data\n if (typeof encoderResult.output === 'string') {\n data = encoderResult.output\n } else {\n data = new Blob([encoderResult.output], {\n // This will set the 'Content-Type: text/plain' header. Reasoning:\n // * The intake rejects the request if there is no content type.\n // * The browser will issue CORS preflight requests if we set it to 'application/json', which\n // could induce higher intake load (and maybe has other impacts).\n // * Also it's not quite JSON, since we are concatenating multiple JSON objects separated by\n // new lines.\n type: 'text/plain'\n })\n }\n\n return {\n data: data,\n type: sendContentTypeByJson ? 'application/json;UTF-8' : undefined,\n bytesCount: encoderResult.outputBytesCount,\n encoding: encoderResult.encoding\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAWA,IAA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CAAC;MAC/C,CAAC,CAAC;IACJ;EACF;EAEA,OAAO;IACLtC,eAAe,EAAEA,eAAe;IAChCmD,GAAG,EAAEzB,WAAW;IAChB0B,MAAM,EAAE1B,WAAW;IACnB2B,IAAI,EAAEnD,iBAAiB,CAACoD;EAC1B,CAAC;AACH;AAEA,SAASb,wBAAwBA,CAACH,aAAa,EAAEvC,qBAAqB,EAAE;EACtE,IAAI+C,IAAI;EACR,IAAI,OAAOR,aAAa,CAACiB,MAAM,KAAK,QAAQ,EAAE;IAC5CT,IAAI,GAAGR,aAAa,CAACiB,MAAM;EAC7B,CAAC,MAAM;IACLT,IAAI,GAAG,IAAIU,IAAI,CAAC,CAAClB,aAAa,CAACiB,MAAM,CAAC,EAAE;MACtC;MACA;MACA;MACA;MACA;MACA;MACApG,IAAI,EAAE;IACR,CAAC,CAAC;EACJ;EAEA,OAAO;IACL2F,IAAI,EAAEA,IAAI;IACV3F,IAAI,EAAE4C,qBAAqB,GAAG,wBAAwB,GAAGzC,SAAS;IAClEyF,UAAU,EAAET,aAAa,CAACE,gBAAgB;IAC1CiB,QAAQ,EAAEnB,aAAa,CAACmB;EAC1B,CAAC;AACH","ignoreList":[]}
@@ -90,11 +90,13 @@ function fetchKeepAliveStrategy(endpointUrl, bytesLimit, payload, onResponse) {
90
90
  keepalive: true,
91
91
  mode: 'cors'
92
92
  };
93
+ var headers = {
94
+ 'x-client-timestamp': Date.now().toString()
95
+ };
93
96
  if (payload.type) {
94
- fetchOption.headers = {
95
- 'Content-Type': payload.type
96
- };
97
+ headers['Content-Type'] = payload.type;
97
98
  }
99
+ fetchOption.headers = headers;
98
100
  fetch(url, fetchOption).then((0, _monitor.monitor)(function (response) {
99
101
  if (typeof onResponse === 'function') {
100
102
  onResponse({
@@ -102,9 +104,8 @@ function fetchKeepAliveStrategy(endpointUrl, bytesLimit, payload, onResponse) {
102
104
  type: response.type
103
105
  });
104
106
  }
105
- }), (0, _monitor.monitor)(function () {
106
- // failed to queue the request
107
- sendXHR(url, payload, onResponse);
107
+ }))["catch"]((0, _monitor.monitor)(function () {
108
+ fetchStrategy(url, payload, onResponse);
108
109
  }));
109
110
  } else {
110
111
  sendXHR(url, payload, onResponse);
@@ -127,6 +128,7 @@ function sendXHR(url, payload, onResponse) {
127
128
  } else if (payload.type) {
128
129
  request.setRequestHeader('Content-Type', payload.type);
129
130
  }
131
+ request.setRequestHeader('x-client-timestamp', Date.now().toString());
130
132
  (0, _addEventListener.addEventListener)(request, 'loadend', function () {
131
133
  if (typeof onResponse === 'function') {
132
134
  onResponse({
@@ -138,4 +140,33 @@ function sendXHR(url, payload, onResponse) {
138
140
  });
139
141
  request.send(data);
140
142
  }
143
+ function fetchStrategy(url, payload, onResponse) {
144
+ var fetchOption = {
145
+ method: 'POST',
146
+ body: payload.data,
147
+ keepalive: true,
148
+ mode: 'cors'
149
+ };
150
+ var headers = {
151
+ 'x-client-timestamp': Date.now().toString()
152
+ };
153
+ if (payload.type) {
154
+ headers['Content-Type'] = payload.type;
155
+ }
156
+ fetchOption.headers = headers;
157
+ fetch(url, fetchOption).then((0, _monitor.monitor)(function (response) {
158
+ if (typeof onResponse === 'function') {
159
+ onResponse({
160
+ status: response.status,
161
+ type: response.type
162
+ });
163
+ }
164
+ }))["catch"]((0, _monitor.monitor)(function () {
165
+ if (typeof onResponse === 'function') {
166
+ onResponse({
167
+ status: 0
168
+ });
169
+ }
170
+ }));
171
+ }
141
172
  //# sourceMappingURL=httpRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"httpRequest.js","names":["_sendWithRetryStrategy","require","_addEventListener","_monitor","_telemetry","addBatchPrecision","url","encoding","indexOf","createHttpRequest","endpointUrl","bytesLimit","retryMaxSize","reportError","undefined","retryState","newRetryState","sendStrategyForRetry","payload","onResponse","fetchKeepAliveStrategy","send","sendWithRetryStrategy","sendOnExit","sendBeaconStrategy","data","bytesCount","canUseBeacon","navigator","sendBeacon","beaconData","type","Blob","isQueued","e","reportBeaconError","sendXHR","hasReportedBeaconError","addTelemetryError","canUseKeepAlive","isKeepAliveSupported","fetchOption","method","body","keepalive","mode","headers","fetch","then","monitor","response","status","window","Request","_unused","request","XMLHttpRequest","open","setRequestHeader","addEventListener","once"],"sources":["../../src/transport/httpRequest.js"],"sourcesContent":["import { newRetryState, sendWithRetryStrategy } from './sendWithRetryStrategy'\nimport { addEventListener } from '../browser/addEventListener'\nimport { monitor } from '../helper/monitor'\nimport { addTelemetryError } from '../telemetry/telemetry'\n/**\n * Use POST request without content type to:\n * - avoid CORS preflight requests\n * - allow usage of sendBeacon\n *\n * multiple elements are sent separated by \\n in order\n * to be parsed correctly without content type header\n */\nfunction addBatchPrecision(url, encoding) {\n if (!url) return url\n url = url + (url.indexOf('?') === -1 ? '?' : '&') + 'precision=ms'\n if (encoding) {\n url = url + '&encoding=' + encoding\n }\n return url\n}\nexport function createHttpRequest(\n endpointUrl,\n bytesLimit,\n retryMaxSize,\n reportError\n) {\n if (retryMaxSize === undefined) {\n retryMaxSize = -1\n }\n var retryState = newRetryState(retryMaxSize)\n var sendStrategyForRetry = function (payload, onResponse) {\n return fetchKeepAliveStrategy(endpointUrl, bytesLimit, payload, onResponse)\n }\n\n return {\n send: function (payload) {\n sendWithRetryStrategy(\n payload,\n retryState,\n sendStrategyForRetry,\n endpointUrl,\n reportError\n )\n },\n /**\n * Since fetch keepalive behaves like regular fetch on Firefox,\n * keep using sendBeaconStrategy on exit\n */\n sendOnExit: function (payload) {\n sendBeaconStrategy(endpointUrl, bytesLimit, payload)\n }\n }\n}\n\nfunction sendBeaconStrategy(endpointUrl, bytesLimit, payload) {\n var data = payload.data\n var bytesCount = payload.bytesCount\n var url = addBatchPrecision(endpointUrl, payload.encoding)\n var canUseBeacon = !!navigator.sendBeacon && bytesCount < bytesLimit\n if (canUseBeacon) {\n try {\n var beaconData\n if (payload.type) {\n beaconData = new Blob([data], {\n type: payload.type\n })\n } else {\n beaconData = data\n }\n\n var isQueued = navigator.sendBeacon(url, beaconData)\n\n if (isQueued) {\n return\n }\n } catch (e) {\n reportBeaconError(e)\n }\n }\n sendXHR(url, payload)\n}\nvar hasReportedBeaconError = false\n\nfunction reportBeaconError(e) {\n if (!hasReportedBeaconError) {\n hasReportedBeaconError = true\n addTelemetryError(e)\n }\n}\nexport function fetchKeepAliveStrategy(\n endpointUrl,\n bytesLimit,\n payload,\n onResponse\n) {\n var data = payload.data\n var bytesCount = payload.bytesCount\n var url = addBatchPrecision(endpointUrl, payload.encoding)\n var canUseKeepAlive = isKeepAliveSupported() && bytesCount < bytesLimit\n if (canUseKeepAlive) {\n var fetchOption = {\n method: 'POST',\n body: data,\n keepalive: true,\n mode: 'cors'\n }\n if (payload.type) {\n fetchOption.headers = {\n 'Content-Type': payload.type\n }\n }\n fetch(url, fetchOption).then(\n monitor(function (response) {\n if (typeof onResponse === 'function') {\n onResponse({ status: response.status, type: response.type })\n }\n }),\n monitor(function () {\n // failed to queue the request\n sendXHR(url, payload, onResponse)\n })\n )\n } else {\n sendXHR(url, payload, onResponse)\n }\n}\n\nfunction isKeepAliveSupported() {\n // Request can throw, cf https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#errors\n try {\n return window.Request && 'keepalive' in new Request('http://a')\n } catch {\n return false\n }\n}\n\nfunction sendXHR(url, payload, onResponse) {\n const data = payload.data\n const request = new XMLHttpRequest()\n request.open('POST', url, true)\n if (data instanceof Blob) {\n request.setRequestHeader('Content-Type', data.type)\n } else if (payload.type) {\n request.setRequestHeader('Content-Type', payload.type)\n }\n\n addEventListener(\n request,\n 'loadend',\n function () {\n if (typeof onResponse === 'function') {\n onResponse({ status: request.status })\n }\n },\n {\n once: true\n }\n )\n request.send(data)\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,iBAAiBA,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AAO,CAACa,IAAI,EAAE;IACvBwB,OAAO,CAACG,gBAAgB,CAAC,cAAc,EAAExC,OAAO,CAACa,IAAI,CAAC;EACxD;EAEA,IAAA4B,kCAAgB,EACdJ,OAAO,EACP,SAAS,EACT,YAAY;IACV,IAAI,OAAOpC,UAAU,KAAK,UAAU,EAAE;MACpCA,UAAU,CAAC;QAAEgC,MAAM,EAAEI,OAAO,CAACJ;MAAO,CAAC,CAAC;IACxC;EACF,CAAC,EACD;IACES,IAAI,EAAE;EACR,CACF,CAAC;EACDL,OAAO,CAAClC,IAAI,CAACI,IAAI,CAAC;AACpB","ignoreList":[]}
1
+ {"version":3,"file":"httpRequest.js","names":["_sendWithRetryStrategy","require","_addEventListener","_monitor","_telemetry","addBatchPrecision","url","encoding","indexOf","createHttpRequest","endpointUrl","bytesLimit","retryMaxSize","reportError","undefined","retryState","newRetryState","sendStrategyForRetry","payload","onResponse","fetchKeepAliveStrategy","send","sendWithRetryStrategy","sendOnExit","sendBeaconStrategy","data","bytesCount","canUseBeacon","navigator","sendBeacon","beaconData","type","Blob","isQueued","e","reportBeaconError","sendXHR","hasReportedBeaconError","addTelemetryError","canUseKeepAlive","isKeepAliveSupported","fetchOption","method","body","keepalive","mode","headers","Date","now","toString","fetch","then","monitor","response","status","fetchStrategy","window","Request","_unused","request","XMLHttpRequest","open","setRequestHeader","addEventListener","once"],"sources":["../../src/transport/httpRequest.js"],"sourcesContent":["import { newRetryState, sendWithRetryStrategy } from './sendWithRetryStrategy'\nimport { addEventListener } from '../browser/addEventListener'\nimport { monitor } from '../helper/monitor'\nimport { addTelemetryError } from '../telemetry/telemetry'\n/**\n * Use POST request without content type to:\n * - avoid CORS preflight requests\n * - allow usage of sendBeacon\n *\n * multiple elements are sent separated by \\n in order\n * to be parsed correctly without content type header\n */\nfunction addBatchPrecision(url, encoding) {\n if (!url) return url\n url = url + (url.indexOf('?') === -1 ? '?' : '&') + 'precision=ms'\n if (encoding) {\n url = url + '&encoding=' + encoding\n }\n return url\n}\nexport function createHttpRequest(\n endpointUrl,\n bytesLimit,\n retryMaxSize,\n reportError\n) {\n if (retryMaxSize === undefined) {\n retryMaxSize = -1\n }\n var retryState = newRetryState(retryMaxSize)\n var sendStrategyForRetry = function (payload, onResponse) {\n return fetchKeepAliveStrategy(endpointUrl, bytesLimit, payload, onResponse)\n }\n\n return {\n send: function (payload) {\n sendWithRetryStrategy(\n payload,\n retryState,\n sendStrategyForRetry,\n endpointUrl,\n reportError\n )\n },\n /**\n * Since fetch keepalive behaves like regular fetch on Firefox,\n * keep using sendBeaconStrategy on exit\n */\n sendOnExit: function (payload) {\n sendBeaconStrategy(endpointUrl, bytesLimit, payload)\n }\n }\n}\n\nfunction sendBeaconStrategy(endpointUrl, bytesLimit, payload) {\n var data = payload.data\n var bytesCount = payload.bytesCount\n var url = addBatchPrecision(endpointUrl, payload.encoding)\n var canUseBeacon = !!navigator.sendBeacon && bytesCount < bytesLimit\n if (canUseBeacon) {\n try {\n var beaconData\n if (payload.type) {\n beaconData = new Blob([data], {\n type: payload.type\n })\n } else {\n beaconData = data\n }\n\n var isQueued = navigator.sendBeacon(url, beaconData)\n\n if (isQueued) {\n return\n }\n } catch (e) {\n reportBeaconError(e)\n }\n }\n sendXHR(url, payload)\n}\nvar hasReportedBeaconError = false\n\nfunction reportBeaconError(e) {\n if (!hasReportedBeaconError) {\n hasReportedBeaconError = true\n addTelemetryError(e)\n }\n}\nexport function fetchKeepAliveStrategy(\n endpointUrl,\n bytesLimit,\n payload,\n onResponse\n) {\n var data = payload.data\n var bytesCount = payload.bytesCount\n var url = addBatchPrecision(endpointUrl, payload.encoding)\n var canUseKeepAlive = isKeepAliveSupported() && bytesCount < bytesLimit\n if (canUseKeepAlive) {\n var fetchOption = {\n method: 'POST',\n body: data,\n keepalive: true,\n mode: 'cors'\n }\n const headers = {\n 'x-client-timestamp': Date.now().toString()\n }\n\n if (payload.type) {\n headers['Content-Type'] = payload.type\n }\n\n fetchOption.headers = headers\n fetch(url, fetchOption)\n .then(\n monitor(function (response) {\n if (typeof onResponse === 'function') {\n onResponse({ status: response.status, type: response.type })\n }\n })\n )\n .catch(\n monitor(function () {\n fetchStrategy(url, payload, onResponse)\n })\n )\n } else {\n sendXHR(url, payload, onResponse)\n }\n}\n\nfunction isKeepAliveSupported() {\n // Request can throw, cf https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#errors\n try {\n return window.Request && 'keepalive' in new Request('http://a')\n } catch {\n return false\n }\n}\n\nfunction sendXHR(url, payload, onResponse) {\n const data = payload.data\n const request = new XMLHttpRequest()\n request.open('POST', url, true)\n if (data instanceof Blob) {\n request.setRequestHeader('Content-Type', data.type)\n } else if (payload.type) {\n request.setRequestHeader('Content-Type', payload.type)\n }\n request.setRequestHeader('x-client-timestamp', Date.now().toString())\n addEventListener(\n request,\n 'loadend',\n function () {\n if (typeof onResponse === 'function') {\n onResponse({ status: request.status })\n }\n },\n {\n once: true\n }\n )\n request.send(data)\n}\nfunction fetchStrategy(url, payload, onResponse) {\n const fetchOption = {\n method: 'POST',\n body: payload.data,\n keepalive: true,\n mode: 'cors'\n }\n const headers = {\n 'x-client-timestamp': Date.now().toString()\n }\n if (payload.type) {\n headers['Content-Type'] = payload.type\n }\n fetchOption.headers = headers\n\n fetch(url, fetchOption)\n .then(\n monitor(function (response) {\n if (typeof onResponse === 'function') {\n onResponse({ status: response.status, type: response.type })\n }\n })\n )\n .catch(\n monitor(function () {\n if (typeof onResponse === 'function') {\n onResponse({ status: 0 })\n }\n })\n )\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,iBAAiBA,CAACC,GAAG,EAAEC,QAAQ,EAAE;EACxC,IAAI,CAACD,GAAG,EAAE,OAAOA,GAAG;EACpBA,GAAG,GA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CAACtB;MAAK,CAAC,CAAC;IAC9D;EACF,CAAC,CACH,CAAC,SACK,CACJ,IAAAqB,gBAAO,EAAC,YAAY;IAClB,IAAI,OAAOjC,UAAU,KAAK,UAAU,EAAE;MACpCA,UAAU,CAAC;QAAEmC,MAAM,EAAE;MAAE,CAAC,CAAC;IAC3B;EACF,CAAC,CACH,CAAC;AACL","ignoreList":[]}
package/esm/dataMap.js CHANGED
@@ -56,6 +56,7 @@ export var dataMap = {
56
56
  view_privacy_replay_level: 'privacy.replay_level'
57
57
  },
58
58
  fields: {
59
+ view_update_time: '_gc.view_update_time',
59
60
  sampled_for_replay: 'session.sampled_for_replay',
60
61
  sampled_for_error_replay: 'session.sampled_for_error_replay',
61
62
  sampled_for_error_session: 'session.sampled_for_error_session',
@@ -1 +1 @@
1
- {"version":3,"file":"dataMap.js","names":["RumEventType","commonTags","sdk_name","sdk_version","app_id","env","service","version","source","userid","user_email","user_name","session_id","session_type","session_sampling","is_signin","os","os_version","os_version_major","browser","browser_version","browser_version_major","screen_size","network_type","time_zone","device","view_id","view_referrer","view_url","view_host","view_path","view_name","view_path_group","commonFields","view_url_query","action_id","action_ids","view_in_foreground","display","session_has_replay","is_login","page_states","session_sample_rate","session_replay_sample_rate","session_on_error_sample_rate","session_replay_on_error_sample_rate","drift","dataMap","view","type","VIEW","tags","view_loading_type","view_apdex_level","view_privacy_replay_level","fields","sampled_for_replay","sampled_for_error_replay","sampled_for_error_session","session_error_timestamp","is_active","session_replay_stats","session_is_active","view_error_count","view_resource_count","view_long_task_count","view_action_count","first_contentful_paint","largest_contentful_paint","largest_contentful_paint_element_selector","cumulative_layout_shift","cumulative_layout_shift_time","cumulative_layout_shift_target_selector","first_input_delay","loading_time","dom_interactive","dom_content_loaded","dom_complete","load_event","first_input_time","first_input_target_selector","first_paint_time","interaction_to_next_paint","interaction_to_next_paint_target_selector","resource_load_time","time_to_interactive","dom","dom_ready","time_spent","first_byte","frustration_count","custom_timings","resource","RESOURCE","trace_id","span_id","resource_id","resource_status","resource_status_group","resource_method","duration","resource_size","resource_url","resource_url_host","resource_url_path","resource_url_path_group","resource_url_query","resource_delivery_type","resource_type","resource_protocol","resource_encode_size","resource_decode_size","resource_transfer_size","resource_render_blocking_status","resource_dns","resource_tcp","resource_ssl","resource_ttfb","resource_trans","resource_redirect","resource_first_byte","resource_dns_time","resource_download_time","resource_first_byte_time","resource_connect_time","resource_ssl_time","resource_redirect_time","error","ERROR","error_id","error_source","error_type","error_handling","error_message","error_stack","error_causes","error_handling_stack","long_task","LONG_TASK","long_task_id","blocking_duration","first_ui_event_timestamp","render_start","style_and_layout_start","long_task_start_time","scripts","action","ACTION","action_type","action_name","action_error_count","action_resource_count","action_frustration_types","action_long_task_count","action_target","action_position","telemetry","status","message","error_kind","connectivity","runtime_env","usage","configuration","browser_log","LOGGER","error_resource_url","error_resource_url_host","error_resource_url_path","error_resource_url_path_group","error_resource_status","error_resource_status_group","error_resource_method"],"sources":["../src/dataMap.js"],"sourcesContent":["import { RumEventType } from './helper/enums'\nexport var commonTags = {\n sdk_name: '_gc.sdk_name',\n sdk_version: '_gc.sdk_version',\n app_id: 'application.id',\n env: 'env',\n service: 'service',\n version: 'version',\n source: 'source',\n userid: 'user.id',\n user_email: 'user.email',\n user_name: 'user.name',\n session_id: 'session.id',\n session_type: 'session.type',\n session_sampling: 'session.is_sampling',\n is_signin: 'user.is_signin',\n os: 'device.os',\n os_version: 'device.os_version',\n os_version_major: 'device.os_version_major',\n browser: 'device.browser',\n browser_version: 'device.browser_version',\n browser_version_major: 'device.browser_version_major',\n screen_size: 'device.screen_size',\n network_type: 'device.network_type',\n time_zone: 'device.time_zone',\n device: 'device.device',\n view_id: 'view.id',\n view_referrer: 'view.referrer',\n view_url: 'view.url',\n view_host: 'view.host',\n view_path: 'view.path',\n view_name: 'view.name',\n view_path_group: 'view.path_group'\n}\nexport var commonFields = {\n view_url_query: 'view.url_query',\n action_id: 'action.id',\n action_ids: 'action.ids',\n view_in_foreground: 'view.in_foreground',\n display: 'display',\n session_has_replay: 'session.has_replay',\n is_login: 'user.is_login',\n page_states: '_gc.page_states',\n session_sample_rate: '_gc.configuration.session_sample_rate',\n session_replay_sample_rate: '_gc.configuration.session_replay_sample_rate',\n session_on_error_sample_rate:\n '_gc.configuration.session_on_error_sample_rate',\n session_replay_on_error_sample_rate:\n '_gc.configuration.session_replay_on_error_sample_rate',\n drift: '_gc.drift'\n}\nexport var dataMap = {\n view: {\n type: RumEventType.VIEW,\n tags: {\n view_loading_type: 'view.loading_type',\n view_apdex_level: 'view.apdex_level',\n view_privacy_replay_level: 'privacy.replay_level'\n },\n fields: {\n sampled_for_replay: 'session.sampled_for_replay',\n sampled_for_error_replay: 'session.sampled_for_error_replay',\n sampled_for_error_session: 'session.sampled_for_error_session',\n session_error_timestamp: 'session.error_timestamp_for_session',\n is_active: 'view.is_active',\n session_replay_stats: '_gc.replay_stats',\n session_is_active: 'session.is_active',\n view_error_count: 'view.error.count',\n view_resource_count: 'view.resource.count',\n view_long_task_count: 'view.long_task.count',\n view_action_count: 'view.action.count',\n first_contentful_paint: 'view.first_contentful_paint',\n largest_contentful_paint: 'view.largest_contentful_paint',\n largest_contentful_paint_element_selector:\n 'view.largest_contentful_paint_element_selector',\n cumulative_layout_shift: 'view.cumulative_layout_shift',\n cumulative_layout_shift_time: 'view.cumulative_layout_shift_time',\n cumulative_layout_shift_target_selector:\n 'view.cumulative_layout_shift_target_selector',\n first_input_delay: 'view.first_input_delay',\n loading_time: 'view.loading_time',\n dom_interactive: 'view.dom_interactive',\n dom_content_loaded: 'view.dom_content_loaded',\n dom_complete: 'view.dom_complete',\n load_event: 'view.load_event',\n first_input_time: 'view.first_input_time',\n first_input_target_selector: 'view.first_input_target_selector',\n first_paint_time: 'view.fpt',\n interaction_to_next_paint: 'view.interaction_to_next_paint',\n interaction_to_next_paint_target_selector:\n 'view.interaction_to_next_paint_target_selector',\n resource_load_time: 'view.resource_load_time',\n time_to_interactive: 'view.tti',\n dom: 'view.dom',\n dom_ready: 'view.dom_ready',\n time_spent: 'view.time_spent',\n first_byte: 'view.first_byte',\n frustration_count: 'view.frustration.count',\n custom_timings: 'view.custom_timings'\n }\n },\n resource: {\n type: RumEventType.RESOURCE,\n tags: {\n trace_id: '_gc.trace_id',\n span_id: '_gc.span_id',\n resource_id: 'resource.id',\n resource_status: 'resource.status',\n resource_status_group: 'resource.status_group',\n resource_method: 'resource.method'\n },\n fields: {\n duration: 'resource.duration',\n resource_size: 'resource.size',\n resource_url: 'resource.url',\n resource_url_host: 'resource.url_host',\n resource_url_path: 'resource.url_path',\n resource_url_path_group: 'resource.url_path_group',\n resource_url_query: 'resource.url_query',\n resource_delivery_type: 'resource.delivery_type',\n resource_type: 'resource.type',\n resource_protocol: 'resource.protocol',\n resource_encode_size: 'resource.encoded_body_size',\n resource_decode_size: 'resource.decoded_body_size',\n resource_transfer_size: 'resource.transfer_size',\n resource_render_blocking_status: 'resource.render_blocking_status',\n resource_dns: 'resource.dns',\n resource_tcp: 'resource.tcp',\n resource_ssl: 'resource.ssl',\n resource_ttfb: 'resource.ttfb',\n resource_trans: 'resource.trans',\n resource_redirect: 'resource.redirect',\n resource_first_byte: 'resource.firstbyte',\n resource_dns_time: 'resource.dns_time',\n resource_download_time: 'resource.download_time',\n resource_first_byte_time: 'resource.first_byte_time',\n resource_connect_time: 'resource.connect_time',\n resource_ssl_time: 'resource.ssl_time',\n resource_redirect_time: 'resource.redirect_time'\n }\n },\n error: {\n type: RumEventType.ERROR,\n tags: {\n error_id: 'error.id',\n trace_id: '_gc.trace_id',\n span_id: '_gc.span_id',\n error_source: 'error.source',\n error_type: 'error.type',\n error_handling: 'error.handling'\n // resource_url: 'error.resource.url',\n // resource_url_host: 'error.resource.url_host',\n // resource_url_path: 'error.resource.url_path',\n // resource_url_path_group: 'error.resource.url_path_group',\n // resource_status: 'error.resource.status',\n // resource_status_group: 'error.resource.status_group',\n // resource_method: 'error.resource.method'\n },\n fields: {\n error_message: ['string', 'error.message'],\n error_stack: ['string', 'error.stack'],\n error_causes: ['string', 'error.causes'],\n error_handling_stack: ['string', 'error.handling_stack']\n }\n },\n long_task: {\n type: RumEventType.LONG_TASK,\n tags: {\n long_task_id: 'long_task.id'\n },\n fields: {\n duration: 'long_task.duration',\n blocking_duration: 'long_task.blocking_duration',\n first_ui_event_timestamp: 'long_task.first_ui_event_timestamp',\n render_start: 'long_task.render_start',\n style_and_layout_start: 'long_task.style_and_layout_start',\n long_task_start_time: 'long_task.start_time',\n scripts: ['string', 'long_task.scripts']\n }\n },\n action: {\n type: RumEventType.ACTION,\n tags: {\n action_type: 'action.type'\n },\n fields: {\n action_name: 'action.target.name',\n duration: 'action.loading_time',\n action_error_count: 'action.error.count',\n action_resource_count: 'action.resource.count',\n action_frustration_types: 'action.frustration.type',\n action_long_task_count: 'action.long_task.count',\n action_target: '_gc.action.target',\n action_position: '_gc.action.position'\n }\n },\n telemetry: {\n type: 'telemetry',\n fields: {\n status: 'telemetry.status',\n message: ['string', 'telemetry.message'],\n type: 'telemetry.type',\n error_stack: ['string', 'telemetry.error.stack'],\n error_kind: ['string', 'telemetry.error.kind'],\n connectivity: ['string', 'telemetry.connectivity'],\n runtime_env: ['string', 'telemetry.runtime_env'],\n usage: ['string', 'telemetry.usage'],\n configuration: ['string', 'telemetry.configuration']\n }\n },\n browser_log: {\n type: RumEventType.LOGGER,\n tags: {\n error_source: 'error.source',\n error_type: 'error.type',\n error_resource_url: 'http.url',\n error_resource_url_host: 'http.url_host',\n error_resource_url_path: 'http.url_path',\n error_resource_url_path_group: 'http.url_path_group',\n error_resource_status: 'http.status_code',\n error_resource_status_group: 'http.status_group',\n error_resource_method: 'http.method',\n action_id: 'user_action.id',\n service: 'service',\n status: 'status'\n },\n fields: {\n message: ['string', 'message'],\n error_message: ['string', 'error.message'],\n error_stack: ['string', 'error.stack']\n }\n }\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,OAAO,IAAIC,UAAU,GAAG;EACtBC,QAAQ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ACNsG,MAAM,EAAE,kBAAkB;MAC1BC,OAAO,EAAE,CAAC,QAAQ,EAAE,mBAAmB,CAAC;MACxC7G,IAAI,EAAE,gBAAgB;MACtBqF,WAAW,EAAE,CAAC,QAAQ,EAAE,uBAAuB,CAAC;MAChDyB,UAAU,EAAE,CAAC,QAAQ,EAAE,sBAAsB,CAAC;MAC9CC,YAAY,EAAE,CAAC,QAAQ,EAAE,wBAAwB,CAAC;MAClDC,WAAW,EAAE,CAAC,QAAQ,EAAE,uBAAuB,CAAC;MAChDC,KAAK,EAAE,CAAC,QAAQ,EAAE,iBAAiB,CAAC;MACpCC,aAAa,EAAE,CAAC,QAAQ,EAAE,yBAAyB;IACrD;EACF,CAAC;EACDC,WAAW,EAAE;IACXnH,IAAI,EAAEjD,YAAY,CAACqK,MAAM;IACzBlH,IAAI,EAAE;MACJ+E,YAAY,EAAE,cAAc;MAC5BC,UAAU,EAAE,YAAY;MACxBmC,kBAAkB,EAAE,UAAU;MAC9BC,uBAAuB,EAAE,eAAe;MACxCC,uBAAuB,EAAE,eAAe;MACxCC,6BAA6B,EAAE,qBAAqB;MACpDC,qBAAqB,EAAE,kBAAkB;MACzCC,2BAA2B,EAAE,mBAAmB;MAChDC,qBAAqB,EAAE,aAAa;MACpCzI,SAAS,EAAE,gBAAgB;MAC3B7B,OAAO,EAAE,SAAS;MAClBuJ,MAAM,EAAE;IACV,CAAC;IACDtG,MAAM,EAAE;MACNuG,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;MAC9BzB,aAAa,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC;MAC1CC,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa;IACvC;EACF;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"dataMap.js","names":["RumEventType","commonTags","sdk_name","sdk_version","app_id","env","service","version","source","userid","user_email","user_name","session_id","session_type","session_sampling","is_signin","os","os_version","os_version_major","browser","browser_version","browser_version_major","screen_size","network_type","time_zone","device","view_id","view_referrer","view_url","view_host","view_path","view_name","view_path_group","commonFields","view_url_query","action_id","action_ids","view_in_foreground","display","session_has_replay","is_login","page_states","session_sample_rate","session_replay_sample_rate","session_on_error_sample_rate","session_replay_on_error_sample_rate","drift","dataMap","view","type","VIEW","tags","view_loading_type","view_apdex_level","view_privacy_replay_level","fields","view_update_time","sampled_for_replay","sampled_for_error_replay","sampled_for_error_session","session_error_timestamp","is_active","session_replay_stats","session_is_active","view_error_count","view_resource_count","view_long_task_count","view_action_count","first_contentful_paint","largest_contentful_paint","largest_contentful_paint_element_selector","cumulative_layout_shift","cumulative_layout_shift_time","cumulative_layout_shift_target_selector","first_input_delay","loading_time","dom_interactive","dom_content_loaded","dom_complete","load_event","first_input_time","first_input_target_selector","first_paint_time","interaction_to_next_paint","interaction_to_next_paint_target_selector","resource_load_time","time_to_interactive","dom","dom_ready","time_spent","first_byte","frustration_count","custom_timings","resource","RESOURCE","trace_id","span_id","resource_id","resource_status","resource_status_group","resource_method","duration","resource_size","resource_url","resource_url_host","resource_url_path","resource_url_path_group","resource_url_query","resource_delivery_type","resource_type","resource_protocol","resource_encode_size","resource_decode_size","resource_transfer_size","resource_render_blocking_status","resource_dns","resource_tcp","resource_ssl","resource_ttfb","resource_trans","resource_redirect","resource_first_byte","resource_dns_time","resource_download_time","resource_first_byte_time","resource_connect_time","resource_ssl_time","resource_redirect_time","error","ERROR","error_id","error_source","error_type","error_handling","error_message","error_stack","error_causes","error_handling_stack","long_task","LONG_TASK","long_task_id","blocking_duration","first_ui_event_timestamp","render_start","style_and_layout_start","long_task_start_time","scripts","action","ACTION","action_type","action_name","action_error_count","action_resource_count","action_frustration_types","action_long_task_count","action_target","action_position","telemetry","status","message","error_kind","connectivity","runtime_env","usage","configuration","browser_log","LOGGER","error_resource_url","error_resource_url_host","error_resource_url_path","error_resource_url_path_group","error_resource_status","error_resource_status_group","error_resource_method"],"sources":["../src/dataMap.js"],"sourcesContent":["import { RumEventType } from './helper/enums'\nexport var commonTags = {\n sdk_name: '_gc.sdk_name',\n sdk_version: '_gc.sdk_version',\n app_id: 'application.id',\n env: 'env',\n service: 'service',\n version: 'version',\n source: 'source',\n userid: 'user.id',\n user_email: 'user.email',\n user_name: 'user.name',\n session_id: 'session.id',\n session_type: 'session.type',\n session_sampling: 'session.is_sampling',\n is_signin: 'user.is_signin',\n os: 'device.os',\n os_version: 'device.os_version',\n os_version_major: 'device.os_version_major',\n browser: 'device.browser',\n browser_version: 'device.browser_version',\n browser_version_major: 'device.browser_version_major',\n screen_size: 'device.screen_size',\n network_type: 'device.network_type',\n time_zone: 'device.time_zone',\n device: 'device.device',\n view_id: 'view.id',\n view_referrer: 'view.referrer',\n view_url: 'view.url',\n view_host: 'view.host',\n view_path: 'view.path',\n view_name: 'view.name',\n view_path_group: 'view.path_group'\n}\nexport var commonFields = {\n view_url_query: 'view.url_query',\n action_id: 'action.id',\n action_ids: 'action.ids',\n view_in_foreground: 'view.in_foreground',\n display: 'display',\n session_has_replay: 'session.has_replay',\n is_login: 'user.is_login',\n page_states: '_gc.page_states',\n session_sample_rate: '_gc.configuration.session_sample_rate',\n session_replay_sample_rate: '_gc.configuration.session_replay_sample_rate',\n session_on_error_sample_rate:\n '_gc.configuration.session_on_error_sample_rate',\n session_replay_on_error_sample_rate:\n '_gc.configuration.session_replay_on_error_sample_rate',\n drift: '_gc.drift'\n}\nexport var dataMap = {\n view: {\n type: RumEventType.VIEW,\n tags: {\n view_loading_type: 'view.loading_type',\n view_apdex_level: 'view.apdex_level',\n view_privacy_replay_level: 'privacy.replay_level'\n },\n fields: {\n view_update_time: '_gc.view_update_time',\n sampled_for_replay: 'session.sampled_for_replay',\n sampled_for_error_replay: 'session.sampled_for_error_replay',\n sampled_for_error_session: 'session.sampled_for_error_session',\n session_error_timestamp: 'session.error_timestamp_for_session',\n is_active: 'view.is_active',\n session_replay_stats: '_gc.replay_stats',\n session_is_active: 'session.is_active',\n view_error_count: 'view.error.count',\n view_resource_count: 'view.resource.count',\n view_long_task_count: 'view.long_task.count',\n view_action_count: 'view.action.count',\n first_contentful_paint: 'view.first_contentful_paint',\n largest_contentful_paint: 'view.largest_contentful_paint',\n largest_contentful_paint_element_selector:\n 'view.largest_contentful_paint_element_selector',\n cumulative_layout_shift: 'view.cumulative_layout_shift',\n cumulative_layout_shift_time: 'view.cumulative_layout_shift_time',\n cumulative_layout_shift_target_selector:\n 'view.cumulative_layout_shift_target_selector',\n first_input_delay: 'view.first_input_delay',\n loading_time: 'view.loading_time',\n dom_interactive: 'view.dom_interactive',\n dom_content_loaded: 'view.dom_content_loaded',\n dom_complete: 'view.dom_complete',\n load_event: 'view.load_event',\n first_input_time: 'view.first_input_time',\n first_input_target_selector: 'view.first_input_target_selector',\n first_paint_time: 'view.fpt',\n interaction_to_next_paint: 'view.interaction_to_next_paint',\n interaction_to_next_paint_target_selector:\n 'view.interaction_to_next_paint_target_selector',\n resource_load_time: 'view.resource_load_time',\n time_to_interactive: 'view.tti',\n dom: 'view.dom',\n dom_ready: 'view.dom_ready',\n time_spent: 'view.time_spent',\n first_byte: 'view.first_byte',\n frustration_count: 'view.frustration.count',\n custom_timings: 'view.custom_timings'\n }\n },\n resource: {\n type: RumEventType.RESOURCE,\n tags: {\n trace_id: '_gc.trace_id',\n span_id: '_gc.span_id',\n resource_id: 'resource.id',\n resource_status: 'resource.status',\n resource_status_group: 'resource.status_group',\n resource_method: 'resource.method'\n },\n fields: {\n duration: 'resource.duration',\n resource_size: 'resource.size',\n resource_url: 'resource.url',\n resource_url_host: 'resource.url_host',\n resource_url_path: 'resource.url_path',\n resource_url_path_group: 'resource.url_path_group',\n resource_url_query: 'resource.url_query',\n resource_delivery_type: 'resource.delivery_type',\n resource_type: 'resource.type',\n resource_protocol: 'resource.protocol',\n resource_encode_size: 'resource.encoded_body_size',\n resource_decode_size: 'resource.decoded_body_size',\n resource_transfer_size: 'resource.transfer_size',\n resource_render_blocking_status: 'resource.render_blocking_status',\n resource_dns: 'resource.dns',\n resource_tcp: 'resource.tcp',\n resource_ssl: 'resource.ssl',\n resource_ttfb: 'resource.ttfb',\n resource_trans: 'resource.trans',\n resource_redirect: 'resource.redirect',\n resource_first_byte: 'resource.firstbyte',\n resource_dns_time: 'resource.dns_time',\n resource_download_time: 'resource.download_time',\n resource_first_byte_time: 'resource.first_byte_time',\n resource_connect_time: 'resource.connect_time',\n resource_ssl_time: 'resource.ssl_time',\n resource_redirect_time: 'resource.redirect_time'\n }\n },\n error: {\n type: RumEventType.ERROR,\n tags: {\n error_id: 'error.id',\n trace_id: '_gc.trace_id',\n span_id: '_gc.span_id',\n error_source: 'error.source',\n error_type: 'error.type',\n error_handling: 'error.handling'\n // resource_url: 'error.resource.url',\n // resource_url_host: 'error.resource.url_host',\n // resource_url_path: 'error.resource.url_path',\n // resource_url_path_group: 'error.resource.url_path_group',\n // resource_status: 'error.resource.status',\n // resource_status_group: 'error.resource.status_group',\n // resource_method: 'error.resource.method'\n },\n fields: {\n error_message: ['string', 'error.message'],\n error_stack: ['string', 'error.stack'],\n error_causes: ['string', 'error.causes'],\n error_handling_stack: ['string', 'error.handling_stack']\n }\n },\n long_task: {\n type: RumEventType.LONG_TASK,\n tags: {\n long_task_id: 'long_task.id'\n },\n fields: {\n duration: 'long_task.duration',\n blocking_duration: 'long_task.blocking_duration',\n first_ui_event_timestamp: 'long_task.first_ui_event_timestamp',\n render_start: 'long_task.render_start',\n style_and_layout_start: 'long_task.style_and_layout_start',\n long_task_start_time: 'long_task.start_time',\n scripts: ['string', 'long_task.scripts']\n }\n },\n action: {\n type: RumEventType.ACTION,\n tags: {\n action_type: 'action.type'\n },\n fields: {\n action_name: 'action.target.name',\n duration: 'action.loading_time',\n action_error_count: 'action.error.count',\n action_resource_count: 'action.resource.count',\n action_frustration_types: 'action.frustration.type',\n action_long_task_count: 'action.long_task.count',\n action_target: '_gc.action.target',\n action_position: '_gc.action.position'\n }\n },\n telemetry: {\n type: 'telemetry',\n fields: {\n status: 'telemetry.status',\n message: ['string', 'telemetry.message'],\n type: 'telemetry.type',\n error_stack: ['string', 'telemetry.error.stack'],\n error_kind: ['string', 'telemetry.error.kind'],\n connectivity: ['string', 'telemetry.connectivity'],\n runtime_env: ['string', 'telemetry.runtime_env'],\n usage: ['string', 'telemetry.usage'],\n configuration: ['string', 'telemetry.configuration']\n }\n },\n browser_log: {\n type: RumEventType.LOGGER,\n tags: {\n error_source: 'error.source',\n error_type: 'error.type',\n error_resource_url: 'http.url',\n error_resource_url_host: 'http.url_host',\n error_resource_url_path: 'http.url_path',\n error_resource_url_path_group: 'http.url_path_group',\n error_resource_status: 'http.status_code',\n error_resource_status_group: 'http.status_group',\n error_resource_method: 'http.method',\n action_id: 'user_action.id',\n service: 'service',\n status: 'status'\n },\n fields: {\n message: ['string', 'message'],\n error_message: ['string', 'error.message'],\n error_stack: ['string', 'error.stack']\n }\n }\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,OAAO,IAAIC,UAAU,GAAG;EACtBC,QAAQ,EAAE,cAAc;EACxBC,WAAW,EAAE,iBAAiB;EAC9BC,MAAM,EAAE,gBAAgB;EACxBC,GAAG,EAAE,KAAK;EACVC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE,SAAS;EACjBC,UAAU,EAAE,YAAY;EACxBC,SAAS,EAAE,WAAW;EACtBC,UAAU,EAAE,YAAY;EACxBC,YAAY,EAAE,cAAc;EAC5BC,gBAAgB,EAAE,qBAAqB;EACvCC,SAAS,EAAE,gBAAgB;EAC3BC,EAAE,EAAE,WAAW;EACfC,UAAU,EAAE,mBAAmB;EAC/BC,gBAAgB,EAAE,yBAAyB;EAC3CC,OAAO,EAAE,gBAAgB;EACzBC,eAAe,EAAE,wBAAwB;EACzCC,qBAAqB,EAAE,8BAA8B;EACrDC,WAAW,EAAE,oBAAoB;EACjCC,YAAY,EAAE,qBAAqB;EACnCC,SAAS,EAAE,kBAAkB;EAC7BC,MAAM,E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AAU;MAC9BC,uBAAuB,EAAE,eAAe;MACxCC,uBAAuB,EAAE,eAAe;MACxCC,6BAA6B,EAAE,qBAAqB;MACpDC,qBAAqB,EAAE,kBAAkB;MACzCC,2BAA2B,EAAE,mBAAmB;MAChDC,qBAAqB,EAAE,aAAa;MACpC1I,SAAS,EAAE,gBAAgB;MAC3B7B,OAAO,EAAE,SAAS;MAClBwJ,MAAM,EAAE;IACV,CAAC;IACDvG,MAAM,EAAE;MACNwG,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;MAC9BzB,aAAa,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC;MAC1CC,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa;IACvC;EACF;AACF,CAAC","ignoreList":[]}
@@ -23,7 +23,7 @@ export function createIdentityEncoder() {
23
23
  output: output,
24
24
  outputBytesCount: outputBytesCount,
25
25
  rawBytesCount: outputBytesCount,
26
- pendingData: ''
26
+ pendingData: []
27
27
  };
28
28
  output = '';
29
29
  outputBytesCount = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"encoder.js","names":["computeBytesCount","createIdentityEncoder","output","outputBytesCount","isAsync","isEmpty","write","data","callback","additionalEncodedBytesCount","finish","finishSync","result","rawBytesCount","pendingData","estimateEncodedBytesCount","length"],"sources":["../../src/helper/encoder.js"],"sourcesContent":["import { computeBytesCount } from './byteUtils'\n\nexport function createIdentityEncoder() {\n var output = ''\n var outputBytesCount = 0\n\n return {\n isAsync: false,\n\n isEmpty: function () {\n return !output\n },\n\n write: function (data, callback) {\n var additionalEncodedBytesCount = computeBytesCount(data)\n outputBytesCount += additionalEncodedBytesCount\n output += data\n if (callback) {\n callback(additionalEncodedBytesCount)\n }\n },\n\n finish: function (callback) {\n callback(this.finishSync())\n },\n\n finishSync: function () {\n var result = {\n output: output,\n outputBytesCount: outputBytesCount,\n rawBytesCount: outputBytesCount,\n pendingData: ''\n }\n output = ''\n outputBytesCount = 0\n return result\n },\n\n estimateEncodedBytesCount: function (data) {\n return data.length\n }\n }\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,aAAa;AAE/C,OAAO,SAASC,qBAAqBA,CAAA,EAAG;EACtC,IAAIC,MAAM,GAAG,EAAE;EACf,IAAIC,gBAAgB,GAAG,CAAC;EAExB,OAAO;IACLC,OAAO,EAAE,KAAK;IAEdC,OAAO,EAAE,SAATA,OAAOA,CAAA,EAAc;MACnB,OAAO,CAACH,MAAM;IAChB,CAAC;IAEDI,KAAK,EAAE,SAAPA,KAAKA,CAAYC,IAAI,EAAEC,QAAQ,EAAE;MAC/B,IAAIC,2BAA2B,GAAGT,iBAAiB,CAACO,IAAI,CAAC;MACzDJ,gBAAgB,IAAIM,2BAA2B;MAC/CP,MAAM,IAAIK,IAAI;MACd,IAAIC,QAAQ,EAAE;QACZA,QAAQ,CAACC,2BAA2B,CAAC;MACvC;IACF,CAAC;IAEDC,MAAM,EAAE,SAARA,MAAMA,CAAYF,QAAQ,EAAE;MAC1BA,QAAQ,CAAC,IAAI,CAACG,UAAU,CAAC,CAAC,CAAC;IAC7B,CAAC;IAEDA,UAAU,EAAE,SAAZA,UAAUA,CAAA,EAAc;MACtB,IAAIC,MAAM,GAAG;QACXV,MAAM,EAAEA,MAAM;QACdC,gBAAgB,EAAEA,gBAAgB;QAClCU,aAAa,EAAEV,gBAAgB;QAC/BW,WAAW,EAAE;MACf,CAAC;MACDZ,MAAM,GAAG,EAAE;MACXC,gBAAgB,GAAG,CAAC;MACpB,OAAOS,MAAM;IACf,CAAC;IAEDG,yBAAyB,EAAE,SAA3BA,yBAAyBA,CAAYR,IAAI,EAAE;MACzC,OAAOA,IAAI,CAACS,MAAM;IACpB;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"encoder.js","names":["computeBytesCount","createIdentityEncoder","output","outputBytesCount","isAsync","isEmpty","write","data","callback","additionalEncodedBytesCount","finish","finishSync","result","rawBytesCount","pendingData","estimateEncodedBytesCount","length"],"sources":["../../src/helper/encoder.js"],"sourcesContent":["import { computeBytesCount } from './byteUtils'\n\nexport function createIdentityEncoder() {\n var output = ''\n var outputBytesCount = 0\n\n return {\n isAsync: false,\n\n isEmpty: function () {\n return !output\n },\n\n write: function (data, callback) {\n var additionalEncodedBytesCount = computeBytesCount(data)\n outputBytesCount += additionalEncodedBytesCount\n output += data\n if (callback) {\n callback(additionalEncodedBytesCount)\n }\n },\n\n finish: function (callback) {\n callback(this.finishSync())\n },\n\n finishSync: function () {\n var result = {\n output: output,\n outputBytesCount: outputBytesCount,\n rawBytesCount: outputBytesCount,\n pendingData: []\n }\n output = ''\n outputBytesCount = 0\n return result\n },\n\n estimateEncodedBytesCount: function (data) {\n return data.length\n }\n }\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,aAAa;AAE/C,OAAO,SAASC,qBAAqBA,CAAA,EAAG;EACtC,IAAIC,MAAM,GAAG,EAAE;EACf,IAAIC,gBAAgB,GAAG,CAAC;EAExB,OAAO;IACLC,OAAO,EAAE,KAAK;IAEdC,OAAO,EAAE,SAATA,OAAOA,CAAA,EAAc;MACnB,OAAO,CAACH,MAAM;IAChB,CAAC;IAEDI,KAAK,EAAE,SAAPA,KAAKA,CAAYC,IAAI,EAAEC,QAAQ,EAAE;MAC/B,IAAIC,2BAA2B,GAAGT,iBAAiB,CAACO,IAAI,CAAC;MACzDJ,gBAAgB,IAAIM,2BAA2B;MAC/CP,MAAM,IAAIK,IAAI;MACd,IAAIC,QAAQ,EAAE;QACZA,QAAQ,CAACC,2BAA2B,CAAC;MACvC;IACF,CAAC;IAEDC,MAAM,EAAE,SAARA,MAAMA,CAAYF,QAAQ,EAAE;MAC1BA,QAAQ,CAAC,IAAI,CAACG,UAAU,CAAC,CAAC,CAAC;IAC7B,CAAC;IAEDA,UAAU,EAAE,SAAZA,UAAUA,CAAA,EAAc;MACtB,IAAIC,MAAM,GAAG;QACXV,MAAM,EAAEA,MAAM;QACdC,gBAAgB,EAAEA,gBAAgB;QAClCU,aAAa,EAAEV,gBAAgB;QAC/BW,WAAW,EAAE;MACf,CAAC;MACDZ,MAAM,GAAG,EAAE;MACXC,gBAAgB,GAAG,CAAC;MACpB,OAAOS,MAAM;IACf,CAAC;IAEDG,yBAAyB,EAAE,SAA3BA,yBAAyBA,CAAYR,IAAI,EAAE;MACzC,OAAOA,IAAI,CAACS,MAAM;IACpB;EACF,CAAC;AACH","ignoreList":[]}
package/esm/index.js CHANGED
@@ -39,7 +39,7 @@ export * from './browser/scroll';
39
39
  export * from './dataMap';
40
40
  export * from './init';
41
41
  export { startSessionManager, stopSessionManager } from './session/sessionManagement';
42
- export { SESSION_TIME_OUT_DELAY, SESSION_STORE_KEY } from './session/sessionConstants';
42
+ export { SESSION_TIME_OUT_DELAY, SESSION_STORE_KEY, SessionPersistence } from './session/sessionConstants';
43
43
  export { STORAGE_POLL_DELAY } from './session/sessionStore';
44
44
  export * from './transport';
45
45
  export * from './synthetics/syntheticsWorkerValues';
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["startSessionManager","stopSessionManager","SESSION_TIME_OUT_DELAY","SESSION_STORE_KEY","STORAGE_POLL_DELAY"],"sources":["../src/index.js"],"sourcesContent":["export * from './helper/boundedBuffer'\nexport * from './helper/valueHistory'\nexport * from './helper/deviceInfo'\nexport * from './helper/enums'\nexport * from './helper/instrumentMethod'\nexport * from './helper/errorTools'\nexport * from './helper/byteUtils'\nexport * from './error/trackRuntimeError'\nexport * from './console/consoleObservable'\nexport * from './report/reportObservable'\nexport * from './helper/display'\nexport * from './helper/monitor'\nexport * from './helper/sanitize'\nexport * from './helper/eventEmitter'\nexport * from './helper/lifeCycle'\nexport * from './helper/limitModification'\nexport * from './helper/createEventRateLimiter'\nexport * from './helper/observable'\nexport * from './helper/tools'\nexport * from './helper/urlPolyfill'\nexport * from './helper/mobileUtil'\nexport * from './helper/getZoneJsOriginalValue'\nexport * from './helper/timer'\nexport * from './helper/readBytesFromStream'\nexport * from './helper/requestIdleCallback'\nexport * from './helper/taskQueue'\nexport * from './tracekit'\nexport * from './configuration/configuration'\nexport * from './configuration/transportConfiguration'\nexport * from './configuration/remoteConfiguration'\nexport * from './browser/cookie'\nexport * from './browser/fetchObservable'\nexport * from './browser/xhrObservable'\nexport * from './browser/pageExitObservable'\nexport * from './browser/htmlDomUtils'\nexport * from './browser/addEventListener'\nexport * from './browser/runOnReadyState'\nexport * from './browser/scroll'\n\nexport * from './dataMap'\nexport * from './init'\nexport {\n startSessionManager,\n stopSessionManager\n} from './session/sessionManagement'\nexport {\n SESSION_TIME_OUT_DELAY,\n SESSION_STORE_KEY\n} from './session/sessionConstants'\nexport { STORAGE_POLL_DELAY } from './session/sessionStore'\nexport * from './transport'\nexport * from './synthetics/syntheticsWorkerValues'\n\nexport * from './helper/serialisation/contextManager'\nexport * from './helper/serialisation/const'\nexport * from './helper/serialisation/jsonStringify'\nexport * from './helper/serialisation/rowData'\nexport * from './helper/serialisation/storedContextManager'\nexport * from './helper/serialisation/customerDataTracker'\nexport * from './helper/encoder'\nexport * from './user'\nexport * from './helper/polyfills'\nexport * from './telemetry/telemetry'\nexport * from './helper/catchUserErrors'\nexport * from './helper/connectivity'\nexport * from './helper/displayAlreadyInitializedError'\n"],"mappings":"AAAA,cAAc,wBAAwB;AACtC,cAAc,uBAAuB;AACrC,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,2BAA2B;AACzC,cAAc,qBAAqB;AACnC,cAAc,oBAAoB;AAClC,cAAc,2BAA2B;AACzC,cAAc,6BAA6B;AAC3C,cAAc,2BAA2B;AACzC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,uBAAuB;AACrC,cAAc,oBAAoB;AAClC,cAAc,4BAA4B;AAC1C,cAAc,iCAAiC;AAC/C,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,qBAAqB;AACnC,cAAc,iCAAiC;AAC/C,cAAc,gBAAgB;AAC9B,cAAc,8BAA8B;AAC5C,cAAc,8BAA8B;AAC5C,cAAc,oBAAoB;AAClC,cAAc,YAAY;AAC1B,cAAc,+BAA+B;AAC7C,cAAc,wCAAwC;AACtD,cAAc,qCAAqC;AACnD,cAAc,kBAAkB;AAChC,cAAc,2BAA2B;AACzC,cAAc,yBAAyB;AACvC,cAAc,8BAA8B;AAC5C,cAAc,wBAAwB;AACtC,cAAc,4BAA4B;AAC1C,cAAc,2BAA2B;AACzC,cAAc,kBAAkB;AAEhC,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,SACEA,mBAAmB,EACnBC,kBAAkB,QACb,6BAA6B;AACpC,SACEC,sBAAsB,EACtBC,iBAAiB,QACZ,4BAA4B;AACnC,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,cAAc,aAAa;AAC3B,cAAc,qCAAqC;AAEnD,cAAc,uCAAuC;AACrD,cAAc,8BAA8B;AAC5C,cAAc,sCAAsC;AACpD,cAAc,gCAAgC;AAC9C,cAAc,6CAA6C;AAC3D,cAAc,4CAA4C;AAC1D,cAAc,kBAAkB;AAChC,cAAc,QAAQ;AACtB,cAAc,oBAAoB;AAClC,cAAc,uBAAuB;AACrC,cAAc,0BAA0B;AACxC,cAAc,uBAAuB;AACrC,cAAc,yCAAyC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["startSessionManager","stopSessionManager","SESSION_TIME_OUT_DELAY","SESSION_STORE_KEY","SessionPersistence","STORAGE_POLL_DELAY"],"sources":["../src/index.js"],"sourcesContent":["export * from './helper/boundedBuffer'\nexport * from './helper/valueHistory'\nexport * from './helper/deviceInfo'\nexport * from './helper/enums'\nexport * from './helper/instrumentMethod'\nexport * from './helper/errorTools'\nexport * from './helper/byteUtils'\nexport * from './error/trackRuntimeError'\nexport * from './console/consoleObservable'\nexport * from './report/reportObservable'\nexport * from './helper/display'\nexport * from './helper/monitor'\nexport * from './helper/sanitize'\nexport * from './helper/eventEmitter'\nexport * from './helper/lifeCycle'\nexport * from './helper/limitModification'\nexport * from './helper/createEventRateLimiter'\nexport * from './helper/observable'\nexport * from './helper/tools'\nexport * from './helper/urlPolyfill'\nexport * from './helper/mobileUtil'\nexport * from './helper/getZoneJsOriginalValue'\nexport * from './helper/timer'\nexport * from './helper/readBytesFromStream'\nexport * from './helper/requestIdleCallback'\nexport * from './helper/taskQueue'\nexport * from './tracekit'\nexport * from './configuration/configuration'\nexport * from './configuration/transportConfiguration'\nexport * from './configuration/remoteConfiguration'\nexport * from './browser/cookie'\nexport * from './browser/fetchObservable'\nexport * from './browser/xhrObservable'\nexport * from './browser/pageExitObservable'\nexport * from './browser/htmlDomUtils'\nexport * from './browser/addEventListener'\nexport * from './browser/runOnReadyState'\nexport * from './browser/scroll'\n\nexport * from './dataMap'\nexport * from './init'\nexport {\n startSessionManager,\n stopSessionManager\n} from './session/sessionManagement'\nexport {\n SESSION_TIME_OUT_DELAY,\n SESSION_STORE_KEY,\n SessionPersistence\n} from './session/sessionConstants'\nexport { STORAGE_POLL_DELAY } from './session/sessionStore'\nexport * from './transport'\nexport * from './synthetics/syntheticsWorkerValues'\n\nexport * from './helper/serialisation/contextManager'\nexport * from './helper/serialisation/const'\nexport * from './helper/serialisation/jsonStringify'\nexport * from './helper/serialisation/rowData'\nexport * from './helper/serialisation/storedContextManager'\nexport * from './helper/serialisation/customerDataTracker'\nexport * from './helper/encoder'\nexport * from './user'\nexport * from './helper/polyfills'\nexport * from './telemetry/telemetry'\nexport * from './helper/catchUserErrors'\nexport * from './helper/connectivity'\nexport * from './helper/displayAlreadyInitializedError'\n"],"mappings":"AAAA,cAAc,wBAAwB;AACtC,cAAc,uBAAuB;AACrC,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,2BAA2B;AACzC,cAAc,qBAAqB;AACnC,cAAc,oBAAoB;AAClC,cAAc,2BAA2B;AACzC,cAAc,6BAA6B;AAC3C,cAAc,2BAA2B;AACzC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,uBAAuB;AACrC,cAAc,oBAAoB;AAClC,cAAc,4BAA4B;AAC1C,cAAc,iCAAiC;AAC/C,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,qBAAqB;AACnC,cAAc,iCAAiC;AAC/C,cAAc,gBAAgB;AAC9B,cAAc,8BAA8B;AAC5C,cAAc,8BAA8B;AAC5C,cAAc,oBAAoB;AAClC,cAAc,YAAY;AAC1B,cAAc,+BAA+B;AAC7C,cAAc,wCAAwC;AACtD,cAAc,qCAAqC;AACnD,cAAc,kBAAkB;AAChC,cAAc,2BAA2B;AACzC,cAAc,yBAAyB;AACvC,cAAc,8BAA8B;AAC5C,cAAc,wBAAwB;AACtC,cAAc,4BAA4B;AAC1C,cAAc,2BAA2B;AACzC,cAAc,kBAAkB;AAEhC,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,SACEA,mBAAmB,EACnBC,kBAAkB,QACb,6BAA6B;AACpC,SACEC,sBAAsB,EACtBC,iBAAiB,EACjBC,kBAAkB,QACb,4BAA4B;AACnC,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,cAAc,aAAa;AAC3B,cAAc,qCAAqC;AAEnD,cAAc,uCAAuC;AACrD,cAAc,8BAA8B;AAC5C,cAAc,sCAAsC;AACpD,cAAc,gCAAgC;AAC9C,cAAc,6CAA6C;AAC3D,cAAc,4CAA4C;AAC1D,cAAc,kBAAkB;AAChC,cAAc,QAAQ;AACtB,cAAc,oBAAoB;AAClC,cAAc,uBAAuB;AACrC,cAAc,0BAA0B;AACxC,cAAc,uBAAuB;AACrC,cAAc,yCAAyC","ignoreList":[]}
@@ -2,4 +2,8 @@ import { ONE_HOUR, ONE_MINUTE } from '../helper/tools';
2
2
  export var SESSION_TIME_OUT_DELAY = 4 * ONE_HOUR;
3
3
  export var SESSION_EXPIRATION_DELAY = 15 * ONE_MINUTE;
4
4
  export var SESSION_STORE_KEY = '_gc_s';
5
+ export var SessionPersistence = {
6
+ COOKIE: 'cookie',
7
+ LOCAL_STORAGE: 'local-storage'
8
+ };
5
9
  //# sourceMappingURL=sessionConstants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sessionConstants.js","names":["ONE_HOUR","ONE_MINUTE","SESSION_TIME_OUT_DELAY","SESSION_EXPIRATION_DELAY","SESSION_STORE_KEY"],"sources":["../../src/session/sessionConstants.js"],"sourcesContent":["import { ONE_HOUR, ONE_MINUTE } from '../helper/tools'\nexport var SESSION_TIME_OUT_DELAY = 4 * ONE_HOUR\nexport var SESSION_EXPIRATION_DELAY = 15 * ONE_MINUTE\nexport var SESSION_STORE_KEY = '_gc_s'\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,UAAU,QAAQ,iBAAiB;AACtD,OAAO,IAAIC,sBAAsB,GAAG,CAAC,GAAGF,QAAQ;AAChD,OAAO,IAAIG,wBAAwB,GAAG,EAAE,GAAGF,UAAU;AACrD,OAAO,IAAIG,iBAAiB,GAAG,OAAO","ignoreList":[]}
1
+ {"version":3,"file":"sessionConstants.js","names":["ONE_HOUR","ONE_MINUTE","SESSION_TIME_OUT_DELAY","SESSION_EXPIRATION_DELAY","SESSION_STORE_KEY","SessionPersistence","COOKIE","LOCAL_STORAGE"],"sources":["../../src/session/sessionConstants.js"],"sourcesContent":["import { ONE_HOUR, ONE_MINUTE } from '../helper/tools'\nexport var SESSION_TIME_OUT_DELAY = 4 * ONE_HOUR\nexport var SESSION_EXPIRATION_DELAY = 15 * ONE_MINUTE\nexport var SESSION_STORE_KEY = '_gc_s'\nexport const SessionPersistence = {\n COOKIE: 'cookie',\n LOCAL_STORAGE: 'local-storage'\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,UAAU,QAAQ,iBAAiB;AACtD,OAAO,IAAIC,sBAAsB,GAAG,CAAC,GAAGF,QAAQ;AAChD,OAAO,IAAIG,wBAAwB,GAAG,EAAE,GAAGF,UAAU;AACrD,OAAO,IAAIG,iBAAiB,GAAG,OAAO;AACtC,OAAO,IAAMC,kBAAkB,GAAG;EAChCC,MAAM,EAAE,QAAQ;EAChBC,aAAa,EAAE;AACjB,CAAC","ignoreList":[]}
@@ -1,11 +1,11 @@
1
1
  import { isChromium } from '../helper/tools';
2
2
  import { getCurrentSite, areCookiesAuthorized, getCookie, setCookie } from '../browser/cookie';
3
- import { SESSION_EXPIRATION_DELAY, SESSION_TIME_OUT_DELAY, SESSION_STORE_KEY } from './sessionConstants';
3
+ import { SESSION_EXPIRATION_DELAY, SESSION_TIME_OUT_DELAY, SESSION_STORE_KEY, SessionPersistence } from './sessionConstants';
4
4
  import { toSessionString, toSessionState, getExpiredSessionState } from './sessionState';
5
5
  export function selectCookieStrategy(initConfiguration) {
6
6
  var cookieOptions = buildCookieOptions(initConfiguration);
7
7
  return areCookiesAuthorized(cookieOptions) ? {
8
- type: 'Cookie',
8
+ type: SessionPersistence.COOKIE,
9
9
  cookieOptions: cookieOptions
10
10
  } : undefined;
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sessionInCookie.js","names":["isChromium","getCurrentSite","areCookiesAuthorized","getCookie","setCookie","SESSION_EXPIRATION_DELAY","SESSION_TIME_OUT_DELAY","SESSION_STORE_KEY","toSessionString","toSessionState","getExpiredSessionState","selectCookieStrategy","initConfiguration","cookieOptions","buildCookieOptions","type","undefined","initCookieStrategy","cookieStore","isLockEnabled","persistSession","persistSessionCookie","retrieveSession","retrieveSessionCookie","expireSession","expireSessionCookie","options","session","sessionString","secure","useSecureSessionCookie","usePartitionedCrossSiteSessionCookie","useCrossSiteSessionCookie","crossSite","partitioned","trackSessionAcrossSubdomains","domain"],"sources":["../../src/session/sessionInCookie.js"],"sourcesContent":["import { isChromium } from '../helper/tools'\nimport {\n getCurrentSite,\n areCookiesAuthorized,\n getCookie,\n setCookie\n} from '../browser/cookie'\nimport {\n SESSION_EXPIRATION_DELAY,\n SESSION_TIME_OUT_DELAY,\n SESSION_STORE_KEY\n} from './sessionConstants'\nimport {\n toSessionString,\n toSessionState,\n getExpiredSessionState\n} from './sessionState'\n\nexport function selectCookieStrategy(initConfiguration) {\n const cookieOptions = buildCookieOptions(initConfiguration)\n return areCookiesAuthorized(cookieOptions)\n ? { type: 'Cookie', cookieOptions }\n : undefined\n}\n\nexport function initCookieStrategy(cookieOptions) {\n const cookieStore = {\n /**\n * Lock strategy allows mitigating issues due to concurrent access to cookie.\n * This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.\n */\n isLockEnabled: isChromium(),\n persistSession: persistSessionCookie(cookieOptions),\n retrieveSession: retrieveSessionCookie(cookieOptions),\n expireSession: function () {\n return expireSessionCookie(cookieOptions)\n }\n }\n return cookieStore\n}\n\nfunction persistSessionCookie(options) {\n return function (session) {\n setCookie(\n SESSION_STORE_KEY,\n toSessionString(session),\n SESSION_EXPIRATION_DELAY,\n options\n )\n }\n}\n\nfunction expireSessionCookie(options) {\n setCookie(\n SESSION_STORE_KEY,\n toSessionString(getExpiredSessionState()),\n SESSION_TIME_OUT_DELAY,\n options\n )\n}\n\nfunction retrieveSessionCookie(options) {\n return function () {\n var sessionString = getCookie(SESSION_STORE_KEY, options)\n return toSessionState(sessionString)\n }\n}\n\nexport function buildCookieOptions(initConfiguration) {\n const cookieOptions = {}\n\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\n if (initConfiguration.trackSessionAcrossSubdomains) {\n cookieOptions.domain = getCurrentSite()\n }\n\n return cookieOptions\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,iBAAiB;AAC5C,SACEC,cAAc,EACdC,oBAAoB,EACpBC,SAAS,EACTC,SAAS,QACJ,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,CAAC;AACH;AAEA,OAAO,SAASd,kBAAkBA,CAACF,iBAAiB,EAAE;EACpD,IAAMC,aAAa,GAAG,CAAC,CAAC;EAExBA,aAAa,CAACgB,MAAM,GAClB,CAAC,CAACjB,iBAAiB,CAACkB,sBAAsB,IAC1C,CAAC,CAAClB,iBAAiB,CAACmB,oCAAoC,IACxD,CAAC,CAACnB,iBAAiB,CAACoB,yBAAyB;EAC/CnB,aAAa,CAACoB,SAAS,GACrB,CAAC,CAACrB,iBAAiB,CAACmB,oCAAoC,IACxD,CAAC,CAACnB,iBAAiB,CAACoB,yBAAyB;EAC/CnB,aAAa,CAACqB,WAAW,GACvB,CAAC,CAACtB,iBAAiB,CAACmB,oCAAoC;EAE1D,IAAInB,iBAAiB,CAACuB,4BAA4B,EAAE;IAClDtB,aAAa,CAACuB,MAAM,GAAGnC,cAAc,CAAC,CAAC;EACzC;EAEA,OAAOY,aAAa;AACtB","ignoreList":[]}
1
+ {"version":3,"file":"sessionInCookie.js","names":["isChromium","getCurrentSite","areCookiesAuthorized","getCookie","setCookie","SESSION_EXPIRATION_DELAY","SESSION_TIME_OUT_DELAY","SESSION_STORE_KEY","SessionPersistence","toSessionString","toSessionState","getExpiredSessionState","selectCookieStrategy","initConfiguration","cookieOptions","buildCookieOptions","type","COOKIE","undefined","initCookieStrategy","cookieStore","isLockEnabled","persistSession","persistSessionCookie","retrieveSession","retrieveSessionCookie","expireSession","expireSessionCookie","options","session","sessionString","secure","useSecureSessionCookie","usePartitionedCrossSiteSessionCookie","useCrossSiteSessionCookie","crossSite","partitioned","trackSessionAcrossSubdomains","domain"],"sources":["../../src/session/sessionInCookie.js"],"sourcesContent":["import { isChromium } from '../helper/tools'\nimport {\n getCurrentSite,\n areCookiesAuthorized,\n getCookie,\n setCookie\n} from '../browser/cookie'\nimport {\n SESSION_EXPIRATION_DELAY,\n SESSION_TIME_OUT_DELAY,\n SESSION_STORE_KEY,\n SessionPersistence\n} from './sessionConstants'\nimport {\n toSessionString,\n toSessionState,\n getExpiredSessionState\n} from './sessionState'\n\nexport function selectCookieStrategy(initConfiguration) {\n const cookieOptions = buildCookieOptions(initConfiguration)\n return areCookiesAuthorized(cookieOptions)\n ? { type: SessionPersistence.COOKIE, cookieOptions }\n : undefined\n}\n\nexport function initCookieStrategy(cookieOptions) {\n const cookieStore = {\n /**\n * Lock strategy allows mitigating issues due to concurrent access to cookie.\n * This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.\n */\n isLockEnabled: isChromium(),\n persistSession: persistSessionCookie(cookieOptions),\n retrieveSession: retrieveSessionCookie(cookieOptions),\n expireSession: function () {\n return expireSessionCookie(cookieOptions)\n }\n }\n return cookieStore\n}\n\nfunction persistSessionCookie(options) {\n return function (session) {\n setCookie(\n SESSION_STORE_KEY,\n toSessionString(session),\n SESSION_EXPIRATION_DELAY,\n options\n )\n }\n}\n\nfunction expireSessionCookie(options) {\n setCookie(\n SESSION_STORE_KEY,\n toSessionString(getExpiredSessionState()),\n SESSION_TIME_OUT_DELAY,\n options\n )\n}\n\nfunction retrieveSessionCookie(options) {\n return function () {\n var sessionString = getCookie(SESSION_STORE_KEY, options)\n return toSessionState(sessionString)\n }\n}\n\nexport function buildCookieOptions(initConfiguration) {\n const cookieOptions = {}\n\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\n if (initConfiguration.trackSessionAcrossSubdomains) {\n cookieOptions.domain = getCurrentSite()\n }\n\n return cookieOptions\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,iBAAiB;AAC5C,SACEC,cAAc,EACdC,oBAAoB,EACpBC,SAAS,EACTC,SAAS,QACJ,mBAAmB;AAC1B,SACEC,wBA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AAC;AACH;AAEA,OAAO,SAASf,kBAAkBA,CAACF,iBAAiB,EAAE;EACpD,IAAMC,aAAa,GAAG,CAAC,CAAC;EAExBA,aAAa,CAACiB,MAAM,GAClB,CAAC,CAAClB,iBAAiB,CAACmB,sBAAsB,IAC1C,CAAC,CAACnB,iBAAiB,CAACoB,oCAAoC,IACxD,CAAC,CAACpB,iBAAiB,CAACqB,yBAAyB;EAC/CpB,aAAa,CAACqB,SAAS,GACrB,CAAC,CAACtB,iBAAiB,CAACoB,oCAAoC,IACxD,CAAC,CAACpB,iBAAiB,CAACqB,yBAAyB;EAC/CpB,aAAa,CAACsB,WAAW,GACvB,CAAC,CAACvB,iBAAiB,CAACoB,oCAAoC;EAE1D,IAAIpB,iBAAiB,CAACwB,4BAA4B,EAAE;IAClDvB,aAAa,CAACwB,MAAM,GAAGrC,cAAc,CAAC,CAAC;EACzC;EAEA,OAAOa,aAAa;AACtB","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { UUID } from '../helper/tools';
2
2
  import { toSessionString, toSessionState, getExpiredSessionState } from './sessionState';
3
- import { SESSION_STORE_KEY } from './sessionConstants';
3
+ import { SESSION_STORE_KEY, SessionPersistence } from './sessionConstants';
4
4
  var LOCAL_STORAGE_TEST_KEY = '_gc_test_';
5
5
  export function selectLocalStorageStrategy() {
6
6
  try {
@@ -10,7 +10,7 @@ export function selectLocalStorageStrategy() {
10
10
  var retrievedId = localStorage.getItem(testKey);
11
11
  localStorage.removeItem(testKey);
12
12
  return id === retrievedId ? {
13
- type: 'LocalStorage'
13
+ type: SessionPersistence.LOCAL_STORAGE
14
14
  } : undefined;
15
15
  } catch (e) {
16
16
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"sessionInLocalStorage.js","names":["UUID","toSessionString","toSessionState","getExpiredSessionState","SESSION_STORE_KEY","LOCAL_STORAGE_TEST_KEY","selectLocalStorageStrategy","id","testKey","concat","localStorage","setItem","retrievedId","getItem","removeItem","type","undefined","e","initLocalStorageStrategy","isLockEnabled","persistSession","persistInLocalStorage","retrieveSession","retrieveSessionFromLocalStorage","expireSession","expireSessionFromLocalStorage","sessionState","sessionString"],"sources":["../../src/session/sessionInLocalStorage.js"],"sourcesContent":["import { UUID } from '../helper/tools'\nimport {\n toSessionString,\n toSessionState,\n getExpiredSessionState\n} from './sessionState'\n\nimport { SESSION_STORE_KEY } from './sessionConstants'\n\nconst LOCAL_STORAGE_TEST_KEY = '_gc_test_'\n\nexport function selectLocalStorageStrategy() {\n try {\n const id = UUID()\n const testKey = `${LOCAL_STORAGE_TEST_KEY}${id}`\n localStorage.setItem(testKey, id)\n const retrievedId = localStorage.getItem(testKey)\n localStorage.removeItem(testKey)\n return id === retrievedId ? { type: 'LocalStorage' } : undefined\n } catch (e) {\n return undefined\n }\n}\n\nexport function initLocalStorageStrategy() {\n return {\n isLockEnabled: false,\n persistSession: persistInLocalStorage,\n retrieveSession: retrieveSessionFromLocalStorage,\n expireSession: expireSessionFromLocalStorage\n }\n}\n\nfunction persistInLocalStorage(sessionState) {\n localStorage.setItem(SESSION_STORE_KEY, toSessionString(sessionState))\n}\n\nfunction retrieveSessionFromLocalStorage() {\n const sessionString = localStorage.getItem(SESSION_STORE_KEY)\n return toSessionState(sessionString)\n}\n\nfunction expireSessionFromLocalStorage() {\n persistInLocalStorage(getExpiredSessionState())\n}\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,iBAAiB;AACtC,SACEC,eAAe,EACfC,cAAc,EACdC,sBAAsB,QACjB,gBAAgB;AAEvB,SAASC,iBAAiB,QAAQ,oBAAoB;AAEtD,IAAMC,sBAAsB,GAAG,WAAW;AAE1C,OAAO,SAASC,0BAA0BA,CAAA,EAAG;EAC3C,IAAI;IACF,IAAMC,EAAE,GAAGP,IAAI,CAAC,CAAC;IACjB,IAAMQ,OAAO,MAAAC,MAAA,CAAMJ,sBAAsB,EAAAI,MAAA,CAAGF,EAAE,CAAE;IAChDG,YAAY,CAACC,OAAO,CAACH,OAAO,EAAED,EAAE,CAAC;IACjC,IAAMK,WAAW,GAAGF,YAAY,CAACG,OAAO,CAACL,OAAO,CAAC;IACjDE,YAAY,CAACI,UAAU,CAACN,OAAO,CAAC;IAChC,OAAOD,EAAE,KAAKK,WAAW,GAAG;MAAEG,IAAI,EAAE;IAAe,CAAC,GAAGC,SAAS;EAClE,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,OAAOD,SAAS;EAClB;AACF;AAEA,OAAO,SAASE,wBAAwBA,CAAA,EAAG;EACzC,OAAO;IACLC,aAAa,EAAE,KAAK;IACpBC,cAAc,EAAEC,qBAAqB;IACrCC,eAAe,EAAEC,+BAA+B;IAChDC,aAAa,EAAEC;EACjB,CAAC;AACH;AAEA,SAASJ,qBAAqBA,CAACK,YAAY,EAAE;EAC3ChB,YAAY,CAACC,OAAO,CAACP,iBAAiB,EAAEH,eAAe,CAACyB,YAAY,CAAC,CAAC;AACxE;AAEA,SAASH,+BAA+BA,CAAA,EAAG;EACzC,IAAMI,aAAa,GAAGjB,YAAY,CAACG,OAAO,CAACT,iBAAiB,CAAC;EAC7D,OAAOF,cAAc,CAACyB,aAAa,CAAC;AACtC;AAEA,SAASF,6BAA6BA,CAAA,EAAG;EACvCJ,qBAAqB,CAAClB,sBAAsB,CAAC,CAAC,CAAC;AACjD","ignoreList":[]}
1
+ {"version":3,"file":"sessionInLocalStorage.js","names":["UUID","toSessionString","toSessionState","getExpiredSessionState","SESSION_STORE_KEY","SessionPersistence","LOCAL_STORAGE_TEST_KEY","selectLocalStorageStrategy","id","testKey","concat","localStorage","setItem","retrievedId","getItem","removeItem","type","LOCAL_STORAGE","undefined","e","initLocalStorageStrategy","isLockEnabled","persistSession","persistInLocalStorage","retrieveSession","retrieveSessionFromLocalStorage","expireSession","expireSessionFromLocalStorage","sessionState","sessionString"],"sources":["../../src/session/sessionInLocalStorage.js"],"sourcesContent":["import { UUID } from '../helper/tools'\nimport {\n toSessionString,\n toSessionState,\n getExpiredSessionState\n} from './sessionState'\n\nimport { SESSION_STORE_KEY, SessionPersistence } from './sessionConstants'\n\nconst LOCAL_STORAGE_TEST_KEY = '_gc_test_'\n\nexport function selectLocalStorageStrategy() {\n try {\n const id = UUID()\n const testKey = `${LOCAL_STORAGE_TEST_KEY}${id}`\n localStorage.setItem(testKey, id)\n const retrievedId = localStorage.getItem(testKey)\n localStorage.removeItem(testKey)\n return id === retrievedId\n ? { type: SessionPersistence.LOCAL_STORAGE }\n : undefined\n } catch (e) {\n return undefined\n }\n}\n\nexport function initLocalStorageStrategy() {\n return {\n isLockEnabled: false,\n persistSession: persistInLocalStorage,\n retrieveSession: retrieveSessionFromLocalStorage,\n expireSession: expireSessionFromLocalStorage\n }\n}\n\nfunction persistInLocalStorage(sessionState) {\n localStorage.setItem(SESSION_STORE_KEY, toSessionString(sessionState))\n}\n\nfunction retrieveSessionFromLocalStorage() {\n const sessionString = localStorage.getItem(SESSION_STORE_KEY)\n return toSessionState(sessionString)\n}\n\nfunction expireSessionFromLocalStorage() {\n persistInLocalStorage(getExpiredSessionState())\n}\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,iBAAiB;AACtC,SACEC,eAAe,EACfC,cAAc,EACdC,sBAAsB,QACjB,gBAAgB;AAEvB,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,oBAAoB;AAE1E,IAAMC,sBAAsB,GAAG,WAAW;AAE1C,OAAO,SAASC,0BAA0BA,CAAA,EAAG;EAC3C,IAAI;IACF,IAAMC,EAAE,GAAGR,IAAI,CAAC,CAAC;IACjB,IAAMS,OAAO,MAAAC,MAAA,CAAMJ,sBAAsB,EAAAI,MAAA,CAAGF,EAAE,CAAE;IAChDG,YAAY,CAACC,OAAO,CAACH,OAAO,EAAED,EAAE,CAAC;IACjC,IAAMK,WAAW,GAAGF,YAAY,CAACG,OAAO,CAACL,OAAO,CAAC;IACjDE,YAAY,CAACI,UAAU,CAACN,OAAO,CAAC;IAChC,OAAOD,EAAE,KAAKK,WAAW,GACrB;MAAEG,IAAI,EAAEX,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