@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.
- package/cjs/boot/init.js +1 -1
- package/cjs/domain/configuration/endpointBuilder.js +1 -1
- package/cjs/domain/tags.js +1 -1
- package/cjs/domain/telemetry/telemetry.js +1 -1
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +1 -1
- package/esm/boot/init.js +1 -1
- package/esm/domain/configuration/endpointBuilder.js +1 -1
- package/esm/domain/tags.js +1 -1
- package/esm/domain/telemetry/telemetry.js +1 -1
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +1 -1
- package/package.json +2 -2
- package/src/domain/telemetry/telemetryEvent.types.ts +1 -1
- package/src/boot/displayAlreadyInitializedError.spec.ts +0 -18
- package/src/boot/init.spec.ts +0 -50
- package/src/browser/addEventListener.spec.ts +0 -141
- package/src/browser/cookie.spec.ts +0 -53
- package/src/browser/fetchObservable.spec.ts +0 -334
- package/src/browser/pageMayExitObservable.spec.ts +0 -56
- package/src/browser/xhrObservable.spec.ts +0 -405
- package/src/domain/allowedTrackingOrigins.spec.ts +0 -210
- package/src/domain/bufferedData.spec.ts +0 -34
- package/src/domain/configuration/configuration.spec.ts +0 -236
- package/src/domain/configuration/endpointBuilder.spec.ts +0 -173
- package/src/domain/configuration/transportConfiguration.spec.ts +0 -130
- package/src/domain/connectivity/connectivity.spec.ts +0 -50
- package/src/domain/console/consoleObservable.spec.ts +0 -151
- package/src/domain/context/contextManager.spec.ts +0 -152
- package/src/domain/context/contextUtils.spec.ts +0 -26
- package/src/domain/context/storeContextManager.spec.ts +0 -103
- package/src/domain/contexts/accountContext.spec.ts +0 -99
- package/src/domain/contexts/globalContext.spec.ts +0 -88
- package/src/domain/contexts/userContext.spec.ts +0 -156
- package/src/domain/error/error.spec.ts +0 -294
- package/src/domain/error/trackRuntimeError.spec.ts +0 -343
- package/src/domain/eventRateLimiter/createEventRateLimiter.spec.ts +0 -119
- package/src/domain/extension/extensionUtils.spec.ts +0 -47
- package/src/domain/report/reportObservable.spec.ts +0 -71
- package/src/domain/session/oldCookiesMigration.spec.ts +0 -76
- package/src/domain/session/sessionManager.spec.ts +0 -684
- package/src/domain/session/sessionState.spec.ts +0 -88
- package/src/domain/session/sessionStore.spec.ts +0 -647
- package/src/domain/session/sessionStoreOperations.spec.ts +0 -234
- package/src/domain/session/storeStrategies/sessionInCookie.spec.ts +0 -228
- package/src/domain/session/storeStrategies/sessionInLocalStorage.spec.ts +0 -75
- package/src/domain/synthetics/syntheticsWorkerValues.spec.ts +0 -82
- package/src/domain/tags.spec.ts +0 -74
- package/src/domain/telemetry/telemetry.spec.ts +0 -494
- package/src/domain/trackingConsent.spec.ts +0 -44
- package/src/tools/abstractHooks.spec.ts +0 -76
- package/src/tools/abstractLifeCycle.spec.ts +0 -46
- package/src/tools/boundedBuffer.spec.ts +0 -40
- package/src/tools/catchUserErrors.spec.ts +0 -20
- package/src/tools/encoder.spec.ts +0 -112
- package/src/tools/experimentalFeatures.spec.ts +0 -60
- package/src/tools/getZoneJsOriginalValue.spec.ts +0 -36
- package/src/tools/instrumentMethod.spec.ts +0 -381
- package/src/tools/matchOption.spec.ts +0 -41
- package/src/tools/mergeInto.spec.ts +0 -198
- package/src/tools/monitor.spec.ts +0 -172
- package/src/tools/observable.spec.ts +0 -259
- package/src/tools/queueMicrotask.spec.ts +0 -24
- package/src/tools/readBytesFromStream.spec.ts +0 -62
- package/src/tools/requestIdleCallback.spec.ts +0 -65
- package/src/tools/serialisation/jsonStringify.spec.ts +0 -76
- package/src/tools/serialisation/sanitize.spec.ts +0 -284
- package/src/tools/stackTrace/capturedExceptions.specHelper.ts +0 -316
- package/src/tools/stackTrace/computeStackTrace.spec.ts +0 -1007
- package/src/tools/stackTrace/handlingStack.spec.ts +0 -20
- package/src/tools/taskQueue.spec.ts +0 -60
- package/src/tools/timer.spec.ts +0 -76
- package/src/tools/utils/browserDetection.spec.ts +0 -120
- package/src/tools/utils/byteUtils.spec.ts +0 -29
- package/src/tools/utils/functionUtils.spec.ts +0 -229
- package/src/tools/utils/numberUtils.spec.ts +0 -27
- package/src/tools/utils/stringUtils.spec.ts +0 -74
- package/src/tools/utils/typeUtils.spec.ts +0 -25
- package/src/tools/utils/urlPolyfill.spec.ts +0 -55
- package/src/tools/valueHistory.spec.ts +0 -180
- package/src/transport/batch.spec.ts +0 -261
- package/src/transport/eventBridge.spec.ts +0 -90
- package/src/transport/flushController.spec.ts +0 -267
- package/src/transport/httpRequest.spec.ts +0 -400
- 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
|
-
})
|