@depup/datadog__browser-rum 6.31.0-depup.0
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/LICENSE +201 -0
- package/README.md +25 -0
- package/bundle/chunks/profiler-9f1c1103f1ef0aa98257-datadog-rum.js +1 -0
- package/bundle/chunks/recorder-926b641c6ef51d09a378-datadog-rum.js +1 -0
- package/bundle/datadog-rum.js +1 -0
- package/changes.json +5 -0
- package/cjs/boot/isBrowserSupported.d.ts +4 -0
- package/cjs/boot/isBrowserSupported.js +17 -0
- package/cjs/boot/isBrowserSupported.js.map +1 -0
- package/cjs/boot/lazyLoadProfiler.d.ts +3 -0
- package/cjs/boot/lazyLoadProfiler.js +56 -0
- package/cjs/boot/lazyLoadProfiler.js.map +1 -0
- package/cjs/boot/lazyLoadRecorder.d.ts +3 -0
- package/cjs/boot/lazyLoadRecorder.js +56 -0
- package/cjs/boot/lazyLoadRecorder.js.map +1 -0
- package/cjs/boot/postStartStrategy.d.ts +33 -0
- package/cjs/boot/postStartStrategy.js +98 -0
- package/cjs/boot/postStartStrategy.js.map +1 -0
- package/cjs/boot/preStartStrategy.d.ts +6 -0
- package/cjs/boot/preStartStrategy.js +24 -0
- package/cjs/boot/preStartStrategy.js.map +1 -0
- package/cjs/boot/profilerApi.d.ts +2 -0
- package/cjs/boot/profilerApi.js +52 -0
- package/cjs/boot/profilerApi.js.map +1 -0
- package/cjs/boot/recorderApi.d.ts +3 -0
- package/cjs/boot/recorderApi.js +71 -0
- package/cjs/boot/recorderApi.js.map +1 -0
- package/cjs/boot/startRecording.d.ts +6 -0
- package/cjs/boot/startRecording.js +45 -0
- package/cjs/boot/startRecording.js.map +1 -0
- package/cjs/domain/deflate/deflateEncoder.d.ts +3 -0
- package/cjs/domain/deflate/deflateEncoder.js +110 -0
- package/cjs/domain/deflate/deflateEncoder.js.map +1 -0
- package/cjs/domain/deflate/deflateWorker.d.ts +29 -0
- package/cjs/domain/deflate/deflateWorker.js +105 -0
- package/cjs/domain/deflate/deflateWorker.js.map +1 -0
- package/cjs/domain/deflate/index.d.ts +3 -0
- package/cjs/domain/deflate/index.js +11 -0
- package/cjs/domain/deflate/index.js.map +1 -0
- package/cjs/domain/getSessionReplayLink.d.ts +2 -0
- package/cjs/domain/getSessionReplayLink.js +35 -0
- package/cjs/domain/getSessionReplayLink.js.map +1 -0
- package/cjs/domain/profiling/actionHistory.d.ts +10 -0
- package/cjs/domain/profiling/actionHistory.js +49 -0
- package/cjs/domain/profiling/actionHistory.js.map +1 -0
- package/cjs/domain/profiling/longTaskHistory.d.ts +11 -0
- package/cjs/domain/profiling/longTaskHistory.js +28 -0
- package/cjs/domain/profiling/longTaskHistory.js.map +1 -0
- package/cjs/domain/profiling/profiler.d.ts +7 -0
- package/cjs/domain/profiling/profiler.js +267 -0
- package/cjs/domain/profiling/profiler.js.map +1 -0
- package/cjs/domain/profiling/profilingContext.d.ts +6 -0
- package/cjs/domain/profiling/profilingContext.js +31 -0
- package/cjs/domain/profiling/profilingContext.js.map +1 -0
- package/cjs/domain/profiling/profilingSupported.d.ts +1 -0
- package/cjs/domain/profiling/profilingSupported.js +11 -0
- package/cjs/domain/profiling/profilingSupported.js.map +1 -0
- package/cjs/domain/profiling/test-utils/mockedTrace.d.ts +3 -0
- package/cjs/domain/profiling/test-utils/mockedTrace.js +57 -0
- package/cjs/domain/profiling/test-utils/mockedTrace.js.map +1 -0
- package/cjs/domain/profiling/transport/assembly.d.ts +7 -0
- package/cjs/domain/profiling/transport/assembly.js +45 -0
- package/cjs/domain/profiling/transport/assembly.js.map +1 -0
- package/cjs/domain/profiling/transport/buildProfileEventAttributes.d.ts +33 -0
- package/cjs/domain/profiling/transport/buildProfileEventAttributes.js +63 -0
- package/cjs/domain/profiling/transport/buildProfileEventAttributes.js.map +1 -0
- package/cjs/domain/profiling/types/index.d.ts +2 -0
- package/cjs/domain/profiling/types/index.js +3 -0
- package/cjs/domain/profiling/types/index.js.map +1 -0
- package/cjs/domain/profiling/types/profilerApi.types.d.ts +58 -0
- package/cjs/domain/profiling/types/profilerApi.types.js +5 -0
- package/cjs/domain/profiling/types/profilerApi.types.js.map +1 -0
- package/cjs/domain/profiling/types/rumProfiler.types.d.ts +55 -0
- package/cjs/domain/profiling/types/rumProfiler.types.js +3 -0
- package/cjs/domain/profiling/types/rumProfiler.types.js.map +1 -0
- package/cjs/domain/profiling/utils/getCustomOrDefaultViewName.d.ts +1 -0
- package/cjs/domain/profiling/utils/getCustomOrDefaultViewName.js +7 -0
- package/cjs/domain/profiling/utils/getCustomOrDefaultViewName.js.map +1 -0
- package/cjs/domain/profiling/utils/getDefaultViewName.d.ts +1 -0
- package/cjs/domain/profiling/utils/getDefaultViewName.js +14 -0
- package/cjs/domain/profiling/utils/getDefaultViewName.js.map +1 -0
- package/cjs/domain/profiling/utils/getNumberOfSamples.d.ts +8 -0
- package/cjs/domain/profiling/utils/getNumberOfSamples.js +19 -0
- package/cjs/domain/profiling/utils/getNumberOfSamples.js.map +1 -0
- package/cjs/domain/profiling/vitalHistory.d.ts +10 -0
- package/cjs/domain/profiling/vitalHistory.js +42 -0
- package/cjs/domain/profiling/vitalHistory.js.map +1 -0
- package/cjs/domain/record/assembly.d.ts +3 -0
- package/cjs/domain/record/assembly.js +16 -0
- package/cjs/domain/record/assembly.js.map +1 -0
- package/cjs/domain/record/elementsScrollPositions.d.ts +10 -0
- package/cjs/domain/record/elementsScrollPositions.js +23 -0
- package/cjs/domain/record/elementsScrollPositions.js.map +1 -0
- package/cjs/domain/record/eventsUtils.d.ts +2 -0
- package/cjs/domain/record/eventsUtils.js +15 -0
- package/cjs/domain/record/eventsUtils.js.map +1 -0
- package/cjs/domain/record/index.d.ts +6 -0
- package/cjs/domain/record/index.js +17 -0
- package/cjs/domain/record/index.js.map +1 -0
- package/cjs/domain/record/internalApi.d.ts +22 -0
- package/cjs/domain/record/internalApi.js +55 -0
- package/cjs/domain/record/internalApi.js.map +1 -0
- package/cjs/domain/record/itemIds.d.ts +40 -0
- package/cjs/domain/record/itemIds.js +58 -0
- package/cjs/domain/record/itemIds.js.map +1 -0
- package/cjs/domain/record/mutationBatch.d.ts +12 -0
- package/cjs/domain/record/mutationBatch.js +44 -0
- package/cjs/domain/record/mutationBatch.js.map +1 -0
- package/cjs/domain/record/record.d.ts +16 -0
- package/cjs/domain/record/record.js +88 -0
- package/cjs/domain/record/record.js.map +1 -0
- package/cjs/domain/record/record.types.d.ts +18 -0
- package/cjs/domain/record/record.types.js +3 -0
- package/cjs/domain/record/record.types.js.map +1 -0
- package/cjs/domain/record/recordingScope.d.ts +24 -0
- package/cjs/domain/record/recordingScope.js +29 -0
- package/cjs/domain/record/recordingScope.js.map +1 -0
- package/cjs/domain/record/serialization/changeEncoder.d.ts +22 -0
- package/cjs/domain/record/serialization/changeEncoder.js +59 -0
- package/cjs/domain/record/serialization/changeEncoder.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/changeConverter.d.ts +10 -0
- package/cjs/domain/record/serialization/conversions/changeConverter.js +216 -0
- package/cjs/domain/record/serialization/conversions/changeConverter.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/changeDecoder.d.ts +16 -0
- package/cjs/domain/record/serialization/conversions/changeDecoder.js +137 -0
- package/cjs/domain/record/serialization/conversions/changeDecoder.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/index.d.ts +7 -0
- package/cjs/domain/record/serialization/conversions/index.js +11 -0
- package/cjs/domain/record/serialization/conversions/index.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/mutationLog.d.ts +15 -0
- package/cjs/domain/record/serialization/conversions/mutationLog.js +36 -0
- package/cjs/domain/record/serialization/conversions/mutationLog.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/nodeIdRemapper.d.ts +10 -0
- package/cjs/domain/record/serialization/conversions/nodeIdRemapper.js +53 -0
- package/cjs/domain/record/serialization/conversions/nodeIdRemapper.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/renderOptions.d.ts +6 -0
- package/cjs/domain/record/serialization/conversions/renderOptions.js +12 -0
- package/cjs/domain/record/serialization/conversions/renderOptions.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/stringTable.d.ts +5 -0
- package/cjs/domain/record/serialization/conversions/stringTable.js +22 -0
- package/cjs/domain/record/serialization/conversions/stringTable.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/vDocument.d.ts +23 -0
- package/cjs/domain/record/serialization/conversions/vDocument.js +176 -0
- package/cjs/domain/record/serialization/conversions/vDocument.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/vNode.d.ts +66 -0
- package/cjs/domain/record/serialization/conversions/vNode.js +285 -0
- package/cjs/domain/record/serialization/conversions/vNode.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/vStyleSheet.d.ts +16 -0
- package/cjs/domain/record/serialization/conversions/vStyleSheet.js +29 -0
- package/cjs/domain/record/serialization/conversions/vStyleSheet.js.map +1 -0
- package/cjs/domain/record/serialization/experimentalFeatures.d.ts +2 -0
- package/cjs/domain/record/serialization/experimentalFeatures.js +16 -0
- package/cjs/domain/record/serialization/experimentalFeatures.js.map +1 -0
- package/cjs/domain/record/serialization/index.d.ts +17 -0
- package/cjs/domain/record/serialization/index.js +37 -0
- package/cjs/domain/record/serialization/index.js.map +1 -0
- package/cjs/domain/record/serialization/insertionCursor.d.ts +57 -0
- package/cjs/domain/record/serialization/insertionCursor.js +68 -0
- package/cjs/domain/record/serialization/insertionCursor.js.map +1 -0
- package/cjs/domain/record/serialization/serialization.types.d.ts +24 -0
- package/cjs/domain/record/serialization/serialization.types.js +3 -0
- package/cjs/domain/record/serialization/serialization.types.js.map +1 -0
- package/cjs/domain/record/serialization/serializationStats.d.ts +12 -0
- package/cjs/domain/record/serialization/serializationStats.js +32 -0
- package/cjs/domain/record/serialization/serializationStats.js.map +1 -0
- package/cjs/domain/record/serialization/serializationTransaction.d.ts +96 -0
- package/cjs/domain/record/serialization/serializationTransaction.js +103 -0
- package/cjs/domain/record/serialization/serializationTransaction.js.map +1 -0
- package/cjs/domain/record/serialization/serializationUtils.d.ts +18 -0
- package/cjs/domain/record/serialization/serializationUtils.js +88 -0
- package/cjs/domain/record/serialization/serializationUtils.js.map +1 -0
- package/cjs/domain/record/serialization/serializeAttribute.d.ts +4 -0
- package/cjs/domain/record/serialization/serializeAttribute.js +42 -0
- package/cjs/domain/record/serialization/serializeAttribute.js.map +1 -0
- package/cjs/domain/record/serialization/serializeAttributes.d.ts +7 -0
- package/cjs/domain/record/serialization/serializeAttributes.js +167 -0
- package/cjs/domain/record/serialization/serializeAttributes.js.map +1 -0
- package/cjs/domain/record/serialization/serializeFullSnapshot.d.ts +5 -0
- package/cjs/domain/record/serialization/serializeFullSnapshot.js +34 -0
- package/cjs/domain/record/serialization/serializeFullSnapshot.js.map +1 -0
- package/cjs/domain/record/serialization/serializeFullSnapshotAsChange.d.ts +5 -0
- package/cjs/domain/record/serialization/serializeFullSnapshotAsChange.js +13 -0
- package/cjs/domain/record/serialization/serializeFullSnapshotAsChange.js.map +1 -0
- package/cjs/domain/record/serialization/serializeMutations.d.ts +11 -0
- package/cjs/domain/record/serialization/serializeMutations.js +262 -0
- package/cjs/domain/record/serialization/serializeMutations.js.map +1 -0
- package/cjs/domain/record/serialization/serializeMutationsAsChange.d.ts +5 -0
- package/cjs/domain/record/serialization/serializeMutationsAsChange.js +204 -0
- package/cjs/domain/record/serialization/serializeMutationsAsChange.js.map +1 -0
- package/cjs/domain/record/serialization/serializeNode.d.ts +7 -0
- package/cjs/domain/record/serialization/serializeNode.js +154 -0
- package/cjs/domain/record/serialization/serializeNode.js.map +1 -0
- package/cjs/domain/record/serialization/serializeNodeAsChange.d.ts +4 -0
- package/cjs/domain/record/serialization/serializeNodeAsChange.js +153 -0
- package/cjs/domain/record/serialization/serializeNodeAsChange.js.map +1 -0
- package/cjs/domain/record/serialization/serializeStyleSheets.d.ts +3 -0
- package/cjs/domain/record/serialization/serializeStyleSheets.js +30 -0
- package/cjs/domain/record/serialization/serializeStyleSheets.js.map +1 -0
- package/cjs/domain/record/serializationVerifier.d.ts +18 -0
- package/cjs/domain/record/serializationVerifier.js +126 -0
- package/cjs/domain/record/serializationVerifier.js.map +1 -0
- package/cjs/domain/record/shadowRootsController.d.ts +11 -0
- package/cjs/domain/record/shadowRootsController.js +45 -0
- package/cjs/domain/record/shadowRootsController.js.map +1 -0
- package/cjs/domain/record/startFullSnapshots.d.ts +10 -0
- package/cjs/domain/record/startFullSnapshots.js +50 -0
- package/cjs/domain/record/startFullSnapshots.js.map +1 -0
- package/cjs/domain/record/trackers/index.d.ts +12 -0
- package/cjs/domain/record/trackers/index.js +27 -0
- package/cjs/domain/record/trackers/index.js.map +1 -0
- package/cjs/domain/record/trackers/trackFocus.d.ts +5 -0
- package/cjs/domain/record/trackers/trackFocus.js +15 -0
- package/cjs/domain/record/trackers/trackFocus.js.map +1 -0
- package/cjs/domain/record/trackers/trackFrustration.d.ts +6 -0
- package/cjs/domain/record/trackers/trackFrustration.js +31 -0
- package/cjs/domain/record/trackers/trackFrustration.js.map +1 -0
- package/cjs/domain/record/trackers/trackInput.d.ts +4 -0
- package/cjs/domain/record/trackers/trackInput.js +104 -0
- package/cjs/domain/record/trackers/trackInput.js.map +1 -0
- package/cjs/domain/record/trackers/trackMediaInteraction.d.ts +5 -0
- package/cjs/domain/record/trackers/trackMediaInteraction.js +29 -0
- package/cjs/domain/record/trackers/trackMediaInteraction.js.map +1 -0
- package/cjs/domain/record/trackers/trackMouseInteraction.d.ts +5 -0
- package/cjs/domain/record/trackers/trackMouseInteraction.js +59 -0
- package/cjs/domain/record/trackers/trackMouseInteraction.js.map +1 -0
- package/cjs/domain/record/trackers/trackMove.d.ts +9 -0
- package/cjs/domain/record/trackers/trackMove.js +55 -0
- package/cjs/domain/record/trackers/trackMove.js.map +1 -0
- package/cjs/domain/record/trackers/trackMutation.d.ts +13 -0
- package/cjs/domain/record/trackers/trackMutation.js +41 -0
- package/cjs/domain/record/trackers/trackMutation.js.map +1 -0
- package/cjs/domain/record/trackers/trackScroll.d.ts +5 -0
- package/cjs/domain/record/trackers/trackScroll.js +48 -0
- package/cjs/domain/record/trackers/trackScroll.js.map +1 -0
- package/cjs/domain/record/trackers/trackStyleSheet.d.ts +6 -0
- package/cjs/domain/record/trackers/trackStyleSheet.js +89 -0
- package/cjs/domain/record/trackers/trackStyleSheet.js.map +1 -0
- package/cjs/domain/record/trackers/trackViewEnd.d.ts +5 -0
- package/cjs/domain/record/trackers/trackViewEnd.js +20 -0
- package/cjs/domain/record/trackers/trackViewEnd.js.map +1 -0
- package/cjs/domain/record/trackers/trackViewportResize.d.ts +6 -0
- package/cjs/domain/record/trackers/trackViewportResize.js +46 -0
- package/cjs/domain/record/trackers/trackViewportResize.js.map +1 -0
- package/cjs/domain/record/trackers/tracker.types.d.ts +3 -0
- package/cjs/domain/record/trackers/tracker.types.js +3 -0
- package/cjs/domain/record/trackers/tracker.types.js.map +1 -0
- package/cjs/domain/record/viewports.d.ts +20 -0
- package/cjs/domain/record/viewports.js +60 -0
- package/cjs/domain/record/viewports.js.map +1 -0
- package/cjs/domain/replayStats.d.ts +8 -0
- package/cjs/domain/replayStats.js +60 -0
- package/cjs/domain/replayStats.js.map +1 -0
- package/cjs/domain/scriptLoadingError.d.ts +6 -0
- package/cjs/domain/scriptLoadingError.js +26 -0
- package/cjs/domain/scriptLoadingError.js.map +1 -0
- package/cjs/domain/segmentCollection/buildReplayPayload.d.ts +15 -0
- package/cjs/domain/segmentCollection/buildReplayPayload.js +26 -0
- package/cjs/domain/segmentCollection/buildReplayPayload.js.map +1 -0
- package/cjs/domain/segmentCollection/index.d.ts +4 -0
- package/cjs/domain/segmentCollection/index.js +11 -0
- package/cjs/domain/segmentCollection/index.js.map +1 -0
- package/cjs/domain/segmentCollection/segment.d.ts +16 -0
- package/cjs/domain/segmentCollection/segment.js +82 -0
- package/cjs/domain/segmentCollection/segment.js.map +1 -0
- package/cjs/domain/segmentCollection/segmentCollection.d.ts +31 -0
- package/cjs/domain/segmentCollection/segmentCollection.js +113 -0
- package/cjs/domain/segmentCollection/segmentCollection.js.map +1 -0
- package/cjs/domain/segmentCollection/startSegmentTelemetry.d.ts +6 -0
- package/cjs/domain/segmentCollection/startSegmentTelemetry.js +52 -0
- package/cjs/domain/segmentCollection/startSegmentTelemetry.js.map +1 -0
- package/cjs/domain/startRecordBridge.d.ts +5 -0
- package/cjs/domain/startRecordBridge.js +17 -0
- package/cjs/domain/startRecordBridge.js.map +1 -0
- package/cjs/domain/startRecorderInitTelemetry.d.ts +15 -0
- package/cjs/domain/startRecorderInitTelemetry.js +55 -0
- package/cjs/domain/startRecorderInitTelemetry.js.map +1 -0
- package/cjs/entries/internal.d.ts +11 -0
- package/cjs/entries/internal.js +28 -0
- package/cjs/entries/internal.js.map +1 -0
- package/cjs/entries/internalSynthetics.d.ts +2 -0
- package/cjs/entries/internalSynthetics.js +27 -0
- package/cjs/entries/internalSynthetics.js.map +1 -0
- package/cjs/entries/main.d.ts +23 -0
- package/cjs/entries/main.js +35 -0
- package/cjs/entries/main.js.map +1 -0
- package/cjs/types/index.d.ts +3 -0
- package/cjs/types/index.js +18 -0
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/profiling.d.ts +296 -0
- package/cjs/types/profiling.js +6 -0
- package/cjs/types/profiling.js.map +1 -0
- package/cjs/types/sessionReplay.d.ts +934 -0
- package/cjs/types/sessionReplay.js +6 -0
- package/cjs/types/sessionReplay.js.map +1 -0
- package/cjs/types/sessionReplayConstants.d.ts +71 -0
- package/cjs/types/sessionReplayConstants.js +67 -0
- package/cjs/types/sessionReplayConstants.js.map +1 -0
- package/esm/boot/isBrowserSupported.d.ts +4 -0
- package/esm/boot/isBrowserSupported.js +14 -0
- package/esm/boot/isBrowserSupported.js.map +1 -0
- package/esm/boot/lazyLoadProfiler.d.ts +3 -0
- package/esm/boot/lazyLoadProfiler.js +19 -0
- package/esm/boot/lazyLoadProfiler.js.map +1 -0
- package/esm/boot/lazyLoadRecorder.d.ts +3 -0
- package/esm/boot/lazyLoadRecorder.js +19 -0
- package/esm/boot/lazyLoadRecorder.js.map +1 -0
- package/esm/boot/postStartStrategy.d.ts +33 -0
- package/esm/boot/postStartStrategy.js +95 -0
- package/esm/boot/postStartStrategy.js.map +1 -0
- package/esm/boot/preStartStrategy.d.ts +6 -0
- package/esm/boot/preStartStrategy.js +21 -0
- package/esm/boot/preStartStrategy.js.map +1 -0
- package/esm/boot/profilerApi.d.ts +2 -0
- package/esm/boot/profilerApi.js +49 -0
- package/esm/boot/profilerApi.js.map +1 -0
- package/esm/boot/recorderApi.d.ts +3 -0
- package/esm/boot/recorderApi.js +68 -0
- package/esm/boot/recorderApi.js.map +1 -0
- package/esm/boot/startRecording.d.ts +6 -0
- package/esm/boot/startRecording.js +42 -0
- package/esm/boot/startRecording.js.map +1 -0
- package/esm/domain/deflate/deflateEncoder.d.ts +3 -0
- package/esm/domain/deflate/deflateEncoder.js +107 -0
- package/esm/domain/deflate/deflateEncoder.js.map +1 -0
- package/esm/domain/deflate/deflateWorker.d.ts +29 -0
- package/esm/domain/deflate/deflateWorker.js +97 -0
- package/esm/domain/deflate/deflateWorker.js.map +1 -0
- package/esm/domain/deflate/index.d.ts +3 -0
- package/esm/domain/deflate/index.js +3 -0
- package/esm/domain/deflate/index.js.map +1 -0
- package/esm/domain/getSessionReplayLink.d.ts +2 -0
- package/esm/domain/getSessionReplayLink.js +32 -0
- package/esm/domain/getSessionReplayLink.js.map +1 -0
- package/esm/domain/profiling/actionHistory.d.ts +10 -0
- package/esm/domain/profiling/actionHistory.js +45 -0
- package/esm/domain/profiling/actionHistory.js.map +1 -0
- package/esm/domain/profiling/longTaskHistory.d.ts +11 -0
- package/esm/domain/profiling/longTaskHistory.js +24 -0
- package/esm/domain/profiling/longTaskHistory.js.map +1 -0
- package/esm/domain/profiling/profiler.d.ts +7 -0
- package/esm/domain/profiling/profiler.js +263 -0
- package/esm/domain/profiling/profiler.js.map +1 -0
- package/esm/domain/profiling/profilingContext.d.ts +6 -0
- package/esm/domain/profiling/profilingContext.js +28 -0
- package/esm/domain/profiling/profilingContext.js.map +1 -0
- package/esm/domain/profiling/profilingSupported.d.ts +1 -0
- package/esm/domain/profiling/profilingSupported.js +8 -0
- package/esm/domain/profiling/profilingSupported.js.map +1 -0
- package/esm/domain/profiling/test-utils/mockedTrace.d.ts +3 -0
- package/esm/domain/profiling/test-utils/mockedTrace.js +54 -0
- package/esm/domain/profiling/test-utils/mockedTrace.js.map +1 -0
- package/esm/domain/profiling/transport/assembly.d.ts +7 -0
- package/esm/domain/profiling/transport/assembly.js +42 -0
- package/esm/domain/profiling/transport/assembly.js.map +1 -0
- package/esm/domain/profiling/transport/buildProfileEventAttributes.d.ts +33 -0
- package/esm/domain/profiling/transport/buildProfileEventAttributes.js +60 -0
- package/esm/domain/profiling/transport/buildProfileEventAttributes.js.map +1 -0
- package/esm/domain/profiling/types/index.d.ts +2 -0
- package/esm/domain/profiling/types/index.js +2 -0
- package/esm/domain/profiling/types/index.js.map +1 -0
- package/esm/domain/profiling/types/profilerApi.types.d.ts +58 -0
- package/esm/domain/profiling/types/profilerApi.types.js +4 -0
- package/esm/domain/profiling/types/profilerApi.types.js.map +1 -0
- package/esm/domain/profiling/types/rumProfiler.types.d.ts +55 -0
- package/esm/domain/profiling/types/rumProfiler.types.js +2 -0
- package/esm/domain/profiling/types/rumProfiler.types.js.map +1 -0
- package/esm/domain/profiling/utils/getCustomOrDefaultViewName.d.ts +1 -0
- package/esm/domain/profiling/utils/getCustomOrDefaultViewName.js +3 -0
- package/esm/domain/profiling/utils/getCustomOrDefaultViewName.js.map +1 -0
- package/esm/domain/profiling/utils/getDefaultViewName.d.ts +1 -0
- package/esm/domain/profiling/utils/getDefaultViewName.js +11 -0
- package/esm/domain/profiling/utils/getDefaultViewName.js.map +1 -0
- package/esm/domain/profiling/utils/getNumberOfSamples.d.ts +8 -0
- package/esm/domain/profiling/utils/getNumberOfSamples.js +16 -0
- package/esm/domain/profiling/utils/getNumberOfSamples.js.map +1 -0
- package/esm/domain/profiling/vitalHistory.d.ts +10 -0
- package/esm/domain/profiling/vitalHistory.js +38 -0
- package/esm/domain/profiling/vitalHistory.js.map +1 -0
- package/esm/domain/record/assembly.d.ts +3 -0
- package/esm/domain/record/assembly.js +13 -0
- package/esm/domain/record/assembly.js.map +1 -0
- package/esm/domain/record/elementsScrollPositions.d.ts +10 -0
- package/esm/domain/record/elementsScrollPositions.js +20 -0
- package/esm/domain/record/elementsScrollPositions.js.map +1 -0
- package/esm/domain/record/eventsUtils.d.ts +2 -0
- package/esm/domain/record/eventsUtils.js +11 -0
- package/esm/domain/record/eventsUtils.js.map +1 -0
- package/esm/domain/record/index.d.ts +6 -0
- package/esm/domain/record/index.js +5 -0
- package/esm/domain/record/index.js.map +1 -0
- package/esm/domain/record/internalApi.d.ts +22 -0
- package/esm/domain/record/internalApi.js +51 -0
- package/esm/domain/record/internalApi.js.map +1 -0
- package/esm/domain/record/itemIds.d.ts +40 -0
- package/esm/domain/record/itemIds.js +52 -0
- package/esm/domain/record/itemIds.js.map +1 -0
- package/esm/domain/record/mutationBatch.d.ts +12 -0
- package/esm/domain/record/mutationBatch.js +40 -0
- package/esm/domain/record/mutationBatch.js.map +1 -0
- package/esm/domain/record/record.d.ts +16 -0
- package/esm/domain/record/record.js +52 -0
- package/esm/domain/record/record.js.map +1 -0
- package/esm/domain/record/record.types.d.ts +18 -0
- package/esm/domain/record/record.types.js +2 -0
- package/esm/domain/record/record.types.js.map +1 -0
- package/esm/domain/record/recordingScope.d.ts +24 -0
- package/esm/domain/record/recordingScope.js +26 -0
- package/esm/domain/record/recordingScope.js.map +1 -0
- package/esm/domain/record/serialization/changeEncoder.d.ts +22 -0
- package/esm/domain/record/serialization/changeEncoder.js +56 -0
- package/esm/domain/record/serialization/changeEncoder.js.map +1 -0
- package/esm/domain/record/serialization/conversions/changeConverter.d.ts +10 -0
- package/esm/domain/record/serialization/conversions/changeConverter.js +213 -0
- package/esm/domain/record/serialization/conversions/changeConverter.js.map +1 -0
- package/esm/domain/record/serialization/conversions/changeDecoder.d.ts +16 -0
- package/esm/domain/record/serialization/conversions/changeDecoder.js +134 -0
- package/esm/domain/record/serialization/conversions/changeDecoder.js.map +1 -0
- package/esm/domain/record/serialization/conversions/index.d.ts +7 -0
- package/esm/domain/record/serialization/conversions/index.js +4 -0
- package/esm/domain/record/serialization/conversions/index.js.map +1 -0
- package/esm/domain/record/serialization/conversions/mutationLog.d.ts +15 -0
- package/esm/domain/record/serialization/conversions/mutationLog.js +33 -0
- package/esm/domain/record/serialization/conversions/mutationLog.js.map +1 -0
- package/esm/domain/record/serialization/conversions/nodeIdRemapper.d.ts +10 -0
- package/esm/domain/record/serialization/conversions/nodeIdRemapper.js +49 -0
- package/esm/domain/record/serialization/conversions/nodeIdRemapper.js.map +1 -0
- package/esm/domain/record/serialization/conversions/renderOptions.d.ts +6 -0
- package/esm/domain/record/serialization/conversions/renderOptions.js +9 -0
- package/esm/domain/record/serialization/conversions/renderOptions.js.map +1 -0
- package/esm/domain/record/serialization/conversions/stringTable.d.ts +5 -0
- package/esm/domain/record/serialization/conversions/stringTable.js +19 -0
- package/esm/domain/record/serialization/conversions/stringTable.js.map +1 -0
- package/esm/domain/record/serialization/conversions/vDocument.d.ts +23 -0
- package/esm/domain/record/serialization/conversions/vDocument.js +173 -0
- package/esm/domain/record/serialization/conversions/vDocument.js.map +1 -0
- package/esm/domain/record/serialization/conversions/vNode.d.ts +66 -0
- package/esm/domain/record/serialization/conversions/vNode.js +282 -0
- package/esm/domain/record/serialization/conversions/vNode.js.map +1 -0
- package/esm/domain/record/serialization/conversions/vStyleSheet.d.ts +16 -0
- package/esm/domain/record/serialization/conversions/vStyleSheet.js +26 -0
- package/esm/domain/record/serialization/conversions/vStyleSheet.js.map +1 -0
- package/esm/domain/record/serialization/experimentalFeatures.d.ts +2 -0
- package/esm/domain/record/serialization/experimentalFeatures.js +12 -0
- package/esm/domain/record/serialization/experimentalFeatures.js.map +1 -0
- package/esm/domain/record/serialization/index.d.ts +17 -0
- package/esm/domain/record/serialization/index.js +14 -0
- package/esm/domain/record/serialization/index.js.map +1 -0
- package/esm/domain/record/serialization/insertionCursor.d.ts +57 -0
- package/esm/domain/record/serialization/insertionCursor.js +64 -0
- package/esm/domain/record/serialization/insertionCursor.js.map +1 -0
- package/esm/domain/record/serialization/serialization.types.d.ts +24 -0
- package/esm/domain/record/serialization/serialization.types.js +2 -0
- package/esm/domain/record/serialization/serialization.types.js.map +1 -0
- package/esm/domain/record/serialization/serializationStats.d.ts +12 -0
- package/esm/domain/record/serialization/serializationStats.js +27 -0
- package/esm/domain/record/serialization/serializationStats.js.map +1 -0
- package/esm/domain/record/serialization/serializationTransaction.d.ts +96 -0
- package/esm/domain/record/serialization/serializationTransaction.js +99 -0
- package/esm/domain/record/serialization/serializationTransaction.js.map +1 -0
- package/esm/domain/record/serialization/serializationUtils.d.ts +18 -0
- package/esm/domain/record/serialization/serializationUtils.js +80 -0
- package/esm/domain/record/serialization/serializationUtils.js.map +1 -0
- package/esm/domain/record/serialization/serializeAttribute.d.ts +4 -0
- package/esm/domain/record/serialization/serializeAttribute.js +38 -0
- package/esm/domain/record/serialization/serializeAttribute.js.map +1 -0
- package/esm/domain/record/serialization/serializeAttributes.d.ts +7 -0
- package/esm/domain/record/serialization/serializeAttributes.js +161 -0
- package/esm/domain/record/serialization/serializeAttributes.js.map +1 -0
- package/esm/domain/record/serialization/serializeFullSnapshot.d.ts +5 -0
- package/esm/domain/record/serialization/serializeFullSnapshot.js +31 -0
- package/esm/domain/record/serialization/serializeFullSnapshot.js.map +1 -0
- package/esm/domain/record/serialization/serializeFullSnapshotAsChange.d.ts +5 -0
- package/esm/domain/record/serialization/serializeFullSnapshotAsChange.js +10 -0
- package/esm/domain/record/serialization/serializeFullSnapshotAsChange.js.map +1 -0
- package/esm/domain/record/serialization/serializeMutations.d.ts +11 -0
- package/esm/domain/record/serialization/serializeMutations.js +257 -0
- package/esm/domain/record/serialization/serializeMutations.js.map +1 -0
- package/esm/domain/record/serialization/serializeMutationsAsChange.d.ts +5 -0
- package/esm/domain/record/serialization/serializeMutationsAsChange.js +201 -0
- package/esm/domain/record/serialization/serializeMutationsAsChange.js.map +1 -0
- package/esm/domain/record/serialization/serializeNode.d.ts +7 -0
- package/esm/domain/record/serialization/serializeNode.js +149 -0
- package/esm/domain/record/serialization/serializeNode.js.map +1 -0
- package/esm/domain/record/serialization/serializeNodeAsChange.d.ts +4 -0
- package/esm/domain/record/serialization/serializeNodeAsChange.js +150 -0
- package/esm/domain/record/serialization/serializeNodeAsChange.js.map +1 -0
- package/esm/domain/record/serialization/serializeStyleSheets.d.ts +3 -0
- package/esm/domain/record/serialization/serializeStyleSheets.js +27 -0
- package/esm/domain/record/serialization/serializeStyleSheets.js.map +1 -0
- package/esm/domain/record/serializationVerifier.d.ts +18 -0
- package/esm/domain/record/serializationVerifier.js +123 -0
- package/esm/domain/record/serializationVerifier.js.map +1 -0
- package/esm/domain/record/shadowRootsController.d.ts +11 -0
- package/esm/domain/record/shadowRootsController.js +41 -0
- package/esm/domain/record/shadowRootsController.js.map +1 -0
- package/esm/domain/record/startFullSnapshots.d.ts +10 -0
- package/esm/domain/record/startFullSnapshots.js +46 -0
- package/esm/domain/record/startFullSnapshots.js.map +1 -0
- package/esm/domain/record/trackers/index.d.ts +12 -0
- package/esm/domain/record/trackers/index.js +12 -0
- package/esm/domain/record/trackers/index.js.map +1 -0
- package/esm/domain/record/trackers/trackFocus.d.ts +5 -0
- package/esm/domain/record/trackers/trackFocus.js +12 -0
- package/esm/domain/record/trackers/trackFocus.js.map +1 -0
- package/esm/domain/record/trackers/trackFrustration.d.ts +6 -0
- package/esm/domain/record/trackers/trackFrustration.js +28 -0
- package/esm/domain/record/trackers/trackFrustration.js.map +1 -0
- package/esm/domain/record/trackers/trackInput.d.ts +4 -0
- package/esm/domain/record/trackers/trackInput.js +101 -0
- package/esm/domain/record/trackers/trackInput.js.map +1 -0
- package/esm/domain/record/trackers/trackMediaInteraction.d.ts +5 -0
- package/esm/domain/record/trackers/trackMediaInteraction.js +26 -0
- package/esm/domain/record/trackers/trackMediaInteraction.js.map +1 -0
- package/esm/domain/record/trackers/trackMouseInteraction.d.ts +5 -0
- package/esm/domain/record/trackers/trackMouseInteraction.js +56 -0
- package/esm/domain/record/trackers/trackMouseInteraction.js.map +1 -0
- package/esm/domain/record/trackers/trackMove.d.ts +9 -0
- package/esm/domain/record/trackers/trackMove.js +51 -0
- package/esm/domain/record/trackers/trackMove.js.map +1 -0
- package/esm/domain/record/trackers/trackMutation.d.ts +13 -0
- package/esm/domain/record/trackers/trackMutation.js +38 -0
- package/esm/domain/record/trackers/trackMutation.js.map +1 -0
- package/esm/domain/record/trackers/trackScroll.d.ts +5 -0
- package/esm/domain/record/trackers/trackScroll.js +45 -0
- package/esm/domain/record/trackers/trackScroll.js.map +1 -0
- package/esm/domain/record/trackers/trackStyleSheet.d.ts +6 -0
- package/esm/domain/record/trackers/trackStyleSheet.js +85 -0
- package/esm/domain/record/trackers/trackStyleSheet.js.map +1 -0
- package/esm/domain/record/trackers/trackViewEnd.d.ts +5 -0
- package/esm/domain/record/trackers/trackViewEnd.js +17 -0
- package/esm/domain/record/trackers/trackViewEnd.js.map +1 -0
- package/esm/domain/record/trackers/trackViewportResize.d.ts +6 -0
- package/esm/domain/record/trackers/trackViewportResize.js +42 -0
- package/esm/domain/record/trackers/trackViewportResize.js.map +1 -0
- package/esm/domain/record/trackers/tracker.types.d.ts +3 -0
- package/esm/domain/record/trackers/tracker.types.js +2 -0
- package/esm/domain/record/trackers/tracker.types.js.map +1 -0
- package/esm/domain/record/viewports.d.ts +20 -0
- package/esm/domain/record/viewports.js +55 -0
- package/esm/domain/record/viewports.js.map +1 -0
- package/esm/domain/replayStats.d.ts +8 -0
- package/esm/domain/replayStats.js +51 -0
- package/esm/domain/replayStats.js.map +1 -0
- package/esm/domain/scriptLoadingError.d.ts +6 -0
- package/esm/domain/scriptLoadingError.js +23 -0
- package/esm/domain/scriptLoadingError.js.map +1 -0
- package/esm/domain/segmentCollection/buildReplayPayload.d.ts +15 -0
- package/esm/domain/segmentCollection/buildReplayPayload.js +23 -0
- package/esm/domain/segmentCollection/buildReplayPayload.js.map +1 -0
- package/esm/domain/segmentCollection/index.d.ts +4 -0
- package/esm/domain/segmentCollection/index.js +4 -0
- package/esm/domain/segmentCollection/index.js.map +1 -0
- package/esm/domain/segmentCollection/segment.d.ts +16 -0
- package/esm/domain/segmentCollection/segment.js +46 -0
- package/esm/domain/segmentCollection/segment.js.map +1 -0
- package/esm/domain/segmentCollection/segmentCollection.d.ts +31 -0
- package/esm/domain/segmentCollection/segmentCollection.js +106 -0
- package/esm/domain/segmentCollection/segmentCollection.js.map +1 -0
- package/esm/domain/segmentCollection/startSegmentTelemetry.d.ts +6 -0
- package/esm/domain/segmentCollection/startSegmentTelemetry.js +49 -0
- package/esm/domain/segmentCollection/startSegmentTelemetry.js.map +1 -0
- package/esm/domain/startRecordBridge.d.ts +5 -0
- package/esm/domain/startRecordBridge.js +14 -0
- package/esm/domain/startRecordBridge.js.map +1 -0
- package/esm/domain/startRecorderInitTelemetry.d.ts +15 -0
- package/esm/domain/startRecorderInitTelemetry.js +52 -0
- package/esm/domain/startRecorderInitTelemetry.js.map +1 -0
- package/esm/entries/internal.d.ts +11 -0
- package/esm/entries/internal.js +4 -0
- package/esm/entries/internal.js.map +1 -0
- package/esm/entries/internalSynthetics.d.ts +2 -0
- package/esm/entries/internalSynthetics.js +23 -0
- package/esm/entries/internalSynthetics.js.map +1 -0
- package/esm/entries/main.d.ts +23 -0
- package/esm/entries/main.js +31 -0
- package/esm/entries/main.js.map +1 -0
- package/esm/types/index.d.ts +3 -0
- package/esm/types/index.js +2 -0
- package/esm/types/index.js.map +1 -0
- package/esm/types/profiling.d.ts +296 -0
- package/esm/types/profiling.js +5 -0
- package/esm/types/profiling.js.map +1 -0
- package/esm/types/sessionReplay.d.ts +934 -0
- package/esm/types/sessionReplay.js +5 -0
- package/esm/types/sessionReplay.js.map +1 -0
- package/esm/types/sessionReplayConstants.d.ts +71 -0
- package/esm/types/sessionReplayConstants.js +64 -0
- package/esm/types/sessionReplayConstants.js.map +1 -0
- package/internal/package.json +6 -0
- package/internal-synthetics/package.json +6 -0
- package/package.json +52 -0
- package/src/boot/isBrowserSupported.ts +14 -0
- package/src/boot/lazyLoadProfiler.ts +20 -0
- package/src/boot/lazyLoadRecorder.ts +20 -0
- package/src/boot/postStartStrategy.ts +176 -0
- package/src/boot/preStartStrategy.ts +34 -0
- package/src/boot/profilerApi.ts +82 -0
- package/src/boot/recorderApi.ts +113 -0
- package/src/boot/startRecording.ts +70 -0
- package/src/domain/deflate/deflateEncoder.ts +144 -0
- package/src/domain/deflate/deflateWorker.ts +152 -0
- package/src/domain/deflate/index.ts +9 -0
- package/src/domain/getSessionReplayLink.ts +40 -0
- package/src/domain/profiling/actionHistory.ts +65 -0
- package/src/domain/profiling/longTaskHistory.ts +40 -0
- package/src/domain/profiling/profiler.ts +366 -0
- package/src/domain/profiling/profilingContext.ts +39 -0
- package/src/domain/profiling/profilingSupported.ts +10 -0
- package/src/domain/profiling/test-utils/mockedTrace.ts +58 -0
- package/src/domain/profiling/transport/assembly.ts +63 -0
- package/src/domain/profiling/transport/buildProfileEventAttributes.ts +106 -0
- package/src/domain/profiling/types/index.ts +2 -0
- package/src/domain/profiling/types/profilerApi.types.ts +87 -0
- package/src/domain/profiling/types/rumProfiler.types.ts +62 -0
- package/src/domain/profiling/utils/getCustomOrDefaultViewName.ts +4 -0
- package/src/domain/profiling/utils/getDefaultViewName.ts +12 -0
- package/src/domain/profiling/utils/getNumberOfSamples.ts +17 -0
- package/src/domain/profiling/vitalHistory.ts +58 -0
- package/src/domain/record/assembly.ts +19 -0
- package/src/domain/record/elementsScrollPositions.ts +28 -0
- package/src/domain/record/eventsUtils.ts +12 -0
- package/src/domain/record/index.ts +12 -0
- package/src/domain/record/internalApi.ts +84 -0
- package/src/domain/record/itemIds.ts +97 -0
- package/src/domain/record/mutationBatch.ts +47 -0
- package/src/domain/record/record.ts +90 -0
- package/src/domain/record/record.types.ts +22 -0
- package/src/domain/record/recordingScope.ts +58 -0
- package/src/domain/record/serialization/changeEncoder.ts +89 -0
- package/src/domain/record/serialization/conversions/changeConverter.ts +277 -0
- package/src/domain/record/serialization/conversions/changeDecoder.ts +192 -0
- package/src/domain/record/serialization/conversions/index.ts +7 -0
- package/src/domain/record/serialization/conversions/mutationLog.ts +56 -0
- package/src/domain/record/serialization/conversions/nodeIdRemapper.ts +69 -0
- package/src/domain/record/serialization/conversions/renderOptions.ts +14 -0
- package/src/domain/record/serialization/conversions/stringTable.ts +25 -0
- package/src/domain/record/serialization/conversions/vDocument.ts +239 -0
- package/src/domain/record/serialization/conversions/vNode.ts +417 -0
- package/src/domain/record/serialization/conversions/vStyleSheet.ts +47 -0
- package/src/domain/record/serialization/experimentalFeatures.ts +15 -0
- package/src/domain/record/serialization/index.ts +21 -0
- package/src/domain/record/serialization/insertionCursor.ts +131 -0
- package/src/domain/record/serialization/serialization.types.ts +38 -0
- package/src/domain/record/serialization/serializationStats.ts +43 -0
- package/src/domain/record/serialization/serializationTransaction.ts +255 -0
- package/src/domain/record/serialization/serializationUtils.ts +103 -0
- package/src/domain/record/serialization/serializeAttribute.ts +55 -0
- package/src/domain/record/serialization/serializeAttributes.ts +194 -0
- package/src/domain/record/serialization/serializeFullSnapshot.ts +46 -0
- package/src/domain/record/serialization/serializeFullSnapshotAsChange.ts +33 -0
- package/src/domain/record/serialization/serializeMutations.ts +395 -0
- package/src/domain/record/serialization/serializeMutationsAsChange.ts +298 -0
- package/src/domain/record/serialization/serializeNode.ts +229 -0
- package/src/domain/record/serialization/serializeNodeAsChange.ts +237 -0
- package/src/domain/record/serialization/serializeStyleSheets.ts +36 -0
- package/src/domain/record/serializationVerifier.ts +208 -0
- package/src/domain/record/shadowRootsController.ts +62 -0
- package/src/domain/record/startFullSnapshots.ts +92 -0
- package/src/domain/record/trackers/index.ts +12 -0
- package/src/domain/record/trackers/trackFocus.ts +16 -0
- package/src/domain/record/trackers/trackFrustration.ts +39 -0
- package/src/domain/record/trackers/trackInput.ts +128 -0
- package/src/domain/record/trackers/trackMediaInteraction.ts +43 -0
- package/src/domain/record/trackers/trackMouseInteraction.ts +74 -0
- package/src/domain/record/trackers/trackMove.ts +78 -0
- package/src/domain/record/trackers/trackMutation.ts +74 -0
- package/src/domain/record/trackers/trackScroll.ts +61 -0
- package/src/domain/record/trackers/trackStyleSheet.ts +117 -0
- package/src/domain/record/trackers/trackViewEnd.ts +27 -0
- package/src/domain/record/trackers/trackViewportResize.ts +69 -0
- package/src/domain/record/trackers/tracker.types.ts +3 -0
- package/src/domain/record/viewports.ts +68 -0
- package/src/domain/replayStats.ts +61 -0
- package/src/domain/scriptLoadingError.ts +36 -0
- package/src/domain/segmentCollection/buildReplayPayload.ts +52 -0
- package/src/domain/segmentCollection/index.ts +4 -0
- package/src/domain/segmentCollection/segment.ts +79 -0
- package/src/domain/segmentCollection/segmentCollection.ts +200 -0
- package/src/domain/segmentCollection/startSegmentTelemetry.ts +91 -0
- package/src/domain/startRecordBridge.ts +17 -0
- package/src/domain/startRecorderInitTelemetry.ts +90 -0
- package/src/entries/internal.ts +18 -0
- package/src/entries/internalSynthetics.ts +24 -0
- package/src/entries/main.ts +96 -0
- package/src/types/index.ts +3 -0
- package/src/types/profiling.ts +298 -0
- package/src/types/sessionReplay.ts +990 -0
- package/src/types/sessionReplayConstants.ts +130 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { buildUrl } from '@datadog/browser-core';
|
|
2
|
+
import { CENSORED_STRING_MARK, shouldMaskNode } from '@datadog/browser-rum-core';
|
|
3
|
+
/**
|
|
4
|
+
* Get the element "value" to be serialized as an attribute or an input update record. It respects
|
|
5
|
+
* the input privacy mode of the element.
|
|
6
|
+
* PERFROMANCE OPTIMIZATION: Assumes that privacy level `HIDDEN` is never encountered because of earlier checks.
|
|
7
|
+
*/
|
|
8
|
+
export function getElementInputValue(element, nodePrivacyLevel) {
|
|
9
|
+
/*
|
|
10
|
+
BROWSER SPEC NOTE: <input>, <select>
|
|
11
|
+
For some <input> elements, the `value` is an exceptional property/attribute that has the
|
|
12
|
+
value synced between el.value and el.getAttribute()
|
|
13
|
+
input[type=button,checkbox,hidden,image,radio,reset,submit]
|
|
14
|
+
*/
|
|
15
|
+
const tagName = element.tagName;
|
|
16
|
+
const value = element.value;
|
|
17
|
+
if (shouldMaskNode(element, nodePrivacyLevel)) {
|
|
18
|
+
const type = element.type;
|
|
19
|
+
if (tagName === 'INPUT' && (type === 'button' || type === 'submit' || type === 'reset')) {
|
|
20
|
+
// Overrule `MASK` privacy level for button-like element values, as they are used during replay
|
|
21
|
+
// to display their label. They can still be hidden via the "hidden" privacy attribute or class name.
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
else if (!value || tagName === 'OPTION') {
|
|
25
|
+
// <Option> value provides no benefit
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
return CENSORED_STRING_MARK;
|
|
29
|
+
}
|
|
30
|
+
if (tagName === 'OPTION' || tagName === 'SELECT') {
|
|
31
|
+
return element.value;
|
|
32
|
+
}
|
|
33
|
+
if (tagName !== 'INPUT' && tagName !== 'TEXTAREA') {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
export const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm;
|
|
39
|
+
export const ABSOLUTE_URL = /^[A-Za-z]+:|^\/\//;
|
|
40
|
+
export const DATA_URI = /^["']?data:.*,/i;
|
|
41
|
+
export function switchToAbsoluteUrl(cssText, cssHref) {
|
|
42
|
+
return cssText.replace(URL_IN_CSS_REF, (matchingSubstring, singleQuote, urlWrappedInSingleQuotes, doubleQuote, urlWrappedInDoubleQuotes, urlNotWrappedInQuotes) => {
|
|
43
|
+
const url = urlWrappedInSingleQuotes || urlWrappedInDoubleQuotes || urlNotWrappedInQuotes;
|
|
44
|
+
if (!cssHref || !url || ABSOLUTE_URL.test(url) || DATA_URI.test(url)) {
|
|
45
|
+
return matchingSubstring;
|
|
46
|
+
}
|
|
47
|
+
const quote = singleQuote || doubleQuote || '';
|
|
48
|
+
return `url(${quote}${makeUrlAbsolute(url, cssHref)}${quote})`;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function makeUrlAbsolute(url, baseUrl) {
|
|
52
|
+
try {
|
|
53
|
+
return buildUrl(url, baseUrl).href;
|
|
54
|
+
}
|
|
55
|
+
catch (_a) {
|
|
56
|
+
return url;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const TAG_NAME_REGEX = /[^a-z1-6-_]/;
|
|
60
|
+
export function getValidTagName(tagName) {
|
|
61
|
+
const processedTagName = tagName.toLowerCase().trim();
|
|
62
|
+
if (TAG_NAME_REGEX.test(processedTagName)) {
|
|
63
|
+
// if the tag name is odd and we cannot extract
|
|
64
|
+
// anything from the string, then we return a
|
|
65
|
+
// generic div
|
|
66
|
+
return 'div';
|
|
67
|
+
}
|
|
68
|
+
return processedTagName;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns the tag name of the given element, normalized to ensure a consistent lowercase
|
|
72
|
+
* representation regardless of whether the element is HTML, XHTML, or SVG.
|
|
73
|
+
*/
|
|
74
|
+
export function normalizedTagName(element) {
|
|
75
|
+
return element.tagName.toLowerCase();
|
|
76
|
+
}
|
|
77
|
+
export function censoredImageForSize(width, height) {
|
|
78
|
+
return `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${width}' height='${height}' style='background-color:silver'%3E%3C/svg%3E`;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=serializationUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializationUtils.js","sourceRoot":"","sources":["../../../../src/domain/record/serialization/serializationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uB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DAAgD,CAAA;AACxJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NodePrivacyLevel } from '@datadog/browser-rum-core';
|
|
2
|
+
import type { RumConfiguration } from '@datadog/browser-rum-core';
|
|
3
|
+
export declare const MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 1000000;
|
|
4
|
+
export declare function serializeAttribute(element: Element, nodePrivacyLevel: NodePrivacyLevel, attributeName: string, configuration: RumConfiguration): string | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { NodePrivacyLevel, CENSORED_STRING_MARK, CENSORED_IMG_MARK, sanitizeIfLongDataUrl, shouldMaskAttribute, } from '@datadog/browser-rum-core';
|
|
2
|
+
import { censoredImageForSize } from './serializationUtils';
|
|
3
|
+
// TODO: temporarily bump the Session Replay limit to 1Mb for dataUrls
|
|
4
|
+
// This limit should be removed after [PANA-2843] is implemented
|
|
5
|
+
export const MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 1000000;
|
|
6
|
+
export function serializeAttribute(element, nodePrivacyLevel, attributeName, configuration) {
|
|
7
|
+
if (nodePrivacyLevel === NodePrivacyLevel.HIDDEN) {
|
|
8
|
+
// dup condition for direct access case
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const attributeValue = element.getAttribute(attributeName);
|
|
12
|
+
const tagName = element.tagName;
|
|
13
|
+
if (shouldMaskAttribute(tagName, attributeName, attributeValue, nodePrivacyLevel, configuration)) {
|
|
14
|
+
// mask image URLs
|
|
15
|
+
if (tagName === 'IMG') {
|
|
16
|
+
// generate image with similar dimension than the original to have the same rendering behaviour
|
|
17
|
+
const image = element;
|
|
18
|
+
if (image.naturalWidth > 0) {
|
|
19
|
+
return censoredImageForSize(image.naturalWidth, image.naturalHeight);
|
|
20
|
+
}
|
|
21
|
+
const { width, height } = element.getBoundingClientRect();
|
|
22
|
+
if (width > 0 || height > 0) {
|
|
23
|
+
return censoredImageForSize(width, height);
|
|
24
|
+
}
|
|
25
|
+
// if we can't get the image size, fallback to the censored image
|
|
26
|
+
return CENSORED_IMG_MARK;
|
|
27
|
+
}
|
|
28
|
+
if (tagName === 'SOURCE') {
|
|
29
|
+
return CENSORED_IMG_MARK;
|
|
30
|
+
}
|
|
31
|
+
return CENSORED_STRING_MARK;
|
|
32
|
+
}
|
|
33
|
+
if (!attributeValue) {
|
|
34
|
+
return attributeValue;
|
|
35
|
+
}
|
|
36
|
+
return sanitizeIfLongDataUrl(attributeValue, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=serializeAttribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializeAttribute.js","sourceRoot":"","sources":["../../../../src/domain/record/serialization/serializeAttribute.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAE3D,sEAAsE;AACtE,gEAAgE;AAChE,MAAM,CAAC,MAAM,+BAA+B,GAAG,OAAS,CAAA;AAExD,MAAM,UAAU,kBAAkB,CAChC,OAAgB,EAChB,gBAAkC,EAClC,aAAqB,EACrB,aAA+B;IAE/B,IAAI,gBAAgB,KAAK,gBAAgB,CAAC,MAAM,EAAE,CAAC;QACjD,uCAAuC;QACvC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAA;IAC1D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;IAC/B,IAAI,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,CAAC,EAAE,CAAC;QACjG,kBAAkB;QAClB,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;YACtB,+FAA+F;YAC/F,MAAM,KAAK,GAAG,OAA2B,CAAA;YACzC,IAAI,KAAK,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;gBAC3B,OAAO,oBAAoB,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,aAAa,CAAC,CAAA;YACtE,CAAC;YACD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;YACzD,IAAI,KAAK,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5B,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YAC5C,CAAC;YACD,iEAAiE;YACjE,OAAO,iBAAiB,CAAA;QAC1B,CAAC;QACD,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;YACzB,OAAO,iBAAiB,CAAA;QAC1B,CAAC;QAED,OAAO,oBAAoB,CAAA;IAC7B,CAAC;IAED,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,cAAc,CAAA;IACvB,CAAC;IAED,OAAO,qBAAqB,CAAC,cAAc,EAAE,+BAA+B,CAAC,CAAA;AAC/E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NodePrivacyLevel } from '@datadog/browser-rum-core';
|
|
2
|
+
import type { ChangeSerializationTransaction, SerializationTransaction } from './serializationTransaction';
|
|
3
|
+
import type { VirtualAttributes } from './serialization.types';
|
|
4
|
+
export declare function serializeAttributes(element: Element, nodePrivacyLevel: NodePrivacyLevel, transaction: ChangeSerializationTransaction | SerializationTransaction): Record<string, number | string>;
|
|
5
|
+
export declare function serializeDOMAttributes(element: Element, nodePrivacyLevel: NodePrivacyLevel, transaction: ChangeSerializationTransaction | SerializationTransaction): Record<string, string>;
|
|
6
|
+
export declare function serializeVirtualAttributes(element: Element, nodePrivacyLevel: NodePrivacyLevel, transaction: ChangeSerializationTransaction | SerializationTransaction): VirtualAttributes;
|
|
7
|
+
export declare function getCssRulesString(cssStyleSheet: CSSStyleSheet | undefined | null): string | null;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { NodePrivacyLevel, shouldMaskNode } from '@datadog/browser-rum-core';
|
|
2
|
+
import { isSafari } from '@datadog/browser-core';
|
|
3
|
+
import { getElementInputValue, normalizedTagName, switchToAbsoluteUrl } from './serializationUtils';
|
|
4
|
+
import { serializeAttribute } from './serializeAttribute';
|
|
5
|
+
export function serializeAttributes(element, nodePrivacyLevel, transaction) {
|
|
6
|
+
return {
|
|
7
|
+
...serializeDOMAttributes(element, nodePrivacyLevel, transaction),
|
|
8
|
+
...serializeVirtualAttributes(element, nodePrivacyLevel, transaction),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export function serializeDOMAttributes(element, nodePrivacyLevel, transaction) {
|
|
12
|
+
if (nodePrivacyLevel === NodePrivacyLevel.HIDDEN) {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
const attrs = {};
|
|
16
|
+
const tagName = normalizedTagName(element);
|
|
17
|
+
for (let i = 0; i < element.attributes.length; i += 1) {
|
|
18
|
+
const attribute = element.attributes.item(i);
|
|
19
|
+
const attributeName = attribute.name;
|
|
20
|
+
const attributeValue = serializeAttribute(element, nodePrivacyLevel, attributeName, transaction.scope.configuration);
|
|
21
|
+
if (attributeValue !== null) {
|
|
22
|
+
attrs[attributeName] = attributeValue;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (element.value &&
|
|
26
|
+
(tagName === 'textarea' || tagName === 'select' || tagName === 'option' || tagName === 'input')) {
|
|
27
|
+
const formValue = getElementInputValue(element, nodePrivacyLevel);
|
|
28
|
+
if (formValue !== undefined) {
|
|
29
|
+
attrs.value = formValue;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* <Option> can be selected, which occurs if its `value` matches ancestor `<Select>.value`
|
|
34
|
+
*/
|
|
35
|
+
if (tagName === 'option') {
|
|
36
|
+
const optionElement = element;
|
|
37
|
+
if (optionElement.selected && !shouldMaskNode(optionElement, nodePrivacyLevel)) {
|
|
38
|
+
attrs.selected = '';
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
delete attrs.selected;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Forms: input[type=checkbox,radio]
|
|
46
|
+
* The `checked` property for <input> is a little bit special:
|
|
47
|
+
* 1. el.checked is a setter that returns if truthy.
|
|
48
|
+
* 2. getAttribute returns the string value
|
|
49
|
+
* getAttribute('checked') does not sync with `Element.checked`, so use JS property
|
|
50
|
+
* NOTE: `checked` property exists on `HTMLInputElement`. For serializer assumptions, we check for type=radio|check.
|
|
51
|
+
*/
|
|
52
|
+
const inputElement = element;
|
|
53
|
+
if (tagName === 'input' && (inputElement.type === 'radio' || inputElement.type === 'checkbox')) {
|
|
54
|
+
if (inputElement.checked && !shouldMaskNode(inputElement, nodePrivacyLevel)) {
|
|
55
|
+
attrs.checked = '';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
delete attrs.checked;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return attrs;
|
|
62
|
+
}
|
|
63
|
+
export function serializeVirtualAttributes(element, nodePrivacyLevel, transaction) {
|
|
64
|
+
if (nodePrivacyLevel === NodePrivacyLevel.HIDDEN) {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
const attrs = {};
|
|
68
|
+
const doc = element.ownerDocument;
|
|
69
|
+
const tagName = normalizedTagName(element);
|
|
70
|
+
// remote css
|
|
71
|
+
if (tagName === 'link') {
|
|
72
|
+
const stylesheet = Array.from(doc.styleSheets).find((s) => s.href === element.href);
|
|
73
|
+
const cssText = getCssRulesString(stylesheet);
|
|
74
|
+
if (cssText && stylesheet) {
|
|
75
|
+
transaction.addMetric('cssText', cssText.length);
|
|
76
|
+
attrs._cssText = cssText;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// dynamic stylesheet
|
|
80
|
+
if (tagName === 'style' && element.sheet) {
|
|
81
|
+
const cssText = getCssRulesString(element.sheet);
|
|
82
|
+
if (cssText) {
|
|
83
|
+
transaction.addMetric('cssText', cssText.length);
|
|
84
|
+
attrs._cssText = cssText;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Serialize the media playback state
|
|
89
|
+
*/
|
|
90
|
+
if (tagName === 'audio' || tagName === 'video') {
|
|
91
|
+
const mediaElement = element;
|
|
92
|
+
attrs.rr_mediaState = mediaElement.paused ? 'paused' : 'played';
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Serialize the scroll state for each element only for full snapshot
|
|
96
|
+
*/
|
|
97
|
+
let scrollTop;
|
|
98
|
+
let scrollLeft;
|
|
99
|
+
switch (transaction.kind) {
|
|
100
|
+
case 0 /* SerializationKind.INITIAL_FULL_SNAPSHOT */:
|
|
101
|
+
scrollTop = Math.round(element.scrollTop);
|
|
102
|
+
scrollLeft = Math.round(element.scrollLeft);
|
|
103
|
+
if (scrollTop || scrollLeft) {
|
|
104
|
+
transaction.scope.elementsScrollPositions.set(element, { scrollTop, scrollLeft });
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
case 1 /* SerializationKind.SUBSEQUENT_FULL_SNAPSHOT */:
|
|
108
|
+
if (transaction.scope.elementsScrollPositions.has(element)) {
|
|
109
|
+
;
|
|
110
|
+
({ scrollTop, scrollLeft } = transaction.scope.elementsScrollPositions.get(element));
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
if (scrollLeft) {
|
|
115
|
+
attrs.rr_scrollLeft = scrollLeft;
|
|
116
|
+
}
|
|
117
|
+
if (scrollTop) {
|
|
118
|
+
attrs.rr_scrollTop = scrollTop;
|
|
119
|
+
}
|
|
120
|
+
return attrs;
|
|
121
|
+
}
|
|
122
|
+
export function getCssRulesString(cssStyleSheet) {
|
|
123
|
+
if (!cssStyleSheet) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
let rules;
|
|
127
|
+
try {
|
|
128
|
+
rules = cssStyleSheet.rules || cssStyleSheet.cssRules;
|
|
129
|
+
}
|
|
130
|
+
catch (_a) {
|
|
131
|
+
// if css is protected by CORS we cannot access cssRules see: https://www.w3.org/TR/cssom-1/#the-cssstylesheet-interface
|
|
132
|
+
}
|
|
133
|
+
if (!rules) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
const styleSheetCssText = Array.from(rules, isSafari() ? getCssRuleStringForSafari : getCssRuleString).join('');
|
|
137
|
+
return switchToAbsoluteUrl(styleSheetCssText, cssStyleSheet.href);
|
|
138
|
+
}
|
|
139
|
+
function getCssRuleStringForSafari(rule) {
|
|
140
|
+
// Safari does not escape attribute selectors containing : properly
|
|
141
|
+
// https://bugs.webkit.org/show_bug.cgi?id=184604
|
|
142
|
+
if (isCSSStyleRule(rule) && rule.selectorText.includes(':')) {
|
|
143
|
+
// This regex replaces [foo:bar] by [foo\\:bar]
|
|
144
|
+
const escapeColon = /(\[[\w-]+[^\\])(:[^\]]+\])/g;
|
|
145
|
+
return rule.cssText.replace(escapeColon, '$1\\$2');
|
|
146
|
+
}
|
|
147
|
+
return getCssRuleString(rule);
|
|
148
|
+
}
|
|
149
|
+
function getCssRuleString(rule) {
|
|
150
|
+
// If it's an @import rule, try to inline sub-rules recursively with `getCssRulesString`. This
|
|
151
|
+
// operation can fail if the imported stylesheet is protected by CORS, in which case we fallback
|
|
152
|
+
// to the @import rule CSS text.
|
|
153
|
+
return (isCSSImportRule(rule) && getCssRulesString(rule.styleSheet)) || rule.cssText;
|
|
154
|
+
}
|
|
155
|
+
function isCSSImportRule(rule) {
|
|
156
|
+
return 'styleSheet' in rule;
|
|
157
|
+
}
|
|
158
|
+
function isCSSStyleRule(rule) {
|
|
159
|
+
return 'selectorText' in rule;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=serializeAttributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializeAttributes.js","sourceRoot":"","sources":["../../../../src/domain/record/serialization/serializeAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAKzD,MAAM,UAAU,mBAAmB,CACjC,OAAgB,EAChB,gBAAkC,EAClC,WAAsE;IAEtE,OAAO;QACL,GAAG,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,EAAE,WAAW,CAAC;QACjE,GAAG,0BAA0B,CAAC,OAAO,EAAE,gBAAgB,EAAE,WAAW,CAAC;KACtE,CAAA;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,OAAgB,EAChB,gBAAkC,EAClC,WAAsE;IAEtE,IAAI,gBAAgB,KAAK,gBAAgB,CAAC,MAAM,EAAE,CAAC;QACjD,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,KAAK,GAA2B,EAAE,CAAA;IACxC,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAE1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACtD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAE,CAAA;QAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;QACpC,MAAM,cAAc,GAAG,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QACpH,IAAI,cAAc,KAAK,IAA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,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC/G,OAAO,mBAAmB,CAAC,iBAAiB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;AACnE,CAAC;AAED,SAAS,yBAAyB,CAAC,IAAa;IAC9C,mEAAmE;IACnE,iDAAiD;IACjD,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5D,+CAA+C;QAC/C,MAAM,WAAW,GAAG,6BAA6B,CAAA;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;IACpD,CAAC;IAED,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAA;AAC/B,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAa;IACrC,8FAA8F;IAC9F,gGAAgG;IAChG,gCAAgC;IAChC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAA;AACtF,CAAC;AAED,SAAS,eAAe,CAAC,IAAa;IACpC,OAAO,YAAY,IAAI,IAAI,CAAA;AAC7B,CAAC;AAED,SAAS,cAAc,CAAC,IAAa;IACnC,OAAO,cAAc,IAAI,IAAI,CAAA;AAC/B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TimeStamp } from '@datadog/browser-core';
|
|
2
|
+
import type { EmitRecordCallback, EmitStatsCallback } from '../record.types';
|
|
3
|
+
import type { RecordingScope } from '../recordingScope';
|
|
4
|
+
import type { SerializationKind } from './serializationTransaction';
|
|
5
|
+
export declare function serializeFullSnapshot(timestamp: TimeStamp, kind: SerializationKind, document: Document, emitRecord: EmitRecordCallback, emitStats: EmitStatsCallback, scope: RecordingScope): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getScrollX, getScrollY } from '@datadog/browser-rum-core';
|
|
2
|
+
import { RecordType } from '../../../types';
|
|
3
|
+
import { serializeNode } from './serializeNode';
|
|
4
|
+
import { serializeInTransaction } from './serializationTransaction';
|
|
5
|
+
export function serializeFullSnapshot(timestamp, kind, document, emitRecord, emitStats, scope) {
|
|
6
|
+
serializeInTransaction(kind, emitRecord, emitStats, scope, (transaction) => {
|
|
7
|
+
const defaultPrivacyLevel = transaction.scope.configuration.defaultPrivacyLevel;
|
|
8
|
+
// We are sure that Documents are never ignored, so this function never returns null.
|
|
9
|
+
const node = serializeNode(document, defaultPrivacyLevel, transaction);
|
|
10
|
+
const record = {
|
|
11
|
+
data: {
|
|
12
|
+
node,
|
|
13
|
+
initialOffset: {
|
|
14
|
+
left: getScrollX(),
|
|
15
|
+
top: getScrollY(),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
type: RecordType.FullSnapshot,
|
|
19
|
+
timestamp,
|
|
20
|
+
};
|
|
21
|
+
transaction.add(record);
|
|
22
|
+
scope.serializeObservable.notify({
|
|
23
|
+
type: 'full',
|
|
24
|
+
kind,
|
|
25
|
+
target: document,
|
|
26
|
+
timestamp,
|
|
27
|
+
v1: record,
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=serializeFullSnapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializeFullSnapshot.js","sourceRoot":"","sources":["../../../../src/domain/record/serialization/serializeFullSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAGlE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAGnE,MAAM,UAAU,qBAAqB,CACnC,SAAoB,EACpB,IAAuB,EACvB,QAAkB,EAClB,UAA8B,EAC9B,SAA4B,EAC5B,KAAqB;IAErB,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,WAAqC,EAAE,EAAE;QACnG,MAAM,mBAAmB,GAAG,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAA;QAE/E,qFAAqF;QACrF,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,EAAE,mBAAmB,EAAE,WAAW,CAAE,CAAA;QAEvE,MAAM,MAAM,GAA8B;YACxC,IAAI,EAAE;gBACJ,IAAI;gBACJ,aAAa,EAAE;oBACb,IAAI,EAAE,UAAU,EAAE;oBAClB,GAAG,EAAE,UAAU,EAAE;iBAClB;aACF;YACD,IAAI,EAAE,UAAU,CAAC,YAAY;YAC7B,SAAS;SACV,CAAA;QACD,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAEvB,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC;YAC/B,IAAI,EAAE,MAAM;YACZ,IAAI;YACJ,MAAM,EAAE,QAAQ;YAChB,SAAS;YACT,EAAE,EAAE,MAAM;SACX,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TimeStamp } from '@datadog/browser-core';
|
|
2
|
+
import type { EmitRecordCallback, EmitStatsCallback } from '../record.types';
|
|
3
|
+
import type { RecordingScope } from '../recordingScope';
|
|
4
|
+
import type { SerializationKind } from './serializationTransaction';
|
|
5
|
+
export declare function serializeFullSnapshotAsChange(timestamp: TimeStamp, kind: SerializationKind, document: Document, emitRecord: EmitRecordCallback, emitStats: EmitStatsCallback, scope: RecordingScope): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { serializeChangesInTransaction } from './serializationTransaction';
|
|
2
|
+
import { serializeNodeAsChange } from './serializeNodeAsChange';
|
|
3
|
+
import { createRootInsertionCursor } from './insertionCursor';
|
|
4
|
+
export function serializeFullSnapshotAsChange(timestamp, kind, document, emitRecord, emitStats, scope) {
|
|
5
|
+
scope.resetIds();
|
|
6
|
+
serializeChangesInTransaction(kind, emitRecord, emitStats, scope, timestamp, (transaction) => {
|
|
7
|
+
serializeNodeAsChange(createRootInsertionCursor(scope.nodeIds), document, scope.configuration.defaultPrivacyLevel, transaction);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=serializeFullSnapshotAsChange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializeFullSnapshotAsChange.js","sourceRoot":"","sources":["../../../../src/domain/record/serialization/serializeFullSnapshotAsChange.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAA;AAE1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAE7D,MAAM,UAAU,6BAA6B,CAC3C,SAAoB,EACpB,IAAuB,EACvB,QAAkB,EAClB,UAA8B,EAC9B,SAA4B,EAC5B,KAAqB;IAErB,KAAK,CAAC,QAAQ,EAAE,CAAA;IAChB,6BAA6B,CAC3B,IAAI,EACJ,UAAU,EACV,SAAS,EACT,KAAK,EACL,SAAS,EACT,CAAC,WAA2C,EAAE,EAAE;QAC9C,qBAAqB,CACnB,yBAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,EACxC,QAAQ,EACR,KAAK,CAAC,aAAa,CAAC,mBAAmB,EACvC,WAAW,CACZ,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RumMutationRecord } from '@datadog/browser-rum-core';
|
|
2
|
+
import type { TimeStamp } from '@datadog/browser-core';
|
|
3
|
+
import type { RecordingScope } from '../recordingScope';
|
|
4
|
+
import type { EmitRecordCallback, EmitStatsCallback } from '../record.types';
|
|
5
|
+
import type { NodeIds } from '../itemIds';
|
|
6
|
+
export type NodeWithSerializedNode = Node & {
|
|
7
|
+
__brand: 'NodeWithSerializedNode';
|
|
8
|
+
};
|
|
9
|
+
export declare function serializeMutations(timestamp: TimeStamp, mutations: RumMutationRecord[], emitRecord: EmitRecordCallback, emitStats: EmitStatsCallback, scope: RecordingScope): void;
|
|
10
|
+
export declare function sortAddedAndMovedNodes(nodes: Node[]): void;
|
|
11
|
+
export declare function idsAreAssignedForNodeAndAncestors(node: Node, nodeIds: NodeIds): node is NodeWithSerializedNode;
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { isNodeShadowHost, getParentNode, forEachChildNodes, getNodePrivacyLevel, getTextContent, NodePrivacyLevel, isNodeShadowRoot, } from '@datadog/browser-rum-core';
|
|
2
|
+
import { IncrementalSource } from '../../../types';
|
|
3
|
+
import { assembleIncrementalSnapshot } from '../assembly';
|
|
4
|
+
import { serializeInTransaction } from './serializationTransaction';
|
|
5
|
+
import { serializeNode } from './serializeNode';
|
|
6
|
+
import { serializeAttribute } from './serializeAttribute';
|
|
7
|
+
import { getElementInputValue } from './serializationUtils';
|
|
8
|
+
export function serializeMutations(timestamp, mutations, emitRecord, emitStats, scope) {
|
|
9
|
+
serializeInTransaction(2 /* SerializationKind.INCREMENTAL_SNAPSHOT */, emitRecord, emitStats, scope, (transaction) => processMutations(timestamp, mutations, transaction));
|
|
10
|
+
}
|
|
11
|
+
function processMutations(timestamp, mutations, transaction) {
|
|
12
|
+
const nodePrivacyLevelCache = new Map();
|
|
13
|
+
mutations
|
|
14
|
+
.filter((mutation) => mutation.type === 'childList')
|
|
15
|
+
.forEach((mutation) => {
|
|
16
|
+
mutation.removedNodes.forEach((removedNode) => {
|
|
17
|
+
traverseRemovedShadowDom(removedNode, transaction.scope.shadowRootsController.removeShadowRoot);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
// Discard any mutation with a 'target' node that:
|
|
21
|
+
// * isn't injected in the current document or isn't known/serialized yet: those nodes are likely
|
|
22
|
+
// part of a mutation occurring in a parent Node
|
|
23
|
+
// * should be hidden or ignored
|
|
24
|
+
const filteredMutations = mutations.filter((mutation) => mutation.target.isConnected &&
|
|
25
|
+
idsAreAssignedForNodeAndAncestors(mutation.target, transaction.scope.nodeIds) &&
|
|
26
|
+
getNodePrivacyLevel(mutation.target, transaction.scope.configuration.defaultPrivacyLevel, nodePrivacyLevelCache) !== NodePrivacyLevel.HIDDEN);
|
|
27
|
+
const { adds, removes, hasBeenSerialized } = processChildListMutations(filteredMutations.filter((mutation) => mutation.type === 'childList'), nodePrivacyLevelCache, transaction);
|
|
28
|
+
const texts = processCharacterDataMutations(filteredMutations.filter((mutation) => mutation.type === 'characterData' && !hasBeenSerialized(mutation.target)), nodePrivacyLevelCache, transaction);
|
|
29
|
+
const attributes = processAttributesMutations(filteredMutations.filter((mutation) => mutation.type === 'attributes' && !hasBeenSerialized(mutation.target)), nodePrivacyLevelCache, transaction);
|
|
30
|
+
if (!texts.length && !attributes.length && !removes.length && !adds.length) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const record = assembleIncrementalSnapshot(IncrementalSource.Mutation, {
|
|
34
|
+
adds,
|
|
35
|
+
removes,
|
|
36
|
+
texts,
|
|
37
|
+
attributes,
|
|
38
|
+
}, timestamp);
|
|
39
|
+
transaction.add(record);
|
|
40
|
+
transaction.scope.serializeObservable.notify({
|
|
41
|
+
type: 'incremental',
|
|
42
|
+
target: mutations,
|
|
43
|
+
timestamp,
|
|
44
|
+
v1: record,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function processChildListMutations(mutations, nodePrivacyLevelCache, transaction) {
|
|
48
|
+
// First, we iterate over mutations to collect:
|
|
49
|
+
//
|
|
50
|
+
// * nodes that have been added in the document and not removed by a subsequent mutation
|
|
51
|
+
// * nodes that have been removed from the document but were not added in a previous mutation
|
|
52
|
+
//
|
|
53
|
+
// For this second category, we also collect their previous parent (mutation.target) because we'll
|
|
54
|
+
// need it to emit a 'remove' mutation.
|
|
55
|
+
//
|
|
56
|
+
// Those two categories may overlap: if a node moved from a position to another, it is reported as
|
|
57
|
+
// two mutation records, one with a "removedNodes" and the other with "addedNodes". In this case,
|
|
58
|
+
// the node will be in both sets.
|
|
59
|
+
const addedAndMovedNodes = new Set();
|
|
60
|
+
const removedNodes = new Map();
|
|
61
|
+
for (const mutation of mutations) {
|
|
62
|
+
mutation.addedNodes.forEach((node) => {
|
|
63
|
+
addedAndMovedNodes.add(node);
|
|
64
|
+
});
|
|
65
|
+
mutation.removedNodes.forEach((node) => {
|
|
66
|
+
if (!addedAndMovedNodes.has(node)) {
|
|
67
|
+
removedNodes.set(node, mutation.target);
|
|
68
|
+
}
|
|
69
|
+
addedAndMovedNodes.delete(node);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
// Then, we sort nodes that are still in the document by topological order, for two reasons:
|
|
73
|
+
//
|
|
74
|
+
// * We will serialize each added nodes with their descendants. We don't want to serialize a node
|
|
75
|
+
// twice, so we need to iterate over the parent nodes first and skip any node that is contained in
|
|
76
|
+
// a precedent node.
|
|
77
|
+
//
|
|
78
|
+
// * To emit "add" mutations, we need references to the parent and potential next sibling of each
|
|
79
|
+
// added node. So we need to iterate over the parent nodes first, and when multiple nodes are
|
|
80
|
+
// siblings, we want to iterate from last to first. This will ensure that any "next" node is
|
|
81
|
+
// already serialized and have an id.
|
|
82
|
+
const sortedAddedAndMovedNodes = Array.from(addedAndMovedNodes);
|
|
83
|
+
sortAddedAndMovedNodes(sortedAddedAndMovedNodes);
|
|
84
|
+
// Then, we iterate over our sorted node sets to emit mutations. We collect the newly serialized
|
|
85
|
+
// node ids in a set to be able to skip subsequent related mutations.
|
|
86
|
+
transaction.serializedNodeIds = new Set();
|
|
87
|
+
const addedNodeMutations = [];
|
|
88
|
+
for (const node of sortedAddedAndMovedNodes) {
|
|
89
|
+
if (hasBeenSerialized(node)) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const parentNodePrivacyLevel = getNodePrivacyLevel(node.parentNode, transaction.scope.configuration.defaultPrivacyLevel, nodePrivacyLevelCache);
|
|
93
|
+
if (parentNodePrivacyLevel === NodePrivacyLevel.HIDDEN || parentNodePrivacyLevel === NodePrivacyLevel.IGNORE) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const serializedNode = serializeNode(node, parentNodePrivacyLevel, transaction);
|
|
97
|
+
if (!serializedNode) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const parentNode = getParentNode(node);
|
|
101
|
+
addedNodeMutations.push({
|
|
102
|
+
nextId: getNextSibling(node),
|
|
103
|
+
parentId: transaction.scope.nodeIds.get(parentNode),
|
|
104
|
+
node: serializedNode,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// Finally, we emit remove mutations.
|
|
108
|
+
const removedNodeMutations = [];
|
|
109
|
+
removedNodes.forEach((parent, node) => {
|
|
110
|
+
const parentId = transaction.scope.nodeIds.get(parent);
|
|
111
|
+
const id = transaction.scope.nodeIds.get(node);
|
|
112
|
+
if (parentId !== undefined && id !== undefined) {
|
|
113
|
+
removedNodeMutations.push({ parentId, id });
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return { adds: addedNodeMutations, removes: removedNodeMutations, hasBeenSerialized };
|
|
117
|
+
function hasBeenSerialized(node) {
|
|
118
|
+
var _a;
|
|
119
|
+
const id = transaction.scope.nodeIds.get(node);
|
|
120
|
+
return id !== undefined && ((_a = transaction.serializedNodeIds) === null || _a === void 0 ? void 0 : _a.has(id));
|
|
121
|
+
}
|
|
122
|
+
function getNextSibling(node) {
|
|
123
|
+
let nextSibling = node.nextSibling;
|
|
124
|
+
while (nextSibling) {
|
|
125
|
+
const id = transaction.scope.nodeIds.get(nextSibling);
|
|
126
|
+
if (id !== undefined) {
|
|
127
|
+
return id;
|
|
128
|
+
}
|
|
129
|
+
nextSibling = nextSibling.nextSibling;
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function processCharacterDataMutations(mutations, nodePrivacyLevelCache, transaction) {
|
|
135
|
+
var _a;
|
|
136
|
+
const textMutations = [];
|
|
137
|
+
// Deduplicate mutations based on their target node
|
|
138
|
+
const handledNodes = new Set();
|
|
139
|
+
const filteredMutations = mutations.filter((mutation) => {
|
|
140
|
+
if (handledNodes.has(mutation.target)) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
handledNodes.add(mutation.target);
|
|
144
|
+
return true;
|
|
145
|
+
});
|
|
146
|
+
// Emit mutations
|
|
147
|
+
for (const mutation of filteredMutations) {
|
|
148
|
+
const value = mutation.target.textContent;
|
|
149
|
+
if (value === mutation.oldValue) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
const id = transaction.scope.nodeIds.get(mutation.target);
|
|
153
|
+
if (id === undefined) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
const parentNodePrivacyLevel = getNodePrivacyLevel(getParentNode(mutation.target), transaction.scope.configuration.defaultPrivacyLevel, nodePrivacyLevelCache);
|
|
157
|
+
if (parentNodePrivacyLevel === NodePrivacyLevel.HIDDEN || parentNodePrivacyLevel === NodePrivacyLevel.IGNORE) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
textMutations.push({
|
|
161
|
+
id,
|
|
162
|
+
value: (_a = getTextContent(mutation.target, parentNodePrivacyLevel)) !== null && _a !== void 0 ? _a : null,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return textMutations;
|
|
166
|
+
}
|
|
167
|
+
function processAttributesMutations(mutations, nodePrivacyLevelCache, transaction) {
|
|
168
|
+
const attributeMutations = [];
|
|
169
|
+
// Deduplicate mutations based on their target node and changed attribute
|
|
170
|
+
const handledElements = new Map();
|
|
171
|
+
const filteredMutations = mutations.filter((mutation) => {
|
|
172
|
+
const handledAttributes = handledElements.get(mutation.target);
|
|
173
|
+
if (handledAttributes && handledAttributes.has(mutation.attributeName)) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
if (!handledAttributes) {
|
|
177
|
+
handledElements.set(mutation.target, new Set([mutation.attributeName]));
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
handledAttributes.add(mutation.attributeName);
|
|
181
|
+
}
|
|
182
|
+
return true;
|
|
183
|
+
});
|
|
184
|
+
// Emit mutations
|
|
185
|
+
const emittedMutations = new Map();
|
|
186
|
+
for (const mutation of filteredMutations) {
|
|
187
|
+
const uncensoredValue = mutation.target.getAttribute(mutation.attributeName);
|
|
188
|
+
if (uncensoredValue === mutation.oldValue) {
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
const id = transaction.scope.nodeIds.get(mutation.target);
|
|
192
|
+
if (id === undefined) {
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
const privacyLevel = getNodePrivacyLevel(mutation.target, transaction.scope.configuration.defaultPrivacyLevel, nodePrivacyLevelCache);
|
|
196
|
+
const attributeValue = serializeAttribute(mutation.target, privacyLevel, mutation.attributeName, transaction.scope.configuration);
|
|
197
|
+
let transformedValue;
|
|
198
|
+
if (mutation.attributeName === 'value') {
|
|
199
|
+
const inputValue = getElementInputValue(mutation.target, privacyLevel);
|
|
200
|
+
if (inputValue === undefined) {
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
transformedValue = inputValue;
|
|
204
|
+
}
|
|
205
|
+
else if (typeof attributeValue === 'string') {
|
|
206
|
+
transformedValue = attributeValue;
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
transformedValue = null;
|
|
210
|
+
}
|
|
211
|
+
let emittedMutation = emittedMutations.get(mutation.target);
|
|
212
|
+
if (!emittedMutation) {
|
|
213
|
+
emittedMutation = { id, attributes: {} };
|
|
214
|
+
attributeMutations.push(emittedMutation);
|
|
215
|
+
emittedMutations.set(mutation.target, emittedMutation);
|
|
216
|
+
}
|
|
217
|
+
emittedMutation.attributes[mutation.attributeName] = transformedValue;
|
|
218
|
+
}
|
|
219
|
+
return attributeMutations;
|
|
220
|
+
}
|
|
221
|
+
export function sortAddedAndMovedNodes(nodes) {
|
|
222
|
+
nodes.sort((a, b) => {
|
|
223
|
+
const position = a.compareDocumentPosition(b);
|
|
224
|
+
/* eslint-disable no-bitwise */
|
|
225
|
+
if (position & Node.DOCUMENT_POSITION_CONTAINED_BY) {
|
|
226
|
+
return -1;
|
|
227
|
+
}
|
|
228
|
+
else if (position & Node.DOCUMENT_POSITION_CONTAINS) {
|
|
229
|
+
return 1;
|
|
230
|
+
}
|
|
231
|
+
else if (position & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
232
|
+
return 1;
|
|
233
|
+
}
|
|
234
|
+
else if (position & Node.DOCUMENT_POSITION_PRECEDING) {
|
|
235
|
+
return -1;
|
|
236
|
+
}
|
|
237
|
+
/* eslint-enable no-bitwise */
|
|
238
|
+
return 0;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function traverseRemovedShadowDom(removedNode, shadowDomRemovedCallback) {
|
|
242
|
+
if (isNodeShadowHost(removedNode)) {
|
|
243
|
+
shadowDomRemovedCallback(removedNode.shadowRoot);
|
|
244
|
+
}
|
|
245
|
+
forEachChildNodes(removedNode, (childNode) => traverseRemovedShadowDom(childNode, shadowDomRemovedCallback));
|
|
246
|
+
}
|
|
247
|
+
export function idsAreAssignedForNodeAndAncestors(node, nodeIds) {
|
|
248
|
+
let current = node;
|
|
249
|
+
while (current) {
|
|
250
|
+
if (nodeIds.get(current) === undefined && !isNodeShadowRoot(current)) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
current = getParentNode(current);
|
|
254
|
+
}
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=serializeMutations.js.map
|