@cloudcare/rum-uniapp 2.1.16 → 2.1.18

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 (39) hide show
  1. package/cjs/boot/buildEnv.js +1 -1
  2. package/cjs/boot/rum.entry.js +78 -56
  3. package/cjs/boot/rum.js +4 -3
  4. package/cjs/core/baseInfo.js +15 -1
  5. package/cjs/core/boundedBuffer.js +10 -6
  6. package/cjs/core/contextManager.js +84 -0
  7. package/cjs/core/dataMap.js +6 -1
  8. package/cjs/core/heavyCustomerDataWarning.js +31 -0
  9. package/cjs/core/transport.js +6 -28
  10. package/cjs/core/user.js +40 -0
  11. package/cjs/helper/byteUtils.js +39 -0
  12. package/cjs/helper/commonContext.js +14 -0
  13. package/cjs/helper/jsonStringify.js +57 -0
  14. package/cjs/helper/tracekit.js +23 -4
  15. package/cjs/helper/utils.js +160 -130
  16. package/cjs/rumEventsCollection/assembly.js +6 -1
  17. package/cjs/rumEventsCollection/error/errorCollection.js +20 -24
  18. package/cjs/rumEventsCollection/page/index.js +3 -2
  19. package/cjs/rumEventsCollection/resource/resourceCollection.js +3 -1
  20. package/esm/boot/buildEnv.js +1 -1
  21. package/esm/boot/rum.entry.js +74 -56
  22. package/esm/boot/rum.js +4 -2
  23. package/esm/core/baseInfo.js +13 -1
  24. package/esm/core/boundedBuffer.js +9 -6
  25. package/esm/core/contextManager.js +70 -0
  26. package/esm/core/dataMap.js +4 -0
  27. package/esm/core/heavyCustomerDataWarning.js +19 -0
  28. package/esm/core/transport.js +6 -29
  29. package/esm/core/user.js +31 -0
  30. package/esm/helper/byteUtils.js +29 -0
  31. package/esm/helper/commonContext.js +7 -0
  32. package/esm/helper/jsonStringify.js +46 -0
  33. package/esm/helper/tracekit.js +22 -4
  34. package/esm/helper/utils.js +144 -115
  35. package/esm/rumEventsCollection/assembly.js +6 -1
  36. package/esm/rumEventsCollection/error/errorCollection.js +20 -25
  37. package/esm/rumEventsCollection/page/index.js +4 -3
  38. package/esm/rumEventsCollection/resource/resourceCollection.js +2 -1
  39. package/package.json +43 -43
@@ -91,6 +91,7 @@ var report = function reportModuleWrapper() {
91
91
  installGlobalUnhandledRejectionHandler();
92
92
  installGlobalOnPageNotFoundHandler();
93
93
  installGlobalOnMemoryWarningHandler();
94
+ installGlobalOnLazyLoadErrorHandler();
94
95
  handlers.push(handler);
95
96
  }
96
97
  /**
@@ -138,7 +139,8 @@ var report = function reportModuleWrapper() {
138
139
  var onErrorHandlerInstalled;
139
140
  var onUnhandledRejectionHandlerInstalled;
140
141
  var onPageNotFoundHandlerInstalled;
141
- var onOnMemoryWarningHandlerInstalled;
142
+ var onMemoryWarningHandlerInstalled;
143
+ var onLazyLoadErrorHandlerInstalled;
142
144
  /**
143
145
  * Ensures all global unhandled exceptions are recorded.
144
146
  * Supported by Gecko and IE.
@@ -271,7 +273,7 @@ var report = function reportModuleWrapper() {
271
273
  }
272
274
 
273
275
  function installGlobalOnMemoryWarningHandler() {
274
- if (onOnMemoryWarningHandlerInstalled || !_sdk.sdk.onMemoryWarning) {
276
+ if (onMemoryWarningHandlerInstalled || !_sdk.sdk.onMemoryWarning) {
275
277
  return;
276
278
  }
277
279
 
@@ -304,7 +306,24 @@ var report = function reportModuleWrapper() {
304
306
  }, true, {});
305
307
  });
306
308
 
307
- onOnMemoryWarningHandlerInstalled = true;
309
+ onMemoryWarningHandlerInstalled = true;
310
+ }
311
+
312
+ function installGlobalOnLazyLoadErrorHandler() {
313
+ if (onLazyLoadErrorHandlerInstalled || !_sdk.sdk.onLazyLoadError) {
314
+ return;
315
+ }
316
+
317
+ _sdk.sdk.onLazyLoadError(function (res) {
318
+ var subpackage = res.subpackage || [];
319
+ notifyHandlers({
320
+ message: res.errMsg || '',
321
+ type: 'lazyloaderror',
322
+ name: subpackage.join(',') + 'load error'
323
+ }, true, {});
324
+ });
325
+
326
+ onLazyLoadErrorHandlerInstalled = true;
308
327
  }
309
328
  /**
310
329
  * Reports an unhandled Error.
@@ -919,7 +938,7 @@ exports.computeStackTrace = computeStackTrace;
919
938
  var ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;
920
939
 
921
940
  function extractMessage(ex) {
922
- var message = ex && ex.message;
941
+ var message = ex && ex.message; // console.log('message',message)
923
942
 
924
943
  if (!message) {
925
944
  return 'No error message';
@@ -7,7 +7,6 @@ exports.round = round;
7
7
  exports.toServerDuration = toServerDuration;
8
8
  exports.msToNs = msToNs;
9
9
  exports.UUID = UUID;
10
- exports.jsonStringify = jsonStringify;
11
10
  exports.elapsed = elapsed;
12
11
  exports.getMethods = getMethods;
13
12
  exports.replaceNumberCharByPath = replaceNumberCharByPath;
@@ -24,15 +23,19 @@ exports.escapeJsonValue = escapeJsonValue;
24
23
  exports.escapeFieldValueStr = escapeFieldValueStr;
25
24
  exports.escapeRowField = escapeRowField;
26
25
  exports.getOrigin = getOrigin;
27
- exports.createContextManager = createContextManager;
28
26
  exports.getActivePage = getActivePage;
29
27
  exports.findCommaSeparatedValue = findCommaSeparatedValue;
28
+ exports.getType = getType;
29
+ exports.mergeInto = mergeInto;
30
+ exports.deepClone = deepClone;
30
31
  exports.defineGlobal = defineGlobal;
31
32
  exports.getGlobalObject = getGlobalObject;
32
- exports.ONE_KILO_BYTE = exports.ONE_HOUR = exports.ONE_MINUTE = exports.ONE_SECOND = exports.deepMixObject = exports.defineObject = exports.getOwnObjectKeys = exports.urlParse = exports.throttle = exports.now = exports.safeJSONParse = exports.isJSONString = exports.isEmptyObject = exports.isObject = exports.trim = exports.extend2Lev = exports.extend = exports.getURLSearchParams = exports.getQueryParamsFromUrl = exports.base64Encode = exports.utf8Encode = exports.areInOrder = exports.toArray = exports.isArray = exports.isNumber = exports.isBoolean = exports.isFunction = exports.isDate = exports.isString = exports.isUndefined = exports.indexOf = exports.keys = exports.values = exports.each = exports.isArguments = void 0;
33
+ exports.ONE_HOUR = exports.ONE_MINUTE = exports.ONE_SECOND = exports.deepMixObject = exports.defineObject = exports.getOwnObjectKeys = exports.urlParse = exports.throttle = exports.now = exports.safeJSONParse = exports.isJSONString = exports.isEmptyObject = exports.isObject = exports.trim = exports.extend2Lev = exports.extend = exports.getURLSearchParams = exports.getQueryParamsFromUrl = exports.base64Encode = exports.utf8Encode = exports.areInOrder = exports.toArray = exports.isArray = exports.isFunction = exports.isNumber = exports.isBoolean = exports.isDate = exports.isString = exports.isUndefined = exports.indexOf = exports.keys = exports.values = exports.each = exports.isArguments = void 0;
33
34
 
34
35
  var _enums = require("./enums");
35
36
 
37
+ var _jsonStringify = require("../helper/jsonStringify");
38
+
36
39
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
37
40
 
38
41
  var ArrayProto = Array.prototype;
@@ -161,6 +164,18 @@ var isDate = function isDate(obj) {
161
164
 
162
165
  exports.isDate = isDate;
163
166
 
167
+ var isBoolean = function isBoolean(obj) {
168
+ return toString.call(obj) === '[object Boolean]';
169
+ };
170
+
171
+ exports.isBoolean = isBoolean;
172
+
173
+ var isNumber = function isNumber(obj) {
174
+ return toString.call(obj) === '[object Number]' && /[\d\.]+/.test(String(obj));
175
+ };
176
+
177
+ exports.isNumber = isNumber;
178
+
164
179
  var isFunction = function isFunction(f) {
165
180
  if (!f) {
166
181
  return false;
@@ -175,18 +190,6 @@ var isFunction = function isFunction(f) {
175
190
 
176
191
  exports.isFunction = isFunction;
177
192
 
178
- var isBoolean = function isBoolean(obj) {
179
- return toString.call(obj) === '[object Boolean]';
180
- };
181
-
182
- exports.isBoolean = isBoolean;
183
-
184
- var isNumber = function isNumber(obj) {
185
- return toString.call(obj) === '[object Number]' && /[\d\.]+/.test(String(obj));
186
- };
187
-
188
- exports.isNumber = isNumber;
189
-
190
193
  var isArray = nativeIsArray || function (obj) {
191
194
  return toString.call(obj) === '[object Array]';
192
195
  };
@@ -237,51 +240,6 @@ function UUID(placeholder) {
237
240
  (parseInt(placeholder, 10) ^ Math.random() * 16 >> parseInt(placeholder, 10) / 4).toString(16) : "".concat(1e7, "-", 1e3, "-", 4e3, "-", 8e3, "-", 1e11).replace(/[018]/g, UUID);
238
241
  }
239
242
 
240
- function jsonStringify(value, replacer, space) {
241
- if (value === null || value === undefined) {
242
- return JSON.stringify(value);
243
- }
244
-
245
- var originalToJSON = [false, undefined];
246
-
247
- if (hasToJSON(value)) {
248
- // We need to add a flag and not rely on the truthiness of value.toJSON
249
- // because it can be set but undefined and that's actually significant.
250
- originalToJSON = [true, value.toJSON];
251
- delete value.toJSON;
252
- }
253
-
254
- var originalProtoToJSON = [false, undefined];
255
- var prototype;
256
-
257
- if (_typeof(value) === 'object') {
258
- prototype = Object.getPrototypeOf(value);
259
-
260
- if (hasToJSON(prototype)) {
261
- originalProtoToJSON = [true, prototype.toJSON];
262
- delete prototype.toJSON;
263
- }
264
- }
265
-
266
- var result;
267
-
268
- try {
269
- result = JSON.stringify(value, undefined, space);
270
- } catch (e) {
271
- result = '<error: unable to serialize object>';
272
- } finally {
273
- if (originalToJSON[0]) {
274
- value.toJSON = originalToJSON[1];
275
- }
276
-
277
- if (originalProtoToJSON[0]) {
278
- prototype.toJSON = originalProtoToJSON[1];
279
- }
280
- }
281
-
282
- return result;
283
- }
284
-
285
243
  var utf8Encode = function utf8Encode(string) {
286
244
  string = (string + '').replace(/\r\n/g, '\n').replace(/\r/g, '\n');
287
245
  var utftext = '',
@@ -537,55 +495,48 @@ var safeJSONParse = function safeJSONParse(str) {
537
495
 
538
496
  exports.safeJSONParse = safeJSONParse;
539
497
 
540
- var now = function now() {
498
+ var now = Date.now || function () {
541
499
  return new Date().getTime();
542
500
  };
543
501
 
544
502
  exports.now = now;
545
503
 
546
- var throttle = function throttle(func, wait, options) {
547
- var timeout, context, args, result;
548
- var previous = 0;
549
- if (!options) options = {};
550
-
551
- var later = function later() {
552
- previous = options.leading === false ? 0 : new Date().getTime();
553
- timeout = null;
554
- result = func.apply(context, args);
555
- if (!timeout) context = args = null;
556
- };
557
-
558
- var throttled = function throttled() {
559
- args = arguments;
560
- var now = new Date().getTime();
561
- if (!previous && options.leading === false) previous = now; //下次触发 func 剩余的时间
562
-
563
- var remaining = wait - (now - previous);
564
- context = this; // 如果没有剩余的时间了或者你改了系统时间
565
-
566
- if (remaining <= 0 || remaining > wait) {
567
- if (timeout) {
568
- clearTimeout(timeout);
569
- timeout = null;
504
+ var throttle = function throttle(fn, wait, options) {
505
+ var needLeadingExecution = options && options.leading !== undefined ? options.leading : true;
506
+ var needTrailingExecution = options && options.trailing !== undefined ? options.trailing : true;
507
+ var inWaitPeriod = false;
508
+ var pendingExecutionWithParameters;
509
+ var pendingTimeoutId;
510
+ var context = this;
511
+ return {
512
+ throttled: function throttled() {
513
+ if (inWaitPeriod) {
514
+ pendingExecutionWithParameters = arguments;
515
+ return;
570
516
  }
571
517
 
572
- previous = now;
573
- result = func.apply(context, args);
574
- if (!timeout) context = args = null;
575
- } else if (!timeout && options.trailing !== false) {
576
- timeout = setTimeout(later, remaining);
577
- }
518
+ if (needLeadingExecution) {
519
+ fn.apply(context, arguments);
520
+ } else {
521
+ pendingExecutionWithParameters = arguments;
522
+ }
578
523
 
579
- return result;
580
- };
524
+ inWaitPeriod = true;
525
+ pendingTimeoutId = setTimeout(function () {
526
+ if (needTrailingExecution && pendingExecutionWithParameters) {
527
+ fn.apply(context, pendingExecutionWithParameters);
528
+ }
581
529
 
582
- throttled.cancel = function () {
583
- clearTimeout(timeout);
584
- previous = 0;
585
- timeout = null;
530
+ inWaitPeriod = false;
531
+ pendingExecutionWithParameters = undefined;
532
+ }, wait);
533
+ },
534
+ cancel: function cancel() {
535
+ clearTimeout(pendingTimeoutId);
536
+ inWaitPeriod = false;
537
+ pendingExecutionWithParameters = undefined;
538
+ }
586
539
  };
587
-
588
- return throttled;
589
540
  };
590
541
 
591
542
  exports.throttle = throttle;
@@ -647,7 +598,7 @@ function toSnakeCase(word) {
647
598
 
648
599
  function escapeRowData(str) {
649
600
  if (_typeof(str) === 'object' && str) {
650
- str = jsonStringify(str);
601
+ str = (0, _jsonStringify.jsonStringify)(str);
651
602
  } else if (!isString(str)) {
652
603
  return str;
653
604
  }
@@ -662,7 +613,7 @@ function escapeJsonValue(value) {
662
613
  if (isString(value)) {
663
614
  return value;
664
615
  } else {
665
- return jsonStringify(value);
616
+ return (0, _jsonStringify.jsonStringify)(value);
666
617
  }
667
618
  }
668
619
 
@@ -672,7 +623,7 @@ function escapeFieldValueStr(str) {
672
623
 
673
624
  function escapeRowField(value) {
674
625
  if (_typeof(value) === 'object' && value) {
675
- return escapeFieldValueStr(jsonStringify(value));
626
+ return escapeFieldValueStr((0, _jsonStringify.jsonStringify)(value));
676
627
  } else if (isString(value)) {
677
628
  return escapeFieldValueStr(value);
678
629
  } else {
@@ -841,32 +792,6 @@ function getOrigin(url) {
841
792
  return urlParse(url).getParse().Origin;
842
793
  }
843
794
 
844
- function createContextManager() {
845
- var context = {};
846
- return {
847
- get: function get() {
848
- return context;
849
- },
850
- add: function add(key, value) {
851
- if (isString(key)) {
852
- context[key] = value;
853
- } else {
854
- console.error('key 需要传递字符串类型');
855
- }
856
- },
857
- remove: function remove(key) {
858
- delete context[key];
859
- },
860
- set: function set(newContext) {
861
- if (isObject(newContext)) {
862
- context = newContext;
863
- } else {
864
- console.error('content 需要传递对象类型数据');
865
- }
866
- }
867
- };
868
- }
869
-
870
795
  function getActivePage() {
871
796
  var curPages = typeof getCurrentPages === 'function' ? getCurrentPages() : [];
872
797
 
@@ -882,14 +807,119 @@ function findCommaSeparatedValue(rawString, name) {
882
807
  return matches ? matches[1] : undefined;
883
808
  }
884
809
 
810
+ function createCircularReferenceChecker() {
811
+ if (typeof WeakSet !== 'undefined') {
812
+ var set = new WeakSet();
813
+ return {
814
+ hasAlreadyBeenSeen: function hasAlreadyBeenSeen(value) {
815
+ var has = set.has(value);
816
+
817
+ if (!has) {
818
+ set.add(value);
819
+ }
820
+
821
+ return has;
822
+ }
823
+ };
824
+ }
825
+
826
+ var array = [];
827
+ return {
828
+ hasAlreadyBeenSeen: function hasAlreadyBeenSeen(value) {
829
+ var has = array.indexOf(value) >= 0;
830
+
831
+ if (!has) {
832
+ array.push(value);
833
+ }
834
+
835
+ return has;
836
+ }
837
+ };
838
+ }
839
+ /**
840
+ * Similar to `typeof`, but distinguish plain objects from `null` and arrays
841
+ */
842
+
843
+
844
+ function getType(value) {
845
+ if (value === null) {
846
+ return 'null';
847
+ }
848
+
849
+ if (Array.isArray(value)) {
850
+ return 'array';
851
+ }
852
+
853
+ return _typeof(value);
854
+ }
855
+ /**
856
+ * Iterate over source and affect its sub values into destination, recursively.
857
+ * If the source and destination can't be merged, return source.
858
+ */
859
+
860
+
861
+ function mergeInto(destination, source, circularReferenceChecker) {
862
+ // ignore the source if it is undefined
863
+ if (typeof circularReferenceChecker === 'undefined') {
864
+ circularReferenceChecker = createCircularReferenceChecker();
865
+ }
866
+
867
+ if (source === undefined) {
868
+ return destination;
869
+ }
870
+
871
+ if (_typeof(source) !== 'object' || source === null) {
872
+ // primitive values - just return source
873
+ return source;
874
+ } else if (source instanceof Date) {
875
+ return new Date(source.getTime());
876
+ } else if (source instanceof RegExp) {
877
+ var flags = source.flags || // old browsers compatibility
878
+ [source.global ? 'g' : '', source.ignoreCase ? 'i' : '', source.multiline ? 'm' : '', source.sticky ? 'y' : '', source.unicode ? 'u' : ''].join('');
879
+ return new RegExp(source.source, flags);
880
+ }
881
+
882
+ if (circularReferenceChecker.hasAlreadyBeenSeen(source)) {
883
+ // remove circular references
884
+ return undefined;
885
+ } else if (Array.isArray(source)) {
886
+ var merged = Array.isArray(destination) ? destination : [];
887
+
888
+ for (var i = 0; i < source.length; ++i) {
889
+ merged[i] = mergeInto(merged[i], source[i], circularReferenceChecker);
890
+ }
891
+
892
+ return merged;
893
+ }
894
+
895
+ var merged = getType(destination) === 'object' ? destination : {};
896
+
897
+ for (var key in source) {
898
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
899
+ merged[key] = mergeInto(merged[key], source[key], circularReferenceChecker);
900
+ }
901
+ }
902
+
903
+ return merged;
904
+ }
905
+ /**
906
+ * A simplistic implementation of a deep clone algorithm.
907
+ * Caveats:
908
+ * - It doesn't maintain prototype chains - don't use with instances of custom classes.
909
+ * - It doesn't handle Map and Set
910
+ */
911
+
912
+
913
+ function deepClone(value) {
914
+ return mergeInto(undefined, value);
915
+ }
916
+
885
917
  var ONE_SECOND = 1000;
886
918
  exports.ONE_SECOND = ONE_SECOND;
887
919
  var ONE_MINUTE = 60 * ONE_SECOND;
888
920
  exports.ONE_MINUTE = ONE_MINUTE;
889
921
  var ONE_HOUR = 60 * ONE_MINUTE;
890
922
  exports.ONE_HOUR = ONE_HOUR;
891
- var ONE_KILO_BYTE = 1024;
892
- exports.ONE_KILO_BYTE = ONE_KILO_BYTE;
893
923
 
894
924
  function defineGlobal(global, name, api) {
895
925
  global[name] = api;
@@ -34,6 +34,11 @@ function startRumAssembly(applicationId, configuration, session, lifeCycle, pare
34
34
  var deviceContext = {
35
35
  device: _baseInfo["default"].deviceInfo
36
36
  };
37
+ var appContext = {
38
+ app: {
39
+ launch: _baseInfo["default"].getLaunchOptions()
40
+ }
41
+ };
37
42
 
38
43
  if (session.isTracked() && (viewContext || rawRumEvent.type === _enums.RumEventType.APP)) {
39
44
  var actionContext = parentContexts.findAction(startTime);
@@ -61,7 +66,7 @@ function startRumAssembly(applicationId, configuration, session, lifeCycle, pare
61
66
  is_signin: configuration.user_id ? 'T' : 'F'
62
67
  }
63
68
  };
64
- var rumEvent = (0, _utils.extend2Lev)(rumContext, deviceContext, viewContext, actionContext, rawRumEvent);
69
+ var rumEvent = (0, _utils.extend2Lev)(rumContext, deviceContext, appContext, viewContext, actionContext, rawRumEvent);
65
70
  var serverRumEvent = (0, _utils.withSnakeCaseKeys)(rumEvent);
66
71
  var context = (0, _utils.extend2Lev)({}, commonContext.context, customerContext);
67
72
 
@@ -12,14 +12,13 @@ var _enums = require("../../helper/enums");
12
12
 
13
13
  var _lifeCycle = require("../../core/lifeCycle");
14
14
 
15
+ var _errorTools = require("../../core/errorTools");
16
+
15
17
  var _utils = require("../../helper/utils");
16
18
 
19
+ var _tracekit = require("../../helper/tracekit");
20
+
17
21
  function startErrorCollection(lifeCycle, configuration) {
18
- // return doStartErrorCollection(
19
- // lifeCycle,
20
- // configuration,
21
- // startAutomaticErrorCollection(configuration),
22
- // )
23
22
  (0, _errorCollection.startAutomaticErrorCollection)(configuration).subscribe(function (error) {
24
23
  lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_ERROR_COLLECTED, {
25
24
  error: error
@@ -33,28 +32,24 @@ function doStartErrorCollection(lifeCycle) {
33
32
  lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processError(error.error));
34
33
  });
35
34
  return {
36
- addError: function addError(customError, savedCommonContext) {// var rawError = computeRawError(
37
- // customError.error,
38
- // customError.startTime,
39
- // customError.source
40
- // )
41
- // lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, {
42
- // customerContext: customError.context,
43
- // savedCommonContext: savedCommonContext,
44
- // error: rawError
45
- // })
35
+ addError: function addError(customError, savedCommonContext) {
36
+ var rawError = computeRawError(customError.error, customError.startTime, customError.context);
37
+ lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_ERROR_COLLECTED, {
38
+ savedCommonContext: savedCommonContext,
39
+ error: rawError
40
+ });
46
41
  }
47
42
  };
48
- } // function computeRawError(error, handlingStack, startClocks) {
49
- // const stackTrace = error instanceof Error ? computeStackTrace(error) : undefined
50
- // return extend({
51
- // startClocks,
52
- // source: ErrorSource.CUSTOM,
53
- // originalError: error,
54
- // handling: ErrorHandling.HANDLED
55
- // }, formatUnknownError(stackTrace, error, 'Provided', handlingStack) )
56
- // }
43
+ }
57
44
 
45
+ function computeRawError(error, startTime, context) {
46
+ var stackTrace = error instanceof Error ? (0, _tracekit.computeStackTrace)(error) : undefined;
47
+ return (0, _utils.extend)({
48
+ startTime: startTime,
49
+ source: _errorTools.ErrorSource.CUSTOM,
50
+ context: context
51
+ }, (0, _errorTools.formatUnknownError)(stackTrace, error, 'Provided'));
52
+ }
58
53
 
59
54
  function processError(error) {
60
55
  var resource = error.resource;
@@ -87,6 +82,7 @@ function processError(error) {
87
82
  type: _enums.RumEventType.ERROR
88
83
  }, tracingInfo);
89
84
  return {
85
+ customerContext: error.context,
90
86
  rawRumEvent: rawRumEvent,
91
87
  startTime: error.startTime
92
88
  };
@@ -99,10 +99,11 @@ function newView(lifeCycle, route, startTime) {
99
99
  startTime: startTime,
100
100
  route: route
101
101
  });
102
- var scheduleViewUpdate = (0, _utils.throttle)(triggerViewUpdate, THROTTLE_VIEW_UPDATE_PERIOD, {
102
+ var scheduleViewThrottled = (0, _utils.throttle)(triggerViewUpdate, THROTTLE_VIEW_UPDATE_PERIOD, {
103
103
  leading: false
104
104
  });
105
- var cancelScheduleViewUpdate = scheduleViewUpdate.cancel;
105
+ var scheduleViewUpdate = scheduleViewThrottled.throttled;
106
+ var cancelScheduleViewUpdate = scheduleViewThrottled.cancel;
106
107
 
107
108
  var _trackEventCounts = (0, _trackEventCounts2.trackEventCounts)(lifeCycle, function (newEventCounts) {
108
109
  eventCounts = newEventCounts;
@@ -11,6 +11,8 @@ var _lifeCycle = require("../../core/lifeCycle");
11
11
 
12
12
  var _utils = require("../../helper/utils");
13
13
 
14
+ var _jsonStringify = require("../../helper/jsonStringify");
15
+
14
16
  var _enums = require("../../helper/enums");
15
17
 
16
18
  function startResourceCollection(lifeCycle, configuration) {
@@ -38,7 +40,7 @@ function processRequest(request) {
38
40
  urlHost: urlObj.Host,
39
41
  urlPath: urlObj.Path,
40
42
  urlPathGroup: (0, _utils.replaceNumberCharByPath)(urlObj.Path),
41
- urlQuery: (0, _utils.jsonStringify)((0, _utils.getQueryParamsFromUrl)(request.url))
43
+ urlQuery: (0, _jsonStringify.jsonStringify)((0, _utils.getQueryParamsFromUrl)(request.url))
42
44
  },
43
45
  type: _enums.RumEventType.RESOURCE
44
46
  }, tracingInfo, correspondingTimingOverrides);
@@ -1,4 +1,4 @@
1
1
  export var buildEnv = {
2
- sdkVersion: '2.1.16',
2
+ sdkVersion: '2.1.18',
3
3
  sdkName: 'df_uniapp_rum_sdk'
4
4
  };