diff --git a/packages/rum-core/src/boot/preStartRum.ts b/packages/rum-core/src/boot/preStartRum.ts index afd936adc8..7f25882199 100644 --- a/packages/rum-core/src/boot/preStartRum.ts +++ b/packages/rum-core/src/boot/preStartRum.ts @@ -16,7 +16,7 @@ import { initFetchObservable, } from '@datadog/browser-core' import type { TrackingConsentState, DeflateWorker } from '@datadog/browser-core' -import { DeflateWorkerStatus, getDeflateWorkerStatus } from '../../../rum/src/domain/deflate' +import { DeflateWorkerStatus, getDeflateWorkerStatus } from '../domain/deflate' import { validateAndBuildRumConfiguration, type RumConfiguration, diff --git a/packages/rum-core/src/boot/rumPublicApi.ts b/packages/rum-core/src/boot/rumPublicApi.ts index 2f00571a64..7824ef4763 100644 --- a/packages/rum-core/src/boot/rumPublicApi.ts +++ b/packages/rum-core/src/boot/rumPublicApi.ts @@ -32,7 +32,7 @@ import { createTrackingConsentState, timeStampToClocks, } from '@datadog/browser-core' -import { DeflateWorkerStatus, getDeflateWorkerStatus } from '../../../rum/src/domain/deflate' +import { DeflateWorkerStatus, getDeflateWorkerStatus } from '../domain/deflate' import type { LifeCycle } from '../domain/lifeCycle' import type { ViewHistory } from '../domain/contexts/viewHistory' import type { RumSessionManager } from '../domain/rumSessionManager' diff --git a/packages/rum/src/domain/deflate/deflateEncoder.spec.ts b/packages/rum-core/src/domain/deflate/deflateEncoder.spec.ts similarity index 100% rename from packages/rum/src/domain/deflate/deflateEncoder.spec.ts rename to packages/rum-core/src/domain/deflate/deflateEncoder.spec.ts diff --git a/packages/rum/src/domain/deflate/deflateEncoder.ts b/packages/rum-core/src/domain/deflate/deflateEncoder.ts similarity index 98% rename from packages/rum/src/domain/deflate/deflateEncoder.ts rename to packages/rum-core/src/domain/deflate/deflateEncoder.ts index 6d357b1fd2..a20804240f 100644 --- a/packages/rum/src/domain/deflate/deflateEncoder.ts +++ b/packages/rum-core/src/domain/deflate/deflateEncoder.ts @@ -5,8 +5,8 @@ import type { DeflateWorker, EncoderResult, } from '@datadog/browser-core' -import type { RumConfiguration } from '@datadog/browser-rum-core' import { addEventListener, addTelemetryDebug, assign, concatBuffers } from '@datadog/browser-core' +import type { RumConfiguration } from '../configuration' export function createDeflateEncoder( configuration: RumConfiguration, diff --git a/packages/rum/src/domain/deflate/deflateWorker.spec.ts b/packages/rum-core/src/domain/deflate/deflateWorker.spec.ts similarity index 100% rename from packages/rum/src/domain/deflate/deflateWorker.spec.ts rename to packages/rum-core/src/domain/deflate/deflateWorker.spec.ts diff --git a/packages/rum/src/domain/deflate/deflateWorker.ts b/packages/rum-core/src/domain/deflate/deflateWorker.ts similarity index 99% rename from packages/rum/src/domain/deflate/deflateWorker.ts rename to packages/rum-core/src/domain/deflate/deflateWorker.ts index 52dfd977cf..61859d5d3e 100644 --- a/packages/rum/src/domain/deflate/deflateWorker.ts +++ b/packages/rum-core/src/domain/deflate/deflateWorker.ts @@ -8,7 +8,7 @@ import { ONE_SECOND, DOCS_ORIGIN, } from '@datadog/browser-core' -import type { RumConfiguration } from '@datadog/browser-rum-core' +import type { RumConfiguration } from '../configuration' export const INITIALIZATION_TIME_OUT_DELAY = 30 * ONE_SECOND diff --git a/packages/rum/src/domain/deflate/index.ts b/packages/rum-core/src/domain/deflate/index.ts similarity index 100% rename from packages/rum/src/domain/deflate/index.ts rename to packages/rum-core/src/domain/deflate/index.ts diff --git a/packages/rum-core/src/index.ts b/packages/rum-core/src/index.ts index c7687443b7..0a1b50a6f0 100644 --- a/packages/rum-core/src/index.ts +++ b/packages/rum-core/src/index.ts @@ -40,3 +40,4 @@ export * from './domain/privacy' export { SessionReplayState } from './domain/rumSessionManager' export type { RumPlugin } from './domain/plugins' export type { MouseEventOnElement } from './domain/action/listenActionEvents' +export * from './domain/deflate' diff --git a/packages/rum-core/test/index.ts b/packages/rum-core/test/index.ts index fcd3ab5cc6..52239fcda2 100644 --- a/packages/rum-core/test/index.ts +++ b/packages/rum-core/test/index.ts @@ -12,3 +12,4 @@ export * from './mockPageStateHistory' export * from './mockRumConfiguration' export * from './locationChangeSetup' export * from './mockContexts' +export * from './mockWorker' diff --git a/packages/rum/test/mockWorker.ts b/packages/rum-core/test/mockWorker.ts similarity index 98% rename from packages/rum/test/mockWorker.ts rename to packages/rum-core/test/mockWorker.ts index 9c94d94b09..71921133e3 100644 --- a/packages/rum/test/mockWorker.ts +++ b/packages/rum-core/test/mockWorker.ts @@ -1,6 +1,6 @@ import type { DeflateWorker, DeflateWorkerAction, DeflateWorkerResponse } from '@datadog/browser-core' +import { createNewEvent } from '@datadog/browser-core/test' import { string2buf } from '../../worker/src/domain/deflate' -import { createNewEvent } from '../../core/test' type DeflateWorkerListener = (event: { data: DeflateWorkerResponse }) => void diff --git a/packages/rum/src/boot/recorderApi.spec.ts b/packages/rum/src/boot/recorderApi.spec.ts index 87a0e756ae..8fdf3d9366 100644 --- a/packages/rum/src/boot/recorderApi.spec.ts +++ b/packages/rum/src/boot/recorderApi.spec.ts @@ -1,8 +1,9 @@ import type { DeflateEncoder, DeflateWorker, DeflateWorkerAction } from '@datadog/browser-core' import { BridgeCapability, PageExitReason, display, isIE } from '@datadog/browser-core' -import type { RecorderApi, RumSessionManager } from '@datadog/browser-rum-core' -import { LifeCycle, LifeCycleEventType } from '@datadog/browser-rum-core' +import type { RecorderApi, RumSessionManager, CreateDeflateWorker } from '@datadog/browser-rum-core' +import { LifeCycle, LifeCycleEventType, resetDeflateWorkerState } from '@datadog/browser-rum-core' import { mockEventBridge, registerCleanupTask } from '@datadog/browser-core/test' +import { MockWorker } from '@datadog/browser-rum-core/test' import type { RumSessionManagerMock } from '../../../rum-core/test' import { createRumSessionManagerMock, @@ -10,9 +11,6 @@ import { mockRumConfiguration, mockViewHistory, } from '../../../rum-core/test' -import type { CreateDeflateWorker } from '../domain/deflate' -import { MockWorker } from '../../test' -import { resetDeflateWorkerState } from '../domain/deflate' import * as replayStats from '../domain/replayStats' import type { StartRecording } from './recorderApi' import { makeRecorderApi } from './recorderApi' diff --git a/packages/rum/src/boot/recorderApi.ts b/packages/rum/src/boot/recorderApi.ts index 2a330aad1b..d847ce082d 100644 --- a/packages/rum/src/boot/recorderApi.ts +++ b/packages/rum/src/boot/recorderApi.ts @@ -15,17 +15,18 @@ import type { RecorderApi, RumConfiguration, StartRecordingOptions, + CreateDeflateWorker, } from '@datadog/browser-rum-core' -import { LifeCycleEventType, SessionReplayState } from '@datadog/browser-rum-core' -import { getReplayStats as getReplayStatsImpl } from '../domain/replayStats' -import { getSessionReplayLink } from '../domain/getSessionReplayLink' -import type { CreateDeflateWorker } from '../domain/deflate' import { + LifeCycleEventType, + SessionReplayState, createDeflateEncoder, startDeflateWorker, DeflateWorkerStatus, getDeflateWorkerStatus, -} from '../domain/deflate' +} from '@datadog/browser-rum-core' +import { getReplayStats as getReplayStatsImpl } from '../domain/replayStats' +import { getSessionReplayLink } from '../domain/getSessionReplayLink' import type { startRecording } from './startRecording' import { isBrowserSupported } from './isBrowserSupported' diff --git a/packages/rum/src/boot/startRecording.spec.ts b/packages/rum/src/boot/startRecording.spec.ts index 5f3e6328a4..b5e603ee73 100644 --- a/packages/rum/src/boot/startRecording.spec.ts +++ b/packages/rum/src/boot/startRecording.spec.ts @@ -1,7 +1,14 @@ import type { TimeStamp, HttpRequest } from '@datadog/browser-core' import { PageExitReason, DefaultPrivacyLevel, noop, isIE, DeflateEncoderStreamId } from '@datadog/browser-core' import type { ViewCreatedEvent } from '@datadog/browser-rum-core' -import { LifeCycle, LifeCycleEventType, startViewHistory } from '@datadog/browser-rum-core' +import { + createDeflateEncoder, + LifeCycle, + LifeCycleEventType, + resetDeflateWorkerState, + startDeflateWorker, + startViewHistory, +} from '@datadog/browser-rum-core' import { collectAsyncCalls, createNewEvent, mockEventBridge, registerCleanupTask } from '@datadog/browser-core/test' import type { ViewEndedEvent } from 'packages/rum-core/src/domain/view/trackViews' import type { RumSessionManagerMock } from '../../../rum-core/test' @@ -12,7 +19,6 @@ import { setSegmentBytesLimit } from '../domain/segmentCollection' import { RecordType } from '../types' import { resetReplayStats } from '../domain/replayStats' -import { createDeflateEncoder, resetDeflateWorkerState, startDeflateWorker } from '../domain/deflate' import { startRecording } from './startRecording' const VIEW_TIMESTAMP = 1 as TimeStamp diff --git a/packages/rum/src/domain/segmentCollection/segment.spec.ts b/packages/rum/src/domain/segmentCollection/segment.spec.ts index 067a1c2002..f1615bde57 100644 --- a/packages/rum/src/domain/segmentCollection/segment.spec.ts +++ b/packages/rum/src/domain/segmentCollection/segment.spec.ts @@ -1,12 +1,11 @@ import type { DeflateEncoder, TimeStamp } from '@datadog/browser-core' import { noop, setDebugMode, isIE, DeflateEncoderStreamId } from '@datadog/browser-core' -import type { RumConfiguration } from '@datadog/browser-rum-core' +import { createDeflateEncoder, type RumConfiguration } from '@datadog/browser-rum-core' import { registerCleanupTask } from '@datadog/browser-core/test' -import { MockWorker } from '../../../test' +import { MockWorker } from '@datadog/browser-rum-core/test' import type { CreationReason, BrowserRecord, SegmentContext, BrowserSegment, BrowserSegmentMetadata } from '../../types' import { RecordType } from '../../types' import { getReplayStats, resetReplayStats } from '../replayStats' -import { createDeflateEncoder } from '../deflate' import type { AddRecordCallback, FlushCallback, Segment } from './segment' import { createSegment } from './segment' diff --git a/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts b/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts index 979354528b..eadd0e09ad 100644 --- a/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts +++ b/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts @@ -1,14 +1,13 @@ import type { ClocksState, HttpRequest, TimeStamp } from '@datadog/browser-core' import { DeflateEncoderStreamId, PageExitReason, isIE } from '@datadog/browser-core' import type { ViewHistory, ViewHistoryEntry, RumConfiguration } from '@datadog/browser-rum-core' -import { LifeCycle, LifeCycleEventType } from '@datadog/browser-rum-core' +import { createDeflateEncoder, LifeCycle, LifeCycleEventType } from '@datadog/browser-rum-core' import type { Clock } from '@datadog/browser-core/test' import { mockClock, registerCleanupTask, restorePageVisibility } from '@datadog/browser-core/test' -import { createRumSessionManagerMock } from '../../../../rum-core/test' +import { createRumSessionManagerMock, MockWorker } from '../../../../rum-core/test' import type { BrowserRecord, SegmentContext } from '../../types' import { RecordType } from '../../types' -import { MockWorker, readMetadataFromReplayPayload } from '../../../test' -import { createDeflateEncoder } from '../deflate' +import { readMetadataFromReplayPayload } from '../../../test' import { computeSegmentContext, doStartSegmentCollection, diff --git a/packages/rum/src/entries/main.ts b/packages/rum/src/entries/main.ts index 895cc7509e..bb20c0816a 100644 --- a/packages/rum/src/entries/main.ts +++ b/packages/rum/src/entries/main.ts @@ -1,11 +1,10 @@ // Keep the following in sync with packages/rum-slim/src/entries/main.ts import { defineGlobal, getGlobalObject } from '@datadog/browser-core' import type { RumPublicApi } from '@datadog/browser-rum-core' -import { makeRumPublicApi, startRum } from '@datadog/browser-rum-core' +import { makeRumPublicApi, startRum, startDeflateWorker, createDeflateEncoder } from '@datadog/browser-rum-core' import { startRecording } from '../boot/startRecording' import { makeRecorderApi } from '../boot/recorderApi' -import { createDeflateEncoder, startDeflateWorker } from '../domain/deflate' export { CommonProperties, diff --git a/packages/rum/test/index.ts b/packages/rum/test/index.ts index 227e480f65..4d47ce9e76 100644 --- a/packages/rum/test/index.ts +++ b/packages/rum/test/index.ts @@ -1,4 +1,3 @@ -export * from './mockWorker' export * from './recordsPerFullSnapshot' export * from './mutationPayloadValidator' export * from './nodes'