@cloudcare/browser-rum 3.3.1 → 3.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/bundle/dataflux-rum.js +1 -1
  2. package/cjs/boot/buildEnv.js +1 -1
  3. package/cjs/boot/perStartRum.js +11 -7
  4. package/cjs/boot/perStartRum.js.map +1 -1
  5. package/cjs/boot/recorderApi.js +2 -49
  6. package/cjs/boot/recorderApi.js.map +1 -1
  7. package/cjs/boot/recorderApiStub.js +53 -0
  8. package/cjs/boot/recorderApiStub.js.map +1 -0
  9. package/cjs/boot/rum.entry.js +6 -7
  10. package/cjs/boot/rum.entry.js.map +1 -1
  11. package/cjs/boot/rum.slim.entry.js +13 -0
  12. package/cjs/boot/rum.slim.entry.js.map +1 -0
  13. package/cjs/boot/rumEntryFactory.js +15 -0
  14. package/cjs/boot/rumEntryFactory.js.map +1 -0
  15. package/cjs/boot/rumPublicApi.js +8 -57
  16. package/cjs/boot/rumPublicApi.js.map +1 -1
  17. package/cjs/boot/rumRecorderApiStub.js +19 -0
  18. package/cjs/boot/rumRecorderApiStub.js.map +1 -0
  19. package/cjs/boot/rumSlimConfiguration.js +16 -0
  20. package/cjs/boot/rumSlimConfiguration.js.map +1 -0
  21. package/cjs/boot/sessionReplayPublicApi.js +62 -0
  22. package/cjs/boot/sessionReplayPublicApi.js.map +1 -0
  23. package/cjs/domain/deflate/deflateEncoder.js +2 -4
  24. package/cjs/domain/deflate/deflateEncoder.js.map +1 -1
  25. package/cjs/domain/deflate/deflateWorker.js +1 -1
  26. package/cjs/domain/encoderStreamId.js +11 -0
  27. package/cjs/domain/encoderStreamId.js.map +1 -0
  28. package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
  29. package/cjs/transport/startRumBatch.js +2 -2
  30. package/cjs/transport/startRumBatch.js.map +1 -1
  31. package/esm/boot/buildEnv.js +1 -1
  32. package/esm/boot/perStartRum.js +11 -7
  33. package/esm/boot/perStartRum.js.map +1 -1
  34. package/esm/boot/recorderApi.js +2 -49
  35. package/esm/boot/recorderApi.js.map +1 -1
  36. package/esm/boot/recorderApiStub.js +47 -0
  37. package/esm/boot/recorderApiStub.js.map +1 -0
  38. package/esm/boot/rum.entry.js +6 -7
  39. package/esm/boot/rum.entry.js.map +1 -1
  40. package/esm/boot/rum.slim.entry.js +7 -0
  41. package/esm/boot/rum.slim.entry.js.map +1 -0
  42. package/esm/boot/rumEntryFactory.js +9 -0
  43. package/esm/boot/rumEntryFactory.js.map +1 -0
  44. package/esm/boot/rumPublicApi.js +8 -57
  45. package/esm/boot/rumPublicApi.js.map +1 -1
  46. package/esm/boot/rumRecorderApiStub.js +13 -0
  47. package/esm/boot/rumRecorderApiStub.js.map +1 -0
  48. package/esm/boot/rumSlimConfiguration.js +10 -0
  49. package/esm/boot/rumSlimConfiguration.js.map +1 -0
  50. package/esm/boot/sessionReplayPublicApi.js +56 -0
  51. package/esm/boot/sessionReplayPublicApi.js.map +1 -0
  52. package/esm/domain/deflate/deflateEncoder.js +2 -4
  53. package/esm/domain/deflate/deflateEncoder.js.map +1 -1
  54. package/esm/domain/deflate/deflateWorker.js +1 -1
  55. package/esm/domain/encoderStreamId.js +5 -0
  56. package/esm/domain/encoderStreamId.js.map +1 -0
  57. package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
  58. package/esm/transport/startRumBatch.js +2 -2
  59. package/esm/transport/startRumBatch.js.map +1 -1
  60. package/package.json +4 -4
  61. package/src/boot/perStartRum.js +11 -7
  62. package/src/boot/recorderApi.js +2 -49
  63. package/src/boot/recorderApiStub.js +47 -0
  64. package/src/boot/rum.entry.js +6 -8
  65. package/src/boot/rum.slim.entry.js +7 -0
  66. package/src/boot/rumEntryFactory.js +10 -0
  67. package/src/boot/rumPublicApi.js +14 -57
  68. package/src/boot/rumRecorderApiStub.js +14 -0
  69. package/src/boot/rumSlimConfiguration.js +11 -0
  70. package/src/boot/sessionReplayPublicApi.js +57 -0
  71. package/src/domain/deflate/deflateEncoder.js +2 -4
  72. package/src/domain/encoderStreamId.js +5 -0
  73. package/src/transport/startRumBatch.js +2 -2
@@ -60,7 +60,7 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
60
60
  resourceTrackerManager: resourceTrackerManager
61
61
  }),
62
62
  getCommonContext,
63
- function (configuration, deflateWorker, initialViewOptions) {
63
+ function (configuration, compressionWorker, initialViewOptions) {
64
64
  if (configuration.storeContextsToLocal) {
65
65
  storeContextManager(
66
66
  configuration,
@@ -76,7 +76,7 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
76
76
  )
77
77
  }
78
78
  customerDataTrackerManager.setCompressionStatus(
79
- deflateWorker
79
+ compressionWorker
80
80
  ? CustomerDataCompressionStatus.Enabled
81
81
  : CustomerDataCompressionStatus.Disabled
82
82
  )
@@ -86,9 +86,12 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
86
86
  customerDataTrackerManager,
87
87
  getCommonContext,
88
88
  initialViewOptions,
89
- deflateWorker && options.createDeflateEncoder
89
+ compressionWorker && options.createCompressionEncoder
90
90
  ? function (streamId) {
91
- return options.createDeflateEncoder(deflateWorker, streamId)
91
+ return options.createCompressionEncoder(
92
+ compressionWorker,
93
+ streamId
94
+ )
92
95
  }
93
96
  : createIdentityEncoder,
94
97
  resourceTrackerManager
@@ -98,7 +101,7 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
98
101
  configuration,
99
102
  startRumResult.session,
100
103
  startRumResult.viewContexts,
101
- deflateWorker
104
+ compressionWorker
102
105
  )
103
106
 
104
107
  strategy = createPostStartStrategy(strategy, startRumResult)
@@ -119,7 +122,11 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
119
122
  addTelemetryUsage({ feature: 'start-view' })
120
123
  })
121
124
 
122
- var rumPublicApi = makePublicApi({
125
+ const recorderPublicApi = options.makeRecorderPublicApi
126
+ ? options.makeRecorderPublicApi(recorderApi)
127
+ : {}
128
+
129
+ var rumPublicApi = makePublicApi(assign({
123
130
  init: monitor(function (initConfiguration) {
124
131
  strategy.init(initConfiguration)
125
132
  }),
@@ -286,56 +293,6 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
286
293
  strategy.setForcedSession()
287
294
  addTelemetryUsage({ feature: 'set-forced-session' })
288
295
  }),
289
- startSessionReplayRecording: monitor(function (options) {
290
- recorderApi.start(options)
291
- addTelemetryUsage({
292
- feature: 'start-session-replay-recording',
293
- force: options && options.force
294
- })
295
- }),
296
- isRecording: monitor(function () {
297
- return recorderApi.isRecording()
298
- }),
299
- stopSessionReplayRecording: monitor(recorderApi.stop),
300
- takeSubsequentFullSnapshot: monitor(recorderApi.takeSubsequentFullSnapshot),
301
- snapshotCanvas: monitor(function (canvas, options) {
302
- return recorderApi.snapshotCanvas(canvas, options)
303
- }),
304
- getSerializedNodeIdForDebug: monitor(function (node) {
305
- return recorderApi.getSerializedNodeIdForDebug(node)
306
- }),
307
- getLastAutoCanvasSnapshotResultForDebug: monitor(function () {
308
- return recorderApi.getLastAutoCanvasSnapshotResultForDebug()
309
- }),
310
- getAutoCanvasSnapshotDebugHistoryForDebug: monitor(function () {
311
- return recorderApi.getAutoCanvasSnapshotDebugHistoryForDebug()
312
- }),
313
- getLastCanvasMutationForDebug: monitor(function () {
314
- return recorderApi.getLastCanvasMutationForDebug()
315
- }),
316
- getCanvasMutationHistoryForDebug: monitor(function () {
317
- return recorderApi.getCanvasMutationHistoryForDebug()
318
- }),
319
- getLastDomMutationForDebug: monitor(function () {
320
- return recorderApi.getLastDomMutationForDebug()
321
- }),
322
- getDomMutationHistoryForDebug: monitor(function () {
323
- return recorderApi.getDomMutationHistoryForDebug()
324
- }),
325
- getLastReplaySegmentFlushForDebug: monitor(function () {
326
- return recorderApi.getLastReplaySegmentFlushForDebug()
327
- }),
328
- getReplaySegmentFlushHistoryForDebug: monitor(function () {
329
- return recorderApi.getReplaySegmentFlushHistoryForDebug()
330
- }),
331
- getReplayPerformanceForDebug: monitor(function () {
332
- return recorderApi.getReplayPerformanceForDebug()
333
- }),
334
- flushReplayMutationsForDebug: monitor(function () {
335
- if (recorderApi.flushReplayMutationsForDebug) {
336
- recorderApi.flushReplayMutationsForDebug()
337
- }
338
- }),
339
296
  createResourceTrackerId: monitor(function () {
340
297
  return resourceTrackerManager.createTrackerId()
341
298
  }),
@@ -357,7 +314,7 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
357
314
  getResource: monitor(function (trackerId) {
358
315
  return resourceTrackerManager.getResource(trackerId)
359
316
  })
360
- })
317
+ }, recorderPublicApi))
361
318
  return rumPublicApi
362
319
  }
363
320
  function createPostStartStrategy(preStartStrategy, startRumResult) {
@@ -0,0 +1,14 @@
1
+ import { noop } from '@cloudcare/browser-core'
2
+
3
+ export function makeRumRecorderApiStub() {
4
+ return {
5
+ getReplayStats: function () {
6
+ return undefined
7
+ },
8
+ onRumStart: noop,
9
+ isRecording: function () {
10
+ return false
11
+ }
12
+ }
13
+ }
14
+
@@ -0,0 +1,11 @@
1
+ import { assign } from '@cloudcare/browser-core'
2
+
3
+ export function forceRumSlimConfiguration(initConfiguration) {
4
+ return assign({}, initConfiguration, {
5
+ sessionReplaySampleRate: 0,
6
+ sessionReplayOnErrorSampleRate: 0,
7
+ replayCanvasEnabled: false,
8
+ compressIntakeRequests: false
9
+ })
10
+ }
11
+
@@ -0,0 +1,57 @@
1
+ import { addTelemetryUsage, monitor } from '@cloudcare/browser-core'
2
+
3
+ export function makeSessionReplayPublicApi(recorderApi) {
4
+ return {
5
+ startSessionReplayRecording: monitor(function (options) {
6
+ recorderApi.start(options)
7
+ addTelemetryUsage({
8
+ feature: 'start-session-replay-recording',
9
+ force: options && options.force
10
+ })
11
+ }),
12
+ isRecording: monitor(function () {
13
+ return recorderApi.isRecording()
14
+ }),
15
+ stopSessionReplayRecording: monitor(recorderApi.stop),
16
+ takeSubsequentFullSnapshot: monitor(recorderApi.takeSubsequentFullSnapshot),
17
+ snapshotCanvas: monitor(function (canvas, options) {
18
+ return recorderApi.snapshotCanvas(canvas, options)
19
+ }),
20
+ getSerializedNodeIdForDebug: monitor(function (node) {
21
+ return recorderApi.getSerializedNodeIdForDebug(node)
22
+ }),
23
+ getLastAutoCanvasSnapshotResultForDebug: monitor(function () {
24
+ return recorderApi.getLastAutoCanvasSnapshotResultForDebug()
25
+ }),
26
+ getAutoCanvasSnapshotDebugHistoryForDebug: monitor(function () {
27
+ return recorderApi.getAutoCanvasSnapshotDebugHistoryForDebug()
28
+ }),
29
+ getLastCanvasMutationForDebug: monitor(function () {
30
+ return recorderApi.getLastCanvasMutationForDebug()
31
+ }),
32
+ getCanvasMutationHistoryForDebug: monitor(function () {
33
+ return recorderApi.getCanvasMutationHistoryForDebug()
34
+ }),
35
+ getLastDomMutationForDebug: monitor(function () {
36
+ return recorderApi.getLastDomMutationForDebug()
37
+ }),
38
+ getDomMutationHistoryForDebug: monitor(function () {
39
+ return recorderApi.getDomMutationHistoryForDebug()
40
+ }),
41
+ getLastReplaySegmentFlushForDebug: monitor(function () {
42
+ return recorderApi.getLastReplaySegmentFlushForDebug()
43
+ }),
44
+ getReplaySegmentFlushHistoryForDebug: monitor(function () {
45
+ return recorderApi.getReplaySegmentFlushHistoryForDebug()
46
+ }),
47
+ getReplayPerformanceForDebug: monitor(function () {
48
+ return recorderApi.getReplayPerformanceForDebug()
49
+ }),
50
+ flushReplayMutationsForDebug: monitor(function () {
51
+ if (recorderApi.flushReplayMutationsForDebug) {
52
+ recorderApi.flushReplayMutationsForDebug()
53
+ }
54
+ })
55
+ }
56
+ }
57
+
@@ -4,10 +4,8 @@ import {
4
4
  addTelemetryDebug,
5
5
  assign
6
6
  } from '@cloudcare/browser-core'
7
- export var DeflateEncoderStreamId = {
8
- REPLAY: 1,
9
- RUM: 2
10
- }
7
+ import { EncoderStreamId } from '../encoderStreamId'
8
+ export var DeflateEncoderStreamId = EncoderStreamId
11
9
  export function createDeflateEncoder(worker, streamId) {
12
10
  var rawBytesCount = 0
13
11
  var compressedData = []
@@ -0,0 +1,5 @@
1
+ export var EncoderStreamId = {
2
+ REPLAY: 1,
3
+ RUM: 2
4
+ }
5
+
@@ -3,7 +3,7 @@ import {
3
3
  RumEventType,
4
4
  startBatchWithReplica
5
5
  } from '@cloudcare/browser-core'
6
- import { DeflateEncoderStreamId } from '../domain/deflate'
6
+ import { EncoderStreamId } from '../domain/encoderStreamId'
7
7
  export function startRumBatch(
8
8
  configuration,
9
9
  lifeCycle,
@@ -17,7 +17,7 @@ export function startRumBatch(
17
17
  configuration,
18
18
  {
19
19
  endpoint: configuration.rumEndpoint,
20
- encoder: createEncoder(DeflateEncoderStreamId.RUM)
20
+ encoder: createEncoder(EncoderStreamId.RUM)
21
21
  },
22
22
  reportError,
23
23
  pageExitObservable,