@openobserve/browser-core 0.3.2 → 0.3.3

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 (83) hide show
  1. package/cjs/boot/init.js +1 -1
  2. package/cjs/domain/configuration/endpointBuilder.js +1 -1
  3. package/cjs/domain/tags.js +1 -1
  4. package/cjs/domain/telemetry/telemetry.js +1 -1
  5. package/cjs/domain/telemetry/telemetryEvent.types.d.ts +1 -1
  6. package/esm/boot/init.js +1 -1
  7. package/esm/domain/configuration/endpointBuilder.js +1 -1
  8. package/esm/domain/tags.js +1 -1
  9. package/esm/domain/telemetry/telemetry.js +1 -1
  10. package/esm/domain/telemetry/telemetryEvent.types.d.ts +1 -1
  11. package/package.json +2 -2
  12. package/src/domain/telemetry/telemetryEvent.types.ts +1 -1
  13. package/src/boot/displayAlreadyInitializedError.spec.ts +0 -18
  14. package/src/boot/init.spec.ts +0 -50
  15. package/src/browser/addEventListener.spec.ts +0 -141
  16. package/src/browser/cookie.spec.ts +0 -53
  17. package/src/browser/fetchObservable.spec.ts +0 -334
  18. package/src/browser/pageMayExitObservable.spec.ts +0 -56
  19. package/src/browser/xhrObservable.spec.ts +0 -405
  20. package/src/domain/allowedTrackingOrigins.spec.ts +0 -210
  21. package/src/domain/bufferedData.spec.ts +0 -34
  22. package/src/domain/configuration/configuration.spec.ts +0 -236
  23. package/src/domain/configuration/endpointBuilder.spec.ts +0 -173
  24. package/src/domain/configuration/transportConfiguration.spec.ts +0 -130
  25. package/src/domain/connectivity/connectivity.spec.ts +0 -50
  26. package/src/domain/console/consoleObservable.spec.ts +0 -151
  27. package/src/domain/context/contextManager.spec.ts +0 -152
  28. package/src/domain/context/contextUtils.spec.ts +0 -26
  29. package/src/domain/context/storeContextManager.spec.ts +0 -103
  30. package/src/domain/contexts/accountContext.spec.ts +0 -99
  31. package/src/domain/contexts/globalContext.spec.ts +0 -88
  32. package/src/domain/contexts/userContext.spec.ts +0 -156
  33. package/src/domain/error/error.spec.ts +0 -294
  34. package/src/domain/error/trackRuntimeError.spec.ts +0 -343
  35. package/src/domain/eventRateLimiter/createEventRateLimiter.spec.ts +0 -119
  36. package/src/domain/extension/extensionUtils.spec.ts +0 -47
  37. package/src/domain/report/reportObservable.spec.ts +0 -71
  38. package/src/domain/session/oldCookiesMigration.spec.ts +0 -76
  39. package/src/domain/session/sessionManager.spec.ts +0 -684
  40. package/src/domain/session/sessionState.spec.ts +0 -88
  41. package/src/domain/session/sessionStore.spec.ts +0 -647
  42. package/src/domain/session/sessionStoreOperations.spec.ts +0 -234
  43. package/src/domain/session/storeStrategies/sessionInCookie.spec.ts +0 -228
  44. package/src/domain/session/storeStrategies/sessionInLocalStorage.spec.ts +0 -75
  45. package/src/domain/synthetics/syntheticsWorkerValues.spec.ts +0 -82
  46. package/src/domain/tags.spec.ts +0 -74
  47. package/src/domain/telemetry/telemetry.spec.ts +0 -494
  48. package/src/domain/trackingConsent.spec.ts +0 -44
  49. package/src/tools/abstractHooks.spec.ts +0 -76
  50. package/src/tools/abstractLifeCycle.spec.ts +0 -46
  51. package/src/tools/boundedBuffer.spec.ts +0 -40
  52. package/src/tools/catchUserErrors.spec.ts +0 -20
  53. package/src/tools/encoder.spec.ts +0 -112
  54. package/src/tools/experimentalFeatures.spec.ts +0 -60
  55. package/src/tools/getZoneJsOriginalValue.spec.ts +0 -36
  56. package/src/tools/instrumentMethod.spec.ts +0 -381
  57. package/src/tools/matchOption.spec.ts +0 -41
  58. package/src/tools/mergeInto.spec.ts +0 -198
  59. package/src/tools/monitor.spec.ts +0 -172
  60. package/src/tools/observable.spec.ts +0 -259
  61. package/src/tools/queueMicrotask.spec.ts +0 -24
  62. package/src/tools/readBytesFromStream.spec.ts +0 -62
  63. package/src/tools/requestIdleCallback.spec.ts +0 -65
  64. package/src/tools/serialisation/jsonStringify.spec.ts +0 -76
  65. package/src/tools/serialisation/sanitize.spec.ts +0 -284
  66. package/src/tools/stackTrace/capturedExceptions.specHelper.ts +0 -316
  67. package/src/tools/stackTrace/computeStackTrace.spec.ts +0 -1007
  68. package/src/tools/stackTrace/handlingStack.spec.ts +0 -20
  69. package/src/tools/taskQueue.spec.ts +0 -60
  70. package/src/tools/timer.spec.ts +0 -76
  71. package/src/tools/utils/browserDetection.spec.ts +0 -120
  72. package/src/tools/utils/byteUtils.spec.ts +0 -29
  73. package/src/tools/utils/functionUtils.spec.ts +0 -229
  74. package/src/tools/utils/numberUtils.spec.ts +0 -27
  75. package/src/tools/utils/stringUtils.spec.ts +0 -74
  76. package/src/tools/utils/typeUtils.spec.ts +0 -25
  77. package/src/tools/utils/urlPolyfill.spec.ts +0 -55
  78. package/src/tools/valueHistory.spec.ts +0 -180
  79. package/src/transport/batch.spec.ts +0 -261
  80. package/src/transport/eventBridge.spec.ts +0 -90
  81. package/src/transport/flushController.spec.ts +0 -267
  82. package/src/transport/httpRequest.spec.ts +0 -400
  83. package/src/transport/sendWithRetryStrategy.spec.ts +0 -393
@@ -1,88 +0,0 @@
1
- import { dateNow } from '../../tools/utils/timeUtils'
2
- import { SESSION_EXPIRATION_DELAY, SESSION_NOT_TRACKED } from './sessionConstants'
3
- import type { SessionState } from './sessionState'
4
- import {
5
- expandSessionState,
6
- isSessionInExpiredState,
7
- toSessionString,
8
- toSessionState,
9
- isSessionInNotStartedState,
10
- } from './sessionState'
11
-
12
- describe('session state utilities', () => {
13
- const NOT_STARTED_SESSION: SessionState = {}
14
- const SERIALIZED_NOT_STARTED_SESSION = ''
15
- const EXPIRED_SESSION: SessionState = { isExpired: '1' }
16
- const SERIALIZED_EXPIRED_SESSION = 'isExpired=1'
17
- const LIVE_SESSION: SessionState = { id: '123', first: 'tracked' }
18
- const SERIALIZED_LIVE_SESSION = 'id=123&first=tracked'
19
-
20
- describe('isSessionStarted', () => {
21
- it('should correctly identify a session in a started state', () => {
22
- expect(isSessionInNotStartedState(LIVE_SESSION)).toBe(false)
23
- expect(isSessionInNotStartedState(EXPIRED_SESSION)).toBe(false)
24
- })
25
-
26
- it('should correctly identify a session in a not started state', () => {
27
- expect(isSessionInNotStartedState(NOT_STARTED_SESSION)).toBe(true)
28
- })
29
- })
30
-
31
- describe('isSessionInExpiredState', () => {
32
- function dateNowWithOffset(offset = 0) {
33
- return String(dateNow() + offset)
34
- }
35
-
36
- it('should correctly identify a session in expired state', () => {
37
- expect(isSessionInExpiredState(EXPIRED_SESSION)).toBe(true)
38
- expect(isSessionInExpiredState({ created: dateNowWithOffset(-1000 * 60 * 60 * 4) })).toBe(true)
39
- expect(isSessionInExpiredState({ expire: dateNowWithOffset(-100) })).toBe(true)
40
- })
41
-
42
- it('should correctly identify a session in live state', () => {
43
- expect(isSessionInExpiredState({ created: dateNowWithOffset(-1000), expire: dateNowWithOffset(1000) })).toBe(
44
- false
45
- )
46
- expect(isSessionInExpiredState({ first: SESSION_NOT_TRACKED })).toBe(false)
47
- expect(isSessionInExpiredState({ first: 'tracked' })).toBe(false)
48
- })
49
- })
50
-
51
- describe('toSessionString', () => {
52
- it('should serialize a sessionState to a string', () => {
53
- expect(toSessionString(LIVE_SESSION)).toEqual(SERIALIZED_LIVE_SESSION)
54
- })
55
-
56
- it('should handle empty sessionStates', () => {
57
- expect(toSessionString(EXPIRED_SESSION)).toEqual(SERIALIZED_EXPIRED_SESSION)
58
- })
59
- })
60
-
61
- describe('sessionStringToSessionState', () => {
62
- it('should deserialize a session string to a sessionState', () => {
63
- expect(toSessionState(SERIALIZED_LIVE_SESSION)).toEqual(LIVE_SESSION)
64
- })
65
-
66
- it('should handle empty session strings', () => {
67
- expect(toSessionState(SERIALIZED_NOT_STARTED_SESSION)).toEqual(NOT_STARTED_SESSION)
68
- })
69
-
70
- it('should handle expired session', () => {
71
- expect(toSessionState(SERIALIZED_EXPIRED_SESSION)).toEqual(EXPIRED_SESSION)
72
- })
73
-
74
- it('should handle invalid session strings', () => {
75
- const sessionString = '{invalid: true}'
76
- expect(toSessionState(sessionString)).toEqual(NOT_STARTED_SESSION)
77
- })
78
- })
79
-
80
- describe('expandSessionState', () => {
81
- it('should modify the expire property of the session', () => {
82
- const session = { ...LIVE_SESSION }
83
- const now = dateNow()
84
- expandSessionState(session)
85
- expect(session.expire).toBeGreaterThanOrEqual(now + SESSION_EXPIRATION_DELAY)
86
- })
87
- })
88
- })